mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] xhci: Sort out the TD skipping business
@ 2026-10-07  7:49 Michal Pecio
  2026-10-07  7:51 ` [PATCH v2 1/2] usb: xhci: Shorten the TD skipping loop Michal Pecio
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michal Pecio @ 2026-10-07  7:49 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel

Hi Mathias,

I see that you have picked this series for 7.4:
https://lore.kernel.org/linux-usb/20260804120110.01bda0e2.michal.pecio@gmail.com/

There is unfortunately a small bug in "Shorten the TD skipping loop":
old_trb_comp_code is assigned before being used by the !trb_in_td()
block, which means that we use the *current* trb_comp_code instead.

 	ep_ring->old_trb_comp_code = trb_comp_code;

 	if (ring_xrun_event)
 		return 0;
 
+	/* Handle events not referencing the current TD */
+	if (!trb_in_td(td, ep_trb_dma)) {
[...]
+		if (xhci_spurious_success_tx_event(xhci, ep_ring))
			// ^-- uses old_trb_comp_code

This causes false warnings when running UVC with non-power-of-2 alt
setting on HCs like VIA, which generate Success after a mid-TD Short
Packet. So this will surely bother users with such workloads.

It happened because I tried to resuse existing ring_xrun_event check
and remove an identical check from the !trb_in_td() block, so I placed
the block after this check.

Revised patch places it before the old_trb_comp_code assignment and
retains a duplicate ring_xrun_event check in the moved code, I'm not
trying to be clever anymore. Patch 2/2 is a necessary rebase.

It is also a pre-existing bug that in some cases the function bails out
without updating old_trb_comp_code, even though we know that the prior
TD cannot generate more events (e.g. we are handling ring underrun).
But that's a separate issue that causes missing warnings in rare cases
rather than false warnings in common cases.

Regards,
Michal

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

end of thread, other threads:[~2026-10-07  9:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-07  7:49 [PATCH v2 0/2] xhci: Sort out the TD skipping business Michal Pecio
2026-10-07  7:51 ` [PATCH v2 1/2] usb: xhci: Shorten the TD skipping loop Michal Pecio
2026-10-07  7:52 ` [PATCH 2/2] usb: xhci: Rework and improve the TD matching and skipping logic Michal Pecio
2026-10-07  9:38 ` [PATCH v2 0/2] xhci: Sort out the TD skipping business Mathias Nyman

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

all inboxes | Powered by JetHome®