Frederic Weisbecker
444a2a3bcd
tracing, perf_events: Protect the buffer from recursion in perf
...
While tracing using events with perf, if one enables the
lockdep:lock_acquire event, it will infect every other perf
trace events.
Basically, you can enable whatever set of trace events through
perf but if this event is part of the set, the only result we
can get is a long list of lock_acquire events of rcu read lock,
and only that.
This is because of a recursion inside perf.
1) When a trace event is triggered, it will fill a per cpu
buffer and submit it to perf.
2) Perf will commit this event but will also protect some data
using rcu_read_lock
3) A recursion appears: rcu_read_lock triggers a lock_acquire
event that will fill the per cpu event and then submit the
buffer to perf.
4) Perf detects a recursion and ignores it
5) Perf continues its work on the previous event, but its buffer
has been overwritten by the lock_acquire event, it has then
been turned into a lock_acquire event of rcu read lock
Such scenario also happens with lock_release with
rcu_read_unlock().
We could turn the rcu_read_lock() into __rcu_read_lock() to drop
the lock debugging from perf fast path, but that would make us
lose the rcu debugging and that doesn't prevent from other
possible kind of recursion from perf in the future.
This patch adds a recursion protection based on a counter on the
perf trace per cpu buffers to solve the problem.
-v2: Fixed lost whitespace, added reviewed-by tag
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Reviewed-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Jason Baron <jbaron@redhat.com>
LKML-Reference: <1257477185-7838-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-11-08 10:31:42 +01:00
..
gcov
microblaze: Enable GCOV_PROFILE_ALL
2009-09-21 14:29:21 +02:00
irq
headers: remove sched.h from interrupt.h
2009-10-11 11:20:58 -07:00
power
headers: utsname.h redux
2009-09-23 18:13:10 -07:00
time
headers: remove sched.h from interrupt.h
2009-10-11 11:20:58 -07:00
trace
tracing, perf_events: Protect the buffer from recursion in perf
2009-11-08 10:31:42 +01:00
.gitignore
acct.c
bsdacct: switch credentials for writing to the accounting file
2009-08-24 11:33:40 +10:00
async.c
audit.c
Audit: send signal info if selinux is disabled
2009-09-24 03:50:26 -04:00
audit.h
audit_tree.c
audit_watch.c
Audit: reorganize struct audit_watch to save 8 bytes
2009-09-24 03:50:25 -04:00
auditfilter.c
auditsc.c
Audit: rearrange audit_context to save 16 bytes per struct
2009-09-24 03:50:26 -04:00
backtracetest.c
bounds.c
capability.c
cgroup.c
cgroup: catch bad css refcnt at css_put
2009-10-01 16:11:12 -07:00
cgroup_freezer.c
cgroups: let ss->can_attach and ss->attach do whole threadgroups at a time
2009-09-24 07:20:58 -07:00
compat.c
configs.c
cpu.c
Merge branch 'x86-pat-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-09-15 09:19:38 -07:00
cpuset.c
cgroups: let ss->can_attach and ss->attach do whole threadgroups at a time
2009-09-24 07:20:58 -07:00
cred-internals.h
cred.c
creds_are_invalid() needs to be exported for use by modules:
2009-09-23 11:02:26 -07:00
delayacct.c
headers: taskstats_kern.h trim
2009-09-18 09:48:52 -07:00
dma.c
exec_domain.c
exit.c
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-10-08 12:16:35 -07:00
extable.c
fork.c
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-10-08 12:16:35 -07:00
freezer.c
sched: fix nr_uninterruptible accounting of frozen tasks really
2009-07-18 14:19:53 +02:00
futex.c
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-10-08 12:16:35 -07:00
futex_compat.c
futex: Fix compat_futex to be same as futex for REQUEUE_PI
2009-08-10 15:41:12 +02:00
groups.c
hrtimer.c
Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-10-05 12:04:16 -07:00
hung_task.c
sysctl: remove "struct file *" argument of ->proc_handler
2009-09-24 07:21:04 -07:00
itimer.c
itimers: Add tracepoints for itimer
2009-08-29 14:10:07 +02:00
kallsyms.c
kallsyms: use new arch_is_kernel_text()
2009-09-23 07:39:30 -07:00
Kconfig.freezer
Kconfig.hz
Kconfig.preempt
kexec.c
kexec: fix omitting offset in extended crashkernel syntax
2009-07-29 19:10:34 -07:00
kfifo.c
kfifo: Use "const" definitions
2009-09-19 13:13:17 -07:00
kgdb.c
kmod.c
Revert "kmod: fix race in usermodehelper code"
2009-09-23 18:12:10 -07:00
kprobes.c
Merge commit 'v2.6.32-rc5' into perf/probes
2009-10-17 09:58:25 +02:00
ksysfs.c
kthread.c
sched: Keep kthreads at default priority
2009-09-09 17:30:06 +02:00
latencytop.c
lockdep.c
lockdep: Use cpu_clock() for lockstat
2009-10-09 15:56:44 +02:00
lockdep_internals.h
lockdep: BFS cleanup
2009-07-24 10:53:29 +02:00
lockdep_proc.c
seq_file: constify seq_operations
2009-09-23 07:39:29 -07:00
lockdep_states.h
Makefile
cgroups: move the cgroup debug subsys into cgroup.c to access internal state
2009-09-24 07:20:57 -07:00
module.c
module: fix up CONFIG_KALLSYMS=n build.
2009-10-01 16:11:11 -07:00
mutex-debug.c
headers: remove sched.h from interrupt.h
2009-10-11 11:20:58 -07:00
mutex-debug.h
mutex.c
mutex.h
notifier.c
kprobes: Fix to add __kprobes to notify_die
2009-08-30 03:08:26 +02:00
ns_cgroup.c
cgroups: let ss->can_attach and ss->attach do whole threadgroups at a time
2009-09-24 07:20:58 -07:00
nsproxy.c
panic.c
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-10-08 12:16:35 -07:00
params.c
param: allow whitespace as kernel parameter separator
2009-09-25 00:32:58 +09:30
perf_event.c
Merge branch 'perf/urgent' into perf/core
2009-10-20 07:51:44 +02:00
pid.c
mm: also use alloc_large_system_hash() for the PID hash table
2009-09-22 07:17:38 -07:00
pid_namespace.c
pidns: deny CLONE_PARENT|CLONE_NEWPID combination
2009-09-24 07:21:04 -07:00
pm_qos_params.c
posix-cpu-timers.c
itimers: Add tracepoints for itimer
2009-08-29 14:10:07 +02:00
posix-timers.c
time: Introduce CLOCK_REALTIME_COARSE
2009-08-21 21:43:46 +02:00
printk.c
printk: add printk_delay to make messages readable for some scenarios
2009-09-23 07:39:28 -07:00
profile.c
kernel/profile.c: Switch /proc/irq/prof_cpu_mask to seq_file
2009-09-20 20:15:40 +02:00
ptrace.c
ptrace: __ptrace_detach: do __wake_up_parent() if we reap the tracee
2009-09-24 07:20:59 -07:00
rcupdate.c
rcu: Move rcu_barrier() to rcutree
2009-10-07 08:11:20 +02:00
rcutorture.c
rcu: Clean up code to address Ingo's checkpatch feedback
2009-09-23 19:46:30 +02:00
rcutree.c
rcu: Place root rcu_node structure in separate lockdep class
2009-10-07 08:11:21 +02:00
rcutree.h
rcu: Make hot-unplugged CPU relinquish its own RCU callbacks
2009-10-07 08:11:20 +02:00
rcutree_plugin.h
rcu: Make hot-unplugged CPU relinquish its own RCU callbacks
2009-10-07 08:11:20 +02:00
rcutree_trace.c
rcu: Make hot-unplugged CPU relinquish its own RCU callbacks
2009-10-07 08:11:20 +02:00
relay.c
const: mark struct vm_struct_operations
2009-09-27 11:39:25 -07:00
res_counter.c
memcg: some modification to softlimit under hierarchical memory reclaim.
2009-10-01 16:11:13 -07:00
resource.c
walk system ram range
2009-09-23 07:39:41 -07:00
rtmutex-debug.c
rtmutex-debug.h
rtmutex-tester.c
rtmutex.c
rtmutex: Avoid deadlock in rt_mutex_start_proxy_lock()
2009-08-06 05:50:21 +02:00
rtmutex.h
rtmutex_common.h
rwsem.c
sched.c
Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-10-14 15:25:04 -07:00
sched_clock.c
sched_clock: Fix atomicity/continuity bug by using cmpxchg64()
2009-09-30 22:56:10 +02:00
sched_cpupri.c
sched: Add new prio to cpupri before removing old prio
2009-08-02 14:26:09 +02:00
sched_cpupri.h
sched_debug.c
sched: Add new wakeup preemption mode: WAKEUP_RUNNING
2009-09-17 10:17:25 +02:00
sched_fair.c
sysctl: remove "struct file *" argument of ->proc_handler
2009-09-24 07:21:04 -07:00
sched_features.h
sched: Add new wakeup preemption mode: WAKEUP_RUNNING
2009-09-17 10:17:25 +02:00
sched_idletask.c
sched: Simplify sys_sched_rr_get_interval() system call
2009-09-21 09:53:55 +02:00
sched_rt.c
sched: Simplify sys_sched_rr_get_interval() system call
2009-09-21 09:53:55 +02:00
sched_stats.h
seccomp.c
semaphore.c
signal.c
signals: inline __fatal_signal_pending
2009-09-24 07:21:01 -07:00
slow-work.c
sysctl: remove "struct file *" argument of ->proc_handler
2009-09-24 07:21:04 -07:00
smp.c
cpumask: remove arch_send_call_function_ipi
2009-09-24 09:34:47 +09:30
softirq.c
softirq: add BLOCK_IOPOLL to softirq_to_name
2009-09-17 15:53:44 -04:00
softlockup.c
sysctl: remove "struct file *" argument of ->proc_handler
2009-09-24 07:21:04 -07:00
spinlock.c
locking: Allow arch-inlined spinlocks
2009-08-31 18:08:50 +02:00
srcu.c
stacktrace.c
stop_machine.c
sys.c
Merge branch 'hwpoison' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6
2009-09-24 07:53:22 -07:00
sys_ni.c
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
2009-09-24 15:13:11 -07:00
sysctl.c
Merge branch 'hwpoison' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6
2009-09-24 07:53:22 -07:00
sysctl_check.c
taskstats.c
genetlink: make netns aware
2009-07-12 14:03:27 -07:00
test_kprobes.c
time.c
time: Prevent 32 bit overflow with set_normalized_timespec()
2009-09-15 10:17:30 +02:00
timeconst.pl
timer.c
Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-09-23 09:46:15 -07:00
tracepoint.c
trivial: fix typo "to to" in multiple files
2009-09-21 15:14:55 +02:00
tsacct.c
uid16.c
headers: utsname.h redux
2009-09-23 18:13:10 -07:00
up.c
user.c
user_namespace.c
utsname.c
utsname_sysctl.c
sysctl: remove "struct file *" argument of ->proc_handler
2009-09-24 07:21:04 -07:00
wait.c
locking, sched: Give waitqueue spinlocks their own lockdep classes
2009-08-10 14:43:09 +02:00
workqueue.c
workqueue: add 'flush_delayed_work()' to run and wait for delayed work
2009-10-14 15:11:35 -07:00