tracing/core for v2.6.32
Subsystems (14)
Linus,
Please pull the tracing-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git tracing-core-for-linus
Highlights:
- Lockless ring-buffer
- Syscall tracepoints enhancements
- Filter engine updates
Thanks,
Ingo
------------------>
Albin Tonnerre (1):
tracing: Remove mentioning of legacy latency_trace file from documentation
Anirban Sinha (1):
tracing: Eliminate code duplication in kernel/tracepoint.c
Frederic Weisbecker (13):
tracing/function-graph-tracer: Use the %pf format
tracing/kmemtrace: Use the %pf format
tracing/function-graph-tracer: Drop the useless nmi protection tracing/core: Turn ftrace_cpu_disabled into a global var
tracing/core: Make the stack entry helpers global
tracing: Move sched event insertion helpers in the sched switch tracer file tracing/function-graph-tracer: Move graph event insertion helpers in the graph tracer file tracing/events: Only define remove_subsystem_dir() if CONFIG_MODULES
tracing: Add ftrace event call parameter to its field descriptor handler
tracing: Add fields format definition for syscall events
tracing: Support for syscall events raw records in perfcounters
tracing: Undef TRACE_EVENT_FN between trace events headers inclusion
tracing: Fix double CPP substitution in TRACE_EVENT_FN
Hendrik Brueckner (3):
tracing: Add syscall tracepoints - s390 arch update
tracing: Check invalid syscall nr while tracing syscalls
tracing: Don't trace kernel thread syscalls
Ingo Molnar (2):
tracing: Fix syscall tracing on !HAVE_FTRACE_SYSCALLS architectures [S390] ftrace: update system call tracer support
Jason Baron (16):
tracing: Map syscall name to number
tracing: Call arch_init_ftrace_syscalls at boot
tracing: Add DECLARE_TRACE_WITH_CALLBACK() macro
tracing: Add syscall tracepoints
tracing: Update FTRACE_SYSCALL_MAX
tracing: Raw_init() bailout in trace event register fail case
tracing: Add ftrace_event_call void * 'data' field
tracing: Add trace events for each syscall entry/exit
tracing: Add individual syscalls tracepoint id support
tracing: Add perf counter support for syscalls tracing
tracing: Add more namespace area to 'perf list' output
tracing: Convert x86_64 mmap and uname to use DEFINE_SYSCALL
tracing: Define NR_syscalls for x86 (32)
tracing: Define NR_syscalls for x86_64
tracing: Convert event tracing code to use NR_syscalls
tracing: Remove FTRACE_SYSCALL_MAX definitions
Josh Stone (4):
tracing: Rename FTRACE_SYSCALLS for tracepoints
tracing: Make syscall tracepoints conditional
tracing: Move tracepoint callbacks from declaration to definition
tracing: Create generic syscall TRACE_EVENTs
Josh Triplett (1):
tracing: Add vim script to enable folding for function_graph traces
Lai Jiangshan (5):
tracing/stat: Add stat_release() callback tracing/workqueues: Add refcnt to struct cpu_workqueue_stats
ring_buffer: Fix warning while ignoring cmpxchg return value tracing/events: add missing type info of dynamic arrays
tracing: Simplify print_graph_cpu()
Li Zefan (21):
tracing/events: Add trace_event boot option
kmemtrace: Print binary output only if 'bin' option is set
kmemtrace: Rename some functions
tracing/events: record the size of dynamic arrays tracing/filters: improve subsystem filter tracing/events: Add module tracepoints tracing/syscalls: Fix to print parameter types
trace_stat: Fix missing entry in stat file
trace_stack: Simplify seqfile code
ftrace: Simplify seqfile code
tracing/syscalls: Fix fields format for enter events tracing/syscalls: Add fields format for exit events tracing/events: Add ftrace_event_call param to define_fields() tracing/events: Add trace_define_common_fields() tracing/syscalls: Add filtering support tracing/syscalls: Fix the output of syscalls with no arguments tracing/filters: Add filter_type to struct ftrace_event_field tracing/filters: Add __field_ext() to TRACE_EVENT tracing/filters: Support filtering for char * strings tracing/filters: Defer pred allocation tracing/filters: Defer pred allocation, fix memory leak
Masami Hiramatsu (1):
kprobes: Clean up insn_pages by using list instead of hlist
Steven Rostedt (25):
ring-buffer: make the buffer a true circular link list
ring-buffer: make lockless
ring-buffer: add design document
tracing/sched: show CPU task wakes up on in trace event
tracing: add comments to explain TRACE_EVENT out of protection
tracing: remove legacy select of MARKERS by context switch tracing
tracing: only show tracing_max_latency when latency tracer configured
ring-buffer: do not reset while in a commit
ring-buffer: do not swap buffers during a commit
ring-buffer: remove unnecessary cpu_relax
ring-buffer: fix ring_buffer_read crossing pages
ring-buffer: remove ring_buffer_event_discard
ring-buffer: do not count discarded events
ring-buffer: disable all cpu buffers when one finds a problem
tracing: print out start and stop in latency traces
tracing: disable update max tracer while reading trace
tracing: disable buffers and synchronize_sched before resetting
tracing: remove users of tracing_reset
tracing: use timestamp to determine start of latency traces
tracing: make tracing_reset safe for external use
tracing: pass around ring buffer instead of tracer
tracing: add trace_array_printk for internal tracers to use
tracing: report error in trace if we fail to swap latency buffer
ring-buffer: check for swapped buffers in start of committing
ring-buffer: only enable ring_buffer_swap_cpu when needed
Tom Zanussi (1):
tracing/filters: Don't use pred on alloc failure
Xiao Guangrong (7):
tracing/filter: Remove preds from struct event_subsystem tracing/filter: Remove empty subsystem and its directory tracing/function: Simplify __ftrace_replace_code() tracing/trace_stack: Cleanup for trace_lookup_stack() tracing/function: Cleanup for function tracer
tracing: cleanup for tracing_trace_options_read() tracing/events: fix the include file dependencies
Zhaolei (2):
tracing: Rename set_tracer_flags()'s local variable trace_flags
ftrace: Move setting of clock-source out of options
[email protected] (2):
tracing: Remove unused fields/variables
tracing: Remove .globl in the scripts/recordmcount.pl doc
Documentation/kernel-parameters.txt | 5 + Documentation/trace/events.txt | 9 + Documentation/trace/ftrace.txt | 68 +- Documentation/trace/function-graph-fold.vim | 42 + Documentation/trace/ring-buffer-design.txt | 955 +++++++++++++++++++++++ arch/s390/Kconfig | 2 +- arch/s390/defconfig | 2 +- arch/s390/include/asm/thread_info.h | 4 +- arch/s390/kernel/entry.S | 2 +- arch/s390/kernel/entry64.S | 2 +- arch/s390/kernel/ftrace.c | 36 +- arch/s390/kernel/ptrace.c | 11 +- arch/x86/Kconfig | 2 +- arch/x86/configs/i386_defconfig | 2 +- arch/x86/configs/x86_64_defconfig | 2 +- arch/x86/include/asm/ftrace.h | 7 - arch/x86/include/asm/thread_info.h | 13 +- arch/x86/include/asm/unistd_32.h | 2 + arch/x86/include/asm/unistd_64.h | 6 + arch/x86/kernel/asm-offsets_64.c | 1 + arch/x86/kernel/ftrace.c | 51 +- arch/x86/kernel/ptrace.c | 13 +- arch/x86/kernel/sys_x86_64.c | 8 +- include/linux/ftrace_event.h | 51 +- include/linux/module.h | 14 +- include/linux/perf_counter.h | 2 + include/linux/ring_buffer.h | 24 +- include/linux/syscalls.h | 131 +++- include/linux/tracepoint.h | 29 +- include/trace/define_trace.h | 7 + include/trace/events/module.h | 126 +++ include/trace/events/sched.h | 12 +- include/trace/events/syscalls.h | 70 ++ include/trace/ftrace.h | 93 ++- include/trace/syscall.h | 48 +- kernel/kmod.c | 4 + kernel/kprobes.c | 30 +- kernel/module.c | 11 + kernel/trace/Kconfig | 13 +- kernel/trace/blktrace.c | 12 +- kernel/trace/ftrace.c | 107 +-- kernel/trace/kmemtrace.c | 149 +++-- kernel/trace/ring_buffer.c | 1112 +++++++++++++++++++++------ kernel/trace/trace.c | 679 +++++++++-------- kernel/trace/trace.h | 76 ++- kernel/trace/trace_boot.c | 16 +- kernel/trace/trace_events.c | 146 +++- kernel/trace/trace_events_filter.c | 261 ++++--- kernel/trace/trace_export.c | 28 +- kernel/trace/trace_functions.c | 4 +- kernel/trace/trace_functions_graph.c | 166 +++- kernel/trace/trace_irqsoff.c | 3 +- kernel/trace/trace_mmiotrace.c | 10 +- kernel/trace/trace_power.c | 22 +- kernel/trace/trace_sched_switch.c | 59 ++ kernel/trace/trace_sched_wakeup.c | 7 +- kernel/trace/trace_selftest.c | 1 + kernel/trace/trace_stack.c | 43 +- kernel/trace/trace_stat.c | 17 +- kernel/trace/trace_stat.h | 2 + kernel/trace/trace_syscalls.c | 471 +++++++++--- kernel/trace/trace_workqueue.c | 32 +- kernel/tracepoint.c | 50 ++- scripts/recordmcount.pl | 1 - tools/perf/util/parse-events.c | 8 +- 65 files changed, 4106 insertions(+), 1286 deletions(-) create mode 100644 Documentation/trace/function-graph-fold.vim create mode 100644 Documentation/trace/ring-buffer-design.txt create mode 100644 include/trace/events/module.h create mode 100644 include/trace/events/syscalls.h
Documentation/kernel-parameters.txt +5 -0
@@ -2480,6 +2480,11 @@ and is between 256 and 4096 characters. It is defined in the file trace_buf_size=nn[KMG] [FTRACE] will set tracing buffer size. + trace_event=[event-list] + [FTRACE] Set and start specified trace events in order + to facilitate early boot debugging. + See also Documentation/trace/events.txt + trix= [HW,OSS] MediaTrix AudioTrix Pro Format: <io>,<irq>,<dma>,<dma2>,<sb_io>,<sb_irq>,<sb_dma>,<mpu_io>,<mpu_irq>
Documentation/trace/events.txt +9 -0
@@ -83,6 +83,15 @@ When reading one of these enable files, there are four results: X - there is a mixture of events enabled and disabled ? - this file does not affect any event +2.3 Boot option +--------------- + +In order to facilitate early boot debugging, use boot option: + + trace_event=[event-list] + +The format of this boot option is the same as described in section 2.1. + 3. Defining an event-enabled tracepoint =======================================
Documentation/trace/ftrace.txt +36 -32
163 lines not on this page · raw message
Documentation/trace/function-graph-fold.vim new file +42 -0
42 lines not on this page · raw message
Documentation/trace/ring-buffer-design.txt new file +955 -0
955 lines not on this page · raw message
arch/s390/Kconfig +1 -1
@@ -84,7 +84,7 @@ config S390 select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_TRACE_MCOUNT_TEST select HAVE_FTRACE_MCOUNT_RECORD - select HAVE_FTRACE_SYSCALLS + select HAVE_SYSCALL_TRACEPOINTS select HAVE_DYNAMIC_FTRACE select HAVE_FUNCTION_GRAPH_TRACER select HAVE_DEFAULT_NO_SPIN_MUTEXES
arch/s390/defconfig +1 -1
@@ -900,7 +900,7 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y CONFIG_HAVE_DYNAMIC_FTRACE=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_FTRACE_SYSCALLS=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y CONFIG_TRACING_SUPPORT=y CONFIG_FTRACE=y # CONFIG_FUNCTION_TRACER is not set
arch/s390/include/asm/thread_info.h +2 -2
@@ -92,7 +92,7 @@ static inline struct thread_info *current_thread_info(void)#define TIF_SYSCALL_TRACE 8/* syscall trace active */ #define TIF_SYSCALL_AUDIT 9/* syscall auditing active */ #define TIF_SECCOMP 10/* secure computing */ -#define TIF_SYSCALL_FTRACE 11/* ftrace syscall instrumentation */ +#define TIF_SYSCALL_TRACEPOINT 11/* syscall tracepoint instrumentation */ #define TIF_USEDFPU 16/* FPU was used by this task this quantum (SMP) */ #define TIF_POLLING_NRFLAG 17/* true if poll_idle() is polling TIF_NEED_RESCHED */
@@ -111,7 +111,7 @@ static inline struct thread_info *current_thread_info(void)#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)#define _TIF_SECCOMP (1<<TIF_SECCOMP) -#define _TIF_SYSCALL_FTRACE (1<<TIF_SYSCALL_FTRACE) +#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)#define _TIF_USEDFPU (1<<TIF_USEDFPU)#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)#define _TIF_31BIT (1<<TIF_31BIT)
arch/s390/kernel/entry.S +1 -1
@@ -54,7 +54,7 @@ _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ _TIF_MCCK_PENDING) _TIF_SYSCALL = (_TIF_SYSCALL_TRACE>>8 | _TIF_SYSCALL_AUDIT>>8 | \ - _TIF_SECCOMP>>8 | _TIF_SYSCALL_FTRACE>>8) + _TIF_SECCOMP>>8 | _TIF_SYSCALL_TRACEPOINT>>8) STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER STACK_SIZE = 1 << STACK_SHIFT
arch/s390/kernel/entry64.S +1 -1
@@ -57,7 +57,7 @@ _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ _TIF_MCCK_PENDING) _TIF_SYSCALL = (_TIF_SYSCALL_TRACE>>8 | _TIF_SYSCALL_AUDIT>>8 | \ - _TIF_SECCOMP>>8 | _TIF_SYSCALL_FTRACE>>8) + _TIF_SECCOMP>>8 | _TIF_SYSCALL_TRACEPOINT>>8) #define BASED(name) name-system_call(%r13)
arch/s390/kernel/ftrace.c +27 -9
@@ -220,6 +220,29 @@ struct syscall_metadata *syscall_nr_to_meta(int nr)return syscalls_metadata[nr]; } +int syscall_name_to_nr (char *name) +{ +int i; + +if (!syscalls_metadata) +return -1 ; +for (i =0 ; i < NR_syscalls; i++) +if (syscalls_metadata[i]) +if (!strcmp (syscalls_metadata[i]->name, name)) +return i; +return -1 ; +} + +void set_syscall_enter_id (int num,int id) +{ + syscalls_metadata[num]->enter_id = id; +} + +void set_syscall_exit_id (int num,int id) +{ + syscalls_metadata[num]->exit_id = id; +} +static struct syscall_metadata *find_syscall_meta (unsigned long syscall) {struct syscall_metadata *start;
@@ -237,24 +260,19 @@ static struct syscall_metadata *find_syscall_meta(unsigned long syscall) return NULL; } -void arch_init_ftrace_syscalls (void ) +static int __init arch_init_ftrace_syscalls (void ) {struct syscall_metadata *meta;int i; -static atomic_t refs; - -if (atomic_inc_return (&refs) !=1 ) - goto out; syscalls_metadata =kzalloc (sizeof (*syscalls_metadata) * NR_syscalls,GFP_KERNEL );if (!syscalls_metadata) - goto out; +return -ENOMEM ;for (i =0 ; i < NR_syscalls; i++) { meta =find_syscall_meta ((unsigned long )sys_call_table[i]); syscalls_metadata[i] = meta; } -return ; -out: -atomic_dec (&refs); +return 0 ; } +arch_initcall (arch_init_ftrace_syscalls);#endif
arch/s390/kernel/ptrace.c +7 -4
@@ -51,6 +51,9 @@#include "compat_ptrace.h" #endif +#define CREATE_TRACE_POINTS +#include <trace/events/syscalls.h> +enum s390_regset {REGSET_GENERAL ,REGSET_FP ,
@@ -661,8 +664,8 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) ret =-1 ; } -if (unlikely (test_thread_flag (TIF_SYSCALL_FTRACE ))) -ftrace_syscall_enter (regs); +if (unlikely (test_thread_flag (TIF_SYSCALL_TRACEPOINT ))) +trace_sys_enter (regs, regs->gprs[2 ]);if (unlikely (current->audit_context)) audit_syscall_entry(is_compat_task() ?
@@ -679,8 +682,8 @@ asmlinkage void do_syscall_trace_exit(struct pt_regs *regs)audit_syscall_exit (AUDITSC_RESULT (regs->gprs[2 ]), regs->gprs[2 ]); -if (unlikely (test_thread_flag (TIF_SYSCALL_FTRACE ))) -ftrace_syscall_exit (regs); +if (unlikely (test_thread_flag (TIF_SYSCALL_TRACEPOINT ))) +trace_sys_exit (regs, regs->gprs[2 ]);if (test_thread_flag (TIF_SYSCALL_TRACE ))tracehook_report_syscall_exit (regs,0 );
arch/x86/Kconfig +1 -1
@@ -38,7 +38,7 @@ config X86 select HAVE_FUNCTION_GRAPH_FP_TEST select HAVE_FUNCTION_TRACE_MCOUNT_TEST select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE - select HAVE_FTRACE_SYSCALLS + select HAVE_SYSCALL_TRACEPOINTS select HAVE_KVM select HAVE_ARCH_KGDB select HAVE_ARCH_TRACEHOOK
arch/x86/configs/i386_defconfig +1 -1
@@ -2355,7 +2355,7 @@ CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y CONFIG_HAVE_DYNAMIC_FTRACE=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_HW_BRANCH_TRACER=y -CONFIG_HAVE_FTRACE_SYSCALLS=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y CONFIG_RING_BUFFER=y CONFIG_TRACING=y CONFIG_TRACING_SUPPORT=y
arch/x86/configs/x86_64_defconfig +1 -1
@@ -2329,7 +2329,7 @@ CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y CONFIG_HAVE_DYNAMIC_FTRACE=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_HW_BRANCH_TRACER=y -CONFIG_HAVE_FTRACE_SYSCALLS=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y CONFIG_RING_BUFFER=y CONFIG_TRACING=y CONFIG_TRACING_SUPPORT=y
arch/x86/include/asm/ftrace.h +0 -7
@@ -28,13 +28,6 @@#endif -/* FIXME: I don't want to stay hardcoded */ -#ifdef CONFIG_X86_64 -# define FTRACE_SYSCALL_MAX 296 -#else -# define FTRACE_SYSCALL_MAX 333 -#endif -#ifdef CONFIG_FUNCTION_TRACER #define MCOUNT_ADDR ((long)(mcount))#define MCOUNT_INSN_SIZE 5/* sizeof mcount call */
arch/x86/include/asm/thread_info.h +7 -6
@@ -95,7 +95,7 @@ struct thread_info {#define TIF_DEBUGCTLMSR 25/* uses thread_struct.debugctlmsr */ #define TIF_DS_AREA_MSR 26/* uses thread_struct.ds_area_msr */ #define TIF_LAZY_MMU_UPDATES 27/* task is updating the mmu lazily */ -#define TIF_SYSCALL_FTRACE 28/* for ftrace syscall instrumentation */ +#define TIF_SYSCALL_TRACEPOINT 28/* syscall tracepoint instrumentation */ #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
@@ -118,17 +118,17 @@ struct thread_info {#define _TIF_DEBUGCTLMSR (1 << TIF_DEBUGCTLMSR)#define _TIF_DS_AREA_MSR (1 << TIF_DS_AREA_MSR)#define _TIF_LAZY_MMU_UPDATES (1 << TIF_LAZY_MMU_UPDATES) -#define _TIF_SYSCALL_FTRACE (1 << TIF_SYSCALL_FTRACE) +#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)/* work to do in syscall_trace_enter() */ #define _TIF_WORK_SYSCALL_ENTRY \ - (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | _TIF_SYSCALL_FTRACE | \ - _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP) + (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | _TIF_SYSCALL_AUDIT | \ + _TIF_SECCOMP | _TIF_SINGLESTEP | _TIF_SYSCALL_TRACEPOINT)/* work to do in syscall_trace_leave() */ #define _TIF_WORK_SYSCALL_EXIT \ (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP | \ - _TIF_SYSCALL_FTRACE) + _TIF_SYSCALL_TRACEPOINT)/* work to do on interrupt/exception return */ #define _TIF_WORK_MASK \
@@ -137,7 +137,8 @@ struct thread_info { _TIF_SINGLESTEP|_TIF_SECCOMP|_TIF_SYSCALL_EMU))/* work to do on any return to user space */ -#define _TIF_ALLWORK_MASK ((0x0000FFFF & ~_TIF_SECCOMP) | _TIF_SYSCALL_FTRACE) +#define _TIF_ALLWORK_MASK \ + ((0x0000FFFF & ~_TIF_SECCOMP) | _TIF_SYSCALL_TRACEPOINT)/* Only used for 64 bit */ #define _TIF_DO_NOTIFY_MASK \
arch/x86/include/asm/unistd_32.h +2 -0
@@ -345,6 +345,8 @@#ifdef __KERNEL__ +#define NR_syscalls 337 +#define __ARCH_WANT_IPC_PARSE_VERSION#define __ARCH_WANT_OLD_READDIR#define __ARCH_WANT_OLD_STAT
arch/x86/include/asm/unistd_64.h +6 -0
@@ -688,6 +688,12 @@ __SYSCALL(__NR_perf_counter_open, sys_perf_counter_open)#endif /* __NO_STUBS */ #ifdef __KERNEL__ + +#ifndef COMPILE_OFFSETS +#include <asm/asm-offsets.h> +#define NR_syscalls (__NR_syscall_max + 1) +#endif +/* * "Conditional" syscalls *
arch/x86/kernel/asm-offsets_64.c +1 -0
@@ -3,6 +3,7 @@* This code generates raw asm output which is post-processed to extract * and format the required data. */ +#define COMPILE_OFFSETS #include <linux/crypto.h> #include <linux/sched.h>
arch/x86/kernel/ftrace.c +33 -18
80 lines not on this page · raw message
arch/x86/kernel/ptrace.c +7 -6
@@ -35,10 +35,11 @@#include <asm/proto.h> #include <asm/ds.h> -#include <trace/syscall.h> -#include "tls.h" +#define CREATE_TRACE_POINTS +#include <trace/events/syscalls.h> +enum x86_regset {REGSET_GENERAL ,REGSET_FP ,
@@ -1497,8 +1498,8 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs) tracehook_report_syscall_entry(regs)) ret =-1L ; -if (unlikely (test_thread_flag (TIF_SYSCALL_FTRACE ))) -ftrace_syscall_enter (regs); +if (unlikely (test_thread_flag (TIF_SYSCALL_TRACEPOINT ))) +trace_sys_enter (regs, regs->orig_ax);if (unlikely (current->audit_context)) {if (IS_IA32 )
@@ -1523,8 +1524,8 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)if (unlikely (current->audit_context))audit_syscall_exit (AUDITSC_RESULT (regs->ax), regs->ax); -if (unlikely (test_thread_flag (TIF_SYSCALL_FTRACE ))) -ftrace_syscall_exit (regs); +if (unlikely (test_thread_flag (TIF_SYSCALL_TRACEPOINT ))) +trace_sys_exit (regs, regs->ax);if (test_thread_flag (TIF_SYSCALL_TRACE ))tracehook_report_syscall_exit (regs,0 );
arch/x86/kernel/sys_x86_64.c +4 -4
@@ -18,9 +18,9 @@#include <asm/ia32.h> #include <asm/syscalls.h> -asmlinkage long sys_mmap (unsigned long addr,unsigned long len, -unsigned long prot,unsigned long flags, -unsigned long fd,unsigned long off) +SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, + unsigned long, prot, unsigned long, flags, + unsigned long, fd, unsigned long, off) {long error;struct file *file;
@@ -226,7 +226,7 @@ bottomup: } -asmlinkage long sys_uname (struct new_utsname __user *name) +SYSCALL_DEFINE1(uname, struct new_utsname __user *, name) {int err;down_read (&uts_sem);
include/linux/ftrace_event.h +31 -20
89 lines not on this page · raw message
include/linux/module.h +11 -3
@@ -17,10 +17,12 @@#include <linux/moduleparam.h> #include <linux/marker.h> #include <linux/tracepoint.h> -#include <asm/local.h> +#include <asm/local.h> #include <asm/module.h> +#include <trace/events/module.h> +/* Not Yet Implemented */ #define MODULE_SUPPORTED_DEVICE (name)
@@ -462,7 +464,10 @@ static inline local_t *__module_ref_addr(struct module *mod, int cpu)static inline void __module_get (struct module *module) {if (module) { -local_inc (__module_ref_addr (module,get_cpu ())); +unsigned int cpu =get_cpu (); +local_inc (__module_ref_addr (module, cpu)); +trace_module_get (module, _THIS_IP_, +local_read (__module_ref_addr (module, cpu)));put_cpu (); } }
@@ -473,8 +478,11 @@ static inline int try_module_get(struct module *module)if (module) {unsigned int cpu =get_cpu (); -if (likely (module_is_live (module))) +if (likely (module_is_live (module))) {local_inc (__module_ref_addr (module, cpu)); +trace_module_get (module, _THIS_IP_, +local_read (__module_ref_addr (module, cpu))); + }else ret =0 ;put_cpu ();
include/linux/perf_counter.h +2 -0
@@ -761,6 +761,8 @@ extern int sysctl_perf_counter_mlock;extern int sysctl_perf_counter_sample_rate;extern void perf_counter_init (void ); +extern void perf_tpcounter_event (int event_id,u64 addr,u64 count, +void *record,int entry_size);#ifndef perf_misc_flags#define perf_misc_flags (regs) (user_mode(regs) ? PERF_EVENT_MISC_USER : \
include/linux/ring_buffer.h +9 -15
@@ -75,20 +75,6 @@ ring_buffer_event_time_delta(struct ring_buffer_event *event) }/* -* ring_buffer_event_discard can discard any event in the ring buffer. -* it is up to the caller to protect against a reader from -* consuming it or a writer from wrapping and replacing it. -* -* No external protection is needed if this is called before -* the event is commited. But in that case it would be better to -* use ring_buffer_discard_commit. -* -* Note, if an event that has not been committed is discarded -* with ring_buffer_event_discard, it must still be committed. -*/ -void ring_buffer_event_discard (struct ring_buffer_event *event); - -/* * ring_buffer_discard_commit will remove an event that has not * ben committed yet. If this is used, then ring_buffer_unlock_commit * must not be called on the discarded event. This function
@@ -154,8 +140,17 @@ unsigned long ring_buffer_size(struct ring_buffer *buffer);void ring_buffer_reset_cpu (struct ring_buffer *buffer,int cpu);void ring_buffer_reset (struct ring_buffer *buffer); +#ifdef CONFIG_RING_BUFFER_ALLOW_SWAP int ring_buffer_swap_cpu (struct ring_buffer *buffer_a,struct ring_buffer *buffer_b,int cpu); +#else +static inline int +ring_buffer_swap_cpu (struct ring_buffer *buffer_a, +struct ring_buffer *buffer_b,int cpu) +{ +return -ENODEV ; +} +#endif int ring_buffer_empty (struct ring_buffer *buffer);int ring_buffer_empty_cpu (struct ring_buffer *buffer,int cpu);
@@ -170,7 +165,6 @@ unsigned long ring_buffer_overruns(struct ring_buffer *buffer);unsigned long ring_buffer_entries_cpu (struct ring_buffer *buffer,int cpu);unsigned long ring_buffer_overrun_cpu (struct ring_buffer *buffer,int cpu);unsigned long ring_buffer_commit_overrun_cpu (struct ring_buffer *buffer,int cpu); -unsigned long ring_buffer_nmi_dropped_cpu (struct ring_buffer *buffer,int cpu);u64 ring_buffer_time_stamp (struct ring_buffer *buffer,int cpu); void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer,
include/linux/syscalls.h +129 -2
166 lines not on this page · raw message
include/linux/tracepoint.h +25 -4
@@ -23,6 +23,8 @@ struct tracepoint;struct tracepoint {const char *name;/* Tracepoint name */ int state;/* State. */ +void (*regfunc)(void ); +void (*unregfunc)(void );void **funcs; } __attribute__((aligned (32 )));/* * Aligned on 32 bytes because it is
@@ -78,12 +80,16 @@ struct tracepoint { return tracepoint_probe_unregister(#name, (void *)probe);\ } -#define DEFINE_TRACE (name) \ + +#define DEFINE_TRACE_FN (name, reg, unreg) \ static const char __tpstrtab_##name[] \ __attribute__((section("__tracepoints_strings"))) = #name; \ struct tracepoint __tracepoint_##name \ __attribute__((section("__tracepoints"), aligned(32))) = \ - { __tpstrtab_##name, 0, NULL } + { __tpstrtab_##name, 0, reg, unreg, NULL } + +#define DEFINE_TRACE (name) \ + DEFINE_TRACE_FN(name, NULL, NULL);#define EXPORT_TRACEPOINT_SYMBOL_GPL (name) \ EXPORT_SYMBOL_GPL(__tracepoint_##name)
@@ -108,6 +114,7 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,return -ENOSYS ; \ } +#define DEFINE_TRACE_FN (name, reg, unreg)#define DEFINE_TRACE (name)#define EXPORT_TRACEPOINT_SYMBOL_GPL (name)#define EXPORT_TRACEPOINT_SYMBOL (name)
@@ -158,6 +165,15 @@ static inline void tracepoint_synchronize_unregister(void) #define PARAMS(args...) args +#endif /* _LINUX_TRACEPOINT_H */ + +/* +* Note: we keep the TRACE_EVENT outside the include file ifdef protection. +* This is due to the way trace events work. If a file includes two +* trace event headers under one "CREATE_TRACE_POINTS" the first include +* will override the TRACE_EVENT and break the second include. +*/ +#ifndef TRACE_EVENT /* * For use with the TRACE_EVENT macro:
@@ -259,10 +275,15 @@ static inline void tracepoint_synchronize_unregister(void)* can also by used by generic instrumentation like SystemTap), and * it is also used to expose a structured trace record in * /sys/kernel/debug/tracing/events/. +* +* A set of (un)registration functions can be passed to the variant +* TRACE_EVENT_FN to perform any (un)registration work. */ #define TRACE_EVENT (name, proto, args, struct, assign, print) \ DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) -#endif +#define TRACE_EVENT_FN (name, proto, args, struct, \ + assign, print, reg, unreg) \ + DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) -#endif +#endif /* ifdef TRACE_EVENT (see note above) */
include/trace/define_trace.h +7 -0
@@ -26,6 +26,11 @@#define TRACE_EVENT (name, proto, args, tstruct, assign, print) \ DEFINE_TRACE(name) +#undef TRACE_EVENT_FN +#define TRACE_EVENT_FN (name, proto, args, tstruct, \ + assign, print, reg, unreg) \ + DEFINE_TRACE_FN(name, reg, unreg) +#undef DECLARE_TRACE#define DECLARE_TRACE (name, proto, args) \ DEFINE_TRACE(name)
@@ -56,6 +61,8 @@#include <trace/ftrace.h> #endif +#undef TRACE_EVENT +#undef TRACE_EVENT_FN#undef TRACE_HEADER_MULTI_READ/* Only undef what we defined in this file */
include/trace/events/module.h new file +126 -0
126 lines not on this page · raw message
include/trace/events/sched.h +8 -4
@@ -94,6 +94,7 @@ TRACE_EVENT(sched_wakeup, __field( pid_t, pid ) __field( int, prio ) __field( int, success ) +__field ( int, cpu ) ), TP_fast_assign(
@@ -101,11 +102,12 @@ TRACE_EVENT(sched_wakeup, __entry->pid = p->pid; __entry->prio = p->prio; __entry->success = success; + __entry->cpu =task_cpu (p); ), -TP_printk ("task %s:%d [%d] success=%d" , +TP_printk ("task %s:%d [%d] success=%d [%03d]" , __entry->comm, __entry->pid, __entry->prio, - __entry->success) + __entry->success, __entry->cpu) );/*
@@ -125,6 +127,7 @@ TRACE_EVENT(sched_wakeup_new, __field( pid_t, pid ) __field( int, prio ) __field( int, success ) +__field ( int, cpu ) ), TP_fast_assign(
@@ -132,11 +135,12 @@ TRACE_EVENT(sched_wakeup_new, __entry->pid = p->pid; __entry->prio = p->prio; __entry->success = success; + __entry->cpu =task_cpu (p); ), -TP_printk ("task %s:%d [%d] success=%d" , +TP_printk ("task %s:%d [%d] success=%d [%03d]" , __entry->comm, __entry->pid, __entry->prio, - __entry->success) + __entry->success, __entry->cpu) );/*
include/trace/events/syscalls.h new file +70 -0
70 lines not on this page · raw message
include/trace/ftrace.h +62 -31
244 lines not on this page · raw message
include/trace/syscall.h +38 -10
72 lines not on this page · raw message
kernel/kmod.c +4 -0
@@ -37,6 +37,8 @@#include <linux/suspend.h> #include <asm/uaccess.h> +#include <trace/events/module.h> +extern int max_threads;static struct workqueue_struct *khelper_wq;
@@ -108,6 +110,8 @@ int __request_module(bool wait, const char *fmt, ...)return -ENOMEM ; } +trace_module_request (module_name, wait, _RET_IP_); + ret =call_usermodehelper (modprobe_path, argv, envp, wait ?UMH_WAIT_PROC :UMH_WAIT_EXEC );atomic_dec (&kmod_concurrent);
kernel/kprobes.c +11 -19
@@ -103,7 +103,7 @@ static struct kprobe_blackpoint kprobe_blacklist[] = {#define INSNS_PER_PAGE (PAGE_SIZE/(MAX_INSN_SIZE * sizeof(kprobe_opcode_t)))struct kprobe_insn_page { -struct hlist_node hlist; +struct list_head list;kprobe_opcode_t *insns;/* Page of instruction slots */ char slot_used[INSNS_PER_PAGE ];int nused;
@@ -117,7 +117,7 @@ enum kprobe_slot_state { };static DEFINE_MUTEX (kprobe_insn_mutex);/* Protects kprobe_insn_pages */ -static struct hlist_head kprobe_insn_pages; +static LIST_HEAD (kprobe_insn_pages);static int kprobe_garbage_slots;static int collect_garbage_slots (void );
@@ -152,10 +152,9 @@ loop_end:static kprobe_opcode_t __kprobes *__get_insn_slot (void ) {struct kprobe_insn_page *kip; -struct hlist_node *pos; retry: -hlist_for_each_entry (kip, pos, &kprobe_insn_pages, hlist) { +list_for_each_entry (kip, &kprobe_insn_pages, list) {if (kip->nused <INSNS_PER_PAGE ) {int i;for (i =0 ; i <INSNS_PER_PAGE ; i++) {
@@ -189,8 +188,8 @@ static kprobe_opcode_t __kprobes *__get_insn_slot(void)kfree (kip);return NULL ; } -INIT_HLIST_NODE (&kip->hlist); -hlist_add_head (&kip->hlist, &kprobe_insn_pages); +INIT_LIST_HEAD (&kip->list); +list_add (&kip->list, &kprobe_insn_pages);memset (kip->slot_used,SLOT_CLEAN ,INSNS_PER_PAGE ); kip->slot_used[0 ] =SLOT_USED ; kip->nused =1 ;
@@ -219,12 +218,8 @@ static int __kprobes collect_one_slot(struct kprobe_insn_page *kip, int idx)* so as not to have to set it up again the * next time somebody inserts a probe. */ -hlist_del (&kip->hlist); -if (hlist_empty (&kprobe_insn_pages)) { -INIT_HLIST_NODE (&kip->hlist); -hlist_add_head (&kip->hlist, - &kprobe_insn_pages); - }else { +if (!list_is_singular (&kprobe_insn_pages)) { +list_del (&kip->list);module_free (NULL , kip->insns);kfree (kip); }
@@ -235,14 +230,13 @@ static int __kprobes collect_one_slot(struct kprobe_insn_page *kip, int idx)static int __kprobes collect_garbage_slots (void ) { -struct kprobe_insn_page *kip; -struct hlist_node *pos, *next; +struct kprobe_insn_page *kip, *next;/* Ensure no-one is preepmted on the garbages */ if (check_safety ())return -EAGAIN ; -hlist_for_each_entry_safe (kip, pos, next, &kprobe_insn_pages, hlist) { +list_for_each_entry_safe (kip, next, &kprobe_insn_pages, list) {int i;if (kip->ngarbage ==0 )continue ;
@@ -260,19 +254,17 @@ static int __kprobes collect_garbage_slots(void)void __kprobes free_insn_slot (kprobe_opcode_t * slot,int dirty) {struct kprobe_insn_page *kip; -struct hlist_node *pos;mutex_lock (&kprobe_insn_mutex); -hlist_for_each_entry (kip, pos, &kprobe_insn_pages, hlist) { +list_for_each_entry (kip, &kprobe_insn_pages, list) {if (kip->insns <= slot && slot < kip->insns + (INSNS_PER_PAGE *MAX_INSN_SIZE )) {int i = (slot - kip->insns) /MAX_INSN_SIZE ;if (dirty) { kip->slot_used[i] =SLOT_DIRTY ; kip->ngarbage++; - }else { + }else collect_one_slot (kip, i); - }break ; } }
kernel/module.c +11 -0
@@ -55,6 +55,11 @@#include <linux/percpu.h> #include <linux/kmemleak.h> +#define CREATE_TRACE_POINTS +#include <trace/events/module.h> + +EXPORT_TRACEPOINT_SYMBOL (module_get); +#if 0 #define DEBUGP printk#else
@@ -942,6 +947,8 @@ void module_put(struct module *module)if (module) {unsigned int cpu =get_cpu ();local_dec (__module_ref_addr (module, cpu)); +trace_module_put (module, _RET_IP_, +local_read (__module_ref_addr (module, cpu)));/* Maybe they're waiting for us to drop reference? */ if (unlikely (!module_is_live (module)))wake_up_process (module->waiter);
@@ -1497,6 +1504,8 @@ static int __unlink_module(void *_mod)/* Free a module, remove from lists, etc (must hold module_mutex). */ static void free_module (struct module *mod) { +trace_module_free (mod); +/* Delete from various lists */ stop_machine (__unlink_module, mod,NULL );remove_notes_attrs (mod);
@@ -2364,6 +2373,8 @@ static noinline struct module *load_module(void __user *umod,/* Get rid of temporary copy */ vfree (hdr); +trace_module_load (mod); +/* Done! */ return mod;
kernel/trace/Kconfig +10 -3
@@ -41,7 +41,7 @@ config HAVE_FTRACE_MCOUNT_RECORD config HAVE_HW_BRANCH_TRACER bool -config HAVE_FTRACE_SYSCALLS +config HAVE_SYSCALL_TRACEPOINTS bool config TRACER_MAX_TRACE
@@ -60,9 +60,14 @@ config EVENT_TRACING bool config CONTEXT_SWITCH_TRACER - select MARKERS bool +config RING_BUFFER_ALLOW_SWAP + bool + help + Allow the use of ring_buffer_swap_cpu. + Adds a very slight overhead to tracing when enabled. + # All tracer options should select GENERIC_TRACER. For those options that are # enabled by all tracers (context switch and event tracer) they select TRACING. # This allows those options to appear when no other tracer is selected. But the
@@ -147,6 +152,7 @@ config IRQSOFF_TRACER select TRACE_IRQFLAGS select GENERIC_TRACER select TRACER_MAX_TRACE + select RING_BUFFER_ALLOW_SWAP help This option measures the time spent in irqs-off critical sections, with microsecond accuracy.
@@ -168,6 +174,7 @@ config PREEMPT_TRACER depends on PREEMPT select GENERIC_TRACER select TRACER_MAX_TRACE + select RING_BUFFER_ALLOW_SWAP help This option measures the time spent in preemption off critical sections, with microsecond accuracy.
@@ -211,7 +218,7 @@ config ENABLE_DEFAULT_TRACERS config FTRACE_SYSCALLS bool "Trace syscalls" - depends on HAVE_FTRACE_SYSCALLS + depends on HAVE_SYSCALL_TRACEPOINTS select GENERIC_TRACER select KALLSYMS help
kernel/trace/blktrace.c +8 -4
@@ -65,13 +65,15 @@ static void trace_note(struct blk_trace *bt, pid_t pid, int action, {struct blk_io_trace *t;struct ring_buffer_event *event =NULL ; +struct ring_buffer *buffer =NULL ;int pc =0 ;int cpu =smp_processor_id ();bool blk_tracer = blk_tracer_enabled;if (blk_tracer) { + buffer = blk_tr->buffer; pc =preempt_count (); - event =trace_buffer_lock_reserve (blk_tr,TRACE_BLK , + event =trace_buffer_lock_reserve (buffer,TRACE_BLK ,sizeof (*t) + len,0 , pc);if (!event)
@@ -96,7 +98,7 @@ record_it:memcpy ((void *) t +sizeof (*t), data, len);if (blk_tracer) -trace_buffer_unlock_commit (blk_tr, event,0 , pc); +trace_buffer_unlock_commit (buffer, event,0 , pc); } }
@@ -179,6 +181,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, {struct task_struct *tsk = current;struct ring_buffer_event *event =NULL ; +struct ring_buffer *buffer =NULL ;struct blk_io_trace *t;unsigned long flags =0 ;unsigned long *sequence;
@@ -204,8 +207,9 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,if (blk_tracer) {tracing_record_cmdline (current); + buffer = blk_tr->buffer; pc =preempt_count (); - event =trace_buffer_lock_reserve (blk_tr,TRACE_BLK , + event =trace_buffer_lock_reserve (buffer,TRACE_BLK ,sizeof (*t) + pdu_len,0 , pc);if (!event)
@@ -252,7 +256,7 @@ record_it:memcpy ((void *) t +sizeof (*t), pdu_data, pdu_len);if (blk_tracer) { -trace_buffer_unlock_commit (blk_tr, event,0 , pc); +trace_buffer_unlock_commit (buffer, event,0 , pc);return ; } }
kernel/trace/ftrace.c +23 -84
196 lines not on this page · raw message
kernel/trace/kmemtrace.c +96 -53
35 lines not on this page · raw message
kernel/trace/ring_buffer.c +885 -227
1,112 lines not on this page · raw message
kernel/trace/trace.c +344 -335
679 lines not on this page · raw message
kernel/trace/trace.h +54 -22
76 lines not on this page · raw message
kernel/trace/trace_events.c +123 -23
146 lines not on this page · raw message
kernel/trace/trace_events_filter.c +160 -101
261 lines not on this page · raw message
kernel/trace/trace_functions_graph.c +127 -39
166 lines not on this page · raw message
kernel/trace/trace_sched_switch.c +59 -0
59 lines not on this page · raw message
kernel/trace/trace_stack.c +13 -30
43 lines not on this page · raw message
kernel/trace/trace_syscalls.c +372 -99
471 lines not on this page · raw message
kernel/tracepoint.c +47 -3
50 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.