[11/21] trace: Use -mcount-record for dynamic ftrace
diff mbox

Message ID 20171127213423.27218-12-andi@firstfloor.org
State New
Headers show

Commit Message

Andi Kleen Nov. 27, 2017, 9:34 p.m. UTC
From: Andi Kleen <ak@linux.intel.com>

gcc 5 supports a new -mcount-record option to generate ftrace
tables directly. This avoids the need to run record_mcount
manually.

Use this option when available.

So far doesn't use -mcount-nop, which also exists now.

This is needed to make ftrace work with LTO because the
normal record-mcount script doesn't run over the link
time output.

It should also improve build times slightly in the general
case.

Cc: rostedt@goodmis.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 scripts/Makefile.build | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Steven Rostedt Dec. 1, 2017, 12:22 a.m. UTC | #1
On Mon, 27 Nov 2017 13:34:13 -0800
Andi Kleen <andi@firstfloor.org> wrote:

> From: Andi Kleen <ak@linux.intel.com>
> 
> gcc 5 supports a new -mcount-record option to generate ftrace
> tables directly. This avoids the need to run record_mcount
> manually.
> 
> Use this option when available.
> 
> So far doesn't use -mcount-nop, which also exists now.
> 
> This is needed to make ftrace work with LTO because the
> normal record-mcount script doesn't run over the link
> time output.
> 
> It should also improve build times slightly in the general
> case.
> 
> Cc: rostedt@goodmis.org
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---

Hi Andi,

Thanks for sending this. I'm currently trying to catch up on all the
changes that need to get into 4.15 and will be doing a bit of
traveling.

I plan on looking at this in a week or two, and add it to the 4.16
queue.

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steven Rostedt May 1, 2018, 6:42 p.m. UTC | #2
On Thu, 30 Nov 2017 19:22:33 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Mon, 27 Nov 2017 13:34:13 -0800
> Andi Kleen <andi@firstfloor.org> wrote:
> 
> > From: Andi Kleen <ak@linux.intel.com>
> > 
> > gcc 5 supports a new -mcount-record option to generate ftrace
> > tables directly. This avoids the need to run record_mcount
> > manually.
> > 
> > Use this option when available.
> > 
> > So far doesn't use -mcount-nop, which also exists now.
> > 
> > This is needed to make ftrace work with LTO because the
> > normal record-mcount script doesn't run over the link
> > time output.
> > 
> > It should also improve build times slightly in the general
> > case.
> > 
> > Cc: rostedt@goodmis.org
> > Signed-off-by: Andi Kleen <ak@linux.intel.com>
> > ---  
> 
> Hi Andi,
> 
> Thanks for sending this. I'm currently trying to catch up on all the
> changes that need to get into 4.15 and will be doing a bit of
> traveling.
> 
> I plan on looking at this in a week or two, and add it to the 4.16
> queue.
>

Looks like it I forgot to add it to the queue (actually, I remember
having issues with that queue and restarted it), and this was dropped.

Adding it this time for 4.18

Sorry about that. :-/

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index cb8997ed0149..8179563bcd85 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -219,6 +219,11 @@  cmd_modversions_c =								\
 endif
 
 ifdef CONFIG_FTRACE_MCOUNT_RECORD
+# gcc 5 supports generating the mcount tables directly
+ifneq ($(call cc-option,-mrecord-mcount,y),y)
+KBUILD_CFLAGS += -mrecord-mcount
+else
+# else do it all manually
 ifdef BUILD_C_RECORDMCOUNT
 ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
   RECORDMCOUNT_FLAGS = -w
@@ -264,6 +269,7 @@  objtool_args += --no-unreachable
 else
 objtool_args += $(call cc-ifversion, -lt, 0405, --no-unreachable)
 endif
+endif
 
 # 'OBJECT_FILES_NON_STANDARD := y': skip objtool checking for a directory
 # 'OBJECT_FILES_NON_STANDARD_foo.o := 'y': skip objtool checking for a file