Re: kthread/kproc panic

From: Julian Elischer <julian_at_elischer.org>
Date: Fri, 26 Oct 2007 10:00:34 -0700
Ed Schouten wrote:
> Hello Julian,
> 
> I just upgraded my box, because I wanted to test AHCI ATAPI support that
> got added yesterday. I get the following panic right after the kernel
> copyright message. Have to type it by hand, so Typo's Copyright (c) me.
> 
> | kernel trap 12 with interrupts disabled
> | Fatal trap 12: page fault while in kernel mode
> | cpuid = 0; apic_id = 00
> | fault virtual address = 0x248
> | // too lazy to copy this by hand
> | db> bt
> | Tracing pid 0 tid 0 td 0xfffff...
> | bcopy() at bcopy+0x16
> | kproc_kthread_add() at kproc_kthread_add+0xbe
> | idle_setup() at idle_setup+0x7f
> | mi_startup() at mi_startup+0x59
> | btext() at btext+0x2c
> 
> I'm running FreeBSD on an amd64.
>
>  oldtd seems to be NULL
> 
> Yours,

I'm struggling to reproduce this.

from your description the following might be a work around.
(Maybe something in your setup has thread0 not set up as early as in mine?
in terms of being linked into proc0)


Index: kern_kthread.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_kthread.c,v
retrieving revision 1.40
diff -u -r1.40 kern_kthread.c
--- kern_kthread.c      26 Oct 2007 08:00:41 -0000      1.40
+++ kern_kthread.c      26 Oct 2007 16:51:49 -0000
_at__at_ -254,7 +254,10 _at__at_
                p = &proc0;
                oldtd = &thread0;
        } else {
-               oldtd = FIRST_THREAD_IN_PROC(p);
+               if (p == &proc0)
+                       oldtd = &thread0;
+               else
+                       oldtd = FIRST_THREAD_IN_PROC(p);
        }
 
        /* Initialize our td  */



if this doesn't help,
reverting just these two files will fix it as then nothing will be using the new code..

Index: src/sys/kern/kern_idle.c
diff -u src/sys/kern/kern_idle.c:1.49 src/sys/kern/kern_idle.c:1.50
--- src/sys/kern/kern_idle.c:1.49	Sat Oct 20 23:23:21 2007
+++ src/sys/kern/kern_idle.c	Fri Oct 26 08:00:41 2007
[...]

Index: src/sys/kern/kern_intr.c
diff -u src/sys/kern/kern_intr.c:1.148 src/sys/kern/kern_intr.c:1.149
--- src/sys/kern/kern_intr.c:1.148	Sat Oct 20 23:23:21 2007
+++ src/sys/kern/kern_intr.c	Fri Oct 26 08:00:41 2007
[...]
Received on Fri Oct 26 2007 - 15:00:08 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:20 UTC