* [PATCH 1/2] drm/amdgpu: Fix error handling in amdgpu_flip_work_func.
@ 2016-03-01 20:31 Mario Kleiner
2016-03-01 20:31 ` [PATCH 2/2] drm/radeon: Fix error handling in radeon_flip_work_func Mario Kleiner
2016-03-05 8:00 ` [PATCH 1/2] drm/amdgpu: Fix error handling in amdgpu_flip_work_func Michel Dänzer
0 siblings, 2 replies; 4+ messages in thread
From: Mario Kleiner @ 2016-03-01 20:31 UTC (permalink / raw)
To: dri-devel
Cc: dan.carpenter, Mario Kleiner, stable, Michel Dänzer,
Alex Deucher
The patch e1d09dc0ccc6: "drm/amdgpu: Don't hang in
amdgpu_flip_work_func on disabled crtc." from Feb 19, 2016, leads to
the following static checker warning, as reported by Dan Carpenter in
https://lists.freedesktop.org/archives/dri-devel/2016-February/101987.html
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:127 amdgpu_flip_work_func() warn: should this be 'repcnt == -1'
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:136 amdgpu_flip_work_func() error: double unlock 'spin_lock:&crtc->dev->event_lock'
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:136 amdgpu_flip_work_func() error: double unlock 'irqsave:flags'
This patch fixes both reported problems:
Change post-decrement of repcnt to pre-decrement, so
it can't underflow anymore, but still performs up to
three repetitions - three is the maximum one could
expect in practice.
Move the spin_unlock_irqrestore to where it actually
belongs.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: <stable@vger.kernel.org> # 4.4+
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.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 8297bc3..1846d65 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -96,7 +96,7 @@ static void amdgpu_flip_work_func(struct work_struct *__work)
* In practice this won't execute very often unless on very fast
* machines because the time window for this to happen is very small.
*/
- while (amdgpuCrtc->enabled && repcnt--) {
+ while (amdgpuCrtc->enabled && --repcnt) {
/* GET_DISTANCE_TO_VBLANKSTART returns distance to real vblank
* start in hpos, and to the "fudged earlier" vblank start in
* vpos.
@@ -112,13 +112,13 @@ static void amdgpu_flip_work_func(struct work_struct *__work)
break;
/* Sleep at least until estimated real start of hw vblank */
- spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
min_udelay = (-hpos + 1) * max(vblank->linedur_ns / 1000, 5);
if (min_udelay > vblank->framedur_ns / 2000) {
/* Don't wait ridiculously long - something is wrong */
repcnt = 0;
break;
}
+ spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
usleep_range(min_udelay, 2 * min_udelay);
spin_lock_irqsave(&crtc->dev->event_lock, flags);
};
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drm/radeon: Fix error handling in radeon_flip_work_func.
2016-03-01 20:31 [PATCH 1/2] drm/amdgpu: Fix error handling in amdgpu_flip_work_func Mario Kleiner
@ 2016-03-01 20:31 ` Mario Kleiner
2016-03-05 8:00 ` [PATCH 1/2] drm/amdgpu: Fix error handling in amdgpu_flip_work_func Michel Dänzer
1 sibling, 0 replies; 4+ messages in thread
From: Mario Kleiner @ 2016-03-01 20:31 UTC (permalink / raw)
To: dri-devel
Cc: dan.carpenter, Mario Kleiner, stable, Michel Dänzer,
Alex Deucher
This is a port of the patch "drm/amdgpu: Fix error handling in amdgpu_flip_work_func."
to fix the following problem for radeon as well which was
reported against amdgpu:
The patch e1d09dc0ccc6: "drm/amdgpu: Don't hang in
amdgpu_flip_work_func on disabled crtc." from Feb 19, 2016, leads to
the following static checker warning, as reported by Dan Carpenter in
https://lists.freedesktop.org/archives/dri-devel/2016-February/101987.html
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:127 amdgpu_flip_work_func() warn: should this be 'repcnt == -1'
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:136 amdgpu_flip_work_func() error: double unlock 'spin_lock:&crtc->dev->event_lock'
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:136 amdgpu_flip_work_func() error: double unlock 'irqsave:flags'
This patch fixes both reported problems:
Change post-decrement of repcnt to pre-decrement, so
it can't underflow anymore, but still performs up to
three repetitions - three is the maximum one could
expect in practice.
Move the spin_unlock_irqrestore to where it actually
belongs.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: <stable@vger.kernel.org> # 4.4+
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/radeon/radeon_display.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 1fab4b9..bfcef4d 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -455,7 +455,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
* In practice this won't execute very often unless on very fast
* machines because the time window for this to happen is very small.
*/
- while (radeon_crtc->enabled && repcnt--) {
+ while (radeon_crtc->enabled && --repcnt) {
/* GET_DISTANCE_TO_VBLANKSTART returns distance to real vblank
* start in hpos, and to the "fudged earlier" vblank start in
* vpos.
@@ -471,13 +471,13 @@ static void radeon_flip_work_func(struct work_struct *__work)
break;
/* Sleep at least until estimated real start of hw vblank */
- spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
min_udelay = (-hpos + 1) * max(vblank->linedur_ns / 1000, 5);
if (min_udelay > vblank->framedur_ns / 2000) {
/* Don't wait ridiculously long - something is wrong */
repcnt = 0;
break;
}
+ spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
usleep_range(min_udelay, 2 * min_udelay);
spin_lock_irqsave(&crtc->dev->event_lock, flags);
};
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] drm/amdgpu: Fix error handling in amdgpu_flip_work_func.
2016-03-01 20:31 [PATCH 1/2] drm/amdgpu: Fix error handling in amdgpu_flip_work_func Mario Kleiner
2016-03-01 20:31 ` [PATCH 2/2] drm/radeon: Fix error handling in radeon_flip_work_func Mario Kleiner
@ 2016-03-05 8:00 ` Michel Dänzer
2016-03-05 17:32 ` Alex Deucher
1 sibling, 1 reply; 4+ messages in thread
From: Michel Dänzer @ 2016-03-05 8:00 UTC (permalink / raw)
To: Mario Kleiner, Alex Deucher; +Cc: dan.carpenter, dri-devel
On 02.03.2016 05:31, Mario Kleiner wrote:
> The patch e1d09dc0ccc6: "drm/amdgpu: Don't hang in
> amdgpu_flip_work_func on disabled crtc." from Feb 19, 2016, leads to
> the following static checker warning, as reported by Dan Carpenter in
> https://lists.freedesktop.org/archives/dri-devel/2016-February/101987.html
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:127 amdgpu_flip_work_func() warn: should this be 'repcnt == -1'
> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:136 amdgpu_flip_work_func() error: double unlock 'spin_lock:&crtc->dev->event_lock'
> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:136 amdgpu_flip_work_func() error: double unlock 'irqsave:flags'
>
> This patch fixes both reported problems:
>
> Change post-decrement of repcnt to pre-decrement, so
> it can't underflow anymore, but still performs up to
> three repetitions - three is the maximum one could
> expect in practice.
>
> Move the spin_unlock_irqrestore to where it actually
> belongs.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
> Cc: <stable@vger.kernel.org> # 4.4+
> Cc: Michel Dänzer <michel.daenzer@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
Both patches are
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Alex, these should go into 4.5 if at all possible.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] drm/amdgpu: Fix error handling in amdgpu_flip_work_func.
2016-03-05 8:00 ` [PATCH 1/2] drm/amdgpu: Fix error handling in amdgpu_flip_work_func Michel Dänzer
@ 2016-03-05 17:32 ` Alex Deucher
0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2016-03-05 17:32 UTC (permalink / raw)
To: Michel Dänzer
Cc: Alex Deucher, Maling list - DRI developers, Dan Carpenter
On Sat, Mar 5, 2016 at 3:00 AM, Michel Dänzer <michel@daenzer.net> wrote:
> On 02.03.2016 05:31, Mario Kleiner wrote:
>> The patch e1d09dc0ccc6: "drm/amdgpu: Don't hang in
>> amdgpu_flip_work_func on disabled crtc." from Feb 19, 2016, leads to
>> the following static checker warning, as reported by Dan Carpenter in
>> https://lists.freedesktop.org/archives/dri-devel/2016-February/101987.html
>>
>> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:127 amdgpu_flip_work_func() warn: should this be 'repcnt == -1'
>> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:136 amdgpu_flip_work_func() error: double unlock 'spin_lock:&crtc->dev->event_lock'
>> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:136 amdgpu_flip_work_func() error: double unlock 'irqsave:flags'
>>
>> This patch fixes both reported problems:
>>
>> Change post-decrement of repcnt to pre-decrement, so
>> it can't underflow anymore, but still performs up to
>> three repetitions - three is the maximum one could
>> expect in practice.
>>
>> Move the spin_unlock_irqrestore to where it actually
>> belongs.
>>
>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>> Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
>> Cc: <stable@vger.kernel.org> # 4.4+
>> Cc: Michel Dänzer <michel.daenzer@amd.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>
> Both patches are
>
> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
>
>
> Alex, these should go into 4.5 if at all possible.
Yup, Added to my 4.5 fixes tree.
Alex
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-05 17:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-01 20:31 [PATCH 1/2] drm/amdgpu: Fix error handling in amdgpu_flip_work_func Mario Kleiner
2016-03-01 20:31 ` [PATCH 2/2] drm/radeon: Fix error handling in radeon_flip_work_func Mario Kleiner
2016-03-05 8:00 ` [PATCH 1/2] drm/amdgpu: Fix error handling in amdgpu_flip_work_func Michel Dänzer
2016-03-05 17:32 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.