From: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
To: "Mukunda,Vijendar" <vijendar.mukunda@amd.com>,
sashiko-reviews@lists.linux.dev,
Bard Liao <yung-chuan.liao@linux.intel.com>,
"Liao, Bard" <bard.liao@intel.com>, Vinod Koul <vkoul@kernel.org>,
srini@kernel.org
Cc: linux-sound@vger.kernel.org, "Dommati,
Sunil-kumar" <Sunil-kumar.Dommati@amd.com>,
Mario Limonciello <Mario.Limonciello@amd.com>
Subject: Re: [PATCH v2] soundwire: bus: use pm_runtime_get_if_active() in sdw_handle_slave_alerts()
Date: Thu, 3 Dec 2026 15:32:35 +0100 [thread overview]
Message-ID: <e56bdf12-c37f-4876-b902-7810278393c1@linux.dev> (raw)
In-Reply-To: <47b75028-5574-4a26-aee2-080a653760fc@amd.com>
>>> 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.
>> I didn't realize that this seemingly harmless return 0 could get in the
>> way of interrupt handling... Ugh.
>>
>> It's possible the same problem reported above occurs on Intel hardware.
>> I vaguely remember that the Cadence IP will only throw an interrupt when
>> the peripheral status changes from ATTACHED to ALERT. If we return
>> without dealing with the interrupt registers, it's possible that the
>> alert is not handled a second time.
>>
>> Bard, do you happen to remember the details of the interrupt handling? I
>> no longer have access to the documentation.
>> Adding Vinod as well since the bot seems to drop people in To: and CC:
> ++
>
> The concern is valid. The circular dependency only arises when the
> manager is in RPM_SUSPENDING: runtime_suspend blocks in cancel_work_sync()
> waiting for the alert work, while the alert work blocks in
> pm_runtime_resume_and_get() waiting for the manager's suspend to complete.
>
> For RPM_RESUMING no cancel_work_sync() is in flight, so there is no
> deadlock risk. The early return for RPM_RESUMING is therefore unnecessary.
>
> @Pierre-Louis :Would restricting the early return to RPM_SUSPENDING only be
> the right fix in your opinion?
possibly, but I can't think of a race-proof way to do this?
prev parent reply other threads:[~2026-12-03 14:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 11:48 [PATCH v2] soundwire: bus: use pm_runtime_get_if_active() in sdw_handle_slave_alerts() Vijendar Mukunda
2026-12-03 12:11 ` sashiko-bot
2026-12-03 13:02 ` Pierre-Louis Bossart
2026-12-03 13:50 ` Mukunda,Vijendar
2026-12-03 14:32 ` Pierre-Louis Bossart [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e56bdf12-c37f-4876-b902-7810278393c1@linux.dev \
--to=pierre-louis.bossart@linux.dev \
--cc=Mario.Limonciello@amd.com \
--cc=Sunil-kumar.Dommati@amd.com \
--cc=bard.liao@intel.com \
--cc=linux-sound@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=srini@kernel.org \
--cc=vijendar.mukunda@amd.com \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox