[PATCH 03/14] tracing: Disable branch profiling for COMPILE_TEST builds
From: Bart Van Assche
Date: Mon Nov 02 2026 - 16:35:52 EST
WARN_CONTEXT_ANALYSIS depends on !TRACE_BRANCH_PROFILING because branch
profiling instruments every if-condition and obscures control flow from
Clang's thread-safety analyzer. Make PROFILE_ANNOTATED_BRANCHES and
PROFILE_ALL_BRANCHES depend on !COMPILE_TEST so that allmodconfig and
allyesconfig builds do not enable TRACE_BRANCH_PROFILING and instead
enable WARN_CONTEXT_ANALYSIS_ALL.
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
kernel/trace/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 35d043b19332..afbf17099a68 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -687,6 +687,7 @@ config BRANCH_PROFILE_NONE
config PROFILE_ANNOTATED_BRANCHES
bool "Trace likely/unlikely profiler"
+ depends on !COMPILE_TEST
select TRACE_BRANCH_PROFILING
help
This tracer profiles all likely and unlikely macros
@@ -698,7 +699,7 @@ config PROFILE_ANNOTATED_BRANCHES
on if you need to profile the system's use of these macros.
config PROFILE_ALL_BRANCHES
- bool "Profile all if conditionals" if !FORTIFY_SOURCE
+ bool "Profile all if conditionals" if !FORTIFY_SOURCE && !COMPILE_TEST
select TRACE_BRANCH_PROFILING
help
This tracer profiles all branch conditions. Every if ()