public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 2/7] lib/igt_core: store GPU string or opened device name
       [not found] <20221202205705.58879-1-kamil.konieczny@linux.intel.com>
@ 2022-12-02 20:57 ` Kamil Konieczny
  2022-12-07 10:32   ` Petri Latvala
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 3/7] lib/igt_core: add prefix to logging Kamil Konieczny
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Kamil Konieczny @ 2022-12-02 20:57 UTC (permalink / raw)
  To: igt-dev

From: Mauro Carvalho Chehab <mchehab@kernel.org>

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]

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 lib/drmtest.c  |  4 +++-
 lib/igt_core.c | 30 ++++++++++++++++++++++++++++++
 lib/igt_core.h |  6 ++++++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 16e80bdf..5eb98272 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -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);
diff --git a/lib/igt_core.c b/lib/igt_core.c
index dca380d0..68ae7289 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -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;
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 5d5593e0..1f7e3652 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -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 */
-- 
2.34.1

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

* [igt-dev] [PATCH i-g-t 3/7] lib/igt_core: add prefix to logging
       [not found] <20221202205705.58879-1-kamil.konieczny@linux.intel.com>
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_core: store GPU string or opened device name Kamil Konieczny
@ 2022-12-02 20:57 ` Kamil Konieczny
  2022-12-05  6:12   ` Mauro Carvalho Chehab
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 4/7] lib/tests/igt_fork: add tests for igt_multi_fork Kamil Konieczny
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Kamil Konieczny @ 2022-12-02 20:57 UTC (permalink / raw)
  To: igt-dev

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.

Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 lib/igt_core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 68ae7289..65b7be64 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -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;
-- 
2.34.1

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

* [igt-dev] [PATCH i-g-t 4/7] lib/tests/igt_fork: add tests for igt_multi_fork
       [not found] <20221202205705.58879-1-kamil.konieczny@linux.intel.com>
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_core: store GPU string or opened device name Kamil Konieczny
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 3/7] lib/igt_core: add prefix to logging Kamil Konieczny
@ 2022-12-02 20:57 ` Kamil Konieczny
  2022-12-05  6:15   ` Mauro Carvalho Chehab
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 6/7] tests/i915/gem_exec_gttfill: add new subtest multigpu-basic Kamil Konieczny
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Kamil Konieczny @ 2022-12-02 20:57 UTC (permalink / raw)
  To: igt-dev

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

Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 lib/tests/igt_fork.c | 93 +++++++++++++++++++++++++++++++-------------
 1 file changed, 65 insertions(+), 28 deletions(-)

diff --git a/lib/tests/igt_fork.c b/lib/tests/igt_fork.c
index d883aba4..163e16a7 100644
--- a/lib/tests/igt_fork.c
+++ b/lib/tests/igt_fork.c
@@ -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");
 }
-- 
2.34.1

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

* [igt-dev] [PATCH i-g-t 6/7] tests/i915/gem_exec_gttfill: add new subtest multigpu-basic
       [not found] <20221202205705.58879-1-kamil.konieczny@linux.intel.com>
                   ` (2 preceding siblings ...)
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 4/7] lib/tests/igt_fork: add tests for igt_multi_fork Kamil Konieczny
@ 2022-12-02 20:57 ` Kamil Konieczny
  2022-12-05  6:28   ` Mauro Carvalho Chehab
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 7/7] tests/i915/gem_close_race: add multiGPU subtests Kamil Konieczny
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Kamil Konieczny @ 2022-12-02 20:57 UTC (permalink / raw)
  To: igt-dev

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

Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 tests/i915/gem_exec_gttfill.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_exec_gttfill.c b/tests/i915/gem_exec_gttfill.c
index f9f244d6..5be8428d 100644
--- a/tests/i915/gem_exec_gttfill.c
+++ b/tests/i915/gem_exec_gttfill.c
@@ -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);
 	}
 }
-- 
2.34.1

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

* [igt-dev] [PATCH i-g-t 7/7] tests/i915/gem_close_race: add multiGPU subtests
       [not found] <20221202205705.58879-1-kamil.konieczny@linux.intel.com>
                   ` (3 preceding siblings ...)
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 6/7] tests/i915/gem_exec_gttfill: add new subtest multigpu-basic Kamil Konieczny
@ 2022-12-02 20:57 ` Kamil Konieczny
  2022-12-05  6:30   ` Mauro Carvalho Chehab
  2022-12-02 21:38 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add few multi-GPU subtests with the help of igt_multi_fork macro Patchwork
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Kamil Konieczny @ 2022-12-02 20:57 UTC (permalink / raw)
  To: igt-dev

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

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

