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

Commit 02424d89 authored by Ian Munsie's avatar Ian Munsie Committed by Benjamin Herrenschmidt
Browse files

powerpc/ftrace: Implement raw syscall tracepoints on PowerPC



This patch implements the raw syscall tracepoints on PowerPC and exports
them for ftrace syscalls to use.

To minimise reworking existing code, I slightly re-ordered the thread
info flags such that the new TIF_SYSCALL_TRACEPOINT bit would still fit
within the 16 bits of the andi. instruction's UI field. The instructions
in question are in /arch/powerpc/kernel/entry_{32,64}.S to and the
_TIF_SYSCALL_T_OR_A with the thread flags to see if system call tracing
is enabled.

In the case of 64bit PowerPC, arch_syscall_addr and
arch_syscall_match_sym_name are overridden to allow ftrace syscalls to
work given the unusual system call table structure and symbol names that
start with a period.

Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 3f5785ec
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -141,6 +141,7 @@ config PPC
	select GENERIC_IRQ_SHOW
	select GENERIC_IRQ_SHOW
	select GENERIC_IRQ_SHOW_LEVEL
	select GENERIC_IRQ_SHOW_LEVEL
	select HAVE_RCU_TABLE_FREE if SMP
	select HAVE_RCU_TABLE_FREE if SMP
	select HAVE_SYSCALL_TRACEPOINTS


config EARLY_PRINTK
config EARLY_PRINTK
	bool
	bool
+14 −0
Original line number Original line Diff line number Diff line
@@ -60,4 +60,18 @@ struct dyn_arch_ftrace {


#endif
#endif


#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_PPC64) && !defined(__ASSEMBLY__)
#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
{
	/*
	 * Compare the symbol name with the system call name. Skip the .sys or .SyS
	 * prefix from the symbol name and the sys prefix from the system call name and
	 * just match the rest. This is only needed on ppc64 since symbol names on
	 * 32bit do not start with a period so the generic function will work.
	 */
	return !strcmp(sym + 4, name + 3);
}
#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_PPC64 && !__ASSEMBLY__ */

#endif /* _ASM_POWERPC_FTRACE */
#endif /* _ASM_POWERPC_FTRACE */
+5 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,11 @@


#include <linux/sched.h>
#include <linux/sched.h>


/* ftrace syscalls requires exporting the sys_call_table */
#ifdef CONFIG_FTRACE_SYSCALLS
extern const unsigned long *sys_call_table;
#endif /* CONFIG_FTRACE_SYSCALLS */

static inline long syscall_get_nr(struct task_struct *task,
static inline long syscall_get_nr(struct task_struct *task,
				  struct pt_regs *regs)
				  struct pt_regs *regs)
{
{
+5 −2
Original line number Original line Diff line number Diff line
@@ -110,7 +110,8 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_NOERROR		12	/* Force successful syscall return */
#define TIF_NOERROR		12	/* Force successful syscall return */
#define TIF_NOTIFY_RESUME	13	/* callback before returning to user */
#define TIF_NOTIFY_RESUME	13	/* callback before returning to user */
#define TIF_FREEZE		14	/* Freezing for suspend */
#define TIF_FREEZE		14	/* Freezing for suspend */
#define TIF_RUNLATCH		15	/* Is the runlatch enabled? */
#define TIF_SYSCALL_TRACEPOINT	15	/* syscall tracepoint instrumentation */
#define TIF_RUNLATCH		16	/* Is the runlatch enabled? */


/* as above, but as bit values */
/* as above, but as bit values */
#define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
#define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
@@ -127,8 +128,10 @@ static inline struct thread_info *current_thread_info(void)
#define _TIF_NOERROR		(1<<TIF_NOERROR)
#define _TIF_NOERROR		(1<<TIF_NOERROR)
#define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
#define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
#define _TIF_FREEZE		(1<<TIF_FREEZE)
#define _TIF_FREEZE		(1<<TIF_FREEZE)
#define _TIF_SYSCALL_TRACEPOINT	(1<<TIF_SYSCALL_TRACEPOINT)
#define _TIF_RUNLATCH		(1<<TIF_RUNLATCH)
#define _TIF_RUNLATCH		(1<<TIF_RUNLATCH)
#define _TIF_SYSCALL_T_OR_A	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
#define _TIF_SYSCALL_T_OR_A	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
				 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)


#define _TIF_USER_WORK_MASK	(_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
#define _TIF_USER_WORK_MASK	(_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
				 _TIF_NOTIFY_RESUME)
				 _TIF_NOTIFY_RESUME)
+1 −0
Original line number Original line Diff line number Diff line
@@ -109,6 +109,7 @@ obj-$(CONFIG_PPC_IO_WORKAROUNDS) += io-workarounds.o


obj-$(CONFIG_DYNAMIC_FTRACE)	+= ftrace.o
obj-$(CONFIG_DYNAMIC_FTRACE)	+= ftrace.o
obj-$(CONFIG_FUNCTION_GRAPH_TRACER)	+= ftrace.o
obj-$(CONFIG_FUNCTION_GRAPH_TRACER)	+= ftrace.o
obj-$(CONFIG_FTRACE_SYSCALLS)	+= ftrace.o
obj-$(CONFIG_PERF_EVENTS)	+= perf_callchain.o
obj-$(CONFIG_PERF_EVENTS)	+= perf_callchain.o


obj-$(CONFIG_PPC_PERF_CTRS)	+= perf_event.o
obj-$(CONFIG_PPC_PERF_CTRS)	+= perf_event.o
Loading