linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] xhci: Simplify TD cancellation and drop some states
@ 2025-09-01  6:46 Michal Pecio
  2025-09-01  6:48 ` [PATCH RFC 1/2] usb: xhci: Drop the TD_CLEARED cancel status Michal Pecio
  2025-09-01  6:48 ` [PATCH RFC 2/2] usb: xhci: Drop the TD_CLEARING_CACHE_DEFERRED cancel Michal Pecio
  0 siblings, 2 replies; 6+ messages in thread
From: Michal Pecio @ 2025-09-01  6:46 UTC (permalink / raw)
  To: Mathias Nyman, Niklas Neronin; +Cc: linux-usb

Hi,

Thoughts about this?

Thanks to asynchronous giveback we can give back TDs at any time we
want without dropping xhci->lock and worrying what we might find when
we take it back. So give back TDs as soon as they are no longer needed
instead of keeping them around in TD_CLEARED state and using a second
pass through the list to give them back.

This turns out to be a surprisingly simple patch and I gave it a quick
test and it's working fine.

The second patch removes another almost meaningless cancel status and
shortens the code a bit while adding functionality which may or may not
turn out to be useful. And hopefully won't be harmful?

That too was tested, by patching xhci_move_dequeue_past_td() to fail
randomly and unlinking from multiple streams on UAS. Works exactly as
described in the commit message.

Overall, the driver lost 40 lines of code and 2KB in binary size. The
latter is surprising, I think I haven't removed 2KB worth of code, but
maybe it affects how gcc inlines or otherwise changes functions. YMMV.

Regards,
Michal

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

end of thread, other threads:[~2025-09-05  6:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-01  6:46 [PATCH RFC 0/2] xhci: Simplify TD cancellation and drop some states Michal Pecio
2025-09-01  6:48 ` [PATCH RFC 1/2] usb: xhci: Drop the TD_CLEARED cancel status Michal Pecio
2025-09-01  9:47   ` Mathias Nyman
2025-09-05  6:56     ` Michał Pecio
2025-09-01  6:48 ` [PATCH RFC 2/2] usb: xhci: Drop the TD_CLEARING_CACHE_DEFERRED cancel Michal Pecio
2025-09-01 20:52   ` Mathias Nyman

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).