aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSven Schnelle <svens@linux.ibm.com>2021-09-24 15:03:07 +0200
committerVasily Gorbik <gor@linux.ibm.com>2021-10-04 09:49:37 +0200
commitf768a20c0a6e5f2396b9ab99bbbfd39d91228df9 (patch)
treed296e5171468dbb3b150c2d250f104dd7e4d8cb1 /arch
parents390/sclp_sd: fix warnings about missing parameter description (diff)
downloadlinux-dev-f768a20c0a6e5f2396b9ab99bbbfd39d91228df9.tar.xz
linux-dev-f768a20c0a6e5f2396b9ab99bbbfd39d91228df9.zip
s390/ftrace: add FTRACE_GEN_NOP_ASM macro
FTRACE_GEN_NOP_ASM(name) can be used to generate assembly functions with the required information added to allow tracing via kprobes/ftrace. It adds the nop instruction which will be patched by ftrace later. If the compiler supports -mnop-mcount it will also add an entry to the __mcount_loc section. Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/ftrace.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h
index e8b460f39c58..d1841f4176be 100644
--- a/arch/s390/include/asm/ftrace.h
+++ b/arch/s390/include/asm/ftrace.h
@@ -68,4 +68,32 @@ static inline bool arch_syscall_match_sym_name(const char *sym,
}
#endif /* __ASSEMBLY__ */
+
+#ifdef CONFIG_FUNCTION_TRACER
+
+#define FTRACE_NOP_INSN .word 0xc004, 0x0000, 0x0000 /* brcl 0,0 */
+
+#ifndef CC_USING_HOTPATCH
+
+#define FTRACE_GEN_MCOUNT_RECORD(name) \
+ .section __mcount_loc, "a", @progbits; \
+ .quad name; \
+ .previous;
+
+#else /* !CC_USING_HOTPATCH */
+
+#define FTRACE_GEN_MCOUNT_RECORD(name)
+
+#endif /* !CC_USING_HOTPATCH */
+
+#define FTRACE_GEN_NOP_ASM(name) \
+ FTRACE_GEN_MCOUNT_RECORD(name) \
+ FTRACE_NOP_INSN
+
+#else /* CONFIG_FUNCTION_TRACER */
+
+#define FTRACE_GEN_NOP_ASM(name)
+
+#endif /* CONFIG_FUNCTION_TRACER */
+
#endif /* _ASM_S390_FTRACE_H */