]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Add "null_sparse" type to VM snap properties
authorMatthew Brost <matthew.brost@intel.com>
Wed, 26 Nov 2025 18:59:45 +0000 (10:59 -0800)
committerMatthew Brost <matthew.brost@intel.com>
Mon, 1 Dec 2025 18:03:12 +0000 (10:03 -0800)
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:

[<vma address>]: <permissions>|<type>

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 <jose.souza@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Link: https://patch.msgid.link/20251126185952.546277-3-matthew.brost@intel.com
drivers/gpu/drm/xe/xe_vm.c

index 880877b10d9187f0d9818d4faaa37a94305231e9..95bf328382bbf5e346219d9198df384b655a60b0 100644 (file)
@@ -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)) {