[Intel-gfx] [RFC 12/14] drm/i915: Interface for controling engine stats collection

Chris Wilson chris at chris-wilson.co.uk
Tue Jul 18 18:43:45 UTC 2017


Quoting Tvrtko Ursulin (2017-07-18 15:36:16)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Enables other i915 components to enable and disable
> the facility as needed.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_engine_cs.c  | 53 +++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_ringbuffer.h |  5 ++++
>  2 files changed, 58 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index 3e5e08c6b5ef..03e7459bad06 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -29,6 +29,8 @@
>  #include "intel_lrc.h"
>  
>  DEFINE_STATIC_KEY_FALSE(i915_engine_stats_key);
> +static DEFINE_MUTEX(i915_engine_stats_mutex);
> +static int i915_engine_stats_ref;
>  
>  /* Haswell does have the CXT_SIZE register however it does not appear to be
>   * valid. Now, docs explain in dwords what is in the context object. The full
> @@ -1340,6 +1342,57 @@ void intel_engines_mark_idle(struct drm_i915_private *i915)
>         }
>  }
>  
> +int intel_enable_engine_stats(struct drm_i915_private *dev_priv)

The pattern I've been trying to use here is

	intel_engine_* - operate on the named engine

	intel_engines_* - operate on all engines

Long term though having a global static key is going to be a nasty wart.
Joonas will definitely ask the question how much will it cost us to use
an engine->bool and what we can do to minimise that cost.
-Chris


More information about the Intel-gfx mailing list