diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2013-05-28 20:01:16 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2013-06-11 18:38:50 -0400 |
commit | 7614c3dc74733dff4b0e774f7a894b9ea6ec508c (patch) | |
tree | 4dd344fc218514d48c30e95821e984c10668b2d5 /kernel/lglock.c | |
parent | 238ae93d699d59876b470bf6455de22bcfaa9a1b (diff) | |
download | linux-7614c3dc74733dff4b0e774f7a894b9ea6ec508c.tar.gz linux-7614c3dc74733dff4b0e774f7a894b9ea6ec508c.tar.bz2 linux-7614c3dc74733dff4b0e774f7a894b9ea6ec508c.zip |
ftrace: Use schedule_on_each_cpu() as a heavy synchronize_sched()
The function tracer uses preempt_disable/enable_notrace() for
synchronization between reading registered ftrace_ops and unregistering
them.
Most of the ftrace_ops are global permanent structures that do not
require this synchronization. That is, ops may be added and removed from
the hlist but are never freed, and wont hurt if a synchronization is
missed.
But this is not true for dynamically created ftrace_ops or control_ops,
which are used by the perf function tracing.
The problem here is that the function tracer can be used to trace
kernel/user context switches as well as going to and from idle.
Basically, it can be used to trace blind spots of the RCU subsystem.
This means that even though preempt_disable() is done, a
synchronize_sched() will ignore CPUs that haven't made it out of user
space or idle. These can include functions that are being traced just
before entering or exiting the kernel sections.
To implement the RCU synchronization, instead of using
synchronize_sched() the use of schedule_on_each_cpu() is performed. This
means that when a dynamically allocated ftrace_ops, or a control ops is
being unregistered, all CPUs must be touched and execute a ftrace_sync()
stub function via the work queues. This will rip CPUs out from idle or
in dynamic tick mode. This only happens when a user disables perf
function tracing or other dynamically allocated function tracers, but it
allows us to continue to debug RCU and context tracking with function
tracing.
Link: http://lkml.kernel.org/r/1369785676.15552.55.camel@gandalf.local.home
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/lglock.c')
0 files changed, 0 insertions, 0 deletions