[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181221031053.240161-1-yuzhao@google.com>
Date: Thu, 20 Dec 2018 20:10:51 -0700
From: Yu Zhao <yuzhao@...gle.com>
To: David Airlie <airlied@...ux.ie>, Daniel Vetter <daniel@...ll.ch>,
Christian König <christian.koenig@....com>,
Alex Deucher <alexander.deucher@....com>
Cc: David Zhou <David1.Zhou@....com>, Samuel Li <Samuel.Li@....com>,
Harry Wentland <harry.wentland@....com>,
Junwei Zhang <Jerry.Zhang@....com>,
Daniel Stone <daniels@...labora.com>,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, Yu Zhao <yuzhao@...gle.com>
Subject: [PATCH 1/3] drm/amd: fix race in page flip job
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@...gle.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
Powered by blists - more mailing lists