diff options
author | Robert Richter <robert.richter@amd.com> | 2012-04-02 14:19:15 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-05-09 09:23:15 -0400 |
commit | 7caaf4d8241feecafb87919402b0a6dbb1b71d9e (patch) | |
tree | 010358e8d67b75dc11ba27221e221500ad0e4882 /arch/x86/kernel/cpu | |
parent | fc006cf7cc7471e1bdf34e40111971e03622af6c (diff) |
perf/x86-ibs: Extend hw period that triggers overflow
If the last hw period is too short we might hit the irq handler which
biases the results. Thus try to have a max last period that triggers
the sw 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-10-git-send-email-robert.richter@amd.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_amd_ibs.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c index 3e32908292a7..cb51a3e55870 100644 --- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c +++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c | |||
@@ -85,8 +85,19 @@ perf_event_set_period(struct hw_perf_event *hwc, u64 min, u64 max, u64 *hw_perio | |||
85 | overflow = 1; | 85 | overflow = 1; |
86 | } | 86 | } |
87 | 87 | ||
88 | if (left > max) | 88 | /* |
89 | left = max; | 89 | * If the hw period that triggers the sw overflow is too short |
90 | * we might hit the irq handler. This biases the results. | ||
91 | * Thus we shorten the next-to-last period and set the last | ||
92 | * period to the max period. | ||
93 | */ | ||
94 | if (left > max) { | ||
95 | left -= max; | ||
96 | if (left > max) | ||
97 | left = max; | ||
98 | else if (left < min) | ||
99 | left = min; | ||
100 | } | ||
90 | 101 | ||
91 | *hw_period = (u64)left; | 102 | *hw_period = (u64)left; |
92 | 103 | ||