summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMatthew Brost <matthew.brost@intel.com>2025-11-26 10:59:46 -0800
committerMatthew Brost <matthew.brost@intel.com>2025-12-01 10:03:13 -0800
commit81e66a55a8d7c57c664520074c770484054f43b2 (patch)
tree8cfcdc155ec15153bb299ec6e2e73be678109e42 /drivers/gpu
parent819c9ffd425971e0e913e5ee690f3485a28c1e0b (diff)
drm/xe: Add mem_region to properties line in VM snapshot capture
Add memory region to properties line in VM snapshot capture indicating where the memory is located. The memory region corresponds to regions in the uAPI. This is useful information for debug and will help build a robust GPU hang replay tool. The current format is: [<vma address>]: <permissions>|<type>|mem_region=0x%x Permissions has two options, either "read_only" or "read_write". Type has three options, either "userptr", "null_sparse", or "bo". Memory region is a bit mask of where the memory is located. 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-4-matthew.brost@intel.com
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/xe/xe_vm.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 95bf328382bb..f2cf95d23bd0 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -4051,6 +4051,7 @@ struct xe_vm_snapshot {
#define XE_VM_SNAP_FLAG_READ_ONLY BIT(1)
#define XE_VM_SNAP_FLAG_IS_NULL BIT(2)
unsigned long flags;
+ int uapi_mem_region;
struct xe_bo *bo;
void *data;
struct mm_struct *mm;
@@ -4096,6 +4097,18 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm)
if (bo) {
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;
+ }
} else if (xe_vma_is_userptr(vma)) {
struct mm_struct *mm =
to_userptr_vma(vma)->userptr.notifier.mm;
@@ -4107,10 +4120,13 @@ 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;
+ snap->snap[i].uapi_mem_region = 0;
} else if (xe_vma_is_null(vma)) {
snap->snap[i].flags |= XE_VM_SNAP_FLAG_IS_NULL;
+ snap->snap[i].uapi_mem_region = -1;
} else {
snap->snap[i].data = ERR_PTR(-ENOENT);
+ snap->snap[i].uapi_mem_region = -1;
}
i++;
}
@@ -4179,13 +4195,16 @@ void xe_vm_snapshot_print(struct xe_vm_snapshot *snap, struct drm_printer *p)
for (i = 0; i < snap->num_snaps; i++) {
drm_printf(p, "[%llx].length: 0x%lx\n", snap->snap[i].ofs, snap->snap[i].len);
- drm_printf(p, "[%llx].properties: %s|%s\n", snap->snap[i].ofs,
+ drm_printf(p, "[%llx].properties: %s|%s|mem_region=0x%lx\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");
+ "userptr" : "bo",
+ snap->snap[i].uapi_mem_region == -1 ? 0 :
+ BIT(snap->snap[i].uapi_mem_region));
if (IS_ERR(snap->snap[i].data)) {
drm_printf(p, "[%llx].error: %li\n", snap->snap[i].ofs,