Merge branch 'tip/perf/urgent-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/urgent
Pull tracing fixes from Steven Rostedt. Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
1f1b396758
|
@ -2881,11 +2881,25 @@ static int set_tracer_option(struct tracer *trace, char *cmp, int neg)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_tracer_flags(unsigned int mask, int enabled)
|
/* Some tracers require overwrite to stay enabled */
|
||||||
|
int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set)
|
||||||
|
{
|
||||||
|
if (tracer->enabled && (mask & TRACE_ITER_OVERWRITE) && !set)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_tracer_flag(unsigned int mask, int enabled)
|
||||||
{
|
{
|
||||||
/* do nothing if flag is already set */
|
/* do nothing if flag is already set */
|
||||||
if (!!(trace_flags & mask) == !!enabled)
|
if (!!(trace_flags & mask) == !!enabled)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
|
/* Give the tracer a chance to approve the change */
|
||||||
|
if (current_trace->flag_changed)
|
||||||
|
if (current_trace->flag_changed(current_trace, mask, !!enabled))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
trace_flags |= mask;
|
trace_flags |= mask;
|
||||||
|
@ -2895,18 +2909,24 @@ static void set_tracer_flags(unsigned int mask, int enabled)
|
||||||
if (mask == TRACE_ITER_RECORD_CMD)
|
if (mask == TRACE_ITER_RECORD_CMD)
|
||||||
trace_event_enable_cmd_record(enabled);
|
trace_event_enable_cmd_record(enabled);
|
||||||
|
|
||||||
if (mask == TRACE_ITER_OVERWRITE)
|
if (mask == TRACE_ITER_OVERWRITE) {
|
||||||
ring_buffer_change_overwrite(global_trace.buffer, enabled);
|
ring_buffer_change_overwrite(global_trace.buffer, enabled);
|
||||||
|
#ifdef CONFIG_TRACER_MAX_TRACE
|
||||||
|
ring_buffer_change_overwrite(max_tr.buffer, enabled);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (mask == TRACE_ITER_PRINTK)
|
if (mask == TRACE_ITER_PRINTK)
|
||||||
trace_printk_start_stop_comm(enabled);
|
trace_printk_start_stop_comm(enabled);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int trace_set_options(char *option)
|
static int trace_set_options(char *option)
|
||||||
{
|
{
|
||||||
char *cmp;
|
char *cmp;
|
||||||
int neg = 0;
|
int neg = 0;
|
||||||
int ret = 0;
|
int ret = -ENODEV;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
cmp = strstrip(option);
|
cmp = strstrip(option);
|
||||||
|
@ -2916,19 +2936,20 @@ static int trace_set_options(char *option)
|
||||||
cmp += 2;
|
cmp += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutex_lock(&trace_types_lock);
|
||||||
|
|
||||||
for (i = 0; trace_options[i]; i++) {
|
for (i = 0; trace_options[i]; i++) {
|
||||||
if (strcmp(cmp, trace_options[i]) == 0) {
|
if (strcmp(cmp, trace_options[i]) == 0) {
|
||||||
set_tracer_flags(1 << i, !neg);
|
ret = set_tracer_flag(1 << i, !neg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If no option could be set, test the specific tracer options */
|
/* If no option could be set, test the specific tracer options */
|
||||||
if (!trace_options[i]) {
|
if (!trace_options[i])
|
||||||
mutex_lock(&trace_types_lock);
|
|
||||||
ret = set_tracer_option(current_trace, cmp, neg);
|
ret = set_tracer_option(current_trace, cmp, neg);
|
||||||
mutex_unlock(&trace_types_lock);
|
|
||||||
}
|
mutex_unlock(&trace_types_lock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -2938,6 +2959,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf,
|
||||||
size_t cnt, loff_t *ppos)
|
size_t cnt, loff_t *ppos)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (cnt >= sizeof(buf))
|
if (cnt >= sizeof(buf))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -2947,7 +2969,9 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf,
|
||||||
|
|
||||||
buf[cnt] = 0;
|
buf[cnt] = 0;
|
||||||
|
|
||||||
trace_set_options(buf);
|
ret = trace_set_options(buf);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
*ppos += cnt;
|
*ppos += cnt;
|
||||||
|
|
||||||
|
@ -3251,6 +3275,9 @@ static int tracing_set_tracer(const char *buf)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
trace_branch_disable();
|
trace_branch_disable();
|
||||||
|
|
||||||
|
current_trace->enabled = false;
|
||||||
|
|
||||||
if (current_trace->reset)
|
if (current_trace->reset)
|
||||||
current_trace->reset(tr);
|
current_trace->reset(tr);
|
||||||
|
|
||||||
|
@ -3295,6 +3322,7 @@ static int tracing_set_tracer(const char *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
current_trace = t;
|
current_trace = t;
|
||||||
|
current_trace->enabled = true;
|
||||||
trace_branch_enable(tr);
|
trace_branch_enable(tr);
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&trace_types_lock);
|
mutex_unlock(&trace_types_lock);
|
||||||
|
@ -4781,7 +4809,13 @@ trace_options_core_write(struct file *filp, const char __user *ubuf, size_t cnt,
|
||||||
|
|
||||||
if (val != 0 && val != 1)
|
if (val != 0 && val != 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
set_tracer_flags(1 << index, val);
|
|
||||||
|
mutex_lock(&trace_types_lock);
|
||||||
|
ret = set_tracer_flag(1 << index, val);
|
||||||
|
mutex_unlock(&trace_types_lock);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
*ppos += cnt;
|
*ppos += cnt;
|
||||||
|
|
||||||
|
|
|
@ -283,11 +283,15 @@ struct tracer {
|
||||||
enum print_line_t (*print_line)(struct trace_iterator *iter);
|
enum print_line_t (*print_line)(struct trace_iterator *iter);
|
||||||
/* If you handled the flag setting, return 0 */
|
/* If you handled the flag setting, return 0 */
|
||||||
int (*set_flag)(u32 old_flags, u32 bit, int set);
|
int (*set_flag)(u32 old_flags, u32 bit, int set);
|
||||||
|
/* Return 0 if OK with change, else return non-zero */
|
||||||
|
int (*flag_changed)(struct tracer *tracer,
|
||||||
|
u32 mask, int set);
|
||||||
struct tracer *next;
|
struct tracer *next;
|
||||||
struct tracer_flags *flags;
|
struct tracer_flags *flags;
|
||||||
bool print_max;
|
bool print_max;
|
||||||
bool use_max_tr;
|
bool use_max_tr;
|
||||||
bool allocated_snapshot;
|
bool allocated_snapshot;
|
||||||
|
bool enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -943,6 +947,8 @@ extern const char *__stop___trace_bprintk_fmt[];
|
||||||
|
|
||||||
void trace_printk_init_buffers(void);
|
void trace_printk_init_buffers(void);
|
||||||
void trace_printk_start_comm(void);
|
void trace_printk_start_comm(void);
|
||||||
|
int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set);
|
||||||
|
int set_tracer_flag(unsigned int mask, int enabled);
|
||||||
|
|
||||||
#undef FTRACE_ENTRY
|
#undef FTRACE_ENTRY
|
||||||
#define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \
|
#define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \
|
||||||
|
|
|
@ -32,7 +32,7 @@ enum {
|
||||||
|
|
||||||
static int trace_type __read_mostly;
|
static int trace_type __read_mostly;
|
||||||
|
|
||||||
static int save_lat_flag;
|
static int save_flags;
|
||||||
|
|
||||||
static void stop_irqsoff_tracer(struct trace_array *tr, int graph);
|
static void stop_irqsoff_tracer(struct trace_array *tr, int graph);
|
||||||
static int start_irqsoff_tracer(struct trace_array *tr, int graph);
|
static int start_irqsoff_tracer(struct trace_array *tr, int graph);
|
||||||
|
@ -558,8 +558,11 @@ static void stop_irqsoff_tracer(struct trace_array *tr, int graph)
|
||||||
|
|
||||||
static void __irqsoff_tracer_init(struct trace_array *tr)
|
static void __irqsoff_tracer_init(struct trace_array *tr)
|
||||||
{
|
{
|
||||||
save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT;
|
save_flags = trace_flags;
|
||||||
trace_flags |= TRACE_ITER_LATENCY_FMT;
|
|
||||||
|
/* non overwrite screws up the latency tracers */
|
||||||
|
set_tracer_flag(TRACE_ITER_OVERWRITE, 1);
|
||||||
|
set_tracer_flag(TRACE_ITER_LATENCY_FMT, 1);
|
||||||
|
|
||||||
tracing_max_latency = 0;
|
tracing_max_latency = 0;
|
||||||
irqsoff_trace = tr;
|
irqsoff_trace = tr;
|
||||||
|
@ -573,10 +576,13 @@ static void __irqsoff_tracer_init(struct trace_array *tr)
|
||||||
|
|
||||||
static void irqsoff_tracer_reset(struct trace_array *tr)
|
static void irqsoff_tracer_reset(struct trace_array *tr)
|
||||||
{
|
{
|
||||||
|
int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT;
|
||||||
|
int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE;
|
||||||
|
|
||||||
stop_irqsoff_tracer(tr, is_graph());
|
stop_irqsoff_tracer(tr, is_graph());
|
||||||
|
|
||||||
if (!save_lat_flag)
|
set_tracer_flag(TRACE_ITER_LATENCY_FMT, lat_flag);
|
||||||
trace_flags &= ~TRACE_ITER_LATENCY_FMT;
|
set_tracer_flag(TRACE_ITER_OVERWRITE, overwrite_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void irqsoff_tracer_start(struct trace_array *tr)
|
static void irqsoff_tracer_start(struct trace_array *tr)
|
||||||
|
@ -609,6 +615,7 @@ static struct tracer irqsoff_tracer __read_mostly =
|
||||||
.print_line = irqsoff_print_line,
|
.print_line = irqsoff_print_line,
|
||||||
.flags = &tracer_flags,
|
.flags = &tracer_flags,
|
||||||
.set_flag = irqsoff_set_flag,
|
.set_flag = irqsoff_set_flag,
|
||||||
|
.flag_changed = trace_keep_overwrite,
|
||||||
#ifdef CONFIG_FTRACE_SELFTEST
|
#ifdef CONFIG_FTRACE_SELFTEST
|
||||||
.selftest = trace_selftest_startup_irqsoff,
|
.selftest = trace_selftest_startup_irqsoff,
|
||||||
#endif
|
#endif
|
||||||
|
@ -642,6 +649,7 @@ static struct tracer preemptoff_tracer __read_mostly =
|
||||||
.print_line = irqsoff_print_line,
|
.print_line = irqsoff_print_line,
|
||||||
.flags = &tracer_flags,
|
.flags = &tracer_flags,
|
||||||
.set_flag = irqsoff_set_flag,
|
.set_flag = irqsoff_set_flag,
|
||||||
|
.flag_changed = trace_keep_overwrite,
|
||||||
#ifdef CONFIG_FTRACE_SELFTEST
|
#ifdef CONFIG_FTRACE_SELFTEST
|
||||||
.selftest = trace_selftest_startup_preemptoff,
|
.selftest = trace_selftest_startup_preemptoff,
|
||||||
#endif
|
#endif
|
||||||
|
@ -677,6 +685,7 @@ static struct tracer preemptirqsoff_tracer __read_mostly =
|
||||||
.print_line = irqsoff_print_line,
|
.print_line = irqsoff_print_line,
|
||||||
.flags = &tracer_flags,
|
.flags = &tracer_flags,
|
||||||
.set_flag = irqsoff_set_flag,
|
.set_flag = irqsoff_set_flag,
|
||||||
|
.flag_changed = trace_keep_overwrite,
|
||||||
#ifdef CONFIG_FTRACE_SELFTEST
|
#ifdef CONFIG_FTRACE_SELFTEST
|
||||||
.selftest = trace_selftest_startup_preemptirqsoff,
|
.selftest = trace_selftest_startup_preemptirqsoff,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,7 +36,7 @@ static void __wakeup_reset(struct trace_array *tr);
|
||||||
static int wakeup_graph_entry(struct ftrace_graph_ent *trace);
|
static int wakeup_graph_entry(struct ftrace_graph_ent *trace);
|
||||||
static void wakeup_graph_return(struct ftrace_graph_ret *trace);
|
static void wakeup_graph_return(struct ftrace_graph_ret *trace);
|
||||||
|
|
||||||
static int save_lat_flag;
|
static int save_flags;
|
||||||
|
|
||||||
#define TRACE_DISPLAY_GRAPH 1
|
#define TRACE_DISPLAY_GRAPH 1
|
||||||
|
|
||||||
|
@ -540,8 +540,11 @@ static void stop_wakeup_tracer(struct trace_array *tr)
|
||||||
|
|
||||||
static int __wakeup_tracer_init(struct trace_array *tr)
|
static int __wakeup_tracer_init(struct trace_array *tr)
|
||||||
{
|
{
|
||||||
save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT;
|
save_flags = trace_flags;
|
||||||
trace_flags |= TRACE_ITER_LATENCY_FMT;
|
|
||||||
|
/* non overwrite screws up the latency tracers */
|
||||||
|
set_tracer_flag(TRACE_ITER_OVERWRITE, 1);
|
||||||
|
set_tracer_flag(TRACE_ITER_LATENCY_FMT, 1);
|
||||||
|
|
||||||
tracing_max_latency = 0;
|
tracing_max_latency = 0;
|
||||||
wakeup_trace = tr;
|
wakeup_trace = tr;
|
||||||
|
@ -563,12 +566,15 @@ static int wakeup_rt_tracer_init(struct trace_array *tr)
|
||||||
|
|
||||||
static void wakeup_tracer_reset(struct trace_array *tr)
|
static void wakeup_tracer_reset(struct trace_array *tr)
|
||||||
{
|
{
|
||||||
|
int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT;
|
||||||
|
int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE;
|
||||||
|
|
||||||
stop_wakeup_tracer(tr);
|
stop_wakeup_tracer(tr);
|
||||||
/* make sure we put back any tasks we are tracing */
|
/* make sure we put back any tasks we are tracing */
|
||||||
wakeup_reset(tr);
|
wakeup_reset(tr);
|
||||||
|
|
||||||
if (!save_lat_flag)
|
set_tracer_flag(TRACE_ITER_LATENCY_FMT, lat_flag);
|
||||||
trace_flags &= ~TRACE_ITER_LATENCY_FMT;
|
set_tracer_flag(TRACE_ITER_OVERWRITE, overwrite_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wakeup_tracer_start(struct trace_array *tr)
|
static void wakeup_tracer_start(struct trace_array *tr)
|
||||||
|
@ -594,6 +600,7 @@ static struct tracer wakeup_tracer __read_mostly =
|
||||||
.print_line = wakeup_print_line,
|
.print_line = wakeup_print_line,
|
||||||
.flags = &tracer_flags,
|
.flags = &tracer_flags,
|
||||||
.set_flag = wakeup_set_flag,
|
.set_flag = wakeup_set_flag,
|
||||||
|
.flag_changed = trace_keep_overwrite,
|
||||||
#ifdef CONFIG_FTRACE_SELFTEST
|
#ifdef CONFIG_FTRACE_SELFTEST
|
||||||
.selftest = trace_selftest_startup_wakeup,
|
.selftest = trace_selftest_startup_wakeup,
|
||||||
#endif
|
#endif
|
||||||
|
@ -615,6 +622,7 @@ static struct tracer wakeup_rt_tracer __read_mostly =
|
||||||
.print_line = wakeup_print_line,
|
.print_line = wakeup_print_line,
|
||||||
.flags = &tracer_flags,
|
.flags = &tracer_flags,
|
||||||
.set_flag = wakeup_set_flag,
|
.set_flag = wakeup_set_flag,
|
||||||
|
.flag_changed = trace_keep_overwrite,
|
||||||
#ifdef CONFIG_FTRACE_SELFTEST
|
#ifdef CONFIG_FTRACE_SELFTEST
|
||||||
.selftest = trace_selftest_startup_wakeup,
|
.selftest = trace_selftest_startup_wakeup,
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue