Skip to contentSkip to conversation

powerpc/perf: use MSR to report privilege level on P9 DD1

PATCH Superseded Madhavan Srinivasan 2 participants 3 messages Jan 3, 2017 – Jan 17, 2017 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/perf: use MSR to report privilege level on P9 DD1

"use_siar" variable is primarily used for deciding the sampled address and the privilege level to be reported for a sample. perf_read_regs() function updates the "use_siar" and "regs->result" based on the pmu flags along with other checks. To force the use of MSR to report the privilege level and to use "regs->nip" to report the instruction pointer, set "PPMU_NO_CONT_SAMPLING" flag and remove "PPMU_HAS_SIER" from the ppmu->flags.

---
 arch/powerpc/perf/power9-pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/perf/power9-pmu.c +1 -1
index a46ef29e50e7..06b7e8ebd29a 100644
@@ -403,7 +403,7 @@ static struct power_pmu power9_isa207_pmu = {
 	.bhrb_filter_map	= power9_bhrb_filter_map,
 	.get_constraint		= isa207_get_constraint,
 	.disable_pmc		= isa207_disable_pmc,
-	.flags			= PPMU_HAS_SIER | PPMU_ARCH_207S,
+	.flags			= PPMU_NO_CONT_SAMPLING | PPMU_ARCH_207S,
 	.n_generic		= ARRAY_SIZE(power9_generic_events),
 	.generic_events		= power9_generic_events,
 	.cache_events		= &power9_cache_events,
Signature · 1 line
2.7.4
#1 lore raw
Quoted 7 lines · Madhavan Srinivasan

"use_siar" variable is primarily used for deciding the sampled address and the privilege level to be reported for a sample. perf_read_regs() function updates the "use_siar" and "regs->result" based on the pmu flags along with other checks. To force the use of MSR to report the privilege level and to use "regs->nip" to report the instruction pointer, set "PPMU_NO_CONT_SAMPLING" flag and remove "PPMU_HAS_SIER" from the ppmu->flags.

This still won't work for marked events AFAICS:

	if (TRAP(regs) != 0xf00)
		use_siar = 0;
	else if (marked)
		use_siar = 1;
	else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING))
		use_siar = 0;
	else if (!(ppmu->flags & PPMU_NO_SIPR) && regs_sipr(regs))
		use_siar = 0;
	else
		use_siar = 1;

So perhaps we just want a USE_SIAR flag?

And I don't see how HAS_SIER is related? Or is SIER broken too?

cheers

#2 lore raw
Quoted 10 lines · Michael Ellerman
Quoted 7 lines · Madhavan Srinivasan

"use_siar" variable is primarily used for deciding the sampled address and the privilege level to be reported for a sample. perf_read_regs() function updates the "use_siar" and "regs->result" based on the pmu flags along with other checks. To force the use of MSR to report the privilege level and to use "regs->nip" to report the instruction pointer, set "PPMU_NO_CONT_SAMPLING" flag and remove "PPMU_HAS_SIER" from the ppmu->flags.

This still won't work for marked events AFAICS:

nice catch. My bad. Did not try with the marked events when testing this patch.

Quoted 12 lines
	if (TRAP(regs) != 0xf00)
		use_siar = 0;
	else if (marked)
		use_siar = 1;
	else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING))
		use_siar = 0;
	else if (!(ppmu->flags & PPMU_NO_SIPR) && regs_sipr(regs))
		use_siar = 0;
	else
		use_siar = 1;
Quoted 1 line

So perhaps we just want a USE_SIAR flag?

OK, Will add a new flag. How about "PPMU_DISBALE_USE_SIAR"?

Quoted 1 line

And I don't see how HAS_SIER is related? Or is SIER broken too?

We dont see proper values in SIER for some samples and we use SIER (regs_sipr) to update the misc_flag.

Will fix the commit message.

Maddy

Quoted 2 lines

cheers