drm/i915: fixup active list locking in object_unbind
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 19 Feb 2010 10:51:57 +0000 (11:51 +0100)
committerEric Anholt <eric@anholt.net>
Fri, 26 Feb 2010 21:23:21 +0000 (13:23 -0800)
All other accesses take this spinlock, so do this here, too.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/i915_gem.c

index 302e096c3ca0e163e9950df5b3915b944025ea7d..e6b85cdbc60f511377fae72855ce6d6b74446bfb 100644 (file)
@@ -1987,6 +1987,7 @@ int
 i915_gem_object_unbind(struct drm_gem_object *obj)
 {
        struct drm_device *dev = obj->dev;
+       drm_i915_private_t *dev_priv = dev->dev_private;
        struct drm_i915_gem_object *obj_priv = obj->driver_private;
        int ret = 0;
 
@@ -2042,8 +2043,10 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
        }
 
        /* Remove ourselves from the LRU list if present. */
+       spin_lock(&dev_priv->mm.active_list_lock);
        if (!list_empty(&obj_priv->list))
                list_del_init(&obj_priv->list);
+       spin_unlock(&dev_priv->mm.active_list_lock);
 
        if (i915_gem_object_is_purgeable(obj_priv))
                i915_gem_object_truncate(obj);