Skip to contentSkip to conversation

lib/igt_core: store GPU string or opened device name

PATCH Superseded Kamil Konieczny 4 participants 14 messages Dec 2, 2022 – Dec 7, 2022 3 messages not in the archive Library code

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/7 lib/igt_core: store GPU string or opened device name

From: Mauro Carvalho Chehab <[email protected]>

This is helpful on tests that run with multiple GPUs. The name will be automatically filled when a device will be opened.

v2: reorganized code, changed commit message to note that
it will be filled with pathname of opended device, also correct static initialization [Kamil]

---
 lib/drmtest.c  |  4 +++-
 lib/igt_core.c | 30 ++++++++++++++++++++++++++++++
 lib/igt_core.h |  6 ++++++
 3 files changed, 39 insertions(+), 1 deletion(-)
lib/drmtest.c +3 -1
index 16e80bdf..5eb98272 100644
@@ -222,8 +222,10 @@ static int open_device(const char *name, unsigned int chipset)
 			break;
 		}
 	}
-	if ((chipset & chip) == chip)
+	if ((chipset & chip) == chip) {
+		set_gpu_string(name);
 		return fd;
+	}
 
 err:
 	close(fd);
lib/igt_core.c +30 -0
index dca380d0..68ae7289 100644
@@ -1576,6 +1576,36 @@ static void kill_and_wait(pid_t *pids, int size, int signum)
 	}
 }
 
+static __thread char *gpu_string;
+
+void set_gpu_string(const char *fname)
+{
+	char sysfs[PATH_MAX], *path, *p;
+
+	if (gpu_string) {
+		free(gpu_string);
+		gpu_string = NULL;
+	}
+
+	if (!fname)
+		return;
+
+	p = strrchr(fname, '/');
+	if (!p) {
+		path = strdup(fname);
+	} else {
+		p++;
+
+		strcpy(sysfs, "/sys/class/drm/");
+		strcat(sysfs, p);
+		path = realpath(sysfs, NULL);
+		igt_debug("opened %s as %s\n", fname, path);
+	}
+
+	gpu_string = path;
+	igt_assert(gpu_string);
+}
+
 __noreturn static void exit_subtest(const char *result)
 {
 	struct timespec now;
lib/igt_core.h +6 -0
index 5d5593e0..1f7e3652 100644
@@ -1519,4 +1519,10 @@ static inline void igt_pci_system_cleanup(void)
 {
 }
 
+/**
+ * set_gpu_string():
+ * Sets a string to describe the GPU being tested
+ */
+void set_gpu_string(const char *string);
+
 #endif /* IGT_CORE_H */
Signature · 1 line
2.34.1
#2 lore raw
Quoted 39 lines · Kamil Konieczny

From: Mauro Carvalho Chehab <[email protected]>

This is helpful on tests that run with multiple GPUs. The name will be automatically filled when a device will be opened.

v2: reorganized code, changed commit message to note that
it will be filled with pathname of opended device, also correct static initialization [Kamil]

---
 lib/drmtest.c  |  4 +++-
 lib/igt_core.c | 30 ++++++++++++++++++++++++++++++
 lib/igt_core.h |  6 ++++++
 3 files changed, 39 insertions(+), 1 deletion(-)
lib/drmtest.c +3 -1
index 16e80bdf..5eb98272 100644
@@ -222,8 +222,10 @@ static int open_device(const char *name, unsigned int chipset)
 			break;
 		}
 	}
-	if ((chipset & chip) == chip)
+	if ((chipset & chip) == chip) {
+		set_gpu_string(name);
 		return fd;
+	}
 
 err:
 	close(fd);
lib/igt_core.c +0 -0
index dca380d0..68ae7289 100644

lib/igt_core.c static void kill_and_wait(pid_t *pids, int size, int signum) · line 1580

Quoted 5 lines
lib/igt_core.c +2 -0
@@ -1576,6 +1576,36 @@ static void kill_and_wait(pid_t *pids, int size, int signum)
 	}
 }
 
+static __thread char *gpu_string;
+

This is assuming that multiple gpu usage is done from different threads/processes per gpu. What about tests that call drm_open_driver_another() from the same thread?

What about tests that don't call drm_open_driver() at all?

Signature · 1 line
Petri Latvala
Quoted 49 lines
lib/igt_core.c +28 -0
+void set_gpu_string(const char *fname)
+{
+	char sysfs[PATH_MAX], *path, *p;
+
+	if (gpu_string) {
+		free(gpu_string);
+		gpu_string = NULL;
+	}
+
+	if (!fname)
+		return;
+
+	p = strrchr(fname, '/');
+	if (!p) {
+		path = strdup(fname);
+	} else {
+		p++;
+
+		strcpy(sysfs, "/sys/class/drm/");
+		strcat(sysfs, p);
+		path = realpath(sysfs, NULL);
+		igt_debug("opened %s as %s\n", fname, path);
+	}
+
+	gpu_string = path;
+	igt_assert(gpu_string);
+}
+
 __noreturn static void exit_subtest(const char *result)
 {
 	struct timespec now;
lib/igt_core.h +6 -0
index 5d5593e0..1f7e3652 100644
@@ -1519,4 +1519,10 @@ static inline void igt_pci_system_cleanup(void)
 {
 }
 
+/**
+ * set_gpu_string():
+ * Sets a string to describe the GPU being tested
+ */
+void set_gpu_string(const char *string);
+
 #endif /* IGT_CORE_H */
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/7 lib/igt_core: add prefix to logging

In reply to a message not in the archive

Allow to store prefix for logs and print it before any message. This will allow to diagnose on wich GPU occurred problems when tested on multi-GPU machines.

---
 lib/igt_core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
lib/igt_core.c +8 -2
index 68ae7289..65b7be64 100644
@@ -348,6 +348,8 @@ static struct {
 	uint8_t start, end;
 } log_buffer;
 static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
+#define LOG_PREFIX_SIZE 32
+char log_prefix[LOG_PREFIX_SIZE] = { 0 };
 
 GKeyFile *igt_key_file;
 
@@ -3105,8 +3107,12 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
 	program_name = command_str;
 #endif
 
-	if (asprintf(&thread_id, "[thread:%d] ", gettid()) == -1)
-		thread_id = NULL;
+	if (igt_thread_is_main()) {
+		thread_id = strdup(log_prefix);
+	} else {
+		if (asprintf(&thread_id, "%s[thread:%d] ", log_prefix, gettid()) == -1)
+			thread_id = NULL;
+	}
 
 	if (!thread_id)
 		return;
Signature · 1 line
2.34.1
Reviewed-by on v1 3/7
#4 lore raw

Re: [igt-dev] [PATCH i-g-t 3/7] lib/igt_core: add prefix to logging

Quoted 5 lines · On Fri, 2 Dec 2022 21:57:01 +0100 Kamil Konieczny…

Allow to store prefix for logs and print it before any message. This will allow to diagnose on wich GPU occurred problems when tested on multi-GPU machines.

Quoted 32 lines
---
 lib/igt_core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
lib/igt_core.c +8 -2
index 68ae7289..65b7be64 100644
@@ -348,6 +348,8 @@ static struct {
 	uint8_t start, end;
 } log_buffer;
 static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
+#define LOG_PREFIX_SIZE 32
+char log_prefix[LOG_PREFIX_SIZE] = { 0 };
 
 GKeyFile *igt_key_file;
 
@@ -3105,8 +3107,12 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
 	program_name = command_str;
 #endif
 
-	if (asprintf(&thread_id, "[thread:%d] ", gettid()) == -1)
-		thread_id = NULL;
+	if (igt_thread_is_main()) {
+		thread_id = strdup(log_prefix);
+	} else {
+		if (asprintf(&thread_id, "%s[thread:%d] ", log_prefix, gettid()) == -1)
+			thread_id = NULL;
+	}
 
 	if (!thread_id)
 		return;
#5 lore raw

PATCH 4/7 lib/tests/igt_fork: add tests for igt_multi_fork

In reply to a message not in the archive

Create tests for new library macro igt_multi_fork. Also while at this, change comment into prints which helps testing.

---
 lib/tests/igt_fork.c | 93 +++++++++++++++++++++++++++++++-------------
 1 file changed, 65 insertions(+), 28 deletions(-)
lib/tests/igt_fork.c +65 -28
index d883aba4..163e16a7 100644
@@ -37,13 +37,20 @@
 char test[] = "test";
 char *fake_argv[] = { test };
 int fake_argc = ARRAY_SIZE(fake_argv);
+int fork_type_dyn;
 
 __noreturn static void igt_fork_vs_skip(void)
 {
 	igt_simple_init(fake_argc, fake_argv);
 
-	igt_fork(i, 1) {
-		igt_skip("skipping");
+	if (fork_type_dyn) {
+		igt_multi_fork(i, 1) {
+			igt_skip("skipping multi-fork");
+		}
+	} else {
+		igt_fork(i, 1) {
+			igt_skip("skipping fork");
+		}
 	}
 
 	igt_waitchildren();
@@ -55,8 +62,14 @@ __noreturn static void igt_fork_vs_assert(void)
 {
 	igt_simple_init(fake_argc, fake_argv);
 
-	igt_fork(i, 1) {
-		igt_assert(0);
+	if (fork_type_dyn) {
+		igt_multi_fork(i, 1) {
+			igt_assert(0);
+		}
+	} else {
+		igt_fork(i, 1) {
+			igt_assert(0);
+		}
 	}
 
 	igt_waitchildren();
@@ -68,8 +81,14 @@ __noreturn static void igt_fork_leak(void)
 {
 	igt_simple_init(fake_argc, fake_argv);
 
-	igt_fork(i, 1) {
-		sleep(10);
+	if (fork_type_dyn) {
+		igt_multi_fork(i, 1) {
+			sleep(10);
+		}
+	} else {
+		igt_fork(i, 1) {
+			sleep(10);
+		}
 	}
 
 	igt_exit();
@@ -97,8 +116,14 @@ __noreturn static void igt_fork_timeout_leak(void)
 {
 	igt_simple_init(fake_argc, fake_argv);
 
-	igt_fork(i, 1) {
-		sleep(10);
+	if (fork_type_dyn) {
+		igt_multi_fork(i, 1) {
+			sleep(10);
+		}
+	} else {
+		igt_fork(i, 1) {
+			sleep(10);
+		}
 	}
 
 	igt_waitchildren_timeout(1, "library test");
@@ -115,14 +140,19 @@ __noreturn static void subtest_leak(void)
 	igt_subtest_init(fake_argc, fake_argv);
 
 	igt_subtest("fork-leak") {
-		igt_fork(child, num_children)
-			children[child] = getpid();
+		if (fork_type_dyn) {
+			igt_multi_fork(child, num_children)
+				children[child] = getpid();
+		} else {
+			igt_fork(child, num_children)
+				children[child] = getpid();
+		}
 
 		/* leak the children */
 		igt_assert(0);
 	}
 
-	/* We expect the exit_subtest to cleanup after the igt_fork */
+	/* We expect the exit_subtest to cleanup after the igt_fork and igt_multi_fork */
 	for (int i = 0; i < num_children; i++) {
 		if (children[i] > 0)
 			assert(kill(children[i], 0) == -1 && errno == ESRCH);
@@ -137,26 +167,33 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	/* check that igt_assert is forwarded */
-	ret = do_fork(igt_fork_vs_assert);
-	internal_assert_wexited(ret, IGT_EXIT_FAILURE);
+	for (fork_type_dyn = 0;	fork_type_dyn <= 1; ++fork_type_dyn) {
+		printf("Checking %sfork ...\n", fork_type_dyn ? "multi-" : "");
+
+		printf("\ncheck that igt_assert is forwarded\n");
+		ret = do_fork(igt_fork_vs_assert);
+		internal_assert_wexited(ret, IGT_EXIT_FAILURE);
 
-	/* check that igt_skip within a fork blows up */
-	ret = do_fork(igt_fork_vs_skip);
-	internal_assert_wexited(ret, SIGABRT + 128);
+		printf("\ncheck that igt_skip within a fork blows up\n");
+		ret = do_fork(igt_fork_vs_skip);
+		internal_assert_wexited(ret, SIGABRT + 128);
 
-	/* check that failure to clean up fails */
-	ret = do_fork(igt_fork_leak);
-	internal_assert_wsignaled(ret, SIGABRT);
+		printf("\ncheck that failure to clean up fails\n");
+		ret = do_fork(igt_fork_leak);
+		internal_assert_wsignaled(ret, SIGABRT);
 
-	/* check that igt_waitchildren_timeout cleans up*/
-	ret = do_fork(igt_fork_timeout_leak);
-	internal_assert_wexited(ret, SIGKILL + 128);
+		printf("\ncheck that igt_waitchildren_timeout cleans up\n");
+		ret = do_fork(igt_fork_timeout_leak);
+		internal_assert_wexited(ret, SIGKILL + 128);
 
-	/* check that any other process leaks are caught*/
-	ret = do_fork(plain_fork_leak);
-	internal_assert_wsignaled(ret, SIGABRT);
+		printf("\ncheck that any other process leaks are caught\n");
+		ret = do_fork(plain_fork_leak);
+		internal_assert_wsignaled(ret, SIGABRT);
+
+		printf("\ncheck subtest leak %d\n", fork_type_dyn);
+		ret = do_fork(subtest_leak);
+		internal_assert_wexited(ret, IGT_EXIT_FAILURE); /* not asserted! */
+	}
 
-	ret = do_fork(subtest_leak);
-	internal_assert_wexited(ret, IGT_EXIT_FAILURE); /* not asserted! */
+	printf("SUCCESS all tests passed\n");
 }
Signature · 1 line
2.34.1
Reviewed-by on v1 4/7
#6 lore raw

Re: [igt-dev] [PATCH i-g-t 4/7] lib/tests/igt_fork: add tests for igt_multi_fork

Quoted 4 lines · On Fri, 2 Dec 2022 21:57:02 +0100 Kamil Konieczny…

Create tests for new library macro igt_multi_fork. Also while at this, change comment into prints which helps testing.

LGTM.

Quoted 158 lines
---
 lib/tests/igt_fork.c | 93 +++++++++++++++++++++++++++++++-------------
 1 file changed, 65 insertions(+), 28 deletions(-)
lib/tests/igt_fork.c +65 -28
index d883aba4..163e16a7 100644
@@ -37,13 +37,20 @@
 char test[] = "test";
 char *fake_argv[] = { test };
 int fake_argc = ARRAY_SIZE(fake_argv);
+int fork_type_dyn;
 
 __noreturn static void igt_fork_vs_skip(void)
 {
 	igt_simple_init(fake_argc, fake_argv);
 
-	igt_fork(i, 1) {
-		igt_skip("skipping");
+	if (fork_type_dyn) {
+		igt_multi_fork(i, 1) {
+			igt_skip("skipping multi-fork");
+		}
+	} else {
+		igt_fork(i, 1) {
+			igt_skip("skipping fork");
+		}
 	}
 
 	igt_waitchildren();
@@ -55,8 +62,14 @@ __noreturn static void igt_fork_vs_assert(void)
 {
 	igt_simple_init(fake_argc, fake_argv);
 
-	igt_fork(i, 1) {
-		igt_assert(0);
+	if (fork_type_dyn) {
+		igt_multi_fork(i, 1) {
+			igt_assert(0);
+		}
+	} else {
+		igt_fork(i, 1) {
+			igt_assert(0);
+		}
 	}
 
 	igt_waitchildren();
@@ -68,8 +81,14 @@ __noreturn static void igt_fork_leak(void)
 {
 	igt_simple_init(fake_argc, fake_argv);
 
-	igt_fork(i, 1) {
-		sleep(10);
+	if (fork_type_dyn) {
+		igt_multi_fork(i, 1) {
+			sleep(10);
+		}
+	} else {
+		igt_fork(i, 1) {
+			sleep(10);
+		}
 	}
 
 	igt_exit();
@@ -97,8 +116,14 @@ __noreturn static void igt_fork_timeout_leak(void)
 {
 	igt_simple_init(fake_argc, fake_argv);
 
-	igt_fork(i, 1) {
-		sleep(10);
+	if (fork_type_dyn) {
+		igt_multi_fork(i, 1) {
+			sleep(10);
+		}
+	} else {
+		igt_fork(i, 1) {
+			sleep(10);
+		}
 	}
 
 	igt_waitchildren_timeout(1, "library test");
@@ -115,14 +140,19 @@ __noreturn static void subtest_leak(void)
 	igt_subtest_init(fake_argc, fake_argv);
 
 	igt_subtest("fork-leak") {
-		igt_fork(child, num_children)
-			children[child] = getpid();
+		if (fork_type_dyn) {
+			igt_multi_fork(child, num_children)
+				children[child] = getpid();
+		} else {
+			igt_fork(child, num_children)
+				children[child] = getpid();
+		}
 
 		/* leak the children */
 		igt_assert(0);
 	}
 
-	/* We expect the exit_subtest to cleanup after the igt_fork */
+	/* We expect the exit_subtest to cleanup after the igt_fork and igt_multi_fork */
 	for (int i = 0; i < num_children; i++) {
 		if (children[i] > 0)
 			assert(kill(children[i], 0) == -1 && errno == ESRCH);
@@ -137,26 +167,33 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	/* check that igt_assert is forwarded */
-	ret = do_fork(igt_fork_vs_assert);
-	internal_assert_wexited(ret, IGT_EXIT_FAILURE);
+	for (fork_type_dyn = 0;	fork_type_dyn <= 1; ++fork_type_dyn) {
+		printf("Checking %sfork ...\n", fork_type_dyn ? "multi-" : "");
+
+		printf("\ncheck that igt_assert is forwarded\n");
+		ret = do_fork(igt_fork_vs_assert);
+		internal_assert_wexited(ret, IGT_EXIT_FAILURE);
 
-	/* check that igt_skip within a fork blows up */
-	ret = do_fork(igt_fork_vs_skip);
-	internal_assert_wexited(ret, SIGABRT + 128);
+		printf("\ncheck that igt_skip within a fork blows up\n");
+		ret = do_fork(igt_fork_vs_skip);
+		internal_assert_wexited(ret, SIGABRT + 128);
 
-	/* check that failure to clean up fails */
-	ret = do_fork(igt_fork_leak);
-	internal_assert_wsignaled(ret, SIGABRT);
+		printf("\ncheck that failure to clean up fails\n");
+		ret = do_fork(igt_fork_leak);
+		internal_assert_wsignaled(ret, SIGABRT);
 
-	/* check that igt_waitchildren_timeout cleans up*/
-	ret = do_fork(igt_fork_timeout_leak);
-	internal_assert_wexited(ret, SIGKILL + 128);
+		printf("\ncheck that igt_waitchildren_timeout cleans up\n");
+		ret = do_fork(igt_fork_timeout_leak);
+		internal_assert_wexited(ret, SIGKILL + 128);
 
-	/* check that any other process leaks are caught*/
-	ret = do_fork(plain_fork_leak);
-	internal_assert_wsignaled(ret, SIGABRT);
+		printf("\ncheck that any other process leaks are caught\n");
+		ret = do_fork(plain_fork_leak);
+		internal_assert_wsignaled(ret, SIGABRT);
+
+		printf("\ncheck subtest leak %d\n", fork_type_dyn);
+		ret = do_fork(subtest_leak);
+		internal_assert_wexited(ret, IGT_EXIT_FAILURE); /* not asserted! */
+	}
 
-	ret = do_fork(subtest_leak);
-	internal_assert_wexited(ret, IGT_EXIT_FAILURE); /* not asserted! */
+	printf("SUCCESS all tests passed\n");
 

}

#7 lore raw

PATCH 6/7 tests/i915/gem_exec_gttfill: add new subtest multigpu-basic

In reply to a message not in the archive

Add new subtest multigpu-basic to be run on two or more GPU cards simultanosly. For this to work test should be run with --device
option, for example with:
--device=pci:vendor=Intel,device=discrete,card=0\;pci:vendor=Intel,device=discrete,card=1
or
--device=pci:vendor=Intel,device=discrete,card=all

---
 tests/i915/gem_exec_gttfill.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)
tests/i915/gem_exec_gttfill.c +30 -2
index f9f244d6..5be8428d 100644
@@ -24,6 +24,7 @@
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
+#include "igt_device_scan.h"
 #include "igt_rand.h"
 
 IGT_TEST_DESCRIPTION("Fill the GTT with batches.");
@@ -226,7 +227,7 @@ igt_main
 {
 	const struct intel_execution_engine2 *e;
 	const intel_ctx_t *ctx;
-	int i915 = -1;
+	int i915 = -1, gpu_count;
 
 	igt_fixture {
 		i915 = drm_open_driver(DRIVER_INTEL);
@@ -258,9 +259,36 @@ igt_main
 		fillgtt(i915, ctx, ALL_ENGINES, 20);
 
 	igt_fixture {
-		intel_allocator_multiprocess_stop();
 		igt_stop_hang_detector();
 		intel_ctx_destroy(i915, ctx);
+		// prepare multigpu tests
+		gpu_count = igt_device_filter_count();
+		if (gpu_count < 2)
+			gpu_count = 1;
+	}
+
+	igt_subtest("multigpu-basic") { /* run on two or more discrete cards */
+		igt_require(gpu_count > 1);
+		igt_multi_fork(child, gpu_count) {
+			int g_fd;
+			// prepare
+			g_fd = __drm_open_driver_another(child, DRIVER_INTEL);
+			igt_assert(g_fd >= 0);
+			ctx = intel_ctx_create_all_physical(g_fd);
+			igt_fork_hang_detector(g_fd);
+			// subtest
+			fillgtt(g_fd, ctx, ALL_ENGINES, 1);
+			// release resources
+			igt_stop_hang_detector();
+			intel_ctx_destroy(g_fd, ctx);
+			close(g_fd);
+		}
+
+		igt_waitchildren();
+	}
+
+	igt_fixture {
+		intel_allocator_multiprocess_stop();
 		close(i915);
 	}
 }
Signature · 1 line
2.34.1
Reviewed-by on v1 6/7
#8 lore raw

Re: [igt-dev] [PATCH i-g-t 6/7] tests/i915/gem_exec_gttfill: add new subtest multigpu-basic

Quoted 34 lines · On Fri, 2 Dec 2022 21:57:04 +0100 Kamil Konieczny…

Add new subtest multigpu-basic to be run on two or more GPU cards simultanosly. For this to work test should be run with --device
option, for example with:
--device=pci:vendor=Intel,device=discrete,card=0\;pci:vendor=Intel,device=discrete,card=1
or
--device=pci:vendor=Intel,device=discrete,card=all

---
 tests/i915/gem_exec_gttfill.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)
tests/i915/gem_exec_gttfill.c +2 -1
index f9f244d6..5be8428d 100644
@@ -24,6 +24,7 @@
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
+#include "igt_device_scan.h"
 #include "igt_rand.h"
 
 IGT_TEST_DESCRIPTION("Fill the GTT with batches.");
@@ -226,7 +227,7 @@ igt_main
 {
 	const struct intel_execution_engine2 *e;
 	const intel_ctx_t *ctx;
-	int i915 = -1;
+	int i915 = -1, gpu_count;
 
 	igt_fixture {
 		i915 = drm_open_driver(DRIVER_INTEL);

tests/i915/gem_exec_gttfill.c igt_main · line 267

Quoted 10 lines
tests/i915/gem_exec_gttfill.c +4 -1
@@ -258,9 +259,36 @@ igt_main
 		fillgtt(i915, ctx, ALL_ENGINES, 20);
 
 	igt_fixture {
-		intel_allocator_multiprocess_stop();
 		igt_stop_hang_detector();
 		intel_ctx_destroy(i915, ctx);
+		// prepare multigpu tests
+		gpu_count = igt_device_filter_count();
+		if (gpu_count < 2)
+			gpu_count = 1;

Same command as on patch 5/7: there's no need to add this check...

tests/i915/gem_exec_gttfill.c igt_main · line 271

Quoted 4 lines
tests/i915/gem_exec_gttfill.c +4 -0
+	}
+
+	igt_subtest("multigpu-basic") { /* run on two or more discrete cards */
+		igt_require(gpu_count > 1);

As you're already asserting it here.

Quoted 13 lines
tests/i915/gem_exec_gttfill.c +13 -0
+		igt_multi_fork(child, gpu_count) {
+			int g_fd;
+			// prepare
+			g_fd = __drm_open_driver_another(child, DRIVER_INTEL);
+			igt_assert(g_fd >= 0);
+			ctx = intel_ctx_create_all_physical(g_fd);
+			igt_fork_hang_detector(g_fd);
+			// subtest
+			fillgtt(g_fd, ctx, ALL_ENGINES, 1);
+			// release resources
+			igt_stop_hang_detector();
+			intel_ctx_destroy(g_fd, ctx);
+			close(g_fd);

tests/i915/gem_exec_gttfill.c igt_main · line 294

Quoted 10 lines
tests/i915/gem_exec_gttfill.c +7 -0
+		}
+
+		igt_waitchildren();
+	}
+
+	igt_fixture {
+		intel_allocator_multiprocess_stop();
 		close(i915);
 	}
 }

After addressing it:

Regards,
Mauro

#9 lore raw

PATCH 7/7 tests/i915/gem_close_race: add multiGPU subtests

In reply to a message not in the archive

Add two multiGPU subtests multigpu-basic-threads and multigpu-basic-process.

---
 tests/i915/gem_close_race.c | 54 +++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
tests/i915/gem_close_race.c +54 -0
index e37a8882..3ef073b8 100644
@@ -47,6 +47,7 @@
 #include "i915/gem_mman.h"
 #include "igt.h"
 #include "igt_aux.h"
+#include "igt_device_scan.h"
 
 #define OBJECT_SIZE (256 * 1024)
 
@@ -254,6 +255,31 @@ static void thread(int fd, struct drm_gem_open name,
 	free(history);
 }
 
+static void multigpu_threads(int timeout, unsigned int flags, int gpu_count)
+{
+	int size = sysconf(_SC_NPROCESSORS_ONLN);
+
+	size /= gpu_count;
+	if (size < 1)
+		size = 1;
+
+	igt_multi_fork(gpu, gpu_count) {
+		struct drm_gem_open name;
+		int fd = __drm_open_driver_another(gpu, DRIVER_INTEL);
+
+		igt_assert(fd > 0);
+
+		igt_fork(child, size)
+			thread(fd, name, timeout, flags);
+
+		igt_waitchildren();
+		gem_quiescent_gpu(fd);
+		close(fd);
+	}
+
+	igt_waitchildren();
+}
+
 static void threads(int timeout, unsigned int flags)
 {
 	struct drm_gem_open name;
@@ -272,6 +298,8 @@ static void threads(int timeout, unsigned int flags)
 
 igt_main
 {
+	int gpu_count;
+
 	igt_fixture {
 		int fd;
 
@@ -286,6 +314,10 @@ igt_main
 		exec_addr = max_t(exec_addr, exec_addr, data_addr);
 		data_addr += exec_addr;
 
+		gpu_count = igt_device_filter_count();
+		if (gpu_count < 2)
+			gpu_count = 1;
+
 		igt_fork_hang_detector(fd);
 		close(fd);
 	}
@@ -302,11 +334,33 @@ igt_main
 		close(fd);
 	}
 
+	igt_describe("Basic workload submission on multi-GPU machine.");
+	igt_subtest("multigpu-basic-process") {
+		igt_require(gpu_count > 1);
+
+		igt_multi_fork(child, gpu_count) {
+			int fd = __drm_open_driver_another(child, DRIVER_INTEL);
+
+			igt_assert(fd > 0);
+			process(fd, child);
+			gem_quiescent_gpu(fd);
+			close(fd);
+		}
+
+		igt_waitchildren();
+	}
+
 	igt_describe("Share buffer handle across different drm fd's and trying to race "
 		     " gem_close against continuous workload with minimum timeout.");
 	igt_subtest("basic-threads")
 		threads(1, 0);
 
+	igt_describe("Run basic-threads race on multi-GPU machine.");
+	igt_subtest("multigpu-basic-threads") {
+		igt_require(gpu_count > 1);
+		multigpu_threads(1, 0, gpu_count);
+	}
+
 	igt_describe("Test try to race gem_close against submission of continuous"
 		     " workload.");
 	igt_subtest("process-exit") {
Signature · 1 line
2.34.1
Reviewed-by on v1 7/7
#10 lore raw

Re: [igt-dev] [PATCH i-g-t 7/7] tests/i915/gem_close_race: add multiGPU subtests

Quoted 62 lines · On Fri, 2 Dec 2022 21:57:05 +0100 Kamil Konieczny…

Add two multiGPU subtests multigpu-basic-threads and multigpu-basic-process.

---
 tests/i915/gem_close_race.c | 54 +++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
tests/i915/gem_close_race.c +28 -0
index e37a8882..3ef073b8 100644
@@ -47,6 +47,7 @@
 #include "i915/gem_mman.h"
 #include "igt.h"
 #include "igt_aux.h"
+#include "igt_device_scan.h"
 
 #define OBJECT_SIZE (256 * 1024)
 
@@ -254,6 +255,31 @@ static void thread(int fd, struct drm_gem_open name,
 	free(history);
 }
 
+static void multigpu_threads(int timeout, unsigned int flags, int gpu_count)
+{
+	int size = sysconf(_SC_NPROCESSORS_ONLN);
+
+	size /= gpu_count;
+	if (size < 1)
+		size = 1;
+
+	igt_multi_fork(gpu, gpu_count) {
+		struct drm_gem_open name;
+		int fd = __drm_open_driver_another(gpu, DRIVER_INTEL);
+
+		igt_assert(fd > 0);
+
+		igt_fork(child, size)
+			thread(fd, name, timeout, flags);
+
+		igt_waitchildren();
+		gem_quiescent_gpu(fd);
+		close(fd);
+	}
+
+	igt_waitchildren();
+}
+
 static void threads(int timeout, unsigned int flags)
 {
 	struct drm_gem_open name;
@@ -272,6 +298,8 @@ static void threads(int timeout, unsigned int flags)
 
 igt_main
 {
+	int gpu_count;
+
 	igt_fixture {
 		int fd;
 

tests/i915/gem_close_race.c igt_main · line 320

Quoted 7 lines
tests/i915/gem_close_race.c +4 -0
@@ -286,6 +314,10 @@ igt_main
 		exec_addr = max_t(exec_addr, exec_addr, data_addr);
 		data_addr += exec_addr;
 
+		gpu_count = igt_device_filter_count();
+		if (gpu_count < 2)
+			gpu_count = 1;
+

Same here: no need to enforce it.

Quoted 27 lines
tests/i915/gem_close_race.c +16 -0
 		igt_fork_hang_detector(fd);
 		close(fd);
 	}
@@ -302,11 +334,33 @@ igt_main
 		close(fd);
 	}
 
+	igt_describe("Basic workload submission on multi-GPU machine.");
+	igt_subtest("multigpu-basic-process") {
+		igt_require(gpu_count > 1);
+
+		igt_multi_fork(child, gpu_count) {
+			int fd = __drm_open_driver_another(child, DRIVER_INTEL);
+
+			igt_assert(fd > 0);
+			process(fd, child);
+			gem_quiescent_gpu(fd);
+			close(fd);
+		}
+
+		igt_waitchildren();
+	}
+
 	igt_describe("Share buffer handle across different drm fd's and trying to race "
 		     " gem_close against continuous workload with minimum timeout.");
 	igt_subtest("basic-threads")
 		threads(1, 0);

tests/i915/gem_close_race.c igt_main · line 366

Quoted 10 lines
tests/i915/gem_close_race.c +6 -0
 
+	igt_describe("Run basic-threads race on multi-GPU machine.");
+	igt_subtest("multigpu-basic-threads") {
+		igt_require(gpu_count > 1);
+		multigpu_threads(1, 0, gpu_count);
+	}
+
 	igt_describe("Test try to race gem_close against submission of continuous"
 		     " workload.");
 	igt_subtest("process-exit") {

As before, after cleaning up:

#11 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for Add few multi-GPU subtests with the help of igt_multi_fork macro

In reply to a message not in the archive
== Series Details ==

== Series Details ==

Series: Add few multi-GPU subtests with the help of igt_multi_fork macro
URL : https://patchwork.freedesktop.org/series/111594/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12463 -> IGTPW_8189
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_8189 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_8189, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/index.html

Participating hosts (32 -> 43)
------------------------------

Additional (13): fi-kbl-soraka bat-kbl-2 bat-adlp-9 fi-bsw-n3050 bat-dg1-5 bat-dg2-8 bat-dg2-9 bat-adlp-6 bat-adlp-4 fi-hsw-4770 bat-jsl-3 bat-dg2-11 fi-bsw-nick
Missing (2): fi-ilk-m540 fi-tgl-dsi

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_8189:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@guc_hang:
- fi-kbl-soraka: NOTRUN -> [INCOMPLETE][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@i915_selftest@live@guc_hang.html

Known issues
------------

Here are the changes found in IGTPW_8189 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@basic-hwmon:
- bat-adlp-4: NOTRUN -> [SKIP][2] ([i915#7456])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]

* igt@gem_exec_gttfill@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][3] ([fdo#109271]) +7 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#4613]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@[email protected]

* igt@gem_lmem_swapping@parallel-random-engines:
- fi-bsw-nick: NOTRUN -> [SKIP][6] ([fdo#109271]) +39 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-bsw-nick/igt@[email protected]
- bat-adlp-4: NOTRUN -> [SKIP][7] ([i915#4613]) +3 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]

* igt@gem_mmap@basic:
- bat-dg1-5: NOTRUN -> [SKIP][8] ([i915#4083])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@gem_softpin@allocator-basic-reserve:
- fi-hsw-4770: NOTRUN -> [SKIP][9] ([fdo#109271]) +11 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-hsw-4770/igt@[email protected]

* igt@gem_tiled_blits@basic:
- bat-dg1-5: NOTRUN -> [SKIP][10] ([i915#4077]) +2 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@gem_tiled_pread_basic:
- bat-dg1-5: NOTRUN -> [SKIP][11] ([i915#4079]) +1 similar issue
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@gem_tiled_pread_basic.html
- bat-adlp-4: NOTRUN -> [SKIP][12] ([i915#3282])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@gem_tiled_pread_basic.html

* igt@i915_module_load@load:
- fi-bsw-n3050: NOTRUN -> [DMESG-WARN][13] ([i915#7430])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-bsw-n3050/igt@[email protected]

* igt@i915_pm_backlight@basic-brightness:
- bat-dg1-5: NOTRUN -> [SKIP][14] ([i915#7561])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@i915_pm_rps@basic-api:
- bat-adlp-4: NOTRUN -> [SKIP][15] ([i915#6621])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]
- bat-dg1-5: NOTRUN -> [SKIP][16] ([i915#6621])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][17] ([i915#5334])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html

* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][18] ([i915#1886])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

* igt@i915_selftest@live@hangcheck:
- fi-hsw-4770: NOTRUN -> [INCOMPLETE][19] ([i915#4785])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-hsw-4770/igt@i915_selftest@[email protected]

* igt@kms_addfb_basic@basic-x-tiled-legacy:
- bat-dg1-5: NOTRUN -> [SKIP][20] ([i915#4212]) +7 similar issues
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@kms_addfb_basic@basic-y-tiled-legacy:
- bat-dg1-5: NOTRUN -> [SKIP][21] ([i915#4215])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@kms_chamelium@dp-crc-fast:
- fi-hsw-4770: NOTRUN -> [SKIP][22] ([fdo#109271] / [fdo#111827]) +7 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-hsw-4770/igt@[email protected]
- bat-adlp-4: NOTRUN -> [SKIP][23] ([fdo#111827]) +8 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]
- bat-dg1-5: NOTRUN -> [SKIP][24] ([fdo#111827]) +8 similar issues
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-bsw-nick: NOTRUN -> [SKIP][25] ([fdo#109271] / [fdo#111827]) +8 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-bsw-nick/igt@[email protected]
- fi-kbl-soraka: NOTRUN -> [SKIP][26] ([fdo#109271] / [fdo#111827]) +7 similar issues
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor:
- bat-adlp-4: NOTRUN -> [SKIP][27] ([i915#4103])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]
- bat-dg1-5: NOTRUN -> [SKIP][28] ([i915#4103] / [i915#4213])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- bat-adlp-4: NOTRUN -> [SKIP][29] ([i915#4093]) +3 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]
- bat-dg1-5: NOTRUN -> [SKIP][30] ([fdo#109285])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc:
- bat-adlp-4: NOTRUN -> [SKIP][31] ([i915#3546])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]

* igt@kms_psr@primary_page_flip:
- bat-dg1-5: NOTRUN -> [SKIP][32] ([i915#1072] / [i915#4078]) +3 similar issues
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@kms_psr@primary_page_flip.html

* igt@kms_psr@sprite_plane_onoff:
- fi-hsw-4770: NOTRUN -> [SKIP][33] ([fdo#109271] / [i915#1072]) +3 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-hsw-4770/igt@kms_psr@sprite_plane_onoff.html

* igt@kms_setmode@basic-clone-single-crtc:
- bat-dg1-5: NOTRUN -> [SKIP][34] ([i915#3555])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]
- bat-adlp-4: NOTRUN -> [SKIP][35] ([i915#3555] / [i915#4579])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]

* igt@prime_vgem@basic-fence-read:
- bat-dg1-5: NOTRUN -> [SKIP][36] ([i915#3708]) +3 similar issues
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@prime_vgem@basic-gtt:
- bat-dg1-5: NOTRUN -> [SKIP][37] ([i915#3708] / [i915#4077]) +1 similar issue
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@prime_vgem@basic-userptr:
- bat-adlp-4: NOTRUN -> [SKIP][38] ([fdo#109295] / [i915#3301] / [i915#3708])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]
- bat-dg1-5: NOTRUN -> [SKIP][39] ([i915#3708] / [i915#4873])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@prime_vgem@basic-write:
- bat-adlp-4: NOTRUN -> [SKIP][40] ([fdo#109295] / [i915#3291] / [i915#3708]) +2 similar issues
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]

* igt@runner@aborted:
- fi-hsw-4770: NOTRUN -> [FAIL][41] ([fdo#109271] / [i915#4312] / [i915#5594])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-hsw-4770/igt@[email protected]
- fi-bsw-n3050: NOTRUN -> [FAIL][42] ([i915#4312])
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-bsw-n3050/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s0@smem:
- {bat-rplp-1}: [DMESG-WARN][43] ([i915#2867]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12463/bat-rplp-1/igt@gem_exec_suspend@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-rplp-1/igt@gem_exec_suspend@[email protected]

* igt@i915_selftest@live@hangcheck:
- {fi-ehl-2}: [INCOMPLETE][45] -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12463/fi-ehl-2/igt@i915_selftest@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-ehl-2/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@reset:
- {bat-rpls-2}: [DMESG-FAIL][47] ([i915#4983]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12463/bat-rpls-2/igt@i915_selftest@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-rpls-2/igt@i915_selftest@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#3003]: https://gitlab.freedesktop.org/drm/intel/issues/3003
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4093]: https://gitlab.freedesktop.org/drm/intel/issues/4093
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4785]: https://gitlab.freedesktop.org/drm/intel/issues/4785
[i915#4873]: https://gitlab.freedesktop.org/drm/intel/issues/4873
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
[i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#5594]: https://gitlab.freedesktop.org/drm/intel/issues/5594
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6434]: https://gitlab.freedesktop.org/drm/intel/issues/6434
[i915#6559]: https://gitlab.freedesktop.org/drm/intel/issues/6559
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#7346]: https://gitlab.freedesktop.org/drm/intel/issues/7346
[i915#7430]: https://gitlab.freedesktop.org/drm/intel/issues/7430
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7498]: https://gitlab.freedesktop.org/drm/intel/issues/7498
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_7080 -> IGTPW_8189

CI-20190529: 20190529
CI_DRM_12463: b36215855627efb694b50c6cc0ba47b0e78d5aa5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8189: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/index.html
IGT_7080: 14721e0783757dfa44ca2677851c3ba508b09682 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

Testlist changes
----------------

+igt@gem_basic@multigpu-create-close
+igt@gem_close_race@multigpu-basic-process
+igt@gem_close_race@multigpu-basic-threads
+igt@gem_exec_gttfill@multigpu-basic

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/index.html

#12 lore raw

Re: [igt-dev] ✗ Fi.CI.BAT: failure for Add few multi-GPU subtests with the help of igt_multi_fork macro

Hi Lakshmi,

these are unrelated,

--
Kamil

Quoted 290 lines · Patchwork

== Series Details ==

Series: Add few multi-GPU subtests with the help of igt_multi_fork macro
URL : https://patchwork.freedesktop.org/series/111594/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12463 -> IGTPW_8189
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_8189 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_8189, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/index.html

Participating hosts (32 -> 43)
------------------------------

Additional (13): fi-kbl-soraka bat-kbl-2 bat-adlp-9 fi-bsw-n3050 bat-dg1-5 bat-dg2-8 bat-dg2-9 bat-adlp-6 bat-adlp-4 fi-hsw-4770 bat-jsl-3 bat-dg2-11 fi-bsw-nick
Missing (2): fi-ilk-m540 fi-tgl-dsi

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_8189:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@guc_hang:
- fi-kbl-soraka: NOTRUN -> [INCOMPLETE][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@i915_selftest@live@guc_hang.html

Known issues
------------

Here are the changes found in IGTPW_8189 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@basic-hwmon:
- bat-adlp-4: NOTRUN -> [SKIP][2] ([i915#7456])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]

* igt@gem_exec_gttfill@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][3] ([fdo#109271]) +7 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#4613]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@[email protected]

* igt@gem_lmem_swapping@parallel-random-engines:
- fi-bsw-nick: NOTRUN -> [SKIP][6] ([fdo#109271]) +39 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-bsw-nick/igt@[email protected]
- bat-adlp-4: NOTRUN -> [SKIP][7] ([i915#4613]) +3 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]

* igt@gem_mmap@basic:
- bat-dg1-5: NOTRUN -> [SKIP][8] ([i915#4083])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@gem_softpin@allocator-basic-reserve:
- fi-hsw-4770: NOTRUN -> [SKIP][9] ([fdo#109271]) +11 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-hsw-4770/igt@[email protected]

* igt@gem_tiled_blits@basic:
- bat-dg1-5: NOTRUN -> [SKIP][10] ([i915#4077]) +2 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@gem_tiled_pread_basic:
- bat-dg1-5: NOTRUN -> [SKIP][11] ([i915#4079]) +1 similar issue
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@gem_tiled_pread_basic.html
- bat-adlp-4: NOTRUN -> [SKIP][12] ([i915#3282])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@gem_tiled_pread_basic.html

* igt@i915_module_load@load:
- fi-bsw-n3050: NOTRUN -> [DMESG-WARN][13] ([i915#7430])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-bsw-n3050/igt@[email protected]

* igt@i915_pm_backlight@basic-brightness:
- bat-dg1-5: NOTRUN -> [SKIP][14] ([i915#7561])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@i915_pm_rps@basic-api:
- bat-adlp-4: NOTRUN -> [SKIP][15] ([i915#6621])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]
- bat-dg1-5: NOTRUN -> [SKIP][16] ([i915#6621])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][17] ([i915#5334])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html

* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][18] ([i915#1886])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

* igt@i915_selftest@live@hangcheck:
- fi-hsw-4770: NOTRUN -> [INCOMPLETE][19] ([i915#4785])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-hsw-4770/igt@i915_selftest@[email protected]

* igt@kms_addfb_basic@basic-x-tiled-legacy:
- bat-dg1-5: NOTRUN -> [SKIP][20] ([i915#4212]) +7 similar issues
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@kms_addfb_basic@basic-y-tiled-legacy:
- bat-dg1-5: NOTRUN -> [SKIP][21] ([i915#4215])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@kms_chamelium@dp-crc-fast:
- fi-hsw-4770: NOTRUN -> [SKIP][22] ([fdo#109271] / [fdo#111827]) +7 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-hsw-4770/igt@[email protected]
- bat-adlp-4: NOTRUN -> [SKIP][23] ([fdo#111827]) +8 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]
- bat-dg1-5: NOTRUN -> [SKIP][24] ([fdo#111827]) +8 similar issues
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-bsw-nick: NOTRUN -> [SKIP][25] ([fdo#109271] / [fdo#111827]) +8 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-bsw-nick/igt@[email protected]
- fi-kbl-soraka: NOTRUN -> [SKIP][26] ([fdo#109271] / [fdo#111827]) +7 similar issues
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-kbl-soraka/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor:
- bat-adlp-4: NOTRUN -> [SKIP][27] ([i915#4103])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]
- bat-dg1-5: NOTRUN -> [SKIP][28] ([i915#4103] / [i915#4213])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- bat-adlp-4: NOTRUN -> [SKIP][29] ([i915#4093]) +3 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]
- bat-dg1-5: NOTRUN -> [SKIP][30] ([fdo#109285])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc:
- bat-adlp-4: NOTRUN -> [SKIP][31] ([i915#3546])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]

* igt@kms_psr@primary_page_flip:
- bat-dg1-5: NOTRUN -> [SKIP][32] ([i915#1072] / [i915#4078]) +3 similar issues
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@kms_psr@primary_page_flip.html

* igt@kms_psr@sprite_plane_onoff:
- fi-hsw-4770: NOTRUN -> [SKIP][33] ([fdo#109271] / [i915#1072]) +3 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-hsw-4770/igt@kms_psr@sprite_plane_onoff.html

* igt@kms_setmode@basic-clone-single-crtc:
- bat-dg1-5: NOTRUN -> [SKIP][34] ([i915#3555])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]
- bat-adlp-4: NOTRUN -> [SKIP][35] ([i915#3555] / [i915#4579])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]

* igt@prime_vgem@basic-fence-read:
- bat-dg1-5: NOTRUN -> [SKIP][36] ([i915#3708]) +3 similar issues
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@prime_vgem@basic-gtt:
- bat-dg1-5: NOTRUN -> [SKIP][37] ([i915#3708] / [i915#4077]) +1 similar issue
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@prime_vgem@basic-userptr:
- bat-adlp-4: NOTRUN -> [SKIP][38] ([fdo#109295] / [i915#3301] / [i915#3708])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]
- bat-dg1-5: NOTRUN -> [SKIP][39] ([i915#3708] / [i915#4873])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@[email protected]

* igt@prime_vgem@basic-write:
- bat-adlp-4: NOTRUN -> [SKIP][40] ([fdo#109295] / [i915#3291] / [i915#3708]) +2 similar issues
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-adlp-4/igt@[email protected]

* igt@runner@aborted:
- fi-hsw-4770: NOTRUN -> [FAIL][41] ([fdo#109271] / [i915#4312] / [i915#5594])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-hsw-4770/igt@[email protected]
- fi-bsw-n3050: NOTRUN -> [FAIL][42] ([i915#4312])
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-bsw-n3050/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s0@smem:
- {bat-rplp-1}: [DMESG-WARN][43] ([i915#2867]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12463/bat-rplp-1/igt@gem_exec_suspend@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-rplp-1/igt@gem_exec_suspend@[email protected]

* igt@i915_selftest@live@hangcheck:
- {fi-ehl-2}: [INCOMPLETE][45] -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12463/fi-ehl-2/igt@i915_selftest@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-ehl-2/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@reset:
- {bat-rpls-2}: [DMESG-FAIL][47] ([i915#4983]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12463/bat-rpls-2/igt@i915_selftest@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-rpls-2/igt@i915_selftest@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#3003]: https://gitlab.freedesktop.org/drm/intel/issues/3003
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4093]: https://gitlab.freedesktop.org/drm/intel/issues/4093
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4785]: https://gitlab.freedesktop.org/drm/intel/issues/4785
[i915#4873]: https://gitlab.freedesktop.org/drm/intel/issues/4873
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
[i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#5594]: https://gitlab.freedesktop.org/drm/intel/issues/5594
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6434]: https://gitlab.freedesktop.org/drm/intel/issues/6434
[i915#6559]: https://gitlab.freedesktop.org/drm/intel/issues/6559
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#7346]: https://gitlab.freedesktop.org/drm/intel/issues/7346
[i915#7430]: https://gitlab.freedesktop.org/drm/intel/issues/7430
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7498]: https://gitlab.freedesktop.org/drm/intel/issues/7498
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_7080 -> IGTPW_8189

CI-20190529: 20190529
CI_DRM_12463: b36215855627efb694b50c6cc0ba47b0e78d5aa5 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8189: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/index.html
IGT_7080: 14721e0783757dfa44ca2677851c3ba508b09682 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

Testlist changes
----------------

(quoted diff) +4 -0
+igt@gem_basic@multigpu-create-close
+igt@gem_close_race@multigpu-basic-process
+igt@gem_close_race@multigpu-basic-threads
+igt@gem_exec_gttfill@multigpu-basic

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/index.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw

Re: [igt-dev] [PATCH i-g-t 5/7] tests/i915/gem_basic: add multigpu-create-close subtest

Quoted 32 lines · On Fri, 2 Dec 2022 21:57:03 +0100 Kamil Konieczny…

Add one subtest to run on more than one gpu simultanosly. For this to work test should be run with --device option on machine with two or more dgfx cards, for example with:

--device=pci:vendor=Intel,device=discrete,card=all

Test will skip if only one card is present.

Cc Anna Karas <[email protected]>
Cc Zbigniew Kempczyński <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Petri Latvala <[email protected]>
---
 tests/i915/gem_basic.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
tests/i915/gem_basic.c +1 -0
index 2aa5d850..9ee09782 100644
@@ -40,6 +40,7 @@
 #include "i915/gem_create.h"
 #include "igt.h"
 #include "igt_types.h"
+#include "lib/igt_device_scan.h"
 
 IGT_TEST_DESCRIPTION("Tests basic gem_create and gem_close IOCTLs");
 
@@ -83,10 +84,16 @@ test_create_fd_close(int fd)
 igt_main
 {

tests/i915/gem_basic.c test_create_fd_close(int fd) · line 94

Quoted 10 lines
tests/i915/gem_basic.c +5 -1
 	igt_fd_t(fd);
+	int gpu_count;
 
-	igt_fixture
+	igt_fixture {
+		int count;
 		fd = drm_open_driver(DRIVER_INTEL);
 
+		count = igt_device_filter_count();
+		gpu_count = count >= 2 ? count : 1;

Hmm... I would just do:

		gpu_count = igt_device_filter_count();

As it seems that you're just wanting to ensure that gpu_count is >= 1 here...

tests/i915/gem_basic.c igt_main · line 107

Quoted 12 lines
tests/i915/gem_basic.c +5 -0
+	}
+
 	igt_describe("Verify that gem_close fails with bad params.");
 	igt_subtest("bad-close")
 		test_bad_close(fd);
@@ -95,6 +102,21 @@ igt_main
 	igt_subtest("create-close")
 		test_create_close(fd);
 
+	igt_describe("Verify basic functionality of gem_create and gem_close on multi-GPU.");
+	igt_subtest("multigpu-create-close") {
+		igt_require(gpu_count > 1);

... Yet, this is the only place where you use gpu_count. So, count <= 0 won't cause any troubles.

Quoted 5 lines
tests/i915/gem_basic.c +5 -0
+		igt_multi_fork(child, gpu_count) {
+			int gpu_fd;
+
+			gpu_fd = __drm_open_driver_another(child, DRIVER_INTEL);
+			igt_assert_f(gpu_fd > 0, "cannot open gpu-%d, errno=%d\n", child, errno);

tests/i915/gem_basic.c igt_main · line 122

Quoted 10 lines
tests/i915/gem_basic.c +7 -0
+			test_create_close(gpu_fd);
+			close(gpu_fd);
+		}
+
+		igt_waitchildren();
+	}
+
 	igt_describe("Verify that closing drm driver is possible with opened gem object.");
 	igt_subtest("create-fd-close")
 		test_create_fd_close(fd);

Once applying this cleanup, feel free to add by RB:

Regards,
Mauro

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw

Re: [igt-dev] [PATCH i-g-t 1/7] lib/igt_core: add igt_multi_fork for parallel tests

Quoted 9 lines · On Fri, 2 Dec 2022 21:56:59 +0100 Kamil Konieczny…

Add new macro igt_multi_fork() to igt_core. These should help in adding tests for multi-GPU hardware as it allows to reuse existing subtests which may use igt_fork() once.

Cc Anna Karas <[email protected]>
Cc Zbigniew Kempczyński <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Petri Latvala <[email protected]>

LGTM.

Quoted 365 lines
---
 lib/igt_core.c | 207 ++++++++++++++++++++++++++++++++++++++++++++-----
 lib/igt_core.h |  21 +++++
 2 files changed, 209 insertions(+), 19 deletions(-)
lib/igt_core.c +188 -19
index b77dca91..dca380d0 100644
@@ -310,6 +310,12 @@ int num_test_children;
 int test_children_sz;
 bool test_child;
 
+/* fork dynamic support state */
+pid_t *test_multi_fork_children;
+int num_test_multi_fork_children;
+int test_multi_fork_children_sz;
+bool test_multi_fork_child;
+
 /* For allocator purposes */
 pid_t child_pid  = -1;
 __thread pid_t child_tid  = -1;
@@ -1560,6 +1566,16 @@ bool __igt_enter_dynamic_container(void)
 	return true;
 }
 
+static void kill_and_wait(pid_t *pids, int size, int signum)
+{
+	for (int c = 0; c < size; c++) {
+		if (pids[c] > 0) {
+			kill(pids[c], signum);
+			waitpid(pids[c], NULL, 0); /* don't leave zombies! */
+		}
+	}
+}
+
 __noreturn static void exit_subtest(const char *result)
 {
 	struct timespec now;
@@ -1569,11 +1585,13 @@ __noreturn static void exit_subtest(const char *result)
 
 	igt_gettime(&now);
 
+	if (test_multi_fork_child)
+		__igt_plain_output = true;
+
 	_subtest_result_message(in_dynamic_subtest ? _SUBTEST_TYPE_DYNAMIC : _SUBTEST_TYPE_NORMAL,
 				*subtest_name,
 				result,
 				igt_time_elapsed(thentime, &now));
-
 	igt_terminate_spins();
 
 	/* If the subtest aborted, it may have left children behind */
@@ -1584,6 +1602,10 @@ __noreturn static void exit_subtest(const char *result)
 		}
 	}
 	num_test_children = 0;
+	if (!test_multi_fork_child && num_test_multi_fork_children > 0)
+		kill_and_wait(test_multi_fork_children, num_test_multi_fork_children, SIGKILL);
+
+	num_test_multi_fork_children = 0;
 
 	/*
 	 * When test completes - mostly in fail state it can leave allocated
@@ -1605,9 +1627,10 @@ __noreturn static void exit_subtest(const char *result)
 
 	/*
 	 * Don't keep the above text in the log if exiting a dynamic
-	 * subsubtest, the subtest would print it again otherwise
+	 * subsubtest, the subtest would print it again otherwise.
+	 * Also don't keep it if called from multi_fork.
 	 */
-	if (in_dynamic_subtest)
+	if (in_dynamic_subtest || test_multi_fork_child)
 		_igt_log_buffer_reset();
 
 	*subtest_name = NULL;
@@ -1636,6 +1659,8 @@ void igt_skip(const char *f, ...)
 
 	internal_assert(!test_child,
 			"skips are not allowed in forks\n");
+	internal_assert(!test_multi_fork_child,
+			"skips are not allowed in multi_fork\n");
 
 	if (!igt_only_list_subtests()) {
 		va_start(args, f);
@@ -1778,7 +1803,7 @@ void igt_fail(int exitcode)
 		dynamic_failed_one = true;
 	} else {
 		/* Dynamic subtest containers must not fail explicitly */
-		assert(_igt_dynamic_tests_executed < 0 || dynamic_failed_one);
+		assert(test_multi_fork_child || _igt_dynamic_tests_executed < 0 || dynamic_failed_one);
 
 		if (!failed_one)
 			igt_exitcode = exitcode;
@@ -1792,6 +1817,9 @@ void igt_fail(int exitcode)
 
 	_igt_log_buffer_dump();
 
+	if (test_multi_fork_child)
+		exit(exitcode);
+
 	if (in_subtest) {
 		exit_subtest("FAIL");
 	} else {
@@ -2156,6 +2184,11 @@ void igt_kill_children(int signal)
 		if (test_children[c] > 0)
 			kill(test_children[c], signal);
 	}
+
+	for (int c = 0; c < num_test_multi_fork_children; c++) {
+		if (test_multi_fork_children[c] > 0)
+			kill(test_multi_fork_children[c], signal);
+	}
 }
 
 void __igt_abort(const char *domain, const char *file, const int line,
@@ -2241,13 +2274,17 @@ void igt_exit(void)
 			igt_exitcode = IGT_EXIT_SKIP;
 	}
 
-	if (command_str)
-		igt_kmsg(KMSG_INFO "%s: exiting, ret=%d\n",
-			 command_str, igt_exitcode);
-	igt_debug("Exiting with status code %d\n", igt_exitcode);
+	if (!test_multi_fork_child) {
+		/* parent will do the yelling */
+		if (command_str)
+			igt_kmsg(KMSG_INFO "%s: exiting, ret=%d\n",
+				 command_str, igt_exitcode);
+		igt_debug("Exiting with status code %d\n", igt_exitcode);
+	}
 
 	igt_kill_children(SIGKILL);
 	assert(!num_test_children);
+	assert(!num_test_multi_fork_children);
 
 	assert(waitpid(-1, &tmp, WNOHANG) == -1 && errno == ECHILD);
 
@@ -2268,8 +2305,13 @@ void igt_exit(void)
 				result = "FAIL";
 		}
 
-		_log_line_fprintf(stdout, "%s (%.3fs)\n",
-				  result, igt_time_elapsed(&subtest_time, &now));
+		if (test_multi_fork_child) /* parent will do the yelling */
+			_log_line_fprintf(stdout, "dyn_child pid:%d (%.3fs) ends with err=%d\n",
+					  getpid(), igt_time_elapsed(&subtest_time, &now),
+					  igt_exitcode);
+		else
+			_log_line_fprintf(stdout, "%s (%.3fs)\n",
+					  result, igt_time_elapsed(&subtest_time, &now));
 	}
 
 	exit(igt_exitcode);
@@ -2468,6 +2510,64 @@ bool __igt_fork(void)
 
 }
 
+static void dyn_children_exit_handler(int sig)
+{
+	int status;
+
+	/* The exit handler can be called from a fatal signal, so play safe */
+	while (num_test_multi_fork_children-- && wait(&status))
+		;
+}
+
+bool __igt_multi_fork(void)
+{
+	internal_assert(!test_with_subtests || in_subtest,
+			"multi-forking is only allowed in subtests or igt_simple_main\n");
+	internal_assert(!test_child,
+			"multi-forking is not allowed from already forked children\n");
+	internal_assert(!test_multi_fork_child,
+			"multi-forking is not allowed from already multi-forked children\n");
+
+	if (!num_test_multi_fork_children)
+		igt_install_exit_handler(dyn_children_exit_handler);
+
+	if (num_test_multi_fork_children >= test_multi_fork_children_sz) {
+		if (!test_multi_fork_children_sz)
+			test_multi_fork_children_sz = 4;
+		else
+			test_multi_fork_children_sz *= 2;
+
+		test_multi_fork_children = realloc(test_multi_fork_children,
+					sizeof(pid_t)*test_multi_fork_children_sz);
+		igt_assert(test_multi_fork_children);
+	}
+
+	/* ensure any buffers are flushed before fork */
+	fflush(NULL);
+
+	switch (test_multi_fork_children[num_test_multi_fork_children++] = fork()) {
+	case -1:
+		num_test_multi_fork_children--; /* so we won't kill(-1) during cleanup */
+		igt_assert(0);
+	case 0:
+		test_multi_fork_child = true;
+		snprintf(log_prefix, LOG_PREFIX_SIZE, "<g:%d> ", num_test_multi_fork_children - 1);
+		num_test_multi_fork_children = 0; /* only parent should care */
+		pthread_mutex_init(&print_mutex, NULL);
+		child_pid = getpid(); /* for allocator */
+		child_tid = -1; /* for allocator */
+		exit_handler_count = 0;
+		reset_helper_process_list();
+		oom_adjust_for_doom();
+		igt_unshare_spins();
+
+		return true;
+	default:
+		return false;
+	}
+
+}
+
 int __igt_waitchildren(void)
 {
 	int err = 0;
@@ -2537,11 +2637,82 @@ int __igt_waitchildren(void)
  */
 void igt_waitchildren(void)
 {
-	int err = __igt_waitchildren();
+	int err;
+
+	if (num_test_multi_fork_children)
+		err = __igt_multi_wait();
+	else
+		err = __igt_waitchildren();
+
 	if (err)
 		igt_fail(err);
 }
 
+int __igt_multi_wait(void)
+{
+	int err = 0;
+	int count;
+	bool was_killed = false;
+
+	assert(!test_multi_fork_child);
+	count = 0;
+	while (count < num_test_multi_fork_children) {
+		int status = -1;
+		int last = 0;
+		pid_t pid;
+		int c;
+
+		pid = wait(&status);
+		if (pid == -1) {
+			if (errno == EINTR)
+				continue;
+
+			igt_debug("wait(multi_fork children running:%d) failed with %m\n",
+				  num_test_multi_fork_children - count);
+			return IGT_EXIT_FAILURE;
+		}
+
+		for (c = 0; c < num_test_multi_fork_children; c++)
+			if (pid == test_multi_fork_children[c])
+				break;
+		if (c == num_test_multi_fork_children)
+			continue;
+
+		if (status != 0) {
+			if (WIFEXITED(status)) {
+				printf("dynamic child %i pid:%d failed with exit status %i\n",
+				       c, pid, WEXITSTATUS(status));
+				last = WEXITSTATUS(status);
+				test_multi_fork_children[c] = -1;
+			} else if (WIFSIGNALED(status)) {
+				printf("dynamic child %i pid:%d died with signal %i, %s\n",
+				       c, pid, WTERMSIG(status),
+				       strsignal(WTERMSIG(status)));
+				last = 128 + WTERMSIG(status);
+				test_multi_fork_children[c] = -1;
+			} else {
+				printf("Unhandled failure [%d] in dynamic child %i pid:%d\n",
+				       status, c, pid);
+				last = 256;
+			}
+
+			/* we don't want to overwrite error with skip */
+			if (err == 0 || err == IGT_EXIT_SKIP)
+				err = last;
+			if (err && err != IGT_EXIT_SKIP && !was_killed) {
+				igt_kill_children(SIGKILL); // if non-skip happen
+				was_killed = true;
+			}
+		}
+
+		count++;
+	}
+
+	num_test_multi_fork_children = 0;
+
+	return err;
+}
+
 static void igt_alarm_killchildren(int signal)
 {
 	igt_info("Timed out waiting for children\n");
@@ -2571,7 +2742,10 @@ void igt_waitchildren_timeout(int seconds, const char *reason)
 
 	alarm(seconds);
 
-	ret = __igt_waitchildren();
+	if (num_test_multi_fork_children)
+		ret = __igt_multi_wait();
+	else
+		ret = __igt_waitchildren();
 	igt_reset_timeout();
 	if (ret)
 		igt_fail(ret);
@@ -2901,13 +3075,8 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
 	program_name = command_str;
 #endif
 
-
-	if (igt_thread_is_main()) {
-		thread_id = strdup("");
-	} else {
-		if (asprintf(&thread_id, "[thread:%d] ", gettid()) == -1)
-			thread_id = NULL;
-	}
+	if (asprintf(&thread_id, "[thread:%d] ", gettid()) == -1)
+		thread_id = NULL;
 
 	if (!thread_id)
 		return;
lib/igt_core.h +21 -0
index b659ea7b..5d5593e0 100644
@@ -1114,6 +1114,27 @@ void igt_waitchildren(void);
 void igt_waitchildren_timeout(int seconds, const char *reason);
 void igt_kill_children(int signal);
 
+bool __igt_multi_fork(void);
+/**
+ * igt_multi_fork:
+ * @child: name of the int variable with the child number
+ * @num_children: number of children to fork
+ *
+ * This is a magic control flow block which spawns parallel processes
+ * with fork() expecting there will runs without skips.
+ *
+ * The test children execute in parallel to the main test process.
+ * Joining all test threads should be done with igt_waitchildren.
+ * After multi_fork one can use igt_fork once to run more children.
+ *
+ * Like in igt_fork() any igt_skip() will cause test fail.
+ */
+#define igt_multi_fork(child, num_children) \
+	for (int child = 0; child < (num_children); child++) \
+		for (; __igt_multi_fork(); exit(0))
+
+int __igt_multi_wait(void);
+
 /**
  * igt_helper_process:
  * @running: indicates whether the process is currently running