Recent changes in USB stack broke dock disconnection - panic

From: Vladimir Grebenschikov <vova_at_fbsd.ru>
Date: Wed, 22 Apr 2009 11:29:31 +0400
Hi

Some recent changes in USB2 stack make panic on IBM dock disconnection.

As far as I understand USB controller in dock seen by notebook through PCIe bus.
On dock disconnection all USB devices should be safely disconnected.

This works before with old USB stack and with early versions of new USB stack.

# kgdb /boot/kernel/kernel /var/crash/vmcore.4 
...
Unread portion of the kernel message buffer:
ugen4.2: <IBM> at usbus4 (disconnected)
uhub5: at uhub4, port 6, addr 2 (disconnected)

Fatal trap 12: page fault while in kernel mode
fault virtual address	= 0xd0
fault code		= supervisor read, page not present
instruction pointer	= 0x20:0xc0987301
stack pointer	        = 0x28:0xe55c8a50
frame pointer	        = 0x28:0xe55c8a64
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, def32 1, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 30 (usbus4)
Physical memory: 2038 MB
Dumping 213 MB: 198 182 166 150 134 118 102 86 70 54 38 22 6
(kgdb) bt
#0  doadump () at pcpu.h:246
#1  0xc04784d9 in db_fncall (dummy1=1, dummy2=0, dummy3=-1065664320, dummy4=0xe55c87f4 "") at /usr/src/sys/ddb/db_command.c:548
#2  0xc04788d1 in db_command (last_cmdp=0xc075991c, cmd_table=0x0, dopager=1) at /usr/src/sys/ddb/db_command.c:445
#3  0xc0478a2a in db_command_loop () at /usr/src/sys/ddb/db_command.c:498
#4  0xc047a86d in db_trap (type=12, code=0) at /usr/src/sys/ddb/db_main.c:229
#5  0xc05799d4 in kdb_trap (type=12, code=0, tf=0xe55c8a10) at /usr/src/sys/kern/subr_kdb.c:534
#6  0xc06bd3ff in trap_fatal (frame=0xe55c8a10, eva=208) at /usr/src/sys/i386/i386/trap.c:917
#7  0xc06bd6a0 in trap_pfault (frame=0xe55c8a10, usermode=0, eva=208) at /usr/src/sys/i386/i386/trap.c:839
#8  0xc06be002 in trap (frame=0xe55c8a10) at /usr/src/sys/i386/i386/trap.c:521
#9  0xc06a4ebb in calltrap () at /usr/src/sys/i386/i386/exception.s:165
#10 0xc0987301 in usb2_intr_schedule_adjust (udev=0xc5050000, len=-32, slot=5 '\005')
    at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_hub.c:1120
#11 0xc0a038b5 in ehci_device_intr_close (xfer=0xc5010cb0)
    at /usr/src/sys/modules/usb/ehci/../../../dev/usb/controller/ehci.c:2317
#12 0xc098afb3 in usb2_transfer_stop (xfer=0xc5010cb0) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_transfer.c:1639
#13 0xc09b432e in ums_stop_read (fifo=0xc5038400) at /usr/src/sys/modules/usb/ums/../../../dev/usb/input/ums.c:653
#14 0xc097b08e in usb2_fifo_close (f=0xc5038400, fflags=1) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_dev.c:787
#15 0xc097c63c in usb2_fifo_free (f=0xc5038400) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_dev.c:582
#16 0xc097c6a3 in usb2_fifo_detach (f_sc=0xc5056800) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_dev.c:1737
#17 0xc09b42c5 in ums_detach (self=0xc504ca00) at /usr/src/sys/modules/usb/ums/../../../dev/usb/input/ums.c:629
#18 0xc05743d8 in device_detach (dev=0xc504ca00) at device_if.h:212
#19 0xc0574599 in bus_generic_detach (dev=0xc4e31580) at /usr/src/sys/kern/subr_bus.c:3033
#20 0xc0985437 in uhub_detach (dev=0xc4e31580) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_hub.c:868
#21 0xc05743d8 in device_detach (dev=0xc4e31580) at device_if.h:212
#22 0xc097e19e in usb2_detach_device (udev=0xc5051000, iface_index=32 ' ', flag=3 '\003')
    at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_device.c:978
#23 0xc097e3ca in usb2_unconfigure (udev=0xc5051000, flag=Variable "flag" is not available.
) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_device.c:382
#24 0xc097e68a in usb2_free_device (udev=0xc5051000, flag=Variable "flag" is not available.
) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_device.c:1958
#25 0xc0986083 in uhub_explore (udev=0xc4e38c00) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_hub.c:303
#26 0xc09776c9 in usb2_bus_explore (pm=0xc4dd9d14)
    at /usr/src/sys/modules/usb/usb/../../../dev/usb/controller/usb_controller.c:211
#27 0xc098851a in usb2_process (arg=0xc4dd9c70) at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_process.c:139
#28 0xc052db00 in fork_exit (callout=0xc0988440 <usb2_process>, arg=0xc4dd9c70, frame=0xe55c8d38)
    at /usr/src/sys/kern/kern_fork.c:821
