]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/ttm: fix ttm_bo_bulk_move_helper
authorChristian König <christian.koenig@amd.com>
Fri, 31 Aug 2018 13:06:35 +0000 (15:06 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Sun, 2 Sep 2018 15:16:32 +0000 (10:16 -0500)
Staring at the function for six hours, just to essentially move one line
of code. The problem was that the first list_cut_position call could result
in list2 pointing to la-la-land.

Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/ttm/ttm_bo.c

index 35d53d81f4868a4706c4d8fc34cb2775d4abfffe..138c98902033275f7452b2292cb3819edc98c460 100644 (file)
@@ -250,15 +250,18 @@ EXPORT_SYMBOL(ttm_bo_move_to_lru_tail);
 static void ttm_bo_bulk_move_helper(struct ttm_lru_bulk_move_pos *pos,
                                    struct list_head *lru, bool is_swap)
 {
+       struct list_head *list;
        LIST_HEAD(entries);
        LIST_HEAD(before);
-       struct list_head *list1, *list2;
 
-       list1 = is_swap ? &pos->last->swap : &pos->last->lru;
-       list2 = is_swap ? pos->first->swap.prev : pos->first->lru.prev;
+       reservation_object_assert_held(pos->last->resv);
+       list = is_swap ? &pos->last->swap : &pos->last->lru;
+       list_cut_position(&entries, lru, list);
+
+       reservation_object_assert_held(pos->first->resv);
+       list = is_swap ? pos->first->swap.prev : pos->first->lru.prev;
+       list_cut_position(&before, &entries, list);
 
-       list_cut_position(&entries, lru, list1);
-       list_cut_position(&before, &entries, list2);
        list_splice(&before, lru);
        list_splice_tail(&entries, lru);
 }