aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_vma.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-06-10 15:54:30 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2019-06-10 20:43:08 +0100
commita8cff4c8283af35546339c9ada5a90a70fe4a075 (patch)
tree1d82abc371c71d0a24b33a943ee72f6dcd3b0c6a /drivers/gpu/drm/i915/i915_vma.c
parentdrm/i915: Allow interrupts when taking the timeline->mutex (diff)
downloadlinux-dev-a8cff4c8283af35546339c9ada5a90a70fe4a075.tar.xz
linux-dev-a8cff4c8283af35546339c9ada5a90a70fe4a075.zip
drm/i915: Promote i915->mm.obj_lock to be irqsafe
The intent is to be able to update the mm.lists from inside an irqsoff section (e.g. from a softirq rcu workqueue), ergo we need to make the i915->mm.obj_lock irqsafe. v2: can_discard_pages() ensures we are shrinkable v3: Beware shadowing of 'flags' Fixes: 3b4fa9640ccd ("drm/i915: Track the purgeable objects on a separate eviction list") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110869 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Matthew Auld <matthew.william.auld@gmail.com> Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190610145430.17717-1-chris@chris-wilson.co.uk
Diffstat (limited to '')
-rw-r--r--drivers/gpu/drm/i915/i915_vma.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index f6ac8394da77..80050f6a0893 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -80,11 +80,14 @@ static void vma_print_allocator(struct i915_vma *vma, const char *reason)
static void obj_bump_mru(struct drm_i915_gem_object *obj)
{
struct drm_i915_private *i915 = to_i915(obj->base.dev);
+ unsigned long flags;
+
+ spin_lock_irqsave(&i915->mm.obj_lock, flags);
- spin_lock(&i915->mm.obj_lock);
if (obj->bind_count)
list_move_tail(&obj->mm.link, &i915->mm.bound_list);
- spin_unlock(&i915->mm.obj_lock);
+
+ spin_unlock_irqrestore(&i915->mm.obj_lock, flags);
obj->mm.dirty = true; /* be paranoid */
}
@@ -678,8 +681,9 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
if (vma->obj) {
struct drm_i915_gem_object *obj = vma->obj;
+ unsigned long flags;
- spin_lock(&dev_priv->mm.obj_lock);
+ spin_lock_irqsave(&dev_priv->mm.obj_lock, flags);
if (i915_gem_object_is_shrinkable(obj))
list_move_tail(&obj->mm.link, &dev_priv->mm.bound_list);
@@ -687,7 +691,7 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
obj->bind_count++;
assert_bind_count(obj);
- spin_unlock(&dev_priv->mm.obj_lock);
+ spin_unlock_irqrestore(&dev_priv->mm.obj_lock, flags);
}
return 0;
@@ -721,8 +725,9 @@ i915_vma_remove(struct i915_vma *vma)
*/
if (vma->obj) {
struct drm_i915_gem_object *obj = vma->obj;
+ unsigned long flags;
- spin_lock(&i915->mm.obj_lock);
+ spin_lock_irqsave(&i915->mm.obj_lock, flags);
GEM_BUG_ON(obj->bind_count == 0);
if (--obj->bind_count == 0 &&
@@ -730,7 +735,7 @@ i915_vma_remove(struct i915_vma *vma)
obj->mm.madv == I915_MADV_WILLNEED)
list_move_tail(&obj->mm.link, &i915->mm.unbound_list);
- spin_unlock(&i915->mm.obj_lock);
+ spin_unlock_irqrestore(&i915->mm.obj_lock, flags);
/*
* And finally now the object is completely decoupled from this