[PATCH 3/3] drm/i915: Mark up i915_active as safe for use inside shrinkers
Chris Wilson
chris at chris-wilson.co.uk
Sat Jun 29 10:17:14 UTC 2019
Since a shrinker may be forced to wait on GPU activity,
i915_active_wait() must be safe for use inside a shrinker, and so let's
mark up the lock as being acquired by the shrinker to avoid any nasty
surprises creeping in.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_active.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index a55a0a954d74..2a32b1e38b27 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -5,6 +5,7 @@
*/
#include <linux/debugobjects.h>
+#include <linux/sched/mm.h>
#include "gt/intel_engine_pm.h"
@@ -203,6 +204,13 @@ void __i915_active_init(struct drm_i915_private *i915,
init_llist_head(&ref->barriers);
atomic_set(&ref->count, 0);
__mutex_init(&ref->mutex, "i915_active", key);
+
+ /* Declare ourselves safe for use inside shrinkers */
+ if (IS_ENABLED(CONFIG_LOCKDEP)) {
+ fs_reclaim_acquire(GFP_KERNEL);
+ might_lock(&ref->mutex);
+ fs_reclaim_release(GFP_KERNEL);
+ }
}
int i915_active_ref(struct i915_active *ref,
--
2.20.1
More information about the Intel-gfx-trybot
mailing list