[Intel-gfx] [PATCH] drm/i915/pmu: Stop peeking at kernel internals for counting interrupts
Ville Syrjälä
ville.syrjala at linux.intel.com
Thu Dec 10 18:45:30 UTC 2020
On Thu, Dec 10, 2020 at 05:35:45PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> Peeking at kernel internals is bad taste so instead we keep our own
> counter which also solves the problem of shared interrupt lines.
>
> Additional cost should be way below noise relative to mmio reads.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Suggested-by: Thomas Gleixner <tglx at linutronix.de>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 3 +++
> drivers/gpu/drm/i915/i915_irq.c | 16 ++++++++++++++++
> drivers/gpu/drm/i915/i915_pmu.c | 19 +------------------
> 3 files changed, 20 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 5d04b282c060..de5cdcdc46b0 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -889,6 +889,9 @@ struct drm_i915_private {
> /* protects the irq masks */
> spinlock_t irq_lock;
>
> + /** Overall irq handler invocations. */
> + u64 irq_count;
> +
> bool display_irqs_enabled;
>
> /* To control wakeup latency, e.g. for irq-driven dp aux transfers. */
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index b245109f73e3..a88c1da025f1 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1596,6 +1596,8 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
> if (!intel_irqs_enabled(dev_priv))
> return IRQ_NONE;
>
> + dev_priv->irq_count++;
Would rather have to be something like
if (ret == IRQ_HANDLED)
irq_count++;
if we really wanted to count only our interrupts when the
irq line is shared.
--
Ville Syrjälä
Intel
More information about the Intel-gfx
mailing list