aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorxinhui pan <xinhui.pan@amd.com>2021-11-10 12:31:49 +0800
committerChristian König <christian.koenig@amd.com>2021-11-11 09:08:08 +0100
commit7120a447c7fe37a123ab7a63afefdbf0787b9002 (patch)
tree9f8f26aff1373e05b2e150f5384cd0eb178ebaa5 /drivers
parentdrm/nouveau: clean up all clients on device removal (diff)
downloadlinux-dev-7120a447c7fe37a123ab7a63afefdbf0787b9002.tar.xz
linux-dev-7120a447c7fe37a123ab7a63afefdbf0787b9002.zip
drm/ttm: Double check mem_type of BO while eviction
BO might sit in a wrong lru list as there is a small period of memory moving and lru list updating. Lets skip eviction if we hit such mismatch. Suggested-by: Christian König <christian.koenig@amd.com> Signed-off-by: xinhui pan <xinhui.pan@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211110043149.57554-2-xinhui.pan@amd.com Signed-off-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index bb9e02c31946..1ddf458aed71 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -617,7 +617,8 @@ static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo,
*busy = !ret;
}
- if (ret && place && !bo->bdev->funcs->eviction_valuable(bo, place)) {
+ if (ret && place && (bo->resource->mem_type != place->mem_type ||
+ !bo->bdev->funcs->eviction_valuable(bo, place))) {
ret = false;
if (*locked) {
dma_resv_unlock(bo->base.resv);