Re: [PATCH] usb/core: Fix race condition when removing EHCI PCI devices

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

 



On Tue, Sep 11, 2012 at 11:34:56AM -0400, Alan Stern wrote:
> > Deregistering the bus first to prevent future readers from accessing the device
> > before cleaning up the hcd, seemed like an appropriate way to go.  I'll leave
> > it to the experts to validate that or provide a better solution. :-)
> > 
> > I adapted their usb_remove_hcd fix for usb_add_hcd error path too to mimic
> > the same behaviour (a little code shuffling to handle the gotos cleanly).
> 
> Moving things around in usb_add_hcd() is not a good way to attack this
> problem.  Here's a better approach; please make sure that it does what
> you want.  The idea is to indicate that a root hub is not registered by
> setting its devnum field to 0.
> 
> Alan Stern

Hi Alan,

I adapted your patch to our 2.6.32 tree and the customer tested it without
success.  The output panic is attached below.  I will work on getting a
machine with the latest kernel to reproduce this problem so I don't waste
your time chasing something that might be fixed upstream.

But if you could take a quick glance at the panic below to see if anything
comes to mind I would appreciate it.

Thanks for any help.

Cheers,
Don

The test failed on the first surprise removal of PCI devices.  Last gasp
from the console is posted below.  I would guess the faulting process was
reading a file under /proc/bus/usb.  I should have a dump if more info is
needed.

