All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V1] accel/amdxdna: wait uninterruptibly for jobs in the HMM invalidate callback
@ 2026-10-15 18:32 Lizhi Hou
  2026-10-15 18:36 ` Mario Limonciello
  2026-10-15 18:45 ` sashiko-bot
  0 siblings, 2 replies; 3+ messages in thread
From: Lizhi Hou @ 2026-10-15 18:32 UTC (permalink / raw)
  To: ogabbay, quic_jhugo, dri-devel, mario.limonciello,
	karol.wachowski, max.zhen
  Cc: Matthew Brost, Copilot, Lizhi Hou

From: Matthew Brost <matthew.brost@intel.com>

aie2_hmm_invalidate() waits for the jobs using a BO before the CPU pages
behind it are released, but does so interruptibly. When the task
triggering the invalidation has a signal pending the wait returns
-ERESTARTSYS immediately, the notifier completes and the pages can be
freed or migrated while the device is still accessing them through the
PASID.

An MMU notifier cannot fail a blockable invalidation, so wait
uninterruptibly. With MAX_SCHEDULE_TIMEOUT an uninterruptible wait
cannot time out either, so drop the now dead error handling.

Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
---
 drivers/accel/amdxdna/aie2_ctx.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
index 9c6b7353cbe9..84ab8a55b7ab 100644
--- a/drivers/accel/amdxdna/aie2_ctx.c
+++ b/drivers/accel/amdxdna/aie2_ctx.c
@@ -1286,16 +1286,12 @@ int aie2_cmd_submit(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job,
 void aie2_hmm_invalidate(struct amdxdna_gem_obj *abo,
 			 unsigned long cur_seq)
 {
-	struct amdxdna_dev *xdna = to_xdna_dev(to_gobj(abo)->dev);
-	struct drm_gem_object *gobj = to_gobj(abo);
-	long ret;
-
-	ret = dma_resv_wait_timeout(gobj->resv, DMA_RESV_USAGE_BOOKKEEP,
-				    true, MAX_SCHEDULE_TIMEOUT);
-	if (!ret)
-		XDNA_ERR(xdna, "Failed to wait for bo, ret %ld", ret);
-	else if (ret == -ERESTARTSYS)
-		XDNA_DBG(xdna, "Wait for bo interrupted by signal");
+	/*
+	 * The pages must not be released while the device may still access
+	 * them, so this wait must be neither interruptible nor time limited.
+	 */
+	dma_resv_wait_timeout(to_gobj(abo)->resv, DMA_RESV_USAGE_BOOKKEEP,
+			      false, MAX_SCHEDULE_TIMEOUT);
 }
 
 int aie2_hwctx_heap_expand(struct amdxdna_hwctx *hwctx,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-15 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15 18:32 [PATCH V1] accel/amdxdna: wait uninterruptibly for jobs in the HMM invalidate callback Lizhi Hou
2026-10-15 18:36 ` Mario Limonciello
2026-10-15 18:45 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.