diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-09-09 14:40:06 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-09-09 14:40:08 -0400 |
commit | 2aa61274efb9f532deaebc9812675a27af1994cb (patch) | |
tree | c2f70525dc152e0ddce60f1a3021473cc6a3f298 /kernel/perf_event.c | |
parent | 359d5106a2ff4ffa2ba129ec8f54743c341dabfc (diff) | |
parent | 5e11637e2c929e34dcc0fbbfb48bdb638937701a (diff) |
Merge branch 'perf/urgent' into perf/core
Merge reason: Pick up pending fixes before applying dependent new changes.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 0d38f27ad885..2d74f31220ad 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -402,11 +402,31 @@ static void perf_group_detach(struct perf_event *event) | |||
402 | } | 402 | } |
403 | } | 403 | } |
404 | 404 | ||
405 | static inline int | ||
406 | event_filter_match(struct perf_event *event) | ||
407 | { | ||
408 | return event->cpu == -1 || event->cpu == smp_processor_id(); | ||
409 | } | ||
410 | |||
405 | static void | 411 | static void |
406 | event_sched_out(struct perf_event *event, | 412 | event_sched_out(struct perf_event *event, |
407 | struct perf_cpu_context *cpuctx, | 413 | struct perf_cpu_context *cpuctx, |
408 | struct perf_event_context *ctx) | 414 | struct perf_event_context *ctx) |
409 | { | 415 | { |
416 | u64 delta; | ||
417 | /* | ||
418 | * An event which could not be activated because of | ||
419 | * filter mismatch still needs to have its timings | ||
420 | * maintained, otherwise bogus information is return | ||
421 | * via read() for time_enabled, time_running: | ||
422 | */ | ||
423 | if (event->state == PERF_EVENT_STATE_INACTIVE | ||
424 | && !event_filter_match(event)) { | ||
425 | delta = ctx->time - event->tstamp_stopped; | ||
426 | event->tstamp_running += delta; | ||
427 | event->tstamp_stopped = ctx->time; | ||
428 | } | ||
429 | |||
410 | if (event->state != PERF_EVENT_STATE_ACTIVE) | 430 | if (event->state != PERF_EVENT_STATE_ACTIVE) |
411 | return; | 431 | return; |
412 | 432 | ||
@@ -432,9 +452,7 @@ group_sched_out(struct perf_event *group_event, | |||
432 | struct perf_event_context *ctx) | 452 | struct perf_event_context *ctx) |
433 | { | 453 | { |
434 | struct perf_event *event; | 454 | struct perf_event *event; |
435 | 455 | int state = group_event->state; | |
436 | if (group_event->state != PERF_EVENT_STATE_ACTIVE) | ||
437 | return; | ||
438 | 456 | ||
439 | event_sched_out(group_event, cpuctx, ctx); | 457 | event_sched_out(group_event, cpuctx, ctx); |
440 | 458 | ||
@@ -444,7 +462,7 @@ group_sched_out(struct perf_event *group_event, | |||
444 | list_for_each_entry(event, &group_event->sibling_list, group_entry) | 462 | list_for_each_entry(event, &group_event->sibling_list, group_entry) |
445 | event_sched_out(event, cpuctx, ctx); | 463 | event_sched_out(event, cpuctx, ctx); |
446 | 464 | ||
447 | if (group_event->attr.exclusive) | 465 | if (state == PERF_EVENT_STATE_ACTIVE && group_event->attr.exclusive) |
448 | cpuctx->exclusive = 0; | 466 | cpuctx->exclusive = 0; |
449 | } | 467 | } |
450 | 468 | ||
@@ -5942,15 +5960,15 @@ perf_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) | |||
5942 | { | 5960 | { |
5943 | unsigned int cpu = (long)hcpu; | 5961 | unsigned int cpu = (long)hcpu; |
5944 | 5962 | ||
5945 | switch (action) { | 5963 | switch (action & ~CPU_TASKS_FROZEN) { |
5946 | 5964 | ||
5947 | case CPU_UP_PREPARE: | 5965 | case CPU_UP_PREPARE: |
5948 | case CPU_UP_PREPARE_FROZEN: | 5966 | case CPU_DOWN_FAILED: |
5949 | perf_event_init_cpu(cpu); | 5967 | perf_event_init_cpu(cpu); |
5950 | break; | 5968 | break; |
5951 | 5969 | ||
5970 | case CPU_UP_CANCELED: | ||
5952 | case CPU_DOWN_PREPARE: | 5971 | case CPU_DOWN_PREPARE: |
5953 | case CPU_DOWN_PREPARE_FROZEN: | ||
5954 | perf_event_exit_cpu(cpu); | 5972 | perf_event_exit_cpu(cpu); |
5955 | break; | 5973 | break; |
5956 | 5974 | ||