Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[linux-2.6-microblaze.git] / lib / Kconfig.kcsan
index e0a93ff..63b70b8 100644 (file)
@@ -191,6 +191,26 @@ config KCSAN_STRICT
          closely aligns with the rules defined by the Linux-kernel memory
          consistency model (LKMM).
 
+config KCSAN_WEAK_MEMORY
+       bool "Enable weak memory modeling to detect missing memory barriers"
+       default y
+       depends on KCSAN_STRICT
+       # We can either let objtool nop __tsan_func_{entry,exit}() and builtin
+       # atomics instrumentation in .noinstr.text, or use a compiler that can
+       # implement __no_kcsan to really remove all instrumentation.
+       depends on STACK_VALIDATION || CC_IS_GCC || CLANG_VERSION >= 140000
+       help
+         Enable support for modeling a subset of weak memory, which allows
+         detecting a subset of data races due to missing memory barriers.
+
+         Depends on KCSAN_STRICT, because the options strenghtening certain
+         plain accesses by default (depending on !KCSAN_STRICT) reduce the
+         ability to detect any data races invoving reordered accesses, in
+         particular reordered writes.
+
+         Weak memory modeling relies on additional instrumentation and may
+         affect performance.
+
 config KCSAN_REPORT_VALUE_CHANGE_ONLY
        bool "Only report races where watcher observed a data value change"
        default y