Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/oprofile: Fix error in oprofile power7_marked_instr_event() function

The calculation for the left shift of the mask OPROFILE_PM_PMCSEL_MSK has an
error. The calculation is should be to shift left by (max_cntrs - cntr) times
the width of the pmsel field width. However, the #define OPROFILE_MAX_PMC_NUM
was used instead of OPROFILE_PMSEL_FIELD_WIDTH. This patch fixes the
calculation.

Signed-off-by: Carl Love <cel@us.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Carl E. Love and committed by
Benjamin Herrenschmidt
46ed7a76 72640d88

+1 -1
+1 -1
arch/powerpc/oprofile/op_model_power4.c
··· 52 52 for (pmc = 0; pmc < 4; pmc++) { 53 53 psel = mmcr1 & (OPROFILE_PM_PMCSEL_MSK 54 54 << (OPROFILE_MAX_PMC_NUM - pmc) 55 - * OPROFILE_MAX_PMC_NUM); 55 + * OPROFILE_PMSEL_FIELD_WIDTH); 56 56 psel = (psel >> ((OPROFILE_MAX_PMC_NUM - pmc) 57 57 * OPROFILE_PMSEL_FIELD_WIDTH)) & ~1ULL; 58 58 unit = mmcr1 & (OPROFILE_PM_UNIT_MSK