drm/xe: Add "null_sparse" type to VM snap properties

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
This commit is contained in:
Matthew Brost 2025-11-26 10:59:45 -08:00
parent eafc150549
commit 819c9ffd42

View 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)) {