public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/2] usb: offload: Decouple interrupter lifecycle and refactor usage tracking
@ 2026-02-13 10:07 Guan-Yu Lin
  2026-02-13 10:07 ` [RFC PATCH v2 1/2] usb: offload: move device locking to callers in offload.c Guan-Yu Lin
  2026-02-13 10:07 ` [RFC PATCH v2 2/2] ALSA: usb: qcom: manage offload device usage Guan-Yu Lin
  0 siblings, 2 replies; 3+ messages in thread
From: Guan-Yu Lin @ 2026-02-13 10:07 UTC (permalink / raw)
  To: gregkh, mathias.nyman, perex, tiwai, quic_wcheng, broonie, arnd,
	harshit.m.mogalapalli, wesley.cheng
  Cc: linux-usb, linux-kernel, linux-sound, Guan-Yu Lin

The current USB offload implementation couples the allocation of xHCI
sideband interrupters with the device's offload usage counter. This
coupling is conceptually incorrect, as hardware resource availability
and power management state serve distinct purposes.

This series decouples these mechanisms by removing the usage counting
logic from the xHCI sideband layer and shifting the responsibility
to the consumer drivers. This allows interrupters to be managed
independently of the device's active offload status.

Furthermore, this refactoring addresses a recursive locking issue.
When a USB device is disconnected, the USB core invokes the driver's
disconnect callback while holding the udev device lock. Previously,
the xHCI sideband layer would call usb_offload_put(), which
attempted to re-acquire the same udev lock, resulting in a deadlock.

By shifting lock acquisition responsibility to the upper-level USB
driver, we ensure that offload usage updates can be safely performed
from contexts where the lock is already held. This standardizes the
lock hierarchy and prevents potential deadlocks during teardown.

Patch 1 performs the core refactoring by updating the offload APIs
to require caller-held device locks and removing implicit usage
counting from the interrupter paths.

Patch 2 updates the Qualcomm USB audio offload driver to explicitly
manage the usage counter during its stream lifecycle, serving as a
derivative consumer of the new API contract. This also ensures the
device remains active during playback, preventing premature
autosuspend.

---
Changes in v2:
- Move device locking to callers 
- Decouple sideband from offload counting.
Link to v1: https://lore.kernel.org/all/20260130074746.287750-1-guanyulin@google.com/
---
Guan-Yu Lin (2):
  usb: offload: move device locking to callers in offload.c
  ALSA: usb: qcom: manage offload device usage

 drivers/usb/core/offload.c        | 34 +++++++++++--------------------
 drivers/usb/host/xhci-sideband.c  | 14 +------------
 sound/usb/qcom/qc_audio_offload.c | 23 ++++++++++++++++++---
 3 files changed, 33 insertions(+), 38 deletions(-)

-- 
2.53.0.273.g2a3d683680-goog


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

end of thread, other threads:[~2026-02-13 10:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-13 10:07 [RFC PATCH v2 0/2] usb: offload: Decouple interrupter lifecycle and refactor usage tracking Guan-Yu Lin
2026-02-13 10:07 ` [RFC PATCH v2 1/2] usb: offload: move device locking to callers in offload.c Guan-Yu Lin
2026-02-13 10:07 ` [RFC PATCH v2 2/2] ALSA: usb: qcom: manage offload device usage Guan-Yu Lin

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