Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/vm: Handle purged BOs in VM snapshots
@ 2026-09-03  9:06 Arvind Yadav
  2026-09-03  9:15 ` ✓ CI.KUnit: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Arvind Yadav @ 2026-09-03  9:06 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, himal.prasad.ghimiray, thomas.hellstrom, Sashiko

A purged BO can remain in a VM after its TTM resource has been freed.
xe_vm_snapshot_capture() can then dereference a NULL resource while
capturing a devcoredump.

Record -ENODATA for the affected VMA instead of dereferencing
the resource.

Fixes: ad9843aac91a ("drm/xe/madvise: Implement purgeable buffer object support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260831064942.315720-17-tejas.upadhyay%40intel.com?part=4
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 19b3d0be7928..77a851d9e373 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -4666,17 +4666,23 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm)
 			snap->snap[i].cpu_caching = bo->cpu_caching;
 			snap->snap[i].bo = xe_bo_get(bo);
 			snap->snap[i].bo_ofs = xe_vma_bo_offset(vma);
-			switch (bo->ttm.resource->mem_type) {
-			case XE_PL_SYSTEM:
-			case XE_PL_TT:
-				snap->snap[i].uapi_mem_region = 0;
-				break;
-			case XE_PL_VRAM0:
-				snap->snap[i].uapi_mem_region = 1;
-				break;
-			case XE_PL_VRAM1:
-				snap->snap[i].uapi_mem_region = 2;
-				break;
+			snap->snap[i].uapi_mem_region = -1;
+
+			if (!bo->ttm.resource) {
+				snap->snap[i].data = ERR_PTR(-ENODATA);
+			} else {
+				switch (bo->ttm.resource->mem_type) {
+				case XE_PL_SYSTEM:
+				case XE_PL_TT:
+					snap->snap[i].uapi_mem_region = 0;
+					break;
+				case XE_PL_VRAM0:
+					snap->snap[i].uapi_mem_region = 1;
+					break;
+				case XE_PL_VRAM1:
+					snap->snap[i].uapi_mem_region = 2;
+					break;
+				}
 			}
 		} else if (xe_vma_is_userptr(vma)) {
 			struct mm_struct *mm =
-- 
2.43.0


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

end of thread, other threads:[~2026-09-04  4:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03  9:06 [PATCH] drm/xe/vm: Handle purged BOs in VM snapshots Arvind Yadav
2026-09-03  9:15 ` ✓ CI.KUnit: success for " Patchwork
2026-09-03 10:01 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-03 19:16 ` [PATCH] " Matthew Brost
2026-09-04  4:46   ` Yadav, Arvind
2026-09-03 20:51 ` ✗ Xe.CI.FULL: failure for " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox