Skip to content

Commit

Permalink
Merge commit 'tip/tracing/core' into oprofile/core
Browse files Browse the repository at this point in the history
Conflicts:
	drivers/oprofile/cpu_buffer.c

Signed-off-by: Robert Richter <[email protected]>
  • Loading branch information
Robert Richter committed Apr 23, 2010
2 parents cb6e943 + c1ab9ca commit b971f06
Show file tree
Hide file tree
Showing 13 changed files with 186 additions and 80 deletions.
2 changes: 1 addition & 1 deletion drivers/oprofile/cpu_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ int op_cpu_buffer_write_commit(struct op_entry *entry)
struct op_sample *op_cpu_buffer_read_entry(struct op_entry *entry, int cpu)
{
struct ring_buffer_event *e;
e = ring_buffer_consume(op_ring_buffer, cpu, NULL);
e = ring_buffer_consume(op_ring_buffer, cpu, NULL, NULL);
if (!e)
return NULL;

Expand Down
1 change: 1 addition & 0 deletions include/linux/ftrace_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions include/linux/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand All @@ -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;

Expand Down
6 changes: 4 additions & 2 deletions include/linux/ring_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 11 additions & 7 deletions include/trace/events/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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);
),

Expand All @@ -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,

Expand Down
52 changes: 22 additions & 30 deletions include/trace/events/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,7 @@ TRACE_EVENT(signal_deliver,
__entry->sa_handler, __entry->sa_flags)
);

/**
* signal_overflow_fail - called when signal queue is overflow
* @sig: signal number
* @group: signal to process group or not (bool)
* @info: pointer to struct siginfo
*
* Kernel fails to generate 'sig' signal with 'info' siginfo, because
* siginfo queue is overflow, and the signal is dropped.
* 'group' is not 0 if the signal will be sent to a process group.
* 'sig' is always one of RT signals.
*/
TRACE_EVENT(signal_overflow_fail,
DECLARE_EVENT_CLASS(signal_queue_overflow,

TP_PROTO(int sig, int group, struct siginfo *info),

Expand All @@ -134,6 +123,24 @@ TRACE_EVENT(signal_overflow_fail,
__entry->sig, __entry->group, __entry->errno, __entry->code)
);

/**
* signal_overflow_fail - called when signal queue is overflow
* @sig: signal number
* @group: signal to process group or not (bool)
* @info: pointer to struct siginfo
*
* Kernel fails to generate 'sig' signal with 'info' siginfo, because
* siginfo queue is overflow, and the signal is dropped.
* 'group' is not 0 if the signal will be sent to a process group.
* 'sig' is always one of RT signals.
*/
DEFINE_EVENT(signal_queue_overflow, signal_overflow_fail,

TP_PROTO(int sig, int group, struct siginfo *info),

TP_ARGS(sig, group, info)
);

/**
* signal_lose_info - called when siginfo is lost
* @sig: signal number
Expand All @@ -145,28 +152,13 @@ TRACE_EVENT(signal_overflow_fail,
* 'group' is not 0 if the signal will be sent to a process group.
* 'sig' is always one of non-RT signals.
*/
TRACE_EVENT(signal_lose_info,
DEFINE_EVENT(signal_queue_overflow, signal_lose_info,

TP_PROTO(int sig, int group, struct siginfo *info),

TP_ARGS(sig, group, info),

TP_STRUCT__entry(
__field( int, sig )
__field( int, group )
__field( int, errno )
__field( int, code )
),

TP_fast_assign(
__entry->sig = sig;
__entry->group = group;
TP_STORE_SIGINFO(__entry, info);
),

TP_printk("sig=%d group=%d errno=%d code=%d",
__entry->sig, __entry->group, __entry->errno, __entry->code)
TP_ARGS(sig, group, info)
);

#endif /* _TRACE_SIGNAL_H */

/* This part must be outside protection */
Expand Down
33 changes: 19 additions & 14 deletions include/trace/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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> = {
Expand All @@ -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>,
* }
*
*/
Expand Down Expand Up @@ -569,7 +575,6 @@ ftrace_raw_event_id_##call(struct ftrace_event_call *event_call, \
return; \
entry = ring_buffer_event_data(event); \
\
\
tstruct \
\
{ assign; } \
Expand Down
8 changes: 4 additions & 4 deletions kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
#define CREATE_TRACE_POINTS
#include <trace/events/module.h>

EXPORT_TRACEPOINT_SYMBOL(module_get);

#if 0
#define DEBUGP printk
#else
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit b971f06

Please sign in to comment.