[PATCH 1/2] Avoid waking the device under the shrinker
Janusz Krzysztofik
janusz.krzysztofik at linux.intel.com
Tue Jul 19 14:16:42 UTC 2022
From: Chris Wilson <chris.p.wilson at intel.com>
We cannot take intel_runtime_pm_get() from underneath fs_reclaim (as we
may hit fs_reclaim during runtime-resume), so we have to avoid unbind
from the shrinker while the device is asleep.
Testcase: igt/gem_mmap_offset/clear
Bug: https://gitlab.freedesktop.org/drm/intel/-/issues/6449
Cc: Matthew Auld <matthew.auld at intel.com>
Signed-off-by: Chris Wilson <chris.p.wilson at intel.com>
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
---
drivers/gpu/drm/i915/i915_gem.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 702e5b89be22..910a6fde5726 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -119,8 +119,8 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
{
struct intel_runtime_pm *rpm = &to_i915(obj->base.dev)->runtime_pm;
bool vm_trylock = !!(flags & I915_GEM_OBJECT_UNBIND_VM_TRYLOCK);
+ intel_wakeref_t wakeref = 0;
LIST_HEAD(still_in_list);
- intel_wakeref_t wakeref;
struct i915_vma *vma;
int ret;
@@ -135,7 +135,8 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
* as they are required by the shrinker. Ergo, we wake the device up
* first just in case.
*/
- wakeref = intel_runtime_pm_get(rpm);
+ if (!(flags & I915_GEM_OBJECT_UNBIND_TEST))
+ wakeref = intel_runtime_pm_get(rpm);
try_again:
ret = 0;
@@ -200,7 +201,8 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
goto try_again;
}
- intel_runtime_pm_put(rpm, wakeref);
+ if (wakeref)
+ intel_runtime_pm_put(rpm, wakeref);
return ret;
}
--
2.25.1
More information about the Intel-gfx-trybot
mailing list