Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: jose.souza@intel.com, lionel.g.landwerlin@intel.com,
	carlos.santa@intel.com, rodrigo.vivi@intel.com
Subject: [RFC PATCH 2/6] drm/xe: Add "null_sparse" type to VM snap properties
Date: Wed, 22 Jan 2025 17:15:09 -0800	[thread overview]
Message-ID: <20250123011513.362430-3-matthew.brost@intel.com> (raw)
In-Reply-To: <20250123011513.362430-1-matthew.brost@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@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@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 5f9651a4c364..469b00150d87 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -3242,6 +3242,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;
@@ -3299,6 +3300,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);
 		}
@@ -3319,7 +3322,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);
@@ -3371,6 +3375,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");
 
@@ -3380,6 +3386,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.34.1


  parent reply	other threads:[~2025-01-23  1:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23  1:15 [RFC PATCH 0/6] Add support for Mesa GPU hang replay tool Matthew Brost
2025-01-23  1:15 ` [RFC PATCH 1/6] drm/xe: Add properties line to VM snapshot capture Matthew Brost
2025-01-23 17:38   ` Matthew Brost
2025-01-23  1:15 ` Matthew Brost [this message]
2025-01-23  1:15 ` [RFC PATCH 3/6] drm/xe: Add mem_region to properties line in " Matthew Brost
2025-01-23  1:15 ` [RFC PATCH 4/6] drm/xe/uapi: Add DRM_XE_EXEC_QUEUE_SET_HANG_REPLAY_STATE Matthew Brost
2025-01-23 10:36   ` Rodrigo Vivi
2025-01-23 17:37     ` Matthew Brost
2025-01-23  1:15 ` [RFC PATCH 5/6] drm/xe: Add replay_offset and replay_length lines to LRC HWCTX snapshot Matthew Brost
2025-01-23  1:15 ` [RFC PATCH 6/6] drm/xe: Implement DRM_XE_EXEC_QUEUE_SET_HANG_REPLAY_STATE Matthew Brost
2025-01-23 17:40   ` Matthew Brost
2025-01-23  1:24 ` ✓ CI.Patch_applied: success for Add support for Mesa GPU hang replay tool Patchwork
2025-01-23  1:24 ` ✓ CI.checkpatch: " Patchwork
2025-01-23  1:25 ` ✓ CI.KUnit: " Patchwork
2025-01-23  1:42 ` ✓ CI.Build: " Patchwork
2025-01-23  1:44 ` ✓ CI.Hooks: " Patchwork
2025-01-23  1:46 ` ✓ CI.checksparse: " Patchwork
2025-01-23  2:12 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-23 13:03 ` ✗ Xe.CI.Full: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250123011513.362430-3-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=carlos.santa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jose.souza@intel.com \
    --cc=lionel.g.landwerlin@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox