[PATCH] drm/ttm: fix ttm_bo_unreserve
Kuehling, Felix
Felix.Kuehling at amd.com
Tue Jun 4 18:46:43 UTC 2019
On 2019-06-04 11:23, Christian König wrote:
> Since we now keep BOs on the LRU we need to make sure
> that they are removed when they are pinned.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
> include/drm/ttm/ttm_bo_driver.h | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> index 9f54cf9c60df..c9b8ba492f24 100644
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -767,14 +767,12 @@ static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo,
> */
> static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo)
> {
> - if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
> - spin_lock(&bo->bdev->glob->lru_lock);
> - if (list_empty(&bo->lru))
> - ttm_bo_add_to_lru(bo);
> - else
> - ttm_bo_move_to_lru_tail(bo, NULL);
> - spin_unlock(&bo->bdev->glob->lru_lock);
> - }
> + spin_lock(&bo->bdev->glob->lru_lock);
> + if (list_empty(&bo->lru))
> + ttm_bo_add_to_lru(bo);
> + else
> + ttm_bo_move_to_lru_tail(bo, NULL);
Going just by the function names, this seems to do the exact opposite of
what the change description says.
Anway, this patch is Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>
BTW, this fix is needed for KFD. It fixes our eviction test that was
broken by your previous patch series. This test specifically triggers
interactions between KFD and graphics under memory pressure. It's
something we rarely see in real world compute application testing
without a targeted test. But when it breaks it leads to some painful
intermittent failures that are hard to regress and debug.
Do you have any targeted tests to trigger evictions when you work on TTM
internals?
Regards,
Felix
> + spin_unlock(&bo->bdev->glob->lru_lock);
> reservation_object_unlock(bo->resv);
> }
>
More information about the amd-gfx
mailing list