aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2012-04-02 14:19:14 -0400
committerIngo Molnar <mingo@kernel.org>2012-05-09 09:23:15 -0400
commitfc006cf7cc7471e1bdf34e40111971e03622af6c (patch)
tree02845a28bbbddb255d3e2c09b281d7f1f1213563 /arch
parent98112d2e957e0d348f06d8a40f2f720204a70b55 (diff)
perf/x86-ibs: Trigger overflow if remaining period is too small
There are cases where the remaining period is smaller than the minimal possible value. In this case the counter is restarted with the minimal period. This is of no use as the interrupt handler will trigger immediately again and most likely hits itself. This biases the results. So, if the remaining period is within the min range, we better do not restart the counter and instead trigger the overflow. Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1333390758-10893-9-git-send-email-robert.richter@amd.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_ibs.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
index 29a1bffe1dfb..3e32908292a7 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
@@ -78,16 +78,13 @@ perf_event_set_period(struct hw_perf_event *hwc, u64 min, u64 max, u64 *hw_perio
78 overflow = 1; 78 overflow = 1;
79 } 79 }
80 80
81 if (unlikely(left <= 0)) { 81 if (unlikely(left < (s64)min)) {
82 left += period; 82 left += period;
83 local64_set(&hwc->period_left, left); 83 local64_set(&hwc->period_left, left);
84 hwc->last_period = period; 84 hwc->last_period = period;
85 overflow = 1; 85 overflow = 1;
86 } 86 }
87 87
88 if (unlikely(left < min))
89 left = min;
90
91 if (left > max) 88 if (left > max)
92 left = max; 89 left = max;
93 90