All of 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] drm/i915: i915_gem_shrink_all() needs an awake	device
Date: Wed, 08 Feb 2017 15:26:26 +0200	[thread overview]
Message-ID: <87y3xgreyl.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20170208104710.18089-1-chris@chris-wilson.co.uk>

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

> Since to unbind an object, we may need a powered up device to access the
> GTT entries, we only shrink bound objects if awake. Callers to
> i915_gem_shrink_all() had to take this into account and take the rpm
> wakeref, but we can move this wakeref into the shrink_all itself for
> convenience and making the function live up to its name.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

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

> ---
>  drivers/gpu/drm/i915/i915_gem.c          | 4 ----
>  drivers/gpu/drm/i915/i915_gem_shrinker.c | 5 +++--
>  2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index b7632bbbafd8..d8d107fe6ca7 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4646,14 +4646,10 @@ void i915_gem_load_cleanup(struct drm_i915_private *dev_priv)
>  
>  int i915_gem_freeze(struct drm_i915_private *dev_priv)
>  {
> -	intel_runtime_pm_get(dev_priv);
> -
>  	mutex_lock(&dev_priv->drm.struct_mutex);
>  	i915_gem_shrink_all(dev_priv);
>  	mutex_unlock(&dev_priv->drm.struct_mutex);
>  
> -	intel_runtime_pm_put(dev_priv);
> -
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
> index 401006b4c6a3..f249a1eb46ac 100644
> --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
> +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
> @@ -259,10 +259,13 @@ unsigned long i915_gem_shrink_all(struct drm_i915_private *dev_priv)
>  {
>  	unsigned long freed;
>  
> +	intel_runtime_pm_get(dev_priv);
>  	freed = i915_gem_shrink(dev_priv, -1UL,
>  				I915_SHRINK_BOUND |
>  				I915_SHRINK_UNBOUND |
>  				I915_SHRINK_ACTIVE);
> +	intel_runtime_pm_put(dev_priv);
> +
>  	rcu_barrier(); /* wait until our RCU delayed slab frees are completed */
>  
>  	return freed;
> @@ -380,9 +383,7 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr)
>  	if (!i915_gem_shrinker_lock_uninterruptible(dev_priv, &slu, 5000))
>  		return NOTIFY_DONE;
>  
> -	intel_runtime_pm_get(dev_priv);
>  	freed_pages = i915_gem_shrink_all(dev_priv);
> -	intel_runtime_pm_put(dev_priv);
>  
>  	/* Because we may be allocating inside our own driver, we cannot
>  	 * assert that there are no objects with pinned pages that are not
> -- 
> 2.11.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-02-08 13:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 10:47 [PATCH] drm/i915: i915_gem_shrink_all() needs an awake device Chris Wilson
2017-02-08 11:25 ` ✗ Fi.CI.BAT: failure for " Patchwork
2017-02-08 13:26 ` Mika Kuoppala [this message]
2017-02-08 21:04   ` [PATCH] " 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=87y3xgreyl.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 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.