summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMatthew Brost <matthew.brost@intel.com>2025-11-26 10:59:48 -0800
committerMatthew Brost <matthew.brost@intel.com>2025-12-01 10:03:15 -0800
commit066a1ddd8559fa494bf5137a1ef00c8761fcacf8 (patch)
tree199a3dcd844c1a835e30b1561b4deda7d3cb27d7 /drivers/gpu
parent6cf5d14a0bf730d6e45c407b7e3bedb1a5d8812f (diff)
drm/xe: Add cpu_caching to properties line in VM snapshot capture
Add CPU caching to properties line in VM snapshot capture indicating the BO caching properites. 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|pat_index=%d|cpu_caching=%d 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. Pat index corresponds to the value setup upon VM bind. CPU caching corresponds to the value of BO setup upon creation. v2: - Save off cpu_caching value rather than looking at BO (Carlos) v4: - Fix NULL ptr dereference (Carlos) 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-6-matthew.brost@intel.com
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/xe/xe_vm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index b298953d2eed..8bf3f9d3d644 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -4053,6 +4053,7 @@ struct xe_vm_snapshot {
unsigned long flags;
int uapi_mem_region;
int pat_index;
+ int cpu_caching;
struct xe_bo *bo;
void *data;
struct mm_struct *mm;
@@ -4097,6 +4098,7 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm)
XE_VM_SNAP_FLAG_READ_ONLY : 0;
snap->snap[i].pat_index = vma->attr.pat_index;
if (bo) {
+ snap->snap[i].cpu_caching = bo->cpu_caching;
snap->snap[i].bo = xe_bo_get(bo);
snap->snap[i].bo_ofs = xe_vma_bo_offset(vma);
switch (bo->ttm.resource->mem_type) {
@@ -4197,7 +4199,7 @@ 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|mem_region=0x%lx|pat_index=%d\n",
+ drm_printf(p, "[%llx].properties: %s|%s|mem_region=0x%lx|pat_index=%d|cpu_caching=%d\n",
snap->snap[i].ofs,
snap->snap[i].flags & XE_VM_SNAP_FLAG_READ_ONLY ?
"read_only" : "read_write",
@@ -4207,7 +4209,8 @@ void xe_vm_snapshot_print(struct xe_vm_snapshot *snap, struct drm_printer *p)
"userptr" : "bo",
snap->snap[i].uapi_mem_region == -1 ? 0 :
BIT(snap->snap[i].uapi_mem_region),
- snap->snap[i].pat_index);
+ snap->snap[i].pat_index,
+ snap->snap[i].cpu_caching);
if (IS_ERR(snap->snap[i].data)) {
drm_printf(p, "[%llx].error: %li\n", snap->snap[i].ofs,