From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 87AC36E44F for ; Wed, 16 Jun 2021 02:25:03 +0000 (UTC) Date: Tue, 15 Jun 2021 19:25:01 -0700 Message-ID: <87o8c65ywy.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" In-Reply-To: <20210614163902.366168-19-jason@jlekstrand.net> References: <20210614163704.365989-1-jason@jlekstrand.net> <20210614163902.366168-19-jason@jlekstrand.net> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Subject: Re: [igt-dev] [PATCH i-g-t 68/77] igt/dummyload: Require an intel_ctx_t for POLL_RUN and !ALL_ENGINES List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Jason Ekstrand Cc: igt-dev@lists.freedesktop.org List-ID: On Mon, 14 Jun 2021 09:38:53 -0700, Jason Ekstrand wrote: > > diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c > index b0a7b361c..25e49de47 100644 > --- a/lib/igt_dummyload.c > +++ b/lib/igt_dummyload.c > @@ -421,22 +421,12 @@ igt_spin_factory(int fd, const struct igt_spin_factory *opts) > { > igt_spin_t *spin; > > - if (opts->engine != ALL_ENGINES) { > - struct intel_execution_engine2 e; > - int class; > - > - if (opts->ctx) { > - class = opts->ctx->cfg.engines[opts->engine].engine_class; > - } else if (!gem_context_lookup_engine(fd, opts->engine, > - opts->ctx_id, &e)) { > - class = e.class; > - } else { > - gem_require_ring(fd, opts->engine); > - class = gem_execbuf_flags_to_engine_class(opts->engine); > - } > + if ((opts->flags & IGT_SPIN_POLL_RUN) && opts->engine != ALL_ENGINES) { > + unsigned int class; > > - if (opts->flags & IGT_SPIN_POLL_RUN) > - igt_require(gem_class_can_store_dword(fd, class)); > + igt_assert(opts->ctx); > + class = intel_ctx_engine_class(opts->ctx, opts->engine); > + igt_require(gem_class_can_store_dword(fd, class)); > } I am not sure if this is correct. If I straightforwardly enforce opts->ctx and tranform the original logic I get this: if (opts->engine != ALL_ENGINES) { int class; igt_assert(opts->ctx); class = intel_ctx_engine_class(opts->ctx, opts->engine); if (opts->flags & IGT_SPIN_POLL_RUN) igt_require(gem_class_can_store_dword(fd, class)); } or even if (opts->engine != ALL_ENGINES) { igt_assert(opts->ctx); if (opts->flags & IGT_SPIN_POLL_RUN) { int class = intel_ctx_engine_class(opts->ctx, opts->engine); igt_require(gem_class_can_store_dword(fd, class)); } } Importantly, "igt_assert(opts->ctx)" is invoked independent of opts->flags, unlike the code in the patch. _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev