drm/xe: Add infrastructure for delayed LRC capture
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tue, 27 Feb 2024 13:12:46 +0000 (14:12 +0100)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Mon, 4 Mar 2024 11:24:38 +0000 (12:24 +0100)
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>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240227131248.92910-2-maarten.lankhorst@linux.intel.com
drivers/gpu/drm/xe/xe_devcoredump.c
drivers/gpu/drm/xe/xe_guc_submit.c
drivers/gpu/drm/xe/xe_guc_submit.h
drivers/gpu/drm/xe/xe_lrc.c
drivers/gpu/drm/xe/xe_lrc.h
drivers/gpu/drm/xe/xe_vm.c

index 68d3d623a05bfa3dc8ffc0f1901dbba2b55d1529..0fcd30680323643f44ea238d4ee6736b7cb8937d 100644 (file)
@@ -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);
index ed5c811208b2df990ac3c712009668f33ffbcec6..19efdb2f881f9f8914af335a8b0b066bdc8364f7 100644 (file)
@@ -1865,6 +1865,24 @@ 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.
index 723dc2bd8df91260b0cdbc35201e6737d993483c..2f14dfd047228364f79fbaa33d1ade25122caf57 100644 (file)
@@ -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
index 046d954a26c38b8fbf85a28755e8aa13819ed95a..3f32b1bd7e910026a880d4f7a31ae4ba1436f154 100644 (file)
@@ -1359,6 +1359,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)
index d6dd4045d6d7d6b31f9945e6a9c079d1a790fda4..d32fa31faa2cf44f44b3e721760f01ec8d1beace 100644 (file)
@@ -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);
 
index d28260351af2e330c16dbbf94609f19b285d1806..643b3701a7386c77c3f25260400693628a9aeda1 100644 (file)
@@ -3377,6 +3377,9 @@ out_unlock:
 
 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;