All of lore.kernel.org
 help / color / mirror / Atom feed
* Fw: [GIT PULL] locking fixes
@ 2016-08-18 21:02 Paul E. McKenney
  2016-08-18 21:34 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2016-08-18 21:02 UTC (permalink / raw)
  To: eric.dumazet, peterz, linux-kernel

Hello, Eric,

Does Johannes's recent change to lockless_dereference() help with
the sparse issue?

							Thanx, Paul

----- Forwarded message from Ingo Molnar <mingo@kernel.org> -----

Date: Thu, 18 Aug 2016 22:34:21 +0200
From: Ingo Molnar <mingo@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Thomas Gleixner <tglx@linutronix.de>, Andrew Morton
	<akpm@linux-foundation.org>, "Paul E. McKenney" <paulmck@us.ibm.com>
Subject: [GIT PULL] locking fixes

Linus,

Please pull the latest locking-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking-urgent-for-linus

   # HEAD: 112dc0c8069e5554e0ad29c58228f1e6ca49e13d locking/barriers: Suppress sparse warnings in lockless_dereference()

Two lockless_dereference() related fixes.

 Thanks,

	Ingo

------------------>
Johannes Berg (2):
      Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"
      locking/barriers: Suppress sparse warnings in lockless_dereference()


 drivers/gpu/drm/drm_fb_helper.c | 2 +-
 include/linux/compiler.h        | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

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) {
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); \
 })


----- End forwarded message -----

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

* Re: Fw: [GIT PULL] locking fixes
  2016-08-18 21:02 Fw: [GIT PULL] locking fixes Paul E. McKenney
@ 2016-08-18 21:34 ` Eric Dumazet
  2016-08-18 22:04   ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2016-08-18 21:34 UTC (permalink / raw)
  To: paulmck; +Cc: peterz, linux-kernel

On Thu, 2016-08-18 at 14:02 -0700, Paul E. McKenney wrote:
> Hello, Eric,
> 
> Does Johannes's recent change to lockless_dereference() help with
> the sparse issue?
> 
> 							Thanx, Paul
> 

Hi Paul

Yes indeed, this helps.

Thanks !

> ----- Forwarded message from Ingo Molnar <mingo@kernel.org> -----
> 
> Date: Thu, 18 Aug 2016 22:34:21 +0200
> From: Ingo Molnar <mingo@kernel.org>
> To: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: linux-kernel@vger.kernel.org, Peter Zijlstra <a.p.zijlstra@chello.nl>,
> 	Thomas Gleixner <tglx@linutronix.de>, Andrew Morton
> 	<akpm@linux-foundation.org>, "Paul E. McKenney" <paulmck@us.ibm.com>
> Subject: [GIT PULL] locking fixes
> 
> Linus,
> 
> Please pull the latest locking-urgent-for-linus git tree from:
> 
>    git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking-urgent-for-linus
> 
>    # HEAD: 112dc0c8069e5554e0ad29c58228f1e6ca49e13d locking/barriers: Suppress sparse warnings in lockless_dereference()
> 
> Two lockless_dereference() related fixes.
> 
>  Thanks,
> 
> 	Ingo
> 
> ------------------>
> Johannes Berg (2):
>       Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"
>       locking/barriers: Suppress sparse warnings in lockless_dereference()
> 
> 
>  drivers/gpu/drm/drm_fb_helper.c | 2 +-
>  include/linux/compiler.h        | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> 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) {
> 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); \
>  })
> 
> 
> ----- End forwarded message -----
> 

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

* Re: Fw: [GIT PULL] locking fixes
  2016-08-18 21:34 ` Eric Dumazet
@ 2016-08-18 22:04   ` Paul E. McKenney
  0 siblings, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2016-08-18 22:04 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: peterz, linux-kernel

On Thu, Aug 18, 2016 at 02:34:23PM -0700, Eric Dumazet wrote:
> On Thu, 2016-08-18 at 14:02 -0700, Paul E. McKenney wrote:
> > Hello, Eric,
> > 
> > Does Johannes's recent change to lockless_dereference() help with
> > the sparse issue?
> > 
> > 							Thanx, Paul
> > 
> 
> Hi Paul
> 
> Yes indeed, this helps.
> 
> Thanks !

Woo-hoo!  ;-)

							Thanx, Paul

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

end of thread, other threads:[~2016-08-19  6:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-18 21:02 Fw: [GIT PULL] locking fixes Paul E. McKenney
2016-08-18 21:34 ` Eric Dumazet
2016-08-18 22:04   ` Paul E. McKenney

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.