diff --git a/tests/i915/gem_close_race.c b/tests/i915/gem_close_race.c
index e37a8882..3ef073b8 100644
--- a/tests/i915/gem_close_race.c
+++ b/tests/i915/gem_close_race.c
@@ -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") {
-- 
2.34.1

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

* [igt-dev] ✗ Fi.CI.BAT: failure for Add few multi-GPU subtests with the help of igt_multi_fork macro
       [not found] <20221202205705.58879-1-kamil.konieczny@linux.intel.com>
                   ` (4 preceding siblings ...)
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 7/7] tests/i915/gem_close_race: add multiGPU subtests Kamil Konieczny
@ 2022-12-02 21:38 ` Patchwork
  2022-12-05 14:33   ` Kamil Konieczny
       [not found] ` <20221202205705.58879-6-kamil.konieczny@linux.intel.com>
       [not found] ` <20221202205705.58879-2-kamil.konieczny@linux.intel.com>
  7 siblings, 1 reply; 14+ messages in thread
From: Patchwork @ 2022-12-02 21:38 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 15338 bytes --]

== 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@debugfs_test@basic-hwmon.html

  * 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@gem_exec_gttfill@basic.html

  * 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@gem_huc_copy@huc-copy.html

  * 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@gem_lmem_swapping@basic.html

  * 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@gem_lmem_swapping@parallel-random-engines.html
    - 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@gem_lmem_swapping@parallel-random-engines.html

  * 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@gem_mmap@basic.html

  * 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@gem_softpin@allocator-basic-reserve.html

  * 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@gem_tiled_blits@basic.html

  * 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@i915_module_load@load.html

  * 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@i915_pm_backlight@basic-brightness.html

  * 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@i915_pm_rps@basic-api.html
    - bat-dg1-5:          NOTRUN -> [SKIP][16] ([i915#6621])
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@i915_pm_rps@basic-api.html

  * 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@live@hangcheck.html

  * 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@kms_addfb_basic@basic-x-tiled-legacy.html

  * 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@kms_addfb_basic@basic-y-tiled-legacy.html

  * 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@kms_chamelium@dp-crc-fast.html
    - 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@kms_chamelium@dp-crc-fast.html
    - 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@kms_chamelium@dp-crc-fast.html

  * 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@kms_chamelium@hdmi-hpd-fast.html
    - 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@kms_chamelium@hdmi-hpd-fast.html

  * 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@kms_cursor_legacy@basic-busy-flip-before-cursor.html
    - 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@kms_cursor_legacy@basic-busy-flip-before-cursor.html

  * 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@kms_force_connector_basic@force-load-detect.html
    - bat-dg1-5:          NOTRUN -> [SKIP][30] ([fdo#109285])
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@kms_force_connector_basic@force-load-detect.html

  * 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@kms_pipe_crc_basic@suspend-read-crc.html

  * 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@kms_setmode@basic-clone-single-crtc.html
    - 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@kms_setmode@basic-clone-single-crtc.html

  * 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@prime_vgem@basic-fence-read.html

  * 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@prime_vgem@basic-gtt.html

  * 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@prime_vgem@basic-userptr.html
    - 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@prime_vgem@basic-userptr.html

  * 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@prime_vgem@basic-write.html

  * 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@runner@aborted.html
    - fi-bsw-n3050:       NOTRUN -> [FAIL][42] ([i915#4312])
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-bsw-n3050/igt@runner@aborted.html

  
#### 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@basic-s0@smem.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-rplp-1/igt@gem_exec_suspend@basic-s0@smem.html

  * 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@live@hangcheck.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-ehl-2/igt@i915_selftest@live@hangcheck.html

  * 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@live@reset.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-rpls-2/igt@i915_selftest@live@reset.html

  
  {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

[-- Attachment #2: Type: text/html, Size: 17880 bytes --]

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

* Re: [igt-dev] [PATCH i-g-t 5/7] tests/i915/gem_basic: add multigpu-create-close subtest
       [not found] ` <20221202205705.58879-6-kamil.konieczny@linux.intel.com>
