From: sashiko-bot@kernel.org
To: "Vijendar Mukunda" <Vijendar.Mukunda@amd.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH v4 12/13] soundwire: amd: fix IRQ thread dropping STATUS_0TO7 on simultaneous wake
Date: Mon, 26 Oct 2026 10:42:52 +0000 [thread overview]
Message-ID: <sashiko-outbox-184996@kernel.org> (raw)
In-Reply-To: <20261026044507.2310694-13-Vijendar.Mukunda@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] soundwire: amd: race with runtime resume in amd_sdw_irq_thread() on wake
--
commit 926ef4f8a65a29a6e1b8f7dfc94a0c8f49817776
Author: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
soundwire: amd: fix IRQ thread dropping STATUS_0TO7 on simultaneous wake
This commit removes the early return in amd_sdw_irq_thread() when
handling a SoundWire wake interrupt and masks AMD_SDW_WAKE_STAT_MASK out
of status_change_8to11 so that simultaneous peripheral status changes are
processed instead of dropped.
> diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
> index d7289b840513b..16dd17f7a343a 100644
> --- a/drivers/soundwire/amd_manager.c
> +++ b/drivers/soundwire/amd_manager.c
> @@ -1019,8 +1019,11 @@ static void amd_sdw_irq_thread(struct work_struct *work)
>
> dev_dbg(amd_manager->dev, "[SDW%d] SDW INT: 0to7=0x%x, 8to11=0x%x\n",
> amd_manager->instance, status_change_0to7, status_change_8to11);
> - if (status_change_8to11 & AMD_SDW_WAKE_STAT_MASK)
> - return amd_sdw_process_wake_event(amd_manager);
> +
> + if (status_change_8to11 & AMD_SDW_WAKE_STAT_MASK) {
> + amd_sdw_process_wake_event(amd_manager);
> + status_change_8to11 &= ~AMD_SDW_WAKE_STAT_MASK;
> + }
>
> if (status_change_8to11 & AMD_SDW_PREQ_INTR_STAT) {
> amd_sdw_read_and_process_ping_status(amd_manager);
[Severity: High]
Can removing the early return here cause peripheral status processing to
race with runtime resume or execute while the bus clock is still stopped
when waking from runtime suspend?
In drivers/soundwire/amd_manager.c, amd_sdw_process_wake_event() only
queues an asynchronous resume via pm_request_resume():
static void amd_sdw_process_wake_event(struct amd_sdw_manager *amd_manager)
{
dev_dbg(amd_manager->dev, "SoundWire Wake event reported\n");
pm_request_resume(amd_manager->dev);
writel(0x00, amd_manager->acp_mmio + ACP_SW_WAKE_EN(amd_manager->instance));
writel(0x00, amd_manager->mmio + ACP_SW_STATE_CHANGE_STATUS_8TO11);
}
When amd_sdw_irq_thread() runs with AMD_SDW_WAKE_STAT_MASK and peripheral
status bits set in status_change_0to7 or status_change_8to11 while
amd_manager->dev is runtime suspended or resuming, pm_request_resume()
returns immediately without waiting for amd_resume_runtime() to finish on
pm_wq.
Execution then falls through in amd_sdw_irq_thread() to either call
amd_sdw_read_and_process_ping_status() or call
amd_sdw_update_slave_status() and schedule amd_manager->amd_sdw_work
(amd_sdw_update_slave_status_work()), and then clears
ACP_SW_STATE_CHANGE_STATUS_8TO11 and ACP_SW_STATE_CHANGE_STATUS_0TO7:
if (status_change_8to11 & AMD_SDW_PREQ_INTR_STAT) {
amd_sdw_read_and_process_ping_status(amd_manager);
} else {
/* Check for the updated status on peripheral device */
amd_sdw_update_slave_status(status_change_0to7, status_change_8to11, amd_manager);
}
if (status_change_8to11 || status_change_0to7)
schedule_work(&amd_manager->amd_sdw_work);
writel(0x00, amd_manager->mmio + ACP_SW_STATE_CHANGE_STATUS_8TO11);
writel(0x00, amd_manager->mmio + ACP_SW_STATE_CHANGE_STATUS_0TO7);
Neither amd_sdw_read_and_process_ping_status() nor
amd_sdw_update_slave_status_work() synchronizes with runtime PM on
amd_manager->dev before accessing the bus or interrupt masks:
static void amd_sdw_update_slave_status_work(struct work_struct *work)
{
...
if (amd_manager->status[0] == SDW_SLAVE_ATTACHED) {
writel(0, amd_manager->mmio + ACP_SW_STATE_CHANGE_STATUS_MASK_0TO7);
writel(0, amd_manager->mmio + ACP_SW_STATE_CHANGE_STATUS_MASK_8TO11);
}
update_status:
sdw_handle_slave_status(&amd_manager->bus, amd_manager->status);
In AMD_SDW_CLK_STOP_MODE, amd_suspend_runtime() stops the clock and keeps
interrupts enabled while clk_stopped is true, and amd_resume_runtime()
restarts the clock in amd_sdw_clock_stop_exit() before completing
sdw_bus_exit_clk_stop() and the D0 transition. In AMD_SDW_POWER_OFF_MODE,
amd_resume_runtime() resets slave status and reinitializes the manager
and interrupt masks.
Could amd_sdw_read_and_process_ping_status() or
amd_sdw_update_slave_status_work() issue immediate commands via
amd_sdw_send_cmd_get_resp() while the clock is still stopped (timing out
after the status registers have already been cleared) or race
concurrently with amd_resume_runtime()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261026044507.2310694-1-Vijendar.Mukunda@amd.com?part=12
next prev parent reply other threads:[~2026-10-26 10:42 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 4:43 [PATCH v4 00/13] soundwire: amd: SoundWire manager driver bug fixes Vijendar Mukunda
2026-10-26 4:43 ` [PATCH v4 01/13] soundwire: amd: fix SDW command timeout return value handling Vijendar Mukunda
2026-10-26 4:43 ` [PATCH v4 02/13] soundwire: amd: return response on IMM status cleanup timeout Vijendar Mukunda
2026-10-26 9:08 ` sashiko-bot
2026-10-26 12:13 ` Mukunda,Vijendar
2026-10-26 13:45 ` Mukunda,Vijendar
2026-10-26 4:43 ` [PATCH v4 03/13] soundwire: amd: cache ping slave status to avoid spurious disconnect on timeout Vijendar Mukunda
2026-10-26 4:43 ` [PATCH v4 04/13] soundwire: amd: assert msg_lock is held in amd_sdw_read_ping_status() Vijendar Mukunda
2026-10-26 4:43 ` [PATCH v4 05/13] soundwire: amd: fix work drain ordering in remove path Vijendar Mukunda
2026-10-26 9:27 ` sashiko-bot
2026-10-27 8:18 ` Mukunda,Vijendar
2026-10-26 4:43 ` [PATCH v4 06/13] soundwire: amd: pm_runtime guard " Vijendar Mukunda
2026-10-26 4:43 ` [PATCH v4 07/13] soundwire: amd: fix ctx leak when sdw_amd_startup() fails Vijendar Mukunda
2026-10-26 9:48 ` sashiko-bot
2026-10-27 4:46 ` Mukunda,Vijendar
2026-10-26 4:43 ` [PATCH v4 08/13] soundwire: amd: propagate amd_init_sdw_manager() error on resume Vijendar Mukunda
2026-10-26 4:43 ` [PATCH v4 09/13] soundwire: amd: drop amd_deinit_sdw_manager() in POWER_OFF suspend Vijendar Mukunda
2026-10-26 4:43 ` [PATCH v4 10/13] soundwire: amd: replace >= ACP70 with explicit switch/case in PM paths Vijendar Mukunda
2026-10-26 4:43 ` [PATCH v4 11/13] soundwire: amd: fix interrupt gate and work drain ordering in PM ops Vijendar Mukunda
2026-10-26 10:27 ` sashiko-bot
2026-10-27 8:28 ` Mukunda,Vijendar
2026-10-26 4:43 ` [PATCH v4 12/13] soundwire: amd: fix IRQ thread dropping STATUS_0TO7 on simultaneous wake Vijendar Mukunda
2026-10-26 10:42 ` sashiko-bot [this message]
2026-10-27 3:48 ` Mukunda,Vijendar
2026-10-26 4:43 ` [PATCH v4 13/13] soundwire: amd: fix STATUS_8TO11 double-clear race in wake handler Vijendar Mukunda
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=sashiko-outbox-184996@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Vijendar.Mukunda@amd.com \
--cc=linux-sound@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.