Commit 62a394eb authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge branches 'tracing/ftrace' and 'tracing/syscalls'; commit 'v2.6.29-rc8' into tracing/core

parents d2e82546 1b3fa2ce
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -35,6 +35,7 @@ config X86
	select HAVE_FUNCTION_GRAPH_TRACER
	select HAVE_FUNCTION_GRAPH_TRACER
	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
	select HAVE_FUNCTION_TRACE_MCOUNT_TEST
	select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
	select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
	select HAVE_FTRACE_SYSCALLS
	select HAVE_KVM
	select HAVE_KVM
	select HAVE_ARCH_KGDB
	select HAVE_ARCH_KGDB
	select HAVE_ARCH_TRACEHOOK
	select HAVE_ARCH_TRACEHOOK
+6 −3
Original line number Original line Diff line number Diff line
@@ -94,6 +94,7 @@ struct thread_info {
#define TIF_FORCED_TF		24	/* true if TF in eflags artificially */
#define TIF_FORCED_TF		24	/* true if TF in eflags artificially */
#define TIF_DEBUGCTLMSR		25	/* uses thread_struct.debugctlmsr */
#define TIF_DEBUGCTLMSR		25	/* uses thread_struct.debugctlmsr */
#define TIF_DS_AREA_MSR		26      /* uses thread_struct.ds_area_msr */
#define TIF_DS_AREA_MSR		26      /* uses thread_struct.ds_area_msr */
#define TIF_SYSCALL_FTRACE	27	/* for ftrace syscall instrumentation */


#define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
#define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
#define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
#define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
@@ -115,15 +116,17 @@ struct thread_info {
#define _TIF_FORCED_TF		(1 << TIF_FORCED_TF)
#define _TIF_FORCED_TF		(1 << TIF_FORCED_TF)
#define _TIF_DEBUGCTLMSR	(1 << TIF_DEBUGCTLMSR)
#define _TIF_DEBUGCTLMSR	(1 << TIF_DEBUGCTLMSR)
#define _TIF_DS_AREA_MSR	(1 << TIF_DS_AREA_MSR)
#define _TIF_DS_AREA_MSR	(1 << TIF_DS_AREA_MSR)
#define _TIF_SYSCALL_FTRACE	(1 << TIF_SYSCALL_FTRACE)


/* work to do in syscall_trace_enter() */
/* work to do in syscall_trace_enter() */
#define _TIF_WORK_SYSCALL_ENTRY	\
#define _TIF_WORK_SYSCALL_ENTRY	\
	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | \
	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | _TIF_SYSCALL_FTRACE |	\
	 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP)
	 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP)


/* work to do in syscall_trace_leave() */
/* work to do in syscall_trace_leave() */
#define _TIF_WORK_SYSCALL_EXIT	\
#define _TIF_WORK_SYSCALL_EXIT	\
	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP)
	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP |	\
	 _TIF_SYSCALL_FTRACE)


/* work to do on interrupt/exception return */
/* work to do on interrupt/exception return */
#define _TIF_WORK_MASK							\
#define _TIF_WORK_MASK							\
@@ -132,7 +135,7 @@ struct thread_info {
	   _TIF_SINGLESTEP|_TIF_SECCOMP|_TIF_SYSCALL_EMU))
	   _TIF_SINGLESTEP|_TIF_SECCOMP|_TIF_SYSCALL_EMU))


/* work to do on any return to user space */
/* work to do on any return to user space */
#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
#define _TIF_ALLWORK_MASK ((0x0000FFFF & ~_TIF_SECCOMP) | _TIF_SYSCALL_FTRACE)


/* Only used for 64 bit */
/* Only used for 64 bit */
#define _TIF_DO_NOTIFY_MASK						\
#define _TIF_DO_NOTIFY_MASK						\
+7 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/audit.h>
#include <linux/audit.h>
#include <linux/seccomp.h>
#include <linux/seccomp.h>
#include <linux/signal.h>
#include <linux/signal.h>
#include <linux/ftrace.h>


#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/pgtable.h>
@@ -1416,6 +1417,9 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs)
	    tracehook_report_syscall_entry(regs))
	    tracehook_report_syscall_entry(regs))
		ret = -1L;
		ret = -1L;


	if (unlikely(test_thread_flag(TIF_SYSCALL_FTRACE)))
		ftrace_syscall_enter(regs);

	if (unlikely(current->audit_context)) {
	if (unlikely(current->audit_context)) {
		if (IS_IA32)
		if (IS_IA32)
			audit_syscall_entry(AUDIT_ARCH_I386,
			audit_syscall_entry(AUDIT_ARCH_I386,
@@ -1439,6 +1443,9 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)
	if (unlikely(current->audit_context))
	if (unlikely(current->audit_context))
		audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax);
		audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax);


	if (unlikely(test_thread_flag(TIF_SYSCALL_FTRACE)))
		ftrace_syscall_exit(regs);

	if (test_thread_flag(TIF_SYSCALL_TRACE))
	if (test_thread_flag(TIF_SYSCALL_TRACE))
		tracehook_report_syscall_exit(regs, 0);
		tracehook_report_syscall_exit(regs, 0);


+21 −0
Original line number Original line Diff line number Diff line
@@ -503,4 +503,25 @@ static inline void trace_hw_branch_oops(void) {}


#endif /* CONFIG_HW_BRANCH_TRACER */
#endif /* CONFIG_HW_BRANCH_TRACER */


/*
 * A syscall entry in the ftrace syscalls array.
 *
 * @syscall_nr: syscall number
 */
struct syscall_trace_entry {
	int		syscall_nr;
};

#ifdef CONFIG_FTRACE_SYSCALLS
extern void start_ftrace_syscalls(void);
extern void stop_ftrace_syscalls(void);
extern void ftrace_syscall_enter(struct pt_regs *regs);
extern void ftrace_syscall_exit(struct pt_regs *regs);
#else
static inline void start_ftrace_syscalls(void) { }
static inline void stop_ftrace_syscalls(void) { }
static inline void ftrace_syscall_enter(struct pt_regs *regs) { }
static inline void ftrace_syscall_exit(struct pt_regs *regs) { }
#endif

#endif /* _LINUX_FTRACE_H */
#endif /* _LINUX_FTRACE_H */
+10 −0
Original line number Original line Diff line number Diff line
@@ -34,6 +34,9 @@ config HAVE_FTRACE_MCOUNT_RECORD
config HAVE_HW_BRANCH_TRACER
config HAVE_HW_BRANCH_TRACER
	bool
	bool


config HAVE_FTRACE_SYSCALLS
	bool

config TRACER_MAX_TRACE
config TRACER_MAX_TRACE
	bool
	bool


@@ -175,6 +178,13 @@ config EVENT_TRACER
	  allowing the user to pick and choose which trace point they
	  allowing the user to pick and choose which trace point they
	  want to trace.
	  want to trace.


config FTRACE_SYSCALLS
	bool "Trace syscalls"
	depends on HAVE_FTRACE_SYSCALLS
	select TRACING
	help
	  Basic tracer to catch the syscall entry and exit events.

config BOOT_TRACER
config BOOT_TRACER
	bool "Trace boot initcalls"
	bool "Trace boot initcalls"
	select TRACING
	select TRACING
Loading