[RFC v2 2/6] drm/xe: Add "null_sparse" type to VM snap properties
Carlos Santa
carlos.santa at intel.corp-partner.google.com
Tue Feb 11 02:20:02 UTC 2025
From: Matthew Brost <matthew.brost at intel.com>
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 at intel.com>
Signed-off-by: Matthew Brost <matthew.brost at 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 130c31775787..75904637e1dd 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -3381,6 +3381,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;
@@ -3438,6 +3439,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);
}
@@ -3458,7 +3461,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);
@@ -3510,6 +3514,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");
@@ -3519,6 +3525,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.43.0
More information about the Intel-xe
mailing list