Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 375452
b: refs/heads/master
c: 1cf4c07
h: refs/heads/master
v: v3
  • Loading branch information
Masami Hiramatsu authored and Steven Rostedt committed May 10, 2013
1 parent 4923908 commit d040527
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 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: 30052170dcc256c18a43fb3e76577a67394543f8
refs/heads/master: 1cf4c0732db3cd3c49cadbc60ff6bda08604e6fa
1 change: 1 addition & 0 deletions trunk/include/linux/ftrace_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ struct ftrace_event_file {
* caching and such. Which is mostly OK ;-)
*/
unsigned long flags;
atomic_t sm_ref; /* soft-mode reference counter */
};

#define __TRACE_EVENT_FLAGS(name, value) \
Expand Down
12 changes: 10 additions & 2 deletions trunk/kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ static int __ftrace_event_enable_disable(struct ftrace_event_file *file,
switch (enable) {
case 0:
/*
* When soft_disable is set and enable is cleared, we want
* When soft_disable is set and enable is cleared, the sm_ref
* reference counter is decremented. If it reaches 0, we want
* to clear the SOFT_DISABLED flag but leave the event in the
* state that it was. That is, if the event was enabled and
* SOFT_DISABLED isn't set, then do nothing. But if SOFT_DISABLED
Expand All @@ -263,6 +264,8 @@ static int __ftrace_event_enable_disable(struct ftrace_event_file *file,
* "soft enable"s (clearing the SOFT_DISABLED bit) wont work.
*/
if (soft_disable) {
if (atomic_dec_return(&file->sm_ref) > 0)
break;
disable = file->flags & FTRACE_EVENT_FL_SOFT_DISABLED;
clear_bit(FTRACE_EVENT_FL_SOFT_MODE_BIT, &file->flags);
} else
Expand Down Expand Up @@ -291,8 +294,11 @@ static int __ftrace_event_enable_disable(struct ftrace_event_file *file,
*/
if (!soft_disable)
clear_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, &file->flags);
else
else {
if (atomic_inc_return(&file->sm_ref) > 1)
break;
set_bit(FTRACE_EVENT_FL_SOFT_MODE_BIT, &file->flags);
}

if (!(file->flags & FTRACE_EVENT_FL_ENABLED)) {

Expand Down Expand Up @@ -1540,6 +1546,7 @@ __trace_add_new_event(struct ftrace_event_call *call,

file->event_call = call;
file->tr = tr;
atomic_set(&file->sm_ref, 0);
list_add(&file->list, &tr->events);

return event_create_dir(tr->event_dir, file, id, enable, filter, format);
Expand All @@ -1562,6 +1569,7 @@ __trace_early_add_new_event(struct ftrace_event_call *call,

file->event_call = call;
file->tr = tr;
atomic_set(&file->sm_ref, 0);
list_add(&file->list, &tr->events);

return 0;
Expand Down

0 comments on commit d040527

Please sign in to comment.