All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Replace lockless_dereference(bool) with READ_ONCE()
@ 2016-07-05  7:54 Chris Wilson
  2016-07-05  8:31 ` ✓ Ro.CI.BAT: success for " Patchwork
  2016-07-05  9:54 ` [PATCH] " Mika Kuoppala
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Wilson @ 2016-07-05  7:54 UTC (permalink / raw)
  To: intel-gfx

After Joonas complained about using READ_ONCE() on the only use of the
variable in the function, where the intent was to simply document that
the read was intentionally racy and unlocked, I switched the READ_ONCE()
over to lockless_dereference(). However, in linux-next that has a
stronger type-check to only allow pointers and is no longer
interchangeable with READ_ONCE(), see commit 331b6d8c7afc
("locking/barriers: Validate lockless_dereference() is used on a pointer
type")

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: 67d97da34917 ("drm/i915: Only start retire worker when idle")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c | 2 +-
 drivers/gpu/drm/i915/i915_irq.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a7852dd0a3d4..20123c09bc18 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3290,7 +3290,7 @@ i915_gem_retire_work_handler(struct work_struct *work)
 	 * We do not need to do this test under locking as in the worst-case
 	 * we queue the retire worker once too often.
 	 */
-	if (lockless_dereference(dev_priv->gt.awake))
+	if (READ_ONCE(dev_priv->gt.awake))
 		queue_delayed_work(dev_priv->wq,
 				   &dev_priv->gt.retire_work,
 				   round_jiffies_up_relative(HZ));
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index f6de8dd567a2..2f01b0b959a1 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -3095,7 +3095,7 @@ static void i915_hangcheck_elapsed(struct work_struct *work)
 	if (!i915.enable_hangcheck)
 		return;
 
-	if (!lockless_dereference(dev_priv->gt.awake))
+	if (!READ_ONCE(dev_priv->gt.awake))
 		return;
 
 	/* As enabling the GPU requires fairly extensive mmio access,
-- 
2.8.1

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

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

* ✓ Ro.CI.BAT: success for drm/i915: Replace lockless_dereference(bool) with READ_ONCE()
  2016-07-05  7:54 [PATCH] drm/i915: Replace lockless_dereference(bool) with READ_ONCE() Chris Wilson
@ 2016-07-05  8:31 ` Patchwork
  2016-07-05  9:54 ` [PATCH] " Mika Kuoppala
  1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2016-07-05  8:31 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Replace lockless_dereference(bool) with READ_ONCE()
URL   : https://patchwork.freedesktop.org/series/9501/
State : success

== Summary ==

Series 9501v1 drm/i915: Replace lockless_dereference(bool) with READ_ONCE()
http://patchwork.freedesktop.org/api/1.0/series/9501/revisions/1/mbox

Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-uc:
                dmesg-fail -> PASS       (fi-skl-i7-6700k)
Test gem_exec_suspend:
        Subgroup basic-s3:
                incomplete -> PASS       (fi-snb-i7-2600)
Test gem_mmap:
        Subgroup basic:
                incomplete -> PASS       (fi-skl-i7-6700k)
Test kms_cursor_legacy:
        Subgroup basic-cursor-vs-flip:
                dmesg-warn -> PASS       (fi-skl-i5-6260u)
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-c-frame-sequence:
                skip       -> PASS       (fi-skl-i5-6260u)
        Subgroup read-crc-pipe-b:
                skip       -> PASS       (fi-skl-i5-6260u)

fi-kbl-qkkr      total:234  pass:162  dwarn:28  dfail:1   fail:2   skip:41 
fi-skl-i5-6260u  total:234  pass:206  dwarn:0   dfail:0   fail:2   skip:26 
fi-skl-i7-6700k  total:234  pass:192  dwarn:0   dfail:0   fail:2   skip:40 
fi-snb-i7-2600   total:234  pass:178  dwarn:0   dfail:0   fail:2   skip:54 
ro-bdw-i5-5250u  total:229  pass:204  dwarn:1   dfail:1   fail:0   skip:23 
ro-bdw-i7-5557U  total:229  pass:203  dwarn:1   dfail:2   fail:0   skip:23 
ro-bdw-i7-5600u  total:229  pass:190  dwarn:0   dfail:1   fail:0   skip:38 
ro-bsw-n3050     total:229  pass:175  dwarn:0   dfail:2   fail:3   skip:49 
ro-byt-n2820     total:229  pass:181  dwarn:0   dfail:1   fail:2   skip:45 
ro-hsw-i3-4010u  total:229  pass:197  dwarn:0   dfail:1   fail:0   skip:31 
ro-hsw-i7-4770r  total:229  pass:197  dwarn:0   dfail:1   fail:0   skip:31 
ro-ilk-i7-620lm  total:22   pass:0    dwarn:7   dfail:0   fail:0   skip:14 
ro-ilk1-i5-650   total:224  pass:157  dwarn:0   dfail:1   fail:1   skip:65 
ro-ivb-i7-3770   total:229  pass:188  dwarn:0   dfail:1   fail:0   skip:40 
ro-skl3-i5-6260u total:229  pass:208  dwarn:1   dfail:1   fail:0   skip:19 
ro-snb-i7-2620M  total:229  pass:179  dwarn:0   dfail:1   fail:1   skip:48 

Results at /archive/results/CI_IGT_test/RO_Patchwork_1409/

0a1ed46 drm-intel-nightly: 2016y-07m-04d-15h-39m-24s UTC integration manifest
23162de drm/i915: Replace lockless_dereference(bool) with READ_ONCE()

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

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

* Re: [PATCH] drm/i915: Replace lockless_dereference(bool) with READ_ONCE()
  2016-07-05  7:54 [PATCH] drm/i915: Replace lockless_dereference(bool) with READ_ONCE() Chris Wilson
  2016-07-05  8:31 ` ✓ Ro.CI.BAT: success for " Patchwork
@ 2016-07-05  9:54 ` Mika Kuoppala
  2016-07-05  9:59   ` Chris Wilson
  1 sibling, 1 reply; 4+ messages in thread
From: Mika Kuoppala @ 2016-07-05  9:54 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

Chris Wilson <chris@chris-wilson.co.uk> writes:

> After Joonas complained about using READ_ONCE() on the only use of the
> variable in the function, where the intent was to simply document that
> the read was intentionally racy and unlocked, I switched the READ_ONCE()
> over to lockless_dereference(). However, in linux-next that has a
> stronger type-check to only allow pointers and is no longer
> interchangeable with READ_ONCE(), see commit 331b6d8c7afc
> ("locking/barriers: Validate lockless_dereference() is used on a pointer
> type")
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Fixes: 67d97da34917 ("drm/i915: Only start retire worker when idle")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem.c | 2 +-
>  drivers/gpu/drm/i915/i915_irq.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index a7852dd0a3d4..20123c09bc18 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -3290,7 +3290,7 @@ i915_gem_retire_work_handler(struct work_struct *work)
>  	 * We do not need to do this test under locking as in the worst-case
>  	 * we queue the retire worker once too often.
>  	 */
> -	if (lockless_dereference(dev_priv->gt.awake))
> +	if (READ_ONCE(dev_priv->gt.awake))
>  		queue_delayed_work(dev_priv->wq,
>  				   &dev_priv->gt.retire_work,
>  				   round_jiffies_up_relative(HZ));
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index f6de8dd567a2..2f01b0b959a1 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -3095,7 +3095,7 @@ static void i915_hangcheck_elapsed(struct work_struct *work)
>  	if (!i915.enable_hangcheck)
>  		return;
>  
> -	if (!lockless_dereference(dev_priv->gt.awake))
> +	if (!READ_ONCE(dev_priv->gt.awake))
>  		return;
>  
>  	/* As enabling the GPU requires fairly extensive mmio access,
> -- 
> 2.8.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915: Replace lockless_dereference(bool) with READ_ONCE()
  2016-07-05  9:54 ` [PATCH] " Mika Kuoppala
@ 2016-07-05  9:59   ` Chris Wilson
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2016-07-05  9:59 UTC (permalink / raw)
  To: Mika Kuoppala; +Cc: intel-gfx

On Tue, Jul 05, 2016 at 12:54:50PM +0300, Mika Kuoppala wrote:
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > After Joonas complained about using READ_ONCE() on the only use of the
> > variable in the function, where the intent was to simply document that
> > the read was intentionally racy and unlocked, I switched the READ_ONCE()
> > over to lockless_dereference(). However, in linux-next that has a
> > stronger type-check to only allow pointers and is no longer
> > interchangeable with READ_ONCE(), see commit 331b6d8c7afc
> > ("locking/barriers: Validate lockless_dereference() is used on a pointer
> > type")
> >
> > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Fixes: 67d97da34917 ("drm/i915: Only start retire worker when idle")
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

Ta, though if PeterZ complains more about superfluous use of data
dependency barriers we may have to invent our own documentatary macro.
-Chris
> 

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2016-07-05  9:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-05  7:54 [PATCH] drm/i915: Replace lockless_dereference(bool) with READ_ONCE() Chris Wilson
2016-07-05  8:31 ` ✓ Ro.CI.BAT: success for " Patchwork
2016-07-05  9:54 ` [PATCH] " Mika Kuoppala
2016-07-05  9:59   ` Chris Wilson

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.