cvs commit: src/sys/dev/usbmisc/umass umass.c

Matthew Dillon dillon at apollo.backplane.com
Sun Mar 14 22:00:40 PST 2004


    This should hopefully fix reports of the system crashing or locking
    up on boot when several USB devices are attached.

    The problem wound up being that (for example) when umass detaches and 
    calls xpt_bus_deregister, xpt_bus_deregister does not properly abort all
    pending activity on the bus.  umass then proceeds to free the sim,
    and when the CAM layer tries to handle timeouts from the remaining
    requests it tries to indirect through SIM memory (because the SIM
    was freed).  Another problem occurs during boot, where the machine
    locks up.  This is because the kernel is waiting for its interrupt
    hooks to finish and the CAM interrupt hook is waiting for the bus
    scan to finish and the bus scan never finishes because when the SIM
    was freed, the bus scan's pending requests were destroyed along with
    it without any accounting for it.

    The problem occured intermittently because umass would not always
    detach/reattach during boot.  Sometimes it would just attach and be
    done with it, no triggering the bug.

    In playing around with USB on one of my boxes, I can still get the
    USB subsystem to fail to recognize a newly plugged in device sometimes
    when I plug it in and unplug it and plug it in and unplug it.  But it
    seems to recover if I plug in another device or if I wait a short while
    and try again.  It's probably something simple but I'm not going to
    persue it this instant.

    Just for fun I've appended the dmesg output from my last set of tests.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>

:dillon      2004/03/14 21:45:19 PST
:
:DragonFly src repository
:
:  Modified files:
:    sys/dev/usbmisc/umass umass.c 
:  Log:
:  When detaching UMASS, abort all the pipes before detaching the sim.  Note
:  sim detachment path is:  umass_cam_detach_sim -> xpt_bus_deregister ->
:  cam_sim_free.  If there is anything pending as of the cam_sim_free() bad
:  things will happen.
:  
:  Revision  Changes    Path
:  1.11      +16 -2     src/sys/dev/usbmisc/umass/umass.c
:
:
:http://www.dragonflybsd.org/cvsweb/src/sys/dev/usbmisc/umass/umass.c.diff?r1=1.10&r2=1.11&f=h
:


Copyright (c) 2003-2004 The DragonFly Project.
Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
DragonFly 1.0-CURRENT #57: Sun Mar 14 21:37:29 PST 2004
    root at xxxxxxxxxxxxxxxxxxxx:/usr/obj/usr/src/sys/AMD64
