Re: [PATCH] xhci: Do not run xhci_cleanup_msix with irq disabled

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

 



Hi Zhang,

>From your log, it looks like you have MSI enabled for this host, but not
MSI-X, is that correct?

I'm a little surprised that the documentation for pci_disable_msi() in
Documentation/PCI/MSI-HOWTO.txt doesn't mention this function can block,
but I trust the warning message.

Andiry has a patch to make the xHCI driver not free MSI interrupts on
suspend, so I'll rebase your patch against his and send it off to Greg
KH.

Sarah Sharp

On Fri, Dec 17, 2010 at 10:14:50AM +0800, Zhang Rui wrote:
> I'm not sure if this patch is the right fix, but it does work for me. :)
> 
> 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.
> 
> Don not run xhci_cleanup_msix with irq disabled.
> 
> CC: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
> Signed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx>
> ---
>  drivers/usb/host/xhci.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6/drivers/usb/host/xhci.c
> ===================================================================
> --- linux-2.6.orig/drivers/usb/host/xhci.c
> +++ linux-2.6/drivers/usb/host/xhci.c
> @@ -508,9 +508,10 @@ void xhci_stop(struct usb_hcd *hcd)
>  	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;
> @@ -544,9 +545,10 @@ void xhci_shutdown(struct usb_hcd *hcd)
>  
>  	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));
>  }
> @@ -677,9 +679,10 @@ int xhci_suspend(struct xhci_hcd *xhci)
>  		spin_unlock_irq(&xhci->lock);
>  		return -ETIMEDOUT;
>  	}
> +	spin_unlock_irq(&xhci->lock);
> +
>  	/* step 5: remove core well power */
>  	xhci_cleanup_msix(xhci);
> -	spin_unlock_irq(&xhci->lock);
>  
>  	return rc;
>  }
> 
> 
--
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