From: Rob Clark <robdclark@gmail.com>
To: igt-dev@lists.freedesktop.org
Cc: Rob Clark <robdclark@chromium.org>
Subject: [PATCH] tests/msm: Add parallel recovery test
Date: Mon, 8 Jan 2024 13:59:06 -0800 [thread overview]
Message-ID: <20240108215906.170647-1-robdclark@gmail.com> (raw)
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
next reply other threads:[~2024-01-08 21:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-08 21:59 Rob Clark [this message]
2024-01-09 0:57 ` ✓ Fi.CI.BAT: success for tests/msm: Add parallel recovery test 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
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=20240108215906.170647-1-robdclark@gmail.com \
--to=robdclark@gmail.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=robdclark@chromium.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