[PATCH V1] accel/amdxdna: Use mmput_async() in the job run error path
From: Lizhi Hou
Date: Tue Dec 01 2026 - 13:21:24 EST
aie2_sched_job_run() runs from the DRM scheduler worker, not from the
submitting process, and the job only holds an mmgrab() reference to the
address space. If the process exits after the mmget_not_zero() at the
top of the function, the mmput() in the error path drops the last
mm_users reference and calls __mmput() -> exit_mmap() ->
mmu_notifier_release(), which invokes amdxdna_hmm_invalidate().
That handler waits with MAX_SCHEDULE_TIMEOUT for the fences of the BO.
The fence attached to the BO reservation object is the finished fence of
this very job, which the scheduler only signals once run_job() has
returned. The scheduler worker therefore blocks forever waiting for a
fence that only it can cause to be signalled, and stalls every other
context sharing the scheduler work queue.
Use mmput_async() so that the address space teardown is deferred and
run_job() can return.
Calling mmput_async() after aie2_job_put() is safe today because the
submit reference is still held until aie2_sched_job_free(). Swapping
the two lines makes it easier to read.
Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
Signed-off-by: Lizhi Hou <lizhi.hou@xxxxxxx>
---
drivers/accel/amdxdna/aie2_ctx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
index 582e171b5fd7..0a6be8ba8e3c 100644
--- a/drivers/accel/amdxdna/aie2_ctx.c
+++ b/drivers/accel/amdxdna/aie2_ctx.c
@@ -453,8 +453,8 @@ aie2_sched_job_run(struct drm_sched_job *sched_job)
if (ret) {
amdxdna_io_stats_job_done(job->hwctx->client);
dma_fence_put(job->fence);
+ mmput_async(job->mm);
aie2_job_put(job);
- mmput(job->mm);
fence = ERR_PTR(ret);
} else {
/*
--
2.34.1