From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5ADED6E0ED for ; Tue, 17 Aug 2021 02:20:03 +0000 (UTC) Date: Mon, 16 Aug 2021 19:20:01 -0700 Message-ID: <87o89wzub2.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" In-Reply-To: <20210816115626.22759-5-zbigniew.kempczynski@intel.com> References: <20210816115626.22759-1-zbigniew.kempczynski@intel.com> <20210816115626.22759-5-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 4/5] tests/gem_exec_schedule: Adopt to use allocator 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 Mon, 16 Aug 2021 04:56:25 -0700, Zbigniew Kempczy=F1ski wrote: > > @@ -117,12 +119,23 @@ static uint32_t __store_dword(int fd, const intel_c= tx_t *ctx, unsigned ring, > > + if (ahnd) { > + obj[0].offset =3D cork_offset; > + obj[0].flags |=3D EXEC_OBJECT_PINNED; > + obj[1].offset =3D target_offset; > + obj[1].flags |=3D EXEC_OBJECT_PINNED; > + if (write_domain) > + obj[1].flags |=3D EXEC_OBJECT_WRITE; > + obj[2].offset =3D get_offset(ahnd, obj[2].handle, 4096, 0); > + obj[2].flags |=3D EXEC_OBJECT_PINNED; > + } else { > + obj[0].offset =3D cork << 20; > + obj[1].offset =3D target << 20; > + obj[2].offset =3D 256 << 10; > + obj[2].offset +=3D (random() % 128) << 12; > + } > > memset(&reloc, 0, sizeof(reloc)); > reloc.target_handle =3D obj[1].handle; > @@ -132,13 +145,13 @@ static uint32_t __store_dword(int fd, const intel_c= tx_t *ctx, unsigned ring, > reloc.read_domains =3D I915_GEM_DOMAIN_INSTRUCTION; > reloc.write_domain =3D write_domain; > obj[2].relocs_ptr =3D to_user_pointer(&reloc); > - obj[2].relocation_count =3D 1; > + obj[2].relocation_count =3D !ahnd ? 1 : 0; > > i =3D 0; > batch[i] =3D MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0); > if (gen >=3D 8) { > batch[++i] =3D reloc.presumed_offset + reloc.delta; > - batch[++i] =3D 0; > + batch[++i] =3D (reloc.presumed_offset + reloc.delta) >> 32; > } else if (gen >=3D 4) { > batch[++i] =3D 0; > batch[++i] =3D reloc.presumed_offset + reloc.delta; > @@ -155,31 +168,38 @@ static uint32_t __store_dword(int fd, const intel_c= tx_t *ctx, unsigned ring, I think we need this here (or in the callers): if (ahnd) put_offset(ahnd, obj[2].offset); > @@ -2584,12 +2824,14 @@ static void measure_semaphore_power(int i915, con= st intel_ctx_t *ctx) > } s_spin[2], s_sema[2]; > double baseline, total; > int64_t jiffie =3D 1; > - igt_spin_t *spin; > + igt_spin_t *spin, *sema[GEM_MAX_ENGINES] =3D {}; > + int i; > > if (!gem_class_can_store_dword(i915, signaler->class)) > continue; > > spin =3D __igt_spin_new(i915, > + .ahnd =3D ahnd, > .ctx =3D ctx, > .engine =3D signaler->flags, > .flags =3D IGT_SPIN_POLL_RUN); > @@ -2603,19 +2845,23 @@ static void measure_semaphore_power(int i915, con= st intel_ctx_t *ctx) > rapl_read(&pkg, &s_spin[1].pkg); > > /* Add a waiter to each engine */ > + i =3D 0; > for_each_ctx_engine(i915, ctx, e) { > - igt_spin_t *sema; > - > - if (e->flags =3D=3D signaler->flags) > + if (e->flags =3D=3D signaler->flags) { > + i++; > continue; > + } > > - sema =3D __igt_spin_new(i915, > - .ctx =3D ctx, > - .engine =3D e->flags, > - .dependency =3D spin->handle); > - > - igt_spin_free(i915, sema); > + sema[i] =3D __igt_spin_new(i915, > + .ahnd =3D ahnd, > + .ctx =3D ctx, > + .engine =3D e->flags, > + .dependency =3D spin->handle); > + i++; > } > + for (i =3D 0; i < GEM_MAX_ENGINES; i++) > + if (sema[i]) > + igt_spin_free(i915, sema[i]); Did we create this array etc. to avoid the stall when the spin is freed and the offset is reused? Or is there a different reason? Otherwise this is: Reviewed-by: Ashutosh Dixit