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

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Mon Dec 5 06:30:45 UTC 2022


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

> Add two multiGPU subtests multigpu-basic-threads and
> multigpu-basic-process.
> 
> Signed-off-by: Kamil Konieczny <kamil.konieczny at 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 at kernel.org>


More information about the igt-dev mailing list