[igt-dev] [PATCH RFC i-g-t v1 1/2] tests/i915/gem_basic: convert to multithreaded multi-GPUs

Petri Latvala petri.latvala at intel.com
Thu Sep 22 10:36:24 UTC 2022


On Wed, Sep 21, 2022 at 03:58:01PM +0200, Mauro Carvalho Chehab wrote:
> Hi Kamil,
> 
> On Wed, 21 Sep 2022 12:29:39 +0200
> Kamil Konieczny <kamil.konieczny at linux.intel.com> wrote:
> 
> > This will convert basic tests to run on multi-GPU hardware
> > configuration. It will take effect when --device option will be
> > used and at least two devices will be found with a filter. When
> > there are no filtered ones or there is only one, tests will
> > fall through to old run.
> > 
> > One method for use will be to extend filtered devices with '*'
> > or regex:
> > 
> > sudo ./gem_basic --device=pci:vendor=intel,device=discrete,card=*
> > 
> > Pros: no change in tests names, no new tests added. Use restricted
> > to runs with suitable hw config.
> > 
> > Cons: it can be hard to replicate failed tests or it can break
> > igt-framework in compliated use cases. It is also not clear how
> > to change this solution into clean macro for reuse.
> > 
> > Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> > Cc: Andi Shyti <andi.shyti at linux.intel.com>
> > Cc: Anna Karas <anna.karas at intel.com>
> > Cc: Chris Wilson <chris.p.wilson at linux.intel.com>
> > Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
> > Cc: Petri Latvala <petri.latvala at intel.com>
> > Cc: Mauro Carvalho Chehab <mauro.chehab at linux.intel.com>
> > Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> > ---
> >  tests/i915/gem_basic.c | 71 ++++++++++++++++++++++++++++++++++++++----
> >  1 file changed, 65 insertions(+), 6 deletions(-)
> > 
> > diff --git a/tests/i915/gem_basic.c b/tests/i915/gem_basic.c
> > index 17ae190c..66413e60 100644
> > --- a/tests/i915/gem_basic.c
> > +++ b/tests/i915/gem_basic.c
> > @@ -38,6 +38,7 @@
> >  
> >  #include "drm.h"
> >  #include "i915/gem_create.h"
> > +#include "igt_device_scan.h"
> >  
> >  IGT_TEST_DESCRIPTION("Tests basic gem_create and gem_close IOCTLs");
> >  
> > @@ -48,6 +49,7 @@ test_bad_close(int fd)
> >  	int ret;
> >  
> >  	igt_info("Testing error return on bad close ioctl.\n");
> > +	igt_info("%s: pid: %d, tid: %lu, CPU: %d\n", __func__, getpid(), pthread_self(), sched_getcpu());
> 
> Hmm... perhaps we should add pid at igt_info(), for multi-GPU scenarios, e. g.
> when IGT was asked to run with more than one GPUs.
> 
> Not sure if it makes sense to display tid/CPU here.

A drive-by note on tid:

pthread_self() returns pthread_t and blindly assuming that's an
integer is not portable. pthread_t is supposed to be used as an opaque
object. Whereas gettid() returns pid_t which is an integer.

"gettid() is not portable though!"

Yeah but portable enough, we use it already here and there, and
HAVE_GETTID is defined to tell you whether we have it.


-- 
Petri Latvala


More information about the igt-dev mailing list