Skip to content

Commit 2a269ba

Browse files
Shiwu ZhangChristianKoenigAMD
authored andcommitted
drm/ttm: fix error handling if no BO can be swapped out v4
In case that all pre-allocated BOs are busy, just continue to populate BOs since likely half of system memory in total is still free. v4 (chk): fix code moved to VMWGFX as well Signed-off-by: Shiwu Zhang <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Christian König <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a4394b6 commit 2a269ba

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

drivers/gpu/drm/ttm/ttm_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ int ttm_global_swapout(struct ttm_operation_ctx *ctx, gfp_t gfp_flags)
112112
{
113113
struct ttm_global *glob = &ttm_glob;
114114
struct ttm_device *bdev;
115-
int ret = -EBUSY;
115+
int ret = 0;
116116

117117
mutex_lock(&ttm_global_mutex);
118118
list_for_each_entry(bdev, &glob->device_list, device_list) {

drivers/gpu/drm/ttm/ttm_tt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@ int ttm_tt_populate(struct ttm_device *bdev,
329329
ttm_dma32_pages_limit) {
330330

331331
ret = ttm_global_swapout(ctx, GFP_KERNEL);
332+
if (ret == 0)
333+
break;
332334
if (ret < 0)
333335
goto error;
334336
}

drivers/gpu/drm/vmwgfx/ttm_memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ static void ttm_shrink(struct ttm_mem_global *glob, bool from_wq,
280280
spin_unlock(&glob->lock);
281281
ret = ttm_global_swapout(ctx, GFP_KERNEL);
282282
spin_lock(&glob->lock);
283-
if (unlikely(ret < 0))
283+
if (unlikely(ret <= 0))
284284
break;
285285
}
286286

0 commit comments

Comments
 (0)