Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

accel/amdxdna: Fix incorrect command state for timed out job

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")
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20251029193423.2430463-1-lizhi.hou@amd.com

Lizhi Hou 6fb7f298 23166804

+14 -2
+13 -2
drivers/accel/amdxdna/aie2_ctx.c
··· 204 204 205 205 cmd_abo = job->cmd_bo; 206 206 207 - if (unlikely(!data)) 207 + if (unlikely(job->job_timeout)) { 208 + amdxdna_cmd_set_state(cmd_abo, ERT_CMD_STATE_TIMEOUT); 209 + ret = -EINVAL; 208 210 goto out; 211 + } 209 212 210 - if (unlikely(size != sizeof(u32))) { 213 + if (unlikely(!data) || unlikely(size != sizeof(u32))) { 211 214 amdxdna_cmd_set_state(cmd_abo, ERT_CMD_STATE_ABORT); 212 215 ret = -EINVAL; 213 216 goto out; ··· 261 258 int ret = 0; 262 259 263 260 cmd_abo = job->cmd_bo; 261 + 262 + if (unlikely(job->job_timeout)) { 263 + amdxdna_cmd_set_state(cmd_abo, ERT_CMD_STATE_TIMEOUT); 264 + ret = -EINVAL; 265 + goto out; 266 + } 267 + 264 268 if (unlikely(!data) || unlikely(size != sizeof(u32) * 3)) { 265 269 amdxdna_cmd_set_state(cmd_abo, ERT_CMD_STATE_ABORT); 266 270 ret = -EINVAL; ··· 380 370 381 371 xdna = hwctx->client->xdna; 382 372 trace_xdna_job(sched_job, hwctx->name, "job timedout", job->seq); 373 + job->job_timeout = true; 383 374 mutex_lock(&xdna->dev_lock); 384 375 aie2_hwctx_stop(xdna, hwctx, sched_job); 385 376
+1
drivers/accel/amdxdna/amdxdna_ctx.h
··· 116 116 /* user can wait on this fence */ 117 117 struct dma_fence *out_fence; 118 118 bool job_done; 119 + bool job_timeout; 119 120 u64 seq; 120 121 struct amdxdna_drv_cmd *drv_cmd; 121 122 struct amdxdna_gem_obj *cmd_bo;