Re: [PATCH v2] xHCI: synchronize irq in xhci_suspend()

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

 



On Monday, December 27, 2010, Sarah Sharp wrote:
> On Mon, Dec 27, 2010 at 02:14:56PM +0100, Rafael J. Wysocki wrote:
> > On Monday, December 27, 2010, Andiry Xu wrote:
> > > Synchronize the interrupts instead of free them in xhci_suspend(). This will
> > > prevent a double free when the host is suspended and then the card removed.
> > > 
> > > Set the flag hcd->msix_enabled when using MSI-X, and check the flag in
> > > suspend_common(). MSI-X synchronization will be handled by xhci_suspend(),
> > > and MSI/INTx will be synchronized in suspend_common().
> > > 
> > > Reported-by: Matthew Garrett <mjg@xxxxxxxxxx>
> > > Signed-off-by: Andiry Xu <andiry.xu@xxxxxxx>
> > 
> > Looks good, but you need to remove the xhci_cleanup_msix() from under
> > the spinlock in _stop() and _shutdown() too.
> 
> There's a separate patch submitted by someone else to do that.  I'll
> take this patch and work out the conflicts.

Well, that was probably me.  Anyway, the patch is appended.  Please use it if
this is the right thing to do here.

Thanks,
Rafael

---
From: Rafael J. Wysocki <rjw@xxxxxxx>
Subject: USB / xHCI: Move xhci_cleanup_msix() from under a spinlock

xhci_cleanup_msix() cannot be called under a spinlock, since it
causes a mutex to be acquired up in the call chain.  Move it
from under the spinlock in xhci_stop() and xhci_shutdown().

Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
---
 drivers/usb/host/xhci.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 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
@@ -512,9 +512,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;
@@ -548,9 +549,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));
 }
--
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