Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234531
b: refs/heads/master
c: b9a46bb
h: refs/heads/master
i:
  234529: cfb50a4
  234527: af17e16
v: v3
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Mar 10, 2011
1 parent 008cc42 commit 5490749
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 113 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a0b1665db09cf2da9ad7d0f12da386373c10bfa
refs/heads/master: b9a46bba88001504235459c8410f17e6a7e38008
5 changes: 0 additions & 5 deletions trunk/Documentation/trace/ftrace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,6 @@ x494] <- /root/a.out[+0x4a8] <- /lib/libc-2.7.so[+0x1e1a6]
latencies, as described in "Latency
trace format".

overwrite - This controls what happens when the trace buffer is
full. If "1" (default), the oldest events are
discarded and overwritten. If "0", then the newest
events are discarded.

ftrace_enabled
--------------

Expand Down
15 changes: 7 additions & 8 deletions trunk/arch/x86/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,19 +437,18 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
return;
}

trace.func = self_addr;
trace.depth = current->curr_ret_stack + 1;

/* Only trace if the calling function expects to */
if (!ftrace_graph_entry(&trace)) {
if (ftrace_push_return_trace(old, self_addr, &trace.depth,
frame_pointer) == -EBUSY) {
*parent = old;
return;
}

if (ftrace_push_return_trace(old, self_addr, &trace.depth,
frame_pointer) == -EBUSY) {
trace.func = self_addr;

/* Only trace if the calling function expects to */
if (!ftrace_graph_entry(&trace)) {
current->curr_ret_stack--;
*parent = old;
return;
}
}
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
8 changes: 4 additions & 4 deletions trunk/arch/x86/kvm/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ TRACE_EVENT(kvm_hv_hypercall,
TP_ARGS(code, fast, rep_cnt, rep_idx, ingpa, outgpa),

TP_STRUCT__entry(
__field( __u16, code )
__field( bool, fast )
__field( __u16, rep_cnt )
__field( __u16, rep_idx )
__field( __u64, ingpa )
__field( __u64, outgpa )
__field( __u16, code )
__field( bool, fast )
),

TP_fast_assign(
__entry->code = code;
__entry->fast = fast;
__entry->rep_cnt = rep_cnt;
__entry->rep_idx = rep_idx;
__entry->ingpa = ingpa;
__entry->outgpa = outgpa;
__entry->code = code;
__entry->fast = fast;
),

TP_printk("code 0x%x %s cnt 0x%x idx 0x%x in 0x%llx out 0x%llx",
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/ftrace_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct trace_entry {
unsigned char flags;
unsigned char preempt_count;
int pid;
int lock_depth;
};

#define FTRACE_MAX_EVENT \
Expand Down
2 changes: 0 additions & 2 deletions trunk/include/linux/ring_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ void ring_buffer_free(struct ring_buffer *buffer);

int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size);

void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val);

struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer,
unsigned long length);
int ring_buffer_unlock_commit(struct ring_buffer *buffer,
Expand Down
8 changes: 4 additions & 4 deletions trunk/include/trace/events/mce.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,36 @@ TRACE_EVENT(mce_record,
TP_STRUCT__entry(
__field( u64, mcgcap )
__field( u64, mcgstatus )
__field( u8, bank )
__field( u64, status )
__field( u64, addr )
__field( u64, misc )
__field( u64, ip )
__field( u8, cs )
__field( u64, tsc )
__field( u64, walltime )
__field( u32, cpu )
__field( u32, cpuid )
__field( u32, apicid )
__field( u32, socketid )
__field( u8, cs )
__field( u8, bank )
__field( u8, cpuvendor )
),

TP_fast_assign(
__entry->mcgcap = m->mcgcap;
__entry->mcgstatus = m->mcgstatus;
__entry->bank = m->bank;
__entry->status = m->status;
__entry->addr = m->addr;
__entry->misc = m->misc;
__entry->ip = m->ip;
__entry->cs = m->cs;
__entry->tsc = m->tsc;
__entry->walltime = m->time;
__entry->cpu = m->extcpu;
__entry->cpuid = m->cpuid;
__entry->apicid = m->apicid;
__entry->socketid = m->socketid;
__entry->cs = m->cs;
__entry->bank = m->bank;
__entry->cpuvendor = m->cpuvendor;
),

Expand Down
5 changes: 3 additions & 2 deletions trunk/include/trace/events/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ TRACE_EVENT(module_request,
TP_ARGS(name, wait, ip),

TP_STRUCT__entry(
__field( unsigned long, ip )
__field( bool, wait )
__field( unsigned long, ip )
__string( name, name )
),

TP_fast_assign(
__entry->ip = ip;
__entry->wait = wait;
__entry->ip = ip;
__assign_str(name, name);
),

Expand All @@ -129,3 +129,4 @@ TRACE_EVENT(module_request,

/* This part must be outside protection */
#include <trace/define_trace.h>

4 changes: 2 additions & 2 deletions trunk/include/trace/events/skb.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ TRACE_EVENT(kfree_skb,

TP_STRUCT__entry(
__field( void *, skbaddr )
__field( void *, location )
__field( unsigned short, protocol )
__field( void *, location )
),

TP_fast_assign(
__entry->skbaddr = skb;
__entry->location = location;
__entry->protocol = ntohs(skb->protocol);
__entry->location = location;
),

TP_printk("skbaddr=%p protocol=%u location=%p",
Expand Down
24 changes: 3 additions & 21 deletions trunk/kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
#include <linux/ring_buffer.h>
#include <linux/trace_clock.h>
#include <linux/ftrace_irq.h>
#include <linux/spinlock.h>
#include <linux/debugfs.h>
#include <linux/uaccess.h>
Expand Down Expand Up @@ -1428,17 +1429,6 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size)
}
EXPORT_SYMBOL_GPL(ring_buffer_resize);

void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val)
{
mutex_lock(&buffer->mutex);
if (val)
buffer->flags |= RB_FL_OVERWRITE;
else
buffer->flags &= ~RB_FL_OVERWRITE;
mutex_unlock(&buffer->mutex);
}
EXPORT_SYMBOL_GPL(ring_buffer_change_overwrite);

static inline void *
__rb_data_page_index(struct buffer_data_page *bpage, unsigned index)
{
Expand Down Expand Up @@ -2172,19 +2162,11 @@ rb_reserve_next_event(struct ring_buffer *buffer,
if (likely(ts >= cpu_buffer->write_stamp)) {
delta = diff;
if (unlikely(test_time_stamp(delta))) {
int local_clock_stable = 1;
#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
local_clock_stable = sched_clock_stable;
#endif
WARN_ONCE(delta > (1ULL << 59),
KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n%s",
KERN_WARNING "Delta way too big! %llu ts=%llu write stamp = %llu\n",
(unsigned long long)delta,
(unsigned long long)ts,
(unsigned long long)cpu_buffer->write_stamp,
local_clock_stable ? "" :
"If you just came from a suspend/resume,\n"
"please switch to the trace global clock:\n"
" echo global > /sys/kernel/debug/tracing/trace_clock\n");
(unsigned long long)cpu_buffer->write_stamp);
add_timestamp = 1;
}
}
Expand Down
34 changes: 11 additions & 23 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#include "trace.h"
#include "trace_output.h"

#define TRACE_BUFFER_FLAGS (RB_FL_OVERWRITE)

/*
* On boot up, the ring buffer is set to the minimum size, so that
* we do not waste memory on systems that are not using tracing.
Expand Down Expand Up @@ -338,7 +340,7 @@ static DECLARE_WAIT_QUEUE_HEAD(trace_wait);
/* trace_flags holds trace_options default values */
unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME |
TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE;
TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD;

static int trace_stop_count;
static DEFINE_SPINLOCK(tracing_start_lock);
Expand Down Expand Up @@ -423,7 +425,6 @@ static const char *trace_options[] = {
"sleep-time",
"graph-time",
"record-cmd",
"overwrite",
NULL
};

Expand Down Expand Up @@ -779,11 +780,6 @@ __acquires(kernel_lock)
tracing_reset_online_cpus(tr);

current_trace = type;

/* If we expanded the buffers, make sure the max is expanded too */
if (ring_buffer_expanded && type->use_max_tr)
ring_buffer_resize(max_tr.buffer, trace_buf_size);

/* the test is responsible for initializing and enabling */
pr_info("Testing tracer %s: ", type->name);
ret = type->selftest(type, tr);
Expand All @@ -796,10 +792,6 @@ __acquires(kernel_lock)
/* Only reset on passing, to avoid touching corrupted buffers */
tracing_reset_online_cpus(tr);

/* Shrink the max buffer again */
if (ring_buffer_expanded && type->use_max_tr)
ring_buffer_resize(max_tr.buffer, 1);

printk(KERN_CONT "PASSED\n");
}
#endif
Expand Down Expand Up @@ -1110,6 +1102,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,

entry->preempt_count = pc & 0xff;
entry->pid = (tsk) ? tsk->pid : 0;
entry->lock_depth = (tsk) ? tsk->lock_depth : 0;
entry->flags =
#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
(irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) |
Expand Down Expand Up @@ -1756,9 +1749,10 @@ static void print_lat_help_header(struct seq_file *m)
seq_puts(m, "# | / _----=> need-resched \n");
seq_puts(m, "# || / _---=> hardirq/softirq \n");
seq_puts(m, "# ||| / _--=> preempt-depth \n");
seq_puts(m, "# |||| / delay \n");
seq_puts(m, "# cmd pid ||||| time | caller \n");
seq_puts(m, "# \\ / ||||| \\ | / \n");
seq_puts(m, "# |||| /_--=> lock-depth \n");
seq_puts(m, "# |||||/ delay \n");
seq_puts(m, "# cmd pid |||||| time | caller \n");
seq_puts(m, "# \\ / |||||| \\ | / \n");
}

static void print_func_help_header(struct seq_file *m)
Expand Down Expand Up @@ -2535,9 +2529,6 @@ static void set_tracer_flags(unsigned int mask, int enabled)

if (mask == TRACE_ITER_RECORD_CMD)
trace_event_enable_cmd_record(enabled);

if (mask == TRACE_ITER_OVERWRITE)
ring_buffer_change_overwrite(global_trace.buffer, enabled);
}

static ssize_t
Expand Down Expand Up @@ -4564,11 +4555,9 @@ void ftrace_dump(enum ftrace_dump_mode oops_dump_mode)
__init static int tracer_alloc_buffers(void)
{
int ring_buf_size;
enum ring_buffer_flags rb_flags;
int i;
int ret = -ENOMEM;


if (!alloc_cpumask_var(&tracing_buffer_mask, GFP_KERNEL))
goto out;

Expand All @@ -4581,13 +4570,12 @@ __init static int tracer_alloc_buffers(void)
else
ring_buf_size = 1;

rb_flags = trace_flags & TRACE_ITER_OVERWRITE ? RB_FL_OVERWRITE : 0;

cpumask_copy(tracing_buffer_mask, cpu_possible_mask);
cpumask_copy(tracing_cpumask, cpu_all_mask);

/* TODO: make the number of buffers hot pluggable with CPUS */
global_trace.buffer = ring_buffer_alloc(ring_buf_size, rb_flags);
global_trace.buffer = ring_buffer_alloc(ring_buf_size,
TRACE_BUFFER_FLAGS);
if (!global_trace.buffer) {
printk(KERN_ERR "tracer: failed to allocate ring buffer!\n");
WARN_ON(1);
Expand All @@ -4597,7 +4585,7 @@ __init static int tracer_alloc_buffers(void)


#ifdef CONFIG_TRACER_MAX_TRACE
max_tr.buffer = ring_buffer_alloc(1, rb_flags);
max_tr.buffer = ring_buffer_alloc(1, TRACE_BUFFER_FLAGS);
if (!max_tr.buffer) {
printk(KERN_ERR "tracer: failed to allocate max ring buffer!\n");
WARN_ON(1);
Expand Down
3 changes: 1 addition & 2 deletions trunk/kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ struct tracer {
/* If you handled the flag setting, return 0 */
int (*set_flag)(u32 old_flags, u32 bit, int set);
struct tracer *next;
struct tracer_flags *flags;
int print_max;
struct tracer_flags *flags;
int use_max_tr;
};

Expand Down Expand Up @@ -606,7 +606,6 @@ enum trace_iterator_flags {
TRACE_ITER_SLEEP_TIME = 0x40000,
TRACE_ITER_GRAPH_TIME = 0x80000,
TRACE_ITER_RECORD_CMD = 0x100000,
TRACE_ITER_OVERWRITE = 0x200000,
};

/*
Expand Down
6 changes: 3 additions & 3 deletions trunk/kernel/trace/trace_entries.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ FTRACE_ENTRY(funcgraph_exit, ftrace_graph_ret_entry,
*/
#define FTRACE_CTX_FIELDS \
__field( unsigned int, prev_pid ) \
__field( unsigned int, next_pid ) \
__field( unsigned int, next_cpu ) \
__field( unsigned char, prev_prio ) \
__field( unsigned char, prev_state ) \
__field( unsigned int, next_pid ) \
__field( unsigned char, next_prio ) \
__field( unsigned char, next_state )
__field( unsigned char, next_state ) \
__field( unsigned int, next_cpu )

FTRACE_ENTRY(context_switch, ctx_switch_entry,

Expand Down
2 changes: 1 addition & 1 deletion trunk/kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ static int trace_define_common_fields(void)
__common_field(unsigned char, flags);
__common_field(unsigned char, preempt_count);
__common_field(int, pid);
__common_field(int, lock_depth);

return ret;
}
Expand Down Expand Up @@ -325,7 +326,6 @@ int trace_set_clr_event(const char *system, const char *event, int set)
{
return __ftrace_set_clr_event(NULL, system, event, set);
}
EXPORT_SYMBOL_GPL(trace_set_clr_event);

/* 128 should be much more than enough */
#define EVENT_BUF_SIZE 127
Expand Down
Loading

0 comments on commit 5490749

Please sign in to comment.