[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <158929421408.390.18401287637902669182.tip-bot2@tip-bot2>
Date: Tue, 12 May 2020 14:36:54 -0000
From: "tip-bot2 for Will Deacon" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Will Deacon <will@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Marco Elver <elver@...gle.com>, x86 <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [tip: locking/kcsan] kcsan: Rework data_race() so that it can be used
by READ_ONCE()
The following commit has been merged into the locking/kcsan branch of tip:
Commit-ID: 88f1be32068d4323aa31236452352d6019a03ccc
Gitweb: https://git.kernel.org/tip/88f1be32068d4323aa31236452352d6019a03ccc
Author: Will Deacon <will@...nel.org>
AuthorDate: Mon, 11 May 2020 21:41:48 +01:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Tue, 12 May 2020 11:04:17 +02:00
kcsan: Rework data_race() so that it can be used by READ_ONCE()
Rework the data_race() macro so that it:
- Accepts expressions which evaluate to a 'const' type
- Attempts to discard volatile qualifiers from scalar types, avoiding
pointless stack spills
- Uses __kcsan_{disable,enable}_current(), allowing its use from code
that is built independently from the kernel, such as the vDSO
This will allow for its use by {READ,WRITE}_ONCE() in a subsequent patch.
At the same time, fix-up some weird whitespace issues.
Signed-off-by: Will Deacon <will@...nel.org>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Marco Elver <elver@...gle.com>
Link: https://lkml.kernel.org/r/20200511204150.27858-17-will@kernel.org
---
include/linux/compiler.h | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 548294e..cb2e3b3 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -314,14 +314,15 @@ unsigned long read_word_at_a_time(const void *addr)
* This macro *does not* affect normal code generation, but is a hint
* to tooling that data races here are to be ignored.
*/
-#define data_race(expr) \
- ({ \
- typeof(({ expr; })) __val; \
- kcsan_disable_current(); \
- __val = ({ expr; }); \
- kcsan_enable_current(); \
- __val; \
- })
+#define data_race(expr) \
+({ \
+ __kcsan_disable_current(); \
+ ({ \
+ __unqual_scalar_typeof(({ expr; })) __v = ({ expr; }); \
+ __kcsan_enable_current(); \
+ __v; \
+ }); \
+})
#endif /* __KERNEL__ */
Powered by blists - more mailing lists