aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_event.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-04-02 13:37:50 -0400
committerIngo Molnar <mingo@elte.hu>2010-04-02 13:38:10 -0400
commitec5e61aabeac58670691bd0613388d16697d0d81 (patch)
tree59838509358f27334874b90756505785cde29b02 /kernel/perf_event.c
parent75ec5a245c7763c397f31ec8964d0a46c54a7386 (diff)
parent8bb39f9aa068262732fe44b965d7a6eb5a5a7d67 (diff)
Merge branch 'perf/urgent' into perf/core
Conflicts: arch/x86/kernel/cpu/perf_event.c Merge reason: Resolve the conflict, pick up fixes Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r--kernel/perf_event.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 455393e71cab..074ba2e036c8 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1164,11 +1164,9 @@ void perf_event_task_sched_out(struct task_struct *task,
1164 struct perf_event_context *ctx = task->perf_event_ctxp; 1164 struct perf_event_context *ctx = task->perf_event_ctxp;
1165 struct perf_event_context *next_ctx; 1165 struct perf_event_context *next_ctx;
1166 struct perf_event_context *parent; 1166 struct perf_event_context *parent;
1167 struct pt_regs *regs;
1168 int do_switch = 1; 1167 int do_switch = 1;
1169 1168
1170 regs = task_pt_regs(task); 1169 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);
1171 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, regs, 0);
1172 1170
1173 if (likely(!ctx || !cpuctx->task_ctx)) 1171 if (likely(!ctx || !cpuctx->task_ctx))
1174 return; 1172 return;
@@ -3382,15 +3380,23 @@ static void perf_event_task_output(struct perf_event *event,
3382 struct perf_task_event *task_event) 3380 struct perf_task_event *task_event)
3383{ 3381{
3384 struct perf_output_handle handle; 3382 struct perf_output_handle handle;
3385 int size;
3386 struct task_struct *task = task_event->task; 3383 struct task_struct *task = task_event->task;
3387 int ret; 3384 unsigned long flags;
3385 int size, ret;
3386
3387 /*
3388 * If this CPU attempts to acquire an rq lock held by a CPU spinning
3389 * in perf_output_lock() from interrupt context, it's game over.
3390 */
3391 local_irq_save(flags);
3388 3392
3389 size = task_event->event_id.header.size; 3393 size = task_event->event_id.header.size;
3390 ret = perf_output_begin(&handle, event, size, 0, 0); 3394 ret = perf_output_begin(&handle, event, size, 0, 0);
3391 3395
3392 if (ret) 3396 if (ret) {
3397 local_irq_restore(flags);
3393 return; 3398 return;
3399 }
3394 3400
3395 task_event->event_id.pid = perf_event_pid(event, task); 3401 task_event->event_id.pid = perf_event_pid(event, task);
3396 task_event->event_id.ppid = perf_event_pid(event, current); 3402 task_event->event_id.ppid = perf_event_pid(event, current);
@@ -3401,6 +3407,7 @@ static void perf_event_task_output(struct perf_event *event,
3401 perf_output_put(&handle, task_event->event_id); 3407 perf_output_put(&handle, task_event->event_id);
3402 3408
3403 perf_output_end(&handle); 3409 perf_output_end(&handle);
3410 local_irq_restore(flags);
3404} 3411}
3405 3412
3406static int perf_event_task_match(struct perf_event *event) 3413static int perf_event_task_match(struct perf_event *event)