powerpc/perf: Fix instruction address sampling on 970 and Power4
PATCH 1/1 powerpc/perf: Fix instruction address sampling on 970 and Power4
970 and Power4 don't support "continuous sampling" which means that when we aren't in marked instruction sampling mode (marked events), SIAR isn't updated with the last instruction sampled before the perf interrupt. On those processors, we must thus use the exception SRR0 value as the sampled instruction pointer.
Those processors also don't support the SIPR and SIHV bits in MMCRA which means we need some kind of heuristic to decide if SIAR values represent kernel or user addresses.
Signed-off-by Benjamin Herrenschmidt <[email protected]>
--- arch/powerpc/include/asm/perf_event_server.h | 2 + arch/powerpc/perf/core-book3s.c | 46 +++++++++++++++++++++++--- arch/powerpc/perf/power4-pmu.c | 1 + arch/powerpc/perf/ppc970-pmu.c | 1 + 4 files changed, 45 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/perf_event_server.h +2 -0
@@ -47,6 +47,8 @@ struct power_pmu {*/ #define PPMU_LIMITED_PMC5_6 1/* PMC5/6 have limited function */ #define PPMU_ALT_SIPR 2/* uses alternate posn for SIPR/HV */ +#define PPMU_NO_SIPR 4/* no SIPR/HV in MMCRA at all */ +#define PPMU_NO_CONT_SAMPLING 8/* no continuous sampling */ /* * Values for flags to get_alternatives()
arch/powerpc/perf/core-book3s.c +41 -5
68 lines not on this page · raw message
arch/powerpc/perf/power4-pmu.c +1 -0
@@ -607,6 +607,7 @@ static struct power_pmu power4_pmu = { .n_generic = ARRAY_SIZE(p4_generic_events), .generic_events = p4_generic_events, .cache_events = &power4_cache_events, + .flags = PPMU_NO_SIPR | PPMU_NO_CONT_SAMPLING, };static int __init init_power4_pmu (void )
arch/powerpc/perf/ppc970-pmu.c +1 -0
@@ -487,6 +487,7 @@ static struct power_pmu ppc970_pmu = { .n_generic = ARRAY_SIZE(ppc970_generic_events), .generic_events = ppc970_generic_events, .cache_events = &ppc970_cache_events, + .flags = PPMU_NO_SIPR | PPMU_NO_CONT_SAMPLING, };static int __init init_ppc970_pmu (void )