aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-03-06 07:19:24 -0500
committerIngo Molnar <mingo@elte.hu>2010-03-10 07:22:30 -0500
commitc08053e627d23490a03431285b78b7a5b617fbad (patch)
tree351f16aa7677f1055e462ff87c0f7a5afc192e9b /arch/x86/kernel/cpu
parent34538ee77b39a12702e0f4c3ed9e8fa2dd5eb92c (diff)
perf, x86: Fix x86_pmu_start
pmu::start should undo pmu::stop, make it so. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: paulus@samba.org Cc: eranian@google.com Cc: robert.richter@amd.com Cc: fweisbec@gmail.com LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r--arch/x86/kernel/cpu/perf_event.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 01b16673742..9757b96f15f 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -785,6 +785,7 @@ static inline int match_prev_assignment(struct hw_perf_event *hwc,
785 hwc->last_tag == cpuc->tags[i]; 785 hwc->last_tag == cpuc->tags[i];
786} 786}
787 787
788static int x86_pmu_start(struct perf_event *event);
788static void x86_pmu_stop(struct perf_event *event); 789static void x86_pmu_stop(struct perf_event *event);
789 790
790void hw_perf_enable(void) 791void hw_perf_enable(void)
@@ -833,20 +834,10 @@ void hw_perf_enable(void)
833 event = cpuc->event_list[i]; 834 event = cpuc->event_list[i];
834 hwc = &event->hw; 835 hwc = &event->hw;
835 836
836 if (hwc->idx == -1) { 837 if (hwc->idx == -1)
837 x86_assign_hw_event(event, cpuc, i); 838 x86_assign_hw_event(event, cpuc, i);
838 x86_perf_event_set_period(event);
839 }
840 /*
841 * need to mark as active because x86_pmu_disable()
842 * clear active_mask and events[] yet it preserves
843 * idx
844 */
845 __set_bit(hwc->idx, cpuc->active_mask);
846 cpuc->events[hwc->idx] = event;
847 839
848 x86_pmu.enable(event); 840 x86_pmu_start(event);
849 perf_event_update_userpage(event);
850 } 841 }
851 cpuc->n_added = 0; 842 cpuc->n_added = 0;
852 perf_events_lapic_init(); 843 perf_events_lapic_init();
@@ -975,11 +966,17 @@ static int x86_pmu_enable(struct perf_event *event)
975 966
976static int x86_pmu_start(struct perf_event *event) 967static int x86_pmu_start(struct perf_event *event)
977{ 968{
978 if (event->hw.idx == -1) 969 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
970 int idx = event->hw.idx;
971
972 if (idx == -1)
979 return -EAGAIN; 973 return -EAGAIN;
980 974
981 x86_perf_event_set_period(event); 975 x86_perf_event_set_period(event);
976 cpuc->events[idx] = event;
977 __set_bit(idx, cpuc->active_mask);
982 x86_pmu.enable(event); 978 x86_pmu.enable(event);
979 perf_event_update_userpage(event);
983 980
984 return 0; 981 return 0;
985} 982}