[RFC PATCH v2 0/2] usb: offload: Decouple interrupter lifecycle and refactor usage tracking
From: Guan-Yu Lin
Date: Fri Feb 13 2026 - 05:09:31 EST
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@xxxxxxxxxx/
---
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