#29 0xc06a4f30 in fork_trampoline () at /usr/src/sys/i386/i386/exception.s:270
(kgdb) fr 10
#10 0xc0987301 in usb2_intr_schedule_adjust (udev=0xc5050000, len=-32, slot=5 '\005')
    at /usr/src/sys/modules/usb/usb/../../../dev/usb/usb_hub.c:1120
1120			hub = bus->devices[udev->hs_hub_addr]->hub;
(kgdb) p udev->hs_hub_addr
$1 = 2 '\002'
(kgdb) p bus->devices[udev->hs_hub_addr]->hub
Cannot access memory at address 0xd0
(kgdb) 



Parts of dmesg:
...
pcib2: <ACPI PCI-PCI bridge> irq 20 at device 28.0 on pci0
pci2: <ACPI PCI bus> on pcib2
pcib3: <ACPI PCI-PCI bridge> irq 21 at device 28.1 on pci0
pci3: <ACPI PCI bus> on pcib3
pci3: <network, ethernet> at device 0.0 (no driver attached)
pcib4: <ACPI PCI-PCI bridge> irq 22 at device 28.2 on pci0
pci4: <ACPI PCI bus> on pcib4
pcib5: <ACPI PCI-PCI bridge> irq 23 at device 28.3 on pci0
pci12: <ACPI PCI bus> on pcib5
uhci0: <UHCI (generic) USB controller> port 0x1800-0x181f irq 16 at device 29.0 on pci0
uhci0: [ITHREAD]
usbus0: <UHCI (generic) USB controller> on uhci0
uhci1: <UHCI (generic) USB controller> port 0x1820-0x183f irq 17 at device 29.1 on pci0
uhci1: [ITHREAD]
usbus1: <UHCI (generic) USB controller> on uhci1
uhci2: <UHCI (generic) USB controller> port 0x1840-0x185f irq 18 at device 29.2 on pci0
uhci2: [ITHREAD]
usbus2: <UHCI (generic) USB controller> on uhci2
uhci3: <UHCI (generic) USB controller> port 0x1860-0x187f irq 19 at device 29.3 on pci0
uhci3: [ITHREAD]
usbus3: <UHCI (generic) USB controller> on uhci3
ehci0: <Intel 82801GB/R (ICH7) USB 2.0 controller> mem 0xee404000-0xee4043ff irq 19 at device 29.7 on pci0
ehci0: [ITHREAD]
usbus4: EHCI version 1.0
usbus4: <Intel 82801GB/R (ICH7) USB 2.0 controller> on ehci0
pcib6: <ACPI PCI-PCI bridge> at device 30.0 on pci0
pci21: <ACPI PCI bus> on pcib6
...
usbus0: 12Mbps Full Speed USB v1.0
usbus1: 12Mbps Full Speed USB v1.0
usbus2: 12Mbps Full Speed USB v1.0
usbus3: 12Mbps Full Speed USB v1.0
usbus4: 480Mbps High Speed USB v2.0
ugen0.1: <Intel> at usbus0
uhub0: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
ugen1.1: <Intel> at usbus1
uhub1: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus1
ugen2.1: <Intel> at usbus2
uhub2: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus2
ugen3.1: <Intel> at usbus3
uhub3: <Intel UHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus3
ugen4.1: <Intel> at usbus4
uhub4: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus4
...
uhub0: 2 ports with 2 removable, self powered
uhub1: 2 ports with 2 removable, self powered
uhub2: 2 ports with 2 removable, self powered
uhub3: 2 ports with 2 removable, self powered
...
uhub4: 8 ports with 8 removable, self powered
ugen4.2: <IBM> at usbus4
uhub5: <IBM product 0x4486, class 9/0, rev 2.00/0.01, addr 2> on usbus4
uhub5: 7 ports with 7 removable, self powered
ugen4.3: <Microsoft> at usbus4
ums0: <Microsoft Microsoft 5-Button Mouse with IntelliEye(TM), class 0/0, rev 1.10/3.00, addr 3> on usbus4
ums0: 5 buttons and [XYZ] coordinates ID=0
ugen3.2: <Broadcom Corp> at usbus3
ubt0: <Broadcom Corp BCM2045B, class 224/1, rev 2.00/1.00, addr 2> on usbus3
ugen3.3: <STMicroelectronics> at usbus3
...

after dock disconnect, it shows before panic:

ugen4.2: <IBM> at usbus4 (disconnected)
uhub5: at uhub4, port 6, addr 2 (disconnected)


USB configuration with dock:
# usbconfig 
ugen0.1: <UHCI root HUB Intel> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen1.1: <UHCI root HUB Intel> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen2.1: <UHCI root HUB Intel> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen3.1: <UHCI root HUB Intel> at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen4.1: <EHCI root HUB Intel> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen4.2: <product 0x4486 IBM> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE
ugen4.3: <Microsoft 5-Button Mouse with IntelliEye(TM) Microsoft> at usbus4, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
ugen3.2: <BCM2045B Broadcom Corp> at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen3.3: <Biometric Coprocessor STMicroelectronics> at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
#

-- 
Vladimir B. Grebenschikov
vova_at_fbsd.ru
Received on Wed Apr 22 2009 - 05:29:35 UTC

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