linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/amd: fix race in page flip job
@ 2018-12-21  3:10 Yu Zhao
  2018-12-21  3:10 ` [PATCH 2/3] drm/amd: validate user pitch alignment Yu Zhao
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Yu Zhao @ 2018-12-21  3:10 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Christian König, Alex Deucher
  Cc: David Zhou, Samuel Li, Harry Wentland, Junwei Zhang,
	Daniel Stone, amd-gfx, dri-devel, linux-kernel, Yu Zhao

Fix race between page flip job submission and completion. We invoke
page_flip callback to submit page flip job to GPU first and then set
pflip_status. If GPU fires page flip done irq in between, its handler
won't see the correct pflip_status thus will refuse to notify the job
completion. The job will eventually times out.

Reverse the order of calling page_flip and setting pflip_status to
fix the race.

Signed-off-by: Yu Zhao <yuzhao@google.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 686a26de50f9..e309d26170db 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -105,11 +105,11 @@ static void amdgpu_display_flip_work_func(struct work_struct *__work)
 	/* We borrow the event spin lock for protecting flip_status */
 	spin_lock_irqsave(&crtc->dev->event_lock, flags);
 
+	/* Set the flip status */
+	amdgpu_crtc->pflip_status = AMDGPU_FLIP_SUBMITTED;
 	/* Do the flip (mmio) */
 	adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base, work->async);
 
-	/* Set the flip status */
-	amdgpu_crtc->pflip_status = AMDGPU_FLIP_SUBMITTED;
 	spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 
 
-- 
2.20.1.415.g653613c723-goog


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

end of thread, other threads:[~2019-01-08 15:25 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-21  3:10 [PATCH 1/3] drm/amd: fix race in page flip job Yu Zhao
2018-12-21  3:10 ` [PATCH 2/3] drm/amd: validate user pitch alignment Yu Zhao
2018-12-21  9:04   ` Michel Dänzer
2018-12-21  9:07   ` Michel Dänzer
2018-12-21 19:41     ` Yu Zhao
2018-12-23 21:44     ` Yu Zhao
2018-12-27 11:54       ` Michel Dänzer
2018-12-21 19:47   ` [PATCH v2 1/2] " Yu Zhao
2018-12-21 19:47     ` [PATCH v2 2/2] drm/amd: validate user GEM object size Yu Zhao
2018-12-22  9:40       ` kbuild test robot
2018-12-23  7:46       ` kbuild test robot
2018-12-22 19:27     ` [PATCH v3 1/2] drm/amd: validate user pitch alignment Yu Zhao
2018-12-22 19:27       ` [PATCH v3 2/2] drm/amd: validate user GEM object size Yu Zhao
2018-12-23 21:52       ` [PATCH v4 1/2] drm/amd: validate user pitch alignment Yu Zhao
2018-12-23 21:52         ` [PATCH v4 2/2] drm/amd: validate user GEM object size Yu Zhao
2018-12-30  1:00           ` [PATCH v5 1/2] drm/amd: validate user pitch alignment Yu Zhao
2018-12-30  1:00             ` [PATCH v5 2/2] drm/amd: validate user GEM object size Yu Zhao
2019-01-03 16:33             ` [PATCH v5 1/2] drm/amd: validate user pitch alignment Michel Dänzer
2019-01-07  4:00               ` Yu Zhao
2019-01-07  9:54                 ` Michel Dänzer
2019-01-07 22:51             ` [PATCH v6 " Yu Zhao
2019-01-07 22:51               ` [PATCH v6 2/2] drm/amd: validate user GEM object size Yu Zhao
2019-01-08 15:25               ` [PATCH v6 1/2] drm/amd: validate user pitch alignment Michel Dänzer
2018-12-21  3:10 ` [PATCH 3/3] drm/amd: validate user GEM object size Yu Zhao
2018-12-21  9:09   ` Michel Dänzer
2018-12-22  4:51   ` kbuild test robot
2018-12-21  8:56 ` [PATCH 1/3] drm/amd: fix race in page flip job Michel Dänzer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).