summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2025-12-19 18:40:15 +0300
committerPeter Zijlstra <peterz@infradead.org>2026-01-05 18:43:34 +0300
commit3635ad878242487fc3e8165d0329aedb118e4608 (patch)
treee99b0a81b038176d898707b54eacca765ebed6f5 /include/linux
parentc237f1ceeef56fa101c2b599a00307b3d690801a (diff)
downloadlinux-3635ad878242487fc3e8165d0329aedb118e4608.tar.xz
compiler: Let data_race() imply disabled context analysis
Many patterns that involve data-racy accesses often deliberately ignore normal synchronization rules to avoid taking a lock. If we have a lock-guarded variable on which we do a lock-less data-racy access, rather than having to write context_unsafe(data_race(..)), simply make the data_race(..) macro imply context-unsafety. The data_race() macro already denotes the intent that something subtly unsafe is about to happen, so it should be clear enough as-is. Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20251219154418.3592607-27-elver@google.com
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/compiler.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 04487c9bd751..110b28dfd1d1 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -190,7 +190,9 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
#define data_race(expr) \
({ \
__kcsan_disable_current(); \
+ disable_context_analysis(); \
auto __v = (expr); \
+ enable_context_analysis(); \
__kcsan_enable_current(); \
__v; \
})