aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-10-08 08:57:10 +1000
committerDave Airlie <airlied@redhat.com>2010-10-19 09:49:42 +1000
commitc9220b0f7cbd1d2272426aa81a72ae2f6582bb71 (patch)
tree223bf3f0edb2bf151687155b1f199ee280376276 /drivers/gpu/drm/ttm
parentb7ae5056c94a8191c1fd0b5697707377516c0c5d (diff)
downloadkernel_samsung_tuna-c9220b0f7cbd1d2272426aa81a72ae2f6582bb71.zip
kernel_samsung_tuna-c9220b0f7cbd1d2272426aa81a72ae2f6582bb71.tar.gz
kernel_samsung_tuna-c9220b0f7cbd1d2272426aa81a72ae2f6582bb71.tar.bz2
drm/ttm: add unlocked variant of new manager put node.
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>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c13
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_manager.c10
2 files changed, 20 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 1e9bb21..5ef0103 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -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.
diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c
index 7410c19..35c97b2 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_manager.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c
@@ -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);