CPU: AMD Athlon(tm) 64 Processor 3200+ (1994.86-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0xf48  Stepping = 8
  Features=0x78bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2>
  AMD Features=0xe0500000<<b20>,AMIE,<b29>,DSP,3DNow!>
real memory  = 1073676288 (1048512K bytes)
avail memory = 1035038720 (1010780K bytes)
Preloaded elf kernel "/kernel" at 0xc0460000.
Pentium Pro MTRR support enabled
pcibios: BIOS version 2.10
Using $PIR table, 6 entries at 0xc00fdf00
acpi0: <XPC    AWRDACPI> on motherboard
installed MI handler for int 9
acpi0: power button is handled as a fixed feature programming model.
acpi_cpu0: <CPU> on acpi0
acpi_tz0: <thermal zone> on acpi0
acpi_button0: <Power Button> on acpi0
npx0: <math processor> on motherboard
npx0: INT 16 interface
pcib0: <Host to PCI bridge> at pcibus 0 on motherboard
pci0: <PCI bus> on pcib0
agp0: <NVIDIA Generic AGP Controller> mem 0xd8000000-0xdbffffff at device 0.0 on pci0
agp0: Unable to find NVIDIA Memory Controller 1.
device_probe_and_attach: agp0 attach returned 19
isab0: <PCI to ISA bridge (vendor=10de device=00d0)> at device 1.0 on pci0
isa0: <ISA bus> on isab0
pci0: <unknown card> (vendor=0x10de, dev=0x00d4) at 1.1 irq 5
ohci0: <nVidia nForce3 USB Controller> mem 0xe0003000-0xe0003fff irq 10 at device 2.0 on pci0
installed MI handler for int 10
usb0: OHCI version 1.0, legacy support
usb0: <nVidia nForce3 USB Controller> on ohci0
usb0: USB revision 1.0
uhub0: nVidia OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 3 ports with 3 removable, self powered
umass0: Sony USB Storage Media, rev 1.10/2.00, addr 2
umass0: SCSI over Bulk-Only; quirks = 0x0182
umass0: Get Max Lun not supported (IOERROR)
umass0:1:0:-1: Attached to scbus1
umass1: Stormblue Co., Ltd. USB Mass Storage Device, rev 1.10/1.11, addr 3
umass1: SCSI over Bulk-Only; quirks = 0x0000
umass1: Get Max Lun not supported (STALLED)
umass1:2:1:-1: Attached to scbus2
ohci1: <nVidia nForce3 USB Controller> mem 0xe0004000-0xe0004fff irq 10 at device 2.1 on pci0
usb1: OHCI version 1.0, legacy support
usb1: <nVidia nForce3 USB Controller> on ohci1
usb1: USB revision 1.0
uhub1: nVidia OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 3 ports with 3 removable, self powered
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xe0005000-0xe00050ff irq 10 at device 2.2 on pci0
ehci_pci_attach: companion usb0
ehci_pci_attach: companion usb1
usb2: EHCI version 1.0
usb2: companion controllers, 4 ports each: usb0 usb1
usb2: <EHCI (generic) USB 2.0 controller> on ehci0
usb2: USB revision 2.0
uhub2: nVidia EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub2: 6 ports with 6 removable, self powered
umass2: Ltd Winter Ver1.3, rev 2.00/0.05, addr 2
umass2: SCSI over Bulk-Only; quirks = 0x0000
umass2:3:2:-1: Attached to scbus3
umass3: DMI USB 2.0 Storage Adaptor, rev 2.00/11.10, addr 3
umass3: SCSI over Bulk-Only; quirks = 0x0000
umass3:4:3:-1: Attached to scbus4
pci0: <unknown card> (vendor=0x10de, dev=0x00d6) at 5.0 irq 5
pci0: <unknown card> (vendor=0x10de, dev=0x00da) at 6.0 irq 9
atapci0: <nVIDIA nForce2 ATA133 controller> port 0xf000-0xf00f at device 8.0 on pci0
ata0: at 0x1f0 irq 14 on atapci0
installed MI handler for int 14
ata1: at 0x170 irq 15 on atapci0
installed MI handler for int 15
pcib1: <PCI to PCI bridge (vendor=10de device=00dd)> at device 10.0 on pci0
pci1: <PCI bus> on pcib1
rl0: <D-Link DFE-530TX+ 10/100BaseTX> port 0x9000-0x90ff mem 0xdf002000-0xdf0020ff irq 10 at device 5.0 on pci1
rl0: Ethernet address: 00:0d:88:22:09:13
miibus0: <MII bus> on rl0
rlphy0: <RealTek internal media interface> on miibus0
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
fwohci0: <VIA VT6306> port 0x9400-0x947f mem 0xdf000000-0xdf0007ff irq 11 at device 6.0 on pci1
installed MI handler for int 11
fwohci0: OHCI version 1.0 (ROM=1)
fwohci0: No. of Isochronous channel is 4.
fwohci0: EUI64 00:30:1b:b0:00:00:fa:78
fwohci0: Phy 1394a available S400, 2 ports.
fwohci0: Link S400, max_rec 2048 bytes.
firewire0: <IEEE1394(FireWire) bus> on fwohci0
sbp0: <SBP-2/SCSI over FireWire> on firewire0
fwohci0: Initiate bus reset
fwohci0: node_id=0xc800ffc0, gen=1, CYCLEMASTER mode
firewire0: 1 nodes, maxhop <= 0, cable IRM = 0 (me)
firewire0: bus manager 0 (me)
atapci1: <SiI 3512 SATA controller> port 0xa800-0xa80f,0xa400-0xa403,0xa000-0xa007,0x9c00-0x9c03,0x9800-0x9807 mem 0xdf001000-0xdf0011ff irq 11 at device 7.0 on pci1
ata2: at 0x9800 on atapci1
ata3: at 0xa000 on atapci1
pcib2: <PCI to PCI bridge (vendor=10de device=00d2)> at device 11.0 on pci0
pci2: <PCI bus> on pcib2
pci2: <NVidia model 0110 graphics accelerator> at 0.0 irq 3
orm0: <Option ROM> at iomem 0xd0000-0xd17ff on isa0
fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0
installed MI handler for int 6
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
installed MI handler for int 1
psm0: <PS/2 Mouse> irq 12 on atkbdc0
installed MI handler for int 12
psm0: model IntelliMouse Explorer, device ID 4
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sc0: <System console> on isa0
sc0: VGA <16 virtual consoles, flags=0x200>
sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A
installed MI handler for int 4
sio1: configured irq 3 not in bitmap of probed irqs 0
sio2: configured irq 5 not in bitmap of probed irqs 0
sio3: configured irq 9 not in bitmap of probed irqs 0
ppc0: <Parallel port> at port 0x378-0x37f irq 7 flags 0x40 on isa0
ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode
ppbus0: <Parallel port bus> on ppc0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
installed MI handler for int 7
installed MI handler for int 0
DUMMYNET initialized (011031)
IP packet filtering initialized, divert enabled, rule-based forwarding enabled, default to accept, unlimited logging
ad0: DMA limited to UDMA33, non-ATA66 cable or device
ad0: 39205MB <Maxtor 6E040L0> [79656/16/63] at ata0-master BIOSDMA
acd0: CDROM <ASUS CD-S520/A4> at ata1-master PIO4
umass0: at uhub0 port 1 (addr 2) disconnected
umass0: detached
umass0: Sony USB Storage Media, rev 1.10/2.00, addr 2
umass0: SCSI over Bulk-Only; quirks = 0x0182
umass0: Get Max Lun not supported (IOERROR)
umass0:1:0:-1: Attached to scbus1
umass1: at uhub0 port 3 (addr 3) disconnected
umass1: detached
umass1: Stormblue Co., Ltd. USB Mass Storage Device, rev 1.10/1.11, addr 3
umass1: SCSI over Bulk-Only; quirks = 0x0000
umass1: Get Max Lun not supported (STALLED)
umass1:2:1:-1: Attached to scbus2
WARNING: "da" is usurping "da"'s cdevsw[]
WARNING: "da" is usurping "da"'s cdevsw[]
WARNING: "da" is usurping "da"'s cdevsw[]
WARNING: "da" is usurping "da"'s cdevsw[]
Mounting root from ufs:/dev/ad0s1a
cd0 at ata1 bus 0 target 0 lun 0
cd0: <ASUS CD-S520/A4 1.2> Removable CD-ROM SCSI-0 device 
cd0: 16.000MB/s transfers
cd0: Attempt to query device size failed: NOT READY, Medium not present
da12 at umass-sim3 bus 3 target 0 lun 0
da12: <ExcelSto r Technology VA2O> Fixed Direct Access SCSI-0 device 
da12: 1.000MB/s transfers
da12: 39266MB (80418240 512 byte sectors: 255H 63S/T 5005C)
da9 at umass-sim1 bus 1 target 0 lun 0
da9: <USB Mass Storage Device 1.00> Removable Direct Access SCSI-2 device 
da9: 1.000MB/s transfers
da9: 125MB (256000 512 byte sectors: 64H 32S/T 125C)
da8 at umass-sim0 bus 0 target 0 lun 0
da8: <Sony Storage Media 2.51> Removable Direct Access SCSI-0 device 
da8: 1.000MB/s transfers
da8: 125MB (256352 512 byte sectors: 64H 32S/T 125C)
da10 at umass-sim2 bus 2 target 0 lun 0
da10: <USB2.0 CardReader CF RW 0.0>> Removable Direct Access SCSI-0 device 
da10: 1.000MB/s transfers
da10: Attempt to query device size failed: NOT READY, Medium not present
da11 at umass-sim2 bus 2 target 0 lun 1
da11: <USB2.0 CardReader Combo 0.0>> Removable Direct Access SCSI-0 device 
da11: 1.000MB/s transfers
da11: Attempt to query device size failed: NOT READY, Medium not present
umass1: at uhub0 port 3 (addr 3) disconnected
(da9:umass-sim1:1:0:0): lost device
(da9:umass-sim1:1:0:0): removing device entry
umass1: detached
umass1: Stormblue Co., Ltd. USB Mass Storage Device, rev 1.10/1.11, addr 3
umass1: SCSI over Bulk-Only; quirks = 0x0000
umass1: Get Max Lun not supported (STALLED)
umass1:10:1:-1: Attached to scbus10
WARNING: "da" is usurping "da"'s cdevsw[]
da9 at umass-sim1 bus 1 target 0 lun 0
da9: <USB Mass Storage Device 1.00> Removable Direct Access SCSI-2 device 
da9: 1.000MB/s transfers
da9: 125MB (256000 512 byte sectors: 64H 32S/T 125C)
umass1: at uhub0 port 3 (addr 3) disconnected
(da9:umass-sim1:1:0:0): lost device
(da9:umass-sim1:1:0:0): removing device entry
umass1: detached
umass3: at uhub2 port 6 (addr 3) disconnected
(da12:umass-sim3:3:0:0): lost device
(da12:umass-sim3:3:0:0): removing device entry
umass3: detached
umass1: Stormblue Co., Ltd. USB Mass Storage Device, rev 1.10/1.11, addr 3
umass1: SCSI over Bulk-Only; quirks = 0x0000
umass1: Get Max Lun not supported (STALLED)
umass1:11:1:-1: Attached to scbus11
WARNING: "da" is usurping "da"'s cdevsw[]
da9 at umass-sim1 bus 1 target 0 lun 0
da9: <USB Mass Storage Device 1.00> Removable Direct Access SCSI-2 device 
da9: 1.000MB/s transfers
da9: 125MB (256000 512 byte sectors: 64H 32S/T 125C)
umass3: DMI USB 2.0 Storage Adaptor, rev 2.00/11.10, addr 3
umass3: SCSI over Bulk-Only; quirks = 0x0000
umass3:12:3:-1: Attached to scbus12
WARNING: "da" is usurping "da"'s cdevsw[]
da12 at umass-sim3 bus 3 target 0 lun 0
da12: <ExcelSto r Technology VA2O> Fixed Direct Access SCSI-0 device 
da12: 1.000MB/s transfers
da12: 39266MB (80418240 512 byte sectors: 255H 63S/T 5005C)
umass1: at uhub0 port 3 (addr 3) disconnected
(da9:umass-sim1:1:0:0): lost device
(da9:umass-sim1:1:0:0): removing device entry
umass1: detached
umass3: at uhub2 port 6 (addr 3) disconnected
(da12:umass-sim3:3:0:0): lost device
(da12:umass-sim3:3:0:0): removing device entry
umass3: detached
umass1: Stormblue Co., Ltd. USB Mass Storage Device, rev 1.10/1.11, addr 3
umass1: SCSI over Bulk-Only; quirks = 0x0000
umass1: Get Max Lun not supported (STALLED)
umass1:13:1:-1: Attached to scbus13
WARNING: "da" is usurping "da"'s cdevsw[]
da9 at umass-sim1 bus 1 target 0 lun 0
da9: <USB Mass Storage Device 1.00> Removable Direct Access SCSI-2 device 
da9: 1.000MB/s transfers
da9: 125MB (256000 512 byte sectors: 64H 32S/T 125C)
umass3: DMI USB 2.0 Storage Adaptor, rev 2.00/11.10, addr 3
umass3: SCSI over Bulk-Only; quirks = 0x0000
umass3:14:3:-1: Attached to scbus14
WARNING: "da" is usurping "da"'s cdevsw[]
da12 at umass-sim3 bus 3 target 0 lun 0
da12: <ExcelSto r Technology VA2O> Fixed Direct Access SCSI-0 device 
da12: 1.000MB/s transfers
da12: 39266MB (80418240 512 byte sectors: 255H 63S/T 5005C)
umass1: at uhub0 port 3 (addr 3) disconnected
(da9:umass-sim1:1:0:0): lost device
(da9:umass-sim1:1:0:0): removing device entry
umass1: detached
umass3: at uhub2 port 6 (addr 3) disconnected
(da12:umass-sim3:3:0:0): lost device
(da12:umass-sim3:3:0:0): removing device entry
umass3: detached
umass1: DMI USB 2.0 Storage Adaptor, rev 2.00/11.10, addr 3
umass1: SCSI over Bulk-Only; quirks = 0x0000
umass1:15:1:-1: Attached to scbus15
WARNING: "da" is usurping "da"'s cdevsw[]
da9 at umass-sim1 bus 1 target 0 lun 0
da9: <ExcelSto r Technology VA2O> Fixed Direct Access SCSI-0 device 
da9: 1.000MB/s transfers
da9: 39266MB (80418240 512 byte sectors: 255H 63S/T 5005C)
umass3: Stormblue Co., Ltd. USB Mass Storage Device, rev 1.10/1.11, addr 3
umass3: SCSI over Bulk-Only; quirks = 0x0000
umass3: Get Max Lun not supported (STALLED)
umass3:16:3:-1: Attached to scbus16
WARNING: "da" is usurping "da"'s cdevsw[]
da12 at umass-sim3 bus 3 target 0 lun 0
da12: <USB Mass Storage Device 1.00> Removable Direct Access SCSI-2 device 
da12: 1.000MB/s transfers
da12: 125MB (256000 512 byte sectors: 64H 32S/T 125C)
umass1: at uhub2 port 6 (addr 3) disconnected
(da9:umass-sim1:1:0:0): lost device
(da9:umass-sim1:1:0:0): removing device entry
umass1: detached
umass3: at uhub0 port 3 (addr 3) disconnected
(da12:umass-sim3:3:0:0): lost device
(da12:umass-sim3:3:0:0): removing device entry
umass3: detached





More information about the Kernel mailing list