From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796299886; b=yWfrHOAyAVb6bhcscDl0pDRcxjzp+g8xhPlnaNNgtejnFo6+83T2BWRJ3dbQ8WjdUrkt YD9h0z/z+9xi7ulUJxb00N5X/dgq4mYzY8ZjMHbtD7/ATdf9aifoOVFzp1GN5wZbvIdO+ yZcIGPvXq1IF9ddcEfYRBufggkLdi1ebTqOksjkEhhXtsyFxgCAe6C2H2PduS3ipJSsO6 dKSP6b9PtPicatx390g7f6qddnJMOgv4G9A5ChohMr/z6nLiy0daPlyOdQ4/RRIjZDuV4 DrwvHAXDi0tXwQzHJ6goibkrhS6Ov2uKgUfTr27wGNCQ0XgIBqKzqp59q6+/cCKj64A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796299886; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ntLijmEXCNKyftrzz5ym1Kb+KfI7ZEd5aU2Pt1cTJj4=; b=wSXzJU4XucXvw6llxENRr2pVrdQ12gEJ4L1nb4F3wLomosZNnoBE85i8px5rSFIJ4cQb luJixk0OJ8QftZX6dG8NQyXeR7nF8oy+S8T6o7y5lIncg7WU6FaZElqQh+3qtyyVHMmfu ajV3wf1zbLOj/GV5HGUCd5pBufubf/kMHA+Hy6HgwmyWTI/GfLCJETZNoYp6FJ+wORniA JP7nLTWvQUARjWTLp+spt1c7G2iBfR20/2HFoGZ6CqzjgoM0ThE0Hk2ocu9vikPlxKTWR SZxdTw0e5AOFTQlVdIePyBjF5r1Z7EnMH4aLd0Nu2tM7TEt7THUZy3X3k/rJDudKdEw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="W/iu9Ftr"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1598C606A32D for ; Thu, 3 Dec 2026 12:11:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=W/iu9Ftr Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A2821F000C1; Thu, 3 Dec 2026 12:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796299885; bh=ntLijmEXCNKyftrzz5ym1Kb+KfI7ZEd5aU2Pt1cTJj4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=W/iu9Ftr0ZNXjZWsijIC8NAFhXWb9LGohynZYhpMCV1cKK1FarB8BFujBmnrDxdLs qS0rEZgsX/G+uBXVsAjgBeq1QVmmYZmvMcRnBgDyfozkIwEd014rLLvTg2nDWpdbFM XxJ77j0xCXNq0RwloXooyIpTOAYLX38iXMWVSVa7KqwlqRks5TcP8GSQkndTpK8/dO gHX/o1TnSTG55rOedFDFLPQjZUCIt2xmSVHqh3GbIWcuropA5NhWIfYKhzAfjTLs7E F8yL2fYuCaeDnPrTHzqDS2m/lW25EGSOVaSXJVW013cOGQmnnGl15/hQqM+6b0hGXV lZAyooTbSnvcw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2] soundwire: bus: use pm_runtime_get_if_active() in sdw_handle_slave_alerts() Reply-To: sashiko-reviews@lists.linux.dev To: "Vijendar Mukunda" Cc: linux-sound@vger.kernel.org In-Reply-To: <20261203114833.3096517-1-Vijendar.Mukunda@amd.com> References: <20261203114833.3096517-1-Vijendar.Mukunda@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 12:11:25 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] soundwire: bus: early return in sdw_handle_slave_alerts() drops alerts - [High] soundwire: bus: early return in sdw_handle_slave_alerts() hangs qcom IRQ -- commit 1fc0f1d3eacfdbaa69b03883111cd2662e12323a Author: Vijendar Mukunda soundwire: bus: use pm_runtime_get_if_active() in sdw_handle_slave_alerts() This commit checks the manager device with pm_runtime_get_if_active() before calling pm_runtime_resume_and_get() on the slave in sdw_handle_slave_alerts(), requesting an async resume and returning 0 early when the manager is not RPM_ACTIVE. > diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c > index 15c66effbf4f4..82d4902be0c9e 100644 > --- a/drivers/soundwire/bus.c > +++ b/drivers/soundwire/bus.c > @@ -1667,15 +1667,55 @@ static int sdw_handle_slave_alerts(struct sdw_sla= ve *slave) > u8 buf, buf2[2]; > bool parity_check; > bool parity_quirk; > + bool have_pm_ref =3D false; > + bool have_mgr_ref =3D false; > + struct device *mgr_dev =3D slave->bus->dev->parent; > =20 > sdw_modify_slave_status(slave, SDW_SLAVE_ALERT); > =20 > - ret =3D pm_runtime_get_sync(&slave->dev); > + ret =3D pm_runtime_get_if_active(mgr_dev); > + if (ret =3D=3D 0) { > + /* > + * Paranoia check based on code analysis: this path is only > + * functionally significant when the manager is in RPM_SUSPENDING. > + * In that state, runtime_suspend() may be blocked in > + * cancel_work_sync() waiting for this work to finish, while this > + * work would block in pm_runtime_resume_and_get() waiting for the > + * manager to complete its suspend - a circular dependency that > + * neither side can break. Returning early breaks the deadlock. > + * > + * In RPM_RESUMING or RPM_SUSPENDED the early return is harmless. > + * This issue has not been observed in practice; it is identified > + * through code analysis. > + * > + * Request an async resume as a best-effort recovery: for > + * wake-capable CLK_STOP_MODE peripherals the clock-stop wake > + * mechanism re-asserts the alert after manager resumes; for other > + * peripherals pm_request_resume() ensures the manager does not > + * remain suspended after completing the ongoing suspend. > + */ > + pm_request_resume(mgr_dev); > + dev_warn(&slave->dev, "Alert deferred: manager not RPM_ACTIVE\n"); > + return 0; > + } [Severity: High] Can returning 0 here drop peripheral alerts during runtime resume and clock-stop suspend? pm_runtime_get_if_active(mgr_dev) returns 0 whenever mgr_dev is not RPM_ACTIVE, which includes RPM_RESUMING. In rpm_resume(), mgr_dev stays in RPM_RESUMING until the manager's runtime_resume callback returns, and calling pm_request_resume(mgr_dev) in that state is a no-op returning -EINPROGRESS. All three in-tree managers (AMD, Intel/Cadence, and Qualcomm) restart the SoundWire clock and have interrupts enabled while mgr_dev is still in RPM_RESUMING. On AMD, amd_resume_runtime() exits clock stop via amd_sdw_clock_stop_exit() while RPM_RESUMING; if a waking peripheral reports ALERT, amd_sdw_irq_thread() schedules amd_sdw_work and clears ACP_SW_STATE_CHANGE_STATUS_0TO7 and ACP_SW_STATE_CHANGE_STATUS_8TO11. Returning 0 without clearing SDW_SCP_INT1 drops the alert, and because AMD performs no post-resume status re-poll, the peripheral remains latched in SDW_SLAVE_ALERT with future state-change alerts suppressed. The same loss occurs on clock-stop-mode-0 managers when mgr_dev is RPM_SUSPENDING or RPM_SUSPENDED, as pm_request_resume() triggers a deferred resume without a wake pulse or post-resume alert re-dispatch. [Severity: High] Does this early return deadlock swrm_runtime_suspend() and hang qcom_swrm_irq_handler() on Qualcomm managers? kworker / PM qcom_swrm_irq_handler() swrm_runtime_suspend() [SWRM_INTERRUPT_STATUS_SLAVE_PEND_I= RQ] /* ctrl->dev is RPM_SUSPENDING */ do { /* clock_stop_not_supported: */ sdw_handle_slave_status() /* skips sdw_bus_clk_stop() */ sdw_handle_slave_alerts() disable_irq(ctrl->irq) pm_runtime_get_if_active() = =3D=3D 0 <-- blocks forever dev_warn(...); return 0; /* SDW_SCP_INT1 never cleared */ clear & re-read INTERRUPT_STATUS } while (intr_sts_masked); <-- spins forever swrm_runtime_suspend() never masks SWRM_INTERRUPT_STATUS_SLAVE_PEND_IRQ and skips sdw_bus_clk_stop() when ctrl->clock_stop_not_supported is set (for any peripheral with clk_stop_mode1). With PING frames still running and SDW_SCP_INT1 left uncleared, SWRM_INTERRUPT_STATUS_SLAVE_PEND_IRQ stays asserted on every loop iteration, flooding unratelimited dev_warn() messages while disable_irq() blocks forever waiting for the IRQ thread. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203114833.3096= 517-1-Vijendar.Mukunda@amd.com?part=3D1