Add OAM support for MTL
Subsystems (3)
cover Add OAM support for MTL
The OAM unit captures OA reports specific to the media engines. Add support to program the OAM unit on media tile on MTL.
The OAM unit is selected by passing the class:instance of a media engine to perf parameters. Corresponding UMD changes are posted to the igt-dev repo as part of supporting the GPUvis tool.
Test-with: [email protected]
Cc: "Ashutosh Dixit <[email protected]>"
Cc: "Lionel G Landwerlin <[email protected]>"
Cc: "Joonas Lahtinen <[email protected]>"
Cc: "Tvrtko Ursulin <[email protected]>"
Chris Wilson (1):
drm/i915/perf: Drop wakeref on GuC RC error
Umesh Nerlige Ramappa (8):
drm/i915/perf: Add helper to check supported OA engines drm/i915/perf: Validate OA sseu config outside switch drm/i915/perf: Fail modprobe if i915_perf_init fails drm/i915/perf: Group engines into respective OA groups drm/i915/perf: Parse 64bit report header formats correctly drm/i915/perf: Handle non-power-of-2 reports drm/i915/perf: Add engine class instance parameters to perf drm/i915/perf: Add support for OA media units
drivers/gpu/drm/i915/gt/intel_engine_types.h | 4 + drivers/gpu/drm/i915/gt/intel_sseu.c | 3 +- drivers/gpu/drm/i915/i915_driver.c | 4 +- drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/i915_pci.c | 1 + drivers/gpu/drm/i915/i915_perf.c | 632 +++++++++++++++---- drivers/gpu/drm/i915/i915_perf.h | 2 +- drivers/gpu/drm/i915/i915_perf_oa_regs.h | 78 +++ drivers/gpu/drm/i915/i915_perf_types.h | 103 ++- drivers/gpu/drm/i915/intel_device_info.h | 1 + include/uapi/drm/i915_drm.h | 24 + 11 files changed, 735 insertions(+), 119 deletions(-)
Signature · 1 line
2.36.1
PATCH 1/9 drm/i915/perf: Drop wakeref on GuC RC error
From: Chris Wilson <[email protected]>
If we fail to adjust the GuC run-control on opening the perf stream, make sure we unwind the wakeref just taken.
--- drivers/gpu/drm/i915/i915_perf.c | 18 +++++++++++------- drivers/gpu/drm/i915/i915_perf_types.h | 6 ++++++ 2 files changed, 17 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +11 -7
@@ -1592,9 +1592,7 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream)/* * Wa_16011777198:dg2: Unset the override of GUCRC mode to enable rc6. */ -if (intel_uc_uses_guc_rc (>->uc) && - (IS_DG2_GRAPHICS_STEP (gt->i915,G10 ,STEP_A0 ,STEP_C0 ) || -IS_DG2_GRAPHICS_STEP (gt->i915,G11 ,STEP_A0 ,STEP_B0 ))) +if (stream->override_gucrc)drm_WARN_ON (>->i915->drm,intel_guc_slpc_unset_gucrc_mode (>->uc.guc.slpc));
@@ -3305,13 +3303,15 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,if (ret) {drm_dbg (&stream->perf->i915->drm,"Unable to override gucrc mode\n" ); - goto err_config; + goto err_fw; } + + stream->override_gucrc = true; } ret =alloc_oa_buffer (stream);if (ret) - goto err_oa_buf_alloc; + goto err_gucrc; stream->ops = &i915_oa_stream_ops;
@@ -3344,12 +3344,16 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,free_oa_buffer (stream); -err_oa_buf_alloc: -free_oa_configs (stream); +err_gucrc: +if (stream->override_gucrc) +intel_guc_slpc_unset_gucrc_mode (>->uc.guc.slpc); +err_fw:intel_uncore_forcewake_put (stream->uncore,FORCEWAKE_ALL );intel_engine_pm_put (stream->engine); +free_oa_configs (stream); + err_config:free_noa_wait (stream);
drivers/gpu/drm/i915/i915_perf_types.h +6 -0
@@ -316,6 +316,12 @@ struct i915_perf_stream {* buffer should be checked for available data. */ u64 poll_oa_period; + +/** +* @override_gucrc: GuC RC has been overridden for the perf stream, +* and we need to restore the default configuration on release. +*/ + bool override_gucrc:1; };/**
Signature · 1 line
2.36.1
Re: [Intel-gfx] [PATCH 1/9] drm/i915/perf: Drop wakeref on GuC RC error
Quoted 42 lines · Umesh Nerlige Ramappa
drivers/gpu/drm/i915/i915_perf.c +7
-7@@ -1592,9 +1592,7 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream)/* * Wa_16011777198:dg2: Unset the override of GUCRC mode to enable rc6. */ -if (intel_uc_uses_guc_rc (>->uc) && - (IS_DG2_GRAPHICS_STEP (gt->i915,G10 ,STEP_A0 ,STEP_C0 ) || -IS_DG2_GRAPHICS_STEP (gt->i915,G11 ,STEP_A0 ,STEP_B0 ))) +if (stream->override_gucrc)drm_WARN_ON (>->i915->drm,intel_guc_slpc_unset_gucrc_mode (>->uc.guc.slpc));@@ -3305,13 +3303,15 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,if (ret) {drm_dbg (&stream->perf->i915->drm,"Unable to override gucrc mode\n" ); - goto err_config; + goto err_fw; } + + stream->override_gucrc = true; } ret =alloc_oa_buffer (stream);if (ret) - goto err_oa_buf_alloc; + goto err_gucrc; stream->ops = &i915_oa_stream_ops;@@ -3344,12 +3344,16 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,free_oa_buffer (stream); -err_oa_buf_alloc: -free_oa_configs (stream); +err_gucrc: +if (stream->override_gucrc)
drivers/gpu/drm/i915/i915_perf.c static int i915_oa_stream_init(struct i915_perf_stream *stream, · line 3358
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +4
-0+intel_guc_slpc_unset_gucrc_mode (>->uc.guc.slpc); +err_fw:intel_uncore_forcewake_put (stream->uncore,FORCEWAKE_ALL );intel_engine_pm_put (stream->engine); +free_oa_configs (stream); + err_config:free_noa_wait (stream);
[nice-to-have] The previous naming scheme for labels in the function is the place from which the goto is issued so err_fw should be named err_gucrc and err_gucrc should be called the preevious name err_oa_buf_alloc but otherwise the code seems correct so this is:
PATCH 2/9 drm/i915/perf: Add helper to check supported OA engines
In reply to Umesh Nerlige RamappaAdd helper to check for supported OA engines.
--- drivers/gpu/drm/i915/i915_perf.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +16 -3
@@ -1570,6 +1570,19 @@ free_noa_wait(struct i915_perf_stream *stream)i915_vma_unpin_and_release (&stream->noa_wait,0 ); } +static bool engine_supports_oa (const struct intel_engine_cs *engine) +{ +enum intel_platform platform =INTEL_INFO (engine->i915)->platform; + +if (intel_engine_is_virtual (engine)) +return false; + +switch (platform) { +default : +return engine->class ==RENDER_CLASS ; + } +} +static void i915_oa_stream_destroy (struct i915_perf_stream *stream) {struct i915_perf *perf = stream->perf;
@@ -2505,7 +2518,7 @@ static int gen8_configure_context(struct i915_gem_context *ctx,for_each_gem_engine (ce,i915_gem_context_lock_engines (ctx), it) {GEM_BUG_ON (ce == ce->engine->kernel_context); -if (ce->engine->class !=RENDER_CLASS ) +if (!engine_supports_oa (ce->engine))continue ;/* Otherwise OA settings will be set upon first use */
@@ -2656,7 +2669,7 @@ oa_configure_all_contexts(struct i915_perf_stream *stream,for_each_uabi_engine (engine, i915) {struct intel_context *ce = engine->kernel_context; -if (engine->class !=RENDER_CLASS ) +if (!engine_supports_oa (ce->engine))continue ; regs[0 ].value =intel_sseu_make_rpcs (engine->gt, &ce->sseu);
@@ -3369,7 +3382,7 @@ void i915_oa_init_reg_state(const struct intel_context *ce, {struct i915_perf_stream *stream; -if (engine->class !=RENDER_CLASS ) +if (!engine_supports_oa (engine))return ;/* perf.exclusive_stream serialised by lrc_configure_all_contexts() */
Signature · 1 line
2.36.1
Re: [Intel-gfx] [PATCH 2/9] drm/i915/perf: Add helper to check supported OA engines
Quoted 13 lines · Umesh Nerlige Ramappa
Add helper to check for supported OA engines.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- drivers/gpu/drm/i915/i915_perf.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_perf.c +0
-0
drivers/gpu/drm/i915/i915_perf.c free_noa_wait(struct i915_perf_stream *stream) · line 1578
Quoted 9 lines
drivers/gpu/drm/i915/i915_perf.c +6
-0@@ -1570,6 +1570,19 @@ free_noa_wait(struct i915_perf_stream *stream)i915_vma_unpin_and_release (&stream->noa_wait,0 ); } +static bool engine_supports_oa (const struct intel_engine_cs *engine) +{ +enum intel_platform platform =INTEL_INFO (engine->i915)->platform; + +if (intel_engine_is_virtual (engine)) +return false;
Let's move this check to a different (or a separate) patch (with explanation about OA and virtual engines in case of separate patch). It is strange to see this check in this patch since previously we have only supported render (I think there is only a single render engine so no virtual render engines are possible, correct?).
With the changes above this is:
Is there anything intrinsically wrong with virtual engines that we cannot get OA data for them? Since we get OA data from an OA unit not engines so wondering why this restriction. So if I have a virtual engine consisting of two VDBOX engines attached to a single OAM unit we cannot get OA data for this virtual engine?
Or is just that we haven't handled such cases? In that case it is fine to disallow virtual engines till we can support them. Sorry just trying to understand the restriction.
Re: [Intel-gfx] [PATCH 2/9] drm/i915/perf: Add helper to check supported OA engines
Quoted 17 lines · Ashutosh
Quoted 16 lines · Umesh Nerlige Ramappa
Add helper to check for supported OA engines.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- drivers/gpu/drm/i915/i915_perf.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_perf.c +0
-0@@ -1570,6 +1570,19 @@ free_noa_wait(struct i915_perf_stream *stream)i915_vma_unpin_and_release (&stream->noa_wait,0 ); }
Quoted 12 lines
drivers/gpu/drm/i915/i915_perf.c free_noa_wait(struct i915_perf_stream *stream) · line 1578
Quoted 6 lines
drivers/gpu/drm/i915/i915_perf.c +6
-0+static bool engine_supports_oa (const struct intel_engine_cs *engine) +{ +enum intel_platform platform =INTEL_INFO (engine->i915)->platform; + +if (intel_engine_is_virtual (engine)) +return false;Let's move this check to a different (or a separate) patch (with explanation about OA and virtual engines in case of separate patch). It is strange to see this check in this patch since previously we have only supported render (I think there is only a single render engine so no virtual render engines are possible, correct?).
will do.
Quoted 11 lines
With the changes above this is:
Reviewed-by Ashutosh Dixit <[email protected]>Is there anything intrinsically wrong with virtual engines that we cannot get OA data for them? Since we get OA data from an OA unit not engines so wondering why this restriction. So if I have a virtual engine consisting of two VDBOX engines attached to a single OAM unit we cannot get OA data for this virtual engine?
Quoted 3 lines
Or is just that we haven't handled such cases? In that case it is fine to disallow virtual engines till we can support them. Sorry just trying to understand the restriction.
iirc, we cannot modify the context image for the virtual engine. Something to do with lrc state for such engines. Also OA supports only a concept of one engine instance passed to it, so a virtual engine does not fit the interface definition.
Thanks,
Umesh
Re: [Intel-gfx] [PATCH 2/9] drm/i915/perf: Add helper to check supported OA engines
Quoted 44 lines · Umesh Nerlige Ramappa
Quoted 17 lines · Ashutosh
Quoted 16 lines · Umesh Nerlige Ramappa
Add helper to check for supported OA engines.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>---
drivers/gpu/drm/i915/i915_perf.c| 19 ++++++++++++++++---1 file changed, 16 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_perf.c +0
-0@@ -1570,6 +1570,19 @@ free_noa_wait(struct i915_perf_stream *stream)i915_vma_unpin_and_release (&stream->noa_wait,0 ); }Quoted 12 lines
drivers/gpu/drm/i915/i915_perf.c free_noa_wait(struct i915_perf_stream *stream) · line 1578
Quoted 6 lines
drivers/gpu/drm/i915/i915_perf.c +6
-0+static bool engine_supports_oa (const struct intel_engine_cs *engine) +{ +enum intel_platform platform =INTEL_INFO (engine->i915)->platform; + +if (intel_engine_is_virtual (engine)) +return false;Let's move this check to a different (or a separate) patch (with explanation about OA and virtual engines in case of separate patch). It is strange to see this check in this patch since previously we have only supported render (I think there is only a single render engine so no virtual render engines are possible, correct?).
will do.
Quoted 11 lines
With the changes above this is:
Reviewed-by Ashutosh Dixit <[email protected]>Is there anything intrinsically wrong with virtual engines that we cannot get OA data for them? Since we get OA data from an OA unit not engines so wondering why this restriction. So if I have a virtual engine consisting of two VDBOX engines attached to a single OAM unit we cannot get OA data for this virtual engine?
Quoted 5 lines
Quoted 3 lines
Or is just that we haven't handled such cases? In that case it is fine to disallow virtual engines till we can support them. Sorry just trying to understand the restriction.
iirc, we cannot modify the context image for the virtual engine. Something to do with lrc state for such engines. Also OA supports only a concept of one engine instance passed to it, so a virtual engine does not fit the interface definition.
Actually, it's not the lrc state, but getting engine_pm wakeref for virtual engine was failing, so we had to use this check, but at this moment the check is not required in OA like you said - there's just one render.
Thanks,
Umesh
Quoted 3 lines
Thanks,
Umesh
PATCH 3/9 drm/i915/perf: Validate OA sseu config outside switch
In reply to Umesh Nerlige RamappaValidate the OA sseu config after all params are parsed.
--- drivers/gpu/drm/i915/i915_perf.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +12 -10
@@ -3956,6 +3956,8 @@ static int read_properties_unlocked(struct i915_perf *perf,u64 __user *uprop = uprops;u32 i;int ret; +bool config_sseu = false; +struct drm_i915_gem_context_param_sseu user_sseu;memset (props,0 ,sizeof (struct perf_open_properties )); props->poll_oa_period =DEFAULT_POLL_PERIOD_NS ;
@@ -4082,8 +4084,6 @@ static int read_properties_unlocked(struct i915_perf *perf, props->hold_preemption = !!value;break ;case DRM_I915_PERF_PROP_GLOBAL_SSEU : { -struct drm_i915_gem_context_param_sseu user_sseu; -if (GRAPHICS_VER_FULL (perf->i915) >=IP_VER (12 ,50 )) { drm_dbg(&perf->i915->drm, "SSEU config not supported on gfx %x\n",
@@ -4098,14 +4098,7 @@ static int read_properties_unlocked(struct i915_perf *perf, "Unable to copy global sseu parameter\n");return -EFAULT ; } - - ret =get_sseu_config (&props->sseu, props->engine, &user_sseu); -if (ret) { -drm_dbg (&perf->i915->drm, -"Invalid SSEU configuration\n" ); -return ret; - } - props->has_sseu = true; + config_sseu = true;break ; }case DRM_I915_PERF_PROP_POLL_OA_PERIOD :
@@ -4125,6 +4118,15 @@ static int read_properties_unlocked(struct i915_perf *perf, uprop +=2 ; } +if (config_sseu) { + ret =get_sseu_config (&props->sseu, props->engine, &user_sseu); +if (ret) { +DRM_DEBUG ("Invalid SSEU configuration\n" ); +return ret; + } + props->has_sseu = true; + } +return 0 ; }
Signature · 1 line
2.36.1
Re: [Intel-gfx] [PATCH 3/9] drm/i915/perf: Validate OA sseu config outside switch
Quoted 2 lines · Umesh Nerlige Ramappa
Validate the OA sseu config after all params are parsed.
Commit messages for all patches need to answer the "why" or the reason for the patch. In this case maybe an overkill but probably something like:
Validate the OA sseu config after all params are parsed since the engine can be passed in as part of perf properties.
Quoted 11 lines
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- drivers/gpu/drm/i915/i915_perf.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)drivers/gpu/drm/i915/i915_perf.c +0
-0
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct i915_perf *perf, · line 3960
Quoted 5 lines
drivers/gpu/drm/i915/i915_perf.c +2
-0@@ -3956,6 +3956,8 @@ static int read_properties_unlocked(struct i915_perf *perf,u64 __user *uprop = uprops;u32 i;int ret; +bool config_sseu = false; +struct drm_i915_gem_context_param_sseu user_sseu;
nit: longer lines above shorter lines
Quoted 29 lines
drivers/gpu/drm/i915/i915_perf.c +1
-10memset (props,0 ,sizeof (struct perf_open_properties )); props->poll_oa_period =DEFAULT_POLL_PERIOD_NS ;@@ -4082,8 +4084,6 @@ static int read_properties_unlocked(struct i915_perf *perf, props->hold_preemption = !!value;break ;case DRM_I915_PERF_PROP_GLOBAL_SSEU : { -struct drm_i915_gem_context_param_sseu user_sseu; -if (GRAPHICS_VER_FULL (perf->i915) >=IP_VER (12 ,50 )) { drm_dbg(&perf->i915->drm, "SSEU config not supported on gfx %x\n",@@ -4098,14 +4098,7 @@ static int read_properties_unlocked(struct i915_perf *perf, "Unable to copy global sseu parameter\n");return -EFAULT ; } - - ret =get_sseu_config (&props->sseu, props->engine, &user_sseu); -if (ret) { -drm_dbg (&perf->i915->drm, -"Invalid SSEU configuration\n" ); -return ret; - } - props->has_sseu = true; + config_sseu = true;break ; }case DRM_I915_PERF_PROP_POLL_OA_PERIOD :
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct i915_perf *perf, · line 4124
Quoted 7 lines
drivers/gpu/drm/i915/i915_perf.c +4
-0@@ -4125,6 +4118,15 @@ static int read_properties_unlocked(struct i915_perf *perf, uprop +=2 ; } +if (config_sseu) { + ret =get_sseu_config (&props->sseu, props->engine, &user_sseu); +if (ret) { +DRM_DEBUG ("Invalid SSEU configuration\n" );
drm_dbg? DRM_DEBUG is deprecated?
drivers/gpu/drm/i915/i915_perf.c static int read_properties_unlocked(struct i915_perf *perf, · line 4131
Quoted 7 lines
drivers/gpu/drm/i915/i915_perf.c +5
-0+return ret; + } + props->has_sseu = true; + } +return 0 ; }
After addressing the above comments:
Re: [Intel-gfx] [PATCH 3/9] drm/i915/perf: Validate OA sseu config outside switch
Quoted 10 lines · Ashutosh
Quoted 2 lines · Umesh Nerlige Ramappa
Validate the OA sseu config after all params are parsed.
Commit messages for all patches need to answer the "why" or the reason for the patch. In this case maybe an overkill but probably something like:
Validate the OA sseu config after all params are parsed since the engine can be passed in as part of perf properties.
Also, if we do this the patch should probably be later in the series after the patch which introduces engine class/instance in the perf properties.
Re: [Intel-gfx] [PATCH 3/9] drm/i915/perf: Validate OA sseu config outside switch
Quoted 7 lines · Ashutosh
Quoted 5 lines · Ashutosh
Quoted 2 lines · Umesh Nerlige Ramappa
Validate the OA sseu config after all params are parsed.
Quoted 8 lines
Quoted 5 lines
Commit messages for all patches need to answer the "why" or the reason for the patch. In this case maybe an overkill but probably something like:
Validate the OA sseu config after all params are parsed since the engine can be passed in as part of perf properties.
Also, if we do this the patch should probably be later in the series after the patch which introduces engine class/instance in the perf properties.
General guidelines for submitting a patch series for review (for the future):
1. The commit message should explain "why" or reason for a patch
2. As far as possible patches should be in a logical order so the series should "tell a story"
3. The patches should be small (each patch being a single logical change if possible)
So after we've done the hard part of figuring out the code and getting it to work, the above guidelines also make the review process easier.
Thanks.
--
Ashutosh
Re: [Intel-gfx] [PATCH 3/9] drm/i915/perf: Validate OA sseu config outside switch
Quoted 20 lines · Ashutosh
Quoted 7 lines · Ashutosh
Quoted 5 lines · Ashutosh
Quoted 2 lines · Umesh Nerlige Ramappa
Validate the OA sseu config after all params are parsed.
Quoted 8 lines
Quoted 5 lines
Commit messages for all patches need to answer the "why" or the reason for the patch. In this case maybe an overkill but probably something like:
Validate the OA sseu config after all params are parsed since the engine can be passed in as part of perf properties.
Also, if we do this the patch should probably be later in the series after the patch which introduces engine class/instance in the perf properties.
General guidelines for submitting a patch series for review (for the future):
Quoted 8 lines
1. The commit message should explain "why" or reason for a patch
2. As far as possible patches should be in a logical order so the series should "tell a story"
3. The patches should be small (each patch being a single logical change if possible)So after we've done the hard part of figuring out the code and getting it to work, the above guidelines also make the review process easier.
will do and post a new revision.
Thanks,
Umesh
Quoted 4 lines
Thanks.
--
Ashutosh
Re: [Intel-gfx] [PATCH 3/9] drm/i915/perf: Validate OA sseu config outside switch
In reply to Dixit, AshutoshQuoted 6 lines · Ashutosh
Quoted 5 lines · Ashutosh
Quoted 2 lines · Umesh Nerlige Ramappa
Validate the OA sseu config after all params are parsed.
Quoted 8 lines
Quoted 5 lines
Commit messages for all patches need to answer the "why" or the reason for the patch. In this case maybe an overkill but probably something like:
Validate the OA sseu config after all params are parsed since the engine can be passed in as part of perf properties.
Also, if we do this the patch should probably be later in the series after the patch which introduces engine class/instance in the perf properties.
Reg: order of this patch,
I am thinking it still makes sense to have it here (before the
class:instance patch). It's more like a refactor before enabling the feature so that once the feature is enabled, there are no corner cases. Thoughts?
I would just add the same description in the commit message.
Thanks,
Umesh
PATCH 4/9 drm/i915/perf: Fail modprobe if i915_perf_init fails
In reply to Umesh Nerlige RamappaCheck for return value from i915_perf_init and fail driver init if perf init fails.
--- drivers/gpu/drm/i915/i915_driver.c | 4 +++- drivers/gpu/drm/i915/i915_perf.c | 4 +++- drivers/gpu/drm/i915/i915_perf.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +3 -1
@@ -477,7 +477,9 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)if (ret)return ret; -i915_perf_init (dev_priv); + ret =i915_perf_init (dev_priv); +if (ret) +return ret; ret =i915_ggtt_probe_hw (dev_priv);if (ret)
drivers/gpu/drm/i915/i915_perf.c +3 -1
@@ -4845,7 +4845,7 @@ static void i915_perf_init_info(struct drm_i915_private *i915)* Note: i915-perf initialization is split into an 'init' and 'register' * phase with the i915_perf_register() exposing state to userspace. */ -void i915_perf_init (struct drm_i915_private *i915) +int i915_perf_init (struct drm_i915_private *i915) {struct i915_perf *perf = &i915->perf;
@@ -4962,6 +4962,8 @@ void i915_perf_init(struct drm_i915_private *i915)oa_init_supported_formats (perf); } + +return 0 ; }static int destroy_config (int id,void *p,void *data)
drivers/gpu/drm/i915/i915_perf.h +1 -1
@@ -18,7 +18,7 @@ struct i915_oa_config;struct intel_context ;struct intel_engine_cs ; -void i915_perf_init (struct drm_i915_private *i915); +int i915_perf_init (struct drm_i915_private *i915);void i915_perf_fini (struct drm_i915_private *i915);void i915_perf_register (struct drm_i915_private *i915);void i915_perf_unregister (struct drm_i915_private *i915);
Signature · 1 line
2.36.1
Re: [Intel-gfx] [PATCH 4/9] drm/i915/perf: Fail modprobe if i915_perf_init fails
Quoted 3 lines · Umesh Nerlige Ramappa
Check for return value from
i915_perf_initand fail driver init if perf init fails.
Guess we'll start returning anything other than zero later:
Quoted 61 lines
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- drivers/gpu/drm/i915/i915_driver.c | 4 +++- drivers/gpu/drm/i915/i915_perf.c | 4 +++- drivers/gpu/drm/i915/i915_perf.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_driver.c +3
-1@@ -477,7 +477,9 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)if (ret)return ret; -i915_perf_init (dev_priv); + ret =i915_perf_init (dev_priv); +if (ret) +return ret; ret =i915_ggtt_probe_hw (dev_priv);if (ret)drivers/gpu/drm/i915/i915_perf.c +3
-1@@ -4845,7 +4845,7 @@ static void i915_perf_init_info(struct drm_i915_private *i915)* Note: i915-perf initialization is split into an 'init' and 'register' * phase with the i915_perf_register() exposing state to userspace. */ -void i915_perf_init (struct drm_i915_private *i915) +int i915_perf_init (struct drm_i915_private *i915) {struct i915_perf *perf = &i915->perf;@@ -4962,6 +4962,8 @@ void i915_perf_init(struct drm_i915_private *i915)oa_init_supported_formats (perf); } + +return 0 ; }static int destroy_config (int id,void *p,void *data)drivers/gpu/drm/i915/i915_perf.h +1
-2@@ -18,7 +18,7 @@ struct i915_oa_config;struct intel_context ;struct intel_engine_cs ; -void i915_perf_init (struct drm_i915_private *i915); +int i915_perf_init (struct drm_i915_private *i915);void i915_perf_fini (struct drm_i915_private *i915);void i915_perf_register (struct drm_i915_private *i915);void i915_perf_unregister (struct drm_i915_private *i915); --2.36.1
Jani Nikula
maintainerRe: [Intel-gfx] [PATCH 4/9] drm/i915/perf: Fail modprobe if i915_perf_init fails
Quoted 6 lines · Ashutosh
Quoted 3 lines · Umesh Nerlige Ramappa
Check for return value from
i915_perf_initand fail driver init if perf init fails.Guess we'll start returning anything other than zero later:
And before doing so, this change is useless, and IMO should not be merged. If it can't or doesn't fail, it should be void. The probe is complicated enough as is, let's not complicate it unless there's a reason for it.
Moreover, we'll probably want to consider what parts of the driver probe are allowed to fail, and the driver can still function. I'm pretty sure most people prefer a working screen without OA over failing probe.
BR,
Jani.
Quoted 64 lines
Reviewed-by Ashutosh Dixit <[email protected]>Quoted 61 lines
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- drivers/gpu/drm/i915/i915_driver.c | 4 +++- drivers/gpu/drm/i915/i915_perf.c | 4 +++- drivers/gpu/drm/i915/i915_perf.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_driver.c +3
-1@@ -477,7 +477,9 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)if (ret)return ret; -i915_perf_init (dev_priv); + ret =i915_perf_init (dev_priv); +if (ret) +return ret; ret =i915_ggtt_probe_hw (dev_priv);if (ret)drivers/gpu/drm/i915/i915_perf.c +3
-1@@ -4845,7 +4845,7 @@ static void i915_perf_init_info(struct drm_i915_private *i915)* Note: i915-perf initialization is split into an 'init' and 'register' * phase with the i915_perf_register() exposing state to userspace. */ -void i915_perf_init (struct drm_i915_private *i915) +int i915_perf_init (struct drm_i915_private *i915) {struct i915_perf *perf = &i915->perf;@@ -4962,6 +4962,8 @@ void i915_perf_init(struct drm_i915_private *i915)oa_init_supported_formats (perf); } + +return 0 ; }static int destroy_config (int id,void *p,void *data)drivers/gpu/drm/i915/i915_perf.h +1
-2@@ -18,7 +18,7 @@ struct i915_oa_config;struct intel_context ;struct intel_engine_cs ; -void i915_perf_init (struct drm_i915_private *i915); +int i915_perf_init (struct drm_i915_private *i915);void i915_perf_fini (struct drm_i915_private *i915);void i915_perf_register (struct drm_i915_private *i915);void i915_perf_unregister (struct drm_i915_private *i915); --2.36.1
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
PATCH 5/9 drm/i915/perf: Group engines into respective OA groups
In reply to Umesh Nerlige RamappaNow that we may have multiple OA units in a single GT as well as on separate GTs, create an engine group that maps to a single OA unit.
--- drivers/gpu/drm/i915/gt/intel_engine_types.h | 4 + drivers/gpu/drm/i915/gt/intel_sseu.c | 3 +- drivers/gpu/drm/i915/i915_perf.c | 126 +++++++++++++++++-- drivers/gpu/drm/i915/i915_perf_types.h | 51 +++++++- 4 files changed, 171 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_types.h +4 -0
@@ -53,6 +53,8 @@ struct intel_gt;struct intel_ring ;struct intel_uncore ;struct intel_breadcrumbs ; +struct intel_engine_cs ; +struct i915_perf_group ;typedef u32 intel_engine_mask_t ;#define ALL_ENGINES ((intel_engine_mask_t)~0ul)
@@ -603,6 +605,8 @@ struct intel_engine_cs { } props, defaults; I915_SELFTEST_DECLARE(struct fault_attr reset_timeout); + +struct i915_perf_group *oa_group; }; static inline bool
drivers/gpu/drm/i915/gt/intel_sseu.c +2 -1
@@ -6,6 +6,7 @@#include <linux/string_helpers.h> #include "i915_drv.h" +#include "i915_perf_types.h" #include "intel_engine_regs.h" #include "intel_gt_regs.h" #include "intel_sseu.h"
@@ -677,7 +678,7 @@ u32 intel_sseu_make_rpcs(struct intel_gt *gt,* If i915/perf is active, we want a stable powergating configuration * on the system. Use the configuration pinned by i915/perf. */ -if (gt->perf.exclusive_stream) +if (gt->perf.group && gt->perf.group[PERF_GROUP_OAG ].exclusive_stream) req_sseu = >->perf.sseu; slices =hweight8 (req_sseu->slice_mask);
drivers/gpu/drm/i915/i915_perf.c +118 -8
207 lines not on this page · raw message
drivers/gpu/drm/i915/i915_perf_types.h +47 -4
83 lines not on this page · raw message
Signature · 1 line
2.36.1
Jani Nikula
maintainerRe: [Intel-gfx] [PATCH 5/9] drm/i915/perf: Group engines into respective OA groups
Quoted 189 lines · Umesh Nerlige Ramappa
Now that we may have multiple OA units in a single GT as well as on separate GTs, create an engine group that maps to a single OA unit.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- drivers/gpu/drm/i915/gt/intel_engine_types.h | 4 + drivers/gpu/drm/i915/gt/intel_sseu.c | 3 +- drivers/gpu/drm/i915/i915_perf.c | 126 +++++++++++++++++-- drivers/gpu/drm/i915/i915_perf_types.h | 51 +++++++- 4 files changed, 171 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/gt/intel_engine_types.h +4
-0@@ -53,6 +53,8 @@ struct intel_gt;struct intel_ring ;struct intel_uncore ;struct intel_breadcrumbs ; +struct intel_engine_cs ; +struct i915_perf_group ;typedef u32 intel_engine_mask_t ;#define ALL_ENGINES ((intel_engine_mask_t)~0ul)@@ -603,6 +605,8 @@ struct intel_engine_cs { } props, defaults; I915_SELFTEST_DECLARE(struct fault_attr reset_timeout); + +struct i915_perf_group *oa_group; }; static inline booldrivers/gpu/drm/i915/gt/intel_sseu.c +2
-1@@ -6,6 +6,7 @@#include <linux/string_helpers.h> #include "i915_drv.h" +#include "i915_perf_types.h" #include "intel_engine_regs.h" #include "intel_gt_regs.h" #include "intel_sseu.h" @@ -677,7 +678,7 @@ u32 intel_sseu_make_rpcs(struct intel_gt *gt,* If i915/perf is active, we want a stable powergating configuration * on the system. Use the configuration pinned by i915/perf. */ -if (gt->perf.exclusive_stream) +if (gt->perf.group && gt->perf.group[PERF_GROUP_OAG ].exclusive_stream) req_sseu = >->perf.sseu; slices =hweight8 (req_sseu->slice_mask);drivers/gpu/drm/i915/i915_perf.c +59
-7@@ -1587,8 +1587,9 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream) {struct i915_perf *perf = stream->perf;struct intel_gt *gt = stream->engine->gt; +struct i915_perf_group *g = stream->engine->oa_group; -if (WARN_ON (stream != gt->perf.exclusive_stream)) +if (WARN_ON (stream != g->exclusive_stream))return ;/* @@ -1597,7 +1598,7 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream)* * See i915_oa_init_reg_state() and lrc_configure_all_contexts() */ -WRITE_ONCE (gt->perf.exclusive_stream,NULL ); +WRITE_ONCE (g->exclusive_stream,NULL ); perf->ops.disable_metric_set (stream);free_oa_buffer (stream);@@ -3195,6 +3196,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, {struct drm_i915_private *i915 = stream->perf->i915;struct i915_perf *perf = stream->perf; +struct i915_perf_group *g;struct intel_gt *gt;int ret;@@ -3205,6 +3207,12 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, } gt = props->engine->gt; + g = props->engine->oa_group; +if (!g) { +DRM_DEBUG ("Perf group invalid\n" ); +return -EINVAL ; + } +/* * If the sysfs metrics/ directory wasn't registered for some * reason then don't let userspace try their luck with config @@ -3234,7 +3242,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,* counter reports and marshal to the appropriate client * we currently only allow exclusive access */ -if (gt->perf.exclusive_stream) { +if (g->exclusive_stream) {drm_dbg (&stream->perf->i915->drm,"OA unit already in use\n" );return -EBUSY ;@@ -3329,7 +3337,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, stream->ops = &i915_oa_stream_ops; stream->engine->gt->perf.sseu = props->sseu; -WRITE_ONCE (gt->perf.exclusive_stream, stream); +WRITE_ONCE (g->exclusive_stream, stream); ret =i915_perf_stream_enable_sync (stream);if (ret) {@@ -3352,7 +3360,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,return 0 ; err_enable: -WRITE_ONCE (gt->perf.exclusive_stream,NULL ); +WRITE_ONCE (g->exclusive_stream,NULL ); perf->ops.disable_metric_set (stream);free_oa_buffer (stream);@@ -3381,12 +3389,13 @@ void i915_oa_init_reg_state(const struct intel_context *ce, const struct intel_engine_cs *engine) {struct i915_perf_stream *stream; +struct i915_perf_group *g = engine->oa_group; -if (!engine_supports_oa (engine)) +if (!g)return ;/* perf.exclusive_stream serialised by lrc_configure_all_contexts() */ - stream =READ_ONCE (engine->gt->perf.exclusive_stream); + stream =READ_ONCE (g->exclusive_stream);if (stream &&GRAPHICS_VER (stream->perf->i915) <12 )gen8_update_reg_state_unlocked (ce, stream); }@@ -4755,6 +4764,95 @@ static struct ctl_table oa_table[] = { {} }; +static u32 __num_perf_groups_per_gt (struct intel_gt *gt) +{ +enum intel_platform platform =INTEL_INFO (gt->i915)->platform; + +switch (platform) { +default : +return 1 ; + } +} + +static u32 __oa_engine_group (struct intel_engine_cs *engine) +{ +if (!engine_supports_oa (engine)) +return PERF_GROUP_INVALID ; + +switch (engine->class) { +case RENDER_CLASS : +return PERF_GROUP_OAG ; + +default : +return PERF_GROUP_INVALID ; + } +} + +static void oa_init_groups (struct intel_gt *gt) +{ +int i, num_groups = gt->perf.num_perf_groups; +struct i915_perf *perf = >->i915->perf; + +for (i =0 ; i < num_groups; i++) { +struct i915_perf_group *g = >->perf.group[i]; + +/* Fused off engines can result in a group with num_engines == 0 */ +if (g->num_engines ==0 ) +continue ; + +/* Set oa_unit_ids now to ensure ids remain contiguous. */ + g->oa_unit_id = perf->oa_unit_ids++; + + g->gt = gt; + } +} +
drivers/gpu/drm/i915/i915_perf.c static struct ctl_table oa_table[] = { · line 4819
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+static int oa_init_gt (struct intel_gt *gt) +{ +u32 num_groups =__num_perf_groups_per_gt (gt); +struct intel_engine_cs *engine; +struct i915_perf_group *g; +intel_engine_mask_t tmp; + + g =kcalloc (num_groups,sizeof (*g),GFP_KERNEL ); +if (drm_WARN_ON (>->i915->drm, !g)) +return -ENOMEM ;
No warnings or messages on -ENOMEM is standard policy.
Quoted 21 lines
drivers/gpu/drm/i915/i915_perf.c +21
-0+ +for_each_engine_masked (engine, gt,ALL_ENGINES , tmp) { +u32 index; + + index =__oa_engine_group (engine); +if (index < num_groups) { + g[index].engine_mask |=BIT (engine->id); + g[index].num_engines++; + engine->oa_group = &g[index]; + }else { + engine->oa_group =NULL ; + } + } + + gt->perf.num_perf_groups = num_groups; + gt->perf.group = g; + +oa_init_groups (gt); + +return 0 ; +}
drivers/gpu/drm/i915/i915_perf.c static struct ctl_table oa_table[] = { · line 4850
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+ +static int oa_init_engine_groups (struct i915_perf *perf) +{ +struct intel_gt *gt; +int i, ret; + +for_each_gt (gt, perf->i915, i) { + ret =oa_init_gt (gt); +if (ret) +return ret;
If this fails in the middle, you'll leave things in half-initialized state when returning, and expect the caller to clean it up. But that's a surprising interface design. If i915_perf_init() returns an error, it's *not* customary to have to call the corresponding cleanup function. On the contrary, you only call it on success. Any init failures need to be cleaned up internally before returning.
Quoted 139 lines
drivers/gpu/drm/i915/i915_perf.c +18
-1+ } + +return 0 ; +} +static void oa_init_supported_formats (struct i915_perf *perf) {struct drm_i915_private *i915 = perf->i915;@@ -4921,7 +5019,7 @@ int i915_perf_init(struct drm_i915_private *i915)if (perf->ops.enable_metric_set) {struct intel_gt *gt; -int i; +int i, ret;for_each_gt (gt, i915, i)mutex_init (>->perf.lock);@@ -4960,6 +5058,13 @@ int i915_perf_init(struct drm_i915_private *i915) perf->i915 = i915; + ret =oa_init_engine_groups (perf); +if (ret) { +drm_err (&i915->drm, +"OA initialization failed %d\n" , ret); +return ret; + } +oa_init_supported_formats (perf); }@@ -4990,10 +5095,15 @@ void i915_perf_sysctl_unregister(void)void i915_perf_fini (struct drm_i915_private *i915) {struct i915_perf *perf = &i915->perf; +struct intel_gt *gt; +int i;if (!perf->i915)return ; +for_each_gt (gt, perf->i915, i) +kfree (gt->perf.group); +idr_for_each (&perf->metrics_idr, destroy_config, perf);idr_destroy (&perf->metrics_idr);drivers/gpu/drm/i915/i915_perf_types.h +47
-4@@ -17,6 +17,7 @@#include <linux/wait.h> #include <uapi/drm/i915_drm.h> +#include "gt/intel_engine_types.h" #include "gt/intel_sseu.h" #include "i915_reg_defs.h" #include "intel_wakeref.h" @@ -30,6 +31,13 @@ struct i915_vma;struct intel_context ;struct intel_engine_cs ; +enum { +PERF_GROUP_OAG =0 , + +PERF_GROUP_MAX , +PERF_GROUP_INVALID =U32_MAX , +}; +struct i915_oa_format {u32 format;int size;@@ -390,6 +398,35 @@ struct i915_oa_ops {u32 (*oa_hw_tail_read)(struct i915_perf_stream *stream); }; +struct i915_perf_group { +/* +* @type: Identifier for the OA unit. +*/ +u32 oa_unit_id; + +/* +* @gt: gt that this group belongs to +*/ +struct intel_gt *gt; + +/* +* @exclusive_stream: The stream currently using the OA unit. This is +* sometimes accessed outside a syscall associated to its file +* descriptor. +*/ +struct i915_perf_stream *exclusive_stream; + +/* +* @num_engines: The number of engines using this OA buffer. +*/ +u32 num_engines; + +/* +* @engine_mask: A mask of engines using a single OA buffer. +*/ +intel_engine_mask_t engine_mask; +}; +struct i915_perf_gt {/* * Lock associated with anything below within this structure. @@ -402,12 +439,15 @@ struct i915_perf_gt {*/ struct intel_sseu sseu; +/** +* @num_perf_groups: number of perf groups per gt. +*/ +u32 num_perf_groups; +/* -* @exclusive_stream: The stream currently using the OA unit. This is -* sometimes accessed outside a syscall associated to its file -* descriptor. +* @group: list of OA groups - one for each OA buffer. */ -struct i915_perf_stream *exclusive_stream; +struct i915_perf_group *group; };struct i915_perf {@@ -461,6 +501,9 @@ struct i915_perf {unsigned long format_mask[FORMAT_MASK_SIZE ];atomic64_t noa_programming_delay; + +/* oa unit ids */ + u32 oa_unit_ids; };#endif /* _I915_PERF_TYPES_H_ */
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [Intel-gfx] [PATCH 5/9] drm/i915/perf: Group engines into respective OA groups
Quoted 13 lines · Jani Nikula
drivers/gpu/drm/i915/i915_perf.c static struct ctl_table oa_table[] = { · line 4819
Quoted 11 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+static int oa_init_gt (struct intel_gt *gt) +{ +u32 num_groups =__num_perf_groups_per_gt (gt); +struct intel_engine_cs *engine; +struct i915_perf_group *g; +intel_engine_mask_t tmp; + + g =kcalloc (num_groups,sizeof (*g),GFP_KERNEL ); +if (drm_WARN_ON (>->i915->drm, !g)) +return -ENOMEM ;No warnings or messages on
-ENOMEMis standard policy.
Hmm I think this is the only error for which this code is failing the probe. So if we are not going to fail the probe, we should at least allow a WARN_ON? Exception proves the rule?
Jani Nikula
maintainerRe: [Intel-gfx] [PATCH 5/9] drm/i915/perf: Group engines into respective OA groups
Quoted 15 lines · Ashutosh
Quoted 13 lines · Jani Nikula
drivers/gpu/drm/i915/i915_perf.c static struct ctl_table oa_table[] = { · line 4819
Quoted 11 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+static int oa_init_gt (struct intel_gt *gt) +{ +u32 num_groups =__num_perf_groups_per_gt (gt); +struct intel_engine_cs *engine; +struct i915_perf_group *g; +intel_engine_mask_t tmp; + + g =kcalloc (num_groups,sizeof (*g),GFP_KERNEL ); +if (drm_WARN_ON (>->i915->drm, !g)) +return -ENOMEM ;No warnings or messages on
-ENOMEMis standard policy.
Quoted 3 lines
Hmm I think this is the only error for which this code is failing the probe. So if we are not going to fail the probe, we should at least allow a
WARN_ON? Exception proves the rule?
A whole lot of other things are going to go bonkers on -ENOMEM, and getting that warn isn't going to help anyone...
Maybe we do need to fail probe on this after all, but it just seemed pointless at the time it was introduced a few patches earlier.
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [Intel-gfx] [PATCH 5/9] drm/i915/perf: Group engines into respective OA groups
Quoted 16 lines · Jani Nikula
Quoted 15 lines · Ashutosh
Quoted 13 lines · Jani Nikula
drivers/gpu/drm/i915/i915_perf.c static struct ctl_table oa_table[] = { · line 4819
Quoted 11 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+static int oa_init_gt (struct intel_gt *gt) +{ +u32 num_groups =__num_perf_groups_per_gt (gt); +struct intel_engine_cs *engine; +struct i915_perf_group *g; +intel_engine_mask_t tmp; + + g =kcalloc (num_groups,sizeof (*g),GFP_KERNEL ); +if (drm_WARN_ON (>->i915->drm, !g)) +return -ENOMEM ;No warnings or messages on
-ENOMEMis standard policy.
Quoted 6 lines
Quoted 3 lines
Hmm I think this is the only error for which this code is failing the probe. So if we are not going to fail the probe, we should at least allow a
WARN_ON? Exception proves the rule?A whole lot of other things are going to go bonkers on
-ENOMEM, and getting that warn isn't going to help anyone...
Should I just add a debug message here instead of warn_ON?
Quoted 3 lines
Maybe we do need to fail probe on this after all, but it just seemed pointless at the time it was introduced a few patches earlier.
Sorry about that, I will fix the order of patches.
Umesh
Quoted 6 lines
BR,
Jani.Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [Intel-gfx] [PATCH 5/9] drm/i915/perf: Group engines into respective OA groups
Quoted 17 lines · Umesh Nerlige Ramappa
Quoted 16 lines · Jani Nikula
Quoted 15 lines · Ashutosh
Quoted 13 lines · Jani Nikula
drivers/gpu/drm/i915/i915_perf.c static struct ctl_table oa_table[] = { · line 4819
Quoted 11 lines
drivers/gpu/drm/i915/i915_perf.c +10
-0+static int oa_init_gt (struct intel_gt *gt) +{ +u32 num_groups =__num_perf_groups_per_gt (gt); +struct intel_engine_cs *engine; +struct i915_perf_group *g; +intel_engine_mask_t tmp; + + g =kcalloc (num_groups,sizeof (*g),GFP_KERNEL ); +if (drm_WARN_ON (>->i915->drm, !g)) +return -ENOMEM ;No warnings or messages on
-ENOMEMis standard policy.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Hmm I think this is the only error for which this code is failing the probe. So if we are not going to fail the probe, we should at least allow a
WARN_ON? Exception proves the rule?A whole lot of other things are going to go bonkers on
-ENOMEM, and getting that warn isn't going to help anyone...Should I just add a debug message here instead of
warn_ON?
nvm, you already mentioned no warn/message on ENOMEM.
Regards,
Umesh
Quoted 14 lines
Quoted 4 lines
Maybe we do need to fail probe on this after all, but it just seemed pointless at the time it was introduced a few patches earlier.
Sorry about that, I will fix the order of patches.
Umesh
Quoted 6 lines
BR,
Jani.Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [Intel-gfx] [PATCH 5/9] drm/i915/perf: Group engines into respective OA groups
In reply to Jani NikulaQuoted 194 lines · Jani Nikula
Quoted 193 lines · Umesh Nerlige Ramappa
Now that we may have multiple OA units in a single GT as well as on separate GTs, create an engine group that maps to a single OA unit.
Signed-off-by Umesh Nerlige Ramappa <[email protected]>--- drivers/gpu/drm/i915/gt/intel_engine_types.h | 4 + drivers/gpu/drm/i915/gt/intel_sseu.c | 3 +- drivers/gpu/drm/i915/i915_perf.c | 126 +++++++++++++++++-- drivers/gpu/drm/i915/i915_perf_types.h | 51 +++++++- 4 files changed, 171 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/gt/intel_engine_types.h +4
-0@@ -53,6 +53,8 @@ struct intel_gt;struct intel_ring ;struct intel_uncore ;struct intel_breadcrumbs ; +struct intel_engine_cs ; +struct i915_perf_group ;typedef u32 intel_engine_mask_t ;#define ALL_ENGINES ((intel_engine_mask_t)~0ul)@@ -603,6 +605,8 @@ struct intel_engine_cs { } props, defaults; I915_SELFTEST_DECLARE(struct fault_attr reset_timeout); + +struct i915_perf_group *oa_group; }; static inline booldrivers/gpu/drm/i915/gt/intel_sseu.c +2
-1@@ -6,6 +6,7 @@#include <linux/string_helpers.h> #include "i915_drv.h" +#include "i915_perf_types.h" #include "intel_engine_regs.h" #include "intel_gt_regs.h" #include "intel_sseu.h" @@ -677,7 +678,7 @@ u32 intel_sseu_make_rpcs(struct intel_gt *gt,* If i915/perf is active, we want a stable powergating configuration * on the system. Use the configuration pinned by i915/perf. */ -if (gt->perf.exclusive_stream) +if (gt->perf.group && gt->perf.group[PERF_GROUP_OAG ].exclusive_stream) req_sseu = >->perf.sseu; slices =hweight8 (req_sseu->slice_mask);drivers/gpu/drm/i915/i915_perf.c +63
-7@@ -1587,8 +1587,9 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream) {struct i915_perf *perf = stream->perf;struct intel_gt *gt = stream->engine->gt; +struct i915_perf_group *g = stream->engine->oa_group; -if (WARN_ON (stream != gt->perf.exclusive_stream)) +if (WARN_ON (stream != g->exclusive_stream))return ;/* @@ -1597,7 +1598,7 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream)* * See i915_oa_init_reg_state() and lrc_configure_all_contexts() */ -WRITE_ONCE (gt->perf.exclusive_stream,NULL ); +WRITE_ONCE (g->exclusive_stream,NULL ); perf->ops.disable_metric_set (stream);free_oa_buffer (stream);@@ -3195,6 +3196,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, {struct drm_i915_private *i915 = stream->perf->i915;struct i915_perf *perf = stream->perf; +struct i915_perf_group *g;struct intel_gt *gt;int ret;@@ -3205,6 +3207,12 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, } gt = props->engine->gt; + g = props->engine->oa_group; +if (!g) { +DRM_DEBUG ("Perf group invalid\n" ); +return -EINVAL ; + } +/* * If the sysfs metrics/ directory wasn't registered for some * reason then don't let userspace try their luck with config @@ -3234,7 +3242,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,* counter reports and marshal to the appropriate client * we currently only allow exclusive access */ -if (gt->perf.exclusive_stream) { +if (g->exclusive_stream) {drm_dbg (&stream->perf->i915->drm,"OA unit already in use\n" );return -EBUSY ;@@ -3329,7 +3337,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, stream->ops = &i915_oa_stream_ops; stream->engine->gt->perf.sseu = props->sseu; -WRITE_ONCE (gt->perf.exclusive_stream, stream); +WRITE_ONCE (g->exclusive_stream, stream); ret =i915_perf_stream_enable_sync (stream);if (ret) {@@ -3352,7 +3360,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,return 0 ; err_enable: -WRITE_ONCE (gt->perf.exclusive_stream,NULL ); +WRITE_ONCE (g->exclusive_stream,NULL ); perf->ops.disable_metric_set (stream);free_oa_buffer (stream);@@ -3381,12 +3389,13 @@ void i915_oa_init_reg_state(const struct intel_context *ce, const struct intel_engine_cs *engine) {struct i915_perf_stream *stream; +struct i915_perf_group *g = engine->oa_group; -if (!engine_supports_oa (engine)) +if (!g)return ;/* perf.exclusive_stream serialised by lrc_configure_all_contexts() */ - stream =READ_ONCE (engine->gt->perf.exclusive_stream); + stream =READ_ONCE (g->exclusive_stream);if (stream &&GRAPHICS_VER (stream->perf->i915) <12 )gen8_update_reg_state_unlocked (ce, stream); }@@ -4755,6 +4764,95 @@ static struct ctl_table oa_table[] = { {} }; +static u32 __num_perf_groups_per_gt (struct intel_gt *gt) +{ +enum intel_platform platform =INTEL_INFO (gt->i915)->platform; + +switch (platform) { +default : +return 1 ; + } +} + +static u32 __oa_engine_group (struct intel_engine_cs *engine) +{ +if (!engine_supports_oa (engine)) +return PERF_GROUP_INVALID ; + +switch (engine->class) { +case RENDER_CLASS : +return PERF_GROUP_OAG ; + +default : +return PERF_GROUP_INVALID ; + } +} + +static void oa_init_groups (struct intel_gt *gt) +{ +int i, num_groups = gt->perf.num_perf_groups; +struct i915_perf *perf = >->i915->perf; + +for (i =0 ; i < num_groups; i++) { +struct i915_perf_group *g = >->perf.group[i]; + +/* Fused off engines can result in a group with num_engines == 0 */ +if (g->num_engines ==0 ) +continue ; + +/* Set oa_unit_ids now to ensure ids remain contiguous. */ + g->oa_unit_id = perf->oa_unit_ids++; + + g->gt = gt; + } +} + +static int oa_init_gt (struct intel_gt *gt) +{ +u32 num_groups =__num_perf_groups_per_gt (gt); +struct intel_engine_cs *engine;
Quoted 8 lines
drivers/gpu/drm/i915/i915_perf.c static struct ctl_table oa_table[] = { · line 4819
Quoted 6 lines
drivers/gpu/drm/i915/i915_perf.c +6
-0+struct i915_perf_group *g; +intel_engine_mask_t tmp; + + g =kcalloc (num_groups,sizeof (*g),GFP_KERNEL ); +if (drm_WARN_ON (>->i915->drm, !g)) +return -ENOMEM ;No warnings or messages on
-ENOMEMis standard policy.
Will remove warn ON.
Quoted 31 lines
Quoted 31 lines
drivers/gpu/drm/i915/i915_perf.c +30
-0+ +for_each_engine_masked (engine, gt,ALL_ENGINES , tmp) { +u32 index; + + index =__oa_engine_group (engine); +if (index < num_groups) { + g[index].engine_mask |=BIT (engine->id); + g[index].num_engines++; + engine->oa_group = &g[index]; + }else { + engine->oa_group =NULL ; + } + } + + gt->perf.num_perf_groups = num_groups; + gt->perf.group = g; + +oa_init_groups (gt); + +return 0 ; +} + +static int oa_init_engine_groups (struct i915_perf *perf) +{ +struct intel_gt *gt; +int i, ret; + +for_each_gt (gt, perf->i915, i) { + ret =oa_init_gt (gt); +if (ret)
Quoted 8 lines
drivers/gpu/drm/i915/i915_perf.c static struct ctl_table oa_table[] = { · line 4850
Quoted 1 line
drivers/gpu/drm/i915/i915_perf.c +1
-0+return ret;If this fails in the middle, you'll leave things in half-initialized state when returning, and expect the caller to clean it up. But that's a surprising interface design. If
i915_perf_init()returns an error, it's *not* customary to have to call the corresponding cleanup function. On the contrary, you only call it on success. Any init failures need to be cleaned up internally before returning.
ENOMEM is the only error I am expecting here, so no other cleanup is needed if this fails.
Thanks,
Umesh
PATCH 6/9 drm/i915/perf: Parse 64bit report header formats correctly
In reply to Umesh Nerlige RamappaNow that OA formats come in flavor of 64 bit reports, the report header has 64 bit report-id, timestamp, context-id and gpu-ticks fields. When filtering these reports, use the right width for these fields.
Note that upper dword of context id is reserved, so squash lower dword only.
--- drivers/gpu/drm/i915/i915_perf.c | 105 ++++++++++++++++++++----- drivers/gpu/drm/i915/i915_perf_types.h | 6 ++ 2 files changed, 92 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +86 -19
@@ -441,6 +441,75 @@ static u32 gen7_oa_hw_tail_read(struct i915_perf_stream *stream)return oastatus1 &GEN7_OASTATUS1_TAIL_MASK ; } +#define oa_report_header_64bit (__s) \ + ((__s)->oa_buffer.format->header == HDR_64_BIT) + +static inline u64 +oa_report_id (struct i915_perf_stream *stream,void *report) +{ +return oa_report_header_64bit (stream) ? *(u64 *)report : *(u32 *)report; +} + +static inline u64 +oa_report_reason (struct i915_perf_stream *stream,void *report) +{ +return (oa_report_id (stream, report) >>OAREPORT_REASON_SHIFT ) & + (GRAPHICS_VER (stream->perf->i915) ==12 ? +OAREPORT_REASON_MASK_EXTENDED : +OAREPORT_REASON_MASK ); +} + +static inline void +oa_report_id_clear (struct i915_perf_stream *stream,u32 *report) +{ +if (oa_report_header_64bit (stream)) + *(u64 *)report =0 ; +else + *report =0 ; +} + +static inline bool +oa_report_ctx_invalid (struct i915_perf_stream *stream,void *report) +{ +return !(oa_report_id (stream, report) & + stream->perf->gen8_valid_ctx_bit) && +GRAPHICS_VER (stream->perf->i915) <=11 ; +} + +static inline u64 +oa_timestamp (struct i915_perf_stream *stream,void *report) +{ +return oa_report_header_64bit (stream) ? + *((u64 *)report +1 ) : + *((u32 *)report +1 ); +} + +static inline void +oa_timestamp_clear (struct i915_perf_stream *stream,u32 *report) +{ +if (oa_report_header_64bit (stream)) + *(u64 *)&report[2 ] =0 ; +else + report[1 ] =0 ; +} + +static inline u32 +oa_context_id (struct i915_perf_stream *stream,u32 *report) +{ +u32 ctx_id =oa_report_header_64bit (stream) ? report[4 ] : report[2 ]; + +return ctx_id & stream->specific_ctx_id_mask; +} + +static inline void +oa_context_id_squash (struct i915_perf_stream *stream,u32 *report) +{ +if (oa_report_header_64bit (stream)) + report[4 ] =INVALID_CTX_ID ; +else + report[2 ] =INVALID_CTX_ID ; +} +/** * oa_buffer_check_unlocked - check for data and update tail ptr state * @stream: i915 stream instance
@@ -521,9 +590,10 @@ static bool oa_buffer_check_unlocked(struct i915_perf_stream *stream)* If not : (╯°□°)╯︵ ┻━┻ */ while (OA_TAKEN (tail, aged_tail) >= report_size) { -u32 *report32 = (void *)(stream->oa_buffer.vaddr + tail); +void *report = stream->oa_buffer.vaddr + tail; -if (report32[0 ] !=0 || report32[1 ] !=0 ) +if (oa_report_id (stream, report) || +oa_timestamp (stream, report))break ; tail = (tail - report_size) & (OA_BUFFER_SIZE -1 );
@@ -702,7 +772,7 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream,u8 *report = oa_buf_base + head;u32 *report32 = (void *)report;u32 ctx_id; -u32 reason; +u64 reason;/* * All the report sizes factor neatly into the buffer
@@ -725,16 +795,12 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream,* triggered this specific report (mostly timer * triggered or e.g. due to a context switch). * -* This field is never expected to be zero so we can -* check that the report isn't invalid before copying -* it to userspace... +* In MMIO triggered reports, some platforms do not set the +* reason bit in this field and it is valid to have a reason +* field of zero. */ - reason = ((report32[0 ] >>OAREPORT_REASON_SHIFT ) & - (GRAPHICS_VER (stream->perf->i915) ==12 ? -OAREPORT_REASON_MASK_EXTENDED : -OAREPORT_REASON_MASK )); - - ctx_id = report32[2 ] & stream->specific_ctx_id_mask; + reason =oa_report_reason (stream, report); + ctx_id =oa_context_id (stream, report32);/* * Squash whatever is in the CTX_ID field if it's marked as
@@ -744,9 +810,10 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream,* Note: that we don't clear the valid_ctx_bit so userspace can * understand that the ID has been squashed by the kernel. */ -if (!(report32[0 ] & stream->perf->gen8_valid_ctx_bit) && -GRAPHICS_VER (stream->perf->i915) <=11 ) - ctx_id = report32[2 ] =INVALID_CTX_ID ; +if (oa_report_ctx_invalid (stream, report)) { + ctx_id =INVALID_CTX_ID ; +oa_context_id_squash (stream, report32); + }/* * NB: For Gen 8 the OA unit no longer supports clock gating
@@ -790,7 +857,7 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream,*/ if (stream->ctx && stream->specific_ctx_id != ctx_id) { - report32[2 ] =INVALID_CTX_ID ; +oa_context_id_squash (stream, report32); } ret = append_oa_sample(stream, buf, count, offset,
@@ -802,11 +869,11 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream, }/* -* Clear out the first 2 dword as a mean to detect unlanded +* Clear out the report id and timestamp as a means to detect unlanded * reports. */ - report32[0 ] =0 ; - report32[1 ] =0 ; +oa_report_id_clear (stream, report32); +oa_timestamp_clear (stream, report32); }if (start_offset != *offset) {
drivers/gpu/drm/i915/i915_perf_types.h +6 -0
@@ -38,9 +38,15 @@ enum { PERF_GROUP_INVALID = U32_MAX, }; +enum report_header { +HDR_32_BIT =0 , +HDR_64_BIT , +}; +struct i915_oa_format {u32 format;int size; +enum report_header header; };struct i915_oa_reg {
Signature · 1 line
2.36.1
PATCH 7/9 drm/i915/perf: Handle non-power-of-2 reports
In reply to Umesh Nerlige RamappaSome of the newer OA formats are not powers of 2. For those formats, hw_tail is adjusted accordingly when checking for new reports.
--- drivers/gpu/drm/i915/i915_perf.c | 50 ++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +28 -22
@@ -542,6 +542,7 @@ static bool oa_buffer_check_unlocked(struct i915_perf_stream *stream)bool pollin;u32 hw_tail;u64 now; +u32 partial_report_size;/* We have to consider the (unlikely) possibility that read() errors * could result in an OA buffer reset which might reset the head and
@@ -551,10 +552,16 @@ static bool oa_buffer_check_unlocked(struct i915_perf_stream *stream) hw_tail = stream->perf->ops.oa_hw_tail_read (stream); -/* The tail pointer increases in 64 byte increments, -* not in report_size steps... +/* The tail pointer increases in 64 byte increments, whereas report +* sizes need not be integral multiples or 64 or powers of 2. +* Compute potentially partially landed report in the OA buffer */ - hw_tail &= ~(report_size -1 ); + partial_report_size =OA_TAKEN (hw_tail, stream->oa_buffer.tail); + partial_report_size %= report_size; + +/* Subtract partial amount off the tail */ + hw_tail = gtt_offset + ((hw_tail - partial_report_size) & + (stream->oa_buffer.vma->size -1 )); now =ktime_get_mono_fast_ns ();
@@ -677,6 +684,8 @@ static int append_oa_sample(struct i915_perf_stream *stream, {int report_size = stream->oa_buffer.format->size;struct drm_i915_perf_record_header header; +int report_size_partial; +u8 *oa_buf_end; header.type =DRM_I915_PERF_RECORD_SAMPLE ; header.pad =0 ;
@@ -690,8 +699,21 @@ static int append_oa_sample(struct i915_perf_stream *stream,return -EFAULT ; buf +=sizeof (header); -if (copy_to_user (buf, report, report_size)) + oa_buf_end = stream->oa_buffer.vaddr + + stream->oa_buffer.vma->size; + report_size_partial = oa_buf_end - report; + +if (report_size_partial < report_size) { +if (copy_to_user (buf, report, report_size_partial)) +return -EFAULT ; + buf += report_size_partial; + +if (copy_to_user (buf, stream->oa_buffer.vaddr, + report_size - report_size_partial)) +return -EFAULT ; + }else if (copy_to_user (buf, report, report_size)) {return -EFAULT ; + } (*offset) += header.size;
@@ -759,8 +781,8 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream,* all a power of two). */ if (drm_WARN_ONCE (&uncore->i915->drm, - head >OA_BUFFER_SIZE || head % report_size || - tail >OA_BUFFER_SIZE || tail % report_size, + head >OA_BUFFER_SIZE || + tail >OA_BUFFER_SIZE ,"Inconsistent OA buffer pointers: head = %u, tail = %u\n" , head, tail))return -EIO ;
@@ -774,22 +796,6 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream,u32 ctx_id;u64 reason; -/* -* All the report sizes factor neatly into the buffer -* size so we never expect to see a report split -* between the beginning and end of the buffer. -* -* Given the initial alignment check a misalignment -* here would imply a driver bug that would result -* in an overrun. -*/ -if (drm_WARN_ON (&uncore->i915->drm, - (OA_BUFFER_SIZE - head) < report_size)) { -drm_err (&uncore->i915->drm, -"Spurious OA head ptr: non-integral report offset\n" ); -break ; - } -/* * The reason field includes flags identifying what * triggered this specific report (mostly timer
Signature · 1 line
2.36.1
PATCH 8/9 drm/i915/perf: Add engine class instance parameters to perf
In reply to Umesh Nerlige RamappaCurrent implementation of perf defaults to render to and configures the default OAG unit. Since there are more OA units on newer hardware, allow user to pass engine class and instance to program specific OA units.
UMD specific changes for GPUvis support:
https://patchwork.freedesktop.org/patch/522827/?series=114023
https://patchwork.freedesktop.org/patch/522822/?series=114023
https://patchwork.freedesktop.org/patch/522826/?series=114023
https://patchwork.freedesktop.org/patch/522828/?series=114023
https://patchwork.freedesktop.org/patch/522816/?series=114023
https://patchwork.freedesktop.org/patch/522825/?series=114023
--- drivers/gpu/drm/i915/i915_perf.c | 49 +++++++++++++++++++------------- include/uapi/drm/i915_drm.h | 20 +++++++++++++ 2 files changed, 49 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +29 -20
@@ -4038,40 +4038,29 @@ static int read_properties_unlocked(struct i915_perf *perf,u64 __user *uprop = uprops;u32 i;int ret; +u8 class, instance;bool config_sseu = false;struct drm_i915_gem_context_param_sseu user_sseu;memset (props,0 ,sizeof (struct perf_open_properties )); props->poll_oa_period =DEFAULT_POLL_PERIOD_NS ; -if (!n_props) { -drm_dbg (&perf->i915->drm, -"No i915 perf properties given\n" ); -return -EINVAL ; - } - -/* At the moment we only support using i915-perf on the RCS. */ - props->engine =intel_engine_lookup_user (perf->i915, -I915_ENGINE_CLASS_RENDER , -0 ); -if (!props->engine) { -drm_dbg (&perf->i915->drm, -"No RENDER-capable engines\n" ); -return -EINVAL ; - } -/* Considering that ID = 0 is reserved and assuming that we don't * (currently) expect any configurations to ever specify duplicate * values for a particular property ID then the last _PROP_MAX value is * one greater than the maximum number of properties we expect to get * from userspace. */ -if (n_props >=DRM_I915_PERF_PROP_MAX ) { +if (!n_props || n_props >=DRM_I915_PERF_PROP_MAX ) {drm_dbg (&perf->i915->drm, -"More i915 perf properties specified than exist\n" ); +"Invalid no. of i915 perf properties given\n" );return -EINVAL ; } +/* Defaults when class:instance is not passed */ + class =I915_ENGINE_CLASS_RENDER ; + instance =0 ; +for (i =0 ; i < n_props; i++) {u64 oa_period, oa_freq_hz;u64 id, value;
@@ -4192,7 +4181,13 @@ static int read_properties_unlocked(struct i915_perf *perf, } props->poll_oa_period = value;break ; -case DRM_I915_PERF_PROP_MAX : +case DRM_I915_PERF_PROP_OA_ENGINE_CLASS : + class = (u8 )value; +break ; +case DRM_I915_PERF_PROP_OA_ENGINE_INSTANCE : + instance = (u8 )value; +break ; +default :MISSING_CASE (id);return -EINVAL ; }
@@ -4200,6 +4195,17 @@ static int read_properties_unlocked(struct i915_perf *perf, uprop +=2 ; } + props->engine =intel_engine_lookup_user (perf->i915, class, instance); +if (!props->engine) { +drm_dbg (&perf->i915->drm, +"OA engine class and instance invalid %d:%d\n" , + class, instance); +return -EINVAL ; + } + +if (!engine_supports_oa (props->engine)) +return -EINVAL ; +if (config_sseu) { ret =get_sseu_config (&props->sseu, props->engine, &user_sseu);if (ret) {
@@ -5210,8 +5216,11 @@ int i915_perf_ioctl_version(void)* * 5: Add DRM_I915_PERF_PROP_POLL_OA_PERIOD parameter that controls the * interval for the hrtimer used to check for OA data. +* +* 6: Add DRM_I915_PERF_PROP_OA_ENGINE_CLASS and +* DRM_I915_PERF_PROP_OA_ENGINE_INSTANCE */ -return 5 ; +return 6 ; }#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST )
include/uapi/drm/i915_drm.h +20 -0
@@ -2758,6 +2758,26 @@ enum drm_i915_perf_property_id {*/ DRM_I915_PERF_PROP_POLL_OA_PERIOD , +/** +* In platforms with multiple OA buffers, the engine class instance must +* be passed to open a stream to a OA unit corresponding to the engine. +* Multiple engines may be mapped to the same OA unit. +* +* In addition to the class:instance, if a gem context is also passed, then +* 1) the report headers of OA reports from other engines are squashed. +* 2) OAR is enabled for the class:instance +* +* This property is available in perf revision 6. +*/ +DRM_I915_PERF_PROP_OA_ENGINE_CLASS , + +/** +* This parameter specifies the engine instance. +* +* This property is available in perf revision 6. +*/ +DRM_I915_PERF_PROP_OA_ENGINE_INSTANCE , + DRM_I915_PERF_PROP_MAX /* non-ABI */ };
Signature · 1 line
2.36.1
PATCH 9/9 drm/i915/perf: Add support for OA media units
In reply to Umesh Nerlige RamappaMTL introduces additional OA units dedicated to media use cases. Add support for programming these OA units.
UMD specific changes for GPUvis support:
https://patchwork.freedesktop.org/patch/522827/?series=114023
https://patchwork.freedesktop.org/patch/522822/?series=114023
https://patchwork.freedesktop.org/patch/522826/?series=114023
https://patchwork.freedesktop.org/patch/522828/?series=114023
https://patchwork.freedesktop.org/patch/522816/?series=114023
https://patchwork.freedesktop.org/patch/522825/?series=114023
--- drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/i915_pci.c | 1 + drivers/gpu/drm/i915/i915_perf.c | 247 ++++++++++++++++++++--- drivers/gpu/drm/i915/i915_perf_oa_regs.h | 78 +++++++ drivers/gpu/drm/i915/i915_perf_types.h | 40 ++++ drivers/gpu/drm/i915/intel_device_info.h | 1 + include/uapi/drm/i915_drm.h | 4 + 7 files changed, 347 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -856,6 +856,8 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915, (INTEL_INFO(dev_priv)->has_oa_bpc_reporting)#define HAS_OA_SLICE_CONTRIB_LIMITS (dev_priv) \ (INTEL_INFO(dev_priv)->has_oa_slice_contrib_limits) +#define HAS_OAM (dev_priv) \ + (INTEL_INFO(dev_priv)->has_oam)/* * Set this flag, when platform requires 64K GTT page sizes or larger for
drivers/gpu/drm/i915/i915_pci.c +1 -0
@@ -1028,6 +1028,7 @@ static const struct intel_device_info adl_p_info = { .has_mslice_steering = 1, \ .has_oa_bpc_reporting = 1, \ .has_oa_slice_contrib_limits = 1, \ + .has_oam = 1, \ .has_rc6 = 1, \ .has_reset_engine = 1, \ .has_rps = 1, \
drivers/gpu/drm/i915/i915_perf.c +221 -26
479 lines not on this page · raw message
drivers/gpu/drm/i915/i915_perf_oa_regs.h +78 -0
82 lines not on this page · raw message
drivers/gpu/drm/i915/i915_perf_types.h +40 -0
@@ -20,6 +20,7 @@#include "gt/intel_engine_types.h" #include "gt/intel_sseu.h" #include "i915_reg_defs.h" +#include "intel_uncore.h" #include "intel_wakeref.h" struct drm_i915_private ;
@@ -33,6 +34,7 @@ struct intel_engine_cs;enum {PERF_GROUP_OAG =0 , +PERF_GROUP_OAM_SAMEDIA_0 =0 ,PERF_GROUP_MAX ,PERF_GROUP_INVALID =U32_MAX ,
@@ -43,9 +45,27 @@ enum report_header { HDR_64_BIT, }; +struct i915_perf_regs { +u32 base; +i915_reg_t oa_head_ptr; +i915_reg_t oa_tail_ptr; +i915_reg_t oa_buffer; +i915_reg_t oa_ctx_ctrl; +i915_reg_t oa_ctrl; +i915_reg_t oa_debug; +i915_reg_t oa_status; +u32 oa_ctrl_counter_format_shift; +}; + +enum { +TYPE_OAG , +TYPE_OAM , +}; +struct i915_oa_format {u32 format;int size; +int type;enum report_header header; };
@@ -317,6 +337,11 @@ struct i915_perf_stream {* @tail: The last verified tail that can be read by userspace. */ u32 tail; + +/** +* @group: The group object for this OA buffer. +*/ +struct i915_perf_group *group; } oa_buffer;/**
@@ -431,6 +456,21 @@ struct i915_perf_group {* @engine_mask: A mask of engines using a single OA buffer. */ intel_engine_mask_t engine_mask; + +/* +* @regs: OA buffer register group for programming the OA unit. +*/ +struct i915_perf_regs regs; + +/* +* @type: Type of OA buffer, OAM, OAG etc. +*/ +int type; + +/* +* @fw_domains: forcewake domains required for this group. +*/ +enum forcewake_domains fw_domains; };struct i915_perf_gt {
drivers/gpu/drm/i915/intel_device_info.h +1 -0
@@ -166,6 +166,7 @@ enum intel_ppgtt_type {func (has_mslice_steering); \func (has_oa_bpc_reporting); \func (has_oa_slice_contrib_limits); \ +func (has_oam); \func (has_one_eu_per_fuse_bit); \func (has_pxp); \func (has_rc6); \
include/uapi/drm/i915_drm.h +4 -0
@@ -2676,6 +2676,10 @@ enum drm_i915_oa_format { I915_OAR_FORMAT_A32u40_A4u32_B8_C8, I915_OA_FORMAT_A24u40_A14u32_B8_C8, +/* MTL OAM */ + I915_OAM_FORMAT_MPEC8u64_B8_C8, + I915_OAM_FORMAT_MPEC8u32_B8_C8, + I915_OA_FORMAT_MAX /* non-ABI */ };
Signature · 1 line
2.36.1
Re: [Intel-gfx] [PATCH 9/9] drm/i915/perf: Add support for OA media units
Quoted 3 lines · Umesh Nerlige Ramappa
MTL introduces additional OA units dedicated to media use cases. Add support for programming these OA units.
This patch is several patches squashed into a single patch. Sorry for creating addition work but can we please split this up into smaller patches. Thanks.
Re: [Intel-gfx] [PATCH 9/9] drm/i915/perf: Add support for OA media units
Quoted 8 lines · Ashutosh
Quoted 3 lines · Umesh Nerlige Ramappa
MTL introduces additional OA units dedicated to media use cases. Add support for programming these OA units.
This patch is several patches squashed into a single patch. Sorry for creating addition work but can we please split this up into smaller patches. Thanks.
I don't recall squashing this, it is still similar to internal repo.
I will however try to see if I can break it down into smaller functional pieces so that it is easier to review.
Thanks,
Umesh
Re: [Intel-gfx] [PATCH 9/9] drm/i915/perf: Add support for OA media units
Quoted 7 lines · Umesh Nerlige Ramappa
Quoted 5 lines · Ashutosh
Quoted 3 lines · Umesh Nerlige Ramappa
MTL introduces additional OA units dedicated to media use cases. Add support for programming these OA units.
Quoted 8 lines
Quoted 3 lines
This patch is several patches squashed into a single patch. Sorry for creating addition work but can we please split this up into smaller patches. Thanks.
I don't recall squashing this, it is still similar to internal repo.
I will however try to see if I can break it down into smaller functional pieces so that it is easier to review.
Maybe skip splitting into smaller patches this time, I will review. Next time we can make sure that right sized patches make it into the internal repo too :). Thanks.
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for Add OAM support for MTL
In reply to Umesh Nerlige Ramappa== Series Details ==
== Series Details ==
Series: Add OAM support for MTL
URL : https://patchwork.freedesktop.org/series/114033/
State : warning
== Summary ==
Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for Add OAM support for MTL
In reply to Umesh Nerlige Ramappa== Series Details ==
== Series Details ==
Series: Add OAM support for MTL
URL : https://patchwork.freedesktop.org/series/114033/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_12739 -> Patchwork_114033v1
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_114033v1 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_114033v1, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114033v1/index.html
Participating hosts (39 -> 39)
------------------------------
Additional (1): bat-rpls-2
Missing (1): fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_114033v1:
### IGT changes ###
#### Possible regressions ####
* igt@i915_suspend@basic-s2idle-without-i915:
- fi-cfl-8109u: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12739/fi-cfl-8109u/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114033v1/fi-cfl-8109u/igt@[email protected]
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@i915_suspend@basic-s2idle-without-i915:
- {bat-rpls-1}: NOTRUN -> [ABORT][3]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114033v1/bat-rpls-1/igt@[email protected]
Known issues
------------
Here are the changes found in Patchwork_114033v1 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live@hangcheck:
- fi-kbl-soraka: [PASS][4] -> [INCOMPLETE][5] ([i915#7913])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12739/fi-kbl-soraka/igt@i915_selftest@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114033v1/fi-kbl-soraka/igt@i915_selftest@[email protected]
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions:
- fi-bsw-n3050: [PASS][6] -> [FAIL][7] ([i915#6298])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12739/fi-bsw-n3050/igt@kms_cursor_legacy@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114033v1/fi-bsw-n3050/igt@kms_cursor_legacy@[email protected]
#### Possible fixes ####
* igt@gem_exec_gttfill@basic:
- fi-pnv-d510: [FAIL][8] ([i915#7229]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12739/fi-pnv-d510/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114033v1/fi-pnv-d510/igt@[email protected]
* igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka: [DMESG-FAIL][10] ([i915#5334] / [i915#7872]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12739/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114033v1/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html
- fi-apl-guc: [DMESG-FAIL][12] ([i915#5334]) -> [PASS][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12739/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114033v1/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
* igt@i915_selftest@live@reset:
- {bat-rpls-1}: [ABORT][14] ([i915#4983]) -> [PASS][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12739/bat-rpls-1/igt@i915_selftest@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114033v1/bat-rpls-1/igt@i915_selftest@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#7102]: https://gitlab.freedesktop.org/drm/intel/issues/7102
[i915#7229]: https://gitlab.freedesktop.org/drm/intel/issues/7229
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7872]: https://gitlab.freedesktop.org/drm/intel/issues/7872
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7996]: https://gitlab.freedesktop.org/drm/intel/issues/7996
Build changes
-------------
* IGT: IGT_7160 -> IGTPW_8498
* Linux: CI_DRM_12739 -> Patchwork_114033v1
CI-20190529: 20190529
CI_DRM_12739: 5fc904286af94038fbf2c7cda50ed871b70cf4e8 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8498: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8498/index.html
IGT_7160: 45da871dd2684227e93a2fc002b87dfc58bd5fd9 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_114033v1: 5fc904286af94038fbf2c7cda50ed871b70cf4e8 @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
192bc8520091 drm/i915/perf: Add support for OA media units 84b6e24bbdb2 drm/i915/perf: Add engine class instance parameters to perf f4496df56191 drm/i915/perf: Handle non-power-of-2 reports 318c5541f507 drm/i915/perf: Parse 64bit report header formats correctly 7f5aeb858190 drm/i915/perf: Group engines into respective OA groups 2ea748f55cbc drm/i915/perf: Fail modprobe if i915_perf_init fails fef287c42287 drm/i915/perf: Validate OA sseu config outside switch 8d941260d3af drm/i915/perf: Add helper to check supported OA engines b9a48e73e1d7 drm/i915/perf: Drop wakeref on GuC RC error
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114033v1/index.html