From: sashiko-bot@kernel.org
To: "Lizhi Hou" <lizhi.hou@amd.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH V2 1/2] accel/amdxdna: Detect a driver command without firmware response
Date: Tue, 17 Nov 2026 21:41:21 +0000 [thread overview]
Message-ID: <sashiko-outbox-219709@kernel.org> (raw)
In-Reply-To: <20261117212733.172074-1-lizhi.hou@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] accel/amdxdna: premature return in aie2_cmd_wait() when
syncobj is reset
--
commit f05d19edddd799b35af693f49ef6b95d8743aad9
Author: Lizhi Hou <lizhi.hou@amd.com>
accel/amdxdna: Detect a driver command without firmware response
This commit initializes cmd->result to U32_MAX before submitting debug BO
driver commands so that commands which never receive a firmware response are
reported as failures.
> diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
> index 74d7019268cb6..7525fefa6f1ef 100644
> --- a/drivers/accel/amdxdna/aie2_ctx.c
> +++ b/drivers/accel/amdxdna/aie2_ctx.c
> @@ -985,10 +985,14 @@ static void aie2_cmd_wait(struct amdxdna_hwctx *hwctx, u64 seq)
> struct dma_fence *out_fence = aie2_cmd_get_out_fence(hwctx, seq);
> struct amdxdna_dev *xdna = hwctx->client->xdna;
>
> - if (!out_fence) {
> - XDNA_ERR(xdna, "Failed to get fence");
> + /*
> + * No fence to wait for. Either seq has already signaled and a later
> + * point pruned it out of the timeline chain, or the syncobj was
> + * reset. Neither means the command failed, so leave the verdict to
> + * the caller, which inspects cmd->result.
> + */
> + if (!out_fence)
> return;
> - }
>
> mutex_unlock(&xdna->dev_lock);
> dma_fence_wait_timeout(out_fence, false, MAX_SCHEDULE_TIMEOUT);
> @@ -1018,6 +1022,7 @@ static int aie2_hwctx_cfg_debug_bo(struct amdxdna_hwctx *hwctx, u32 bo_hdl,
> goto put_obj;
> }
> kref_init(&cmd->refcnt);
> + cmd->result = U32_MAX;
[Severity: Medium]
Can aie2_hwctx_cfg_debug_bo() and aie2_hwctx_sync_debug_bo() observe
cmd->result == U32_MAX while the job is still running if the syncobj was
reset?
aie2_ctx_syncobj_create() exports hwctx->priv->syncobj to userspace as
hwctx->syncobj_hdl. If userspace resets that syncobj while a debug BO
command is in flight, aie2_cmd_get_out_fence() returns NULL and
aie2_cmd_wait() returns immediately without waiting for the job to
finish:
CPU0 CPU1
aie2_hwctx_cfg_debug_bo()
cmd->result = U32_MAX
amdxdna_cmd_submit()
DRM_IOCTL_SYNCOBJ_RESET
drm_syncobj_replace_fence(..., NULL)
aie2_cmd_wait()
out_fence = NULL
return
if (cmd->result) <-- sees U32_MAX, returns -EINVAL
aie2_sched_drvcmd_resp_handler()
job->drv_cmd->result = 0
Unlike the pruned timeline point case where seq has already signaled,
resetting the syncobj drops the fence before the firmware responds.
aie2_hwctx_cfg_debug_bo() then sees cmd->result == U32_MAX and skips
updating abo->assigned_hwctx even though firmware still executes the
attach or detach command, leaving abo->assigned_hwctx out of sync with
firmware.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117212733.172074-1-lizhi.hou@amd.com?part=1
next prev parent reply other threads:[~2026-11-17 21:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 21:27 [PATCH V2 1/2] accel/amdxdna: Detect a driver command without firmware response Lizhi Hou
2026-11-17 21:27 ` [PATCH V2 2/2] accel/amdxdna: Abort jobs when the firmware context is gone Lizhi Hou
2026-11-17 21:54 ` Max Zhen
2026-11-17 21:41 ` sashiko-bot [this message]
2026-11-17 21:54 ` [PATCH V2 1/2] accel/amdxdna: Detect a driver command without firmware response Max Zhen
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-219709@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lizhi.hou@amd.com \
--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.