All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten@mblankhorst.nl, "Lankhorst <maarten.lankhorst"@linux.intel.com
To: intel-xe@lists.freedesktop.org
Cc: Maarten Lankhorst <dev@lankhorst.se>
Subject: [Intel-xe] [PATCH 2/4] drm/xe: Annotate each dumpable vma as such
Date: Tue, 24 Oct 2023 14:22:54 +0200	[thread overview]
Message-ID: <20231024122256.19512-3-dev@lankhorst.se> (raw)
In-Reply-To: <20231024122256.19512-1-dev@lankhorst.se>

From: Maarten Lankhorst <dev@lankhorst.se>

In preparation for snapshot dumping, mark each dumpable VMA as such, so
we can walk over the VM later and dump it.

Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
---
 drivers/gpu/drm/xe/xe_vm.c       | 21 ++++++++++++++++-----
 drivers/gpu/drm/xe/xe_vm_types.h |  3 +++
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index dca03d8ad98e..e17af7aa1ca1 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -864,6 +864,7 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm,
 				    u64 start, u64 end,
 				    bool read_only,
 				    bool is_null,
+				    bool dumpable,
 				    u8 tile_mask)
 {
 	struct xe_vma *vma;
@@ -895,6 +896,8 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm,
 		vma->gpuva.flags |= XE_VMA_READ_ONLY;
 	if (is_null)
 		vma->gpuva.flags |= DRM_GPUVA_SPARSE;
+	if (dumpable)
+		vma->gpuva.flags |= XE_VMA_DUMPABLE;
 
 	if (tile_mask) {
 		vma->tile_mask = tile_mask;
@@ -2199,6 +2202,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
 			op->map.read_only =
 				flags & XE_VM_BIND_FLAG_READONLY;
 			op->map.is_null = flags & XE_VM_BIND_FLAG_NULL;
+			op->map.dumpable = operation & XE_VM_BIND_FLAG_DUMPABLE;
 		}
 		break;
 	case XE_VM_BIND_OP_UNMAP:
@@ -2263,7 +2267,8 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
 }
 
 static struct xe_vma *new_vma(struct xe_vm *vm, struct drm_gpuva_op_map *op,
-			      u8 tile_mask, bool read_only, bool is_null)
+			      u8 tile_mask, bool read_only, bool is_null,
+			      bool dumpable)
 {
 	struct xe_bo *bo = op->gem.obj ? gem_to_xe_bo(op->gem.obj) : NULL;
 	struct xe_vma *vma;
@@ -2279,7 +2284,7 @@ static struct xe_vma *new_vma(struct xe_vm *vm, struct drm_gpuva_op_map *op,
 	vma = xe_vma_create(vm, bo, op->gem.offset,
 			    op->va.addr, op->va.addr +
 			    op->va.range - 1, read_only, is_null,
-			    tile_mask);
+			    dumpable, tile_mask);
 	if (bo)
 		xe_bo_unlock(bo);
 
@@ -2414,7 +2419,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q,
 
 			vma = new_vma(vm, &op->base.map,
 				      op->tile_mask, op->map.read_only,
-				      op->map.is_null);
+				      op->map.is_null, op->map.dumpable);
 			if (IS_ERR(vma))
 				return PTR_ERR(vma);
 
@@ -2437,10 +2442,13 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q,
 				bool is_null =
 					op->base.remap.unmap->va->flags &
 					DRM_GPUVA_SPARSE;
+				bool dumpable =
+					op->base.remap.unmap->va->flags &
+					XE_VMA_DUMPABLE;
 
 				vma = new_vma(vm, op->base.remap.prev,
 					      op->tile_mask, read_only,
-					      is_null);
+					      is_null, dumpable);
 				if (IS_ERR(vma))
 					return PTR_ERR(vma);
 
@@ -2471,10 +2479,13 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q,
 				bool is_null =
 					op->base.remap.unmap->va->flags &
 					DRM_GPUVA_SPARSE;
+				bool dumpable =
+					op->base.remap.unmap->va->flags &
+					XE_VMA_DUMPABLE;
 
 				vma = new_vma(vm, op->base.remap.next,
 					      op->tile_mask, read_only,
-					      is_null);
+					      is_null, dumpable);
 				if (IS_ERR(vma))
 					return PTR_ERR(vma);
 
diff --git a/drivers/gpu/drm/xe/xe_vm_types.h b/drivers/gpu/drm/xe/xe_vm_types.h
index aaf0c7101019..6852af366ea2 100644
--- a/drivers/gpu/drm/xe/xe_vm_types.h
+++ b/drivers/gpu/drm/xe/xe_vm_types.h
@@ -32,6 +32,7 @@ struct xe_vm;
 #define XE_VMA_PTE_4K		(DRM_GPUVA_USERBITS << 5)
 #define XE_VMA_PTE_2M		(DRM_GPUVA_USERBITS << 6)
 #define XE_VMA_PTE_1G		(DRM_GPUVA_USERBITS << 7)
+#define XE_VMA_DUMPABLE		(DRM_GPUVA_USERBITS << 8)
 
 /** struct xe_userptr - User pointer */
 struct xe_userptr {
@@ -340,6 +341,8 @@ struct xe_vma_op_map {
 	bool read_only;
 	/** @is_null: is NULL binding */
 	bool is_null;
+	/** @dumpable: whether BO is dumped on GPU hang */
+	bool dumpable;
 };
 
 /** struct xe_vma_op_remap - VMA remap operation */
-- 
2.40.1


  parent reply	other threads:[~2023-10-24 12:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 12:22 [Intel-xe] [PATCH 0/4] drm/xe: Implement snapshot support Maarten, Lankhorst <maarten.lankhorst
2023-10-24 12:22 ` [Intel-xe] [PATCH 1/4] drm/xe: Add uapi for dumpable bos Maarten, Lankhorst <maarten.lankhorst
2023-11-13 21:41   ` Souza, Jose
2023-10-24 12:22 ` Maarten, Lankhorst <maarten.lankhorst [this message]
2023-10-24 12:22 ` [Intel-xe] [PATCH 3/4] drm/xe: Add vm snapshot mutex for easily taking a vm snapshot during devcoredump Maarten, Lankhorst <maarten.lankhorst
2023-10-24 12:22 ` [Intel-xe] [PATCH 4/4] drm/xe: Implement VM snapshot support Maarten, Lankhorst <maarten.lankhorst
2023-10-27 12:17   ` Thomas Hellström
2023-10-27 17:47     ` Maarten Lankhorst
2023-11-13 21:52   ` Souza, Jose
2024-01-22 18:03   ` Souza, Jose
2023-10-24 13:07 ` [Intel-xe] ✓ CI.Patch_applied: success for drm/xe: Implement " Patchwork
2023-10-24 13:07 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-10-24 13:09 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-10-24 13:16 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-10-24 13:16 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-10-24 13:18 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-10-24 13:52 ` [Intel-xe] ✓ CI.BAT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-10-13 15:21 [Intel-xe] [PATCH 0/4] RFC for discussion of devcoredump uapi maarten.lankhorst
2023-10-13 15:21 ` [Intel-xe] [PATCH 2/4] drm/xe: Annotate each dumpable vma as such maarten.lankhorst

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=20231024122256.19512-3-dev@lankhorst.se \
    --to=maarten@mblankhorst.nl \
    --cc="Lankhorst <maarten.lankhorst"@linux.intel.com \
    --cc=dev@lankhorst.se \
    --cc=intel-xe@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.