tracing updates for v2.6.28
Subsystems (20)
Linus,
Please pull the latest tracing-v28-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git tracing-v28-for-linus
Thanks,
Ingo
------------------>
Anders Kaseorg (1):
ftrace: make ftrace_test_p6nop disassembler-friendly
Andrew Morton (1):
kbuild: ftrace: don't assume that scripts/recordmcount.pl is executable
Arjan van de Ven (3):
tracing/fastboot: add a script to visualize the kernel boot process / time tracing/fastboot: fix printk format typo in boot tracer tracing/fastboot: fix issues and improve output of bootgraph.pl
Arnaud Patard (1):
tracing/fastboot: fix bootgraph.pl initcall name regexp
Frederic Weisbecker (10):
tracing/ftrace: change the type of the print_line callback tracing/ftrace: adapt mmiotrace to the new type of print_line tracing/ftrace: adapt the boot tracer to the new print_line type tracing/ftrace: adapt mmiotrace to the new type of print_line, fix tracing/fastboot: change the printing of boot tracer according to bootgraph.pl tracing/fastboot: get the initcall name before it disappears tracing/fastboot: only trace non-module initcalls
ftrace: return an error when setting a nonexistent tracer tracing/fastboot: fix initcalls disposition in bootgraph.pl tracing/fastboot: fix initcalls disposition in bootgraph.pl
Frédéric Weisbecker (11):
ftrace: fix some mistakes in error messages
tracing/ftrace: make nop tracer reset previous entries tracing/ftrace: tracing engine depends on Nop Tracer tracing/ftrace: replace none tracer by nop tracer x86/ftrace: use uaccess in atomic context
tracing/ftrace: add the boot tracer
tracing/ftrace: make tracing suitable to run the boot tracer tracing/ftrace: give an entry on the config for boot tracer tracing/ftrace: launch boot tracing after pre-smp initcalls ftrace/fastboot: disable tracers self-tests when boot tracer is selected tracing/ftrace: don't consume unhandled entries by boot tracer
Harvey Harrison (3):
x86: suppress trivial sparse signedness warnings
ftrace: fix hex output mode of ftrace
trace: add build-time check to avoid overrunning hex buffer
Huang Ying (1):
ftrace: fix incorrect comment style of __ftrace_enabled_save()
Ingo Molnar (15):
tracing: disable tracepoints by default
sched: clean up tracepoints
tracing: clean up tracepoints kconfig structure
ftrace: ignore functions that cannot be kprobe-ed
ftrace: mark lapic_wd_event() notrace
ftrace: build fix
ftrace: ftrace_kill_atomic() build fix
ftrace: scripts/recordmcount.pl cross-build hack
ftrace: clean up macro usage
stack tracer: depends on DEBUG_KERNEL
ftrace: make it depend on DEBUG_KERNEL
ring-buffer: fix build error tracing/fastboot: build fix tracing/stacktrace: improve help text tracing/fastboot: improve help text
Jeremy Fitzhardinge (1):
ftrace: fix build problem with CONFIG_FTRACE
Lai Jiangshan (3):
markers: fix unregister bug and reenter bug
markers: fix unchecked format
markers: bit-field is not thread-safe nor smp-safe
Mathieu Desnoyers (18):
tracing: Kernel Tracepoints
tracing: tracepoints, documentation
tracing: tracepoints, samples
tracing, sched: LTTng instrumentation - scheduler
ftrace: port to tracepoints
tracepoints: use TABLE_SIZE macro
tracepoints: use rcu sched
tracepoints: fix reentrancy
markers: marker_synchronize_unregister()
markers: fix unregister bug and reenter bug, cleanup
markers: probe example, fix teardown
markers: documentation fix for teardown
sputrace: use marker_synchronize_unregister()
markers: re-enable fast batch registration
markers: turn marker_synchronize_unregister() into an inline
markers: fix synchronize marker unregister static inline
tracepoints: tracepoint_synchronize_unregister()
tracepoints: synchronize unregister static inline
Michael Ellerman (1):
ftrace: make output nicely spaced for up to 999 cpus
Pekka Paalanen (9):
x86: fix mmiotrace 8-bit register decoding x86 mmiotrace: fix a rare memory leak
ftrace: move mmiotrace functions out of trace.c
ftrace: add trace_vprintk()
x86 mmiotrace: implement mmiotrace_printk()
mmiotrace: handle TRACE_PRINT entries
mmiotrace: remove left-over marker cruft
ftrace: inject markers via trace_marker file tracing/ftrace: fix pipe breaking
Peter Zijlstra (2):
ftrace: make ftrace_printk usable with the other tracers
ftrace: sched_switch: show the wakee's cpu
Stephen Rothwell (1):
ftrace: fix build failure
Steven Noonan (4):
ftrace: add nop tracer
ftrace: mcount_addr defined but not used
trace: remove pointless ifdefs
ftrace: ktime.h not included in ftrace.h
Steven Rostedt (45):
ftrace: create __mcount_loc section
ftrace: mcount call site on boot nops core
ftrace: enable mcount recording for modules
ftrace: rebuild everything on change to FTRACE_MCOUNT_RECORD
ftrace: enable using mcount recording on x86
ftrace: x86 mcount stub
ftrace: use only 5 byte nops for x86
ftrace: do not show freed records in available_filter_functions
ftrace: move notrace to compiler.h
ftrace: remove old pointers to mcount
ftrace: new continue entry - separate out from trace_entry
ftrace: printk formatting infrastructure
ftrace: ftrace_printk doc moved
ftrace: dump out ftrace buffers to console on panic
ftrace: do not init module on ftrace disabled
ftrace: add necessary locking for ftrace records
ftrace: update recordmount.pl arch changes
ftrace: handle weak symbol functions
ftrace: x86 use copy to and from user functions
ftrace: objcopy version test for local symbols
ftrace: add stack tracer
ftrace: remove direct reference to mcount in trace code
ftrace: remove warning of old objcopy and local functions
ftrace: stack trace add indexes
ftrace: binary and not logical for continue test
ftrace: print continue index fix
ftrace: use ftrace_release for all dynamic ftrace functions
ftrace: fix unlocking of hash
ftrace: warn on failure to disable mcount callers
ftrace: give time for wakeup test to run
tracing: unified trace buffer
ring_buffer: add paranoid check for buffer page
ring_buffer: reset buffer page when freeing
ftrace: make work with new ring buffer
ftrace: take advantage of variable length entries
ring_buffer: remove raw from local_irq_save
ring_buffer: implement new locking
ftrace: type cast filter+verifier
ring_buffer: allocate buffer page pointer
ftrace: preempt disable over interrupt disable
ring_buffer: map to cpu not page
ftrace: move pc counter in irqtrace
ring-buffer: move page indexes into page headers
ring-buffer: make reentrant
ftrace: make some tracers reentrant
Tim Bird (1):
tracing/fastboot: add better resolution to initcall debug/tracing
Documentation/markers.txt | 10 +- Documentation/tracepoints.txt | 101 ++ Documentation/tracers/mmiotrace.txt | 5 +- arch/powerpc/platforms/cell/spufs/sputrace.c | 1 + arch/x86/Kconfig | 1 + arch/x86/kernel/cpu/perfctr-watchdog.c | 11 +- arch/x86/kernel/entry_32.S | 14 - arch/x86/kernel/entry_64.S | 26 - arch/x86/kernel/ftrace.c | 124 +- arch/x86/mm/mmio-mod.c | 87 +- arch/x86/mm/pf_in.c | 121 +- arch/x86/mm/testmmiotrace.c | 4 + include/asm-generic/vmlinux.lds.h | 14 +- include/asm-x86/ftrace.h | 10 + include/linux/compiler.h | 2 + include/linux/ftrace.h | 84 +- include/linux/init.h | 2 +- include/linux/kernel.h | 5 + include/linux/kprobes.h | 5 +- include/linux/linkage.h | 2 - include/linux/marker.h | 7 + include/linux/mmiotrace.h | 20 +- include/linux/module.h | 17 + include/linux/ring_buffer.h | 127 ++ include/linux/tracepoint.h | 137 ++ include/trace/sched.h | 56 + init/Kconfig | 7 + init/main.c | 34 +- kernel/Makefile | 1 + kernel/exit.c | 10 +- kernel/fork.c | 3 + kernel/kthread.c | 5 + kernel/marker.c | 36 +- kernel/module.c | 81 +- kernel/notifier.c | 2 +- kernel/sched.c | 17 +- kernel/signal.c | 3 + kernel/trace/Kconfig | 64 +- kernel/trace/Makefile | 4 + kernel/trace/ftrace.c | 275 +++- kernel/trace/ring_buffer.c | 2014 ++++++++++++++++++++++++ kernel/trace/trace.c | 1845 +++++++++++----------- kernel/trace/trace.h | 211 ++- kernel/trace/trace_boot.c | 126 ++ kernel/trace/trace_functions.c | 2 +- kernel/trace/trace_irqsoff.c | 19 +- kernel/trace/trace_mmiotrace.c | 116 ++- kernel/trace/trace_nop.c | 64 + kernel/trace/trace_sched_switch.c | 137 +-- kernel/trace/trace_sched_wakeup.c | 148 +-- kernel/trace/trace_selftest.c | 83 +- kernel/trace/trace_stack.c | 310 ++++ kernel/trace/trace_sysprof.c | 2 +- kernel/tracepoint.c | 477 ++++++ samples/Kconfig | 6 + samples/Makefile | 2 +- samples/markers/probe-example.c | 1 + samples/tracepoints/Makefile | 6 + samples/tracepoints/tp-samples-trace.h | 13 + samples/tracepoints/tracepoint-probe-sample.c | 55 + samples/tracepoints/tracepoint-probe-sample2.c | 42 + samples/tracepoints/tracepoint-sample.c | 53 + scripts/Makefile.build | 7 + scripts/bootgraph.pl | 149 ++ scripts/recordmcount.pl | 395 +++++ 65 files changed, 6244 insertions(+), 1574 deletions(-) create mode 100644 Documentation/tracepoints.txt create mode 100644 include/linux/ring_buffer.h create mode 100644 include/linux/tracepoint.h create mode 100644 include/trace/sched.h create mode 100644 kernel/trace/ring_buffer.c create mode 100644 kernel/trace/trace_boot.c create mode 100644 kernel/trace/trace_nop.c create mode 100644 kernel/trace/trace_stack.c create mode 100644 kernel/tracepoint.c create mode 100644 samples/tracepoints/Makefile create mode 100644 samples/tracepoints/tp-samples-trace.h create mode 100644 samples/tracepoints/tracepoint-probe-sample.c create mode 100644 samples/tracepoints/tracepoint-probe-sample2.c create mode 100644 samples/tracepoints/tracepoint-sample.c create mode 100644 scripts/bootgraph.pl create mode 100755 scripts/recordmcount.pl
Documentation/markers.txt +6 -4
@@ -50,10 +50,12 @@ Connecting a function (probe) to a marker is done by providing a probe (function to call) for the specific marker through marker_probe_register() and can be activated by calling marker_arm(). Marker deactivation can be done by calling marker_disarm() as many times as marker_arm() has been called. Removing a probe -is done through marker_probe_unregister(); it will disarm the probe and make -sure there is no caller left using the probe when it returns. Probe removal is -preempt-safe because preemption is disabled around the probe call. See the -"Probe example" section below for a sample probe module. +is done through marker_probe_unregister(); it will disarm the probe. +marker_synchronize_unregister() must be called before the end of the module exit +function to make sure there is no caller left using the probe. This, and the +fact that preemption is disabled around the probe call, make sure that probe +removal and module unload are safe. See the "Probe example" section below for a +sample probe module. The marker mechanism supports inserting multiple instances of the same marker. Markers can be put in inline functions, inlined static functions, and
Documentation/tracepoints.txt new file +101 -0
101 lines not on this page · raw message
Documentation/tracers/mmiotrace.txt +2 -3
@@ -36,7 +36,7 @@ $ mount -t debugfs debugfs /debug $ echo mmiotrace > /debug/tracing/current_tracer $ cat /debug/tracing/trace_pipe > mydump.txt & Start X or whatever. -$ echo "X is up" > /debug/tracing/marker +$ echo "X is up" > /debug/tracing/trace_marker $ echo none > /debug/tracing/current_tracer Check for lost events.
@@ -59,9 +59,8 @@ The 'cat' process should stay running (sleeping) in the background. Load the driver you want to trace and use it. Mmiotrace will only catch MMIO accesses to areas that are ioremapped while mmiotrace is active. -[Unimplemented feature:] During tracing you can place comments (markers) into the trace by -$ echo "X is up" > /debug/tracing/marker +$ echo "X is up" > /debug/tracing/trace_marker This makes it easier to see which part of the (huge) trace corresponds to which action. It is recommended to place descriptive markers about what you do.
arch/powerpc/platforms/cell/spufs/sputrace.c +1 -0
@@ -232,6 +232,7 @@ static void __exit sputrace_exit(void)remove_proc_entry ("sputrace" ,NULL );kfree (sputrace_log); +marker_synchronize_unregister (); }module_init (sputrace_init);
arch/x86/Kconfig +1 -0
@@ -25,6 +25,7 @@ config X86 select HAVE_KPROBES select ARCH_WANT_OPTIONAL_GPIOLIB select HAVE_KRETPROBES + select HAVE_FTRACE_MCOUNT_RECORD select HAVE_DYNAMIC_FTRACE select HAVE_FTRACE select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
arch/x86/kernel/cpu/perfctr-watchdog.c +7 -4
@@ -17,6 +17,8 @@#include <linux/bitops.h> #include <linux/smp.h> #include <linux/nmi.h> +#include <linux/kprobes.h> +#include <asm/apic.h> #include <asm/intel_arch_perfmon.h>
@@ -336,7 +338,8 @@ static void single_msr_unreserve(void)release_perfctr_nmi (wd_ops->perfctr); } -static void single_msr_rearm (struct nmi_watchdog_ctlblk *wd,unsigned nmi_hz) +static void __kprobes +single_msr_rearm (struct nmi_watchdog_ctlblk *wd,unsigned nmi_hz) {/* start the cycle over again */ write_watchdog_counter (wd->perfctr_msr,NULL , nmi_hz);
@@ -401,7 +404,7 @@ static int setup_p6_watchdog(unsigned nmi_hz)return 1 ; } -static void p6_rearm (struct nmi_watchdog_ctlblk *wd,unsigned nmi_hz) +static void __kprobes p6_rearm (struct nmi_watchdog_ctlblk *wd,unsigned nmi_hz) {/* * P6 based Pentium M need to re-unmask
@@ -605,7 +608,7 @@ static void p4_unreserve(void)release_perfctr_nmi (MSR_P4_IQ_PERFCTR0 ); } -static void p4_rearm (struct nmi_watchdog_ctlblk *wd,unsigned nmi_hz) +static void __kprobes p4_rearm (struct nmi_watchdog_ctlblk *wd,unsigned nmi_hz) {unsigned dummy;/*
@@ -784,7 +787,7 @@ unsigned lapic_adjust_nmi_hz(unsigned hz)return hz; } -int lapic_wd_event (unsigned nmi_hz) +int __kprobes lapic_wd_event (unsigned nmi_hz) {struct nmi_watchdog_ctlblk *wd = &__get_cpu_var (nmi_watchdog_ctlblk);u64 ctr;
arch/x86/kernel/entry_32.S +0 -14
@@ -1153,20 +1153,6 @@ ENDPROC(xen_failsafe_callback) #ifdef CONFIG_DYNAMIC_FTRACE ENTRY(mcount) - pushl %eax - pushl %ecx - pushl %edx - movl 0xc(%esp), %eax - subl $MCOUNT_INSN_SIZE, %eax - -.globl mcount_call -mcount_call: - call ftrace_stub - - popl %edx - popl %ecx - popl %eax - ret END(mcount)
arch/x86/kernel/entry_64.S +0 -26
@@ -64,32 +64,6 @@ #ifdef CONFIG_FTRACE #ifdef CONFIG_DYNAMIC_FTRACE ENTRY(mcount) - - subq $0x38, %rsp - movq %rax, (%rsp) - movq %rcx, 8(%rsp) - movq %rdx, 16(%rsp) - movq %rsi, 24(%rsp) - movq %rdi, 32(%rsp) - movq %r8, 40(%rsp) - movq %r9, 48(%rsp) - - movq 0x38(%rsp), %rdi - subq $MCOUNT_INSN_SIZE, %rdi - -.globl mcount_call -mcount_call: - call ftrace_stub - - movq 48(%rsp), %r9 - movq 40(%rsp), %r8 - movq 32(%rsp), %rdi - movq 24(%rsp), %rsi - movq 16(%rsp), %rdx - movq 8(%rsp), %rcx - movq (%rsp), %rax - addq $0x38, %rsp - retq END(mcount)
arch/x86/kernel/ftrace.c +79 -45
166 lines not on this page · raw message
arch/x86/mm/mmio-mod.c +21 -66
136 lines not on this page · raw message
arch/x86/mm/pf_in.c +84 -37
225 lines not on this page · raw message
arch/x86/mm/testmmiotrace.c +4 -0
@@ -3,6 +3,7 @@*/ #include <linux/module.h> #include <linux/io.h> +#include <linux/mmiotrace.h> #define MODULE_NAME "testmmiotrace"
@@ -13,6 +14,7 @@ MODULE_PARM_DESC(mmio_address, "Start address of the mapping of 16 kB.");static void do_write_test (void __iomem *p) {unsigned int i; +mmiotrace_printk ("Write test.\n" );for (i =0 ; i <256 ; i++)iowrite8 (i, p + i);for (i =1024 ; i < (5 *1024 ); i +=2 )
@@ -24,6 +26,7 @@ static void do_write_test(void __iomem *p)static void do_read_test (void __iomem *p) {unsigned int i; +mmiotrace_printk ("Read test.\n" );for (i =0 ; i <256 ; i++)ioread8 (p + i);for (i =1024 ; i < (5 *1024 ); i +=2 )
@@ -39,6 +42,7 @@ static void do_test(void)pr_err (MODULE_NAME ": could not ioremap, aborting.\n" );return ; } +mmiotrace_printk ("ioremap returned %p.\n" , p);do_write_test (p);do_read_test (p);iounmap (p);
include/asm-generic/vmlinux.lds.h +13 -1
@@ -37,6 +37,13 @@#define MEM_DISCARD (sec) *(.mem##sec)#endif +#ifdef CONFIG_FTRACE_MCOUNT_RECORD +#define MCOUNT_REC () VMLINUX_SYMBOL(__start_mcount_loc) = .; \ + *(__mcount_loc) \ + VMLINUX_SYMBOL(__stop_mcount_loc) = .; +#else +#define MCOUNT_REC () +#endif /* .data section */ #define DATA_DATA \
@@ -52,7 +59,10 @@ . = ALIGN(8); \ VMLINUX_SYMBOL(__start___markers) = .; \ *(__markers ) \ - VMLINUX_SYMBOL(__stop___markers) = .; + VMLINUX_SYMBOL(__stop___markers) = .; \ + VMLINUX_SYMBOL(__start___tracepoints) = .; \ + *(__tracepoints ) \ + VMLINUX_SYMBOL(__stop___tracepoints) = .;#define RO_DATA (align) \ . = ALIGN((align)); \
@@ -61,6 +71,7 @@ *(.rodata) *(.rodata.*) \ *(__vermagic)/* Kernel version magic */ \ *(__markers_strings)/* Markers: strings */ \ + *(__tracepoints_strings)/* Tracepoints: strings */ \ } \ \ .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
@@ -188,6 +199,7 @@/* __*init sections */ \ __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \ *(.ref.rodata) \ + MCOUNT_REC() \ DEV_KEEP(init.rodata) \ DEV_KEEP(exit.rodata) \CPU_KEEP (init.rodata) \
include/asm-x86/ftrace.h +10 -0
@@ -7,6 +7,16 @@#ifndef __ASSEMBLY__extern void mcount (void ); + +static inline unsigned long ftrace_call_adjust (unsigned long addr) +{ +/* +* call mcount is "e8 <4 byte offset>" +* The addr points to the 4 byte offset and the caller of this +* function wants the pointer to e8. Simply subtract one. +*/ +return addr -1 ; +}#endif #endif /* CONFIG_FTRACE */
include/linux/compiler.h +2 -0
@@ -44,6 +44,8 @@ extern void __chk_io_ptr(const volatile void __iomem *);# error Sorry, your compiler is too old/not recognized.#endif +#define notrace __attribute__((no_instrument_function)) +/* Intel compiler defines __GNUC__. So we will overwrite implementations * coming from above header files here */
include/linux/ftrace.h +78 -6
126 lines not on this page · raw message
include/linux/init.h +1 -1
@@ -40,7 +40,7 @@/* These are for everybody (although not all archs will actually discard it in modules) */ -#define __init __section(.init.text) __cold +#define __init __section(.init.text) __cold notrace#define __initdata __section(.init.data)#define __initconst __section(.init.rodata)#define __exitdata __section(.exit.data)
include/linux/kernel.h +5 -0
@@ -486,4 +486,9 @@ struct sysinfo {#define NUMA_BUILD 0#endif +/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ +#ifdef CONFIG_FTRACE_MCOUNT_RECORD +# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD +#endif +#endif
include/linux/kprobes.h +3 -2
@@ -29,6 +29,7 @@* <[email protected]> and Prasanna S Panchamukhi * <[email protected]> added function-return probes. */ +#include <linux/linkage.h> #include <linux/list.h> #include <linux/notifier.h> #include <linux/smp.h>
@@ -47,7 +48,7 @@#define KPROBE_HIT_SSDONE 0x00000008/* Attach to insert probes on any functions which should be ignored*/ -#define __kprobes __attribute__((__section__(".kprobes.text"))) +#define __kprobes __attribute__((__section__(".kprobes.text"))) notracestruct kprobe ;struct pt_regs ;
@@ -256,7 +257,7 @@ void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);#else /* CONFIG_KPROBES */ -#define __kprobes/**/ +#define __kprobes notracestruct jprobe ;struct kretprobe ;
include/linux/linkage.h +0 -2
@@ -4,8 +4,6 @@#include <linux/compiler.h> #include <asm/linkage.h> -#define notrace __attribute__((no_instrument_function)) -#ifdef __cplusplus#define CPP_ASMLINKAGE extern "C"#else
include/linux/marker.h +7 -0
@@ -160,4 +160,11 @@ extern int marker_probe_unregister_private_data(marker_probe_func *probe,extern void *marker_get_private_data (const char *name,marker_probe_func *probe,int num); +/* +* marker_synchronize_unregister must be called between the last marker probe +* unregistration and the end of module exit to make sure there is no caller +* executing a probe when it is freed. +*/ +#define marker_synchronize_unregister () synchronize_sched() +#endif
include/linux/mmiotrace.h +16 -4
@@ -34,11 +34,15 @@ extern void unregister_kmmio_probe(struct kmmio_probe *p);/* Called from page fault handler. */ extern int kmmio_handler (struct pt_regs *regs,unsigned long addr); -/* Called from ioremap.c */ #ifdef CONFIG_MMIOTRACE +/* Called from ioremap.c */ extern void mmiotrace_ioremap (resource_size_t offset,unsigned long size,void __iomem *addr);extern void mmiotrace_iounmap (volatile void __iomem *addr); + +/* For anyone to insert markers. Remember trailing newline. */ +extern int mmiotrace_printk (const char *fmt, ...) + __attribute__ ((format (printf,1 ,2 )));#else static inline void mmiotrace_ioremap (resource_size_t offset,unsigned long size,void __iomem *addr)
@@ -48,15 +52,22 @@ static inline void mmiotrace_ioremap(resource_size_t offset,static inline void mmiotrace_iounmap (volatile void __iomem *addr) { } -#endif /* CONFIG_MMIOTRACE_HOOKS */ + +static inline int mmiotrace_printk (const char *fmt, ...) + __attribute__ ((format (printf,1 ,0 ))); + +static inline int mmiotrace_printk (const char *fmt, ...) +{ +return 0 ; +} +#endif /* CONFIG_MMIOTRACE */ enum mm_io_opcode {MMIO_READ =0x1 ,/* struct mmiotrace_rw */ MMIO_WRITE =0x2 ,/* struct mmiotrace_rw */ MMIO_PROBE =0x3 ,/* struct mmiotrace_map */ MMIO_UNPROBE =0x4 ,/* struct mmiotrace_map */ -MMIO_MARKER =0x5 ,/* raw char data */ -MMIO_UNKNOWN_OP =0x6 ,/* struct mmiotrace_rw */ +MMIO_UNKNOWN_OP =0x5 ,/* struct mmiotrace_rw */ };struct mmiotrace_rw {
@@ -81,5 +92,6 @@ extern void enable_mmiotrace(void);extern void disable_mmiotrace (void );extern void mmio_trace_rw (struct mmiotrace_rw *rw);extern void mmio_trace_mapping (struct mmiotrace_map *map); +extern int mmio_trace_printk (const char *fmt,va_list args);#endif /* MMIOTRACE_H */
include/linux/module.h +17 -0
@@ -16,6 +16,7 @@#include <linux/kobject.h> #include <linux/moduleparam.h> #include <linux/marker.h> +#include <linux/tracepoint.h> #include <asm/local.h> #include <asm/module.h>
@@ -331,6 +332,10 @@ struct modulestruct marker *markers;unsigned int num_markers;#endif +#ifdef CONFIG_TRACEPOINTS +struct tracepoint *tracepoints; +unsigned int num_tracepoints; +#endif #ifdef CONFIG_MODULE_UNLOAD /* What modules depend on me? */
@@ -454,6 +459,9 @@ extern void print_modules(void);extern void module_update_markers (void ); +extern void module_update_tracepoints (void ); +extern int module_get_iter_tracepoints (struct tracepoint_iter *iter); +#else /* !CONFIG_MODULES... */ #define EXPORT_SYMBOL (sym)#define EXPORT_SYMBOL_GPL (sym)
@@ -558,6 +566,15 @@ static inline void module_update_markers(void) { } +static inline void module_update_tracepoints (void ) +{ +} + +static inline int module_get_iter_tracepoints (struct tracepoint_iter *iter) +{ +return 0 ; +} +#endif /* CONFIG_MODULES */ struct device_driver ;
include/linux/ring_buffer.h new file +127 -0
127 lines not on this page · raw message
include/linux/tracepoint.h new file +137 -0
137 lines not on this page · raw message
include/trace/sched.h new file +56 -0
56 lines not on this page · raw message
init/Kconfig +7 -0
@@ -771,6 +771,13 @@ config PROFILING Say Y here to enable the extended profiling support mechanisms used by profilers such as OProfile. +# +# Place an empty function call at each tracepoint site. Can be +# dynamically changed for a probe function. +# +config TRACEPOINTS + bool + config MARKERS bool "Activate markers" help
init/main.c +20 -14
@@ -60,6 +60,7 @@#include <linux/sched.h> #include <linux/signal.h> #include <linux/idr.h> +#include <linux/ftrace.h> #include <asm/io.h> #include <asm/bugs.h>
@@ -687,6 +688,8 @@ asmlinkage void __init start_kernel(void)acpi_early_init ();/* before LAPIC and SMP init */ +ftrace_init (); +/* Do the rest non-__init'ed, we're now alive */ rest_init (); }
@@ -703,30 +706,31 @@ __setup("initcall_debug", initcall_debug_setup);int do_one_initcall (initcall_t fn) {int count =preempt_count (); -ktime_t t0, t1, delta; +ktime_t delta;char msgbuf[64 ]; -int result; +struct boot_trace it;if (initcall_debug) { -printk ("calling %pF\n" , fn); - t0 =ktime_get (); + it.caller =task_pid_nr (current); +printk ("calling %pF @ %i\n" , fn, it.caller); + it.calltime =ktime_get (); } - result =fn (); + it.result =fn ();if (initcall_debug) { - t1 =ktime_get (); - delta =ktime_sub (t1, t0); - -printk ("initcall %pF returned %d after %Ld msecs\n" , - fn, result, - (unsigned long long ) delta.tv64 >>20 ); + it.rettime =ktime_get (); + delta =ktime_sub (it.rettime, it.calltime); + it.duration = (unsigned long long ) delta.tv64 >>10 ; +printk ("initcall %pF returned %d after %Ld usecs\n" , fn, + it.result, it.duration); +trace_boot (&it, fn); } msgbuf[0 ] =0 ; -if (result && result != -ENODEV && initcall_debug) -sprintf (msgbuf,"error code %d " , result); +if (it.result && it.result != -ENODEV && initcall_debug) +sprintf (msgbuf,"error code %d " , it.result);if (preempt_count () != count) {strlcat (msgbuf,"preemption imbalance " ,sizeof (msgbuf));
@@ -740,7 +744,7 @@ int do_one_initcall(initcall_t fn)printk ("initcall %pF returned with %s\n" , fn, msgbuf); } -return result; +return it.result; }
@@ -855,6 +859,7 @@ static int __init kernel_init(void * unused)smp_prepare_cpus (setup_max_cpus);do_pre_smp_initcalls (); +start_boot_trace ();smp_init ();sched_init_smp ();
@@ -881,6 +886,7 @@ static int __init kernel_init(void * unused)* we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ +stop_boot_trace ();init_post ();return 0 ; }
kernel/Makefile +1 -0
@@ -83,6 +83,7 @@ obj-$(CONFIG_SYSCTL) += utsname_sysctl.o obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o obj-$(CONFIG_MARKERS) += marker.o +obj-$(CONFIG_TRACEPOINTS) += tracepoint.o obj-$(CONFIG_LATENCYTOP) += latencytop.o obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o obj-$(CONFIG_FTRACE) += trace/
kernel/exit.c +9 -1
@@ -47,6 +47,7 @@#include <linux/blkdev.h> #include <linux/task_io_accounting_ops.h> #include <linux/tracehook.h> +#include <trace/sched.h> #include <asm/uaccess.h> #include <asm/unistd.h>
@@ -149,7 +150,10 @@ static void __exit_signal(struct task_struct *tsk)static void delayed_put_task_struct (struct rcu_head *rhp) { -put_task_struct (container_of(rhp ,struct task_struct ,rcu )); + struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); + +trace_sched_process_free (tsk); +put_task_struct (tsk); }
@@ -1074,6 +1078,8 @@ NORET_TYPE void do_exit(long code)if (group_dead)acct_process (); +trace_sched_process_exit (tsk); +exit_sem (tsk);exit_files (tsk);exit_fs (tsk);
@@ -1675,6 +1681,8 @@ static long do_wait(enum pid_type type, struct pid *pid, int options,struct task_struct *tsk;int retval; +trace_sched_process_wait (pid); +add_wait_queue (¤t->signal->wait_chldexit,&wait); repeat:/*
kernel/fork.c +3 -0
@@ -58,6 +58,7 @@#include <linux/tty.h> #include <linux/proc_fs.h> #include <linux/blkdev.h> +#include <trace/sched.h> #include <asm/pgtable.h> #include <asm/pgalloc.h>
@@ -1364,6 +1365,8 @@ long do_fork(unsigned long clone_flags,if (!IS_ERR (p)) {struct completion vfork; +trace_sched_process_fork (current, p); + nr =task_pid_vnr (p);if (clone_flags &CLONE_PARENT_SETTID )
kernel/kthread.c +5 -0
@@ -13,6 +13,7 @@#include <linux/file.h> #include <linux/module.h> #include <linux/mutex.h> +#include <trace/sched.h> #define KTHREAD_NICE_LEVEL (-5)
@@ -206,6 +207,8 @@ int kthread_stop(struct task_struct *k)/* It could exit after stop_info.k set, but before wake_up_process. */ get_task_struct (k); +trace_sched_kthread_stop (k); +/* Must init completion *before* thread sees kthread_stop_info.k */ init_completion (&kthread_stop_info.done);smp_wmb ();
@@ -221,6 +224,8 @@ int kthread_stop(struct task_struct *k) ret = kthread_stop_info.err;mutex_unlock (&kthread_stop_lock); +trace_sched_kthread_stop_ret (ret); +return ret; }EXPORT_SYMBOL (kthread_stop);
kernel/marker.c +24 -12
@@ -62,7 +62,7 @@ struct marker_entry {int refcount;/* Number of times armed. 0 if disarmed. */ struct rcu_head rcu;void *oldptr; - unsigned char rcu_pending:1; +int rcu_pending; unsigned char ptype:1;char name[0 ];/* Contains name'\0'format'\0' */ };
@@ -103,11 +103,11 @@ void marker_probe_cb(const struct marker *mdata, void *call_private, ...)char ptype;/* -* preempt_disable does two things : disabling preemption to make sure -* the teardown of the callbacks can be done correctly when they are in -* modules and they insure RCU read coherency. +* rcu_read_lock_sched does two things : disabling preemption to make +* sure the teardown of the callbacks can be done correctly when they +* are in modules and they insure RCU read coherency. */ -preempt_disable (); +rcu_read_lock_sched (); ptype = mdata->ptype;if (likely (!ptype)) {marker_probe_func *func;
@@ -145,7 +145,7 @@ void marker_probe_cb(const struct marker *mdata, void *call_private, ...)va_end (args); } } -preempt_enable (); +rcu_read_unlock_sched (); }EXPORT_SYMBOL_GPL (marker_probe_cb);
@@ -162,7 +162,7 @@ void marker_probe_cb_noarg(const struct marker *mdata, void *call_private, ...)va_list args;/* not initialized */ char ptype; -preempt_disable (); +rcu_read_lock_sched (); ptype = mdata->ptype;if (likely (!ptype)) {marker_probe_func *func;
@@ -195,7 +195,7 @@ void marker_probe_cb_noarg(const struct marker *mdata, void *call_private, ...) multi[i].func (multi[i].probe_private, call_private, mdata->format, &args); } -preempt_enable (); +rcu_read_unlock_sched (); }EXPORT_SYMBOL_GPL (marker_probe_cb_noarg);
@@ -560,7 +560,7 @@ static int set_marker(struct marker_entry **entry, struct marker *elem,* Disable a marker and its probe callback. * Note: only waiting an RCU period after setting elem->call to the empty * function insures that the original callback is not used anymore. This insured -* by preempt_disable around the call site. +* by rcu_read_lock_sched around the call site. */ static void disable_marker (struct marker *elem) {
@@ -653,11 +653,17 @@ int marker_probe_register(const char *name, const char *format, entry =get_marker (name);if (!entry) { entry =add_marker (name, format); -if (IS_ERR (entry)) { +if (IS_ERR (entry)) ret =PTR_ERR (entry); - goto end; - } + }else if (format) { +if (!entry->format) + ret =marker_set_format (&entry, format); +else if (strcmp (entry->format, format)) + ret = -EPERM ; } +if (ret) + goto end; +/* * If we detect that a call_rcu is pending for this marker, * make sure it's executed now.
@@ -674,6 +680,8 @@ int marker_probe_register(const char *name, const char *format,mutex_lock (&markers_mutex); entry =get_marker (name);WARN_ON (!entry); +if (entry->rcu_pending) +rcu_barrier_sched (); entry->oldptr = old; entry->rcu_pending =1 ;/* write rcu_pending before calling the RCU callback */
@@ -717,6 +725,8 @@ int marker_probe_unregister(const char *name, entry =get_marker (name);if (!entry) goto end; +if (entry->rcu_pending) +rcu_barrier_sched (); entry->oldptr = old; entry->rcu_pending =1 ;/* write rcu_pending before calling the RCU callback */
@@ -795,6 +805,8 @@ int marker_probe_unregister_private_data(marker_probe_func *probe,mutex_lock (&markers_mutex); entry =get_marker_from_private_data (probe, probe_private);WARN_ON (!entry); +if (entry->rcu_pending) +rcu_barrier_sched (); entry->oldptr = old; entry->rcu_pending =1 ;/* write rcu_pending before calling the RCU callback */
kernel/module.c +80 -1
133 lines not on this page · raw message
kernel/notifier.c +1 -1
@@ -550,7 +550,7 @@ EXPORT_SYMBOL(unregister_reboot_notifier);static ATOMIC_NOTIFIER_HEAD (die_chain); -int notify_die (enum die_val val,const char *str, +int notrace notify_die(enum die_val val, const char *str,struct pt_regs *regs,long err,int trap,int sig) {struct die_args args = {
kernel/sched.c +6 -11
@@ -71,6 +71,7 @@#include <linux/debugfs.h> #include <linux/ctype.h> #include <linux/ftrace.h> +#include <trace/sched.h> #include <asm/tlb.h> #include <asm/irq_regs.h>
@@ -1936,6 +1937,7 @@ unsigned long wait_task_inactive(struct task_struct *p, long match_state)* just go back and repeat. */ rq =task_rq_lock (p, &flags); +trace_sched_wait_task (rq, p); running =task_running (rq, p); on_rq = p->se.on_rq; ncsw =0 ;
@@ -2297,9 +2299,7 @@ out_activate: success =1 ; out_running: -trace_mark (kernel_sched_wakeup, -"pid %d state %ld ## rq %p task %p rq->curr %p" , - p->pid, p->state, rq, p, rq->curr); +trace_sched_wakeup (rq, p);check_preempt_curr (rq, p, sync); p->state =TASK_RUNNING ;
@@ -2432,9 +2432,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags) p->sched_class->task_new (rq, p);inc_nr_running (rq); } -trace_mark (kernel_sched_wakeup_new, -"pid %d state %ld ## rq %p task %p rq->curr %p" , - p->pid, p->state, rq, p, rq->curr); +trace_sched_wakeup_new (rq, p);check_preempt_curr (rq, p,0 );#ifdef CONFIG_SMP if (p->sched_class->task_wake_up)
@@ -2607,11 +2605,7 @@ context_switch(struct rq *rq, struct task_struct *prev,struct mm_struct *mm, *oldmm;prepare_task_switch (rq, prev, next); -trace_mark (kernel_sched_schedule, -"prev_pid %d next_pid %d prev_state %ld " -"## rq %p prev %p next %p" , - prev->pid, next->pid, prev->state, - rq, prev, next); +trace_sched_switch (rq, prev, next); mm = next->mm; oldmm = prev->active_mm;/*
@@ -2851,6 +2845,7 @@ static void sched_migrate_task(struct task_struct *p, int dest_cpu) || unlikely(!cpu_active(dest_cpu))) goto out; +trace_sched_migrate_task (rq, p, dest_cpu);/* force the process onto the specified CPU */ if (migrate_task (p, dest_cpu, &req)) {/* Need to wait for migration thread (might exit: take ref). */
kernel/signal.c +3 -0
@@ -27,6 +27,7 @@#include <linux/freezer.h> #include <linux/pid_namespace.h> #include <linux/nsproxy.h> +#include <trace/sched.h> #include <asm/param.h> #include <asm/uaccess.h>
@@ -803,6 +804,8 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,struct sigpending *pending;struct sigqueue *q; +trace_sched_signal_send (sig, t); +assert_spin_locked (&t->sighand->siglock);if (!prepare_signal (sig, t))return 0 ;
kernel/trace/Kconfig +63 -1
132 lines not on this page · raw message
kernel/trace/Makefile +4 -0
@@ -11,6 +11,7 @@ obj-y += trace_selftest_dynamic.o endif obj-$(CONFIG_FTRACE) += libftrace.o +obj-$(CONFIG_RING_BUFFER) += ring_buffer.o obj-$(CONFIG_TRACING) += trace.o obj-$(CONFIG_CONTEXT_SWITCH_TRACER) += trace_sched_switch.o
@@ -19,6 +20,9 @@ obj-$(CONFIG_FTRACE) += trace_functions.o obj-$(CONFIG_IRQSOFF_TRACER) += trace_irqsoff.o obj-$(CONFIG_PREEMPT_TRACER) += trace_irqsoff.o obj-$(CONFIG_SCHED_TRACER) += trace_sched_wakeup.o +obj-$(CONFIG_NOP_TRACER) += trace_nop.o +obj-$(CONFIG_STACK_TRACER) += trace_stack.o obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o +obj-$(CONFIG_BOOT_TRACER) += trace_boot.o libftrace-y := ftrace.o
kernel/trace/ftrace.c +210 -65
418 lines not on this page · raw message
kernel/trace/ring_buffer.c new file +2014 -0
501 lines not on this page · raw message
kernel/trace/trace.c +949 -896
1,845 lines not on this page · raw message
kernel/trace/trace.h +146 -65
211 lines not on this page · raw message
kernel/trace/trace_boot.c new file +126 -0
126 lines not on this page · raw message
kernel/trace/trace_mmiotrace.c +99 -17
116 lines not on this page · raw message
kernel/trace/trace_nop.c new file +64 -0
64 lines not on this page · raw message
kernel/trace/trace_sched_switch.c +31 -106
137 lines not on this page · raw message
kernel/trace/trace_sched_wakeup.c +44 -104
148 lines not on this page · raw message
kernel/trace/trace_selftest.c +29 -54
83 lines not on this page · raw message
kernel/trace/trace_stack.c new file +310 -0
310 lines not on this page · raw message
kernel/tracepoint.c new file +477 -0
477 lines not on this page · raw message
samples/tracepoints/tp-samples-trace.h new file +13 -0
Lines of this file are not shown. View the raw message.
samples/tracepoints/tracepoint-probe-sample.c new file +55 -0
55 lines not on this page · raw message
samples/tracepoints/tracepoint-probe-sample2.c new file +42 -0
42 lines not on this page · raw message
samples/tracepoints/tracepoint-sample.c new file +53 -0
53 lines not on this page · raw message
scripts/bootgraph.pl new file +149 -0
149 lines not on this page · raw message
scripts/recordmcount.pl new file +395 -0
395 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.