提交 efc96737 编写于 作者: I Ingo Molnar

Merge branch 'tip/perf/core' of...

Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core
...@@ -191,8 +191,6 @@ And for string fields they are: ...@@ -191,8 +191,6 @@ And for string fields they are:
Currently, only exact string matches are supported. Currently, only exact string matches are supported.
Currently, the maximum number of predicates in a filter is 16.
5.2 Setting filters 5.2 Setting filters
------------------- -------------------
......
...@@ -172,6 +172,7 @@ enum { ...@@ -172,6 +172,7 @@ enum {
TRACE_EVENT_FL_FILTERED_BIT, TRACE_EVENT_FL_FILTERED_BIT,
TRACE_EVENT_FL_RECORDED_CMD_BIT, TRACE_EVENT_FL_RECORDED_CMD_BIT,
TRACE_EVENT_FL_CAP_ANY_BIT, TRACE_EVENT_FL_CAP_ANY_BIT,
TRACE_EVENT_FL_NO_SET_FILTER_BIT,
}; };
enum { enum {
...@@ -179,6 +180,7 @@ enum { ...@@ -179,6 +180,7 @@ enum {
TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
}; };
struct ftrace_event_call { struct ftrace_event_call {
......
...@@ -66,8 +66,9 @@ void jump_label_inc(struct jump_label_key *key) ...@@ -66,8 +66,9 @@ void jump_label_inc(struct jump_label_key *key)
return; return;
jump_label_lock(); jump_label_lock();
if (atomic_add_return(1, &key->enabled) == 1) if (atomic_read(&key->enabled) == 0)
jump_label_update(key, JUMP_LABEL_ENABLE); jump_label_update(key, JUMP_LABEL_ENABLE);
atomic_inc(&key->enabled);
jump_label_unlock(); jump_label_unlock();
} }
......
...@@ -498,36 +498,32 @@ void get_usage_chars(struct lock_class *class, char usage[LOCK_USAGE_CHARS]) ...@@ -498,36 +498,32 @@ void get_usage_chars(struct lock_class *class, char usage[LOCK_USAGE_CHARS])
usage[i] = '\0'; usage[i] = '\0';
} }
static int __print_lock_name(struct lock_class *class) static void __print_lock_name(struct lock_class *class)
{ {
char str[KSYM_NAME_LEN]; char str[KSYM_NAME_LEN];
const char *name; const char *name;
name = class->name;
if (!name)
name = __get_key_name(class->key, str);
return printk("%s", name);
}
static void print_lock_name(struct lock_class *class)
{
char str[KSYM_NAME_LEN], usage[LOCK_USAGE_CHARS];
const char *name;
get_usage_chars(class, usage);
name = class->name; name = class->name;
if (!name) { if (!name) {
name = __get_key_name(class->key, str); name = __get_key_name(class->key, str);
printk(" (%s", name); printk("%s", name);
} else { } else {
printk(" (%s", name); printk("%s", name);
if (class->name_version > 1) if (class->name_version > 1)
printk("#%d", class->name_version); printk("#%d", class->name_version);
if (class->subclass) if (class->subclass)
printk("/%d", class->subclass); printk("/%d", class->subclass);
} }
}
static void print_lock_name(struct lock_class *class)
{
char usage[LOCK_USAGE_CHARS];
get_usage_chars(class, usage);
printk(" (");
__print_lock_name(class);
printk("){%s}", usage); printk("){%s}", usage);
} }
......
...@@ -152,7 +152,6 @@ void clear_ftrace_function(void) ...@@ -152,7 +152,6 @@ void clear_ftrace_function(void)
ftrace_pid_function = ftrace_stub; ftrace_pid_function = ftrace_stub;
} }
#undef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
#ifndef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST #ifndef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
/* /*
* For those archs that do not test ftrace_trace_stop in their * For those archs that do not test ftrace_trace_stop in their
...@@ -1212,7 +1211,9 @@ ftrace_hash_move(struct ftrace_ops *ops, int enable, ...@@ -1212,7 +1211,9 @@ ftrace_hash_move(struct ftrace_ops *ops, int enable,
if (!src->count) { if (!src->count) {
free_ftrace_hash_rcu(*dst); free_ftrace_hash_rcu(*dst);
rcu_assign_pointer(*dst, EMPTY_HASH); rcu_assign_pointer(*dst, EMPTY_HASH);
return 0; /* still need to update the function records */
ret = 0;
goto out;
} }
/* /*
......
...@@ -2140,6 +2140,21 @@ enum print_line_t print_trace_line(struct trace_iterator *iter) ...@@ -2140,6 +2140,21 @@ enum print_line_t print_trace_line(struct trace_iterator *iter)
return print_trace_fmt(iter); return print_trace_fmt(iter);
} }
void trace_latency_header(struct seq_file *m)
{
struct trace_iterator *iter = m->private;
/* print nothing if the buffers are empty */
if (trace_empty(iter))
return;
if (iter->iter_flags & TRACE_FILE_LAT_FMT)
print_trace_header(m, iter);
if (!(trace_flags & TRACE_ITER_VERBOSE))
print_lat_help_header(m);
}
void trace_default_header(struct seq_file *m) void trace_default_header(struct seq_file *m)
{ {
struct trace_iterator *iter = m->private; struct trace_iterator *iter = m->private;
......
...@@ -370,6 +370,7 @@ void trace_graph_function(struct trace_array *tr, ...@@ -370,6 +370,7 @@ void trace_graph_function(struct trace_array *tr,
unsigned long ip, unsigned long ip,
unsigned long parent_ip, unsigned long parent_ip,
unsigned long flags, int pc); unsigned long flags, int pc);
void trace_latency_header(struct seq_file *m);
void trace_default_header(struct seq_file *m); void trace_default_header(struct seq_file *m);
void print_trace_header(struct seq_file *m, struct trace_iterator *iter); void print_trace_header(struct seq_file *m, struct trace_iterator *iter);
int trace_empty(struct trace_iterator *iter); int trace_empty(struct trace_iterator *iter);
......
...@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events) ...@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
/* First see if we did not already create this dir */ /* First see if we did not already create this dir */
list_for_each_entry(system, &event_subsystems, list) { list_for_each_entry(system, &event_subsystems, list) {
if (strcmp(system->name, name) == 0) { if (strcmp(system->name, name) == 0) {
__get_system(system);
system->nr_events++; system->nr_events++;
return system->entry; return system->entry;
} }
......
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
#include "trace.h" #include "trace.h"
#include "trace_output.h" #include "trace_output.h"
#define DEFAULT_SYS_FILTER_MESSAGE \
"### global filter ###\n" \
"# Use this to set filters for multiple events.\n" \
"# Only events with the given fields will be affected.\n" \
"# If no events are modified, an error message will be displayed here"
enum filter_op_ids enum filter_op_ids
{ {
OP_OR, OP_OR,
...@@ -646,7 +652,7 @@ void print_subsystem_event_filter(struct event_subsystem *system, ...@@ -646,7 +652,7 @@ void print_subsystem_event_filter(struct event_subsystem *system,
if (filter && filter->filter_string) if (filter && filter->filter_string)
trace_seq_printf(s, "%s\n", filter->filter_string); trace_seq_printf(s, "%s\n", filter->filter_string);
else else
trace_seq_printf(s, "none\n"); trace_seq_printf(s, DEFAULT_SYS_FILTER_MESSAGE "\n");
mutex_unlock(&event_mutex); mutex_unlock(&event_mutex);
} }
...@@ -1649,7 +1655,9 @@ static int replace_system_preds(struct event_subsystem *system, ...@@ -1649,7 +1655,9 @@ static int replace_system_preds(struct event_subsystem *system,
*/ */
err = replace_preds(call, NULL, ps, filter_string, true); err = replace_preds(call, NULL, ps, filter_string, true);
if (err) if (err)
goto fail; call->flags |= TRACE_EVENT_FL_NO_SET_FILTER;
else
call->flags &= ~TRACE_EVENT_FL_NO_SET_FILTER;
} }
list_for_each_entry(call, &ftrace_events, list) { list_for_each_entry(call, &ftrace_events, list) {
...@@ -1658,6 +1666,9 @@ static int replace_system_preds(struct event_subsystem *system, ...@@ -1658,6 +1666,9 @@ static int replace_system_preds(struct event_subsystem *system,
if (strcmp(call->class->system, system->name) != 0) if (strcmp(call->class->system, system->name) != 0)
continue; continue;
if (call->flags & TRACE_EVENT_FL_NO_SET_FILTER)
continue;
filter_item = kzalloc(sizeof(*filter_item), GFP_KERNEL); filter_item = kzalloc(sizeof(*filter_item), GFP_KERNEL);
if (!filter_item) if (!filter_item)
goto fail_mem; goto fail_mem;
...@@ -1833,7 +1844,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system, ...@@ -1833,7 +1844,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
if (!filter) if (!filter)
goto out; goto out;
replace_filter_string(filter, filter_string); /* System filters just show a default message */
kfree(filter->filter_string);
filter->filter_string = NULL;
/* /*
* No event actually uses the system filter * No event actually uses the system filter
* we can free it without synchronize_sched(). * we can free it without synchronize_sched().
...@@ -1843,14 +1857,12 @@ int apply_subsystem_event_filter(struct event_subsystem *system, ...@@ -1843,14 +1857,12 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
parse_init(ps, filter_ops, filter_string); parse_init(ps, filter_ops, filter_string);
err = filter_parse(ps); err = filter_parse(ps);
if (err) { if (err)
append_filter_err(ps, system->filter); goto err_filter;
goto out;
}
err = replace_system_preds(system, ps, filter_string); err = replace_system_preds(system, ps, filter_string);
if (err) if (err)
append_filter_err(ps, system->filter); goto err_filter;
out: out:
filter_opstack_clear(ps); filter_opstack_clear(ps);
...@@ -1860,6 +1872,11 @@ int apply_subsystem_event_filter(struct event_subsystem *system, ...@@ -1860,6 +1872,11 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
mutex_unlock(&event_mutex); mutex_unlock(&event_mutex);
return err; return err;
err_filter:
replace_filter_string(filter, filter_string);
append_filter_err(ps, system->filter);
goto out;
} }
#ifdef CONFIG_PERF_EVENTS #ifdef CONFIG_PERF_EVENTS
......
...@@ -280,9 +280,20 @@ static enum print_line_t irqsoff_print_line(struct trace_iterator *iter) ...@@ -280,9 +280,20 @@ static enum print_line_t irqsoff_print_line(struct trace_iterator *iter)
} }
static void irqsoff_graph_return(struct ftrace_graph_ret *trace) { } static void irqsoff_graph_return(struct ftrace_graph_ret *trace) { }
static void irqsoff_print_header(struct seq_file *s) { }
static void irqsoff_trace_open(struct trace_iterator *iter) { } static void irqsoff_trace_open(struct trace_iterator *iter) { }
static void irqsoff_trace_close(struct trace_iterator *iter) { } static void irqsoff_trace_close(struct trace_iterator *iter) { }
#ifdef CONFIG_FUNCTION_TRACER
static void irqsoff_print_header(struct seq_file *s)
{
trace_default_header(s);
}
#else
static void irqsoff_print_header(struct seq_file *s)
{
trace_latency_header(s);
}
#endif /* CONFIG_FUNCTION_TRACER */
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
/* /*
......
...@@ -280,9 +280,20 @@ static enum print_line_t wakeup_print_line(struct trace_iterator *iter) ...@@ -280,9 +280,20 @@ static enum print_line_t wakeup_print_line(struct trace_iterator *iter)
} }
static void wakeup_graph_return(struct ftrace_graph_ret *trace) { } static void wakeup_graph_return(struct ftrace_graph_ret *trace) { }
static void wakeup_print_header(struct seq_file *s) { }
static void wakeup_trace_open(struct trace_iterator *iter) { } static void wakeup_trace_open(struct trace_iterator *iter) { }
static void wakeup_trace_close(struct trace_iterator *iter) { } static void wakeup_trace_close(struct trace_iterator *iter) { }
#ifdef CONFIG_FUNCTION_TRACER
static void wakeup_print_header(struct seq_file *s)
{
trace_default_header(s);
}
#else
static void wakeup_print_header(struct seq_file *s)
{
trace_latency_header(s);
}
#endif /* CONFIG_FUNCTION_TRACER */
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
/* /*
......
...@@ -1537,6 +1537,8 @@ process_flags(struct event *event, struct print_arg *arg, char **tok) ...@@ -1537,6 +1537,8 @@ process_flags(struct event *event, struct print_arg *arg, char **tok)
field = malloc_or_die(sizeof(*field)); field = malloc_or_die(sizeof(*field));
type = process_arg(event, field, &token); type = process_arg(event, field, &token);
while (type == EVENT_OP)
type = process_op(event, field, &token);
if (test_type_token(type, token, EVENT_DELIM, ",")) if (test_type_token(type, token, EVENT_DELIM, ","))
goto out_free; goto out_free;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册