Re: [PATCH v2 03/14] tracing: Disable branch profiling for COMPILE_TEST builds

From: Marco Elver

Date: Wed Nov 11 2026 - 06:00:53 EST


On Mon, 9 Nov 2026 at 20:14, Bart Van Assche <bvanassche@xxxxxxx> wrote:
>
> 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.

WARN_CONTEXT_ANALYSIS_ALL depends on !COMPILE_TEST, so allmodconfig
gets WARN_CONTEXT_ANALYSIS, not _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 ()