From: Peter Zijlstra <peterz@infradead.org>
To: doug.hatch@hp.com, tglx@linutronix.de, mingo@kernel.org,
Waiman.Long@hp.com, linux-kernel@vger.kernel.org,
scott.norton@hp.com, torvalds@linux-foundation.org,
hpa@zytor.com
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:locking/core] locking/pvqspinlock: Replace xchg() by the more descriptive set_mb()
Date: Tue, 12 May 2015 16:59:39 +0200 [thread overview]
Message-ID: <20150512145939.GG16478@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20150511145408.GU27504@twins.programming.kicks-ass.net>
On Mon, May 11, 2015 at 04:54:08PM +0200, Peter Zijlstra wrote:
> +++ b/arch/arm/include/asm/barrier.h
> @@ -81,7 +81,7 @@ do { \
> #define read_barrier_depends() do { } while(0)
> #define smp_read_barrier_depends() do { } while(0)
>
> -#define set_mb(var, value) do { var = value; smp_mb(); } while (0)
> +#define set_mb(var, value) do { WRITE_ONCE(var, value); smp_mb(); } while (0)
>
> #define smp_mb__before_atomic() smp_mb()
> #define smp_mb__after_atomic() smp_mb()
Which triggered a massive compile fail and requires the same union
trickery we already had for READ_ONCE().
Added the below bit to the patch to aid compiling.
---
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index a7c0941d10da..03e227ba481c 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -250,7 +250,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; })
#define WRITE_ONCE(x, val) \
- ({ typeof(x) __val = (val); __write_once_size(&(x), &__val, sizeof(__val)); __val; })
+ ({ union { typeof(x) __val; char __c[1]; } __u = { .__val = (val) }; __write_once_size(&(x), __u.__c, sizeof(x)); __u.__val; })
#endif /* __KERNEL__ */
prev parent reply other threads:[~2015-05-12 14:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tip-52c9d2badd1ae4d11c29de57d4e964e48afd3cb4@git.kernel.org>
2015-05-11 14:54 ` Peter Zijlstra
2015-05-11 16:50 ` Waiman Long
2015-05-11 17:50 ` Linus Torvalds
2015-05-12 8:45 ` Peter Zijlstra
2015-05-12 13:00 ` Peter Zijlstra
2015-05-12 8:53 ` Peter Zijlstra
2015-05-12 14:59 ` Peter Zijlstra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150512145939.GG16478@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Waiman.Long@hp.com \
--cc=doug.hatch@hp.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=scott.norton@hp.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome