Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72441cb1 authored by Steven Rostedt's avatar Steven Rostedt Committed by Steven Rostedt
Browse files

ftrace/x86: Add support for C version of recordmcount



This patch adds the support for the C version of recordmcount and
compile times show ~ 12% improvement.

After verifying this works, other archs can add:

 HAVE_C_MCOUNT_RECORD

in its Kconfig and it will use the C version of recordmcount
instead of the perl version.

Cc: <linux-arch@vger.kernel.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: John Reiser <jreiser@bitwagon.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 81d3858d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -568,6 +568,12 @@ endif

ifdef CONFIG_FUNCTION_TRACER
KBUILD_CFLAGS	+= -pg
ifdef CONFIG_DYNAMIC_FTRACE
	ifdef CONFIG_HAVE_C_MCOUNT_RECORD
		BUILD_C_RECORDMCOUNT := y
		export BUILD_C_RECORDMCOUNT
	endif
endif
endif

# We trigger additional mismatches with less inlining
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ config X86
	select HAVE_KRETPROBES
	select HAVE_OPTPROBES
	select HAVE_FTRACE_MCOUNT_RECORD
	select HAVE_C_MCOUNT_RECORD
	select HAVE_DYNAMIC_FTRACE
	select HAVE_FUNCTION_TRACER
	select HAVE_FUNCTION_GRAPH_TRACER
+5 −0
Original line number Diff line number Diff line
@@ -49,6 +49,11 @@ config HAVE_SYSCALL_TRACEPOINTS
	help
	  See Documentation/trace/ftrace-design.txt

config HAVE_C_MCOUNT_RECORD
	bool
	help
	  C version of recordmcount available?

config TRACER_MAX_TRACE
	bool

+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ hostprogs-$(CONFIG_KALLSYMS) += kallsyms
hostprogs-$(CONFIG_LOGO)         += pnmtologo
hostprogs-$(CONFIG_VT)           += conmakehash
hostprogs-$(CONFIG_IKCONFIG)     += bin2c
hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount

always		:= $(hostprogs-y) $(hostprogs-m)

+4 −0
Original line number Diff line number Diff line
@@ -209,12 +209,16 @@ cmd_modversions = \
endif

ifdef CONFIG_FTRACE_MCOUNT_RECORD
ifdef BUILD_C_RECORDMCOUNT
cmd_record_mcount = $(srctree)/scripts/recordmcount "$(@)";
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)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
	"$(if $(part-of-module),1,0)" "$(@)";
endif
endif

define rule_cc_o_c
	$(call echo-cmd,checksrc) $(cmd_checksrc)			  \