Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 3/3] tests/i915_hangman: add multigpu basic error state subtest
Date: Thu, 20 Apr 2023 20:24:40 +0200	[thread overview]
Message-ID: <20230420182440.49442-4-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20230420182440.49442-1-kamil.konieczny@linux.intel.com>

Verify that basic error capture works in multiGPU hardware
configuration for two or more GPUs.

Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tests/i915/i915_hangman.c | 63 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 55 insertions(+), 8 deletions(-)

diff --git a/tests/i915/i915_hangman.c b/tests/i915/i915_hangman.c
index d76d0a037..580b3a739 100644
--- a/tests/i915/i915_hangman.c
+++ b/tests/i915/i915_hangman.c
@@ -39,6 +39,7 @@
 #include "igt_store.h"
 #include "igt_sysfs.h"
 #include "igt_debugfs.h"
+#include "igt_device_scan.h"
 #include "sw_sync.h"
 
 #ifndef I915_PARAM_CMD_PARSER_VERSION
@@ -514,6 +515,21 @@ static void do_tests(int device, int sysfs, const char *name, const char *prefix
 	}
 }
 
+static int set_engines_prop(int device, struct gem_engine_properties *params)
+{
+	const struct intel_execution_engine2 *e;
+	int num = 0;
+
+	for_each_physical_engine(device, e) {
+		params[num].engine = e;
+		params[num].preempt_timeout = 500;
+		params[num].heartbeat_interval = 1000;
+		gem_engine_properties_configure(device, params + num++);
+	}
+
+	return num;
+}
+
 igt_main
 {
 	const intel_ctx_t *ctx;
@@ -522,10 +538,9 @@ igt_main
 	int num_engines = 0;
 	int sysfs_fd = -1;
 	int i915 = -1;
+	int gpu_count;
 
 	igt_fixture {
-		const struct intel_execution_engine2 *e;
-
 		i915 = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(i915);
 
@@ -540,12 +555,8 @@ igt_main
 
 		gem_require_mmap_device_coherent(i915);
 
-		for_each_physical_engine(i915, e) {
-			saved_params[num_engines].engine = e;
-			saved_params[num_engines].preempt_timeout = 500;
-			saved_params[num_engines].heartbeat_interval = 1000;
-			gem_engine_properties_configure(i915, saved_params + num_engines++);
-		}
+		num_engines = set_engines_prop(i915, &saved_params[0]);
+		gpu_count = igt_device_filter_count();
 	}
 
 	igt_describe("Basic error capture");
@@ -576,6 +587,42 @@ igt_main
 
 	do_tests(i915, sysfs_fd, "engine", "engine", ctx);
 
+	igt_describe("Basic multigpu error capture");
+	igt_subtest("multigpu-error-basic") {
+		igt_require(gpu_count > 1);
+
+		igt_multi_fork(child, gpu_count) {
+			int gpu_fd, gpu_sysfs;
+
+			if (child)
+				gpu_fd = __drm_open_driver_another(child, DRIVER_INTEL);
+			else
+				gpu_fd = gem_reopen_driver(i915);
+
+			igt_assert(gpu_fd > 0);
+			igt_require_gem(gpu_fd);
+			ctx = intel_ctx_create_all_physical(gpu_fd);
+			hang = igt_allow_hang(gpu_fd, ctx->id, HANG_ALLOW_CAPTURE | HANG_WANT_ENGINE_RESET);
+			gpu_sysfs = igt_sysfs_open(gpu_fd);
+			igt_assert(gpu_sysfs != -1);
+			igt_require(has_error_state(gpu_sysfs));
+			gem_require_mmap_device_coherent(gpu_sysfs);
+			num_engines = set_engines_prop(gpu_fd, &saved_params[0]);
+
+			test_error_state_basic(gpu_fd, gpu_sysfs);
+
+			igt_disallow_hang(gpu_fd, hang);
+			intel_ctx_destroy(gpu_fd, ctx);
+			if (child)
+				for (int i = 0; i < num_engines; i++)
+					gem_engine_properties_restore(i915, saved_params + i);
+			close(gpu_fd);
+			close(gpu_sysfs);
+		}
+
+		igt_waitchildren();
+	}
+
 	igt_fixture {
 		int i;
 
-- 
2.37.2

  parent reply	other threads:[~2023-04-20 18:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 18:24 [igt-dev] [PATCH i-g-t 0/3] Add multi-gpu basic error state subtest Kamil Konieczny
2023-04-20 18:24 ` [igt-dev] [PATCH i-g-t 1/3] tests/i915_hangman: make sysfs var local Kamil Konieczny
2023-04-27 15:01   ` Mauro Carvalho Chehab
2023-04-20 18:24 ` [igt-dev] [PATCH i-g-t 2/3] tests/i915_hangman: make device " Kamil Konieczny
2023-04-27 15:04   ` Mauro Carvalho Chehab
2023-04-20 18:24 ` Kamil Konieczny [this message]
2023-04-27 15:09   ` [igt-dev] [PATCH i-g-t 3/3] tests/i915_hangman: add multigpu basic error state subtest Mauro Carvalho Chehab
2023-04-20 19:13 ` [igt-dev] ✓ Fi.CI.BAT: success for Add multi-gpu " Patchwork
2023-04-21  2:49 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20230420182440.49442-4-kamil.konieczny@linux.intel.com \
    --to=kamil.konieczny@linux.intel.com \
    --cc=igt-dev@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