[PATCH v2 0/2] Fix invalidated inline DMA mappings in GPUSVM
From: Arvind Yadav
Date: Fri Dec 04 2026 - 01:53:37 EST
Invalidation during HMM can leave stale inline DMA state. This skips
DMA array allocation and makes the mapper use a DMA address as an
array pointer, causing a KASAN report in the Xe prefetch worker.
===================================================================
BUG: KASAN: user-memory-access in drm_gpusvm_get_pages+0xe12/0x1380 [drm_gpusvm_helper]
Write of size 16 at addr 000000027abfd000 by task kworker/u64:71/693678
Workqueue: xe_prefetch_work_queue prefetch_work_func [xe]
Following Matt's suggestion, clear inline DMA state during unmap
instead of adding another retry after HMM.
Prepare Xe first by copying inline entries under notifier_lock for
page-table staging. When an invalidated userptr stages cleared PTEs,
preserve that state in tile_invalidated at commit.
Changes in v2:
- Clear inline DMA state during unmap instead of retrying after HMM
(Matthew Brost).
- Add the Xe snapshot patch and track cleared PTEs through commit.
- Update the inline DMA helper's lifetime documentation.
Arvind Yadav (2):
drm/xe: Snapshot inline DMA addresses before staging page tables
drm/gpusvm: Clear inline DMA mapping state on unmap
drivers/gpu/drm/drm_gpusvm.c | 5 ++
drivers/gpu/drm/xe/xe_pt.c | 82 ++++++++++++++++++++++++++++----
drivers/gpu/drm/xe/xe_pt_types.h | 2 +
include/drm/drm_gpusvm.h | 14 +++---
4 files changed, 89 insertions(+), 14 deletions(-)
--
2.43.0