drm/ttm: revert "implement LRU add callbacks v2"
authorChristian König <christian.koenig@amd.com>
Thu, 12 Jan 2017 10:50:13 +0000 (11:50 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 27 Jan 2017 17:20:34 +0000 (12:20 -0500)
The additional housekeeping had too much CPU overhead,
let's use the BO priorities instead.

agd: also revert hibmc changes

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Roger.He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/ast/ast_ttm.c
drivers/gpu/drm/bochs/bochs_mm.c
drivers/gpu/drm/cirrus/cirrus_ttm.c
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
drivers/gpu/drm/mgag200/mgag200_ttm.c
drivers/gpu/drm/nouveau/nouveau_bo.c
drivers/gpu/drm/qxl/qxl_ttm.c
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/virtio/virtgpu_ttm.c
drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
include/drm/ttm/ttm_bo_driver.h

index 6b1f85b1a1cbdc30b47aee9e32b3907749146a75..eebfc1d19b29fe7b54c07932e817aefd57c9aea2 100644 (file)
@@ -1086,8 +1086,6 @@ static struct ttm_bo_driver amdgpu_bo_driver = {
        .fault_reserve_notify = &amdgpu_bo_fault_reserve_notify,
        .io_mem_reserve = &amdgpu_ttm_io_mem_reserve,
        .io_mem_free = &amdgpu_ttm_io_mem_free,
-       .lru_tail = &ttm_bo_default_lru_tail,
-       .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
 };
 
 int amdgpu_ttm_init(struct amdgpu_device *adev)
index 2a1368fac1d14f196647778950d7dcf7fbb58334..50c910efa13da4f6e02f56ac69db03f14b11b168 100644 (file)
@@ -236,8 +236,6 @@ struct ttm_bo_driver ast_bo_driver = {
        .verify_access = ast_bo_verify_access,
        .io_mem_reserve = &ast_ttm_io_mem_reserve,
        .io_mem_free = &ast_ttm_io_mem_free,
-       .lru_tail = &ttm_bo_default_lru_tail,
-       .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
 };
 
 int ast_mm_init(struct ast_private *ast)
index ceb1fecf02dd3606bbf023dd3a7538d262724535..857755ac2d702050d05f8eb4484fdf0590f9aa80 100644 (file)
@@ -205,8 +205,6 @@ struct ttm_bo_driver bochs_bo_driver = {
        .verify_access = bochs_bo_verify_access,
        .io_mem_reserve = &bochs_ttm_io_mem_reserve,
        .io_mem_free = &bochs_ttm_io_mem_free,
-       .lru_tail = &ttm_bo_default_lru_tail,
-       .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
 };
 
 int bochs_mm_init(struct bochs_device *bochs)
index d6da848f7c6f46df6f305601cf4771415ad1b158..f53aa8f4a143eb840048e5dd502ab8fa3f637ab1 100644 (file)
@@ -236,8 +236,6 @@ struct ttm_bo_driver cirrus_bo_driver = {
        .verify_access = cirrus_bo_verify_access,
        .io_mem_reserve = &cirrus_ttm_io_mem_reserve,
        .io_mem_free = &cirrus_ttm_io_mem_free,
-       .lru_tail = &ttm_bo_default_lru_tail,
-       .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
 };
 
 int cirrus_mm_init(struct cirrus_device *cirrus)
index 3c6f750389fb07311c7ed11d1a4f8df66fbafc2f..20732b62d4c95d9e3d2b691a78b8965bbb0149c4 100644 (file)
@@ -243,8 +243,6 @@ struct ttm_bo_driver hibmc_bo_driver = {
        .verify_access          = hibmc_bo_verify_access,
        .io_mem_reserve         = &hibmc_ttm_io_mem_reserve,
        .io_mem_free            = NULL,
-       .lru_tail               = &ttm_bo_default_lru_tail,
-       .swap_lru_tail          = &ttm_bo_default_swap_lru_tail,
 };
 
 int hibmc_mm_init(struct hibmc_drm_private *hibmc)
index 5e20220ef4c6e9c5132c9dab0ee98006d32a23d9..657598bb1e6bcece8a1e4bb8734796e40f78cc59 100644 (file)
@@ -236,8 +236,6 @@ struct ttm_bo_driver mgag200_bo_driver = {
        .verify_access = mgag200_bo_verify_access,
        .io_mem_reserve = &mgag200_ttm_io_mem_reserve,
        .io_mem_free = &mgag200_ttm_io_mem_free,
-       .lru_tail = &ttm_bo_default_lru_tail,
-       .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
 };
 
 int mgag200_mm_init(struct mga_device *mdev)
index 2435183a625c6f8b374fffe63d9e6c9435d20c73..8a528ebe30f3c245de1d87c79ca5df35df717aff 100644 (file)
@@ -1571,8 +1571,6 @@ struct ttm_bo_driver nouveau_bo_driver = {
        .fault_reserve_notify = &nouveau_ttm_fault_reserve_notify,
        .io_mem_reserve = &nouveau_ttm_io_mem_reserve,
        .io_mem_free = &nouveau_ttm_io_mem_free,
-       .lru_tail = &ttm_bo_default_lru_tail,
-       .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
 };
 
 struct nvkm_vma *
index 4ecf97af29c4ef6d61cd372de0b8e8eea34e83ce..3dcc48431015d700a53c7835aff04d1a27240ed3 100644 (file)
@@ -394,8 +394,6 @@ static struct ttm_bo_driver qxl_bo_driver = {
        .io_mem_reserve = &qxl_ttm_io_mem_reserve,
        .io_mem_free = &qxl_ttm_io_mem_free,
        .move_notify = &qxl_bo_move_notify,
-       .lru_tail = &ttm_bo_default_lru_tail,
-       .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
 };
 
 int qxl_ttm_init(struct qxl_device *qdev)
index 1888144d0fed0ea5c977645d7c7e5c47cf26719b..7e3eb8e80095bc2777cd3b5fe8ada3f7ac7998dc 100644 (file)
@@ -871,8 +871,6 @@ static struct ttm_bo_driver radeon_bo_driver = {
        .fault_reserve_notify = &radeon_bo_fault_reserve_notify,
        .io_mem_reserve = &radeon_ttm_io_mem_reserve,
        .io_mem_free = &radeon_ttm_io_mem_free,
-       .lru_tail = &ttm_bo_default_lru_tail,
-       .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
 };
 
 int radeon_ttm_init(struct radeon_device *rdev)
index 0b287d8947a4a8366d109c7a07df2a4dc4e331e5..8c5c64d52af284310ff1e70b94d2bb3356c13955 100644 (file)
@@ -163,6 +163,7 @@ static void ttm_bo_release_list(struct kref *list_kref)
 void ttm_bo_add_to_lru(struct ttm_buffer_object *bo)
 {
        struct ttm_bo_device *bdev = bo->bdev;
+       struct ttm_mem_type_manager *man;
 
        lockdep_assert_held(&bo->resv->lock.base);
 
@@ -170,11 +171,13 @@ void ttm_bo_add_to_lru(struct ttm_buffer_object *bo)
 
                BUG_ON(!list_empty(&bo->lru));
 
-               list_add(&bo->lru, bdev->driver->lru_tail(bo));
+               man = &bdev->man[bo->mem.mem_type];
+               list_add_tail(&bo->lru, &man->lru[bo->priority]);
                kref_get(&bo->list_kref);
 
                if (bo->ttm && !(bo->ttm->page_flags & TTM_PAGE_FLAG_SG)) {
-                       list_add(&bo->swap, bdev->driver->swap_lru_tail(bo));
+                       list_add_tail(&bo->swap,
+                                     &bo->glob->swap_lru[bo->priority]);
                        kref_get(&bo->list_kref);
                }
        }
@@ -240,18 +243,6 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo)
 }
 EXPORT_SYMBOL(ttm_bo_move_to_lru_tail);
 
