Skip to contentSkip to conversation

drm/ttm: wait for eviction in ttm_bo_force_list_clean

PATCH In review Christian König 2 participants 2 messages Jun 22, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ttm: wait for eviction in ttm_bo_force_list_clean

From: Christian König <[email protected]>

Now that we can pipeline evictions we need to wait for them to finish when we cleanup a memory domain.

---
 drivers/gpu/drm/ttm/ttm_bo.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/ttm/ttm_bo.c +18 -0
index 5d93169..e340d0d6 100644
@@ -1287,6 +1287,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
 {
 	struct ttm_mem_type_manager *man = &bdev->man[mem_type];
 	struct ttm_bo_global *glob = bdev->glob;
+	struct fence *fence;
 	int ret;
 
 	/*
@@ -1307,6 +1308,23 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
 		spin_lock(&glob->lru_lock);
 	}
 	spin_unlock(&glob->lru_lock);
+
+	spin_lock(&man->move_lock);
+	fence = fence_get(man->move);
+	spin_unlock(&man->move_lock);
+
+	if (fence) {
+		ret = fence_wait(fence, false);
+		fence_put(fence);
+		if (ret) {
+			if (allow_errors) {
+				return ret;
+			} else {
+				pr_err("Cleanup eviction failed\n");
+			}
+		}
+	}
+
 	return 0;
 }
 
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Christian König

From: Christian König <[email protected]>

Now that we can pipeline evictions we need to wait for them to finish when we cleanup a memory domain.

Quoted 43 lines
---
 drivers/gpu/drm/ttm/ttm_bo.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/ttm/ttm_bo.c +18 -1
index 5d93169..e340d0d6 100644
@@ -1287,6 +1287,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
 {
        struct ttm_mem_type_manager *man = &bdev->man[mem_type];
        struct ttm_bo_global *glob = bdev->glob;
+       struct fence *fence;
        int ret;
 
        /*
@@ -1307,6 +1308,23 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
                spin_lock(&glob->lru_lock);
        }
        spin_unlock(&glob->lru_lock);
+
+       spin_lock(&man->move_lock);
+       fence = fence_get(man->move);
+       spin_unlock(&man->move_lock);
+
+       if (fence) {
+               ret = fence_wait(fence, false);
+               fence_put(fence);
+               if (ret) {
+                       if (allow_errors) {
+                               return ret;
+                       } else {
+                               pr_err("Cleanup eviction failed\n");
+                       }
+               }
+       }
+
        return 0;
 }
 
--

2.5.0

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel