From: Mario Limonciello <superm1@kernel.org>
To: Lizhi Hou <lizhi.hou@amd.com>,
ogabbay@kernel.org, quic_jhugo@quicinc.com,
maciej.falkowski@linux.intel.com,
dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, max.zhen@amd.com, sonal.santan@amd.com
Subject: Re: [PATCH V2] accel/amdxdna: Fix incorrect command state for timed out job
Date: Wed, 29 Oct 2025 14:38:51 -0500 [thread overview]
Message-ID: <8324911f-ff49-457c-9021-a860d2d4c0c7@kernel.org> (raw)
In-Reply-To: <20251029193423.2430463-1-lizhi.hou@amd.com>
On 10/29/25 2:34 PM, Lizhi Hou wrote:
> When a command times out, mark it as ERT_CMD_STATE_TIMEOUT. Any other
> commands that are canceled due to this timeout should be marked as
> ERT_CMD_STATE_ABORT.
>
> Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>> ---
> drivers/accel/amdxdna/aie2_ctx.c | 15 +++++++++++++--
> drivers/accel/amdxdna/amdxdna_ctx.h | 1 +
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
> index c6c473c78352..289a2aaf4cae 100644
> --- a/drivers/accel/amdxdna/aie2_ctx.c
> +++ b/drivers/accel/amdxdna/aie2_ctx.c
> @@ -204,10 +204,13 @@ aie2_sched_resp_handler(void *handle, void __iomem *data, size_t size)
>
> cmd_abo = job->cmd_bo;
>
> - if (unlikely(!data))
> + if (unlikely(job->job_timeout)) {
> + amdxdna_cmd_set_state(cmd_abo, ERT_CMD_STATE_TIMEOUT);
> + ret = -EINVAL;
> goto out;
> + }
>
> - if (unlikely(size != sizeof(u32))) {
> + if (unlikely(!data) || unlikely(size != sizeof(u32))) {
> amdxdna_cmd_set_state(cmd_abo, ERT_CMD_STATE_ABORT);
> ret = -EINVAL;
> goto out;
> @@ -258,6 +261,13 @@ aie2_sched_cmdlist_resp_handler(void *handle, void __iomem *data, size_t size)
> int ret = 0;
>
> cmd_abo = job->cmd_bo;
> +
> + if (unlikely(job->job_timeout)) {
> + amdxdna_cmd_set_state(cmd_abo, ERT_CMD_STATE_TIMEOUT);
> + ret = -EINVAL;
> + goto out;
> + }
> +
> if (unlikely(!data) || unlikely(size != sizeof(u32) * 3)) {
> amdxdna_cmd_set_state(cmd_abo, ERT_CMD_STATE_ABORT);
> ret = -EINVAL;
> @@ -370,6 +380,7 @@ aie2_sched_job_timedout(struct drm_sched_job *sched_job)
>
> xdna = hwctx->client->xdna;
> trace_xdna_job(sched_job, hwctx->name, "job timedout", job->seq);
> + job->job_timeout = true;
> mutex_lock(&xdna->dev_lock);
> aie2_hwctx_stop(xdna, hwctx, sched_job);
>
> diff --git a/drivers/accel/amdxdna/amdxdna_ctx.h b/drivers/accel/amdxdna/amdxdna_ctx.h
> index cbe60efbe60b..919c654dfea6 100644
> --- a/drivers/accel/amdxdna/amdxdna_ctx.h
> +++ b/drivers/accel/amdxdna/amdxdna_ctx.h
> @@ -116,6 +116,7 @@ struct amdxdna_sched_job {
> /* user can wait on this fence */
> struct dma_fence *out_fence;
> bool job_done;
> + bool job_timeout;
> u64 seq;
> struct amdxdna_drv_cmd *drv_cmd;
> struct amdxdna_gem_obj *cmd_bo;
next prev parent reply other threads:[~2025-10-29 19:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 19:34 [PATCH V2] accel/amdxdna: Fix incorrect command state for timed out job Lizhi Hou
2025-10-29 19:38 ` Mario Limonciello [this message]
2025-10-31 16:06 ` Lizhi Hou
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=8324911f-ff49-457c-9021-a860d2d4c0c7@kernel.org \
--to=superm1@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=maciej.falkowski@linux.intel.com \
--cc=max.zhen@amd.com \
--cc=ogabbay@kernel.org \
--cc=quic_jhugo@quicinc.com \
--cc=sonal.santan@amd.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;
as well as URLs for NNTP newsgroup(s).