public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi@etezian.org>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: IGT dev <igt-dev@lists.freedesktop.org>, Andi Shyti <andi@etezian.org>
Subject: Re: [igt-dev] [PATCH v17 4/7] lib/i915: add gem_engine_topology library and for_each loop definition
Date: Fri, 5 Apr 2019 12:00:47 +0300	[thread overview]
Message-ID: <20190405090047.GE18786@jack.zhora.eu> (raw)
In-Reply-To: <3af0b26f-f79a-bfc3-5735-241f192a8cc0@linux.intel.com>

Hi Tvrtko,

> > +	struct i915_context_param_engines *engines =
> > +			(struct i915_context_param_engines*) param->value;
> 
> Cosmetics only: Our coding style is "(type *)var".
> 
> > +	for (typeof(engines->class_instance[0]) *p =
> > +			&engines->class_instance[0];
> > +						i < ed->nengines; i++, p++)
> 
> More cosmetics: Indentation alignment looks wonky.

working at the edge of the 80 characters provides always
cosmetic challenges, I'll fix the above.

> > +struct intel_execution_engine2
> > +*intel_get_current_engine(struct intel_engine_data *ed)
> > +{
> > +	if (!ed->n)
> > +		ed->current_engine = &ed->engines[0];
> > +	else if (ed->n >= ed->nengines)
> > +		ed->current_engine = NULL;
> > +
> > +	return ed->current_engine;
> > +}
> > +
> 
> Why can this just return ed->current_engine? I am confused by the need to
> check against ed->nengines both in the getter and in the next helper. Just
> need to init ed->current_engine to the first one in init_engine_list I
> think.

In the previous patch there was an unrefined mistake:
ed->current_engine was initialized in the
'intel_init_engine_list()' function.

But because there everything is allocated in stack, the
'&ed->engines[0]' is also in stack that get freed when the
function returns, with the result that I lose reference.

For this, I would need the pointer to be assigned somewhere that
works with the addresses provided by the caller and this looks
like the best place for it (indeed I removed the assignement from
intel_init_engine_list()).

> > +struct intel_execution_engine2
> > +*intel_get_current_physical_engine(struct intel_engine_data *ed)
> > +{
> > +	struct intel_execution_engine2 *e;
> > +
> > +	if (ed->n >= ed->nengines)
> > +		return NULL;
> 
> Can this be hit? intel_next_engine looks to be avoiding incrementing past
> nengines - 1.

yes, you're right, I didn't want to hit the for loop for this
case that can be checked here, it's redundant, but it looks more
readable. I'll remove it.

> > +
> > +	if (igt_only_list_subtests())
> > +		intel_next_engine(ed);
> 
> In subtest listing mode there cannot be virtual engines in the list so I
> think this branch is not needed.

Yes, indeed, if we have the list of engines at this point, it's
only physical. I'll remove it.

> > +			__e2->name       = e2->name;
> > +			__e2->instance   = e2->instance;
> > +			__e2->class      = e2->class;
> > +			__e2->is_virtual = false;
> 
> You could use init_engine here but granted it would have to do a redundant
> name search so maybe not.

yes, this is how it is was done at first, I put it outside for
the reason you mentioned :)

Thanks,
Andi

> Regards,
> 
> Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-04-05  9:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05  1:07 [igt-dev] [PATCH v17 0/7] new engine discovery interface Andi Shyti
2019-04-05  1:07 ` [igt-dev] [PATCH v17 1/7] lib/igt_gt: remove unnecessary argument Andi Shyti
2019-04-05 14:43   ` Caz Yokoyama
2019-04-05  1:07 ` [igt-dev] [PATCH v17 2/7] lib: ioctl_wrappers: reach engines by index as well Andi Shyti
2019-04-05  7:59   ` Chris Wilson
2019-04-05  8:35     ` Andi Shyti
2019-04-05  1:07 ` [igt-dev] [PATCH v17 3/7] include/drm-uapi: import i915_drm.h header file Andi Shyti
2019-04-05  1:07 ` [igt-dev] [PATCH v17 4/7] lib/i915: add gem_engine_topology library and for_each loop definition Andi Shyti
2019-04-05  8:42   ` Tvrtko Ursulin
2019-04-05  9:00     ` Andi Shyti [this message]
2019-04-05  9:16       ` Tvrtko Ursulin
2019-04-05  1:07 ` [igt-dev] [PATCH v17 5/7] lib: igt_gt: add eb flags to class helper Andi Shyti
2019-04-05  1:07 ` [igt-dev] [PATCH v17 6/7] lib: igt_gt: make gem_engine_can_store_dword() check engine class Andi Shyti
2019-04-05  1:07 ` [igt-dev] [PATCH v17 7/7] test: perf_pmu: use the gem_engine_topology library Andi Shyti
2019-04-05  8:50   ` Tvrtko Ursulin
2019-04-05  9:09     ` Andi Shyti
2019-04-05  9:22       ` Tvrtko Ursulin
2019-04-05  2:06 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [v17,1/7] lib/igt_gt: remove unnecessary argument Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190405090047.GE18786@jack.zhora.eu \
    --to=andi@etezian.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tvrtko.ursulin@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox