public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 7/7] tests/i915/gem_close_race: add multiGPU subtests
Date: Fri,  2 Dec 2022 21:57:05 +0100	[thread overview]
Message-ID: <20221202205705.58879-8-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20221202205705.58879-1-kamil.konieczny@linux.intel.com>

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

  parent reply	other threads:[~2022-12-02 20:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 ` Kamil Konieczny [this message]
2022-12-05  6:30   ` [igt-dev] [PATCH i-g-t 7/7] tests/i915/gem_close_race: add multiGPU subtests 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221202205705.58879-8-kamil.konieczny@linux.intel.com \
    --to=kamil.konieczny@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox