From: Michal Pecio <michal.pecio@gmail.com>
To: Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Bart Nagel <bart@tremby.net>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/5] xhci: Sort out the TD skipping business
Date: Tue, 4 Aug 2026 12:01:10 +0200 [thread overview]
Message-ID: <20260804120110.01bda0e2.michal.pecio@gmail.com> (raw)
Hi,
This series is motivated by a recently found rare regression due to
my commit from last year and the solution suggested by Mathias Nyman.
https://lore.kernel.org/linux-usb/al_hchyOdPoPWKEo@spiral/
I think it's a good solution not only for this specific case, but also
in general, because the next event after Missed Service Error almost
always references some TD - exceptions are Ring Underrun, which we
have special handling for, and Stopped - Length Invalid, which would
be a rare occurrence, not currently supported anyway, and possible
to support within the proposed framework by making find_td_by_dma()
calculate accurate 'missed_tds' value while still returning NULL.
The first two patches fix bugs, because I found another obscure one.
The next two patches prepare for the last one by simplifying things.
The last patch implements the big change, the whole matching/skipping
loop is replaced with a more straightforward and robust version. New
functionality is paid for with a net increase of 4 LOC, not too bad.
I gave this a bit of testing and it seems to be working, including
weird cases like: Missed Service Error retires a waiting TD with
error_mid_td, then skipping is triggered by another Transaction Error
immediately afterwards, and it turns out that two TDs were missed.
[ 1665.224921] xhci_hcd 0000:0a:00.0: Transfer error for slot 1 ep 2 on endpoint
[ 1665.225151] xhci_hcd 0000:0a:00.0: Missed Service Error for slot 1 ep 2, skip 1, try now 0
[ 1665.225156] xhci_hcd 0000:0a:00.0: Missing TD completion event after mid TD error
[ 1665.225305] xhci_hcd 0000:0a:00.0: Transfer error for slot 1 ep 2 on endpoint
[ 1665.225308] xhci_hcd 0000:0a:00.0: Skipped 2 TDs on slot 1 ep 2 comp_code 4, TD found 1, skip flag 0
Additional testing of patch 1 in isolation would be appreciated from
the reporter of the regression (Cc). That patch would go to v6.18.
Regards,
Michal
Michal Pecio (5):
usb: xhci: Handle bogus TRB pointers in Missed Service Error events
usb: xhci: Guarantee URB giveback on Ring Underrun/Overrun
usb: xhci: Don't set the skip flag on non-isoc endpoints
usb: xhci: Shorten the TD skipping loop
usb: xhci: Rework and improve the TD matching and skipping logic
drivers/usb/host/xhci-ring.c | 200 ++++++++++++++++++-----------------
1 file changed, 102 insertions(+), 98 deletions(-)
--
2.48.1
next reply other threads:[~2026-08-04 10:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 10:01 Michal Pecio [this message]
2026-08-04 10:02 ` [PATCH 1/5] usb: xhci: Handle bogus TRB pointers in Missed Service Error events Michal Pecio
2026-08-05 17:13 ` Mathias Nyman
2026-08-04 10:03 ` [PATCH 2/5] usb: xhci: Guarantee URB giveback on Ring Underrun/Overrun Michal Pecio
2026-08-04 10:03 ` [PATCH 3/5] usb: xhci: Don't set the skip flag on non-isoc endpoints Michal Pecio
2026-08-04 10:04 ` [PATCH 4/5] usb: xhci: Shorten the TD skipping loop Michal Pecio
2026-08-05 17:14 ` Mathias Nyman
2026-08-04 10:05 ` [PATCH 5/5] usb: xhci: Rework and improve the TD matching and skipping logic Michal Pecio
2026-08-05 17:39 ` Mathias Nyman
2026-08-05 19:30 ` Michal Pecio
2026-08-06 11:00 ` Michal Pecio
2026-08-06 22:16 ` Mathias Nyman
2026-08-05 19:06 ` [PATCH 0/5] xhci: Sort out the TD skipping business Bart Nagel
2026-08-05 20:21 ` Michal Pecio
2026-08-06 18:28 ` Bart Nagel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260804120110.01bda0e2.michal.pecio@gmail.com \
--to=michal.pecio@gmail.com \
--cc=bart@tremby.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox