From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66D3310E0EC for ; Mon, 5 Dec 2022 06:31:01 +0000 (UTC) Date: Mon, 5 Dec 2022 07:30:45 +0100 From: Mauro Carvalho Chehab To: Kamil Konieczny Message-ID: <20221205073045.27ed07ec@maurocar-mobl2> In-Reply-To: <20221202205705.58879-8-kamil.konieczny@linux.intel.com> References: <20221202205705.58879-1-kamil.konieczny@linux.intel.com> <20221202205705.58879-8-kamil.konieczny@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [igt-dev] [PATCH i-g-t 7/7] tests/i915/gem_close_race: add multiGPU subtests List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On Fri, 2 Dec 2022 21:57:05 +0100 Kamil Konieczny wrote: > Add two multiGPU subtests multigpu-basic-threads and > multigpu-basic-process. > > Signed-off-by: Kamil Konieczny > --- > 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