Skip to content

Commit d0c378b

Browse files
author
Jocelyn Falempe
committed
drm/xe: Wait for migration job before unmapping pages
JIRA: https://issues.redhat.com/browse/RHEL-53571 Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git (v6.12.9) commit c8f05dc Author: Nirmoy Das <nirmoy.das@intel.com> AuthorDate: Fri Dec 13 13:24:15 2024 +0100 Commit: Greg Kroah-Hartman <gregkh@linuxfoundation.org> CommitDate: Thu Jan 9 13:33:49 2025 +0100 commit 5e0a67f upstream. Fix a potential GPU page fault during tt -> system moves by waiting for migration jobs to complete before unmapping SG. This ensures that IOMMU mappings are not prematurely torn down while a migration job is still in progress. v2: Use intr=false(Matt A) v3: Update commit message(Matt A) v4: s/DMA_RESV_USAGE_BOOKKEEP/DMA_RESV_USAGE_KERNEL(Thomas) Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3466 Fixes: 75521e8 ("drm/xe: Perform dma_map when moving system buffer objects to TT") Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: stable@vger.kernel.org # v6.11+ Cc: Matthew Auld <matthew.auld@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241213122415.3880017-2-nirmoy.das@intel.com Signed-off-by: Nirmoy Das <nirmoy.das@intel.com> (cherry picked from commit cda0641) Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
1 parent 0a49c92 commit d0c378b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,16 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
846846

847847
out:
848848
if ((!ttm_bo->resource || ttm_bo->resource->mem_type == XE_PL_SYSTEM) &&
849-
ttm_bo->ttm)
849+
ttm_bo->ttm) {
850+
long timeout = dma_resv_wait_timeout(ttm_bo->base.resv,
851+
DMA_RESV_USAGE_KERNEL,
852+
false,
853+
MAX_SCHEDULE_TIMEOUT);
854+
if (timeout < 0)
855+
ret = timeout;
856+
850857
xe_tt_unmap_sg(ttm_bo->ttm);
858+
}
851859

852860
return ret;
853861
}

0 commit comments

Comments
 (0)