diff options
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 4d98789b0664..70d6d8fc2411 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -642,21 +642,24 @@ static void x86_pmu_disable(struct pmu *pmu) | |||
642 | x86_pmu.disable_all(); | 642 | x86_pmu.disable_all(); |
643 | } | 643 | } |
644 | 644 | ||
645 | static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc, | ||
646 | u64 enable_mask) | ||
647 | { | ||
648 | wrmsrl(hwc->config_base + hwc->idx, hwc->config | enable_mask); | ||
649 | } | ||
650 | |||
645 | static void x86_pmu_enable_all(int added) | 651 | static void x86_pmu_enable_all(int added) |
646 | { | 652 | { |
647 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | 653 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); |
648 | int idx; | 654 | int idx; |
649 | 655 | ||
650 | for (idx = 0; idx < x86_pmu.num_counters; idx++) { | 656 | for (idx = 0; idx < x86_pmu.num_counters; idx++) { |
651 | struct perf_event *event = cpuc->events[idx]; | 657 | struct hw_perf_event *hwc = &cpuc->events[idx]->hw; |
652 | u64 val; | ||
653 | 658 | ||
654 | if (!test_bit(idx, cpuc->active_mask)) | 659 | if (!test_bit(idx, cpuc->active_mask)) |
655 | continue; | 660 | continue; |
656 | 661 | ||
657 | val = event->hw.config; | 662 | __x86_pmu_enable_event(hwc, ARCH_PERFMON_EVENTSEL_ENABLE); |
658 | val |= ARCH_PERFMON_EVENTSEL_ENABLE; | ||
659 | wrmsrl(x86_pmu.eventsel + idx, val); | ||
660 | } | 663 | } |
661 | } | 664 | } |
662 | 665 | ||
@@ -915,12 +918,6 @@ static void x86_pmu_enable(struct pmu *pmu) | |||
915 | x86_pmu.enable_all(added); | 918 | x86_pmu.enable_all(added); |
916 | } | 919 | } |
917 | 920 | ||
918 | static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc, | ||
919 | u64 enable_mask) | ||
920 | { | ||
921 | wrmsrl(hwc->config_base + hwc->idx, hwc->config | enable_mask); | ||
922 | } | ||
923 | |||
924 | static inline void x86_pmu_disable_event(struct perf_event *event) | 921 | static inline void x86_pmu_disable_event(struct perf_event *event) |
925 | { | 922 | { |
926 | struct hw_perf_event *hwc = &event->hw; | 923 | struct hw_perf_event *hwc = &event->hw; |