Commit 178b0013 authored by Daniel Vetter's avatar Daniel Vetter Committed by Alex Deucher

drm/amdgpu/dc: Stop dma_resv_lock inversion in commit_tail

Trying to grab dma_resv_lock while in commit_tail before we've done
all the code that leads to the eventual signalling of the vblank event
(which can be a dma_fence) is deadlock-y. Don't do that.

Here the solution is easy because just grabbing locks to read
something races anyway. We don't need to bother, READ_ONCE is
equivalent. And avoids the locking issue.

v2: Also take into account tmz_surface boolean, plus just delete the
old code.

Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: linux-rdma@vger.kernel.org
Cc: amd-gfx@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 317469f6
...@@ -7081,20 +7081,13 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, ...@@ -7081,20 +7081,13 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
DRM_ERROR("Waiting for fences timed out!"); DRM_ERROR("Waiting for fences timed out!");
/* /*
* TODO This might fail and hence better not used, wait * We cannot reserve buffers here, which means the normal flag
* explicitly on fences instead * access functions don't work. Paper over this with READ_ONCE,
* and in general should be called for * but maybe the flags are invariant enough that not even that
* blocking commit to as per framework helpers * would be needed.
*/ */
r = amdgpu_bo_reserve(abo, true); tiling_flags = READ_ONCE(abo->tiling_flags);
if (unlikely(r != 0)) tmz_surface = READ_ONCE(abo->flags) & AMDGPU_GEM_CREATE_ENCRYPTED;
DRM_ERROR("failed to reserve buffer before flip\n");
amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
tmz_surface = amdgpu_bo_encrypted(abo);
amdgpu_bo_unreserve(abo);
fill_dc_plane_info_and_addr( fill_dc_plane_info_and_addr(
dm->adev, new_plane_state, tiling_flags, dm->adev, new_plane_state, tiling_flags,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment