From: Ingo Molnar Date: Sun, 23 Nov 2008 08:10:32 +0000 (+0100) Subject: Merge branches 'tracing/profiling', 'tracing/options' and 'tracing/urgent' into traci... X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a0a70c735ef714fe1b6777b571630c3d50c7b008;p=linux-beck.git Merge branches 'tracing/profiling', 'tracing/options' and 'tracing/urgent' into tracing/core --- a0a70c735ef714fe1b6777b571630c3d50c7b008 diff --cc kernel/trace/trace.c index 5653c6b07ba1,697eda36b86a,e97c29a6e7b0,d86e3252f300..4ee6f0375222 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@@@@ -43,15 -43,6 -43,29 -43,6 +43,29 @@@@@ unsigned long __read_mostly tracing_max_latency = (cycle_t)ULONG_MAX; unsigned long __read_mostly tracing_thresh; ++ +/* For tracers that don't implement custom flags */ ++ +static struct tracer_opt dummy_tracer_opt[] = { ++ + { } ++ +}; ++ + ++ +static struct tracer_flags dummy_tracer_flags = { ++ + .val = 0, ++ + .opts = dummy_tracer_opt ++ +}; ++ + ++ +static int dummy_set_flag(u32 old_flags, u32 bit, int set) ++ +{ ++ + return 0; ++ +} + + + +/* + + * Kill all tracing for good (never come back). + + * It is initialized to 1 but will turn to zero if the initialization + + * of the tracer is successful. But that is the only place that sets + + * this back to zero. + + */ + +int tracing_disabled = 1; + + static DEFINE_PER_CPU(local_t, ftrace_cpu_disabled); static inline void ftrace_disable_cpu(void) @@@@@ -549,10 -494,11 -563,10 -494,11 +571,10 @@@@@ int register_tracer(struct tracer *type * internal tracing to verify that everything is in order. * If we fail, we do not register this tracer. */ --- for_each_tracing_cpu(i) { +++ for_each_tracing_cpu(i) tracing_reset(tr, i); --- } +++ current_trace = type; - - tr->ctrl = 0; /* the test is responsible for initializing and enabling */ pr_info("Testing tracer %s: ", type->name); ret = type->selftest(type, tr); @@@@@ -815,35 -691,6 -828,36 -691,6 +837,36 @@@@@ trace_function(struct trace_array *tr, ring_buffer_unlock_commit(tr->buffer, event, irq_flags); } + +#ifdef CONFIG_FUNCTION_RET_TRACER + +static void __trace_function_return(struct trace_array *tr, + + struct trace_array_cpu *data, + + struct ftrace_retfunc *trace, + + unsigned long flags, + + int pc) + +{ + + struct ring_buffer_event *event; + + struct ftrace_ret_entry *entry; + + unsigned long irq_flags; + + + + if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled)))) + + return; + + + + event = ring_buffer_lock_reserve(global_trace.buffer, sizeof(*entry), + + &irq_flags); + + if (!event) + + return; + + entry = ring_buffer_event_data(event); + + tracing_generic_entry_update(&entry->ent, flags, pc); + + entry->ent.type = TRACE_FN_RET; + + entry->ip = trace->func; + + entry->parent_ip = trace->ret; + + entry->rettime = trace->rettime; + + entry->calltime = trace->calltime; ++ + entry->overrun = trace->overrun; + + ring_buffer_unlock_commit(global_trace.buffer, event, irq_flags); + +} + +#endif + + void ftrace(struct trace_array *tr, struct trace_array_cpu *data, unsigned long ip, unsigned long parent_ip, unsigned long flags, @@@@@ -2433,9 -2188,9 -2446,10 -2189,9 +2456,10 @@@@@ static struct file_operations tracing_c }; static ssize_t - -tracing_iter_ctrl_read(struct file *filp, char __user *ubuf, + +tracing_trace_options_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { ++ + int i; char *buf; int r = 0; int len = 0; @@@@@ -2469,8 -2224,8 -2503,42 -2225,8 +2513,42 @@@@@ return r; } ++ +/* Try to assign a tracer specific option */ ++ +static int set_tracer_option(struct tracer *trace, char *cmp, int neg) ++ +{ ++ + struct tracer_flags *trace_flags = trace->flags; ++ + struct tracer_opt *opts = NULL; ++ + int ret = 0, i = 0; ++ + int len; ++ + ++ + for (i = 0; trace_flags->opts[i].name; i++) { ++ + opts = &trace_flags->opts[i]; ++ + len = strlen(opts->name); ++ + ++ + if (strncmp(cmp, opts->name, len) == 0) { ++ + ret = trace->set_flag(trace_flags->val, ++ + opts->bit, !neg); ++ + break; ++ + } ++ + } ++ + /* Not found */ ++ + if (!trace_flags->opts[i].name) ++ + return -EINVAL; ++ + ++ + /* Refused to handle */ ++ + if (ret) ++ + return ret; ++ + ++ + if (neg) ++ + trace_flags->val &= ~opts->bit; ++ + else ++ + trace_flags->val |= opts->bit; ++ + ++ + return 0; ++ +} ++ + static ssize_t - -tracing_iter_ctrl_write(struct file *filp, const char __user *ubuf, + +tracing_trace_options_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { char buf[64];