All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/vblank: Use u32 consistently for vblank counters
@ 2015-08-07 10:31 Daniel Vetter
  2015-08-07 11:56 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Vetter @ 2015-08-07 10:31 UTC (permalink / raw)
  To: Intel Graphics Development, DRI Development
  Cc: Daniel Vetter, Michel Dänzer, Daniel Vetter

In

commit 99264a61dfcda41d86d0960cf2d4c0fc2758a773
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Apr 15 19:34:43 2015 +0200

    drm/vblank: Fixup and document timestamp update/read barriers

I've switched vblank->count from atomic_t to unsigned long and
accidentally created an integer comparison bug in
drm_vblank_count_and_time since vblanke->count might overflow the u32
local copy and hence the retry loop never succeed.

Fix this by consistently using u32.

Cc: Michel Dänzer <michel@daenzer.net>
Reported-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_irq.c | 2 +-
 include/drm/drmP.h        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index a7311c6e6f30..a2cfd2cc8c39 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -75,7 +75,7 @@ module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600)
 module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600);
 
 static void store_vblank(struct drm_device *dev, int crtc,
-			 unsigned vblank_count_inc,
+			 u32 vblank_count_inc,
 			 struct timeval *t_vblank)
 {
 	struct drm_vblank_crtc *vblank = &dev->vblank[crtc];
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index fdf8a501cb44..38e0e77d7277 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -691,7 +691,7 @@ struct drm_vblank_crtc {
 	struct timer_list disable_timer;		/* delayed disable timer */
 
 	/* vblank counter, protected by dev->vblank_time_lock for writes */
-	unsigned long count;
+	u32 count;
 	/* vblank timestamps, protected by dev->vblank_time_lock for writes */
 	struct timeval time[DRM_VBLANKTIME_RBSIZE];
 
-- 
2.5.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/vblank: Use u32 consistently for vblank counters
  2015-08-07 10:31 [PATCH] drm/vblank: Use u32 consistently for vblank counters Daniel Vetter
@ 2015-08-07 11:56 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2015-08-07 11:56 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Daniel Vetter, Intel Graphics Development, Michel Dänzer,
	DRI Development


[-- Attachment #1.1: Type: text/plain, Size: 926 bytes --]

On Fri, Aug 07, 2015 at 12:31:17PM +0200, Daniel Vetter wrote:
> In
> 
> commit 99264a61dfcda41d86d0960cf2d4c0fc2758a773
> Author: Daniel Vetter <daniel.vetter@ffwll.ch>
> Date:   Wed Apr 15 19:34:43 2015 +0200
> 
>     drm/vblank: Fixup and document timestamp update/read barriers
> 
> I've switched vblank->count from atomic_t to unsigned long and
> accidentally created an integer comparison bug in
> drm_vblank_count_and_time since vblanke->count might overflow the u32
> local copy and hence the retry loop never succeed.
> 
> Fix this by consistently using u32.
> 
> Cc: Michel Dänzer <michel@daenzer.net>
> Reported-by: Michel Dänzer <michel@daenzer.net>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/drm_irq.c | 2 +-
>  include/drm/drmP.h        | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2015-08-07 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-07 10:31 [PATCH] drm/vblank: Use u32 consistently for vblank counters Daniel Vetter
2015-08-07 11:56 ` Thierry Reding

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.