AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: move the nonblocking commit helpers appropriately
@ 2018-09-24 13:31 Shirish S
       [not found] ` <1537795907-1168-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Shirish S @ 2018-09-24 13:31 UTC (permalink / raw)
  To: harry.wentland-5C7GfCeVMHo, sunpeng.li-5C7GfCeVMHo
  Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Shirish S

[Why]
In multi-monitor scenario, if first crtc's flip done event occurs delayed
(but within timeout), due to non-blocking design of commit_tail(), there
are more than one commit's scheduled by the time the second crtc's
wait_for_completion_timeout() is called in drm_atomic_helper_wait_for_flip_done.

Due to these in-between additions and deletions in the atomic state, it is
found that the system fails while accessing common data structures of the
second crtc in drm_atomic_helper_wait_for_flip_done(), leading to crash as
below:

	BUG: unable to handle kernel paging request at 000000010000001c
	IP: do_raw_spin_lock+0xf/0x94
	PGD 0 P4D 0
	Oops: 0000 [#1] PREEMPT SMP NOPTI
	Call Trace:
	 __wait_for_common+0x36/0x60
	 drm_atomic_helper_wait_for_flip_done+0x47/0x89
	 amdgpu_dm_atomic_commit_tail+0xf4b/0xf84
	 ? drm_atomic_helper_wait_for_dependencies+0x1cd/0x217
	 commit_tail+0x41/0x5f

[How]
Move drm_atomic_helper_commit_hw_done() post wait_for_flip_done(),
which cleans up the atomic state's commit and completes pending hw_done and
flip_done works as a result there wont be dangling flip waits on random commits.

Signed-off-by: Shirish S <shirish.s@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 0f10d92..41a1958 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4626,12 +4626,17 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
 	}
 	spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
 
-	/* Signal HW programming completion */
-	drm_atomic_helper_commit_hw_done(state);
 
 	if (wait_for_vblank)
 		drm_atomic_helper_wait_for_flip_done(dev, state);
 
+	/* Atomic state pointer gets corrupted in case of frequent
+	 * modesets operations like changing resolutions.
+	 * Hence discard state->commit before signalling to user
+	 * space.
+	 */
+	drm_atomic_helper_commit_hw_done(state);
+
 	drm_atomic_helper_cleanup_planes(dev, state);
 
 	/*
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-02 14:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-24 13:31 [PATCH] drm/amd/display: move the nonblocking commit helpers appropriately Shirish S
     [not found] ` <1537795907-1168-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
2018-09-28 13:16   ` [PATCH] drm/amd/display: Work around race beetween hw_done and wait_for_flip Harry Wentland
     [not found]     ` <20180928131606.15931-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
2018-10-01  9:06       ` S, Shirish
2018-10-01 23:26   ` [PATCH v2] drm/amd/display: Signal hw_done() after waiting for flip_done() sunpeng.li-5C7GfCeVMHo
     [not found]     ` <1538436399-28084-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2018-10-02 14:41       ` Harry Wentland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox