diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2013-10-02 04:04:06 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-10-03 03:25:38 -0400 |
commit | a53b27b3abeef406de92a2bb0ceb6fb4c3fb8fc4 (patch) | |
tree | 6fb7ab29d0882b487b2f648f96a3d1c74454a1fc /arch | |
parent | e82b89a6f19bae73fb064d1b3dd91fcefbb478f4 (diff) |
powerpc/perf: Fix handling of FAB events
Commit 4df4899 "Add power8 EBB support" included a bug in the handling
of the FAB_CRESP_MATCH and FAB_TYPE_MATCH fields.
These values are pulled out of the event code using EVENT_THR_CTL_SHIFT,
however we were then or'ing that value directly into MMCR1.
This meant we were failing to set the FAB fields correctly, and also
potentially corrupting the value for PMC4SEL. Leading to no counts for
the FAB events and incorrect counts for PMC4.
The fix is simply to shift left the FAB value correctly before or'ing it
with MMCR1.
Reported-by: Sooraj Ravindran Nair <soonair3@in.ibm.com>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Cc: <stable@vger.kernel.org> # 3.10+
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/perf/power8-pmu.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c index 2ee4a707f0df..a3f7abd2f13f 100644 --- a/arch/powerpc/perf/power8-pmu.c +++ b/arch/powerpc/perf/power8-pmu.c | |||
@@ -199,6 +199,7 @@ | |||
199 | #define MMCR1_UNIT_SHIFT(pmc) (60 - (4 * ((pmc) - 1))) | 199 | #define MMCR1_UNIT_SHIFT(pmc) (60 - (4 * ((pmc) - 1))) |
200 | #define MMCR1_COMBINE_SHIFT(pmc) (35 - ((pmc) - 1)) | 200 | #define MMCR1_COMBINE_SHIFT(pmc) (35 - ((pmc) - 1)) |
201 | #define MMCR1_PMCSEL_SHIFT(pmc) (24 - (((pmc) - 1)) * 8) | 201 | #define MMCR1_PMCSEL_SHIFT(pmc) (24 - (((pmc) - 1)) * 8) |
202 | #define MMCR1_FAB_SHIFT 36 | ||
202 | #define MMCR1_DC_QUAL_SHIFT 47 | 203 | #define MMCR1_DC_QUAL_SHIFT 47 |
203 | #define MMCR1_IC_QUAL_SHIFT 46 | 204 | #define MMCR1_IC_QUAL_SHIFT 46 |
204 | 205 | ||
@@ -388,8 +389,8 @@ static int power8_compute_mmcr(u64 event[], int n_ev, | |||
388 | * the threshold bits are used for the match value. | 389 | * the threshold bits are used for the match value. |
389 | */ | 390 | */ |
390 | if (event_is_fab_match(event[i])) { | 391 | if (event_is_fab_match(event[i])) { |
391 | mmcr1 |= (event[i] >> EVENT_THR_CTL_SHIFT) & | 392 | mmcr1 |= ((event[i] >> EVENT_THR_CTL_SHIFT) & |
392 | EVENT_THR_CTL_MASK; | 393 | EVENT_THR_CTL_MASK) << MMCR1_FAB_SHIFT; |
393 | } else { | 394 | } else { |
394 | val = (event[i] >> EVENT_THR_CTL_SHIFT) & EVENT_THR_CTL_MASK; | 395 | val = (event[i] >> EVENT_THR_CTL_SHIFT) & EVENT_THR_CTL_MASK; |
395 | mmcra |= val << MMCRA_THR_CTL_SHIFT; | 396 | mmcra |= val << MMCRA_THR_CTL_SHIFT; |