]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.60/perf-x86-intel-uncore-correct-fixed-counter-index-check-in-generic-code.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 4.14.60 / perf-x86-intel-uncore-correct-fixed-counter-index-check-in-generic-code.patch
CommitLineData
a65d4bac
GKH
1From foo@baz Sat Jul 28 10:25:26 CEST 2018
2From: Kan Liang <kan.liang@intel.com>
3Date: Thu, 3 May 2018 11:25:08 -0700
4Subject: perf/x86/intel/uncore: Correct fixed counter index check in generic code
5
6From: Kan Liang <kan.liang@intel.com>
7
8[ Upstream commit 4749f8196452eeb73cf2086a6a9705bae479d33d ]
9
10There is no index which is bigger than UNCORE_PMC_IDX_FIXED. The only
11exception is client IMC uncore, which has been specially handled.
12For generic code, it is not correct to use >= to check fixed counter.
13The code quality issue will bring problem when a new counter index is
14introduced.
15
16Signed-off-by: Kan Liang <kan.liang@intel.com>
17Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
18Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
19Cc: Linus Torvalds <torvalds@linux-foundation.org>
20Cc: Peter Zijlstra <peterz@infradead.org>
21Cc: acme@kernel.org
22Cc: eranian@google.com
23Link: http://lkml.kernel.org/r/1525371913-10597-3-git-send-email-kan.liang@intel.com
24Signed-off-by: Ingo Molnar <mingo@kernel.org>
25Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
26Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27---
28 arch/x86/events/intel/uncore.c | 2 +-
29 1 file changed, 1 insertion(+), 1 deletion(-)
30
31--- a/arch/x86/events/intel/uncore.c
32+++ b/arch/x86/events/intel/uncore.c
33@@ -218,7 +218,7 @@ void uncore_perf_event_update(struct int
34 u64 prev_count, new_count, delta;
35 int shift;
36
37- if (event->hw.idx >= UNCORE_PMC_IDX_FIXED)
38+ if (event->hw.idx == UNCORE_PMC_IDX_FIXED)
39 shift = 64 - uncore_fixed_ctr_bits(box);
40 else
41 shift = 64 - uncore_perf_ctr_bits(box);