-struct list_head *ttm_bo_default_lru_tail(struct ttm_buffer_object *bo)
-{
-       return bo->bdev->man[bo->mem.mem_type].lru[bo->priority].prev;
-}
-EXPORT_SYMBOL(ttm_bo_default_lru_tail);
-
-struct list_head *ttm_bo_default_swap_lru_tail(struct ttm_buffer_object *bo)
-{
-       return bo->glob->swap_lru[bo->priority].prev;
-}
-EXPORT_SYMBOL(ttm_bo_default_swap_lru_tail);
-
 /*
  * Call bo->mutex locked.
  */
index 07b0de530cb9189b1cbb40bcc743d7258d0b7230..9cc7079f7acad025b89beae96c88c47eb45ec9b0 100644 (file)
@@ -434,8 +434,6 @@ static struct ttm_bo_driver virtio_gpu_bo_driver = {
        .io_mem_free = &virtio_gpu_ttm_io_mem_free,
        .move_notify = &virtio_gpu_bo_move_notify,
        .swap_notify = &virtio_gpu_bo_swap_notify,
-       .lru_tail = &ttm_bo_default_lru_tail,
-       .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
 };
 
 int virtio_gpu_ttm_init(struct virtio_gpu_device *vgdev)
index caa279b6b56ffa82c10b23495c1129b7a2b2d36f..1de96693f2a7699318a1917df1e2683c0ce65185 100644 (file)
@@ -859,6 +859,4 @@ struct ttm_bo_driver vmw_bo_driver = {
        .fault_reserve_notify = &vmw_ttm_fault_reserve_notify,
        .io_mem_reserve = &vmw_ttm_io_mem_reserve,
        .io_mem_free = &vmw_ttm_io_mem_free,
-       .lru_tail = &ttm_bo_default_lru_tail,
-       .swap_lru_tail = &ttm_bo_default_swap_lru_tail,
 };
index c8407e737542ac2b16f85346a76747d6839d3d0f..f1b243f112aaf16a4a3980d6167dfff25a076a42 100644 (file)
@@ -468,12 +468,6 @@ struct ttm_bo_driver {
         * Called with LRU lock held immediately before the removal.
         */
        void (*lru_removal)(struct ttm_buffer_object *bo);
-
-       /**
-        * Return the list_head after which a BO should be inserted in the LRU.
-        */
-       struct list_head *(*lru_tail)(struct ttm_buffer_object *bo);
-       struct list_head *(*swap_lru_tail)(struct ttm_buffer_object *bo);
 };
 
 /**
@@ -788,9 +782,6 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
 extern void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo);
 extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo);
 
-struct list_head *ttm_bo_default_lru_tail(struct ttm_buffer_object *bo);
-struct list_head *ttm_bo_default_swap_lru_tail(struct ttm_buffer_object *bo);
-
 /**
  * __ttm_bo_reserve:
  *