From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F71334D38E for ; Fri, 13 Feb 2026 10:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770977360; cv=none; b=P1OoO4im/pgg744yQ3y83B+UEmDeZ2lwCNP1BmpdP6+uGI2DbZawyae+wDA1ZxT6N6CZvXCCjCiU3c95uLf4pQW0on1Y94i9sRsNSzmY0HiBRXn4VeKmaKeltduxUfsTj245Ntu5GWyXSrMFEPWhvxEo8eUZUzbW/S5Lao7pDAw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770977360; c=relaxed/simple; bh=mNiqJWiiuf4qjeh9FL8FnIeCmlWo4rOAoNCWhUe4854=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=q6Zl3+MYz0gKn7fX8f4tyGr1b9uBBgN5eoxfpi5KPJsY7asAB9c8gHmhcnLHGkbZbxEFhgOL/TZ9204XxufkDdwOKSzY0K7ep2T/xBwforVl1YmklElgNUGjFFAB67FME/9onvKWx7p7hc2Dj03AZFmVYk5r9vEbBvYSvNT04Dg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--guanyulin.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=CxZjYZgb; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--guanyulin.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CxZjYZgb" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2a7b7f04a11so30060135ad.3 for ; Fri, 13 Feb 2026 02:09:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770977358; x=1771582158; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=+3luSD5LpgzelIQotxW7JLGJfxcioAB1HiWlg97wEX0=; b=CxZjYZgb2N1u724K9udLUlQOMtvEhkQ7oBS2hN5WT8bdGwa6cDJbLWut7itlV+I0yH GznE3kSSMVGF2tTkNM2+85gKWFmaXRhZStXberylPkfkKrhkl7btTh3s5LH3332Ekxr3 jdgE0ppfrrBDJS9Ms7XTKyDaEeiNRVYy8zUqzKTlSx14y/T2ePTRWlBsApIeB6x33tUR I7XXEfcNXFO77KwWTXXBPa6ikwqlwyuW6ea5BcTEnUZIgK0kYwdKdcOm5x92jCmagYR8 ag2aQ7OBzzkNW4Mdqpq+HlOzHIIx2XUQc65ffDnucHZqZjxNazG9gsOBpKx4folISapR /mjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770977358; x=1771582158; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+3luSD5LpgzelIQotxW7JLGJfxcioAB1HiWlg97wEX0=; b=W4HQq0iXv6pUmRtDeIsgmaEUAofDIQJNhLV9xqbYP1/zhQDrFCr7MaJGYwxxxXGcPG A5f2dMx8JCCphuT+6phaD8HrM2B/qNeOgkH3u14vHH68zGIU1tkh7WCjYkchPUPJySiG eWovaMIT46zzMsi3Z/JfTYF/JnNHrbaa3RNOYFkzRwddvHFYvfJWBWFtH+C6C85WpBiH Q3hzfWfcyUmh0naJuwisfKR/o/Y+eJkg/nYEdGt9gIBGeJ12ILMotZYb5bIYkiQA3ZSa Vc2MFRGcwJGw21H8sZxYNG4S6cpD1zkzCtLECV8HDn2tyPV/HSmOecbJDDK1AsqIUxTh nnpQ== X-Forwarded-Encrypted: i=1; AJvYcCV3Wkvqc6d3su4LbOwc3pHffBjsg8g5oIMoObfz+N5h2rLKxjwsH+PkjMg0JjGwIyGx1iry/i56a2xmHYU=@vger.kernel.org X-Gm-Message-State: AOJu0YwHGzL/ulK8EJcc/3uO52v9F1gCDCz/ow6BvReOFV5plpKdhkz8 L5W6lOmRKd34W1EFfHEvfJFcQY9ajqhauEBt0hcxJD8R+a+HJJBR8JShxpF/x1qt9QvvX16qoeU x2Iqz4tjM8LadOKJ2sw== X-Received: from plei5.prod.google.com ([2002:a17:902:e485:b0:298:33c9:da0c]) (user=guanyulin job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:e852:b0:2aa:e7f3:faf3 with SMTP id d9443c01a7336-2ab505229e3mr15965125ad.23.1770977358272; Fri, 13 Feb 2026 02:09:18 -0800 (PST) Date: Fri, 13 Feb 2026 10:07:34 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.53.0.273.g2a3d683680-goog Message-ID: <20260213100736.2914690-1-guanyulin@google.com> Subject: [RFC PATCH v2 0/2] usb: offload: Decouple interrupter lifecycle and refactor usage tracking From: Guan-Yu Lin To: gregkh@linuxfoundation.org, mathias.nyman@intel.com, perex@perex.cz, tiwai@suse.com, quic_wcheng@quicinc.com, broonie@kernel.org, arnd@arndb.de, harshit.m.mogalapalli@oracle.com, wesley.cheng@oss.qualcomm.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, Guan-Yu Lin Content-Type: text/plain; charset="UTF-8" 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