drm/msm: Refcount submits
authorRob Clark <robdclark@chromium.org>
Fri, 23 Oct 2020 16:51:17 +0000 (09:51 -0700)
committerRob Clark <robdclark@chromium.org>
Thu, 5 Nov 2020 00:00:56 +0000 (16:00 -0800)
commit964d2f97e74b3951973bc22d8a5547f6c0d505b4
treea6daa7c193ec0075675d9459ec4d00ed941c2c63
parent77d205290aa944895cf7e8bea500b8fd95a6b05b
drm/msm: Refcount submits

Before we remove dev->struct_mutex from the retire path, we have to deal
with the situation of a submit retiring before the submit ioctl returns.

To deal with this, ring->submits will hold a reference to the submit,
which is dropped when the submit is retired.  And the submit ioctl path
holds it's own ref, which it drops when it is done with the submit.

Also, add to submit list *after* getting/pinning bo's, to prevent badness
in case the completed fence is corrupted, and retire_worker mistakenly
believes the submit is done too early.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/msm_drv.h
drivers/gpu/drm/msm/msm_gem.h
drivers/gpu/drm/msm/msm_gem_submit.c
drivers/gpu/drm/msm/msm_gpu.c