OProfile changes for v2.6.35
Subsystems (5)
Linus,
Please pull the latest oprofile-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git oprofile-for-linus
Thanks,
Ingo
------------------>
Andi Kleen (1):
oprofile: remove double ring buffering
Li Zefan (3):
tracing: Convert some signal events to DEFINE_TRACE
tracing: Update comments
tracing: Remove side effect from module tracepoints that caused a GPF
Martin Schwidefsky (1):
oprofile: convert oprofile from timer_hook to hrtimer
Phil Carmody (1):
oprofile: protect from not being in an IRQ context
Robert Richter (14):
oprofile: update file list in MAINTAINERS file oprofile/x86: rework error handler in nmi_setup() oprofile/x86: reserve counter msrs pairwise oprofile/x86: moving shutdown functions
oprofile/x86: return -EBUSY if counters are already reserved oprofile/x86: move IBS code
oprofile/x86: remove duplicate IBS capability check oprofile/x86: fix uninitialized counter usage during cpu hotplug oprofile/x86: remove CONFIG_SMP macros
oprofile/x86: protect cpu hotplug sections oprofile/x86: stop disabled counters in nmi handler oprofile/x86: reordering some functions
oprofile/x86: notify cpus only when daemon is running oprofile/x86: make AMD IBS hotplug capable
Steven Rostedt (4):
tracing: Fix compile error in module tracepoints when MODULE_UNLOAD not set
ring-buffer: Add place holder recording of dropped events
tracing: Show the lost events in the trace_pipe output
ring-buffer: Add lost event count to end of sub buffer
MAINTAINERS | 1 + arch/x86/oprofile/nmi_int.c | 199 +++++++++++++++--------- arch/x86/oprofile/op_model_amd.c | 280 +++++++++++++++------------------ arch/x86/oprofile/op_model_p4.c | 52 ++++--- arch/x86/oprofile/op_model_ppro.c | 77 +++++----- arch/x86/oprofile/op_x86_model.h | 4 +- drivers/oprofile/cpu_buffer.c | 75 +++------- drivers/oprofile/oprof.c | 12 +- drivers/oprofile/oprof.h | 3 +- drivers/oprofile/timer_int.c | 78 +++++++++- include/linux/ftrace_event.h | 1 + include/linux/module.h | 6 +- include/linux/ring_buffer.h | 6 +- include/trace/events/module.h | 18 ++- include/trace/events/signal.h | 52 +++---- include/trace/ftrace.h | 33 +++-- kernel/module.c | 8 +- kernel/trace/ring_buffer.c | 101 ++++++++++++- kernel/trace/ring_buffer_benchmark.c | 2 +- kernel/trace/trace.c | 30 +++- kernel/trace/trace_functions_graph.c | 5 +- kernel/trace/trace_selftest.c | 2 +- 22 files changed, 609 insertions(+), 436 deletions(-)
MAINTAINERS +1 -0
@@ -4165,6 +4165,7 @@ OPROFILE M: Robert Richter <[email protected]> L: [email protected] S: Maintained +F: arch/*/include/asm/oprofile*.h F: arch/*/oprofile/ F: drivers/oprofile/ F: include/linux/oprofile.h
arch/x86/oprofile/nmi_int.c +123 -76
308 lines not on this page · raw message
arch/x86/oprofile/op_model_amd.c +127 -153
353 lines not on this page · raw message
arch/x86/oprofile/op_model_p4.c +31 -21
71 lines not on this page · raw message
arch/x86/oprofile/op_model_ppro.c +38 -39
108 lines not on this page · raw message
arch/x86/oprofile/op_x86_model.h +2 -2
@@ -40,10 +40,10 @@ struct op_x86_model_spec {u64 reserved;u16 event_mask;int (*init)(struct oprofile_operations *ops); -void (*exit)(void ); -void (*fill_in_addresses)(struct op_msrs *const msrs); +int (*fill_in_addresses)(struct op_msrs *const msrs);void (*setup_ctrs)(struct op_x86_model_spec const *model,struct op_msrs const *const msrs); +void (*cpu_down)(void );int (*check_ctrs)(struct pt_regs *const regs,struct op_msrs const *const msrs);void (*start)(struct op_msrs const *const msrs);
drivers/oprofile/cpu_buffer.c +23 -52
126 lines not on this page · raw message
drivers/oprofile/oprof.c +8 -4
@@ -253,22 +253,26 @@ static int __init oprofile_init(void)int err; err =oprofile_arch_init (&oprofile_ops); -if (err <0 || timer) {printk (KERN_INFO "oprofile: using timer interrupt.\n" ); -oprofile_timer_init (&oprofile_ops); + err =oprofile_timer_init (&oprofile_ops); +if (err) + goto out_arch; } - err =oprofilefs_register ();if (err) -oprofile_arch_exit (); + goto out_arch; +return 0 ; +out_arch: +oprofile_arch_exit ();return err; } static void __exit oprofile_exit(void) { +oprofile_timer_exit ();oprofilefs_unregister ();oprofile_arch_exit (); }
drivers/oprofile/oprof.h +2 -1
@@ -34,7 +34,8 @@ struct super_block;struct dentry ;void oprofile_create_files (struct super_block *sb,struct dentry *root); -void oprofile_timer_init (struct oprofile_operations *ops); +int oprofile_timer_init (struct oprofile_operations *ops); +void oprofile_timer_exit (void );int oprofile_set_backtrace (unsigned long depth);int oprofile_set_timeout (unsigned long time);
drivers/oprofile/timer_int.c +69 -9
103 lines not on this page · raw message
include/linux/ftrace_event.h +1 -0
@@ -58,6 +58,7 @@ struct trace_iterator {/* The below is zeroed out in pipe_read */ struct trace_seq seq;struct trace_entry *ent; +unsigned long lost_events;int leftover;int cpu;u64 ts;
include/linux/module.h +2 -4
@@ -465,8 +465,7 @@ static inline void __module_get(struct module *module)if (module) {preempt_disable ();__this_cpu_inc (module->refptr->incs); -trace_module_get (module, _THIS_IP_, -__this_cpu_read (module->refptr->incs)); +trace_module_get (module, _THIS_IP_);preempt_enable (); } }
@@ -480,8 +479,7 @@ static inline int try_module_get(struct module *module)if (likely (module_is_live (module))) {__this_cpu_inc (module->refptr->incs); -trace_module_get (module, _THIS_IP_, -__this_cpu_read (module->refptr->incs)); +trace_module_get (module, _THIS_IP_); }else ret =0 ;
include/linux/ring_buffer.h +4 -2
@@ -120,9 +120,11 @@ int ring_buffer_write(struct ring_buffer *buffer, unsigned long length, void *data);struct ring_buffer_event * -ring_buffer_peek (struct ring_buffer *buffer,int cpu,u64 *ts); +ring_buffer_peek (struct ring_buffer *buffer,int cpu,u64 *ts, +unsigned long *lost_events);struct ring_buffer_event * -ring_buffer_consume (struct ring_buffer *buffer,int cpu,u64 *ts); +ring_buffer_consume (struct ring_buffer *buffer,int cpu,u64 *ts, +unsigned long *lost_events);struct ring_buffer_iter *ring_buffer_read_start (struct ring_buffer *buffer,int cpu);
include/trace/events/module.h +11 -7
@@ -51,11 +51,14 @@ TRACE_EVENT(module_free,TP_printk ("%s" ,__get_str (name)) ); +#ifdef CONFIG_MODULE_UNLOAD +/* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */ + DECLARE_EVENT_CLASS(module_refcnt, - TP_PROTO(struct module *mod, unsigned long ip, int refcnt), + TP_PROTO(struct module *mod, unsigned long ip), - TP_ARGS(mod, ip, refcnt), + TP_ARGS(mod, ip), TP_STRUCT__entry( __field( unsigned long, ip )
@@ -65,7 +68,7 @@ DECLARE_EVENT_CLASS(module_refcnt,TP_fast_assign ( __entry->ip = ip; - __entry->refcnt = refcnt; + __entry->refcnt =__this_cpu_read (mod->refptr->incs) +__this_cpu_read (mod->refptr->decs);__assign_str (name, mod->name); ),
@@ -75,17 +78,18 @@ DECLARE_EVENT_CLASS(module_refcnt,DEFINE_EVENT (module_refcnt, module_get, - TP_PROTO(struct module *mod, unsigned long ip, int refcnt), + TP_PROTO(struct module *mod, unsigned long ip), -TP_ARGS (mod, ip, refcnt) +TP_ARGS (mod, ip) );DEFINE_EVENT (module_refcnt, module_put, - TP_PROTO(struct module *mod, unsigned long ip, int refcnt), + TP_PROTO(struct module *mod, unsigned long ip), -TP_ARGS (mod, ip, refcnt) +TP_ARGS (mod, ip) ); +#endif /* CONFIG_MODULE_UNLOAD */ TRACE_EVENT(module_request,
include/trace/events/signal.h +22 -30
74 lines not on this page · raw message
include/trace/ftrace.h +19 -14
@@ -154,9 +154,11 @@* * field = (typeof(field))entry; * -* p = get_cpu_var(ftrace_event_seq); +* p = &get_cpu_var(ftrace_event_seq); * trace_seq_init(p); -* ret = trace_seq_printf(s, <TP_printk> "\n"); +* ret = trace_seq_printf(s, "%s: ", <call>); +* if (ret) +* ret = trace_seq_printf(s, <TP_printk> "\n"); * put_cpu(); * if (!ret) * return TRACE_TYPE_PARTIAL_LINE;
@@ -450,38 +452,38 @@ perf_trace_disable_##name(struct ftrace_event_call *unused) \* * static void ftrace_raw_event_<call>(proto) * { +* struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; * struct ring_buffer_event *event; * struct ftrace_raw_<call> *entry; <-- defined in stage 1 * struct ring_buffer *buffer; * unsigned long irq_flags; +* int __data_size; * int pc; * * local_save_flags(irq_flags); * pc = preempt_count(); * +* __data_size = ftrace_get_offsets_<call>(&__data_offsets, args); +* * event = trace_current_buffer_lock_reserve(&buffer, * event_<call>.id, -* sizeof(struct ftrace_raw_<call>), +* sizeof(*entry) + __data_size, * irq_flags, pc); * if (!event) * return; * entry = ring_buffer_event_data(event); * -* <assign>; <-- Here we assign the entries by the __field and -* __array macros. +* { <assign>; } <-- Here we assign the entries by the __field and +* __array macros. * -* trace_current_buffer_unlock_commit(buffer, event, irq_flags, pc); +* if (!filter_current_check_discard(buffer, event_call, entry, event)) +* trace_current_buffer_unlock_commit(buffer, +* event, irq_flags, pc); * } * * static int ftrace_raw_reg_event_<call>(struct ftrace_event_call *unused) * { -* int ret; -* -* ret = register_trace_<call>(ftrace_raw_event_<call>); -* if (!ret) -* pr_info("event trace: Could not activate trace point " -* "probe to <call>"); -* return ret; +* return register_trace_<call>(ftrace_raw_event_<call>); * } * * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused)
@@ -493,6 +495,8 @@ perf_trace_disable_##name(struct ftrace_event_call *unused) \* .trace = ftrace_raw_output_<call>, <-- stage 2 * }; * +* static const char print_fmt_<call>[] = <TP_printk>; +* * static struct ftrace_event_call __used * __attribute__((__aligned__(4))) * __attribute__((section("_ftrace_events"))) event_<call> = {
@@ -501,6 +505,8 @@ perf_trace_disable_##name(struct ftrace_event_call *unused) \* .raw_init = trace_event_raw_init, * .regfunc = ftrace_reg_event_<call>, * .unregfunc = ftrace_unreg_event_<call>, +* .print_fmt = print_fmt_<call>, +* .define_fields = ftrace_define_fields_<call>, * } * */
@@ -569,7 +575,6 @@ ftrace_raw_event_id_##call(struct ftrace_event_call *event_call, \return ; \ entry =ring_buffer_event_data (event); \ \ - \ tstruct \ \ { assign; } \
kernel/module.c +4 -4
@@ -59,8 +59,6 @@#define CREATE_TRACE_POINTS #include <trace/events/module.h> -EXPORT_TRACEPOINT_SYMBOL (module_get); -#if 0 #define DEBUGP printk#else
@@ -515,6 +513,9 @@ MODINFO_ATTR(srcversion);static char last_unloaded_module[MODULE_NAME_LEN +1 ];#ifdef CONFIG_MODULE_UNLOAD + +EXPORT_TRACEPOINT_SYMBOL (module_get); +/* Init the unload section of the module. */ static void module_unload_init (struct module *mod) {
@@ -867,8 +868,7 @@ void module_put(struct module *module)smp_wmb ();/* see comment in module_refcount */ __this_cpu_inc (module->refptr->decs); -trace_module_put (module, _RET_IP_, -__this_cpu_read (module->refptr->decs)); +trace_module_put (module, _RET_IP_);/* Maybe they're waiting for us to drop reference? */ if (unlikely (!module_is_live (module)))wake_up_process (module->waiter);
kernel/trace/ring_buffer.c +95 -6
231 lines not on this page · raw message
kernel/trace/ring_buffer_benchmark.c +1 -1
@@ -81,7 +81,7 @@ static enum event_status read_event(int cpu)int *entry;u64 ts; - event =ring_buffer_consume (buffer, cpu, &ts); + event =ring_buffer_consume (buffer, cpu, &ts,NULL );if (!event)return EVENT_DROPPED ;
kernel/trace/trace.c +22 -8
@@ -1545,7 +1545,8 @@ static void trace_iterator_increment(struct trace_iterator *iter) }static struct trace_entry * -peek_next_entry (struct trace_iterator *iter,int cpu,u64 *ts) +peek_next_entry (struct trace_iterator *iter,int cpu,u64 *ts, +unsigned long *lost_events) {struct ring_buffer_event *event;struct ring_buffer_iter *buf_iter = iter->buffer_iter[cpu];
@@ -1556,7 +1557,8 @@ peek_next_entry(struct trace_iterator *iter, int cpu, u64 *ts)if (buf_iter) event =ring_buffer_iter_peek (buf_iter, ts);else - event =ring_buffer_peek (iter->tr->buffer, cpu, ts); + event =ring_buffer_peek (iter->tr->buffer, cpu, ts, + lost_events);ftrace_enable_cpu ();
@@ -1564,10 +1566,12 @@ peek_next_entry(struct trace_iterator *iter, int cpu, u64 *ts) }static struct trace_entry * -__find_next_entry (struct trace_iterator *iter,int *ent_cpu,u64 *ent_ts) +__find_next_entry (struct trace_iterator *iter,int *ent_cpu, +unsigned long *missing_events,u64 *ent_ts) {struct ring_buffer *buffer = iter->tr->buffer;struct trace_entry *ent, *next =NULL ; +unsigned long lost_events, next_lost =0 ;int cpu_file = iter->cpu_file;u64 next_ts =0 , ts;int next_cpu =-1 ;
@@ -1580,7 +1584,7 @@ __find_next_entry(struct trace_iterator *iter, int *ent_cpu, u64 *ent_ts)if (cpu_file >TRACE_PIPE_ALL_CPU ) {if (ring_buffer_empty_cpu (buffer, cpu_file))return NULL ; - ent =peek_next_entry (iter, cpu_file, ent_ts); + ent =peek_next_entry (iter, cpu_file, ent_ts, missing_events);if (ent_cpu) *ent_cpu = cpu_file;
@@ -1592,7 +1596,7 @@ __find_next_entry(struct trace_iterator *iter, int *ent_cpu, u64 *ent_ts)if (ring_buffer_empty_cpu (buffer, cpu))continue ; - ent =peek_next_entry (iter, cpu, &ts); + ent =peek_next_entry (iter, cpu, &ts, &lost_events);/* * Pick the entry with the smallest timestamp:
@@ -1601,6 +1605,7 @@ __find_next_entry(struct trace_iterator *iter, int *ent_cpu, u64 *ent_ts) next = ent; next_cpu = cpu; next_ts = ts; + next_lost = lost_events; } }
@@ -1610,6 +1615,9 @@ __find_next_entry(struct trace_iterator *iter, int *ent_cpu, u64 *ent_ts)if (ent_ts) *ent_ts = next_ts; +if (missing_events) + *missing_events = next_lost; +return next; }
@@ -1617,13 +1625,14 @@ __find_next_entry(struct trace_iterator *iter, int *ent_cpu, u64 *ent_ts)struct trace_entry *trace_find_next_entry (struct trace_iterator *iter,int *ent_cpu,u64 *ent_ts) { -return __find_next_entry (iter, ent_cpu, ent_ts); +return __find_next_entry (iter, ent_cpu,NULL , ent_ts); }/* Find the next real entry, and increment the iterator to the next entry */ static void *find_next_entry_inc (struct trace_iterator *iter) { - iter->ent =__find_next_entry (iter, &iter->cpu, &iter->ts); + iter->ent =__find_next_entry (iter, &iter->cpu, + &iter->lost_events, &iter->ts);if (iter->ent)trace_iterator_increment (iter);
@@ -1635,7 +1644,8 @@ static void trace_consume(struct trace_iterator *iter) {/* Don't allow ftrace to trace into the ring buffers */ ftrace_disable_cpu (); -ring_buffer_consume (iter->tr->buffer, iter->cpu, &iter->ts); +ring_buffer_consume (iter->tr->buffer, iter->cpu, &iter->ts, + &iter->lost_events);ftrace_enable_cpu (); }
@@ -2030,6 +2040,10 @@ static enum print_line_t print_trace_line(struct trace_iterator *iter) {enum print_line_t ret; +if (iter->lost_events) +trace_seq_printf (&iter->seq,"CPU:%d [LOST %lu EVENTS]\n" , + iter->cpu, iter->lost_events); +if (iter->trace && iter->trace->print_line) { ret = iter->trace->print_line (iter);if (ret !=TRACE_TYPE_UNHANDLED )
kernel/trace/trace_functions_graph.c +3 -2
@@ -490,9 +490,10 @@ get_return_for_leaf(struct trace_iterator *iter,* We need to consume the current entry to see * the next one. */ -ring_buffer_consume (iter->tr->buffer, iter->cpu,NULL ); +ring_buffer_consume (iter->tr->buffer, iter->cpu, +NULL ,NULL ); event =ring_buffer_peek (iter->tr->buffer, iter->cpu, -NULL ); +NULL ,NULL ); }if (!event)
kernel/trace/trace_selftest.c +1 -1
@@ -30,7 +30,7 @@ static int trace_test_buffer_cpu(struct trace_array *tr, int cpu)struct trace_entry *entry;unsigned int loops =0 ; -while ((event =ring_buffer_consume (tr->buffer, cpu,NULL ))) { +while ((event =ring_buffer_consume (tr->buffer, cpu,NULL ,NULL ))) { entry =ring_buffer_event_data (event);/*