drm/msm: Fix premature purging of BO
authorAkhil P Oommen <akhilpo@codeaurora.org>
Tue, 22 Sep 2020 14:55:26 +0000 (20:25 +0530)
committerRob Clark <robdclark@chromium.org>
Tue, 22 Sep 2020 15:28:15 +0000 (08:28 -0700)
commit9d8baa2bf224f6f010644b2a60a3ca73d829663e
treebf46923902182a442cd8a3f814901a3ba351465e
parentca9b38e6d671616e95bdf247cf5ded269e3f3fb9
drm/msm: Fix premature purging of BO

In the case where we have a back-to-back submission that shares the same
BO, this BO will be prematurely moved to inactive_list while retiring the
first submit. But it will be still part of the second submit which is
being processed by the GPU. Now, if the shrinker happens to be triggered at
this point, it will result in a premature purging of this BO.

To fix this, we need to refcount BO while doing submit and retire. Then,
it should be moved to inactive list when this refcount becomes 0.

Signed-off-by: Akhil P Oommen <akhilpo@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/msm_drv.h
drivers/gpu/drm/msm/msm_gem.c
drivers/gpu/drm/msm/msm_gem.h
drivers/gpu/drm/msm/msm_gpu.c