All of lore.kernel.org
 help / color / mirror / Atom feed
* [v2 PATCH] ftrace: Speed up recordmcount
@ 2010-10-27 16:24 Wu Zhangjin
  2010-10-28  2:21 ` Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wu Zhangjin @ 2010-10-27 16:24 UTC (permalink / raw)
  To: rostedt, linux-kernel
  Cc: mingo, John Reiser, Sam Ravnborg, linux-kbuild, Michal Marek,
	Wu Zhangjin

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

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>
---
 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
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [v2 PATCH] ftrace: Speed up recordmcount
  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
  2010-12-22 13:15 ` [tip:perf/core] " tip-bot for Wu Zhangjin
  2 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2010-10-28  2:21 UTC (permalink / raw)
  To: Wu Zhangjin
  Cc: linux-kernel, mingo, John Reiser, Sam Ravnborg, linux-kbuild,
	Michal Marek

Michal,

Can you give an Acked-by: on this patch?

Thanks!

-- Steve


On Thu, 2010-10-28 at 00:24 +0800, 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
> 
> 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>
> ---
>  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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [v2 PATCH] ftrace: Speed up recordmcount
  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
  2010-11-09  5:35   ` wu zhangjin
  2010-12-22 13:15 ` [tip:perf/core] " tip-bot for Wu Zhangjin
  2 siblings, 1 reply; 6+ messages in thread
From: Michal Marek @ 2010-10-28 21:05 UTC (permalink / raw)
  To: Wu Zhangjin
  Cc: rostedt, linux-kernel, mingo, John Reiser, Sam Ravnborg,
	linux-kbuild

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [v2 PATCH] ftrace: Speed up recordmcount
  2010-10-28 21:05 ` Michal Marek
@ 2010-11-09  5:35   ` wu zhangjin
  2010-11-09 13:53     ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: wu zhangjin @ 2010-11-09  5:35 UTC (permalink / raw)
  To: rostedt
  Cc: linux-kernel, mingo, John Reiser, Sam Ravnborg, linux-kbuild,
	Michal Marek

Hi, Steve

On 10/29/10, Michal Marek <mmarek@suse.cz> wrote:
> 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
>

Did you apply this patch, should I fix this typo and resend it to you?

Best Regards,
Wu Zhangjin

>
>> 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
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [v2 PATCH] ftrace: Speed up recordmcount
  2010-11-09  5:35   ` wu zhangjin
@ 2010-11-09 13:53     ` Steven Rostedt
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2010-11-09 13:53 UTC (permalink / raw)
  To: wu zhangjin
  Cc: linux-kernel, mingo, John Reiser, Sam Ravnborg, linux-kbuild,
	Michal Marek

On Tue, 2010-11-09 at 13:35 +0800, wu zhangjin wrote:

> Did you apply this patch, should I fix this typo and resend it to you?

I applied it, but during testing it triggered a bug in the build system.

I'm looking into it. It is not really related to this patch, but I can't
submit it till the build is fix.

Also, since it is not that critical of a patch, I think I'll queue it
for 2.6.38, just to be safe.

Thanks,

-- Steve



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:perf/core] ftrace: Speed up recordmcount
  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
@ 2010-12-22 13:15 ` tip-bot for Wu Zhangjin
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Wu Zhangjin @ 2010-12-22 13:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, wuzhangjin, rostedt, mmarek, tglx

Commit-ID:  45677454dd6d128608117abe7dcd2bdfdd7cdf72
Gitweb:     http://git.kernel.org/tip/45677454dd6d128608117abe7dcd2bdfdd7cdf72
Author:     Wu Zhangjin <wuzhangjin@gmail.com>
AuthorDate: Thu, 28 Oct 2010 00:24:34 +0800
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Thu, 18 Nov 2010 17:16:05 -0500

ftrace: Speed up recordmcount

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:

CFLAGS_REMOVE_file.o = -pg

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>)

Acked-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
LKML-Reference: <3dc8cddf022eb7024f9f2cf857529a15bee8999a.1288196498.git.wuzhangjin@gmail.com>

[ changed if [ .. == .. ] to if [ .. = .. ] to handle dash environments ]

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 scripts/Makefile.build |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 5ad25e1..4eb99ab 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-22 13:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.