[igt-dev] [PATCH i-g-t v3 13/52] tests/gem_ctx_exec: Adopt to use allocator

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Thu Aug 5 08:46:41 UTC 2021


On Wed, Aug 04, 2021 at 08:06:11PM -0700, Dixit, Ashutosh wrote:
> On Mon, 26 Jul 2021 12:59:47 -0700, Zbigniew Kempczyński wrote:
> 
> With the couple of nits below addressed, this is:
> 
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
> 
> > @@ -345,10 +354,14 @@ static void close_race(int i915)
> >	const intel_ctx_t **ctx;
> >	uint32_t *ctx_id;
> >	igt_spin_t *spin;
> > +	uint64_t ahnd;
> >
> >	/* Check we can execute a polling spinner */
> >	base_ctx = intel_ctx_create(i915, NULL);
> > -	igt_spin_free(i915, igt_spin_new(i915, .ctx = base_ctx,
> > +	ahnd = get_reloc_ahnd(i915, base_ctx->id);
> > +	igt_spin_free(i915, igt_spin_new(i915,
> > +					 .ahnd = ahnd,
> > +					 .ctx = base_ctx,
> >					 .flags = IGT_SPIN_POLL_RUN));
> 
> Missing put_ahnd here I think.

We may free ahnd here (internally allocator structure will be free
due to refcnt == 0), then first child which will call get_reloc_ahnd()
will recreate this. Or we may keep this allocator structure till the
end of the test - I will put put_ahnd() there. 
 
> 
> > @@ -403,6 +419,7 @@ static void close_race(int i915)
> >		}
> >
> >		igt_spin_free(i915, spin);
> > +		put_ahnd(ahnd);
> 
> nit: prefer to move it next to intel_ctx_destroy.

I need to add this there, not move. put_ahnd() in children will
decrement refcount of allocator structure then last put_ahnd()
in main process will lead to freeing it. 

> 
> > @@ -474,11 +491,22 @@ igt_main
> >	igt_subtest("basic-nohangcheck")
> >		nohangcheck_hostile(fd);
> >
> > -	igt_subtest("basic-close-race")
> > -		close_race(fd);
> > +	igt_subtest_group {
> > +		igt_fixture {
> > +			intel_allocator_multiprocess_start();
> > +		}
> > +
> > +		igt_subtest("basic-close-race")
> > +				close_race(fd);
> 
> indent

Ack.

Thanks for review!

--
Zbigniew


More information about the igt-dev mailing list