public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xhci: Fix soft lockup in xhci_pci_probe path when XHCI_STATE_HALTED
@ 2016-08-01 16:08 Kamal Mostafa
  2016-08-01 16:27 ` Gabriel Krisman Bertazi
  0 siblings, 1 reply; 2+ messages in thread
From: Kamal Mostafa @ 2016-08-01 16:08 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman, linux-usb, linux-kernel
  Cc: Gabriel Krisman Bertazi, Kamal Mostafa

Commit 27a41a83ec54 ("xhci: Cleanup only when releasing primary hcd")
causes a soft lockup at boot when XHCI_STATE_HALTED, preventing
VirtualBox 5.1.x from booting if USB3.0 is enabled.

Revert to allowing xhci_irq to handle the interrupt when
XHCI_STATE_HALTED but not XHCI_STATE_DYING.

Fixes: 27a41a83ec54 ("xhci: Cleanup only when releasing primary hcd")
BugLink: https://bugs.launchpad.net/bugs/1604058
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Cc: <stable@vger.kernel.org> #v4.3+
Cc: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
---
 drivers/usb/host/xhci-ring.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 918e0c7..1d36a5f 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2751,8 +2751,7 @@ hw_died:
 		writel(irq_pending, &xhci->ir_set->irq_pending);
 	}
 
-	if (xhci->xhc_state & XHCI_STATE_DYING ||
-	    xhci->xhc_state & XHCI_STATE_HALTED) {
+	if (xhci->xhc_state & XHCI_STATE_DYING) {
 		xhci_dbg(xhci, "xHCI dying, ignoring interrupt. "
 				"Shouldn't IRQs be disabled?\n");
 		/* Clear the event handler busy flag (RW1C);
@@ -2764,6 +2763,8 @@ hw_died:
 		spin_unlock(&xhci->lock);
 
 		return IRQ_HANDLED;
+	} else if (xhci->xhc_state & XHCI_STATE_HALTED) {
+		xhci_dbg(xhci, "xHCI halted, handling interrupt.\n");
 	}
 
 	event_ring_deq = xhci->event_ring->dequeue;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xhci: Fix soft lockup in xhci_pci_probe path when XHCI_STATE_HALTED
  2016-08-01 16:08 [PATCH] xhci: Fix soft lockup in xhci_pci_probe path when XHCI_STATE_HALTED Kamal Mostafa
@ 2016-08-01 16:27 ` Gabriel Krisman Bertazi
  0 siblings, 0 replies; 2+ messages in thread
From: Gabriel Krisman Bertazi @ 2016-08-01 16:27 UTC (permalink / raw)
  To: Kamal Mostafa; +Cc: Mathias Nyman, Greg Kroah-Hartman, linux-usb, linux-kernel

Kamal Mostafa <kamal@canonical.com> writes:

> Commit 27a41a83ec54 ("xhci: Cleanup only when releasing primary hcd")
> causes a soft lockup at boot when XHCI_STATE_HALTED, preventing
> VirtualBox 5.1.x from booting if USB3.0 is enabled.
>
> Revert to allowing xhci_irq to handle the interrupt when
> XHCI_STATE_HALTED but not XHCI_STATE_DYING.
>
> Fixes: 27a41a83ec54 ("xhci: Cleanup only when releasing primary hcd")
> BugLink: https://bugs.launchpad.net/bugs/1604058
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> Cc: <stable@vger.kernel.org> #v4.3+
> Cc: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
> Acked-by: Tim Gardner <tim.gardner@canonical.com>
> Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  drivers/usb/host/xhci-ring.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index 918e0c7..1d36a5f 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -2751,8 +2751,7 @@ hw_died:
>  		writel(irq_pending, &xhci->ir_set->irq_pending);
>  	}
>
> -	if (xhci->xhc_state & XHCI_STATE_DYING ||
> -	    xhci->xhc_state & XHCI_STATE_HALTED) {
> +	if (xhci->xhc_state & XHCI_STATE_DYING) {
>  		xhci_dbg(xhci, "xHCI dying, ignoring interrupt. "
>  				"Shouldn't IRQs be disabled?\n");
>  		/* Clear the event handler busy flag (RW1C);
> @@ -2764,6 +2763,8 @@ hw_died:
>  		spin_unlock(&xhci->lock);
>
>  		return IRQ_HANDLED;
> +	} else if (xhci->xhc_state & XHCI_STATE_HALTED) {
> +		xhci_dbg(xhci, "xHCI halted, handling interrupt.\n");
>  	}

Returning early when XHCI_STATE_HALTED is no longer necessary since my
commit ensures we only free the HCD after disabling the primary HCD.

I think we can drop the 'else if' leg all together and only test for
XHCI_STATE_DYING here.

-- 
Gabriel Krisman Bertazi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-01 16:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-01 16:08 [PATCH] xhci: Fix soft lockup in xhci_pci_probe path when XHCI_STATE_HALTED Kamal Mostafa
2016-08-01 16:27 ` Gabriel Krisman Bertazi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox