diff mbox

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

Message ID 1483434793-1814-1-git-send-email-maddy@linux.vnet.ibm.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

maddy Jan. 3, 2017, 9:13 a.m. UTC
"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.

Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
 arch/powerpc/perf/power9-pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Ellerman Jan. 17, 2017, 5:46 a.m. UTC | #1
Madhavan Srinivasan <maddy@linux.vnet.ibm.com> writes:

> "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
maddy Jan. 17, 2017, 6:18 a.m. UTC | #2
On Tuesday 17 January 2017 11:16 AM, Michael Ellerman wrote:
> Madhavan Srinivasan <maddy@linux.vnet.ibm.com> writes:
>
>> "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.

>
> 	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?
OK, Will add a new flag. How about "PPMU_DISBALE_USE_SIAR"?

> 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

> cheers
>
diff mbox

Patch

diff --git a/arch/powerpc/perf/power9-pmu.c b/arch/powerpc/perf/power9-pmu.c
index a46ef29e50e7..06b7e8ebd29a 100644
--- a/arch/powerpc/perf/power9-pmu.c
+++ b/arch/powerpc/perf/power9-pmu.c
@@ -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,