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

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE3559d

3 messages, 2 authors, 2017-01-17 · open the first message on its own page

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

From: Madhavan Srinivasan <hidden>
Date: 2017-01-03 09:14:21

"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 <redacted>
---
 arch/powerpc/perf/power9-pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
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,
-- 
2.7.4

Re: [PATCH] powerpc/perf: use MSR to report privilege level on P9 DD1

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2017-01-17 05:46:51

Madhavan Srinivasan [off-list ref] 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

Re: [PATCH] powerpc/perf: use MSR to report privilege level on P9 DD1

From: Madhavan Srinivasan <hidden>
Date: 2017-01-17 06:18:42


On Tuesday 17 January 2017 11:16 AM, Michael Ellerman wrote:
Madhavan Srinivasan [off-list ref] writes:
quoted
"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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help