diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/cpu/perf_counter.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c index 5a7f718eb1e1..886dcf334bc3 100644 --- a/arch/x86/kernel/cpu/perf_counter.c +++ b/arch/x86/kernel/cpu/perf_counter.c | |||
@@ -286,11 +286,8 @@ static int __hw_perf_counter_init(struct perf_counter *counter) | |||
286 | hwc->nmi = 1; | 286 | hwc->nmi = 1; |
287 | } | 287 | } |
288 | 288 | ||
289 | hwc->irq_period = hw_event->irq_period; | 289 | atomic64_set(&hwc->period_left, |
290 | if ((s64)hwc->irq_period <= 0 || hwc->irq_period > x86_pmu.max_period) | 290 | min(x86_pmu.max_period, hwc->irq_period)); |
291 | hwc->irq_period = x86_pmu.max_period; | ||
292 | |||
293 | atomic64_set(&hwc->period_left, hwc->irq_period); | ||
294 | 291 | ||
295 | /* | 292 | /* |
296 | * Raw event type provide the config in the event structure | 293 | * Raw event type provide the config in the event structure |
@@ -458,7 +455,7 @@ x86_perf_counter_set_period(struct perf_counter *counter, | |||
458 | struct hw_perf_counter *hwc, int idx) | 455 | struct hw_perf_counter *hwc, int idx) |
459 | { | 456 | { |
460 | s64 left = atomic64_read(&hwc->period_left); | 457 | s64 left = atomic64_read(&hwc->period_left); |
461 | s64 period = hwc->irq_period; | 458 | s64 period = min(x86_pmu.max_period, hwc->irq_period); |
462 | int err; | 459 | int err; |
463 | 460 | ||
464 | /* | 461 | /* |