[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: camlSys__entry vs. FreeBSD kmod



On 11 Jul 2012, at 12:37, Anil Madhavapeddy wrote:

> So Sys__entry is the native code entry point for the Sys module, which
> will execute any top-level phrases. Looking at stdlib/sys.mlp, we have:
> 
> external get_config: unit -> string * int * bool = "caml_sys_get_config"
> external get_argv: unit -> string * string array = "caml_sys_get_argv"
> 
> let (executable_name, argv) = get_argv()
> let (os_type, word_size, big_endian) = get_config()
> let max_array_length = (1 lsl (word_size - 10)) - 1;;
> let max_string_length = word_size / 8 * max_array_length - 1;;
> 
> Can you put a printk into caml_sys_get_argv to see if its getting called,
> and that you are getting past it?  That would be a likely source of the
> crash (although I wonder why it doesnt show up in the backtrace).

The panic message isn't included, but I'd generally caution that kernel stacks 
are, by default, Quite Small, so do keep an eye out for red zone-related panics 
from stack overflow. (I can't remember if FreeBSD always inserts unmapped pages 
below all kernel stacks -- if it's optional, you definitely want it on). You 
should also be able to configure larger stacks and may want to do so. One 
approach here to get a sense of whether you're likely run into problems is to 
monitor stack size on the same OCaml program running in userspace -- if 
suspended at the right moment, you can probably look at procstat -v output to 
see how many pages have been allocated to stack regions.

Robert

> 
> -anil
> 
> On 11 Jul 2012, at 12:30, PALI Gabor Janos wrote:
> 
>> Hi,
>> 
>> I have just been trying to make a (very)* preliminary version of the
>> kernel-module-embedded Caml run-time (asmrun) work, but somewhere in
>> caml_startup() the execution dies, see the attached picture:
>> 
>> http://people.freebsd.org/~pgj/mirage/2012/07/11/camlSys__entry.bt.png
>> 
>> Note that it works fine if I do not use the Printf module (and use a
>> fibonacci function instead).  You can take a look at the sources I
>> currently have (which is not under public version control for now):
>> 
>> http://people.freebsd.org/~pgj/mirage/2012/07/11/src.zip
>> 
>> By the way, the platform is FreeBSD/i386 10-CURRENT (r238163).  I can
>> provide more data on the crash if that helps.
>> 
>> Ideas or suggestions are welcome!
>> 
> 
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.