lock recursion panic in cam_xpt.c

From: Giorgos Keramidas <keramida_at_ceid.upatras.gr>
Date: Tue, 29 Jun 2010 09:13:54 +0300
A recent CURRENT build from /head _at_ 209581 panics when I run
"cdrecord -scanbus" with the attached backtrace.  The culprit
seems to be the extra call fo xpt_lock_buses() added in head rev
208752, but I'm not sure if this is the real cause yet.

    --- a/sys/cam/cam_xpt.c  Wed Jun 02 17:27:23 2010 +0000
    +++ b/sys/cam/cam_xpt.c  Wed Jun 02 18:06:32 2010 +0000
    _at__at_ -2138,6 +2138,7 _at__at_ xptpdperiphtraverse(struct periph_driver

             retval = 1;

    +        xpt_lock_buses();
             for (periph = (start_periph ? start_periph :
                  TAILQ_FIRST(&(*pdrv)->units)); periph != NULL;
                  periph = next_periph) {
    _at__at_ -2145,9 +2146,12 _at__at_ xptpdperiphtraverse(struct periph_driver
                     next_periph = TAILQ_NEXT(periph, unit_links);

                     retval = tr_func(periph, arg);
    -                if (retval == 0)
    +                if (retval == 0) {
    +                        xpt_unlock_buses();
                             return(retval);
    +                }
             }
    +        xpt_unlock_buses();
             return(retval);
     }

With a kernel built from /head when "cdrecord -scanbus" runs, an
instant mutex recursion & panic happens at...

------------------------------------------------------------------------
Unread portion of the kernel message buffer:
panic: _mtx_lock_sleep: recursed on non-recursive mutex XPT topology lock _at_ /usr/src/sys/cam/cam_xpt.c:4814

cpuid = 0
Uptime: 12m51s
Physical memory: 3034 MB
Dumping 178 MB: 163 147 131 115 99 83 67 51 35 19 3

Reading symbols from /boot/kernel/geom_eli.ko...Reading symbols from /boot/kernel/geom_eli.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/geom_eli.ko
Reading symbols from /boot/kernel/crypto.ko...Reading symbols from /boot/kernel/crypto.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/crypto.ko
Reading symbols from /boot/kernel/zlib.ko...Reading symbols from /boot/kernel/zlib.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/zlib.ko
Reading symbols from /boot/kernel/if_iwn.ko...Reading symbols from /boot/kernel/if_iwn.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/if_iwn.ko
Reading symbols from /boot/kernel/snd_hda.ko...Reading symbols from /boot/kernel/snd_hda.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/snd_hda.ko
Reading symbols from /boot/kernel/sound.ko...Reading symbols from /boot/kernel/sound.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/sound.ko
Reading symbols from /boot/kernel/acpi_ibm.ko...Reading symbols from /boot/kernel/acpi_ibm.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/acpi_ibm.ko
Reading symbols from /boot/kernel/nullfs.ko...Reading symbols from /boot/kernel/nullfs.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/nullfs.ko
Reading symbols from /boot/kernel/snake_saver.ko...Reading symbols from /boot/kernel/snake_saver.ko.symbols...done.
done.
Loaded symbols for /boot/kernel/snake_saver.ko
#0  doadump () at pcpu.h:231
231	pcpu.h: No such file or directory.
	in pcpu.h
(kgdb) #0  doadump () at pcpu.h:231
#1  0x8068f66e in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:416
#2  0x8068f942 in panic (fmt=Variable "fmt" is not available.
) at /usr/src/sys/kern/kern_shutdown.c:590
#3  0x8067fe2a in _mtx_lock_sleep (m=0x80a83c98, tid=2272695552, opts=0,
    file=0x809b2014 "/usr/src/sys/cam/cam_xpt.c", line=4814)
    at /usr/src/sys/kern/kern_mutex.c:341
#4  0x80680047 in _mtx_lock_flags (m=0x80a83c98, opts=0,
    file=0x809b2014 "/usr/src/sys/cam/cam_xpt.c", line=4814)
    at /usr/src/sys/kern/kern_mutex.c:203
#5  0x8046abaa in xpt_lock_buses () at /usr/src/sys/cam/cam_xpt.c:4814
#6  0x8046ac14 in xptpdperiphtraverse (pdrv=0x86649640, start_periph=0x0,
    tr_func=0x8046b8b0 <xptplistperiphfunc>, arg=0x87682000)
    at /usr/src/sys/cam/cam_xpt.c:2151
#7  0x8046acd8 in xptplistpdrvfunc (pdrv=0x86649640, arg=0x87682000)
    at /usr/src/sys/cam/cam_xpt.c:1840
#8  0x8046a88c in xptpdrvtraverse (start_pdrv=Variable "start_pdrv" is not available.
)
    at /usr/src/sys/cam/cam_xpt.c:2132
#9  0x8047062c in xpt_action_default (start_ccb=0x87682000)
    at /usr/src/sys/cam/cam_xpt.c:1967
#10 0x8046a9b2 in xpt_action (start_ccb=0x87682000)
    at /usr/src/sys/cam/cam_xpt.c:2331
#11 0x8046ca36 in xptioctl (dev=0x87214e00, cmd=3294893314,
    addr=0x87682000 "\177\004", flag=3, td=0x87769500)
    at /usr/src/sys/cam/cam_xpt.c:598
#12 0x8060f6b8 in devfs_ioctl_f (fp=0x877bb8c0, com=3294893314,
    data=0x87682000, cred=0x872ad780, td=0x87769500)
    at /usr/src/sys/fs/devfs/devfs_vnops.c:669
#13 0x806dab5d in kern_ioctl (td=0x87769500, fd=3, com=3294893314,
    data=0x87682000 "\177\004") at file.h:254
#14 0x806dace4 in ioctl (td=0x87769500, uap=0x9aa55cec)
    at /usr/src/sys/kern/sys_generic.c:678
#15 0x806cff26 in syscallenter (td=0x87769500, sa=0x9aa55ce4)
    at /usr/src/sys/kern/subr_trap.c:314
#16 0x80953964 in syscall (frame=0x9aa55d28)
    at /usr/src/sys/i386/i386/trap.c:1060
#17 0x8093afc1 in Xint0x80_syscall ()
    at /usr/src/sys/i386/i386/exception.s:264
#18 0x00000033 in ?? ()
Previous frame inner to this frame (corrupt stack?)
(kgdb)
------------------------------------------------------------------------
Received on Tue Jun 29 2010 - 04:14:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:05 UTC