aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-01-06 13:16:07 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-01-27 12:20:32 -0500
commit2ee7fc92cfd327fe41377f64a7f04ddc30c851e7 (patch)
treebd078cc528801cf9a30e953e115d48eb32215af2
parent63d24f8846b0095cbbd94746b6fc8a6acbda8f5e (diff)
drm/ttm: remove allow_errors parameter from ttm_bo_force_list_clean
Not allowing errors here is completely pointless and actually dangerous cause trying to continue on an error can cause an endless loop. Reviewed-by: Sinclair Yeh <syeh@vmware.com> Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Roger.He <Hongbo.He@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index d4973e9c126e..89bbcf0300f4 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1291,7 +1291,7 @@ int ttm_bo_create(struct ttm_bo_device *bdev,
1291EXPORT_SYMBOL(ttm_bo_create); 1291EXPORT_SYMBOL(ttm_bo_create);
1292 1292
1293static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev, 1293static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
1294 unsigned mem_type, bool allow_errors) 1294 unsigned mem_type)
1295{ 1295{
1296 struct ttm_mem_type_manager *man = &bdev->man[mem_type]; 1296 struct ttm_mem_type_manager *man = &bdev->man[mem_type];
1297 struct ttm_bo_global *glob = bdev->glob; 1297 struct ttm_bo_global *glob = bdev->glob;
@@ -1306,13 +1306,8 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
1306 while (!list_empty(&man->lru)) { 1306 while (!list_empty(&man->lru)) {
1307 spin_unlock(&glob->lru_lock); 1307 spin_unlock(&glob->lru_lock);
1308 ret = ttm_mem_evict_first(bdev, mem_type, NULL, false, false); 1308 ret = ttm_mem_evict_first(bdev, mem_type, NULL, false, false);
1309 if (ret) { 1309 if (ret)
1310 if (allow_errors) { 1310 return ret;
1311 return ret;
1312 } else {
1313 pr_err("Cleanup eviction failed\n");
1314 }
1315 }
1316 spin_lock(&glob->lru_lock); 1311 spin_lock(&glob->lru_lock);
1317 } 1312 }
1318 spin_unlock(&glob->lru_lock); 1313 spin_unlock(&glob->lru_lock);
@@ -1324,13 +1319,8 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
1324 if (fence) { 1319 if (fence) {
1325 ret = dma_fence_wait(fence, false); 1320 ret = dma_fence_wait(fence, false);
1326 dma_fence_put(fence); 1321 dma_fence_put(fence);
1327 if (ret) { 1322 if (ret)
1328 if (allow_errors) { 1323 return ret;
1329 return ret;
1330 } else {
1331 pr_err("Cleanup eviction failed\n");
1332 }
1333 }
1334 } 1324 }
1335 1325
1336 return 0; 1326 return 0;
@@ -1359,7 +1349,11 @@ int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type)
1359 1349
1360 ret = 0; 1350 ret = 0;
1361 if (mem_type > 0) { 1351 if (mem_type > 0) {
1362 ttm_bo_force_list_clean(bdev, mem_type, false); 1352 ret = ttm_bo_force_list_clean(bdev, mem_type);
1353 if (ret) {
1354 pr_err("Cleanup eviction failed\n");
1355 return ret;
1356 }
1363 1357
1364 ret = (*man->func->takedown)(man); 1358 ret = (*man->func->takedown)(man);
1365 } 1359 }
@@ -1382,7 +1376,7 @@ int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type)
1382 return 0; 1376 return 0;
1383 } 1377 }
1384 1378
1385 return ttm_bo_force_list_clean(bdev, mem_type, true); 1379 return ttm_bo_force_list_clean(bdev, mem_type);
1386} 1380}
1387EXPORT_SYMBOL(ttm_bo_evict_mm); 1381EXPORT_SYMBOL(ttm_bo_evict_mm);
1388 1382