From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v3 9/9] drm/i915/perf: Add support for OA media units
Date: Thu, 02 Mar 2023 13:01:21 -0800 [thread overview]
Message-ID: <87h6v2yiji.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20230228022329.3615793-10-umesh.nerlige.ramappa@intel.com>
On Mon, 27 Feb 2023 18:23:29 -0800, Umesh Nerlige Ramappa wrote:
>
Hi Umesh,
> @@ -1632,11 +1647,28 @@ free_noa_wait(struct i915_perf_stream *stream)
> i915_vma_unpin_and_release(&stream->noa_wait, 0);
> }
>
> +/*
> + * intel_engine_lookup_user ensures that most of engine specific checks are
> + * taken care of, however, we can run into a case where the OA unit catering to
> + * the engine passed by the user is disabled for some reason. In such cases,
> + * ensure oa unit corresponding to an engine is functional. If there are no
> + * engines in the group, the unit is disabled.
> + */
> +static bool oa_unit_functional(const struct intel_engine_cs *engine)
> +{
> + return engine->oa_group && engine->oa_group->num_engines;
This doesn't add anything above engine_supports_oa() below: if
engine->oa_group is true for engine X, engine->oa_group->num_engines must
at least be 1 because the oa_group must at least contain X. (Of course
oa_group->num_engines can still be 0 but engine->oa_group->num_engines must
be > 0).
We can see this in oa_init_gt where num_engines++ and oa_group assignment
is done together:
static int oa_init_gt(struct intel_gt *gt)
{
...
for_each_engine_masked(engine, gt, ALL_ENGINES, tmp) {
u32 index = __oa_engine_group(engine);
engine->oa_group = NULL;
if (index < num_groups) {
g[index].num_engines++;
engine->oa_group = &g[index];
}
}
}
Therefore in read_properties_unlocked these checks are sufficient:
props->engine = intel_engine_lookup_user(perf->i915, class, instance);
if (!props->engine) {
return -EINVAL;
}
if (!engine_supports_oa(props->engine)) {
return -EINVAL;
}
The oa_unit_functional check is not needed.
> +}
> +
> static bool engine_supports_oa(const struct intel_engine_cs *engine)
> {
> return engine->oa_group;
> }
>
> +static bool engine_supports_oa_format(struct intel_engine_cs *engine, int type)
> +{
> + return engine->oa_group && engine->oa_group->type == type;
> +}
> +
/snip/
> @@ -4186,6 +4227,17 @@ static int read_properties_unlocked(struct i915_perf *perf,
> return -EINVAL;
> }
>
> + if (!oa_unit_functional(props->engine))
> + return -ENODEV;
> +
> + i = array_index_nospec(props->oa_format, I915_OA_FORMAT_MAX);
> + f = &perf->oa_formats[i];
> + if (!engine_supports_oa_format(props->engine, f->type)) {
> + DRM_DEBUG("Invalid OA format %d for class %d\n",
> + f->type, props->engine->class);
> + return -EINVAL;
> + }
> +
Thanks.
--
Ashutosh
prev parent reply other threads:[~2023-03-02 21:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-28 2:23 [Intel-gfx] [PATCH v3 0/9] Add OAM support for MTL Umesh Nerlige Ramappa
2023-02-28 2:23 ` [Intel-gfx] [PATCH v3 1/9] drm/i915/perf: Drop wakeref on GuC RC error Umesh Nerlige Ramappa
2023-02-28 2:23 ` [Intel-gfx] [PATCH v3 2/9] drm/i915/perf: Add helper to check supported OA engines Umesh Nerlige Ramappa
2023-02-28 2:23 ` [Intel-gfx] [PATCH v3 3/9] drm/i915/perf: Validate OA sseu config outside switch Umesh Nerlige Ramappa
2023-02-28 2:23 ` [Intel-gfx] [PATCH v3 4/9] drm/i915/perf: Group engines into respective OA groups Umesh Nerlige Ramappa
2023-03-02 0:36 ` Dixit, Ashutosh
2023-02-28 2:23 ` [Intel-gfx] [PATCH v3 5/9] drm/i915/perf: Fail modprobe if i915_perf_init fails on OOM Umesh Nerlige Ramappa
2023-02-28 2:23 ` [Intel-gfx] [PATCH v3 6/9] drm/i915/perf: Parse 64bit report header formats correctly Umesh Nerlige Ramappa
2023-02-28 2:23 ` [Intel-gfx] [PATCH v3 7/9] drm/i915/perf: Handle non-power-of-2 reports Umesh Nerlige Ramappa
2023-02-28 22:55 ` Dixit, Ashutosh
2023-02-28 2:23 ` [Intel-gfx] [PATCH v3 8/9] drm/i915/perf: Add engine class instance parameters to perf Umesh Nerlige Ramappa
2023-03-01 21:59 ` Dixit, Ashutosh
2023-03-03 0:52 ` Umesh Nerlige Ramappa
2023-02-28 2:23 ` [Intel-gfx] [PATCH v3 9/9] drm/i915/perf: Add support for OA media units Umesh Nerlige Ramappa
2023-03-02 21:01 ` Dixit, Ashutosh [this message]
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=87h6v2yiji.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=umesh.nerlige.ramappa@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.