Current-Users archive

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

Re: kern/38636: ld(4) is now totally broken with ataraid(4) (ld.c 1.57 botch?)



OK, this is getting really annoying!  :-)  So I'm trying to debug it on
my own....  :-(

First I added a wee bit of extra debug to config_devalloc() to be sure
that dv_xname was really being set properly (as well as fixing up some
panic() messages along the way):

Index: sys/kern/subr_autoconf.c
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/sys/kern/subr_autoconf.c,v
retrieving revision 1.150
diff -u -r1.150 subr_autoconf.c
--- sys/kern/subr_autoconf.c    25 May 2008 15:03:01 -0000      1.150
+++ sys/kern/subr_autoconf.c    26 May 2008 21:23:50 -0000
@@ -1214,7 +1214,8 @@
        xunit = number(&num[sizeof(num)], myunit);
        lunit = &num[sizeof(num)] - xunit;
        if (lname + lunit > sizeof(dev->dv_xname))
-               panic("config_devalloc: device name too long");
+               panic("config_devalloc: device name '%s' too long for dv_xname 
with unit number '%s'",
+                     cd->cd_name, xunit);
 
        /* get memory for all device vars */
        KASSERT((ca->ca_flags & DVF_PRIV_ALLOC) || ca->ca_devsize >= 
sizeof(struct device));
@@ -1222,7 +1223,8 @@
                dev_private = malloc(ca->ca_devsize, M_DEVBUF,
                                     M_ZERO | (cold ? M_NOWAIT : M_WAITOK));
                if (dev_private == NULL)
-                       panic("config_devalloc: memory allocation for device 
softc failed");
+                       panic("config_devalloc: memory allocation for device 
softc for %s%s failed",
+                             cd->cd_name, xunit);
        } else {
                KASSERT(ca->ca_flags & DVF_PRIV_ALLOC);
                dev_private = NULL;
@@ -1235,7 +1237,8 @@
                dev = dev_private;
        }
        if (dev == NULL)
-               panic("config_devalloc: memory allocation for device_t failed");
+               panic("config_devalloc: memory allocation for device_t for %s%s 
failed",
+                     cd->cd_name, xunit);
 
        dev->dv_class = cd->cd_class;
        dev->dv_cfdata = cf;
@@ -1270,6 +1273,13 @@
        prop_dictionary_set_uint16(dev->dv_properties,
            "device-unit", dev->dv_unit);
 
+#ifdef DEBUG
+       aprint_debug_dev(dev, "config_devalloc: setup completed for %s unit %d 
as %s\n",
+                        dev->dv_cfdriver->cd_name,
+                        dev->dv_unit,
+                        dev->dv_xname);
+#endif
+
        return (dev);
 }
 

as well as the following two lines in ld.c:

Index: sys/dev/ld.c
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/sys/dev/ld.c,v
retrieving revision 1.58
diff -u -r1.58 ld.c
--- sys/dev/ld.c        28 Apr 2008 20:23:46 -0000      1.58
+++ sys/dev/ld.c        26 May 2008 22:00:35 -0000
@@ -110,6 +110,11 @@
        disk_init(&sc->sc_dk, device_xname(&sc->sc_dv), &lddkdriver);
        disk_attach(&sc->sc_dk);
 
+#ifdef DIAGNOSTIC
+       aprint_normal_dev(&sc->sc_dv, "unit %d\n", sc->sc_dv.dv_unit);
+       aprint_normal_dev(&sc->sc_dv, "cd_name %s\n", 
sc->sc_dv.dv_cfdriver->cd_name);
+#endif
+
        if (sc->sc_maxxfer > MAXPHYS)
                sc->sc_maxxfer = MAXPHYS;
 

Now booting with "-svx" I get a uvm_fault on the second line, as
follows.  As you can also see dv_xname is not set by this point even
though it was set A-OK back in config_devalloc().

ataraid0: config_devalloc: setup completed for ataraid unit 0 as ataraid0
ataraid0: found 1 RAID volume
ld0: config_devalloc: setup completed for ld unit 0 as ld0
ld0 at ataraid0 vendtype 1 unit 0: Adaptec ATA RAID-1 array
: unit 0
uvm_fault(0xc0bc7cc0, 0, 1) -> 0xe
kernel: supervisor trap page fault, code=0
Stopped in pid 0.1 (system) at  netbsd:ldattach+0x9b:   movl    0x10(%eax),%eax
db{1}> 


I'm beginning to suspect it must be either one of disk_init() or
disk_attach().  What else could it be!?!?!?

-- 
                                                Greg A. Woods
                                                Planix, Inc.

<woods%planix.com@localhost>     +1 416 489-5852 x122     http://www.planix.com/


Home | Main Index | Thread Index | Old Index