diff options
author | Dave Airlie <airlied@redhat.com> | 2010-10-07 18:57:10 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-10-18 19:49:42 -0400 |
commit | c9220b0f7cbd1d2272426aa81a72ae2f6582bb71 (patch) | |
tree | 223bf3f0edb2bf151687155b1f199ee280376276 /drivers/gpu/drm/ttm | |
parent | b7ae5056c94a8191c1fd0b5697707377516c0c5d (diff) |
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.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 |
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 1e9bb2156dcf..5ef0103bd0b6 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) | |||
464 | spin_lock(&glob->lru_lock); | 464 | spin_lock(&glob->lru_lock); |
465 | } | 465 | } |
466 | 466 | ||
467 | if (bo->mem.mm_node) { | 467 | ttm_bo_mem_put_locked(bo, &bo->mem); |
468 | ttm_bo_mem_put(bo, &bo->mem); | ||
469 | } | ||
470 | 468 | ||
471 | atomic_set(&bo->reserved, 0); | 469 | atomic_set(&bo->reserved, 0); |
472 | wake_up_all(&bo->event_queue); | 470 | 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) | |||
791 | } | 789 | } |
792 | EXPORT_SYMBOL(ttm_bo_mem_put); | 790 | EXPORT_SYMBOL(ttm_bo_mem_put); |
793 | 791 | ||
792 | void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo, struct ttm_mem_reg *mem) | ||
793 | { | ||
794 | struct ttm_mem_type_manager *man = &bo->bdev->man[mem->mem_type]; | ||
795 | |||
796 | if (mem->mm_node) | ||
797 | (*man->func->put_node_locked)(man, mem); | ||
798 | } | ||
799 | EXPORT_SYMBOL(ttm_bo_mem_put_locked); | ||
800 | |||
794 | /** | 801 | /** |
795 | * Repeatedly evict memory from the LRU for @mem_type until we create enough | 802 | * Repeatedly evict memory from the LRU for @mem_type until we create enough |
796 | * space, or we've evicted everything and there isn't enough space. | 803 | * 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 7410c190c891..35c97b20bdae 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, | |||
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | static void ttm_bo_man_put_node_locked(struct ttm_mem_type_manager *man, | ||
94 | struct ttm_mem_reg *mem) | ||
95 | { | ||
96 | if (mem->mm_node) { | ||
97 | drm_mm_put_block(mem->mm_node); | ||
98 | mem->mm_node = NULL; | ||
99 | } | ||
100 | } | ||
101 | |||
93 | static int ttm_bo_man_init(struct ttm_mem_type_manager *man, | 102 | static int ttm_bo_man_init(struct ttm_mem_type_manager *man, |
94 | unsigned long p_size) | 103 | unsigned long p_size) |
95 | { | 104 | { |
@@ -143,6 +152,7 @@ const struct ttm_mem_type_manager_func ttm_bo_manager_func = { | |||
143 | ttm_bo_man_takedown, | 152 | ttm_bo_man_takedown, |
144 | ttm_bo_man_get_node, | 153 | ttm_bo_man_get_node, |
145 | ttm_bo_man_put_node, | 154 | ttm_bo_man_put_node, |
155 | ttm_bo_man_put_node_locked, | ||
146 | ttm_bo_man_debug | 156 | ttm_bo_man_debug |
147 | }; | 157 | }; |
148 | EXPORT_SYMBOL(ttm_bo_manager_func); | 158 | EXPORT_SYMBOL(ttm_bo_manager_func); |