From: Lizhi Hou <lizhi.hou@amd.com>
To: Taimuraz Kaitmazov <taimuraz@kaitmazov.com>,
Min Ma <mamin506@gmail.com>, Oded Gabbay <ogabbay@kernel.org>
Cc: <dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] accel/amdxdna: make the debug BO command wait interruptible
Date: Wed, 26 Aug 2026 10:34:20 -0700 [thread overview]
Message-ID: <b7e8caf7-18de-fcbb-ee42-1b49b67b5eef@amd.com> (raw)
In-Reply-To: <20260826150726.126296-1-taimuraz@kaitmazov.com>
On 8/26/26 08:07, Taimuraz Kaitmazov wrote:
> aie2_cmd_wait() waits with dma_fence_wait_timeout(..., false,
> MAX_SCHEDULE_TIMEOUT): uninterruptible and unbounded. Both callers reach
> it from an ioctl holding xdna->dev_lock, and the only thing that can
> signal the fence when firmware does not answer is
> aie2_sched_job_timedout(), which takes that same lock. A debug BO command
> that never completes therefore blocks the ioctl forever, leaves the task
> unkillable, and stalls every other ioctl on the device behind dev_lock.
>
> Wait interruptibly and propagate the result. This does not remove the
> lock dependency, it makes it survivable.
This is fixed by
https://lore.kernel.org/all/20260707055732.479103-1-lizhi.hou@amd.com/
could you sync to drm-misc-fixes or the latest upstream kernel?
Thanks,
Lizhi
> Signed-off-by: Taimuraz Kaitmazov <taimuraz@kaitmazov.com>
> ---
> drivers/accel/amdxdna/aie2_ctx.c | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
> index 54486960cbf5..1f910ee4941c 100644
> --- a/drivers/accel/amdxdna/aie2_ctx.c
> +++ b/drivers/accel/amdxdna/aie2_ctx.c
> @@ -897,17 +897,20 @@ static int aie2_hwctx_cu_config(struct amdxdna_hwctx *hwctx, void *buf, u32 size
> return ret;
> }
>
> -static void aie2_cmd_wait(struct amdxdna_hwctx *hwctx, u64 seq)
> +static int aie2_cmd_wait(struct amdxdna_hwctx *hwctx, u64 seq)
> {
> struct dma_fence *out_fence = aie2_cmd_get_out_fence(hwctx, seq);
> + long ret;
>
> if (!out_fence) {
> XDNA_ERR(hwctx->client->xdna, "Failed to get fence");
> - return;
> + return -EINVAL;
> }
>
> - dma_fence_wait_timeout(out_fence, false, MAX_SCHEDULE_TIMEOUT);
> + ret = dma_fence_wait_timeout(out_fence, true, MAX_SCHEDULE_TIMEOUT);
> dma_fence_put(out_fence);
> +
> + return ret < 0 ? ret : 0;
> }
>
> static int aie2_hwctx_cfg_debug_bo(struct amdxdna_hwctx *hwctx, u32 bo_hdl,
> @@ -954,7 +957,10 @@ static int aie2_hwctx_cfg_debug_bo(struct amdxdna_hwctx *hwctx, u32 bo_hdl,
> goto put_cmd;
> }
>
> - aie2_cmd_wait(hwctx, seq);
> + ret = aie2_cmd_wait(hwctx, seq);
> + if (ret)
> + goto put_cmd;
> +
> if (cmd->result) {
> XDNA_ERR(xdna, "Response failure 0x%x", cmd->result);
> ret = -EINVAL;
> @@ -1014,7 +1020,10 @@ int aie2_hwctx_sync_debug_bo(struct amdxdna_hwctx *hwctx, u32 debug_bo_hdl)
> goto put_cmd;
> }
>
> - aie2_cmd_wait(hwctx, seq);
> + ret = aie2_cmd_wait(hwctx, seq);
> + if (ret)
> + goto put_cmd;
> +
> if (cmd->result) {
> XDNA_ERR(xdna, "Response failure 0x%x", cmd->result);
> ret = -EINVAL;
next parent reply other threads:[~2026-08-26 17:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260826150726.126296-1-taimuraz@kaitmazov.com>
2026-08-26 17:34 ` Lizhi Hou [this message]
[not found] ` <20260826184503.282106-1-taimuraz@kaitmazov.com>
2026-08-26 20:04 ` [PATCH v2] " 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=b7e8caf7-18de-fcbb-ee42-1b49b67b5eef@amd.com \
--to=lizhi.hou@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mamin506@gmail.com \
--cc=ogabbay@kernel.org \
--cc=taimuraz@kaitmazov.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®