public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: rostedt@goodmis.org
Cc: linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH] Use -mcount-record for dynamic ftrace
Date: Tue,  1 Nov 2016 19:27:27 -0700	[thread overview]
Message-ID: <1478053647-15565-1-git-send-email-andi@firstfloor.org> (raw)

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.

It also has a -mcount-nop option to generate the mcount calls
as nops. So far that is not implemented, but it could be used
to optimize patching at boot up.

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

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index de46ab03f063..2d7467076411 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -212,6 +212,11 @@ cmd_modversions =								\
 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
@@ -241,6 +246,7 @@ cmd_record_mcount =						\
 		$(sub_cmd_record_mcount)			\
 	fi;
 endif
+endif
 
 ifdef CONFIG_STACK_VALIDATION
 ifneq ($(SKIP_STACK_VALIDATION),1)
-- 
2.5.5

             reply	other threads:[~2016-11-02  2:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02  2:27 Andi Kleen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-04-13  0:54 [PATCH] Use -mcount-record for dynamic ftrace Andi Kleen
2015-04-13 19:32 ` Steven Rostedt
2015-04-13 21:55   ` Andi Kleen
2015-04-13 22:03     ` Steven Rostedt
2015-04-13 22:54       ` Andi Kleen
2015-04-14  0:26         ` Steven Rostedt
2015-04-14  6:19   ` Kalle Valo
2015-04-14 13:07     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478053647-15565-1-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ak@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox