[RFC PATCH 1/6] drm/xe: Add properties line to VM snapshot capture
Matthew Brost
matthew.brost at intel.com
Thu Jan 23 17:38:18 UTC 2025
On Wed, Jan 22, 2025 at 05:15:08PM -0800, Matthew Brost wrote:
> Add properties line to VM snapshot capture which includes additional
> information about VMA being dumped. This is helpful for debug purposes
> but also to build a robust GPU hang replay tool.
>
> The current format is:
>
> [<vma address>]: <permissions>|<type>
>
Typo.
s/[<vma address>]:/[<vma address>].properties:/
Also exists in the next few patches commit messages too. Will fix in
rev.
Matt
> Permissions has two options, either "read_only" or "read_write".
>
> Type has two options, either "userptr" 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 | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 690330352d4c..5f9651a4c364 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -3240,6 +3240,9 @@ struct xe_vm_snapshot {
> struct {
> u64 ofs, bo_ofs;
> unsigned long len;
> +#define XE_VM_SNAP_FLAG_USERPTR BIT(0)
> +#define XE_VM_SNAP_FLAG_READ_ONLY BIT(1)
> + unsigned long flags;
> struct xe_bo *bo;
> void *data;
> struct mm_struct *mm;
> @@ -3280,6 +3283,8 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm)
>
> snap->snap[i].ofs = xe_vma_start(vma);
> snap->snap[i].len = xe_vma_size(vma);
> + snap->snap[i].flags = xe_vma_read_only(vma) ?
> + XE_VM_SNAP_FLAG_READ_ONLY : 0;
> if (bo) {
> snap->snap[i].bo = xe_bo_get(bo);
> snap->snap[i].bo_ofs = xe_vma_bo_offset(vma);
> @@ -3293,6 +3298,7 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm)
> snap->snap[i].data = ERR_PTR(-EFAULT);
>
> snap->snap[i].bo_ofs = xe_vma_userptr(vma);
> + snap->snap[i].flags |= XE_VM_SNAP_FLAG_USERPTR;
> } else {
> snap->snap[i].data = ERR_PTR(-ENOENT);
> }
> @@ -3362,6 +3368,12 @@ 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,
> + snap->snap[i].flags & XE_VM_SNAP_FLAG_READ_ONLY ?
> + "read_only" : "read_write",
> + snap->snap[i].flags & XE_VM_SNAP_FLAG_USERPTR ?
> + "userptr" : "bo");
> +
> if (IS_ERR(snap->snap[i].data)) {
> drm_printf(p, "[%llx].error: %li\n", snap->snap[i].ofs,
> PTR_ERR(snap->snap[i].data));
> --
> 2.34.1
>
More information about the Intel-xe
mailing list