Commit d983c89c authored by Vasily Gorbik's avatar Vasily Gorbik Committed by Steven Rostedt (VMware)

s390/ftrace: Add -mfentry and -mnop-mcount support

Utilize -mfentry and -mnop-mcount gcc options together with
-mrecord-mcount to get compiler generated calls to the profiling functions
as nops which are compatible with current -mhotpatch=0,3 approach.  At the
same time -mrecord-mcount enables __mcount_loc section generation by
the compiler which allows to avoid using scripts/recordmcount.pl script.

Link: http://lkml.kernel.org/r/patch-4.thread-aa7b8d.git-aa7b8dbf236f.your-ad-here.call-01533557518-ext-9465@work.hoursReviewed-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 2f4df001
...@@ -136,6 +136,7 @@ config S390 ...@@ -136,6 +136,7 @@ config S390
select HAVE_DYNAMIC_FTRACE select HAVE_DYNAMIC_FTRACE
select HAVE_DYNAMIC_FTRACE_WITH_REGS select HAVE_DYNAMIC_FTRACE_WITH_REGS
select HAVE_EFFICIENT_UNALIGNED_ACCESS select HAVE_EFFICIENT_UNALIGNED_ACCESS
select HAVE_FENTRY
select HAVE_FTRACE_MCOUNT_RECORD select HAVE_FTRACE_MCOUNT_RECORD
select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_GRAPH_TRACER
select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_TRACER
...@@ -157,6 +158,7 @@ config S390 ...@@ -157,6 +158,7 @@ config S390
select HAVE_MEMBLOCK_NODE_MAP select HAVE_MEMBLOCK_NODE_MAP
select HAVE_MEMBLOCK_PHYS_MAP select HAVE_MEMBLOCK_PHYS_MAP
select HAVE_MOD_ARCH_SPECIFIC select HAVE_MOD_ARCH_SPECIFIC
select HAVE_NOP_MCOUNT
select HAVE_OPROFILE select HAVE_OPROFILE
select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS
select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_REGS_AND_STACK_ACCESS_API
......
...@@ -86,13 +86,15 @@ ifdef CONFIG_EXPOLINE ...@@ -86,13 +86,15 @@ ifdef CONFIG_EXPOLINE
endif endif
ifdef CONFIG_FUNCTION_TRACER ifdef CONFIG_FUNCTION_TRACER
# make use of hotpatch feature if the compiler supports it ifeq ($(call cc-option-yn,-mfentry -mnop-mcount),n)
cc_hotpatch := -mhotpatch=0,3 # make use of hotpatch feature if the compiler supports it
ifeq ($(call cc-option-yn,$(cc_hotpatch)),y) cc_hotpatch := -mhotpatch=0,3
CC_FLAGS_FTRACE := $(cc_hotpatch) ifeq ($(call cc-option-yn,$(cc_hotpatch)),y)
KBUILD_AFLAGS += -DCC_USING_HOTPATCH CC_FLAGS_FTRACE := $(cc_hotpatch)
KBUILD_CFLAGS += -DCC_USING_HOTPATCH KBUILD_AFLAGS += -DCC_USING_HOTPATCH
endif KBUILD_CFLAGS += -DCC_USING_HOTPATCH
endif
endif
endif endif
# Test CFI features of binutils # Test CFI features of binutils
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#define ARCH_SUPPORTS_FTRACE_OPS 1 #define ARCH_SUPPORTS_FTRACE_OPS 1
#ifdef CC_USING_HOTPATCH #if defined(CC_USING_HOTPATCH) || defined(CC_USING_NOP_MCOUNT)
#define MCOUNT_INSN_SIZE 6 #define MCOUNT_INSN_SIZE 6
#else #else
#define MCOUNT_INSN_SIZE 24 #define MCOUNT_INSN_SIZE 24
...@@ -42,7 +42,7 @@ struct ftrace_insn { ...@@ -42,7 +42,7 @@ struct ftrace_insn {
static inline void ftrace_generate_nop_insn(struct ftrace_insn *insn) static inline void ftrace_generate_nop_insn(struct ftrace_insn *insn)
{ {
#ifdef CONFIG_FUNCTION_TRACER #ifdef CONFIG_FUNCTION_TRACER
#ifdef CC_USING_HOTPATCH #if defined(CC_USING_HOTPATCH) || defined(CC_USING_NOP_MCOUNT)
/* brcl 0,0 */ /* brcl 0,0 */
insn->opc = 0xc004; insn->opc = 0xc004;
insn->disp = 0; insn->disp = 0;
...@@ -57,7 +57,7 @@ static inline void ftrace_generate_nop_insn(struct ftrace_insn *insn) ...@@ -57,7 +57,7 @@ static inline void ftrace_generate_nop_insn(struct ftrace_insn *insn)
static inline int is_ftrace_nop(struct ftrace_insn *insn) static inline int is_ftrace_nop(struct ftrace_insn *insn)
{ {
#ifdef CONFIG_FUNCTION_TRACER #ifdef CONFIG_FUNCTION_TRACER
#ifdef CC_USING_HOTPATCH #if defined(CC_USING_HOTPATCH) || defined(CC_USING_NOP_MCOUNT)
if (insn->disp == 0) if (insn->disp == 0)
return 1; return 1;
#else #else
......
...@@ -61,7 +61,7 @@ unsigned long ftrace_plt; ...@@ -61,7 +61,7 @@ unsigned long ftrace_plt;
static inline void ftrace_generate_orig_insn(struct ftrace_insn *insn) static inline void ftrace_generate_orig_insn(struct ftrace_insn *insn)
{ {
#ifdef CC_USING_HOTPATCH #if defined(CC_USING_HOTPATCH) || defined(CC_USING_NOP_MCOUNT)
/* brcl 0,0 */ /* brcl 0,0 */
insn->opc = 0xc004; insn->opc = 0xc004;
insn->disp = 0; insn->disp = 0;
......
...@@ -35,7 +35,7 @@ ENTRY(ftrace_caller) ...@@ -35,7 +35,7 @@ ENTRY(ftrace_caller)
.globl ftrace_regs_caller .globl ftrace_regs_caller
.set ftrace_regs_caller,ftrace_caller .set ftrace_regs_caller,ftrace_caller
lgr %r1,%r15 lgr %r1,%r15
#ifndef CC_USING_HOTPATCH #if !(defined(CC_USING_HOTPATCH) || defined(CC_USING_NOP_MCOUNT))
aghi %r0,MCOUNT_RETURN_FIXUP aghi %r0,MCOUNT_RETURN_FIXUP
#endif #endif
aghi %r15,-STACK_FRAME_SIZE aghi %r15,-STACK_FRAME_SIZE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment