All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: Unbind objects in shrinker only if device is runtime active
@ 2016-05-02  8:40 Praveen Paneri
  2016-05-02  8:40 ` [PATCH 2/2] drm/i915: Add rpm get/put in oom and vmap notifier Praveen Paneri
  2016-05-02  9:18 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Unbind objects in shrinker only if device is runtime active Patchwork
  0 siblings, 2 replies; 5+ messages in thread
From: Praveen Paneri @ 2016-05-02  8:40 UTC (permalink / raw)
  To: intel-gfx; +Cc: Akash Goel, Praveen Paneri

When the system is running low on memory, gem shrinker is invoked.
In this process objects will be unbounded from GTT and unbinding process
will require access to GTT(GTTADR) and also to fence register potentially.
That requires a resume of gfx device, if suspended, in the shrinker path.
Considering the power leakage due to intermediate resume, perform unbinding
operation only if device is already runtime active.

v2: Use newly implemented intel_runtime_pm_get_if_in_use (Chris)

Signed-off-by: Akash Goel <akash.goel@intel.com>
Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_shrinker.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index 2643d18..9a24415 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -134,6 +134,15 @@ i915_gem_shrink(struct drm_i915_private *dev_priv,
 	i915_gem_retire_requests(dev_priv->dev);
 
 	/*
+	 * Unbinding of objects will require HW access; Let us not wake the
+	 * device just to recover a little memory. If absolutely necessary,
+	 * we will force the wake during oom-notifier.
+	 */
+	if ((flags & I915_SHRINK_BOUND) &&
+	    !intel_runtime_pm_get_if_in_use(dev_priv))
+		flags &= ~I915_SHRINK_BOUND;
+
+	/*
 	 * As we may completely rewrite the (un)bound list whilst unbinding
 	 * (due to retiring requests) we have to strictly process only
 	 * one element of the list at the time, and recheck the list
@@ -197,6 +206,9 @@ i915_gem_shrink(struct drm_i915_private *dev_priv,
 		list_splice(&still_in_list, phase->list);
 	}
 
+	if (flags & I915_SHRINK_BOUND)
+		intel_runtime_pm_put(dev_priv);
+
 	i915_gem_retire_requests(dev_priv->dev);
 
 	return count;
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drm/i915: Add rpm get/put in oom and vmap notifier
  2016-05-02  8:40 [PATCH 1/2] drm/i915: Unbind objects in shrinker only if device is runtime active Praveen Paneri
@ 2016-05-02  8:40 ` Praveen Paneri
  2016-05-02 13:04   ` Chris Wilson
  2016-05-02  9:18 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Unbind objects in shrinker only if device is runtime active Patchwork
  1 sibling, 1 reply; 5+ messages in thread
From: Praveen Paneri @ 2016-05-02  8:40 UTC (permalink / raw)
  To: intel-gfx; +Cc: Praveen Paneri

i915_gem_shrink() will scan the bound list only if device is not
suspended but in OOM failure scenario it becomes absolutely necessary
to release as much memory as possible. Also in allocation failure from
vmap address space, it is incumbent on the Driver to reap all its
vmaps. So, adding rpm get/put in i915_gem_shrinker_oom() and
i915_gem_shrinker_vmap() to ensure shrinking of bound objects as well.

Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_shrinker.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index 9a24415..79004f3 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -357,7 +357,9 @@ 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
@@ -410,11 +412,13 @@ i915_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void *ptr
 	if (ret)
 		goto out;
 
+	intel_runtime_pm_get(dev_priv);
 	freed_pages += i915_gem_shrink(dev_priv, -1UL,
 				       I915_SHRINK_BOUND |
 				       I915_SHRINK_UNBOUND |
 				       I915_SHRINK_ACTIVE |
 				       I915_SHRINK_VMAPS);
+	intel_runtime_pm_put(dev_priv);
 
 	/* We also want to clear any cached iomaps as they wrap vmap */
 	list_for_each_entry_safe(vma, next,
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Unbind objects in shrinker only if device is runtime active
  2016-05-02  8:40 [PATCH 1/2] drm/i915: Unbind objects in shrinker only if device is runtime active Praveen Paneri
  2016-05-02  8:40 ` [PATCH 2/2] drm/i915: Add rpm get/put in oom and vmap notifier Praveen Paneri
@ 2016-05-02  9:18 ` Patchwork
  1 sibling, 0 replies; 5+ messages in thread
From: Patchwork @ 2016-05-02  9:18 UTC (permalink / raw)
  To: Praveen Paneri; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/2] drm/i915: Unbind objects in shrinker only if device is runtime active
URL   : https://patchwork.freedesktop.org/series/6598/
State : success

== Summary ==

Series 6598v1 Series without cover letter
http://patchwork.freedesktop.org/api/1.0/series/6598/revisions/1/mbox/

Test gem_exec_flush:
        Subgroup basic-uc-pro-default:
                fail       -> PASS       (bsw-nuc-2)
        Subgroup basic-uc-prw-default:
                fail       -> PASS       (bsw-nuc-2)

bdw-nuci7-2      total:209  pass:197  dwarn:0   dfail:0   fail:0   skip:12 
bdw-ultra        total:209  pass:184  dwarn:0   dfail:0   fail:0   skip:25 
bsw-nuc-2        total:208  pass:166  dwarn:0   dfail:0   fail:1   skip:41 
byt-nuc          total:208  pass:164  dwarn:0   dfail:0   fail:3   skip:41 
hsw-brixbox      total:209  pass:183  dwarn:0   dfail:0   fail:0   skip:26 
hsw-gt2          total:209  pass:187  dwarn:0   dfail:0   fail:1   skip:21 
ilk-hp8440p      total:209  pass:145  dwarn:0   dfail:0   fail:3   skip:61 
ivb-t430s        total:209  pass:178  dwarn:0   dfail:0   fail:0   skip:31 
skl-i7k-2        total:209  pass:182  dwarn:0   dfail:0   fail:0   skip:27 
skl-nuci5        total:209  pass:198  dwarn:0   dfail:0   fail:0   skip:11 
snb-dellxps      total:209  pass:167  dwarn:0   dfail:0   fail:0   skip:42 
snb-x220t        total:209  pass:167  dwarn:0   dfail:0   fail:1   skip:41 

Results at /archive/results/CI_IGT_test/Patchwork_2122/

5256d5ce241debab2267faf6dc2d5ad9eaca9554 drm-intel-nightly: 2016y-05m-02d-07h-51m-16s UTC integration manifest
480ca2e drm/i915: Add rpm get/put in oom and vmap notifier
3d9875d drm/i915: Unbind objects in shrinker only if device is runtime active

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] drm/i915: Add rpm get/put in oom and vmap notifier
  2016-05-02  8:40 ` [PATCH 2/2] drm/i915: Add rpm get/put in oom and vmap notifier Praveen Paneri
@ 2016-05-02 13:04   ` Chris Wilson
  2016-05-03  3:46     ` Praveen Paneri
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2016-05-02 13:04 UTC (permalink / raw)
  To: Praveen Paneri; +Cc: intel-gfx

On Mon, May 02, 2016 at 02:10:29PM +0530, Praveen Paneri wrote:
> i915_gem_shrink() will scan the bound list only if device is not
> suspended but in OOM failure scenario it becomes absolutely necessary
> to release as much memory as possible. Also in allocation failure from
> vmap address space, it is incumbent on the Driver to reap all its
> vmaps. So, adding rpm get/put in i915_gem_shrinker_oom() and
> i915_gem_shrinker_vmap() to ensure shrinking of bound objects as well.
> 
> Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Please do mention when you made changed. I skipped over this series when
I only saw the 2 patches because I thought to myself you hadn't added the
third patch for the new vmap path.

Nevertheless applied, thanks.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] drm/i915: Add rpm get/put in oom and vmap notifier
  2016-05-02 13:04   ` Chris Wilson
@ 2016-05-03  3:46     ` Praveen Paneri
  0 siblings, 0 replies; 5+ messages in thread
From: Praveen Paneri @ 2016-05-03  3:46 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx



On Monday 02 May 2016 06:34 PM, Chris Wilson wrote:
> On Mon, May 02, 2016 at 02:10:29PM +0530, Praveen Paneri wrote:
>> i915_gem_shrink() will scan the bound list only if device is not
>> suspended but in OOM failure scenario it becomes absolutely necessary
>> to release as much memory as possible. Also in allocation failure from
>> vmap address space, it is incumbent on the Driver to reap all its
>> vmaps. So, adding rpm get/put in i915_gem_shrinker_oom() and
>> i915_gem_shrinker_vmap() to ensure shrinking of bound objects as well.
>>
>> Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
>> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
>
> Please do mention when you made changed. I skipped over this series when
> I only saw the 2 patches because I thought to myself you hadn't added the
> third patch for the new vmap path.
Will take care of this going forward.

Thanks,
Praveen
>
> Nevertheless applied, thanks.
> -Chris
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-03  3:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-02  8:40 [PATCH 1/2] drm/i915: Unbind objects in shrinker only if device is runtime active Praveen Paneri
2016-05-02  8:40 ` [PATCH 2/2] drm/i915: Add rpm get/put in oom and vmap notifier Praveen Paneri
2016-05-02 13:04   ` Chris Wilson
2016-05-03  3:46     ` Praveen Paneri
2016-05-02  9:18 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Unbind objects in shrinker only if device is runtime active Patchwork

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.