Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests/msm: Add parallel recovery test
@ 2024-01-08 21:59 Rob Clark
  2024-01-09  0:57 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Rob Clark @ 2024-01-08 21:59 UTC (permalink / raw)
  To: igt-dev; +Cc: Rob Clark

From: Rob Clark <robdclark@chromium.org>

Add parallel recovery test to validate that the kernel does actually
manage to recover the gpu and successfully run unrelated (not hanging)
submits.

Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 tests/msm/msm_recovery.c | 53 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/tests/msm/msm_recovery.c b/tests/msm/msm_recovery.c
index 05c89948bf9a..6088368660f4 100644
--- a/tests/msm/msm_recovery.c
+++ b/tests/msm/msm_recovery.c
@@ -148,6 +148,49 @@ do_hang_test(struct msm_pipe *pipe)
 	read_and_clear_devcore();
 }
 
+/**
+ * SUBTEST: gpu-fault-parallel
+ *
+ * Description: does a bunch of submits in parallel threads, a subset of
+ * which trigger GPU hangs.  For the submits which do not trigger hangs,
+ * validate that they executed properly by checking that they were able
+ * to write to the scratch buffer, so that we can see that the kernel
+ * properly re-plays the non-faulting submits.
+ */
+static void
+do_parallel_test(struct msm_pipe *pipe, int child)
+{
+	struct msm_cmd *cmd = igt_msm_cmd_new(pipe, 0x1000);
+	bool hang = child == 5;
+	int fence_fd;
+
+	msm_cmd_pkt7(cmd, CP_NOP, 0);
+
+	if (hang) {
+		msm_cmd_emit(cmd, 0xdeaddead);
+	} else {
+		/* Each forked thread writes/reads offset of child idx dwords: */
+		msm_cmd_pkt7(cmd, CP_MEM_WRITE, 3);
+		msm_cmd_bo  (cmd, scratch_bo, child * 4); /* ADDR_LO/HI */
+		msm_cmd_emit(cmd, child + 1);             /* VAL */
+	}
+
+	igt_until_timeout(15) {
+		scratch[child] = 0;
+		fence_fd = igt_msm_cmd_submit(cmd);
+		igt_wait_and_close(fence_fd);
+
+		if (hang) {
+			read_and_clear_devcore();
+		} else {
+			/* verify that non-crashing submits succeeded: */
+			igt_assert_eq(scratch[child], child + 1);
+		}
+	}
+
+	igt_msm_cmd_free(cmd);
+}
+
 /*
  * Tests for drm/msm hangcheck, recovery, and fault handling
  */
@@ -183,6 +226,16 @@ igt_main
 		do_hang_test(pipe);
 	}
 
+	igt_describe("Parallel fault handling");
+	igt_subtest("gpu-fault-parallel") {
+		igt_require(dev->gen >= 6);
+
+		igt_fork(child, 20) {
+			do_parallel_test(pipe, child);
+		}
+		igt_waitchildren();
+	}
+
 	igt_describe("Test iova fault handling");
 	igt_subtest("iova-fault") {
 		struct msm_cmd *cmd;
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-09 15:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-08 21:59 [PATCH] tests/msm: Add parallel recovery test Rob Clark
2024-01-09  0:57 ` ✓ Fi.CI.BAT: success for " Patchwork
2024-01-09  0:59 ` ✓ CI.xeBAT: " Patchwork
2024-01-09 11:28 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-01-09 15:05 ` [PATCH] " Kamil Konieczny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox