From: Michal Marek <mmarek@suse.cz>
To: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: rostedt@goodmis.org, linux-kernel@vger.kernel.org, mingo@elte.hu,
John Reiser <jreiser@bitwagon.com>,
Sam Ravnborg <sam@ravnborg.org>,
linux-kbuild <linux-kbuild@vger.kernel.org>
Subject: Re: [v2 PATCH] ftrace: Speed up recordmcount
Date: Thu, 28 Oct 2010 23:05:57 +0200 [thread overview]
Message-ID: <4CC9E5B5.5040402@suse.cz> (raw)
In-Reply-To: <3dc8cddf022eb7024f9f2cf857529a15bee8999a.1288196498.git.wuzhangjin@gmail.com>
On 27.10.2010 18:24, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
>
> cmd_record_mcount is used to locate the _mcount symbols in the object
> files, only the files compiled with -pg has the _mcount symbol, so, it
> is only needed for such files, but the current cmd_record_mcount is used
> for all of the object files, so, we need to fix it and speed it up.
>
> Since -pg may be removed by the method used in kernel/trace/Makefile:
>
> ORIG_CFLAGS := $(KBUILD_CFLAGS)
> KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS))
>
> Or may be removed by the method used in arch/x86/kernel/Makefile:
>
> CONFIG_REMOVE_file.o = -pg
CFLAGS_REMOVE_file.o
> So, we must check the last variable stores the compiling flags, that is
> c_flags(Please refer to cmd_cc_o_c and rule_cc_o_c defined in
> scripts/Makefile.build) and since the CFLAGS_REMOVE_file.o is already
> filtered in _c_flags(Please refer to scripts/Makefile.lib) and _c_flags
> has less symbols, therefore, we only need to check _c_flags.
>
> ---------------
> Changes from v1:
>
> o Don't touch Makefile for CONFIG_FTRACE_MCOUNT_RECORD is enough
> o Use _c_flags intead of KBUILD_CFLAGS to cover CONFIG_REMOVE_file.o = -pg
> (feedback from Steven Rostedt <rostedt@goodmis.org>)
>
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Acked-by: Michal Marek <mmarek@suse.cz>
> ---
> scripts/Makefile.build | 13 +++++++++----
> 1 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 5ad25e1..0ad6108 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -214,17 +214,22 @@ ifdef BUILD_C_RECORDMCOUNT
> # The empty.o file is created in the make process in order to determine
> # the target endianness and word size. It is made before all other C
> # files, including recordmcount.
> -cmd_record_mcount = if [ $(@) != "scripts/mod/empty.o" ]; then \
> - $(objtree)/scripts/recordmcount "$(@)"; \
> - fi;
> +sub_cmd_record_mcount = \
> + if [ $(@) != "scripts/mod/empty.o" ]; then \
> + $(objtree)/scripts/recordmcount "$(@)"; \
> + fi;
> else
> -cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
> +sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
> "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
> "$(if $(CONFIG_64BIT),64,32)" \
> "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
> "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
> "$(if $(part-of-module),1,0)" "$(@)";
> endif
> +cmd_record_mcount = \
> + if [ "$(findstring -pg,$(_c_flags))" == "-pg" ]; then \
> + $(sub_cmd_record_mcount) \
> + fi;
> endif
>
> define rule_cc_o_c
next prev parent reply other threads:[~2010-10-28 21:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 16:24 [v2 PATCH] ftrace: Speed up recordmcount Wu Zhangjin
2010-10-28 2:21 ` Steven Rostedt
2010-10-28 21:05 ` Michal Marek [this message]
2010-11-09 5:35 ` wu zhangjin
2010-11-09 13:53 ` Steven Rostedt
2010-12-22 13:15 ` [tip:perf/core] " tip-bot for Wu Zhangjin
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=4CC9E5B5.5040402@suse.cz \
--to=mmarek@suse.cz \
--cc=jreiser@bitwagon.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=sam@ravnborg.org \
--cc=wuzhangjin@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.