Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1460346 > unrolled thread

[PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"

Started byJohannes Berg <johannes@sipsolutions.net>
First post2016-08-11 12:00 +0200
Last post2016-08-18 15:50 +0200
Articles 11 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference" Johannes Berg <johannes@sipsolutions.net> - 2016-08-11 12:00 +0200
    [PATCH 2/2] locking/barriers: suppress sparse warnings in lockless_dereference() Johannes Berg <johannes@sipsolutions.net> - 2016-08-11 12:00 +0200
      [tip:locking/core] locking/barriers: Suppress sparse warnings in  lockless_dereference() tip-bot for Johannes Berg <tipbot@zytor.com> - 2016-08-18 13:10 +0200
      [tip:locking/urgent] locking/barriers: Suppress sparse warnings in  lockless_dereference() tip-bot for Johannes Berg <tipbot@zytor.com> - 2016-08-18 15:50 +0200
    Re: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to  lockless_dereference" Daniel Vetter <daniel@ffwll.ch> - 2016-08-11 12:40 +0200
      Re: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to  lockless_dereference" "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-08-12 00:30 +0200
        Re: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to  lockless_dereference" Johannes Berg <johannes@sipsolutions.net> - 2016-08-12 08:10 +0200
        Re: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to  lockless_dereference" Peter Zijlstra <peterz@infradead.org> - 2016-08-12 20:30 +0200
          Re: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to  lockless_dereference" "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-08-12 21:20 +0200
    [tip:locking/core] Revert "drm/fb-helper: Reduce READ_ONCE(master)  to lockless_dereference" tip-bot for Johannes Berg <tipbot@zytor.com> - 2016-08-18 13:10 +0200
    [tip:locking/urgent] Revert "drm/fb-helper: Reduce  READ_ONCE(master) to lockless_dereference" tip-bot for Johannes Berg <tipbot@zytor.com> - 2016-08-18 15:50 +0200

#1460346 — [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"

FromJohannes Berg <johannes@sipsolutions.net>
Date2016-08-11 12:00 +0200
Subject[PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"
Message-ID<s4UWl-289-9@gated-at.bofh.it>
From: Johannes Berg <johannes.berg@intel.com>

This reverts commit fa7d81bb3c269a2ee38b6e4d569d9eb8be1a78ad.

As Peter explained:
  [...] lockless_dereference() is _stronger_ than READ_ONCE(), not weaker.

  [...]

  Also, clue is in the name: 'dereference', you don't actually dereference
  the pointer here, only load it.

My next patch breaks compile on this, because it assumes you want to
deference and thus also need the struct type visible (which it isn't
here), so revert it.

Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index ce54e985d91b..0a06f9120b5a 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -464,7 +464,7 @@ static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
 
 	/* Sometimes user space wants everything disabled, so don't steal the
 	 * display if there's a master. */
-	if (lockless_dereference(dev->master))
+	if (READ_ONCE(dev->master))
 		return false;
 
 	drm_for_each_crtc(crtc, dev) {
-- 
2.8.1

[toc] | [next] | [standalone]


#1460347 — [PATCH 2/2] locking/barriers: suppress sparse warnings in lockless_dereference()

FromJohannes Berg <johannes@sipsolutions.net>
Date2016-08-11 12:00 +0200
Subject[PATCH 2/2] locking/barriers: suppress sparse warnings in lockless_dereference()
Message-ID<s4UWl-289-13@gated-at.bofh.it>
In reply to#1460346
From: Johannes Berg <johannes.berg@intel.com>

After Peter's commit (see below) we get a lot of sparse warnings
(one for every rcu_dereference, and more) since the expression
here is assigning to the wrong address space.

Instead of validating that 'p' is a pointer this way, instead make
it fail compilation when it's not by using sizeof(*(p)). This will
not cause any sparse warnings (tested, likely since the address
space is irrelevant for sizeof), and will fail compilation when
'p' isn't a pointer type.

Fixes: 331b6d8c7afc ("locking/barriers: Validate lockless_dereference() is used on a pointer type")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 include/linux/compiler.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 1bb954842725..436aa4e42221 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -527,13 +527,13 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
  * object's lifetime is managed by something other than RCU.  That
  * "something other" might be reference counting or simple immortality.
  *
- * The seemingly unused void * variable is to validate @p is indeed a pointer
- * type. All pointer types silently cast to void *.
+ * The seemingly unused size_t variable is to validate @p is indeed a pointer
+ * type by making sure it can be dereferenced.
  */
 #define lockless_dereference(p) \
 ({ \
 	typeof(p) _________p1 = READ_ONCE(p); \
-	__maybe_unused const void * const _________p2 = _________p1; \
+	size_t __maybe_unused __size_of_ptr = sizeof(*(p)); \
 	smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
 	(_________p1); \
 })
-- 
2.8.1

[toc] | [prev] | [next] | [standalone]


#1465174 — [tip:locking/core] locking/barriers: Suppress sparse warnings in lockless_dereference()

Fromtip-bot for Johannes Berg <tipbot@zytor.com>
Date2016-08-18 13:10 +0200
Subject[tip:locking/core] locking/barriers: Suppress sparse warnings in lockless_dereference()
Message-ID<s7tmW-7oo-43@gated-at.bofh.it>
In reply to#1460347
Commit-ID:  9054b5958ca3cc83ec815d40ed5b5176bf422a03
Gitweb:     http://git.kernel.org/tip/9054b5958ca3cc83ec815d40ed5b5176bf422a03
Author:     Johannes Berg <johannes.berg@intel.com>
AuthorDate: Thu, 11 Aug 2016 11:50:22 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 18 Aug 2016 11:34:27 +0200

locking/barriers: Suppress sparse warnings in lockless_dereference()

After Peter's commit:

  331b6d8c7afc ("locking/barriers: Validate lockless_dereference() is used on a pointer type")

... we get a lot of sparse warnings (one for every rcu_dereference, and more)
since the expression here is assigning to the wrong address space.

Instead of validating that 'p' is a pointer this way, instead make
it fail compilation when it's not by using sizeof(*(p)). This will
not cause any sparse warnings (tested, likely since the address
space is irrelevant for sizeof), and will fail compilation when
'p' isn't a pointer type.

Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 331b6d8c7afc ("locking/barriers: Validate lockless_dereference() is used on a pointer type")
Link: http://lkml.kernel.org/r/1470909022-687-2-git-send-email-johannes@sipsolutions.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/compiler.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 1bb9548..436aa4e 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -527,13 +527,13 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
  * object's lifetime is managed by something other than RCU.  That
  * "something other" might be reference counting or simple immortality.
  *
- * The seemingly unused void * variable is to validate @p is indeed a pointer
- * type. All pointer types silently cast to void *.
+ * The seemingly unused size_t variable is to validate @p is indeed a pointer
+ * type by making sure it can be dereferenced.
  */
 #define lockless_dereference(p) \
 ({ \
 	typeof(p) _________p1 = READ_ONCE(p); \
-	__maybe_unused const void * const _________p2 = _________p1; \
+	size_t __maybe_unused __size_of_ptr = sizeof(*(p)); \
 	smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
 	(_________p1); \
 })

[toc] | [prev] | [next] | [standalone]


#1465366 — [tip:locking/urgent] locking/barriers: Suppress sparse warnings in lockless_dereference()

Fromtip-bot for Johannes Berg <tipbot@zytor.com>
Date2016-08-18 15:50 +0200
Subject[tip:locking/urgent] locking/barriers: Suppress sparse warnings in lockless_dereference()
Message-ID<s7vRM-sf-49@gated-at.bofh.it>
In reply to#1460347
Commit-ID:  112dc0c8069e5554e0ad29c58228f1e6ca49e13d
Gitweb:     http://git.kernel.org/tip/112dc0c8069e5554e0ad29c58228f1e6ca49e13d
Author:     Johannes Berg <johannes.berg@intel.com>
AuthorDate: Thu, 11 Aug 2016 11:50:22 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 18 Aug 2016 15:36:13 +0200

locking/barriers: Suppress sparse warnings in lockless_dereference()

After Peter's commit:

  331b6d8c7afc ("locking/barriers: Validate lockless_dereference() is used on a pointer type")

... we get a lot of sparse warnings (one for every rcu_dereference, and more)
since the expression here is assigning to the wrong address space.

Instead of validating that 'p' is a pointer this way, instead make
it fail compilation when it's not by using sizeof(*(p)). This will
not cause any sparse warnings (tested, likely since the address
space is irrelevant for sizeof), and will fail compilation when
'p' isn't a pointer type.

Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 331b6d8c7afc ("locking/barriers: Validate lockless_dereference() is used on a pointer type")
Link: http://lkml.kernel.org/r/1470909022-687-2-git-send-email-johannes@sipsolutions.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/compiler.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 1bb9548..436aa4e 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -527,13 +527,13 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
  * object's lifetime is managed by something other than RCU.  That
  * "something other" might be reference counting or simple immortality.
  *
- * The seemingly unused void * variable is to validate @p is indeed a pointer
- * type. All pointer types silently cast to void *.
+ * The seemingly unused size_t variable is to validate @p is indeed a pointer
+ * type by making sure it can be dereferenced.
  */
 #define lockless_dereference(p) \
 ({ \
 	typeof(p) _________p1 = READ_ONCE(p); \
-	__maybe_unused const void * const _________p2 = _________p1; \
+	size_t __maybe_unused __size_of_ptr = sizeof(*(p)); \
 	smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
 	(_________p1); \
 })

[toc] | [prev] | [next] | [standalone]


#1460382 — Re: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"

FromDaniel Vetter <daniel@ffwll.ch>
Date2016-08-11 12:40 +0200
SubjectRe: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"
Message-ID<s4Vz3-2BB-13@gated-at.bofh.it>
In reply to#1460346
On Thu, Aug 11, 2016 at 11:50:21AM +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> This reverts commit fa7d81bb3c269a2ee38b6e4d569d9eb8be1a78ad.
> 
> As Peter explained:
>   [...] lockless_dereference() is _stronger_ than READ_ONCE(), not weaker.
> 
>   [...]
> 
>   Also, clue is in the name: 'dereference', you don't actually dereference
>   the pointer here, only load it.
> 
> My next patch breaks compile on this, because it assumes you want to
> deference and thus also need the struct type visible (which it isn't
> here), so revert it.
> 
> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

And ack-by: me for merging through whatever tree this makes sense for.
-Daniel

> ---
>  drivers/gpu/drm/drm_fb_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index ce54e985d91b..0a06f9120b5a 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -464,7 +464,7 @@ static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
>  
>  	/* Sometimes user space wants everything disabled, so don't steal the
>  	 * display if there's a master. */
> -	if (lockless_dereference(dev->master))
> +	if (READ_ONCE(dev->master))
>  		return false;
>  
>  	drm_for_each_crtc(crtc, dev) {
> -- 
> 2.8.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

[toc] | [prev] | [next] | [standalone]


#1460838 — Re: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2016-08-12 00:30 +0200
SubjectRe: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"
Message-ID<s56Ea-1t7-13@gated-at.bofh.it>
In reply to#1460382
On Thu, Aug 11, 2016 at 12:38:59PM +0200, Daniel Vetter wrote:
> On Thu, Aug 11, 2016 at 11:50:21AM +0200, Johannes Berg wrote:
> > From: Johannes Berg <johannes.berg@intel.com>
> > 
> > This reverts commit fa7d81bb3c269a2ee38b6e4d569d9eb8be1a78ad.
> > 
> > As Peter explained:
> >   [...] lockless_dereference() is _stronger_ than READ_ONCE(), not weaker.
> > 
> >   [...]
> > 
> >   Also, clue is in the name: 'dereference', you don't actually dereference
> >   the pointer here, only load it.
> > 
> > My next patch breaks compile on this, because it assumes you want to
> > deference and thus also need the struct type visible (which it isn't
> > here), so revert it.
> > 
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> And ack-by: me for merging through whatever tree this makes sense for.
> -Daniel

Initial testing says that the change below must precede the change
to the definition of lockless_dereference(), so the two should go
together.

If my upcoming testing of the two changes together pans out, I will
give you a Tested-by -- I am guessing that you don't want to wait
until the next merge window for these changes.

							Thanx, Paul

> > ---
> >  drivers/gpu/drm/drm_fb_helper.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> > index ce54e985d91b..0a06f9120b5a 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -464,7 +464,7 @@ static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
> >  
> >  	/* Sometimes user space wants everything disabled, so don't steal the
> >  	 * display if there's a master. */
> > -	if (lockless_dereference(dev->master))
> > +	if (READ_ONCE(dev->master))
> >  		return false;
> >  
> >  	drm_for_each_crtc(crtc, dev) {
> > -- 
> > 2.8.1
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
> 

[toc] | [prev] | [next] | [standalone]


#1460958 — Re: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"

FromJohannes Berg <johannes@sipsolutions.net>
Date2016-08-12 08:10 +0200
SubjectRe: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"
Message-ID<s5dPj-6mv-3@gated-at.bofh.it>
In reply to#1460838
> Initial testing says that the change below must precede the change
> to the definition of lockless_dereference(), so the two should go
> together.

Indeed.

> If my upcoming testing of the two changes together pans out, I will
> give you a Tested-by -- I am guessing that you don't want to wait
> until the next merge window for these changes.

I don't mind hugely since I have a fix now, but this one actually
causes >1K warnings (including some "too many warnings!") for my build
(net/wireless and net/mac80211 only!) and drowns out the real ones...
I'm sure other parts of the tree are similarly affected.

johannes

[toc] | [prev] | [next] | [standalone]


#1461368 — Re: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"

FromPeter Zijlstra <peterz@infradead.org>
Date2016-08-12 20:30 +0200
SubjectRe: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"
Message-ID<s5pns-5ga-41@gated-at.bofh.it>
In reply to#1460838
On Thu, Aug 11, 2016 at 11:26:47AM -0700, Paul E. McKenney wrote:
> If my upcoming testing of the two changes together pans out, I will
> give you a Tested-by -- I am guessing that you don't want to wait
> until the next merge window for these changes.

I was planning to stuff them in tip/locking/urgent, so they'd end up in
this release.

[toc] | [prev] | [next] | [standalone]


#1461430 — Re: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2016-08-12 21:20 +0200
SubjectRe: [PATCH 1/2] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"
Message-ID<s5q9Q-5PW-19@gated-at.bofh.it>
In reply to#1461368
On Fri, Aug 12, 2016 at 08:25:43PM +0200, Peter Zijlstra wrote:
> On Thu, Aug 11, 2016 at 11:26:47AM -0700, Paul E. McKenney wrote:
> > If my upcoming testing of the two changes together pans out, I will
> > give you a Tested-by -- I am guessing that you don't want to wait
> > until the next merge window for these changes.
> 
> I was planning to stuff them in tip/locking/urgent, so they'd end up in
> this release.

They seem to work fine for me, so for both:

Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

							Thanx, Paul

[toc] | [prev] | [next] | [standalone]


#1465172 — [tip:locking/core] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"

Fromtip-bot for Johannes Berg <tipbot@zytor.com>
Date2016-08-18 13:10 +0200
Subject[tip:locking/core] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"
Message-ID<s7tmW-7oo-39@gated-at.bofh.it>
In reply to#1460346
Commit-ID:  8180cfb96098f7066fbd0a44ac3aaf422f74609d
Gitweb:     http://git.kernel.org/tip/8180cfb96098f7066fbd0a44ac3aaf422f74609d
Author:     Johannes Berg <johannes.berg@intel.com>
AuthorDate: Thu, 11 Aug 2016 11:50:21 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 18 Aug 2016 11:34:26 +0200

Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"

This reverts commit:

  fa7d81bb3c269 ("drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference")

As Peter explained:

  [...] lockless_dereference() is _stronger_ than READ_ONCE(), not weaker.

  [...]

  Also, clue is in the name: 'dereference', you don't actually dereference
  the pointer here, only load it.

My next patch breaks the compile without this revert, because it assumes
you want to deference and thus also need the struct type visible (which
it isn't here), so revert it.

Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1470909022-687-1-git-send-email-johannes@sipsolutions.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 drivers/gpu/drm/drm_fb_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index ce54e98..0a06f91 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -464,7 +464,7 @@ static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
 
 	/* Sometimes user space wants everything disabled, so don't steal the
 	 * display if there's a master. */
-	if (lockless_dereference(dev->master))
+	if (READ_ONCE(dev->master))
 		return false;
 
 	drm_for_each_crtc(crtc, dev) {

[toc] | [prev] | [next] | [standalone]


#1465369 — [tip:locking/urgent] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"

Fromtip-bot for Johannes Berg <tipbot@zytor.com>
Date2016-08-18 15:50 +0200
Subject[tip:locking/urgent] Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"
Message-ID<s7vRM-sf-51@gated-at.bofh.it>
In reply to#1460346
Commit-ID:  f17b3ea3d2df7c9bf3ce1dbd65b5fd7061f8e787
Gitweb:     http://git.kernel.org/tip/f17b3ea3d2df7c9bf3ce1dbd65b5fd7061f8e787
Author:     Johannes Berg <johannes.berg@intel.com>
AuthorDate: Thu, 11 Aug 2016 11:50:21 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 18 Aug 2016 15:36:13 +0200

Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"

This reverts commit:

  fa7d81bb3c269 ("drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference")

As Peter explained:

  [...] lockless_dereference() is _stronger_ than READ_ONCE(), not weaker.

  [...]

  Also, clue is in the name: 'dereference', you don't actually dereference
  the pointer here, only load it.

My next patch breaks the compile without this revert, because it assumes
you want to deference and thus also need the struct type visible (which
it isn't here), so revert it.

Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1470909022-687-1-git-send-email-johannes@sipsolutions.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 drivers/gpu/drm/drm_fb_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index ce54e98..0a06f91 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -464,7 +464,7 @@ static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
 
 	/* Sometimes user space wants everything disabled, so don't steal the
 	 * display if there's a master. */
-	if (lockless_dereference(dev->master))
+	if (READ_ONCE(dev->master))
 		return false;
 
 	drm_for_each_crtc(crtc, dev) {

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web