From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 E5F1A2BF006 for ; Wed, 25 Feb 2026 06:46:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772001970; cv=none; b=qowUJnWc0+i9b2RNHVXVGRnOcBXHxs2VoniiOuISNX5Zx34MvVwkXOfVj7q/JYZE03f/5cZRiyX/HGsVNtfbIr/v6G3Y8wo+Kdt9TG6TxcrbgPKyrpNsy6xVyyyay+NvH/X/To99yf4XVpeeOzl0DJRau2tX5QNooGUJ2eaRC5w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772001970; c=relaxed/simple; bh=FcYnhA40wSm/6OIMnGZ+9dkPjQW2cki8snS/gC9NApM=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=QKG4IxJK5fz69SAEzLGG/IuUzRw5RgSxkImeBaLyhcktEkH0rIclI+d6PJvRXyNjLkivqoBQxlLNuYoVQAm26k8TYswpw7nhjQHcEoHEikXpXWbqM61mSHQ1xxIuiE+hPBcS7q3v3Ew1CwcCzou9I7mmUScCICb+1iNOF/54g9A= 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=LZGloXmg; arc=none smtp.client-ip=209.85.216.74 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="LZGloXmg" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-354c72d23dfso38133474a91.2 for ; Tue, 24 Feb 2026 22:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772001968; x=1772606768; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=5csDQ2S42k5WJW49iQ3pOEtVJoAgPTcMFYf2ie1hhyA=; b=LZGloXmgiuYUf41tkaofOLdwMV7tYHGZzn+/DsrT34NcueoczBVfKbb6WzSK/B12cs X9HdWdvQRv758FCFYuCPa2CKJTrcfehLLpqQC5iF5YO2n/66imTK/lJSXLcWufsDMEUA 5qBBPLnhPDN92eDCXbFGT6h/rjC/fUOPxQFp5P0nSZL3Lj5kaqXV7hLTZ2X3n9DjM5sa DDlN+K7e4eHoSSsT+XvXXjE0AQzMfZnyfRTIH5AGXceDux5c1X6dPvQr562laO0+XnVP b4WHG3Lhrkd4xQltHDvD6NtzIktYQRpzy7uoSWszixuHFJUZzETYlus949t9+KY5dbc5 SsJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772001968; x=1772606768; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5csDQ2S42k5WJW49iQ3pOEtVJoAgPTcMFYf2ie1hhyA=; b=vdU3fs5AnoyDCg0ZtK4hs3Rikh7fpGAAMFwXxUgu8dL8axqGueEae2RsQkOBSNA2bF hahx2+MYYBqaIUmU6okrtVKbpnVGmFb+FHKkScJMqB4hRR0o8DAmjS1F0R/Xj46S6sQK n4vIxRFph7VWSR0MTNI0owd0a2DxVkzaq/gzz3SmNJXsxx/WAj5zOsHpjlnviCGZp9FI a7ri6wtV2bhx2Zxk7FMfxtFnKRwYp6EHCUF0U3D1Ax3sRRsFfGdBcsH6coKnhl18P7Ab io6QOJ9Ul3/uCQzcMUrzwOLVtYT7x3cKjnvegrma6u8iJl15t0I7v6St634dm85h6SiJ 44Vw== X-Forwarded-Encrypted: i=1; AJvYcCXr8z6+56os0ZHMGmcTVvoPkDZUqpCASH0QLIJ4WL5zuFf7J/kCrJXDkKdKmU74nkiiHOrRsHh0QxnROIM=@vger.kernel.org X-Gm-Message-State: AOJu0YzEh8vYiDhCHq8I+R1iWWWYRzWZSzsZQTusy5nDlVorkgyyElcT e/Gnd2LvQD/xKtLNHB8ESKJO8VUgUYn1pdQy2iEknbkd9Z7uPP4JGm0TBhpV3Y5YeU5XVimoEph MfR9ftnuEEthp9dPrFQ== X-Received: from pjbbv16.prod.google.com ([2002:a17:90a:f190:b0:352:de4e:4038]) (user=guanyulin job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:1b43:b0:34a:a65e:e6ad with SMTP id 98e67ed59e1d1-358ae7e9f7fmr11623755a91.1.1772001968119; Tue, 24 Feb 2026 22:46:08 -0800 (PST) Date: Wed, 25 Feb 2026 06:45:49 +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.414.gf7e9f6c205-goog Message-ID: <20260225064601.270301-1-guanyulin@google.com> Subject: [PATCH v1 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, dan.carpenter@linaro.org 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 v1: - Fix build error when building sound/usb/qcom/qc_audio_offload.o - Link to RFC v2: https://lore.kernel.org/all/20260213100736.2914690-1-guanyulin@google.com/ Changes in RFC v2: - Move device locking to callers - Decouple sideband from offload counting. - Link to RFC 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 | 102 ++++++++++++++++++------------ 3 files changed, 73 insertions(+), 77 deletions(-) -- 2.53.0.414.gf7e9f6c205-goog