diff options
Diffstat (limited to 'arch/x86/kernel/cpu/perf_event.c')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 9757b96f15f5..b68c4fb7a944 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -983,14 +983,8 @@ static int x86_pmu_start(struct perf_event *event) | |||
983 | 983 | ||
984 | static void x86_pmu_unthrottle(struct perf_event *event) | 984 | static void x86_pmu_unthrottle(struct perf_event *event) |
985 | { | 985 | { |
986 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | 986 | int ret = x86_pmu_start(event); |
987 | struct hw_perf_event *hwc = &event->hw; | 987 | WARN_ON_ONCE(ret); |
988 | |||
989 | if (WARN_ON_ONCE(hwc->idx >= X86_PMC_IDX_MAX || | ||
990 | cpuc->events[hwc->idx] != event)) | ||
991 | return; | ||
992 | |||
993 | x86_pmu.enable(event); | ||
994 | } | 988 | } |
995 | 989 | ||
996 | void perf_event_print_debug(void) | 990 | void perf_event_print_debug(void) |
@@ -1050,11 +1044,9 @@ static void x86_pmu_stop(struct perf_event *event) | |||
1050 | struct hw_perf_event *hwc = &event->hw; | 1044 | struct hw_perf_event *hwc = &event->hw; |
1051 | int idx = hwc->idx; | 1045 | int idx = hwc->idx; |
1052 | 1046 | ||
1053 | /* | 1047 | if (!__test_and_clear_bit(idx, cpuc->active_mask)) |
1054 | * Must be done before we disable, otherwise the nmi handler | 1048 | return; |
1055 | * could reenable again: | 1049 | |
1056 | */ | ||
1057 | __clear_bit(idx, cpuc->active_mask); | ||
1058 | x86_pmu.disable(event); | 1050 | x86_pmu.disable(event); |
1059 | 1051 | ||
1060 | /* | 1052 | /* |
@@ -1123,7 +1115,7 @@ static int x86_pmu_handle_irq(struct pt_regs *regs) | |||
1123 | continue; | 1115 | continue; |
1124 | 1116 | ||
1125 | if (perf_event_overflow(event, 1, &data, regs)) | 1117 | if (perf_event_overflow(event, 1, &data, regs)) |
1126 | x86_pmu.disable(event); | 1118 | x86_pmu_stop(event); |
1127 | } | 1119 | } |
1128 | 1120 | ||
1129 | if (handled) | 1121 | if (handled) |