aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_event.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-09-10 06:51:54 -0400
committerIngo Molnar <mingo@elte.hu>2010-09-10 10:24:33 -0400
commitcee010ec5211b96f33c5c2208f5c14ebb04b634a (patch)
treedae35fd772d7e18db94b320a0ffc97e55e719d0e /kernel/perf_event.c
parent3b8fad3e2f5f69bfd8e42d099ca8582fb2342edf (diff)
perf: Ensure we call add_event_to_ctx() with the right locks held
Even though we call it from the inherit path, where the child is not yet accessible, we need to hold ctx->lock, add_event_to_ctx() assumes IRQs are disabled. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r--kernel/perf_event.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index eaf1c5de6dcc..f395fb4d9b74 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5913,6 +5913,7 @@ inherit_event(struct perf_event *parent_event,
5913 struct perf_event_context *child_ctx) 5913 struct perf_event_context *child_ctx)
5914{ 5914{
5915 struct perf_event *child_event; 5915 struct perf_event *child_event;
5916 unsigned long flags;
5916 5917
5917 /* 5918 /*
5918 * Instead of creating recursive hierarchies of events, 5919 * Instead of creating recursive hierarchies of events,
@@ -5957,7 +5958,9 @@ inherit_event(struct perf_event *parent_event,
5957 /* 5958 /*
5958 * Link it up in the child's context: 5959 * Link it up in the child's context:
5959 */ 5960 */
5961 raw_spin_lock_irqsave(&child_ctx->lock, flags);
5960 add_event_to_ctx(child_event, child_ctx); 5962 add_event_to_ctx(child_event, child_ctx);
5963 raw_spin_unlock_irqrestore(&child_ctx->lock, flags);
5961 5964
5962 /* 5965 /*
5963 * Get a reference to the parent filp - we will fput it 5966 * Get a reference to the parent filp - we will fput it