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 | |
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>
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo_manager.c | 10 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 4 |
3 files changed, 24 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); |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index e3371dbe6a10..d0ff529fedde 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -214,6 +214,8 @@ struct ttm_mem_type_manager_func { | |||
214 | struct ttm_mem_reg *mem); | 214 | struct ttm_mem_reg *mem); |
215 | void (*put_node)(struct ttm_mem_type_manager *man, | 215 | void (*put_node)(struct ttm_mem_type_manager *man, |
216 | struct ttm_mem_reg *mem); | 216 | struct ttm_mem_reg *mem); |
217 | void (*put_node_locked)(struct ttm_mem_type_manager *man, | ||
218 | struct ttm_mem_reg *mem); | ||
217 | void (*debug)(struct ttm_mem_type_manager *man, const char *prefix); | 219 | void (*debug)(struct ttm_mem_type_manager *man, const char *prefix); |
218 | }; | 220 | }; |
219 | 221 | ||
@@ -667,6 +669,8 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
667 | 669 | ||
668 | extern void ttm_bo_mem_put(struct ttm_buffer_object *bo, | 670 | extern void ttm_bo_mem_put(struct ttm_buffer_object *bo, |
669 | struct ttm_mem_reg *mem); | 671 | struct ttm_mem_reg *mem); |
672 | extern void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo, | ||
673 | struct ttm_mem_reg *mem); | ||
670 | 674 | ||
671 | /** | 675 | /** |
672 | * ttm_bo_wait_for_cpu | 676 | * ttm_bo_wait_for_cpu |