]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
drm/ttm: add unlocked variant of new manager put node.
authorDave Airlie <airlied@redhat.com>
Thu, 7 Oct 2010 22:57:10 +0000 (08:57 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 18 Oct 2010 23:49:42 +0000 (09:49 +1000)
We need the unlocked variant for the new codepath introduced to fix the
race condition in master recently.

Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_bo_manager.c
include/drm/ttm/ttm_bo_driver.h

index 1e9bb2156dcfbfb77cccecaf0d67059a5e6da48d..5ef0103bd0b60b722f55783c9c80e05cf2230aae 100644 (file)
@@ -464,9 +464,7 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
                spin_lock(&glob->lru_lock);
        }
 
-       if (bo->mem.mm_node) {
-               ttm_bo_mem_put(bo, &bo->mem);
-       }
+       ttm_bo_mem_put_locked(bo, &bo->mem);
 
        atomic_set(&bo->reserved, 0);
        wake_up_all(&bo->event_queue);
@@ -791,6 +789,15 @@ void ttm_bo_mem_put(struct ttm_buffer_object *bo, struct ttm_mem_reg *mem)
 }
 EXPORT_SYMBOL(ttm_bo_mem_put);
 
+void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo, struct ttm_mem_reg *mem)
+{
+       struct ttm_mem_type_manager *man = &bo->bdev->man[mem->mem_type];
+
+       if (mem->mm_node)
+               (*man->func->put_node_locked)(man, mem);
+}
+EXPORT_SYMBOL(ttm_bo_mem_put_locked);
+
 /**
  * Repeatedly evict memory from the LRU for @mem_type until we create enough
  * space, or we've evicted everything and there isn't enough space.
index 7410c190c8911a9342ba57ea616d77a722061312..35c97b20bdae5b617fe4cc7709b6becb44cd1e4f 100644 (file)
@@ -90,6 +90,15 @@ static void ttm_bo_man_put_node(struct ttm_mem_type_manager *man,
        }
 }
 
+static void ttm_bo_man_put_node_locked(struct ttm_mem_type_manager *man,
+                                      struct ttm_mem_reg *mem)
+{
+       if (mem->mm_node) {
+               drm_mm_put_block(mem->mm_node);
+               mem->mm_node = NULL;
+       }
+}
+
 static int ttm_bo_man_init(struct ttm_mem_type_manager *man,
                           unsigned long p_size)
 {
@@ -143,6 +152,7 @@ const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
        ttm_bo_man_takedown,
        ttm_bo_man_get_node,
        ttm_bo_man_put_node,
+       ttm_bo_man_put_node_locked,
        ttm_bo_man_debug
 };
 EXPORT_SYMBOL(ttm_bo_manager_func);
index e3371dbe6a10cd2f0617aa93b5c3747110f9a89d..d0ff529fedde77ccf29a0ecafc9ea6656aee0ffa 100644 (file)
@@ -214,6 +214,8 @@ struct ttm_mem_type_manager_func {
                         struct ttm_mem_reg *mem);
        void (*put_node)(struct ttm_mem_type_manager *man,
                         struct ttm_mem_reg *mem);
+       void (*put_node_locked)(struct ttm_mem_type_manager *man,
+                               struct ttm_mem_reg *mem);
        void (*debug)(struct ttm_mem_type_manager *man, const char *prefix);
 };
 
@@ -667,6 +669,8 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
 
 extern void ttm_bo_mem_put(struct ttm_buffer_object *bo,
                           struct ttm_mem_reg *mem);
+extern void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo,
+                                 struct ttm_mem_reg *mem);
 
 /**
  * ttm_bo_wait_for_cpu