From: "Zhang, Yidong (David)" <yidong.zhang@amd.com>
To: sashiko-reviews@lists.linux.dev
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH V1 16/20] accel/amdxdna: Implement AIE4 suspend and resume
Date: Mon, 5 Oct 2026 14:49:06 -0700 [thread overview]
Message-ID: <195a273c-53d0-4db3-bc7d-0150bd5db892@amd.com> (raw)
In-Reply-To: <20260930040712.A27381F000FF@smtp.kernel.org>
On 9/29/2026 9:07 PM, sashiko-bot@kernel.org wrote:
> [You don't often get email from sashiko-bot@kernel.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] amdxdna: submitter thread hangs forever on failed device resume
> --
>
> commit 3c6d084a73c19b1b3a172be33a5eb12a9d7f8889
> Author: David Zhang <yidong.zhang@amd.com>
>
> accel/amdxdna: Implement AIE4 suspend and resume
>
> Implement suspend and resume callbacks for AIE4 Physical Function (PF),
> Virtual Function (VF), and Classic device types.
>
>> diff --git a/drivers/accel/amdxdna/aie4_pci.c b/drivers/accel/amdxdna/aie4_pci.c
>> index f180983a692dc..6a50c1499ec93 100644
>> --- a/drivers/accel/amdxdna/aie4_pci.c
>> +++ b/drivers/accel/amdxdna/aie4_pci.c
> [ ... ]
>
>> @@ -1096,11 +1096,250 @@ static void aie4_debugfs_init(struct amdxdna_dev *xdna)
> [ ... ]
>
>> +static int aie4_vf_resume(struct amdxdna_dev *xdna)
>> +{
> [ ... ]
>
>> + ret = aie4_hwctx_resume_all(ndev);
>> + if (ret) {
>> + XDNA_ERR(xdna, "hwctx_resume failed %d", ret);
>> + goto hw_clear;
>> + }
>> +
>> + XDNA_DBG(xdna, "vf resume done");
>> + return 0;
>> +
>> +hw_clear:
>> + aie4_hwctx_suspend_all(ndev, true);
>> + aie4_vf_hw_stop(ndev);
>> +pci_disable:
>> + pci_disable_device(pdev);
> [Severity: High]
> Could this error path leave submitter threads permanently hung in an
> uninterruptible wait?
>
> When aie4_vf_resume() or aie4_classic_resume() fails, they call
> aie4_hwctx_suspend_all(ndev, true) which destroys the context with
> AIE4_HWCTX_ERROR (setting has_reset = true).
>
> However, a submitter thread waiting in wait_till_connected_hsa_not_full() in
> drivers/accel/amdxdna/aie4_ctx.c with wait_through_reset = true explicitly
> ignores has_reset:
>
> ret = wait_event_freezable(priv->job_list_wq,
> aie4_hwctx_connected(hwctx) ||
> (!wait_through_reset &&
> aie4_hwctx_has_reset(hwctx)));
>
> Since the hardware resume failed, the context will never be recreated and
> connected, causing it to block forever. This holds the srcu read lock and
> prevents device removal (causing a deadlock in synchronize_srcu()).
I will fix the synchronize_srcu() deadlock in context teardown by stopping
the hardware context and waking all waiters before destroying it.
The fix will be in upcoming PATCH V2.
/David
>> + return ret;
>> +}
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260930033233.1727265-1-yidong.zhang@amd.com?part=16
next prev parent reply other threads:[~2026-10-05 21:49 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 3:32 [PATCH V1 00/20] accel/amdxdna: Kernel submission and PM for AIE4 David Zhang
2026-09-30 3:32 ` [PATCH V1 01/20] accel/amdxdna: Rename NPU3 firmware files David Zhang
2026-09-30 3:32 ` [PATCH V1 02/20] accel/amdxdna: Remove mmap for doorbell David Zhang
2026-09-30 3:32 ` [PATCH V1 03/20] accel/amdxdna: Add CERT firmware version support David Zhang
2026-09-30 3:53 ` sashiko-bot
2026-09-30 3:32 ` [PATCH V1 04/20] accel/amdxdna: Upgrade firmware version to 6.0 David Zhang
2026-09-30 3:32 ` [PATCH V1 05/20] accel/amdxdna: Add NPU3 classic device support David Zhang
2026-09-30 3:32 ` [PATCH V1 06/20] accel/amdxdna: Add AIE version query to aie4_get_info David Zhang
2026-09-30 3:32 ` [PATCH V1 07/20] accel/amdxdna: Add get and set power_mode for AIE4 David Zhang
2026-09-30 3:56 ` sashiko-bot
2026-09-30 3:32 ` [PATCH V1 08/20] accel/amdxdna: Add clock, DPM frequency, and resource info queries " David Zhang
2026-09-30 3:32 ` [PATCH V1 09/20] accel/amdxdna: Add context switch hysteresis with debugfs control David Zhang
2026-09-30 3:52 ` sashiko-bot
2026-09-30 3:32 ` [PATCH V1 10/20] accel/amdxdna: Refactor AIE4 hardware initialization sequence David Zhang
2026-09-30 3:32 ` [PATCH V1 11/20] accel/amdxdna: Decouple AIE4 doorbell and MSI-X notification transport hooks David Zhang
2026-09-30 3:32 ` [PATCH V1 12/20] accel/amdxdna: Implement AIE4 kernel queue lifecycle and memory layout David Zhang
2026-09-30 4:00 ` sashiko-bot
2026-09-30 3:32 ` [PATCH V1 13/20] accel/amdxdna: Prepare for AIE4 command submission David Zhang
2026-09-30 4:00 ` sashiko-bot
2026-09-30 3:32 ` [PATCH V1 14/20] accel/amdxdna: Implement AIE4 command packet building and submission David Zhang
2026-09-30 4:04 ` sashiko-bot
2026-10-05 21:52 ` Zhang, Yidong (David)
2026-09-30 3:32 ` [PATCH V1 15/20] accel/amdxdna: Finalize runtime PM before acquiring dev_lock on removal David Zhang
2026-09-30 3:32 ` [PATCH V1 16/20] accel/amdxdna: Implement AIE4 suspend and resume David Zhang
2026-09-30 4:07 ` sashiko-bot
2026-10-05 21:49 ` Zhang, Yidong (David) [this message]
2026-09-30 3:32 ` [PATCH V1 17/20] accel/amdxdna: Link SR-IOV VFs for power management sequencing David Zhang
2026-09-30 3:59 ` sashiko-bot
2026-09-30 3:32 ` [PATCH V1 18/20] accel/amdxdna: Implement runtime suspend and resume support David Zhang
2026-09-30 4:00 ` sashiko-bot
2026-09-30 3:32 ` [PATCH V1 19/20] accel/amdxdna: Add stub hwctx_config for AIE4 David Zhang
2026-09-30 3:59 ` sashiko-bot
2026-09-30 3:32 ` [PATCH V1 20/20] accel/amdxdna: Enable AIE4 firmware logging to DRAM David Zhang
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=195a273c-53d0-4db3-bc7d-0150bd5db892@amd.com \
--to=yidong.zhang@amd.com \
--cc=dri-devel@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox