From: Lizhi Hou <lizhi.hou@amd.com>
To: <ogabbay@kernel.org>, <quic_jhugo@quicinc.com>,
<dri-devel@lists.freedesktop.org>, <mario.limonciello@amd.com>,
<karol.wachowski@linux.intel.com>, <max.zhen@amd.com>
Cc: Lizhi Hou <lizhi.hou@amd.com>, <linux-kernel@vger.kernel.org>,
<sonal.santan@amd.com>
Subject: [PATCH V2 2/2] accel/amdxdna: Abort jobs when the firmware context is gone
Date: Tue, 17 Nov 2026 13:27:33 -0800 [thread overview]
Message-ID: <20261117212733.172074-2-lizhi.hou@amd.com> (raw)
In-Reply-To: <20261117212733.172074-1-lizhi.hou@amd.com>
aie2_sched_job_run() returned NULL when the firmware context is gone
(mbox_chann pointer is NULL). The DRM scheduler treats a NULL return as
a job that completed without an error.
Return ERR_PTR(-ECANCELED) so the error is recorded on the fence, and mark
the command BO aborted.
Fixes: 6b13cb8f48a4 ("accel/amdxdna: Fix runtime suspend deadlock when there is pending job")
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
---
drivers/accel/amdxdna/aie2_ctx.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
index 32458d05635f9..c42ea1b4e08d2 100644
--- a/drivers/accel/amdxdna/aie2_ctx.c
+++ b/drivers/accel/amdxdna/aie2_ctx.c
@@ -404,8 +404,18 @@ aie2_sched_job_run(struct drm_sched_job *sched_job)
trace_xdna_job(sched_job, hwctx->name, "job run",
job->seq, job->drv_cmd ? job->drv_cmd->opcode : DEFAULT_IO);
- if (!hwctx->priv->mbox_chann)
- return NULL;
+ /*
+ * The firmware context is gone, but the scheduler keeps draining the
+ * entity, for example from drm_sched_entity_destroy(). Returning NULL
+ * would make the DRM scheduler signal the job fence without an error
+ * and user space would see the command as successfully completed.
+ * Abort the job instead. Driver internal commands have no command BO.
+ */
+ if (!hwctx->priv->mbox_chann) {
+ if (cmd_abo)
+ amdxdna_cmd_set_state(cmd_abo, ERT_CMD_STATE_ABORT);
+ return ERR_PTR(-ECANCELED);
+ }
if (!mmget_not_zero(job->mm))
return ERR_PTR(-ESRCH);
--
2.34.1
next prev parent reply other threads:[~2026-11-17 21:27 UTC|newest]
Thread overview: 4+ 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 ` Lizhi Hou [this message]
2026-11-17 21:54 ` [PATCH V2 2/2] accel/amdxdna: Abort jobs when the firmware context is gone Max Zhen
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=20261117212733.172074-2-lizhi.hou@amd.com \
--to=lizhi.hou@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karol.wachowski@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.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
all inboxes | Powered by JetHome®