Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 187888
b: refs/heads/master
c: 3f379b0
h: refs/heads/master
v: v3
  • Loading branch information
Paul E. McKenney authored and Ingo Molnar committed Mar 11, 2010
1 parent 2f1636d commit bb9bd24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 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: 54dbf96c921513bf98484a20ef366d51944a4c4d
refs/heads/master: 3f379b03fbfddd20536389a85c6456f8233d1f8d
22 changes: 13 additions & 9 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/ctype.h>
#include <linux/list.h>
#include <linux/hash.h>
#include <linux/rcupdate.h>

#include <trace/events/sched.h>

Expand Down Expand Up @@ -88,18 +89,22 @@ ftrace_func_t ftrace_pid_function __read_mostly = ftrace_stub;
static int ftrace_set_func(unsigned long *array, int *idx, char *buffer);
#endif

/*
* Traverse the ftrace_list, invoking all entries. The reason that we
* can use rcu_dereference_raw() is that elements removed from this list
* are simply leaked, so there is no need to interact with a grace-period
* mechanism. The rcu_dereference_raw() calls are needed to handle
* concurrent insertions into the ftrace_list.
*
* Silly Alpha and silly pointer-speculation compiler optimizations!
*/
static void ftrace_list_func(unsigned long ip, unsigned long parent_ip)
{
struct ftrace_ops *op = ftrace_list;

/* in case someone actually ports this to alpha! */
read_barrier_depends();
struct ftrace_ops *op = rcu_dereference_raw(ftrace_list); /*see above*/

while (op != &ftrace_list_end) {
/* silly alpha */
read_barrier_depends();
op->func(ip, parent_ip);
op = op->next;
op = rcu_dereference_raw(op->next); /*see above*/
};
}

Expand Down Expand Up @@ -154,8 +159,7 @@ static int __register_ftrace_function(struct ftrace_ops *ops)
* the ops->next pointer is valid before another CPU sees
* the ops pointer included into the ftrace_list.
*/
smp_wmb();
ftrace_list = ops;
rcu_assign_pointer(ftrace_list, ops);

if (ftrace_enabled) {
ftrace_func_t func;
Expand Down

0 comments on commit bb9bd24

Please sign in to comment.