Current-Users archive

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

Re: lockdebug panic on boot



On Fri, Apr 23, 2010 at 10:51:11AM +0200, Christoph Egger wrote:
> panic: LOCKDEBUG
> fatal breakpoint trap in supervisor mode
> trap type 1 code 0 rip ffffffff801fe4ad cs e030 rflags 246 cr2  0 cpl 8 rsp 
> ffffffff80ec29e0
> Stopped in pid 0.1 (system) at  netbsd:breakpoint+0x5:  leave
> breakpoint() at netbsd:breakpoint+0x5
> panic() at netbsd:panic+0x28f
> lockdebug_more() at netbsd:lockdebug_more
> mutex_enter() at netbsd:mutex_enter+0x279
> vmem_xfree() at netbsd:vmem_xfree+0x34
> kmem_free() at netbsd:kmem_free+0xd4
> config_devalloc() at netbsd:config_devalloc+0x289

Try the attached patch.

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933
Index: sys/kern/subr_autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_autoconf.c,v
retrieving revision 1.205
diff -u -p -r1.205 subr_autoconf.c
--- sys/kern/subr_autoconf.c    19 Apr 2010 11:20:56 -0000      1.205
+++ sys/kern/subr_autoconf.c    28 Apr 2010 22:02:59 -0000
@@ -1118,7 +1118,9 @@ config_makeroom(int n, struct cfdriver *
                 * not hold alldevs_mtx, try again.
                 */
                if (cd->cd_devs != osp) {
+                       mutex_exit(&alldevs_mtx);
                        kmem_free(nsp, sizeof(device_t[new]));
+                       mutex_enter(&alldevs_mtx);
                        continue;
                }
 
@@ -1128,8 +1130,11 @@ config_makeroom(int n, struct cfdriver *
 
                cd->cd_ndevs = new;
                cd->cd_devs = nsp;
-               if (old != 0)
+               if (old != 0) {
+                       mutex_exit(&alldevs_mtx);
                        kmem_free(osp, sizeof(device_t[old]));
+                       mutex_enter(&alldevs_mtx);
+               }
        }
        alldevs_nwrite--;
 }
@@ -2005,11 +2010,8 @@ config_twiddle_fn(void *cookie)
 static int
 config_alldevs_lock(void)
 {
-       int s;
-
-       s = splhigh();
        mutex_enter(&alldevs_mtx);
-       return s;
+       return 0;
 }
 
 static void
@@ -2027,11 +2029,11 @@ config_alldevs_exit(struct alldevs_foray
        config_dump_garbage(&af->af_garbage);
 }
 
+/*ARGSUSED*/
 static void
 config_alldevs_unlock(int s)
 {
        mutex_exit(&alldevs_mtx);
-       splx(s);
 }
 
 /*


Home | Main Index | Thread Index | Old Index