xhci: Do not run xhci_cleanup_msix with irq disabled
when unloading xhci_hcd, I got:
[ 134.856813] xhci_hcd 0000:02:00.0: remove, state 4
[ 134.858140] usb usb3: USB disconnect, address 1
[ 134.874956] xhci_hcd 0000:02:00.0: Host controller not halted, aborting reset.
[ 134.876351] BUG: sleeping function called from invalid context at kernel/mutex.c:85
[ 134.877657] in_atomic(): 0, irqs_disabled(): 1, pid: 1451, name: modprobe
[ 134.878975] Pid: 1451, comm: modprobe Not tainted 2.6.37-rc5+ #162
[ 134.880298] Call Trace:
[ 134.881602] [<ffffffff8104156a>] __might_sleep+0xeb/0xf0
[ 134.882921] [<ffffffff814763dc>] mutex_lock+0x24/0x50
[ 134.884229] [<ffffffff810a745c>] free_desc+0x2e/0x5f
[ 134.885538] [<ffffffff810a74c8>] irq_free_descs+0x3b/0x71
[ 134.886853] [<ffffffff8102584d>] free_irq_at+0x31/0x36
[ 134.888167] [<ffffffff8102723f>] destroy_irq+0x69/0x71
[ 134.889486] [<ffffffff8102747a>] native_teardown_msi_irq+0xe/0x10
[ 134.890820] [<ffffffff8124c382>] default_teardown_msi_irqs+0x57/0x80
[ 134.892158] [<ffffffff8124be46>] free_msi_irqs+0x8b/0xe9
[ 134.893504] [<ffffffff8124cd46>] pci_disable_msix+0x35/0x39
[ 134.894844] [<ffffffffa01b444a>] xhci_cleanup_msix+0x31/0x51 [xhci_hcd]
[ 134.896186] [<ffffffffa01b4b3a>] xhci_stop+0x3a/0x80 [xhci_hcd]
[ 134.897521] [<ffffffff81341dd4>] usb_remove_hcd+0xfd/0x14a
[ 134.898859] [<ffffffff813500ae>] usb_hcd_pci_remove+0x5c/0xc6
[ 134.900193] [<ffffffff8123c606>] pci_device_remove+0x3f/0x91
[ 134.901535] [<ffffffff812e7ea4>] __device_release_driver+0x83/0xd9
[ 134.902899] [<ffffffff812e8571>] driver_detach+0x86/0xad
[ 134.904222] [<ffffffff812e7d56>] bus_remove_driver+0xb2/0xd8
[ 134.905540] [<ffffffff812e8633>] driver_unregister+0x6c/0x74
[ 134.906839] [<ffffffff8123c8e4>] pci_unregister_driver+0x44/0x89
[ 134.908121] [<ffffffffa01b940e>] xhci_unregister_pci+0x15/0x17 [xhci_hcd]
[ 134.909396] [<ffffffffa01bd7d2>] xhci_hcd_cleanup+0xe/0x10 [xhci_hcd]
[ 134.910652] [<ffffffff8107fcd1>] sys_delete_module+0x1ca/0x23b
[ 134.911882] [<ffffffff81123932>] ? path_put+0x22/0x26
[ 134.913104] [<ffffffff8109a800>] ? audit_syscall_entry+0x2c/0x148
[ 134.914333] [<ffffffff8100ac82>] system_call_fastpath+0x16/0x1b
[ 134.915658] xhci_hcd 0000:02:00.0: USB bus 3 deregistered
[ 134.916465] xhci_hcd 0000:02:00.0: PCI INT A disabled
and the same issue when xhci_suspend is invoked. (Note from Sarah: That's
fixed by Andiry's patch before this, by synchronizing the irqs rather than
freeing them on suspend.)
Do not run xhci_cleanup_msix with irq disabled.
This patch should be queued for the 2.6.37 stable tree.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@kernel.org
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index d48edfa..b2c56d1 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -512,9 +512,10 @@
spin_lock_irq(&xhci->lock);
xhci_halt(xhci);
xhci_reset(xhci);
- xhci_cleanup_msix(xhci);
spin_unlock_irq(&xhci->lock);
+ xhci_cleanup_msix(xhci);
+
#ifdef CONFIG_USB_XHCI_HCD_DEBUGGING
/* Tell the event ring poll function not to reschedule */
xhci->zombie = 1;
@@ -548,9 +549,10 @@
spin_lock_irq(&xhci->lock);
xhci_halt(xhci);
- xhci_cleanup_msix(xhci);
spin_unlock_irq(&xhci->lock);
+ xhci_cleanup_msix(xhci);
+
xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n",
xhci_readl(xhci, &xhci->op_regs->status));
}