All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/i915: Trim gen8_irq_handler
Date: Thu, 14 Sep 2017 18:46:10 +0300	[thread overview]
Message-ID: <20170914154610.GZ4914@intel.com> (raw)
In-Reply-To: <20170913181846.18121-1-chris@chris-wilson.co.uk>

On Wed, Sep 13, 2017 at 07:18:44PM +0100, Chris Wilson wrote:
> The goal here is to trim an excess posting read and keep the predicates
> tight (reusing the same predicate throughout for GT ack/handling).
> 
> add/remove: 0/0 grow/shrink: 2/1 up/down: 26/-30 (-4)
> function                                     old     new   delta
> gen8_gt_irq_handler                          282     301     +19
> cherryview_irq_handler                       450     457      +7
> gen8_irq_handler                            1653    1623     -30
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_irq.c | 54 +++++++++++++++++++++++------------------
>  1 file changed, 30 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 91a2c5dbf2da..e12321cb7403 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1375,31 +1375,34 @@ static irqreturn_t gen8_gt_irq_ack(struct drm_i915_private *dev_priv,
>  }
>  
>  static void gen8_gt_irq_handler(struct drm_i915_private *dev_priv,
> -				u32 gt_iir[4])
> +				u32 master_ctl, u32 gt_iir[4])
>  {
> -	if (gt_iir[0]) {
> +	if (master_ctl & (GEN8_GT_RCS_IRQ | GEN8_GT_BCS_IRQ)) {
>  		gen8_cs_irq_handler(dev_priv->engine[RCS],
>  				    gt_iir[0], GEN8_RCS_IRQ_SHIFT);
>  		gen8_cs_irq_handler(dev_priv->engine[BCS],
>  				    gt_iir[0], GEN8_BCS_IRQ_SHIFT);
>  	}
>  
> -	if (gt_iir[1]) {
> +	if (master_ctl & (GEN8_GT_VCS1_IRQ | GEN8_GT_VCS2_IRQ)) {
>  		gen8_cs_irq_handler(dev_priv->engine[VCS],
>  				    gt_iir[1], GEN8_VCS1_IRQ_SHIFT);
>  		gen8_cs_irq_handler(dev_priv->engine[VCS2],
>  				    gt_iir[1], GEN8_VCS2_IRQ_SHIFT);
>  	}
>  
> -	if (gt_iir[3])
> +	if (master_ctl & GEN8_GT_VECS_IRQ) {
>  		gen8_cs_irq_handler(dev_priv->engine[VECS],
>  				    gt_iir[3], GEN8_VECS_IRQ_SHIFT);
> +	}
>  
> -	if (gt_iir[2] & dev_priv->pm_rps_events)
> -		gen6_rps_irq_handler(dev_priv, gt_iir[2]);
> +	if (master_ctl & (GEN8_GT_PM_IRQ | GEN8_GT_GUC_IRQ)) {
> +		if (gt_iir[2] & dev_priv->pm_rps_events)
> +			gen6_rps_irq_handler(dev_priv, gt_iir[2]);
>  
> -	if (gt_iir[2] & dev_priv->pm_guc_events)
> -		gen9_guc_irq_handler(dev_priv, gt_iir[2]);
> +		if (gt_iir[2] & dev_priv->pm_guc_events)
> +			gen9_guc_irq_handler(dev_priv, gt_iir[2]);
> +	}
>  }
>  
>  static bool bxt_port_hotplug_long_detect(enum port port, u32 val)
> @@ -1984,7 +1987,7 @@ static irqreturn_t cherryview_irq_handler(int irq, void *arg)
>  		I915_WRITE(GEN8_MASTER_IRQ, GEN8_MASTER_IRQ_CONTROL);
>  		POSTING_READ(GEN8_MASTER_IRQ);
>  
> -		gen8_gt_irq_handler(dev_priv, gt_iir);
> +		gen8_gt_irq_handler(dev_priv, master_ctl, gt_iir);
>  
>  		if (hotplug_status)
>  			i9xx_hpd_irq_handler(dev_priv, hotplug_status);
> @@ -2518,36 +2521,39 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
>  	return ret;
>  }
>  
> +#define GEN8_GT_IRQ_BITS (GEN8_GT_RCS_IRQ | GEN8_GT_BCS_IRQ | \
> +			  GEN8_GT_VCS1_IRQ | GEN8_GT_VCS2_IRQ | \
> +			  GEN8_GT_VECS_IRQ | GEN8_GT_PM_IRQ | GEN8_GT_GUC_IRQ)
> +
>  static irqreturn_t gen8_irq_handler(int irq, void *arg)
>  {
> -	struct drm_device *dev = arg;
> -	struct drm_i915_private *dev_priv = to_i915(dev);
> -	u32 master_ctl;
> -	u32 gt_iir[4] = {};
> -	irqreturn_t ret;
> +	struct drm_i915_private *dev_priv = arg;
> +	u32 master_ctl, gt_iir[4];
> +	irqreturn_t ret = IRQ_NONE;
>  
>  	if (!intel_irqs_enabled(dev_priv))
>  		return IRQ_NONE;
>  
> -	master_ctl = I915_READ_FW(GEN8_MASTER_IRQ);
> -	master_ctl &= ~GEN8_MASTER_IRQ_CONTROL;
> +	master_ctl = I915_READ_FW(GEN8_MASTER_IRQ) &  ~GEN8_MASTER_IRQ_CONTROL;
>  	if (!master_ctl)
>  		return IRQ_NONE;
>  
>  	I915_WRITE_FW(GEN8_MASTER_IRQ, 0);
>  
> -	/* IRQs are synced during runtime_suspend, we don't require a wakeref */
> -	disable_rpm_wakeref_asserts(dev_priv);
> -
>  	/* Find, clear, then process each source of interrupt */
> -	ret = gen8_gt_irq_ack(dev_priv, master_ctl, gt_iir);
> -	gen8_gt_irq_handler(dev_priv, gt_iir);
> -	ret |= gen8_de_irq_handler(dev_priv, master_ctl);
> +	if (master_ctl & GEN8_GT_IRQ_BITS)
> +		ret |= gen8_gt_irq_ack(dev_priv, master_ctl, gt_iir);
> +
> +	if (master_ctl & ~GEN8_GT_IRQ_BITS) {
> +		disable_rpm_wakeref_asserts(dev_priv);

Hmm. Why is this needed for DE interrupts but not GT interrupts? Just
the _FW() vs. not in the codepaths? If I'm reading things right we still
have some non _FW() accesses in the RPS handler at least.

BDW+ doesn't suffer from the "hang when accessing the same cacheline from
multiple cpus" issue anymore?

> +		ret |= gen8_de_irq_handler(dev_priv, master_ctl);
> +		enable_rpm_wakeref_asserts(dev_priv);
> +	}

This thing reminds me that I'd still like to split the DE stuff into
ack/handle stuff as well.

>  
>  	I915_WRITE_FW(GEN8_MASTER_IRQ, GEN8_MASTER_IRQ_CONTROL);
> -	POSTING_READ_FW(GEN8_MASTER_IRQ);
>  
> -	enable_rpm_wakeref_asserts(dev_priv);
> +	if (master_ctl & GEN8_GT_IRQ_BITS)
> +		gen8_gt_irq_handler(dev_priv, master_ctl, gt_iir);
>  
>  	return ret;
>  }
> -- 
> 2.14.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-09-14 15:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 18:18 [PATCH 1/3] drm/i915: Trim gen8_irq_handler Chris Wilson
2017-09-13 18:18 ` [PATCH 2/3] drm/i915: Remove the extraneous irqreturn_t from gen8 sub handlers Chris Wilson
2017-09-13 18:18 ` [PATCH 3/3] drm/i915: Skip pipestats for GT operations in chv/vlv irq handler Chris Wilson
2017-09-14 16:02   ` Ville Syrjälä
2017-09-13 18:42 ` ✗ Fi.CI.BAT: warning for series starting with [1/3] drm/i915: Trim gen8_irq_handler Patchwork
2017-09-14  7:20 ` [PATCH 1/3] " Pandiyan, Dhinakaran
2017-09-14  8:37   ` Chris Wilson
2017-09-14 19:46     ` Pandiyan, Dhinakaran
2017-09-14 15:46 ` Ville Syrjälä [this message]
2017-09-14 15:54   ` 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=20170914154610.GZ4914@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.