Skip to content

Commit 17cfccc

Browse files
Madhavan Srinivasanmpe
authored andcommitted
powerpc/perf: Fix thresholding counter data for unknown type
MMCRA[34:36] and MMCRA[38:44] expose the thresholding counter value. Thresholding counter can be used to count latency cycles such as load miss to reload. But threshold counter value is not relevant when the sampled instruction type is unknown or reserved. Patch to fix the thresholding counter value to zero when sampled instruction type is unknown or reserved. Fixes: 170a315('powerpc/perf: Support to export MMCRA[TEC*] field to userspace') Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 374f3f5 commit 17cfccc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/powerpc/perf/isa207-common.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,13 @@ void isa207_get_mem_weight(u64 *weight)
226226
u64 mmcra = mfspr(SPRN_MMCRA);
227227
u64 exp = MMCRA_THR_CTR_EXP(mmcra);
228228
u64 mantissa = MMCRA_THR_CTR_MANT(mmcra);
229+
u64 sier = mfspr(SPRN_SIER);
230+
u64 val = (sier & ISA207_SIER_TYPE_MASK) >> ISA207_SIER_TYPE_SHIFT;
229231

230-
*weight = mantissa << (2 * exp);
232+
if (val == 0 || val == 7)
233+
*weight = 0;
234+
else
235+
*weight = mantissa << (2 * exp);
231236
}
232237

233238
int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp)

0 commit comments

Comments
 (0)