]> git.baikalelectronics.ru Git - kernel.git/commit
drm/ttm: Fix a deadlock if the target BO is not idle during swap
authorxinhui pan <xinhui.pan@amd.com>
Tue, 7 Sep 2021 04:08:32 +0000 (12:08 +0800)
committerDave Airlie <airlied@redhat.com>
Fri, 10 Sep 2021 06:18:53 +0000 (16:18 +1000)
commit5db233bb267188a11b7aabb2847efb707b3e9a5b
treec4a7f3427150fa6952d607f08a0361a86301ffe0
parent14e2bc298cb6295e130aebb784a59d26d146018c
drm/ttm: Fix a deadlock if the target BO is not idle during swap

The ret value might be -EBUSY, caller will think lru lock is still
locked but actually NOT. So return -ENOSPC instead. Otherwise we hit
list corruption.

ttm_bo_cleanup_refs might fail too if BO is not idle. If we return 0,
caller(ttm_tt_populate -> ttm_global_swapout ->ttm_device_swapout) will
be stuck as we actually did not free any BO memory. This usually happens
when the fence is not signaled for a long time.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Fixes: bae0bb5cb9c3 ("drm/ttm: move swapout logic around v3")
Link: https://patchwork.freedesktop.org/patch/msgid/20210907040832.1107747-1-xinhui.pan@amd.com
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/ttm/ttm_bo.c