@ 2022-12-05  6:10   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2022-12-05  6:10 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev, Petri Latvala

On Fri,  2 Dec 2022 21:57:03 +0100
Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:

> 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 <anna.karas@intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
>  tests/i915/gem_basic.c | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/i915/gem_basic.c b/tests/i915/gem_basic.c
> index 2aa5d850..9ee09782 100644
> --- a/tests/i915/gem_basic.c
> +++ b/tests/i915/gem_basic.c
> @@ -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
>  {
>  	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...

> +	}
> +
>  	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.

> +		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);
> +			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:

Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>

Regards,
Mauro

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

* Re: [igt-dev] [PATCH i-g-t 3/7] lib/igt_core: add prefix to logging
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 3/7] lib/igt_core: add prefix to logging Kamil Konieczny
@ 2022-12-05  6:12   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2022-12-05  6:12 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev

On Fri,  2 Dec 2022 21:57:01 +0100
Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:

> 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.
> 
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>

Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>

> ---
>  lib/igt_core.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 68ae7289..65b7be64 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -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;

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

* Re: [igt-dev] [PATCH i-g-t 4/7] lib/tests/igt_fork: add tests for igt_multi_fork
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 4/7] lib/tests/igt_fork: add tests for igt_multi_fork Kamil Konieczny
@ 2022-12-05  6:15   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2022-12-05  6:15 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev

On Fri,  2 Dec 2022 21:57:02 +0100
Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:

> Create tests for new library macro igt_multi_fork. Also while at
> this, change comment into prints which helps testing.
> 
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>

LGTM.

Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>

> ---
>  lib/tests/igt_fork.c | 93 +++++++++++++++++++++++++++++++-------------
>  1 file changed, 65 insertions(+), 28 deletions(-)
> 
> diff --git a/lib/tests/igt_fork.c b/lib/tests/igt_fork.c
> index d883aba4..163e16a7 100644
> --- a/lib/tests/igt_fork.c
> +++ b/lib/tests/igt_fork.c
> @@ -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");


>  }

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

* Re: [igt-dev] [PATCH i-g-t 6/7] tests/i915/gem_exec_gttfill: add new subtest multigpu-basic
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 6/7] tests/i915/gem_exec_gttfill: add new subtest multigpu-basic Kamil Konieczny
@ 2022-12-05  6:28   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2022-12-05  6:28 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev

On Fri,  2 Dec 2022 21:57:04 +0100
Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:

> 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
> 
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
>  tests/i915/gem_exec_gttfill.c | 32 ++++++++++++++++++++++++++++++--
>  1 file changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/i915/gem_exec_gttfill.c b/tests/i915/gem_exec_gttfill.c
> index f9f244d6..5be8428d 100644
> --- a/tests/i915/gem_exec_gttfill.c
> +++ b/tests/i915/gem_exec_gttfill.c
> @@ -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;

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

> +	}
> +
> +	igt_subtest("multigpu-basic") { /* run on two or more discrete cards */
> +		igt_require(gpu_count > 1);

As you're already asserting it here.

> +		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);
>  	}
>  }

After addressing it:

Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>

Regards,
Mauro

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

* Re: [igt-dev] [PATCH i-g-t 7/7] tests/i915/gem_close_race: add multiGPU subtests
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 7/7] tests/i915/gem_close_race: add multiGPU subtests Kamil Konieczny
@ 2022-12-05  6:30   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2022-12-05  6:30 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev

