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-next>] [day] [month] [year] [list]
Message-Id: <f603e1dc44524b81ebc423dd226eb44d837a37be.1288175801.git.wuzhangjin@gmail.com>
Date:	Wed, 27 Oct 2010 18:39:56 +0800
From:	Wu Zhangjin <wuzhangjin@...il.com>
To:	rostedt@...dmis.org, linux-kernel@...r.kernel.org
Cc:	mingo@...e.hu, John Reiser <jreiser@...wagon.com>,
	Wu Zhangjin <wuzhangjin@...il.com>
Subject: [PATCH] ftrace: Speed up recordmcount

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.

Signed-off-by: Wu Zhangjin <wuzhangjin@...il.com>
---
 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
+		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
 
-- 
1.7.1

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