LuaJit 1.1.0 coredump on FreeBSD

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

LuaJit 1.1.0 coredump on FreeBSD

Jim Mellander
I've been using Luajit 1.0.3 for my application with no problems on
FreeBSD 4.10

I built LuaJIT 1.1.0 ('make bsd') on the same system, and get the
following problem:

-bash-3.00$ luajit
Lua 5.1  Copyright (C) 1994-2006 Lua.org, PUC-Rio
LuaJIT 1.1.0  Copyright (C) 2005-2006 Mike Pall
 > print(os.clock())
Illegal instruction (core dumped)

Other examples:

-bash-3.00$ luajit
Lua 5.1  Copyright (C) 1994-2006 Lua.org, PUC-Rio
LuaJIT 1.1.0  Copyright (C) 2005-2006 Mike Pall
 > for i=1,1000000 do end
 > x=0
Illegal instruction (core dumped)

-bash-3.00$ luajit
Lua 5.1  Copyright (C) 1994-2006 Lua.org, PUC-Rio
LuaJIT 1.1.0  Copyright (C) 2005-2006 Mike Pall
 > x=0
Illegal instruction (core dumped)

Any ideas how to proceed?

Reply | Threaded
Open this post in threaded view
|

Re: LuaJit 1.1.0 coredump on FreeBSD

Mike Pall-3-2
Hi,

Jim Mellander wrote:
> I've been using Luajit 1.0.3 for my application with no problems on
> FreeBSD 4.10
>
> I built LuaJIT 1.1.0 ('make bsd') on the same system, and get the
> following problem:
> [...]
> Illegal instruction (core dumped)

This looks like a problem with SSE2 code generation. It seems
your kernel doesn't know how to deal with it even though your CPU
supports it?

I don't have access to a system with such an old version of
FreeBSD. But a little research shows that SSE support must be
explicitly enabled for 4.x with 'options CPU_ENABLE_SSE'. If your
kernel doesn't have this, then you need to recompile it with this
option.

Bye,
     Mike
Reply | Threaded
Open this post in threaded view
|

Re: LuaJit 1.1.0 coredump on FreeBSD

Jim Mellander
Hi Mike:

Thanks for your quick response.  It indeed looks like SSE is not enabled
in the kernel per:

$ sysctl hw.instruction_sse
hw.instruction_sse: 0

