Hello list,

So we do seem to have a panic on boot in mojave which is confusing me somewhat.

If I load kext after boot, no problems.
If I slow down boot, like use boot-args=-v on a MacBookAir, no problems.
Slow VM, no problems.

So clearly I have a race, possible loading so early not everything is ready.

Reading the screen, I appear to die:

Kernel trap at 0xXXXXXXXX, type 14=page fault
mach_kernel : _sleep + 0x63
mach_kernel : _msleep + 0x62
net.lundman.spl : _spl_cv_wait + 0x22

This is early in my kext init phase, I have created a new thread, hold a
mutex and call msleep() to wait on the thread to signal it has started.

Now, I do not have the kernel sources, so I can only guess at the location,
but the _sleep code probably has not changed.  I die in here:

_sleep + 0x63 (+99 decimal).

(lldb) dis -a _sleep
kernel`_sleep:

kernel[0xffffff80008ce3e8] <+88>:   je     0xffffff80008ce3f2        ;
<+98> at OSAtomicOperations.c
kernel[0xffffff80008ce3ea] <+90>:   lock
kernel[0xffffff80008ce3eb] <+91>:   incq   0x80(%rax)
kernel[0xffffff80008ce3f2] <+98>:   movl   %r14d, %esi
kernel[0xffffff80008ce3f5] <+101>:  andl   $0x400, %esi              ; imm
= 0x400

which *probably* matches:

        p = current_proc();
        p->p_priority = pri & PRIMASK;
        /* It can still block in proc_exit() after the teardown. */
        if (p->p_stats != NULL)
                OSIncrementAtomicLong(&p->p_stats->p_ru.ru_nvcsw);


But it isn't clear to me why it would die in OSIncrementAtomicLong().
'current_proc()' will never return NULL, and we pass the test of p->p_stats.

Is it possible "->p_ru" is not yet ready for me to call msleep()?


Now, I could presumably sleep a little in my init, but that isn't exactly a
solution. Perhaps I can have the kext loaded a little later, although we
want it loaded before mountroot so we can have the rootfs.

Currently, we have plist.info set as:

       <key>IOProviderClass</key>
         <string>IOResources</string>
       <key>IOResourceMatch</key>
         <string>IOBSD</string>
       <key>OSBundleRequired</key>
         <string>Root</string>



In addition to that, it would be nice if I could connect to the lldb of the
macbookair (VMs do not boot fast enough to panic). But not sure if using a
thunderbolt->ethernet adapter will work, when it is this early in the boot
process.

I have attempted to use "kdp_match_name=en2 kdp_ip_addr=192.168.x.x" but I
am unable to connect.

Any information would be appreciated, even in haiku form.

Lund

-- 
Jorgen Lundman       | <lund...@lundman.net>
Unix Administrator   | +81 (0)90-5578-8500
Shibuya-ku, Tokyo    | Japan

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (Filesystem-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/filesystem-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to