diff options
-rw-r--r-- | kernel/perf_counter.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 5ea0240adab2..ff166c11b69a 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -663,6 +663,7 @@ static void __perf_counter_enable(void *info) | |||
663 | struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context); | 663 | struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context); |
664 | struct perf_counter_context *ctx = counter->ctx; | 664 | struct perf_counter_context *ctx = counter->ctx; |
665 | struct perf_counter *leader = counter->group_leader; | 665 | struct perf_counter *leader = counter->group_leader; |
666 | unsigned long pmuflags; | ||
666 | unsigned long flags; | 667 | unsigned long flags; |
667 | int err; | 668 | int err; |
668 | 669 | ||
@@ -689,14 +690,18 @@ static void __perf_counter_enable(void *info) | |||
689 | if (leader != counter && leader->state != PERF_COUNTER_STATE_ACTIVE) | 690 | if (leader != counter && leader->state != PERF_COUNTER_STATE_ACTIVE) |
690 | goto unlock; | 691 | goto unlock; |
691 | 692 | ||
692 | if (!group_can_go_on(counter, cpuctx, 1)) | 693 | if (!group_can_go_on(counter, cpuctx, 1)) { |
693 | err = -EEXIST; | 694 | err = -EEXIST; |
694 | else if (counter == leader) | 695 | } else { |
695 | err = group_sched_in(counter, cpuctx, ctx, | 696 | pmuflags = hw_perf_save_disable(); |
696 | smp_processor_id()); | 697 | if (counter == leader) |
697 | else | 698 | err = group_sched_in(counter, cpuctx, ctx, |
698 | err = counter_sched_in(counter, cpuctx, ctx, | 699 | smp_processor_id()); |
699 | smp_processor_id()); | 700 | else |
701 | err = counter_sched_in(counter, cpuctx, ctx, | ||
702 | smp_processor_id()); | ||
703 | hw_perf_restore(pmuflags); | ||
704 | } | ||
700 | 705 | ||
701 | if (err) { | 706 | if (err) { |
702 | /* | 707 | /* |