tracing: updates for 3.5
Subsystems (4)
Steven Rostedt
maintainerIngo, Peter,
This is the same as the last patch pull request, with the exception that I added the Acked-by from Masami in the change log of patch 4. The patches are the same.
-- Steve
Please pull the latest tip/perf/core-3 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
tip/perf/core-3
Head SHA1: 4a6d70c9505fef1d8906b1d61db3de5d8ecf9454
Dan Carpenter (1):
tracing: Remove an unneeded check in trace_seq_buffer()
Steven Rostedt (3):
tracing: Add percpu buffers for trace_printk() ftrace/x86: Have arch x86_64 use breakpoints instead of stop machine ftrace/x86: Remove the complex ftrace NMI handling code
Vaibhav Nagarnaik (1):
ring-buffer: Add per_cpu ring buffer control files
----
arch/x86/Kconfig | 1 - arch/x86/include/asm/ftrace.h | 3 + arch/x86/kernel/ftrace.c | 511 +++++++++++++++++++++++++++-------------- arch/x86/kernel/nmi.c | 10 +- arch/x86/kernel/traps.c | 8 +- include/linux/ftrace.h | 6 + include/linux/kernel.h | 13 +- include/linux/ring_buffer.h | 6 +- kernel/trace/ring_buffer.c | 248 +++++++++++--------- kernel/trace/trace.c | 379 ++++++++++++++++++++++-------- kernel/trace/trace.h | 4 +- kernel/trace/trace_printk.c | 4 + 12 files changed, 810 insertions(+), 383 deletions(-)
---------------------------
arch/x86/Kconfig +0 -1
@@ -40,7 +40,6 @@ config X86 select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_GRAPH_FP_TEST select HAVE_FUNCTION_TRACE_MCOUNT_TEST - select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE select HAVE_SYSCALL_TRACEPOINTS select HAVE_KVM select HAVE_ARCH_KGDB
arch/x86/include/asm/ftrace.h +3 -0
@@ -34,6 +34,7 @@#ifndef __ASSEMBLY__extern void mcount (void ); +extern int modifying_ftrace_code;static inline unsigned long ftrace_call_adjust (unsigned long addr) {
@@ -50,6 +51,8 @@ struct dyn_arch_ftrace {/* No extra data needed for x86 */ }; +int ftrace_int3_handler (struct pt_regs *regs); +#endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_TRACER */
arch/x86/kernel/ftrace.c +343 -168
553 lines not on this page · raw message
arch/x86/kernel/nmi.c +5 -5
@@ -84,7 +84,7 @@ __setup("unknown_nmi_panic", setup_unknown_nmi_panic);#define nmi_to_desc (type) (&nmi_desc[type]) -static int notrace __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2b) +static int __kprobes nmi_handle (unsigned int type,struct pt_regs *regs,bool b2b) {struct nmi_desc *desc =nmi_to_desc (type);struct nmiaction *a;
@@ -209,7 +209,7 @@ void unregister_nmi_handler(unsigned int type, const char *name)EXPORT_SYMBOL_GPL (unregister_nmi_handler); -static notrace __kprobes void +static __kprobes void pci_serr_error (unsigned char reason,struct pt_regs *regs) { pr_emerg("NMI: PCI system error (SERR) for reason %02x on CPU %d.\n",
@@ -236,7 +236,7 @@ pci_serr_error(unsigned char reason, struct pt_regs *regs)outb (reason,NMI_REASON_PORT ); } -static notrace __kprobes void +static __kprobes void io_check_error (unsigned char reason,struct pt_regs *regs) {unsigned long i;
@@ -263,7 +263,7 @@ io_check_error(unsigned char reason, struct pt_regs *regs)outb (reason,NMI_REASON_PORT ); } -static notrace __kprobes void +static __kprobes void unknown_nmi_error (unsigned char reason,struct pt_regs *regs) {int handled;
@@ -305,7 +305,7 @@ unknown_nmi_error(unsigned char reason, struct pt_regs *regs) static DEFINE_PER_CPU(bool, swallow_nmi); static DEFINE_PER_CPU(unsigned long, last_nmi_rip); -static notrace __kprobes void default_do_nmi(struct pt_regs *regs) +static __kprobes void default_do_nmi (struct pt_regs *regs) {unsigned char reason =0 ;int handled;
arch/x86/kernel/traps.c +7 -1
@@ -50,6 +50,7 @@#include <asm/processor.h> #include <asm/debugreg.h> #include <linux/atomic.h> +#include <asm/ftrace.h> #include <asm/traps.h> #include <asm/desc.h> #include <asm/i387.h>
@@ -303,8 +304,13 @@ gp_in_kernel: }/* May run on IST stack. */ -dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) +dotraplinkage void __kprobes notrace do_int3(struct pt_regs *regs, long error_code) { +#ifdef CONFIG_DYNAMIC_FTRACE +/* ftrace must be first, everything else may cause a recursive crash */ +if (unlikely (modifying_ftrace_code) &&ftrace_int3_handler (regs)) +return ; +#endif #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP if (kgdb_ll_trap (DIE_INT3 ,"int3" , regs, error_code,X86_TRAP_BP ,SIGTRAP ) ==NOTIFY_STOP )
include/linux/ftrace.h +6 -0
@@ -286,6 +286,12 @@ struct ftrace_rec_iter *ftrace_rec_iter_start(void);struct ftrace_rec_iter *ftrace_rec_iter_next (struct ftrace_rec_iter *iter);struct dyn_ftrace *ftrace_rec_iter_record (struct ftrace_rec_iter *iter); +#define for_ftrace_rec_iter (iter) \ + for (iter = ftrace_rec_iter_start(); \ + iter; \ + iter = ftrace_rec_iter_next(iter)) + +int ftrace_update_record (struct dyn_ftrace *rec,int enable);int ftrace_test_record (struct dyn_ftrace *rec,int enable);void ftrace_run_stop_machine (int command);
include/linux/kernel.h +7 -6
@@ -480,15 +480,16 @@ do { \ #define trace_printk(fmt, args...) \ do { \ + static const char *trace_printk_fmt \ + __attribute__((section("__trace_printk_fmt"))) = \ + __builtin_constant_p(fmt) ? fmt : NULL; \ + \ __trace_printk_check_format(fmt, ##args); \ - if (__builtin_constant_p(fmt)) { \ - static const char *trace_printk_fmt \ - __attribute__((section("__trace_printk_fmt"))) = \ - __builtin_constant_p(fmt) ? fmt : NULL; \ \ + if (__builtin_constant_p(fmt)) \ __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \ - } else \ - __trace_printk(_THIS_IP_, fmt, ##args); \ + else \ + __trace_printk(_THIS_IP_, fmt, ##args); \ } while (0) extern __printf(2, 3)
include/linux/ring_buffer.h +4 -2
@@ -96,9 +96,11 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k__ring_buffer_alloc ((size), (flags), &__key); \ }) +#define RING_BUFFER_ALL_CPUS -1 +void ring_buffer_free (struct ring_buffer *buffer); -int ring_buffer_resize (struct ring_buffer *buffer,unsigned long size); +int ring_buffer_resize (struct ring_buffer *buffer,unsigned long size,int cpu);void ring_buffer_change_overwrite (struct ring_buffer *buffer,int val);
@@ -129,7 +131,7 @@ ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts);void ring_buffer_iter_reset (struct ring_buffer_iter *iter);int ring_buffer_iter_empty (struct ring_buffer_iter *iter); -unsigned long ring_buffer_size (struct ring_buffer *buffer); +unsigned long ring_buffer_size (struct ring_buffer *buffer,int cpu);void ring_buffer_reset_cpu (struct ring_buffer *buffer,int cpu);void ring_buffer_reset (struct ring_buffer *buffer);
kernel/trace/ring_buffer.c +140 -108
421 lines not on this page · raw message
kernel/trace/trace.c +288 -91
633 lines not on this page · raw message
kernel/trace/trace.h +3 -1
@@ -131,6 +131,7 @@ struct trace_array_cpu {atomic_t disabled;void *buffer_page;/* ring buffer spare */ +unsigned long entries;unsigned long saved_latency;unsigned long critical_start;unsigned long critical_end;
@@ -152,7 +153,6 @@ struct trace_array_cpu {*/ struct trace_array {struct ring_buffer *buffer; -unsigned long entries;int cpu;int buffer_disabled;cycle_t time_start;
@@ -826,6 +826,8 @@ extern struct list_head ftrace_events;extern const char *__start___trace_bprintk_fmt[];extern const char *__stop___trace_bprintk_fmt[]; +void trace_printk_init_buffers (void ); +#undef FTRACE_ENTRY#define FTRACE_ENTRY (call, struct_name, id, tstruct, print, filter) \ extern struct ftrace_event_call \
kernel/trace/trace_printk.c +4 -0
@@ -51,6 +51,10 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)const char **iter;char *fmt; +/* allocate the trace_printk per cpu buffers */ +if (start != end) +trace_printk_init_buffers (); +mutex_lock (&btrace_mutex);for (iter = start; iter < end; iter++) {struct trace_bprintk_fmt *tb_fmt =lookup_format (*iter);