]>
Commit | Line | Data |
---|---|---|
a65d4bac GKH |
1 | From foo@baz Sat Jul 28 10:25:26 CEST 2018 |
2 | From: Kan Liang <kan.liang@intel.com> | |
3 | Date: Thu, 3 May 2018 11:25:08 -0700 | |
4 | Subject: perf/x86/intel/uncore: Correct fixed counter index check in generic code | |
5 | ||
6 | From: Kan Liang <kan.liang@intel.com> | |
7 | ||
8 | [ Upstream commit 4749f8196452eeb73cf2086a6a9705bae479d33d ] | |
9 | ||
10 | There is no index which is bigger than UNCORE_PMC_IDX_FIXED. The only | |
11 | exception is client IMC uncore, which has been specially handled. | |
12 | For generic code, it is not correct to use >= to check fixed counter. | |
13 | The code quality issue will bring problem when a new counter index is | |
14 | introduced. | |
15 | ||
16 | Signed-off-by: Kan Liang <kan.liang@intel.com> | |
17 | Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> | |
18 | Reviewed-by: Thomas Gleixner <tglx@linutronix.de> | |
19 | Cc: Linus Torvalds <torvalds@linux-foundation.org> | |
20 | Cc: Peter Zijlstra <peterz@infradead.org> | |
21 | Cc: acme@kernel.org | |
22 | Cc: eranian@google.com | |
23 | Link: http://lkml.kernel.org/r/1525371913-10597-3-git-send-email-kan.liang@intel.com | |
24 | Signed-off-by: Ingo Molnar <mingo@kernel.org> | |
25 | Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> | |
26 | Signed-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); |