All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/pmu: Deprecate I915_PMU_LAST and optimize state tracking
Date: Fri, 27 Nov 2020 10:36:20 +0000	[thread overview]
Message-ID: <160647338038.5755.10632872150961246118@build.alporthouse.com> (raw)
In-Reply-To: <20201127100109.1968571-1-tvrtko.ursulin@linux.intel.com>

Quoting Tvrtko Ursulin (2020-11-27 10:01:09)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Adding any kinds of "last" abi markers is usually a mistake which I
> repeated when implementing the PMU because it felt convenient at the time.
> 
> This patch marks I915_PMU_LAST as deprecated and stops the internal
> implementation using it for sizing the event status bitmask and array.
> 
> New way of sizing the fields is a bit less elegant, but it omits reserving
> slots for tracking events we are not interested in, and as such saves some
> runtime space. Adding sampling events is likely to be a special event and
> the new plumbing needed will be easily detected in testing. Existing
> asserts against the bitfield and array sizes are keeping the code safe.
> 
> First event which gets the new treatment in this new scheme are the
> interrupts - which neither needs any tracking in i915 pmu nor needs
> waking up the GPU to read it.
> 
> v2:
>  * Streamline helper names. (Chris)
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_pmu.c | 80 ++++++++++++++++++++++++---------
>  drivers/gpu/drm/i915/i915_pmu.h | 35 ++++++++++-----
>  include/uapi/drm/i915_drm.h     |  2 +-
>  3 files changed, 83 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index cd786ad12be7..06dc63bf84d7 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -27,8 +27,6 @@
>          BIT(I915_SAMPLE_WAIT) | \
>          BIT(I915_SAMPLE_SEMA))
>  
> -#define ENGINE_SAMPLE_BITS (1 << I915_PMU_SAMPLE_BITS)
> -
>  static cpumask_t i915_pmu_cpumask;
>  static unsigned int i915_pmu_target_cpu = -1;
>  
> @@ -57,17 +55,38 @@ static bool is_engine_config(u64 config)
>         return config < __I915_PMU_OTHER(0);
>  }
>  
> -static unsigned int config_enabled_bit(u64 config)
> +static unsigned int other_bit(const u64 config)
> +{
> +       unsigned int val;
> +
> +       switch (config) {
> +       case I915_PMU_ACTUAL_FREQUENCY:
> +               val =  __I915_PMU_ACTUAL_FREQUENCY_ENABLED;
> +               break;
> +       case I915_PMU_REQUESTED_FREQUENCY:
> +               val = __I915_PMU_REQUESTED_FREQUENCY_ENABLED;
> +               break;
> +       case I915_PMU_RC6_RESIDENCY:
> +               val = __I915_PMU_RC6_RESIDENCY_ENABLED;
> +               break;
> +       default:

Should we explicitly list the untracked events?

At least we should put a comment here to remind ourselves what takes
the default path.

/* Anything that doesn't require event tracking can be ignored */

> +               return -1;
> +       }
> +
> +       return I915_ENGINE_SAMPLE_COUNT + val;
> +}
> +
> +static unsigned int config_bit(const u64 config)
>  {
>         if (is_engine_config(config))
>                 return engine_config_sample(config);
>         else
> -               return ENGINE_SAMPLE_BITS + (config - __I915_PMU_OTHER(0));
> +               return other_bit(config);
>  }

Thanks, that reads so much more clearly to me, and complements it use
well.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-11-27 10:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 16:47 [Intel-gfx] [PATCH] drm/i915/pmu: Deprecate I915_PMU_LAST and optimize state tracking Tvrtko Ursulin
2020-11-26 16:56 ` Chris Wilson
2020-11-26 18:58   ` Tvrtko Ursulin
2020-11-26 19:12     ` Chris Wilson
2020-11-26 17:45 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-11-26 20:23 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2020-11-27 10:01 ` [Intel-gfx] [PATCH v2] " Tvrtko Ursulin
2020-11-27 10:36   ` Chris Wilson [this message]
2020-11-30 12:31     ` Tvrtko Ursulin
2020-12-01 13:17   ` [Intel-gfx] [PATCH v3] " Tvrtko Ursulin
2020-12-01 13:23     ` Chris Wilson
2020-12-01 13:52       ` Tvrtko Ursulin
2020-12-01 13:59         ` Chris Wilson
2020-11-27 11:59 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/pmu: Deprecate I915_PMU_LAST and optimize state tracking (rev2) Patchwork
2020-12-01 13:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/pmu: Deprecate I915_PMU_LAST and optimize state tracking (rev3) Patchwork
2020-12-01 18:21 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2020-12-03 22:33 ` [Intel-gfx] [PATCH] drm/i915/pmu: Deprecate I915_PMU_LAST and optimize state tracking Chris Wilson
2020-12-04 10:57   ` Tvrtko Ursulin
2020-12-04 11:06     ` Chris Wilson

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=160647338038.5755.10632872150961246118@build.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=Intel-gfx@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 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.