lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1288185700.18238.117.camel@gandalf.stny.rr.com>
Date:	Wed, 27 Oct 2010 09:21:40 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Wu Zhangjin <wuzhangjin@...il.com>
Cc:	linux-kernel@...r.kernel.org, mingo@...e.hu,
	John Reiser <jreiser@...wagon.com>,
	Michal Marek <mmarek@...e.cz>,
	linux-kbuild <linux-kbuild@...r.kernel.org>,
	Sam Ravnborg <sam@...nborg.org>
Subject: Re: [PATCH] ftrace: Speed up recordmcount

[ Added kbuild maintainers ]

On Wed, 2010-10-27 at 18:39 +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@...il.com>
> 
> cmd_record_mcount is only needed for the targets who are compiled with
> -pg, so, only define it when CONFIG_FTRACE_MCOUNT_RECORD is defined and
> only use it for the targets who are compiled with -pg.

Thanks! I was going to do this myself, but just have not gotten around
to it.

> 
> Signed-off-by: Wu Zhangjin <wuzhangjin@...il.com>

I need a SoB from Michal to apply it.

> ---
>  Makefile               |   11 ++++++++---
>  scripts/Makefile.build |   26 ++++++++++++++++----------
>  2 files changed, 24 insertions(+), 13 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 3e43805..60d7a87 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -576,9 +576,14 @@ endif
>  ifdef CONFIG_FUNCTION_TRACER
>  KBUILD_CFLAGS	+= -pg
>  ifdef CONFIG_DYNAMIC_FTRACE
> -	ifdef CONFIG_HAVE_C_RECORDMCOUNT
> -		BUILD_C_RECORDMCOUNT := y
> -		export BUILD_C_RECORDMCOUNT
> +	ifdef CONFIG_FTRACE_MCOUNT_RECORD

FTRACE_MCOUNT_RECORD depends on DYNAMIC_FTRACE, so if you require
FTRACE_MCOUNT_RECORD, you can remove the ifdef CONFIG_DYNAMIC_FTRACE.


> +		DEFINE_CMD_RECORD_MCOUNT := y
> +		export DEFINE_CMD_RECORD_MCOUNT
> +
> +		ifdef CONFIG_HAVE_C_RECORDMCOUNT
> +			BUILD_C_RECORDMCOUNT := y
> +			export BUILD_C_RECORDMCOUNT
> +		endif
>  	endif
>  endif
>  endif
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 5ad25e1..ceb5175 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -208,22 +208,28 @@ cmd_modversions =								\
>  	fi;
>  endif
>  
> -ifdef CONFIG_FTRACE_MCOUNT_RECORD
> +ifdef DEFINE_CMD_RECORD_MCOUNT
>  ifdef BUILD_C_RECORDMCOUNT
>  # Due to recursion, we must skip empty.o.
>  # 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;
> +cmd_record_mcount =							\
> +	if [ "$(findstring -pg,$(KBUILD_CFLAGS))" == "-pg" ]; then	\
> +		if [ $(@) != "scripts/mod/empty.o" ]; then		\
> +			$(objtree)/scripts/recordmcount "$(@)";		\
> +		fi;							\
> +	fi;
>  else
> -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)" "$(@)";
> +cmd_record_mcount = 							\
> +	if [ "$(findstring -pg,$(KBUILD_CFLAGS))" == "-pg" ]; then	\
> +		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)" "$(@)";			\
> +	fi;
>  endif
>  endif
>  


Note, this does not catch objects that have the -pg stripped by
CFLAGS_REMOVE_object.o


How about something like this:

ifdef DEFINE_CMD_RECORD_MCOUNT
ifdef BUILD_C_RECORDMCOUNT
sub_cmd_record_mcount = if [ $(@) != "scripts/mod/empty.o" ]; then		\
			$(objtree)/scripts/recordmcount "$(@)";			\
		    fi;
else
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


I tested the above and it seemed to work (although, I did it on another
machine, and copied it here by hand, so this version may have a typo).

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