On Fri,  2 Dec 2022 21:57:05 +0100
Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:

> Add two multiGPU subtests multigpu-basic-threads and
> multigpu-basic-process.
> 
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
>  tests/i915/gem_close_race.c | 54 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
> 
> diff --git a/tests/i915/gem_close_race.c b/tests/i915/gem_close_race.c
> index e37a8882..3ef073b8 100644
> --- a/tests/i915/gem_close_race.c
> +++ b/tests/i915/gem_close_race.c
> @@ -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;
> +

Same here: no need to enforce it.

>  		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") {

As before, after cleaning up:

Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>

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

* Re: [igt-dev] [PATCH i-g-t 1/7] lib/igt_core: add igt_multi_fork for parallel tests
       [not found] ` <20221202205705.58879-2-kamil.konieczny@linux.intel.com>
@ 2022-12-05  6:32   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2022-12-05  6:32 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev, Petri Latvala

On Fri,  2 Dec 2022 21:56:59 +0100
Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:

> 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 <anna.karas@intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>

LGTM.
Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>

> ---
>  lib/igt_core.c | 207 ++++++++++++++++++++++++++++++++++++++++++++-----
>  lib/igt_core.h |  21 +++++
>  2 files changed, 209 insertions(+), 19 deletions(-)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index b77dca91..dca380d0 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -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;
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index b659ea7b..5d5593e0 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -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

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

* Re: [igt-dev] ✗ Fi.CI.BAT: failure for Add few multi-GPU subtests with the help of igt_multi_fork macro
  2022-12-02 21:38 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add few multi-GPU subtests with the help of igt_multi_fork macro Patchwork
@ 2022-12-05 14:33   ` Kamil Konieczny
  0 siblings, 0 replies; 14+ messages in thread
From: Kamil Konieczny @ 2022-12-05 14:33 UTC (permalink / raw)
  To: igt-dev; +Cc: Lakshminarayana Vudum

Hi Lakshmi,

these are unrelated,

--
Kamil

