dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: Convert cmpxchg(bool) back to a two step operation
@ 2017-03-30 14:08 Chris Wilson
  2017-03-30 14:18 ` Ville Syrjälä
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2017-03-30 14:08 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx

ARM v6 (at least) only allows cmpxchg on 32bit variables which doesn't
always include the bool type.

drivers/built-in.o: In function `vblank_disable_and_save':
imx-ocotp.c:(.text+0xb45e8): undefined reference to `__bad_cmpxchg'
Makefile:986: recipe for target 'vmlinux' failed

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Reported-by: Leonard Crestez <leonard.crestez@nxp.com>
Fixes: 43dc7fe2b211 ("drm: Mark up accesses of vblank->enabled outside of its spinlock")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_irq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index aa23b9833588..dac1b2593cb1 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -338,8 +338,10 @@ static void vblank_disable_and_save(struct drm_device *dev, unsigned int pipe)
 	 * calling the ->disable_vblank() operation in atomic context with the
 	 * hardware potentially runtime suspended.
 	 */
-	if (cmpxchg_relaxed(&vblank->enabled, true, false))
+	if (vblank->enabled) {
 		__disable_vblank(dev, pipe);
+		vblank->enabled = false;
+	}
 
 	/*
 	 * Always update the count and timestamp to maintain the
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm: Convert cmpxchg(bool) back to a two step operation
  2017-03-30 14:08 [PATCH] drm: Convert cmpxchg(bool) back to a two step operation Chris Wilson
@ 2017-03-30 14:18 ` Ville Syrjälä
  0 siblings, 0 replies; 2+ messages in thread
From: Ville Syrjälä @ 2017-03-30 14:18 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Daniel Vetter, intel-gfx, dri-devel

On Thu, Mar 30, 2017 at 03:08:32PM +0100, Chris Wilson wrote:
> ARM v6 (at least) only allows cmpxchg on 32bit variables which doesn't
> always include the bool type.
> 
> drivers/built-in.o: In function `vblank_disable_and_save':
> imx-ocotp.c:(.text+0xb45e8): undefined reference to `__bad_cmpxchg'
> Makefile:986: recipe for target 'vmlinux' failed
> 
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Reported-by: Leonard Crestez <leonard.crestez@nxp.com>
> Fixes: 43dc7fe2b211 ("drm: Mark up accesses of vblank->enabled outside of its spinlock")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

Thanks for the quick fix. Pushed to drm-misc-next.

> ---
>  drivers/gpu/drm/drm_irq.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index aa23b9833588..dac1b2593cb1 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -338,8 +338,10 @@ static void vblank_disable_and_save(struct drm_device *dev, unsigned int pipe)
>  	 * calling the ->disable_vblank() operation in atomic context with the
>  	 * hardware potentially runtime suspended.
>  	 */
> -	if (cmpxchg_relaxed(&vblank->enabled, true, false))
> +	if (vblank->enabled) {
>  		__disable_vblank(dev, pipe);
> +		vblank->enabled = false;
> +	}
>  
>  	/*
>  	 * Always update the count and timestamp to maintain the
> -- 
> 2.11.0

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-03-30 14:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-30 14:08 [PATCH] drm: Convert cmpxchg(bool) back to a two step operation Chris Wilson
2017-03-30 14:18 ` Ville Syrjälä

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).