]> Git Repo - linux.git/commitdiff
xhci: flush endpoint start to reduce race risk with stop endpoint command.
authorMathias Nyman <[email protected]>
Fri, 29 Jan 2021 13:00:31 +0000 (15:00 +0200)
committerGreg Kroah-Hartman <[email protected]>
Fri, 29 Jan 2021 13:16:51 +0000 (14:16 +0100)
Stop endpoint command fails with "context state error" if the endpoint is
already stopped.

This case was observed when a previous URB cancel had just completed and
rang the doorbell to restart the ring, when a new URB cancel queued a stop
endpoint command.
>From xHC hardware pov the endpoint had not yet started, so the stop
endpoint command failed with context state error.
Right after this the doorbell ring took effect and ring was restarted.

Interrupt handler saw a stop endpoint command completion event with
"context state error" and discovered that the ring was back up in
running state.

flushing the write reduces these cases in stress testing, but does not
completely remove the issue.

Signed-off-by: Mathias Nyman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/usb/host/xhci-ring.c

index 2cbdc4537e73a18592b9cd57b654dd9303036630..d9714cea6dfa26a8a4096c4412fcefbb0b18c1fe 100644 (file)
@@ -429,9 +429,8 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci,
        trace_xhci_ring_ep_doorbell(slot_id, DB_VALUE(ep_index, stream_id));
 
        writel(DB_VALUE(ep_index, stream_id), db_addr);
-       /* The CPU has better things to do at this point than wait for a
-        * write-posting flush.  It'll get there soon enough.
-        */
+       /* flush the write */
+       readl(db_addr);
 }
 
 /* Ring the doorbell for any rings with pending URBs */
This page took 0.078428 seconds and 4 git commands to generate.