From 819c9ffd425971e0e913e5ee690f3485a28c1e0b Mon Sep 17 00:00:00 2001 From: Matthew Brost Date: Wed, 26 Nov 2025 10:59:45 -0800 Subject: [PATCH] drm/xe: Add "null_sparse" type to VM snap properties MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add "null_sparse" type to VM snap properties indicating the VMA reads zero and writes are droppped. This is useful information for debug and will help build a robust GPU hang replay tool. The current format is: []: | Permissions has two options, either "read_only" or "read_write". Type has three options, either "userptr", "null_sparse", or "bo". Cc: José Roberto de Souza Signed-off-by: Matthew Brost Reviewed-by: Jonathan Cavitt Link: https://patch.msgid.link/20251126185952.546277-3-matthew.brost@intel.com --- drivers/gpu/drm/xe/xe_vm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c index 880877b10d91..95bf328382bb 100644 --- a/drivers/gpu/drm/xe/xe_vm.c +++ b/drivers/gpu/drm/xe/xe_vm.c @@ -4049,6 +4049,7 @@ struct xe_vm_snapshot { unsigned long len; #define XE_VM_SNAP_FLAG_USERPTR BIT(0) #define XE_VM_SNAP_FLAG_READ_ONLY BIT(1) +#define XE_VM_SNAP_FLAG_IS_NULL BIT(2) unsigned long flags; struct xe_bo *bo; void *data; @@ -4106,6 +4107,8 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm) snap->snap[i].bo_ofs = xe_vma_userptr(vma); snap->snap[i].flags |= XE_VM_SNAP_FLAG_USERPTR; + } else if (xe_vma_is_null(vma)) { + snap->snap[i].flags |= XE_VM_SNAP_FLAG_IS_NULL; } else { snap->snap[i].data = ERR_PTR(-ENOENT); } @@ -4126,7 +4129,8 @@ void xe_vm_snapshot_capture_delayed(struct xe_vm_snapshot *snap) struct xe_bo *bo = snap->snap[i].bo; int err; - if (IS_ERR(snap->snap[i].data)) + if (IS_ERR(snap->snap[i].data) || + snap->snap[i].flags & XE_VM_SNAP_FLAG_IS_NULL) continue; snap->snap[i].data = kvmalloc(snap->snap[i].len, GFP_USER); @@ -4178,6 +4182,8 @@ void xe_vm_snapshot_print(struct xe_vm_snapshot *snap, struct drm_printer *p) drm_printf(p, "[%llx].properties: %s|%s\n", snap->snap[i].ofs, snap->snap[i].flags & XE_VM_SNAP_FLAG_READ_ONLY ? "read_only" : "read_write", + snap->snap[i].flags & XE_VM_SNAP_FLAG_IS_NULL ? + "null_sparse" : snap->snap[i].flags & XE_VM_SNAP_FLAG_USERPTR ? "userptr" : "bo"); @@ -4187,6 +4193,9 @@ void xe_vm_snapshot_print(struct xe_vm_snapshot *snap, struct drm_printer *p) continue; } + if (snap->snap[i].flags & XE_VM_SNAP_FLAG_IS_NULL) + continue; + drm_printf(p, "[%llx].data: ", snap->snap[i].ofs); for (j = 0; j < snap->snap[i].len; j += sizeof(u32)) { -- 2.47.3