On 2022-12-02 at 21:38:06 -0000, Patchwork wrote:
> == 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@debugfs_test@basic-hwmon.html
> 
>   * 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@gem_exec_gttfill@basic.html
> 
>   * 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@gem_huc_copy@huc-copy.html
> 
>   * 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@gem_lmem_swapping@basic.html
> 
>   * 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@gem_lmem_swapping@parallel-random-engines.html
>     - 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@gem_lmem_swapping@parallel-random-engines.html
> 
>   * 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@gem_mmap@basic.html
> 
>   * 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@gem_softpin@allocator-basic-reserve.html
> 
>   * 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@gem_tiled_blits@basic.html
> 
>   * 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@i915_module_load@load.html
> 
>   * 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@i915_pm_backlight@basic-brightness.html
> 
>   * 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@i915_pm_rps@basic-api.html
>     - bat-dg1-5:          NOTRUN -> [SKIP][16] ([i915#6621])
>    [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@i915_pm_rps@basic-api.html
> 
>   * 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@live@hangcheck.html
> 
>   * 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@kms_addfb_basic@basic-x-tiled-legacy.html
> 
>   * 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@kms_addfb_basic@basic-y-tiled-legacy.html
> 
>   * 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@kms_chamelium@dp-crc-fast.html
>     - 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@kms_chamelium@dp-crc-fast.html
>     - 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@kms_chamelium@dp-crc-fast.html
> 
>   * 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@kms_chamelium@hdmi-hpd-fast.html
>     - 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@kms_chamelium@hdmi-hpd-fast.html
> 
>   * 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@kms_cursor_legacy@basic-busy-flip-before-cursor.html
>     - 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@kms_cursor_legacy@basic-busy-flip-before-cursor.html
> 
>   * 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@kms_force_connector_basic@force-load-detect.html
>     - bat-dg1-5:          NOTRUN -> [SKIP][30] ([fdo#109285])
>    [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-dg1-5/igt@kms_force_connector_basic@force-load-detect.html
> 
>   * 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@kms_pipe_crc_basic@suspend-read-crc.html
> 
>   * 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@kms_setmode@basic-clone-single-crtc.html
>     - 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@kms_setmode@basic-clone-single-crtc.html
> 
>   * 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@prime_vgem@basic-fence-read.html
> 
>   * 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@prime_vgem@basic-gtt.html
> 
>   * 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@prime_vgem@basic-userptr.html
>     - 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@prime_vgem@basic-userptr.html
> 
>   * 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@prime_vgem@basic-write.html
> 
>   * 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@runner@aborted.html
>     - fi-bsw-n3050:       NOTRUN -> [FAIL][42] ([i915#4312])
>    [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-bsw-n3050/igt@runner@aborted.html
> 
>   
> #### 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@basic-s0@smem.html
>    [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-rplp-1/igt@gem_exec_suspend@basic-s0@smem.html
> 
>   * 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@live@hangcheck.html
>    [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/fi-ehl-2/igt@i915_selftest@live@hangcheck.html
> 
>   * 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@live@reset.html
>    [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8189/bat-rpls-2/igt@i915_selftest@live@reset.html
> 
>   
>   {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

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

* Re: [igt-dev] [PATCH i-g-t 2/7] lib/igt_core: store GPU string or opened device name
  2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_core: store GPU string or opened device name Kamil Konieczny
@ 2022-12-07 10:32   ` Petri Latvala
  0 siblings, 0 replies; 14+ messages in thread
From: Petri Latvala @ 2022-12-07 10:32 UTC (permalink / raw)
  To: Kamil Konieczny; +Cc: igt-dev

On Fri, Dec 02, 2022 at 09:57:00PM +0100, Kamil Konieczny wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
> 
> 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]
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
>  lib/drmtest.c  |  4 +++-
>  lib/igt_core.c | 30 ++++++++++++++++++++++++++++++
>  lib/igt_core.h |  6 ++++++
>  3 files changed, 39 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 16e80bdf..5eb98272 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -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);
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index dca380d0..68ae7289 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -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?


-- 
Petri Latvala


> +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;
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index 5d5593e0..1f7e3652 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -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 */
> -- 
> 2.34.1
> 

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

end of thread, other threads:[~2022-12-07 10:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20221202205705.58879-1-kamil.konieczny@linux.intel.com>
2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_core: store GPU string or opened device name Kamil Konieczny
2022-12-07 10:32   ` Petri Latvala
2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 3/7] lib/igt_core: add prefix to logging Kamil Konieczny
2022-12-05  6:12   ` Mauro Carvalho Chehab
2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 4/7] lib/tests/igt_fork: add tests for igt_multi_fork Kamil Konieczny
2022-12-05  6:15   ` Mauro Carvalho Chehab
2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 6/7] tests/i915/gem_exec_gttfill: add new subtest multigpu-basic Kamil Konieczny
2022-12-05  6:28   ` Mauro Carvalho Chehab
2022-12-02 20:57 ` [igt-dev] [PATCH i-g-t 7/7] tests/i915/gem_close_race: add multiGPU subtests Kamil Konieczny
2022-12-05  6:30   ` Mauro Carvalho Chehab
2022-12-02 21:38 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add few multi-GPU subtests with the help of igt_multi_fork macro Patchwork
2022-12-05 14:33   ` Kamil Konieczny
     [not found] ` <20221202205705.58879-6-kamil.konieczny@linux.intel.com>
2022-12-05  6:10   ` [igt-dev] [PATCH i-g-t 5/7] tests/i915/gem_basic: add multigpu-create-close subtest Mauro Carvalho Chehab
     [not found] ` <20221202205705.58879-2-kamil.konieczny@linux.intel.com>
2022-12-05  6:32   ` [igt-dev] [PATCH i-g-t 1/7] lib/igt_core: add igt_multi_fork for parallel tests Mauro Carvalho Chehab

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