public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: igt-dev@lists.freedesktop.org, Petri Latvala <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 5/7] tests/i915/gem_basic: add multigpu-create-close subtest
Date: Mon, 5 Dec 2022 07:10:31 +0100	[thread overview]
Message-ID: <20221205071031.66f23969@maurocar-mobl2> (raw)
In-Reply-To: <20221202205705.58879-6-kamil.konieczny@linux.intel.com>

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

  parent reply	other threads:[~2022-12-05  6:10 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 ` [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   ` Mauro Carvalho Chehab [this message]
     [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=20221205071031.66f23969@maurocar-mobl2 \
    --to=mauro.chehab@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=petri.latvala@intel.com \
    /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