Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/ttm: fix ttm_bo_swapout

Commit 7120a447c7fe ("drm/ttm: Double check mem_type of BO while eviction")
made ttm_bo_evict_swapout_allowable() function actually check the
placement, but we always used a dummy placement in ttm_bo_swapout.

Fix this by using the real placement instead.

Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: 7120a447c7fe ("drm/ttm: Double check mem_type of BO while eviction")
Reviewed-by: Pan, Xinhui <Xinhui.Pan@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211202103828.44573-1-christian.koenig@amd.com

+2 -1
+2 -1
drivers/gpu/drm/ttm/ttm_bo.c
··· 1103 1103 * as an indication that we're about to swap out. 1104 1104 */ 1105 1105 memset(&place, 0, sizeof(place)); 1106 - place.mem_type = TTM_PL_SYSTEM; 1106 + place.mem_type = bo->resource->mem_type; 1107 1107 if (!ttm_bo_evict_swapout_allowable(bo, ctx, &place, &locked, NULL)) 1108 1108 return -EBUSY; 1109 1109 ··· 1135 1135 struct ttm_place hop; 1136 1136 1137 1137 memset(&hop, 0, sizeof(hop)); 1138 + place.mem_type = TTM_PL_SYSTEM; 1138 1139 ret = ttm_resource_alloc(bo, &place, &evict_mem); 1139 1140 if (unlikely(ret)) 1140 1141 goto out;