Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Subject: [PATCH v5 8/9] drm/xe: Add infrastructure for delayed LRC capture
Date: Wed, 21 Feb 2024 14:30:23 +0100	[thread overview]
Message-ID: <20240221133024.898315-8-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20240221133024.898315-1-maarten.lankhorst@linux.intel.com>

Add a xe_guc_exec_queue_snapshot_capture_delayed and
xe_lrc_snapshot_capture_delayed function to capture
the contents of LRC in the next patch.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/xe/xe_devcoredump.c |  7 +++----
 drivers/gpu/drm/xe/xe_guc_submit.c  | 19 +++++++++++++++++++
 drivers/gpu/drm/xe/xe_guc_submit.h  |  2 ++
 drivers/gpu/drm/xe/xe_lrc.c         |  8 ++++++++
 drivers/gpu/drm/xe/xe_lrc.h         |  1 +
 drivers/gpu/drm/xe/xe_vm.c          |  3 +++
 6 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c
index 68d3d623a05bf..0fcd306803236 100644
--- a/drivers/gpu/drm/xe/xe_devcoredump.c
+++ b/drivers/gpu/drm/xe/xe_devcoredump.c
@@ -65,8 +65,8 @@ static void xe_devcoredump_deferred_snap_work(struct work_struct *work)
 	struct xe_devcoredump_snapshot *ss = container_of(work, typeof(*ss), work);
 
 	xe_force_wake_get(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL);
-	if (ss->vm)
-		xe_vm_snapshot_capture_delayed(ss->vm);
+	xe_vm_snapshot_capture_delayed(ss->vm);
+	xe_guc_exec_queue_snapshot_capture_delayed(ss->ge);
 	xe_force_wake_put(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL);
 }
 
@@ -196,8 +196,7 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
 		coredump->snapshot.hwe[id] = xe_hw_engine_snapshot_capture(hwe);
 	}
 
-	if (ss->vm)
-		queue_work(system_unbound_wq, &ss->work);
+	queue_work(system_unbound_wq, &ss->work);
 
 	xe_force_wake_put(gt_to_fw(q->gt), XE_FORCEWAKE_ALL);
 	dma_fence_end_signalling(cookie);
diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 7348689ec5aef..d681672721a94 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -1859,6 +1859,25 @@ xe_guc_exec_queue_snapshot_capture(struct xe_sched_job *job)
 	return snapshot;
 }
 
+
+/**
+ * xe_guc_exec_queue_snapshot_capture_delayed - Take delayed part of snapshot of the GuC Engine.
+ * @snapshot: Previously captured snapshot of job.
+ *
+ * This captures some data that requires taking some locks, so it cannot be done in signaling path.
+ */
+void
+xe_guc_exec_queue_snapshot_capture_delayed(struct xe_guc_submit_exec_queue_snapshot *snapshot)
+{
+	int i;
+
+	if (!snapshot || !snapshot->lrc)
+		return;
+
+	for (i = 0; i < snapshot->width; ++i)
+		xe_lrc_snapshot_capture_delayed(snapshot->lrc[i]);
+}
+
 /**
  * xe_guc_exec_queue_snapshot_print - Print out a given GuC Engine snapshot.
  * @snapshot: GuC Submit Engine snapshot object.
diff --git a/drivers/gpu/drm/xe/xe_guc_submit.h b/drivers/gpu/drm/xe/xe_guc_submit.h
index 723dc2bd8df91..2f14dfd047228 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.h
+++ b/drivers/gpu/drm/xe/xe_guc_submit.h
@@ -29,6 +29,8 @@ int xe_guc_exec_queue_reset_failure_handler(struct xe_guc *guc, u32 *msg, u32 le
 struct xe_guc_submit_exec_queue_snapshot *
 xe_guc_exec_queue_snapshot_capture(struct xe_sched_job *job);
 void
+xe_guc_exec_queue_snapshot_capture_delayed(struct xe_guc_submit_exec_queue_snapshot *snapshot);
+void
 xe_guc_exec_queue_snapshot_print(struct xe_guc_submit_exec_queue_snapshot *snapshot,
 				 struct drm_printer *p);
 void
diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
index 2fe044ffae381..20f235cdaca34 100644
--- a/drivers/gpu/drm/xe/xe_lrc.c
+++ b/drivers/gpu/drm/xe/xe_lrc.c
@@ -1336,6 +1336,14 @@ struct xe_lrc_snapshot *xe_lrc_snapshot_capture(struct xe_lrc *lrc)
 	return snapshot;
 }
 
+void xe_lrc_snapshot_capture_delayed(struct xe_lrc_snapshot *snapshot)
+{
+	if (!snapshot)
+		return;
+
+	/* TODO: Copy status page */
+}
+
 void xe_lrc_snapshot_print(struct xe_lrc_snapshot *snapshot, struct drm_printer *p)
 {
 	if (!snapshot)
diff --git a/drivers/gpu/drm/xe/xe_lrc.h b/drivers/gpu/drm/xe/xe_lrc.h
index d6dd4045d6d7d..d32fa31faa2cf 100644
--- a/drivers/gpu/drm/xe/xe_lrc.h
+++ b/drivers/gpu/drm/xe/xe_lrc.h
@@ -56,6 +56,7 @@ void xe_lrc_dump_default(struct drm_printer *p,
 void xe_lrc_emit_hwe_state_instructions(struct xe_exec_queue *q, struct xe_bb *bb);
 
 struct xe_lrc_snapshot *xe_lrc_snapshot_capture(struct xe_lrc *lrc);
+void xe_lrc_snapshot_capture_delayed(struct xe_lrc_snapshot *snapshot);
 void xe_lrc_snapshot_print(struct xe_lrc_snapshot *snapshot, struct drm_printer *p);
 void xe_lrc_snapshot_free(struct xe_lrc_snapshot *snapshot);
 
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 056ba970a70c8..4bffa758cb5a6 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -3340,6 +3340,9 @@ struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm)
 
 void xe_vm_snapshot_capture_delayed(struct xe_vm_snapshot *snap)
 {
+	if (!snap)
+		return;
+
 	for (int i = 0; i < snap->num_snaps; i++) {
 		struct xe_bo *bo = snap->snap[i].bo;
 		struct iosys_map src;
-- 
2.43.0


  parent reply	other threads:[~2024-02-21 13:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 13:30 [PATCH v5 1/9] drm/xe/snapshot: Remove drm_err on guc alloc failures Maarten Lankhorst
2024-02-21 13:30 ` [PATCH v5 2/9] drm/xe: Clear all snapshot members after deleting coredump Maarten Lankhorst
2024-02-21 15:09   ` Francois Dugast
2024-02-21 13:30 ` [PATCH v5 3/9] drm/xe: Add uapi for dumpable bos Maarten Lankhorst
2024-02-21 13:30 ` [PATCH v5 4/9] drm/xe: Annotate each dumpable vma as such Maarten Lankhorst
2024-02-21 13:30 ` [PATCH v5 5/9] drm/xe: Add vm snapshot mutex for easily taking a vm snapshot during devcoredump Maarten Lankhorst
2024-02-21 13:30 ` [PATCH v5 6/9] drm/xe: Implement VM snapshot support for BO's and userptr Maarten Lankhorst
2024-02-21 13:30 ` [PATCH v5 7/9] drm/xe: Move lrc snapshot capturing to xe_lrc.c Maarten Lankhorst
2024-02-21 17:56   ` Souza, Jose
2024-02-21 19:27     ` Maarten Lankhorst
2024-02-21 13:30 ` Maarten Lankhorst [this message]
2024-02-21 13:30 ` [PATCH v5 9/9] drm/xe: Implement capture of HWSP and HWCTX Maarten Lankhorst
2024-02-21 17:26   ` Souza, Jose
2024-02-21 17:29     ` Maarten Lankhorst
2024-02-21 17:44       ` Souza, Jose
2024-02-21 17:45   ` Souza, Jose
2024-02-21 17:56   ` Souza, Jose
2024-02-22 15:30     ` Souza, Jose
2024-02-21 13:37 ` ✓ CI.Patch_applied: success for series starting with [v5,1/9] drm/xe/snapshot: Remove drm_err on guc alloc failures Patchwork
2024-02-21 13:38 ` ✗ CI.checkpatch: warning " Patchwork
2024-02-21 13:40 ` ✓ CI.KUnit: success " Patchwork
2024-02-21 13:52 ` ✓ CI.Build: " Patchwork
2024-02-21 13:53 ` ✓ CI.Hooks: " Patchwork
2024-02-21 13:54 ` ✓ CI.checksparse: " Patchwork
2024-02-21 14:02 ` [PATCH v5 1/9] " Francois Dugast
2024-02-21 14:30 ` ✓ CI.BAT: success for series starting with [v5,1/9] " 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=20240221133024.898315-8-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox