[PATCH 2/2] drm/i915: Proclaim the driver as wedged if oom-locking fails
Chris Wilson
chris at chris-wilson.co.uk
Mon Dec 18 21:37:44 UTC 2017
If we cannot make forward progress in acquiring the BKL-struct_mutex for
oom, mark the driver as wedged in order to allow the system to recover -
albeit without the GPU until the next resume.
References: https://bugs.freedesktop.org/show_bug.cgi?id=104327
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem_shrinker.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index 9029ed04879c..8b6aac713deb 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -416,8 +416,21 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr)
container_of(nb, struct drm_i915_private, mm.oom_notifier);
struct drm_i915_gem_object *obj;
unsigned long unevictable, bound, unbound, freed_pages;
+ bool unlock;
+
+ if (!shrinker_lock_uninterruptible(i915, &unlock, 5000)) {
+ dev_err(i915->drm.dev,
+ "Unable to acquire device lock for oom; marking wedged\n");
+
+ i915_gem_set_wedged(i915);
+ yield();
+
+ *(unsigned long *)ptr += 1; /* try again */
+ return NOTIFY_DONE;
+ }
freed_pages = i915_gem_shrink_all(i915);
+ shrinker_unlock(i915, unlock);
/* Because we may be allocating inside our own driver, we cannot
* assert that there are no objects with pinned pages that are not
--
2.15.1
More information about the Intel-gfx-trybot
mailing list