From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 191116E02D for ; Fri, 22 Oct 2021 23:13:04 +0000 (UTC) Date: Fri, 22 Oct 2021 16:13:02 -0700 Message-ID: <87fssswt4x.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" In-Reply-To: <20211021114400.28238-1-zbigniew.kempczynski@intel.com> References: <20211021114400.28238-1-zbigniew.kempczynski@intel.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable Subject: Re: [igt-dev] [PATCH i-g-t] tests/gem_exec_await: Adopt to no-reloc mode List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Zbigniew =?ISO-8859-2?Q?Kempczy=F1ski?= Cc: igt-dev@lists.freedesktop.org, Petri Latvala List-ID: On Thu, 21 Oct 2021 04:44:00 -0700, Zbigniew Kempczy=F1ski wrote: > > In previous series most of tests were already adopted to no-reloc > mode but some still requires adoption. This change adds softpinning > with offset acquired from an allocator. Reviewed-by: Ashutosh Dixit > Signed-off-by: Zbigniew Kempczy=F1ski > Cc: Ashutosh Dixit > Cc: Petri Latvala > --- > tests/i915/gem_exec_await.c | 31 +++++++++++++++++++++++++++---- > 1 file changed, 27 insertions(+), 4 deletions(-) > > diff --git a/tests/i915/gem_exec_await.c b/tests/i915/gem_exec_await.c > index bea57c61b..bf8eb6822 100644 > --- a/tests/i915/gem_exec_await.c > +++ b/tests/i915/gem_exec_await.c > @@ -72,6 +72,7 @@ static void wide(int fd, const intel_ctx_t *ctx, int ri= ng_size, > unsigned engines[I915_EXEC_RING_MASK + 1], nengine; > unsigned long count; > double time; > + uint64_t ahnd =3D get_reloc_ahnd(fd, 0); /* just offset provider */ > > nengine =3D 0; > for_each_ctx_engine(fd, ctx, engine) { > @@ -97,8 +98,13 @@ static void wide(int fd, const intel_ctx_t *ctx, int r= ing_size, > for (unsigned n =3D 0; n < ring_size; n++) { > exec[e].obj[n].handle =3D gem_create(fd, 4096); > exec[e].obj[n].flags =3D EXEC_OBJECT_WRITE; > + exec[e].obj[n].offset =3D get_offset(ahnd, exec[e].obj[n].handle, > + 4096, 0); > + if (ahnd) > + exec[e].obj[n].flags |=3D EXEC_OBJECT_PINNED; > > obj[e*ring_size + n].handle =3D exec[e].obj[n].handle; > + obj[e*ring_size + n].offset =3D exec[e].obj[n].offset; > } > > exec[e].execbuf.buffers_ptr =3D to_user_pointer(exec[e].exec); > @@ -115,6 +121,11 @@ static void wide(int fd, const intel_ctx_t *ctx, int= ring_size, > } > > exec[e].exec[0].handle =3D gem_create(fd, 4096); > + exec[e].exec[0].offset =3D get_offset(ahnd, exec[e].exec[0].handle, > + 4096, 0); > + if (ahnd) > + exec[e].exec[0].flags =3D EXEC_OBJECT_PINNED; > + > exec[e].cmd =3D gem_mmap__wc(fd, exec[e].exec[0].handle, > 0, 4096, PROT_WRITE); > > @@ -133,11 +144,17 @@ static void wide(int fd, const intel_ctx_t *ctx, in= t ring_size, > exec[e].reloc.delta =3D 1; > > exec[e].exec[1].relocs_ptr =3D to_user_pointer(&exec[e].reloc); > - exec[e].exec[1].relocation_count =3D 1; > + exec[e].exec[1].relocation_count =3D !ahnd ? 1 : 0; > } > + > obj[nengine*ring_size].handle =3D gem_create(fd, 4096); > gem_write(fd, obj[nengine*ring_size].handle, 0, &bbe, sizeof(bbe)); > > + obj[nengine*ring_size].offset =3D get_offset(ahnd, obj[nengine*ring_siz= e].handle, > + 4096, 0); > + if (ahnd) > + obj[nengine*ring_size].flags |=3D EXEC_OBJECT_PINNED; > + > memset(&execbuf, 0, sizeof(execbuf)); > execbuf.buffers_ptr =3D to_user_pointer(&obj[nengine*ring_size]); > execbuf.buffer_count =3D 1; > @@ -222,16 +239,22 @@ static void wide(int fd, const intel_ctx_t *ctx, in= t ring_size, > if (flags & CONTEXTS) > intel_ctx_destroy(fd, exec[e].ctx); > > - for (unsigned n =3D 0; n < ring_size; n++) > + for (unsigned n =3D 0; n < ring_size; n++) { > gem_close(fd, exec[e].obj[n].handle); > + put_offset(ahnd, exec[e].obj[n].handle); > + } > free(exec[e].obj); > > munmap(exec[e].cmd, 4096); > gem_close(fd, exec[e].exec[1].handle); > + put_offset(ahnd, exec[e].exec[1].handle); > } > free(exec); > + put_ahnd(ahnd); > } > > +#define TIMEOUT 20 > + > igt_main > { > int ring_size =3D 0; > @@ -254,11 +277,11 @@ igt_main > } > > igt_subtest("wide-all") > - wide(device, ctx, ring_size, 20, 0); > + wide(device, ctx, ring_size, TIMEOUT, 0); > > igt_subtest("wide-contexts") { > gem_require_contexts(device); > - wide(device, ctx, ring_size, 20, CONTEXTS); > + wide(device, ctx, ring_size, TIMEOUT, CONTEXTS); > } > > igt_fixture { > -- > 2.26.0 >