tracing updates for v2.6.33
Subsystems (13)
Linus,
Please pull the latest 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:
- filter engine updates
- bkl-locking events
- various cleanups and other updates
there's also a generic change that adds __always_unused:
include/linux/compiler-gcc.h | 1 + include/linux/compiler.h | 4 +
Thanks,
Ingo
------------------>
Ananth N Mavinakayanahalli (1):
kprobes: Sanitize struct kretprobe_instance allocations
Frederic Weisbecker (12):
tracing/bkl: Add bkl ftrace events tracing/filters: Cleanup useless headers tracing/event: Cleanup the useless dentry variable tracing/filters: Provide basic regex support tracing/filters: Unify the regex parsing helpers
tracing: Pushdown the bkl tracepoints calls
tracing: Rename set_ftrace to set_bootup_ftrace
tracing: Remove unused ftrace_trace_addr helper
tracing: Move syscalls metadata handling from arch to core
tracing: Document HAVE_SYSCALL_TRACEPOINTS needs
ftrace: Copy ftrace_graph_filter boot param using strlcpy
ftrace: Rename set_bootup_ftrace into set_cmdline_ftrace
Ingo Molnar (2):
ring-buffer benchmark: Run producer/consumer threads at nice +19 tracing, function tracer: Clean up strstrip() usage
Jiri Olsa (2):
tracing: Enable records during the module load
tracing: Enable "__cold" functions
Joe Perches (2):
ftrace.c: Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt testmmiotrace.c: Add and use pr_fmt(fmt)
Josh Stone (1):
tracing: Remove the stale include/trace/power.h
Lai Jiangshan (2):
tracing: Prevent build warning: 'ftrace_graph_buf' defined but not used
tracing: Separate raw syscall from syscall tracer
Li Hong (8):
tracing: Amend documentation in recordmcount.pl to reflect implementation
tracing: Correct the check for number of arguments in recordmcount.pl
tracing: Check absolute path of input file in recordmcount.pl
tracing: Fix objcopy revision check in recordmcount.pl
tracing: Move mcount section search to front of loop in recordmcount.pl
tracing: Add regex for weak functions in recordmcount.pl
tracing: Move conditional into update_funcs() in recordmcount.pl
tracing: Exit with error if a weak function is used in recordmcount.pl
Li Zefan (2):
compiler: Introduce __always_unused
tracing: Fix to use __always_unused attribute
Stefan Assmann (1):
ftrace: add kernel command line graph function filtering
Steven Rostedt (6):
function-graph/x86: Replace unbalanced ret with jmp
ring-buffer: Add multiple iterations between benchmark timestamps
tracing: do not disable interrupts for trace_clock_local
ring-buffer: Move access to commit_page up into function used
tracing: Only print objcopy version warning once from recordmcount
ring-buffer-benchmark: Add parameters to set produce/consumer priorities
[email protected] (1):
tracing: Support multiple pids in set_pid_ftrace file
Documentation/kernel-parameters.txt | 7 + Documentation/trace/ftrace-design.txt | 13 +- Makefile | 1 + arch/s390/kernel/ftrace.c | 67 +------ arch/x86/kernel/entry_32.S | 7 +- arch/x86/kernel/entry_64.S | 6 +- arch/x86/kernel/ftrace.c | 84 +------- arch/x86/mm/testmmiotrace.c | 29 ++-- include/linux/compiler-gcc.h | 1 + include/linux/compiler.h | 4 + include/linux/smp_lock.h | 21 ++- include/trace/events/bkl.h | 61 ++++++ include/trace/events/syscalls.h | 3 +- include/trace/power.h | 32 --- include/trace/syscall.h | 2 +- kernel/kprobes.c | 4 +- kernel/trace/ftrace.c | 375 +++++++++++++++++++++------------ kernel/trace/ring_buffer.c | 9 +- kernel/trace/ring_buffer_benchmark.c | 85 +++++++- kernel/trace/trace.c | 4 +- kernel/trace/trace.h | 44 +++-- kernel/trace/trace_clock.c | 8 +- kernel/trace/trace_events.c | 23 +- kernel/trace/trace_events_filter.c | 155 ++++++++++++-- kernel/trace/trace_export.c | 4 +- kernel/trace/trace_syscalls.c | 86 ++++++++ lib/kernel_lock.c | 20 ++- scripts/recordmcount.pl | 219 +++++++++++--------- 28 files changed, 856 insertions(+), 518 deletions(-) create mode 100644 include/trace/events/bkl.h delete mode 100644 include/trace/power.h
Documentation/kernel-parameters.txt +7 -0
@@ -779,6 +779,13 @@ and is between 256 and 4096 characters. It is defined in the file by the set_ftrace_notrace file in the debugfs tracing directory. + ftrace_graph_filter=[function-list] + [FTRACE] Limit the top level callers functions traced + by the function graph tracer at boot up. + function-list is a comma separated list of functions + that can be changed at run time by the + set_graph_function file in the debugfs tracing directory. + gamecon.map[2|3]= [HW,JOY] Multisystem joystick and NES/SNES/PSX pad support via parallel port (up to 5 devices per port)
Documentation/trace/ftrace-design.txt +11 -2
@@ -213,10 +213,19 @@ If you can't trace NMI functions, then skip this option. <details to be filled> -HAVE_FTRACE_SYSCALLS +HAVE_SYSCALL_TRACEPOINTS --------------------- -<details to be filled> +You need very few things to get the syscalls tracing in an arch. + +- Have a NR_syscalls variable in <asm/unistd.h> that provides the number + of syscalls supported by the arch. +- Implement arch_syscall_addr() that resolves a syscall address from a + syscall number. +- Support the TIF_SYSCALL_TRACEPOINT thread flags +- Put the trace_sys_enter() and trace_sys_exit() tracepoints calls from ptrace + in the ptrace syscalls tracing path. +- Tag this arch as HAVE_SYSCALL_TRACEPOINTS. HAVE_FTRACE_MCOUNT_RECORD
Makefile +1 -0
@@ -379,6 +379,7 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exc PHONY += scripts_basic scripts_basic: $(Q)$(MAKE) $(build)=scripts/basic + $(Q)rm -f .tmp_quiet_recordmcount # To avoid any implicit rule to kick in, define an empty command. scripts/basic/%: scripts_basic ;
arch/s390/kernel/ftrace.c +2 -65
75 lines not on this page · raw message
arch/x86/kernel/entry_32.S +2 -5
@@ -1185,17 +1185,14 @@ END(ftrace_graph_caller) .globl return_to_handler return_to_handler: - pushl $0 pushl %eax - pushl %ecx pushl %edx movl %ebp, %eax call ftrace_return_to_handler - movl %eax, 0xc(%esp) + movl %eax, %ecx popl %edx - popl %ecx popl %eax - ret + jmp *%ecx #endif .section .rodata,"a"
arch/x86/kernel/entry_64.S +3 -3
@@ -155,11 +155,11 @@ GLOBAL(return_to_handler) call ftrace_return_to_handler - movq %rax, 16(%rsp) + movq %rax, %rdi movq 8(%rsp), %rdx movq (%rsp), %rax - addq $16, %rsp - retq + addq $24, %rsp + jmp *%rdi #endif
arch/x86/kernel/ftrace.c +7 -77
110 lines not on this page · raw message
arch/x86/mm/testmmiotrace.c +14 -15
@@ -1,12 +1,13 @@/* * Written by Pekka Paalanen, 2008-2009 <[email protected]> */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/io.h> #include <linux/mmiotrace.h> -#define MODULE_NAME "testmmiotrace" -static unsigned long mmio_address;module_param (mmio_address, ulong,0 ); MODULE_PARM_DESC(mmio_address, " Start address of the mapping of 16 kB "
@@ -30,7 +31,7 @@ static unsigned v32(unsigned i)static void do_write_test (void __iomem *p) {unsigned int i; -pr_info (MODULE_NAME ": write test.\n" ); +pr_info ("write test.\n" );mmiotrace_printk ("Write test.\n" );for (i =0 ; i <256 ; i++)
@@ -47,7 +48,7 @@ static void do_read_test(void __iomem *p) {unsigned int i;unsigned errs[3 ] = {0 }; -pr_info (MODULE_NAME ": read test.\n" ); +pr_info ("read test.\n" );mmiotrace_printk ("Read test.\n" );for (i =0 ; i <256 ; i++)
@@ -68,7 +69,7 @@ static void do_read_test(void __iomem *p)static void do_read_far_test (void __iomem *p) { -pr_info (MODULE_NAME ": read far test.\n" ); +pr_info ("read far test.\n" );mmiotrace_printk ("Read far test.\n" );ioread32 (p + read_far);
@@ -78,7 +79,7 @@ static void do_test(unsigned long size) {void __iomem *p =ioremap_nocache (mmio_address, size);if (!p) { -pr_err (MODULE_NAME ": could not ioremap, aborting.\n" ); +pr_err ("could not ioremap, aborting.\n" );return ; }mmiotrace_printk ("ioremap returned %p.\n" , p);
@@ -94,24 +95,22 @@ static int __init init(void)unsigned long size = (read_far) ? (8 <<20 ) : (16 <<10 );if (mmio_address ==0 ) { -pr_err (MODULE_NAME ": you have to use the module argument " -"mmio_address.\n" ); -pr_err (MODULE_NAME ": DO NOT LOAD THIS MODULE UNLESS" -" YOU REALLY KNOW WHAT YOU ARE DOING!\n" ); +pr_err ("you have to use the module argument mmio_address.\n" ); +pr_err ("DO NOT LOAD THIS MODULE UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!\n" );return -ENXIO ; } -pr_warning (MODULE_NAME ": WARNING: mapping %lu kB @ 0x%08lx in PCI " -"address space, and writing 16 kB of rubbish in there.\n" , - size >>10 , mmio_address); +pr_warning ("WARNING: mapping %lu kB @ 0x%08lx in PCI address space, " +"and writing 16 kB of rubbish in there.\n" , + size >>10 , mmio_address);do_test (size); -pr_info (MODULE_NAME ": All done.\n" ); +pr_info ("All done.\n" );return 0 ; } static void __exit cleanup(void) { -pr_debug (MODULE_NAME ": unloaded.\n" ); +pr_debug ("unloaded.\n" ); }module_init (init);
include/linux/compiler-gcc.h +1 -0
@@ -79,6 +79,7 @@#define noinline __attribute__((noinline))#define __attribute_const__ __attribute__((__const__))#define __maybe_unused __attribute__((unused)) +#define __always_unused __attribute__((unused))#define __gcc_header (x) #x#define _gcc_header (x) __gcc_header(linux/compiler-gcc##x.h)
include/linux/compiler.h +4 -0
@@ -213,6 +213,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);# define __maybe_unused/* unimplemented */ #endif +#ifndef __always_unused +# define __always_unused/* unimplemented */ +#endif +#ifndef noinline#define noinline#endif
include/linux/smp_lock.h +17 -4
@@ -24,8 +24,21 @@ static inline int reacquire_kernel_lock(struct task_struct *task)return 0 ; } -extern void __lockfunc lock_kernel(void) __acquires(kernel_lock); -extern void __lockfunc unlock_kernel(void) __releases(kernel_lock); +extern void __lockfunc +_lock_kernel(const char *func, const char *file, int line) +__acquires(kernel_lock); + +extern void __lockfunc +_unlock_kernel(const char *func, const char *file, int line) +__releases(kernel_lock); + +#define lock_kernel() do { \ +_lock_kernel (__func__, __FILE__, __LINE__); \ +} while (0) + +#define unlock_kernel () do { \ + _unlock_kernel(__func__, __FILE__, __LINE__); \ +} while (0)/* * Various legacy drivers don't really need the BKL in a specific
@@ -41,8 +54,8 @@ static inline void cycle_kernel_lock(void)#else -#define lock_kernel () do { } while(0) -#define unlock_kernel () do { } while(0) +#define lock_kernel () +#define unlock_kernel ()#define release_kernel_lock (task) do { } while(0)#define cycle_kernel_lock () do { } while(0)#define reacquire_kernel_lock (task) 0
include/trace/events/bkl.h new file +61 -0
61 lines not on this page · raw message
include/trace/events/syscalls.h +2 -1
@@ -1,5 +1,6 @@#undef TRACE_SYSTEM -#define TRACE_SYSTEM syscalls +#define TRACE_SYSTEM raw_syscalls +#define TRACE_INCLUDE_FILE syscalls#if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_EVENTS_SYSCALLS_H
include/trace/power.h deleted +0 -32
@@ -1,32 +0,0 @@ -#ifndef _TRACE_POWER_H -#define _TRACE_POWER_H - -#include <linux/ktime.h> -#include <linux/tracepoint.h> - -enum { -POWER_NONE =0 , -POWER_CSTATE =1 , -POWER_PSTATE =2 , -}; - -struct power_trace { -ktime_t stamp; -ktime_t end; -int type; -int state; -}; - -DECLARE_TRACE (power_start, - TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state), -TP_ARGS (it, type, state)); - -DECLARE_TRACE (power_mark, - TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state), -TP_ARGS (it, type, state)); - -DECLARE_TRACE (power_end, - TP_PROTO(struct power_trace *it), -TP_ARGS (it)); - -#endif /* _TRACE_POWER_H */
include/trace/syscall.h +1 -1
@@ -33,7 +33,7 @@ struct syscall_metadata { };#ifdef CONFIG_FTRACE_SYSCALLS -extern struct syscall_metadata *syscall_nr_to_meta (int nr); +extern unsigned long arch_syscall_addr (int nr);extern int syscall_name_to_nr (char *name);void set_syscall_enter_id (int num,int id);void set_syscall_exit_id (int num,int id);
kernel/kprobes.c +2 -2
@@ -1014,9 +1014,9 @@ int __kprobes register_kretprobe(struct kretprobe *rp)/* Pre-allocate memory for max kretprobe instances */ if (rp->maxactive <=0 ) {#ifdef CONFIG_PREEMPT - rp->maxactive =max (10 ,2 *NR_CPUS ); + rp->maxactive =max (10 ,2 *num_possible_cpus ());#else - rp->maxactive =NR_CPUS ; + rp->maxactive =num_possible_cpus ();#endif }spin_lock_init (&rp->lock);
kernel/trace/ftrace.c +236 -139
532 lines not on this page · raw message
kernel/trace/ring_buffer.c +3 -6
@@ -1785,9 +1785,9 @@ rb_reset_tail(struct ring_buffer_per_cpu *cpu_buffer,static struct ring_buffer_event *rb_move_tail (struct ring_buffer_per_cpu *cpu_buffer,unsigned long length,unsigned long tail, -struct buffer_page *commit_page,struct buffer_page *tail_page,u64 *ts) { +struct buffer_page *commit_page = cpu_buffer->commit_page;struct ring_buffer *buffer = cpu_buffer->buffer;struct buffer_page *next_page;int ret;
@@ -1890,13 +1890,10 @@ static struct ring_buffer_event * __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer, unsigned type, unsigned long length, u64 *ts) { - struct buffer_page *tail_page, *commit_page; + struct buffer_page *tail_page;struct ring_buffer_event *event;unsigned long tail, write; - commit_page = cpu_buffer->commit_page; -/* we just need to protect against interrupts */ -barrier (); tail_page = cpu_buffer->tail_page; write =local_add_return (length, &tail_page->write);
@@ -1907,7 +1904,7 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,/* See if we shot pass the end of this buffer page */ if (write >BUF_PAGE_SIZE )return rb_move_tail (cpu_buffer, length, tail, - commit_page, tail_page, ts); + tail_page, ts);/* We reserved something on the buffer */
kernel/trace/ring_buffer_benchmark.c +76 -9
109 lines not on this page · raw message
kernel/trace/trace.c +2 -2
@@ -129,7 +129,7 @@ static int tracing_set_tracer(const char *buf);static char bootup_tracer_buf[MAX_TRACER_SIZE ]__initdata ;static char *default_bootup_tracer; -static int __init set_ftrace (char *str) +static int __init set_cmdline_ftrace (char *str) {strncpy (bootup_tracer_buf, str,MAX_TRACER_SIZE ); default_bootup_tracer = bootup_tracer_buf;
@@ -137,7 +137,7 @@ static int __init set_ftrace(char *str) ring_buffer_expanded =1 ;return 1 ; } -__setup ("ftrace=" , set_ftrace); +__setup ("ftrace=" , set_cmdline_ftrace);static int __init set_ftrace_dump_on_oops (char *str) {
kernel/trace/trace.h +29 -15
73 lines not on this page · raw message
kernel/trace/trace_clock.c +5 -3
@@ -20,6 +20,8 @@#include <linux/ktime.h> #include <linux/trace_clock.h> +#include "trace.h" +/* * trace_clock_local(): the simplest and least coherent tracing clock. *
@@ -28,17 +30,17 @@*/ u64 notrace trace_clock_local(void) { -unsigned long flags;u64 clock; +int resched;/* * sched_clock() is an architecture implemented, fast, scalable, * lockless clock. It is not guaranteed to be coherent across * CPUs, nor across CPU idle events. */ -raw_local_irq_save (flags); + resched =ftrace_preempt_disable (); clock =sched_clock (); -raw_local_irq_restore (flags); +ftrace_preempt_enable (resched);return clock; }
kernel/trace/trace_events.c +11 -12
@@ -878,9 +878,9 @@ event_subsystem_dir(const char *name, struct dentry *d_events) "'%s/filter' entry\n", name); } - entry =trace_create_file ("enable" ,0644 , system->entry, - (void *)system->name, - &ftrace_system_enable_fops); +trace_create_file ("enable" ,0644 , system->entry, + (void *)system->name, + &ftrace_system_enable_fops);return system->entry; }
@@ -892,7 +892,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,const struct file_operations *filter, const struct file_operations *format) { - struct dentry *entry; int ret;/*
@@ -910,12 +909,12 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events, }if (call->regfunc) - entry =trace_create_file ("enable" ,0644 , call->dir, call, - enable); +trace_create_file ("enable" ,0644 , call->dir, call, + enable);if (call->id && call->profile_enable) - entry =trace_create_file ("id" ,0444 , call->dir, call, - id); +trace_create_file ("id" ,0444 , call->dir, call, + id);if (call->define_fields) { ret = call->define_fields (call);
@@ -924,16 +923,16 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events, " events/%s\n", call->name);return ret; } - entry =trace_create_file ("filter" ,0644 , call->dir, call, - filter); +trace_create_file ("filter" ,0644 , call->dir, call, + filter); }/* A trace may not want to export its format */ if (!call->show_format)return 0 ; - entry =trace_create_file ("format" ,0444 , call->dir, call, - format); +trace_create_file ("format" ,0444 , call->dir, call, + format);return 0 ; }
kernel/trace/trace_events_filter.c +137 -18
214 lines not on this page · raw message
kernel/trace/trace_export.c +2 -2
@@ -48,11 +48,11 @@ struct ____ftrace_##name { \ tstruct \ }; \ -static void __used ____ftrace_check_##name(void) \ +static void __always_unused ____ftrace_check_##name(void) \ { \ struct ____ftrace_##name *__entry = NULL; \ \ - /* force cmpile-time check on F_printk() */ \ + /* force compile-time check on F_printk() */ \printk (print); \ }
kernel/trace/trace_syscalls.c +86 -0
98 lines not on this page · raw message
lib/kernel_lock.c +14 -6
@@ -5,10 +5,13 @@* relegated to obsolescence, but used by various less * important (or lazy) subsystems. */ -#include <linux/smp_lock.h> #include <linux/module.h> #include <linux/kallsyms.h> #include <linux/semaphore.h> +#include <linux/smp_lock.h> + +#define CREATE_TRACE_POINTS +#include <trace/events/bkl.h> /* * The 'big kernel lock'
@@ -113,21 +116,26 @@ static inline void __unlock_kernel(void)* This cannot happen asynchronously, so we only need to * worry about other CPU's. */ -void __lockfunc lock_kernel(void) +void __lockfunc _lock_kernel(const char *func, const char *file, int line) { -int depth = current->lock_depth+1 ; +int depth = current->lock_depth +1 ; + +trace_lock_kernel (func, file, line); +if (likely (!depth))__lock_kernel (); current->lock_depth = depth; } -void __lockfunc unlock_kernel(void) +void __lockfunc _unlock_kernel(const char *func, const char *file, int line) {BUG_ON (current->lock_depth <0 );if (likely (--current->lock_depth <0 ))__unlock_kernel (); + +trace_unlock_kernel (func, file, line); } -EXPORT_SYMBOL (lock_kernel); -EXPORT_SYMBOL (unlock_kernel); +EXPORT_SYMBOL (_lock_kernel); +EXPORT_SYMBOL (_unlock_kernel);
scripts/recordmcount.pl +120 -99
368 lines not on this page · raw message