usb 3-1.6: New USB device found, idVendor=0557, idProduct=8021
usb 3-1.6: New USB device strings: Mfr=0, Product=0, SerialNumber=0
usb 3-1.6: configuration #1 chosen from 1 choice
hub 3-1.6:1.0: USB hub found
hub 3-1.6:1.0: 4 ports detected
hub 4-1:1.0: unable to enumerate USB device on port 3
usb 3-1.6.1: new low speed USB device number 5 using ehci_hcd
usb 3-1.6.1: New USB device found, idVendor=0557, idProduct=2260
usb 3-1.6.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 3-1.6.1: Product: CS1308R1 V1.2.116
usb 3-1.6.1: Manufacturer: ATEN International Co. Ltd
usb 3-1.6.1: configuration #1 chosen from 1 choice
input: ATEN International Co. Ltd CS1308R1 V1.2.116 as
/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:3d:00.0/0000:3e:01.0/0000:66:00.0/usb3/3-1/3-1.6/3-1.6.1/3-1.6.1:1.0/input/input10
generic-usb 0003:0557:2260.0009: input,hidraw8: USB HID v1.00 Keyboard
[ATEN International Co. Ltd CS1308R1 V1.2.116] on
usb-0000:66:00.0-1.6.1/input0
input: ATEN International Co. Ltd CS1308R1 V1.2.116 as
/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:3d:00.0/0000:3e:01.0/0000:66:00.0/usb3/3-1/3-1.6/3-1.6.1/3-1.6.1:1.1/input/input11
generic-usb 0003:0557:2260.000A: input,hidraw9: USB HID v1.00 Device [ATEN
International Co. Ltd CS1308R1 V1.2.116] on usb-0000:66:00.0-1.6.1/input1
input: ATEN International Co. Ltd CS1308R1 V1.2.116 as
/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:3d:00.0/0000:3e:01.0/0000:66:00.0/usb3/3-1/3-1.6/3-1.6.1/3-1.6.1:1.2/input/input12
generic-usb 0003:0557:2260.000B: input,hidraw10: USB HID v1.00 Mouse [ATEN
International Co. Ltd CS1308R1 V1.2.116] on usb-0000:66:00.0-1.6.1/input2
input: ATEN International Co. Ltd CS1308R1 V1.2.116 as
/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:3d:00.0/0000:3e:01.0/0000:66:00.0/usb3/3-1/3-1.6/3-1.6.1/3-1.6.1:1.3/input/input13
generic-usb 0003:0557:2260.000C: input,hidraw11: USB HID v1.10 Mouse [ATEN
International Co. Ltd CS1308R1 V1.2.116] on usb-0000:66:00.0-1.6.1/input3
hub 4-1:1.0: unable to enumerate USB device on port 3
usb 3-1.3: new high speed USB device number 6 using ehci_hcd
sd 0:0:0:0: [sdq] Unhandled error code
sd 0:0:0:0: [sdq] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
sd 0:0:0:0: [sdq] CDB: Write(10): 2a 00 02 08 08 08 00 00 01 00
md: super_written gets error=-5, uptodate=0
md/raid1:md2: Disk failure on sdq3, disabling device.
md/raid1:md2: Operation continuing on 1 devices.
usb 3-1.3: New USB device found, idVendor=152d, idProduct=2339
usb 3-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=5
usb 3-1.3: Product: USB to ATA/ATAPI Bridge
usb 3-1.3: Manufacturer: JMicron
usb 3-1.3: SerialNumber: MATSHITADV        YN14  003100
usb 3-1.3: configuration #1 chosen from 1 choice
scsi3 : SCSI emulation for USB Mass Storage devices
hub 4-1:1.0: unable to enumerate USB device on port 3
hub 4-1:1.0: unable to enumerate USB device on port 3
hub 4-1:1.0: unable to enumerate USB device on port 3
hub 4-1:1.0: unable to enumerate USB device on port 3
scsi 3:0:0:0: CD-ROM            MATSHITA DVD-RAM UJ8A0AS  1.20 PQ: 0 ANSI: 0
sr1: scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray
sr 3:0:0:0: Attached scsi generic sg3 type 5
hub 4-1:1.0: unable to enumerate USB device on port 3
bonding: bond0: Warning: the permanent HWaddr of eth100600 -
00:25:5c:a6:f2:60 - is still in use by bond0. Set the HWaddr of eth100600
to a different address to avoid conflicts.
bonding: bond0: releasing backup interface eth100600
hub 4-1:1.0: unable to enumerate USB device on port 3
igb 0000:07:00.0: PCI INT A disabled
bonding: bond1: Warning: the permanent HWaddr of eth100601 -
00:25:5c:a6:f2:61 - is still in use by bond1. Set the HWaddr of eth100601
to a different address to avoid conflicts.
bonding: bond1: releasing backup interface eth100601
igb 0000:07:00.1: PCI INT B disabled
pcieport 0000:06:01.0: PCI INT A disabled
pcieport 0000:06:04.0: PCI INT A disabled
pcieport 0000:06:05.0: PCI INT A disabled
mpt2sas0: _scsih_remove
mpt2sas0: _scsih_remove_inner: waiting for outstanding operations
mpt2sas0: _scsih_remove_inner: outstanding operations are complete
hub 4-1:1.0: unable to enumerate USB device on port 3
hub 4-1:1.0: unable to enumerate USB device on port 3
hub 4-1:1.0: unable to enumerate USB device on port 3
mpt2sas0: removing handle(0x0009), sas_addr(0x5000c5003b167841)
mpt2sas0: sending diag reset !!
hub 4-1:1.0: unable to enumerate USB device on port 3
mpt2sas0: diag reset: FAILED
mpt2sas 0000:0b:00.0: PCI INT A disabled
hub 4-1:1.0: unable to enumerate USB device on port 3
pcieport 0000:06:06.0: PCI INT A disabled
pcieport 0000:06:08.0: PCI INT A disabled
pcieport 0000:06:09.0: PCI INT A disabled
pcieport 0000:05:00.0: PCI INT A disabled
ehci_hcd 0000:2c:00.0: HC died; cleaning up
ehci_hcd 0000:2c:00.0: force halt; handhake ffffc90000654024 00004000
00004000 -> -19
ehci_hcd 0000:2c:00.0: HC died; cleaning up
ehci_hcd 0000:2c:00.0: remove, state 0
usb usb1: USB disconnect, device number 1
usb 1-1: USB disconnect, device number 2
usb 1-1.1: USB disconnect, device number 3
hub 4-1:1.0: unable to enumerate USB device on port 3
usb 1-1.3: USB disconnect, device number 4
usb 1-1.6: USB disconnect, device number 5
usb 1-1.6.1: USB disconnect, device number 6
ehci_hcd 0000:2c:00.0: USB bus 1 deregistered
hub 4-1:1.0: unable to enumerate USB device on port 3
general protection fault: 0000 [#1] SMP 
last sysfs file:
/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:3d:00.0/0000:3e:01.0/0000:66:00.0/usb3/3-1/3-1.6/3-1.6.1/3-1.6.1:1.2/input/input12/event12/uevent
CPU 0 
Modules linked in: autofs4 sunrpc configfs cachefiles fscache(T) bonding
8021q garp stp llc vhost_net macvtap macvlan tun uinput ipmi_devintf
ftmod(P)(U) ipmi_msghandler sg matroxfb(U) fosil(U) ext4 mbcache jbd2
raid1 sr_mod cdrom sd_mod(U) crc_t10dif usb_storage mpt2sas(U)
scsi_hbas(U) scsi_transport_sas raid_class igb(U) dca dm_mirror
dm_region_hash dm_log dm_mod ipv6 cxgb4 cxgb3 mdio libiscsi_tcp libiscsi
scsi_transport_iscsi [last unloaded: scsi_wait_scan]

Pid: 32752, comm: cat Tainted: P           ---------------  T
2.6.32-279.el6.bz849188.test01.x86_64 #1 Stratus ftServer 2700/G7LAY
RIP: 0010:[<ffffffff813b8167>]  [<ffffffff813b8167>] usb_device_dump+0x87/0xa70
RSP: 0018:ffff88014bfebd88  EFLAGS: 00010202
RAX: 6b6b6b6b6b6b6b6b RBX: fffffffffffffff4 RCX: 0000000000000000
RDX: ffff88017d2eeba8 RSI: 0000000000000000 RDI: ffffea00052a7978
RBP: ffff88014bfebe58 R08: 0000000000000000 R09: 000000000004b828
R10: 0000000000000000 R11: 0000000000000030 R12: ffff880176c88cd8
md/raid1:md3: Disk failure on sdq5, disabling device.
md/raid1:md3: Operation continuing on 1 devices.
R13: 000000000000133a R14: ffff88014bfebeb0 R15: ffff88014bfebe98
FS:  00007fc569b43700(0000) GS:ffff88002be00000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000002285000 CR3: 0000000175f5e000 CR4: 00000000000406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
hub 4-1:1.0: unable to enumerate USB device on port 3
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process cat (pid: 32752, threadinfo ffff88014bfea000, task ffff8801788a6a40)
Stack:
 ffff880100000001 ffffffff00000000 ffffffff00000001 ffffffff00000000
<d> ffffffff817d35d9 ffffffff81b7a764 ffff8801000002ec ffff880179d98000
<d> 0000000100000001 ffff880176c99568 ffff880176c99570 ffff880176c999b0
Call Trace:
 [<ffffffff813b8c70>] usb_device_read+0x120/0x190
 [<ffffffff8122155b>] ? selinux_file_permission+0xfb/0x150
 [<ffffffff8117cdf5>] vfs_read+0xb5/0x1a0
 [<ffffffff8117cfb1>] sys_read+0x51/0x80
 [<ffffffff8100b2c8>] tracesys+0xd9/0xde
Code: 00 00 48 c7 c3 f4 ff ff ff e8 d6 bf d6 ff 48 85 c0 48 89 85 68 ff ff
ff 74 c9 48 8b 55 b0 48 8b 42 38 48 85 c0 0f 84 0f 03 00 00 <44> 8b 00 41
83 f8 ff 0f 84 02 03 00 00 48 8b 4d b0 48 c7 c0 af 
RIP  [<ffffffff813b8167>] usb_device_dump+0x87/0xa70
 RSP <ffff88014bfebd88>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux