Re: [PATCH] tracing: Disable branch profiling in noinstr code

From: Josh Poimboeuf
Date: Fri Mar 21 2025 - 14:55:16 EST


On Fri, Mar 21, 2025 at 02:28:26PM -0400, Steven Rostedt wrote:
> On Fri, 21 Mar 2025 10:21:34 -0700
> Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> > I *basically* did that, albeit in more of a surgical manner by editing a
> > lot of the makefiles in arch/x86/*/.
> >
> > Let me see if I can figure out how to do that more broadly at the
> > arch/x86 level.
>
> Ah, I thought there was a way to do it recursively, but I don't see a
> way to do that.
>
> Masahiro, do you know of a way that we can add a CFLAGS option to a
> directory and all its siblings without modifying all the Makefiles?

This appears to work:

diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild
index cf0ad89f5639..ff8f0e2fbf4b 100644
--- a/arch/x86/Kbuild
+++ b/arch/x86/Kbuild
@@ -1,4 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
+
+subdir-ccflags-$(CONFIG_TRACE_BRANCH_PROFILING) += -DDISABLE_BRANCH_PROFILING
+
obj-$(CONFIG_ARCH_HAS_CC_PLATFORM) += coco/

obj-y += entry/

--
Josh