linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* usb:xhci Report issue of missing memory barrier before ring doorbell
@ 2021-04-27  6:06 rtqq
  0 siblings, 0 replies; only message in thread
From: rtqq @ 2021-04-27  6:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Armv8 cpu core, xhci usb controller, Linux 5.4 kernel;
xhci usb controller port connect one high speed usb thumb drive, read data from usb disk device, at same time run "many" memtester apps;
after some time,  log as below:
[   97.488082] usb 1-1: reset high-speed USB device number 2
[   97.644326] sd 1:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x03 driverbyte=0x00
[   97.652605] sd 1:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 00 0c 80 08 00 00 f0 00
[   97.660300] blk_update_request: I/O error, dev sda, sector 819208 op 0x0:(READ) flags 0x84700 phys_seg 2 prio class 0 

Note must run apps to make enough traffic on system bus, for example many instances of memtester, or many graphic rendering application.

This issue seems is caused by missing memory barrier before ring xhci doorbell.
Function giveback_first_trb:  there is toggle operation on cycle bit filed of start_trb, then call xhci_ring_ep_doorbell.
The cycle bit of trb identify the enqueue pointer of one transfer ring.

I doubt missing memory barrier between toggle cycle bit and xhci_ring_ep_doorbell, so change it like:
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3123,6 +3123,7 @@ static void giveback_first_trb(struct xhci_hcd *xhci, int slot_id,
                start_trb->field[3] |= cpu_to_le32(start_cycle);
        else
                start_trb->field[3] &= cpu_to_le32(~TRB_CYCLE);
+       wmb();
        xhci_ring_ep_doorbell(xhci, slot_id, ep_index, stream_id);
 }

Then this issue gone by run same test.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-27  6:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27  6:06 usb:xhci Report issue of missing memory barrier before ring doorbell rtqq

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).