[PATCH v4 2/9] drm/xe: Add "null_sparse" type to VM snap properties

Cavitt, Jonathan jonathan.cavitt at intel.com
Wed May 7 20:36:28 UTC 2025


-----Original Message-----
From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of Matthew Brost
Sent: Wednesday, May 7, 2025 1:16 PM
To: intel-xe at lists.freedesktop.org
Cc: Souza, Jose <jose.souza at intel.com>; Santa, Carlos <carlos.santa at intel.com>; Venkatesh Reddy, Sushma <sushma.venkatesh.reddy at intel.com>
Subject: [PATCH v4 2/9] 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 at intel.com>
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>

Admittedly, this looks like it could or should be squashed with
the previous patch in this series, but it's not a blocking request.

Reviewed-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
-Jonathan Cavitt

> ---
>  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 ddeec681f71f..95c51834c620 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -3729,6 +3729,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;
> @@ -3786,6 +3787,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);
>  		}
> @@ -3806,7 +3809,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);
> @@ -3858,6 +3862,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");
>  
> @@ -3867,6 +3873,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
> 
> 


More information about the Intel-xe mailing list