Skip to content

Commit 091c0f8

Browse files
committed
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: ftrace: Fix hash record accounting bug perf: Fix parsing of __print_flags() in TP_printk() jump_label: jump_label_inc may return before the code is patched ftrace: Remove force undef config value left for testing tracing: Restore system filter behavior tracing: fix event_subsystem ref counting
2 parents 4fb1db3 + ddf6e0e commit 091c0f8

6 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎include/linux/ftrace_event.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,15 @@ enum {
172172
TRACE_EVENT_FL_FILTERED_BIT,
173173
TRACE_EVENT_FL_RECORDED_CMD_BIT,
174174
TRACE_EVENT_FL_CAP_ANY_BIT,
175+
TRACE_EVENT_FL_NO_SET_FILTER_BIT,
175176
};
176177

177178
enum {
178179
TRACE_EVENT_FL_ENABLED = (1 << TRACE_EVENT_FL_ENABLED_BIT),
179180
TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
180181
TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
181182
TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
183+
TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
182184
};
183185

184186
struct ftrace_event_call {

‎kernel/jump_label.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ void jump_label_inc(struct jump_label_key *key)
6666
return;
6767

6868
jump_label_lock();
69-
if (atomic_add_return(1, &key->enabled) == 1)
69+
if (atomic_read(&key->enabled) == 0)
7070
jump_label_update(key, JUMP_LABEL_ENABLE);
71+
atomic_inc(&key->enabled);
7172
jump_label_unlock();
7273
}
7374

‎kernel/trace/ftrace.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ void clear_ftrace_function(void)
152152
ftrace_pid_function = ftrace_stub;
153153
}
154154

155-
#undef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
156155
#ifndef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
157156
/*
158157
* 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,
12121211
if (!src->count) {
12131212
free_ftrace_hash_rcu(*dst);
12141213
rcu_assign_pointer(*dst, EMPTY_HASH);
1215-
return 0;
1214+
/* still need to update the function records */
1215+
ret = 0;
1216+
goto out;
12161217
}
12171218

12181219
/*

‎kernel/trace/trace_events.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
10781078
/* First see if we did not already create this dir */
10791079
list_for_each_entry(system, &event_subsystems, list) {
10801080
if (strcmp(system->name, name) == 0) {
1081-
__get_system(system);
10821081
system->nr_events++;
10831082
return system->entry;
10841083
}

‎kernel/trace/trace_events_filter.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,9 @@ static int replace_system_preds(struct event_subsystem *system,
16491649
*/
16501650
err = replace_preds(call, NULL, ps, filter_string, true);
16511651
if (err)
1652-
goto fail;
1652+
call->flags |= TRACE_EVENT_FL_NO_SET_FILTER;
1653+
else
1654+
call->flags &= ~TRACE_EVENT_FL_NO_SET_FILTER;
16531655
}
16541656

16551657
list_for_each_entry(call, &ftrace_events, list) {
@@ -1658,6 +1660,9 @@ static int replace_system_preds(struct event_subsystem *system,
16581660
if (strcmp(call->class->system, system->name) != 0)
16591661
continue;
16601662

1663+
if (call->flags & TRACE_EVENT_FL_NO_SET_FILTER)
1664+
continue;
1665+
16611666
filter_item = kzalloc(sizeof(*filter_item), GFP_KERNEL);
16621667
if (!filter_item)
16631668
goto fail_mem;

‎tools/perf/util/trace-event-parse.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,8 @@ process_flags(struct event *event, struct print_arg *arg, char **tok)
15371537
field = malloc_or_die(sizeof(*field));
15381538

15391539
type = process_arg(event, field, &token);
1540+
while (type == EVENT_OP)
1541+
type = process_op(event, field, &token);
15401542
if (test_type_token(type, token, EVENT_DELIM, ","))
15411543
goto out_free;
15421544

0 commit comments

Comments
 (0)