* Should xhci_irq() call usb_hc_died()?
@ 2016-12-10 0:26 Bjorn Helgaas
2016-12-12 8:43 ` Felipe Balbi
0 siblings, 1 reply; 3+ messages in thread
From: Bjorn Helgaas @ 2016-12-10 0:26 UTC (permalink / raw)
To: Mathias Nyman; +Cc: Alan Stern, Greg Kroah-Hartman, linux-usb, linux-kernel
Hi Mathias,
ehci_irq(), ohci_irq(), fotg210_irq(), and oxu210_hcd_irq() contain code
equivalent to this:
status = ehci_readl(...);
if (status == ~(u32) 0) {
...
usb_hc_died(hcd);
...
return IRQ_HANDLED;
}
xhci_irq() has a similar check, but does not call usb_hc_died():
status = readl(...);
if (status = 0xffffffff) {
...
return IRQ_HANDLED;
}
Should xhci_irq() also call usb_hc_died()? Maybe there's some reason
for it to be different than the others, but it wasn't obvious to this
casual observer :)
Bjorn
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Should xhci_irq() call usb_hc_died()?
2016-12-10 0:26 Should xhci_irq() call usb_hc_died()? Bjorn Helgaas
@ 2016-12-12 8:43 ` Felipe Balbi
2016-12-12 10:48 ` Mathias Nyman
0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2016-12-12 8:43 UTC (permalink / raw)
To: Bjorn Helgaas, Mathias Nyman
Cc: Alan Stern, Greg Kroah-Hartman, linux-usb, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 860 bytes --]
Hi,
Bjorn Helgaas <helgaas@kernel.org> writes:
> Hi Mathias,
>
> ehci_irq(), ohci_irq(), fotg210_irq(), and oxu210_hcd_irq() contain code
> equivalent to this:
>
> status = ehci_readl(...);
> if (status == ~(u32) 0) {
> ...
> usb_hc_died(hcd);
> ...
> return IRQ_HANDLED;
> }
>
> xhci_irq() has a similar check, but does not call usb_hc_died():
>
> status = readl(...);
> if (status = 0xffffffff) {
> ...
> return IRQ_HANDLED;
> }
>
> Should xhci_irq() also call usb_hc_died()? Maybe there's some reason
> for it to be different than the others, but it wasn't obvious to this
> casual observer :)
you might just have fixed several bugs in dealing with a dead HC :-)
Can you provide a patch? (well, unless Mathias has a strong reason not
to call usb_hc_died(), of course).
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Should xhci_irq() call usb_hc_died()?
2016-12-12 8:43 ` Felipe Balbi
@ 2016-12-12 10:48 ` Mathias Nyman
0 siblings, 0 replies; 3+ messages in thread
From: Mathias Nyman @ 2016-12-12 10:48 UTC (permalink / raw)
To: Felipe Balbi, Bjorn Helgaas, Mathias Nyman
Cc: Alan Stern, Greg Kroah-Hartman, linux-usb, linux-kernel
On 12.12.2016 10:43, Felipe Balbi wrote:
>
> Hi,
>
> Bjorn Helgaas <helgaas@kernel.org> writes:
>> Hi Mathias,
>>
>> ehci_irq(), ohci_irq(), fotg210_irq(), and oxu210_hcd_irq() contain code
>> equivalent to this:
>>
>> status = ehci_readl(...);
>> if (status == ~(u32) 0) {
>> ...
>> usb_hc_died(hcd);
>> ...
>> return IRQ_HANDLED;
>> }
>>
>> xhci_irq() has a similar check, but does not call usb_hc_died():
>>
>> status = readl(...);
>> if (status = 0xffffffff) {
>> ...
>> return IRQ_HANDLED;
>> }
>>
>> Should xhci_irq() also call usb_hc_died()? Maybe there's some reason
>> for it to be different than the others, but it wasn't obvious to this
>> casual observer :)
It probably should, I'm not aware of any reason why not, and a quick look at the
logs didn't reveal anything.
Currently we are calling usb_hcd_died() in a couple of timeout cases if we read
0xffffffff from the pci registers, So eventually usb_hc_died() will be called.
I'll take a look at this in more detail
>
> you might just have fixed several bugs in dealing with a dead HC :-)
>
> Can you provide a patch? (well, unless Mathias has a strong reason not
> to call usb_hc_died(), of course).
I don't think this is the worst case, there are a couple of other reasons such as
normal pci remove case we halt the host and reset the hardware after first HCD (USB2)
is removed, with all the secondary HCD (USB3) sand all its devices still connected,
Or then the abnormal case where HC disappears, we may time out while giving back a
killed URB, and may end up never returning it. USB core waits with the roothub device
lock held for the URB, and we try to tear down xhci, which also requires the roothub
device lock at some point -> deadlock.
I'm am looking at these, but I need to make sure i fix it properly and not cause even
more issues.
-Mathias
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-12 10:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-10 0:26 Should xhci_irq() call usb_hc_died()? Bjorn Helgaas
2016-12-12 8:43 ` Felipe Balbi
2016-12-12 10:48 ` Mathias Nyman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox