drm/amd/display: Detect and disallow idle reallow during reentrancy
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Mon, 26 Feb 2024 19:29:05 +0000 (14:29 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 22 Mar 2024 19:49:29 +0000 (15:49 -0400)
commit93ddf00f874c26e078ba01010bc126f521d49e7f
tree128c8121052936638f71621b1371476157fe02c4
parent398a16e1f03b6b583b94c7ab080aa38432fb0502
drm/amd/display: Detect and disallow idle reallow during reentrancy

[Why]
Cursor updates can be preempted by queued flips in some DMs.

The synchronization model causes this to occur within the same thread
at an intermediate level when we insert logs into the OS queue.

Since this occurs on the same thread and we're still holding the lock
(recursively) the cache is coherent.

The exit sequence will run twice since we technically haven't finished
the exit the first time, so we need a way to detect and avoid the
reallow in the middle of this call to prevent the hang on the cursor
update that was preempted.

[How]
Keep a counter that tracks the depth of the exit calls. Do not reallow
until the counter is zero.

Reviewed-by: Duncan Ma <duncan.ma@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h