However, this is a production kernel, for which any changes need to go
thru a time-consuming QA process, as well as requiring me to run the
gauntlet of fascist system administration :-(   Under the circumstances,
I would prefer to take the performance hit by sinking back into the
pre-SSE days.  I didn't see any option for disabling the use of SSE in
the Luajit code - can this be done via a define?  Alternatively, is
there some way to detect that although the CPU supports SSE, the kernel
doesn't, and dynamically disable that code under the circumstances?


Thanks in advance.


Mike Pall wrote:

> Hi,
>
> Jim Mellander wrote:
>
>>I've been using Luajit 1.0.3 for my application with no problems on
>>FreeBSD 4.10
>>
>>I built LuaJIT 1.1.0 ('make bsd') on the same system, and get the
>>following problem:
>>[...]
>>Illegal instruction (core dumped)
>
>
> This looks like a problem with SSE2 code generation. It seems
> your kernel doesn't know how to deal with it even though your CPU
> supports it?
>
> I don't have access to a system with such an old version of
> FreeBSD. But a little research shows that SSE support must be
> explicitly enabled for 4.x with 'options CPU_ENABLE_SSE'. If your
> kernel doesn't have this, then you need to recompile it with this
> option.
>
> Bye,
>      Mike
>

--
Jim Mellander
Incident Response Manager
Computer Protection Program
Lawrence Berkeley National Laboratory
(510) 486-7204

Your fortune for today is:

Let us never negotiate out of fear, but let us never fear to negotiate.
                -- John F. Kennedy

Reply | Threaded
Open this post in threaded view
|

Re: LuaJit 1.1.0 coredump on FreeBSD

Mike Pall-3-2
Hi,

Jim Mellander wrote:
> I would prefer to take the performance hit by sinking back into the
> pre-SSE days.  I didn't see any option for disabling the use of SSE in
> the Luajit code - can this be done via a define?

Workaround: redefine JIT_F_CPU_SSE2 in src/ljit.h to 0.

> Alternatively, is
> there some way to detect that although the CPU supports SSE, the kernel
> doesn't, and dynamically disable that code under the circumstances?

The CPUID detection is in fact designed to do exactly this (to
benefit older operating systems). But apparently FreeBSD 4.x
doesn't play by the rules if the option is disabled. AFAIK it has
been fixed in newer versions.

> However, this is a production kernel, for which any changes need to go
> thru a time-consuming QA process, as well as requiring me to run the
> gauntlet of fascist system administration :-(

Never surrender to bureaucracies. Queue one change request now
and get what you need in a few months. Queue three change
requests every day and within two weeks you get your own box.

Bye,
     Mike
Reply | Threaded
Open this post in threaded view
|

Re: LuaJit 1.1.0 coredump on FreeBSD

Jim Mellander
Thanks for the info, I'll try it.

You ain't seen bureaucracies until you've seen a .gov bureaucracy!  Your
workaround should get me by while waiting for the wheels of government
bureaucracy to laboriously turn over, or until they gum up completely....


Mike Pall wrote:

> Hi,
>
> Jim Mellander wrote:
>
>>I would prefer to take the performance hit by sinking back into the
>>pre-SSE days.  I didn't see any option for disabling the use of SSE in
>>the Luajit code - can this be done via a define?
>
>
> Workaround: redefine JIT_F_CPU_SSE2 in src/ljit.h to 0.
>
>
>>Alternatively, is
>>there some way to detect that although the CPU supports SSE, the kernel
>>doesn't, and dynamically disable that code under the circumstances?
>
>
> The CPUID detection is in fact designed to do exactly this (to
> benefit older operating systems). But apparently FreeBSD 4.x
> doesn't play by the rules if the option is disabled. AFAIK it has
> been fixed in newer versions.
>
>
>>However, this is a production kernel, for which any changes need to go
>>thru a time-consuming QA process, as well as requiring me to run the
>>gauntlet of fascist system administration :-(
>
>
> Never surrender to bureaucracies. Queue one change request now
> and get what you need in a few months. Queue three change
> requests every day and within two weeks you get your own box.
>
> Bye,
>      Mike
>

--
Jim Mellander
Incident Response Manager
Computer Protection Program
Lawrence Berkeley National Laboratory
(510) 486-7204

Your fortune for today is:

When in doubt, lead trump.

Reply | Threaded
Open this post in threaded view
|

Re: LuaJit 1.1.0 coredump on FreeBSD

Jim Mellander
The workaround has allowed me to forge ahead while waiting on the .gov
bureaucracy (thanks, Mike!).  However, running my code with luajit -O
(as opposed to plain luajit) gives the following, but does not impair
the running of the program - I infer this means that the optimizer was
turned off:

ERROR: jit.opt disabled: /usr/local/share/lua/5.1/jit/opt_lib.lua:190:
attempt to perform arithmetic on field 'INLINE_IDX' (a nil value)


Jim Mellander wrote:

> Thanks for the info, I'll try it.
>
> You ain't seen bureaucracies until you've seen a .gov bureaucracy!  Your
> workaround should get me by while waiting for the wheels of government
> bureaucracy to laboriously turn over, or until they gum up completely....
>
>
> Mike Pall wrote:
>
>> Hi,
>>
>> Jim Mellander wrote:
>>
>>> I would prefer to take the performance hit by sinking back into the
>>> pre-SSE days.  I didn't see any option for disabling the use of SSE
>>> in the Luajit code - can this be done via a define?
>>
>>
>>
>> Workaround: redefine JIT_F_CPU_SSE2 in src/ljit.h to 0.
>>
>>
>>> Alternatively, is there some way to detect that although the CPU
>>> supports SSE, the kernel doesn't, and dynamically disable that code
>>> under the circumstances?
>>
>>
>>
>> The CPUID detection is in fact designed to do exactly this (to
>> benefit older operating systems). But apparently FreeBSD 4.x
>> doesn't play by the rules if the option is disabled. AFAIK it has
>> been fixed in newer versions.
>>
>>
>>> However, this is a production kernel, for which any changes need to go
>>> thru a time-consuming QA process, as well as requiring me to run the
>>> gauntlet of fascist system administration :-(
>>
>>
>>
>> Never surrender to bureaucracies. Queue one change request now
>> and get what you need in a few months. Queue three change
>> requests every day and within two weeks you get your own box.
>>
>> Bye,
>>      Mike
>>
>

--
Jim Mellander
Incident Response Manager
Computer Protection Program
Lawrence Berkeley National Laboratory
(510) 486-7204

Your fortune for today is:

The eyes of taxes are upon you.

Reply | Threaded
Open this post in threaded view
|

Re: LuaJit 1.1.0 coredump on FreeBSD

Mike Pall-4-2
Hi,

Jim Mellander wrote:
> ERROR: jit.opt disabled: /usr/local/share/lua/5.1/jit/opt_lib.lua:190:
> attempt to perform arithmetic on field 'INLINE_IDX' (a nil value)

Well, there's a reason why luajit_install.html has a section
called "Upgrading From Previous Versions". :-)

It seems you are using the LuaJIT 1.1.0 executable with the
LuaJIT 1.0.3 jit.* library files. Be sure to delete the files
from the old version (all instances in the Lua search path!) and
install the new ones.

Starting with LuaJIT 1.1.0 the library files actually complain
loudly if they are used with the wrong version. ;-)

Bye,
     Mike