diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2009-12-02 12:33:45 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-12-16 00:34:36 -0500 |
commit | aaa207369436d04bb85382ddbb688a5b9461fd21 (patch) | |
tree | 7d1b013bda999a1c122b7ba067075ef164e168b0 /drivers/gpu | |
parent | b663752627e7c6b4bc414684d71c6adce5719fce (diff) |
drm/ttm: Delayed delete fixes.
1) Remove from lru before reserving so we avoid competing with
evicting processes.
2) Avoid calling kref_put() on bo::list_kref while spinlocked.
3) Additional refcounting bug-checking.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 4cd4007e68fa..7927fe99d017 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -465,6 +465,8 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all) | |||
465 | spin_unlock(&bo->lock); | 465 | spin_unlock(&bo->lock); |
466 | 466 | ||
467 | spin_lock(&glob->lru_lock); | 467 | spin_lock(&glob->lru_lock); |
468 | put_count = ttm_bo_del_from_lru(bo); | ||
469 | |||
468 | ret = ttm_bo_reserve_locked(bo, false, false, false, 0); | 470 | ret = ttm_bo_reserve_locked(bo, false, false, false, 0); |
469 | BUG_ON(ret); | 471 | BUG_ON(ret); |
470 | if (bo->ttm) | 472 | if (bo->ttm) |
@@ -472,20 +474,19 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all) | |||
472 | 474 | ||
473 | if (!list_empty(&bo->ddestroy)) { | 475 | if (!list_empty(&bo->ddestroy)) { |
474 | list_del_init(&bo->ddestroy); | 476 | list_del_init(&bo->ddestroy); |
475 | kref_put(&bo->list_kref, ttm_bo_ref_bug); | 477 | ++put_count; |
476 | } | 478 | } |
477 | if (bo->mem.mm_node) { | 479 | if (bo->mem.mm_node) { |
478 | bo->mem.mm_node->private = NULL; | 480 | bo->mem.mm_node->private = NULL; |
479 | drm_mm_put_block(bo->mem.mm_node); | 481 | drm_mm_put_block(bo->mem.mm_node); |
480 | bo->mem.mm_node = NULL; | 482 | bo->mem.mm_node = NULL; |
481 | } | 483 | } |
482 | put_count = ttm_bo_del_from_lru(bo); | ||
483 | spin_unlock(&glob->lru_lock); | 484 | spin_unlock(&glob->lru_lock); |
484 | 485 | ||
485 | atomic_set(&bo->reserved, 0); | 486 | atomic_set(&bo->reserved, 0); |
486 | 487 | ||
487 | while (put_count--) | 488 | while (put_count--) |
488 | kref_put(&bo->list_kref, ttm_bo_release_list); | 489 | kref_put(&bo->list_kref, ttm_bo_ref_bug); |
489 | 490 | ||
490 | return 0; | 491 | return 0; |
491 | } | 492 | } |