Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/4] drm/i915: Split out parking from the idle worker for reuse
Date: Thu, 05 Apr 2018 14:32:54 +0300	[thread overview]
Message-ID: <87d0zd3n2x.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20180405110220.27008-3-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> We will want to park GEM before disengaging the drive^W^W^W unwedging.
> Since we already do the work for idling, expose the guts as a new
> function that we can then reuse.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem.c | 65 +++++++++++++++++++++++------------------
>  1 file changed, 37 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 9650a7b10c5f..e148db310ea6 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -136,6 +136,42 @@ int i915_mutex_lock_interruptible(struct drm_device *dev)
>  	return 0;
>  }
>  
> +static u32 i915_gem_park(struct drm_i915_private *i915)
> +{
> +	lockdep_assert_held(&i915->drm.struct_mutex);
> +	GEM_BUG_ON(!i915->gt.awake);
> +	GEM_BUG_ON(i915->gt.epoch == I915_EPOCH_INVALID);
> +
> +	/*
> +	 * Be paranoid and flush a concurrent interrupt to make sure
> +	 * we don't reactivate any irq tasklets after parking.
> +	 *
> +	 * FIXME: Note that even though we have waited for execlists to be idle,
> +	 * there may still be an in-flight interrupt even though the CSB
> +	 * is now empty. synchronize_irq() makes sure that a residual interrupt
> +	 * is completed before we continue, but it doesn't prevent the HW from
> +	 * raising a spurious interrupt later. To complete the shield we should
> +	 * coordinate disabling the CS irq with flushing the interrupts.
> +	 */
> +	synchronize_irq(i915->drm.irq);
> +
> +	intel_engines_park(i915);
> +	i915_gem_timelines_park(i915);
> +
> +	i915_pmu_gt_parked(i915);
> +
> +	i915->gt.awake = false;
> +
> +	if (INTEL_GEN(i915) >= 6)
> +		gen6_rps_idle(i915);
> +
> +	intel_display_power_put(i915, POWER_DOMAIN_GT_IRQ);
> +
> +	intel_runtime_pm_put(i915);
> +
> +	return i915->gt.epoch;
> +}
> +
>  int
>  i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
>  			    struct drm_file *file)
> @@ -3496,36 +3532,9 @@ i915_gem_idle_work_handler(struct work_struct *work)
>  	if (new_requests_since_last_retire(dev_priv))
>  		goto out_unlock;
>  
> -	/*
> -	 * Be paranoid and flush a concurrent interrupt to make sure
> -	 * we don't reactivate any irq tasklets after parking.
> -	 *
> -	 * FIXME: Note that even though we have waited for execlists to be idle,
> -	 * there may still be an in-flight interrupt even though the CSB
> -	 * is now empty. synchronize_irq() makes sure that a residual interrupt
> -	 * is completed before we continue, but it doesn't prevent the HW from
> -	 * raising a spurious interrupt later. To complete the shield we should
> -	 * coordinate disabling the CS irq with flushing the interrupts.
> -	 */
> -	synchronize_irq(dev_priv->drm.irq);
> -
> -	intel_engines_park(dev_priv);
> -	i915_gem_timelines_park(dev_priv);
> +	epoch = i915_gem_park(dev_priv);
>  
> -	i915_pmu_gt_parked(dev_priv);
> -
> -	GEM_BUG_ON(!dev_priv->gt.awake);
> -	dev_priv->gt.awake = false;
> -	epoch = dev_priv->gt.epoch;
> -	GEM_BUG_ON(epoch == I915_EPOCH_INVALID);
>  	rearm_hangcheck = false;
> -
> -	if (INTEL_GEN(dev_priv) >= 6)
> -		gen6_rps_idle(dev_priv);
> -
> -	intel_display_power_put(dev_priv, POWER_DOMAIN_GT_IRQ);
> -
> -	intel_runtime_pm_put(dev_priv);
>  out_unlock:
>  	mutex_unlock(&dev_priv->drm.struct_mutex);
>  
> -- 
> 2.16.3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-04-05 11:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 11:02 [PATCH 1/4] drm/i915: Only call finish_reset after a prepare_reset Chris Wilson
2018-04-05 11:02 ` [PATCH 2/4] drm/i915: Always assume the GPU reset occurs Chris Wilson
2018-04-05 11:02 ` [PATCH 3/4] drm/i915: Split out parking from the idle worker for reuse Chris Wilson
2018-04-05 11:32   ` Mika Kuoppala [this message]
2018-04-05 11:02 ` [PATCH 4/4] drm/i915: Park before resetting the submission backend Chris Wilson
2018-04-05 11:54   ` Sagar Arun Kamble
2018-04-05 12:17     ` Chris Wilson
2018-04-05 12:36       ` Chris Wilson
2018-04-06 12:25     ` Chris Wilson
2018-04-06 13:39       ` Michal Wajdeczko
2018-04-06 14:09         ` Chris Wilson
2018-04-05 11:10 ` [PATCH 1/4] drm/i915: Only call finish_reset after a prepare_reset Maarten Lankhorst
2018-04-05 16:19   ` Chris Wilson
2018-04-05 11:11 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] " Patchwork
2018-04-05 11:26 ` ✓ Fi.CI.BAT: success " Patchwork
2018-04-05 13:03 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-04-06 13:09 ` ✗ Fi.CI.BAT: failure for series starting with [1/4] drm/i915: Only call finish_reset after a prepare_reset (rev2) Patchwork

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=87d0zd3n2x.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox