Commit 7abb840b authored by Michael Neuling's avatar Michael Neuling Committed by Benjamin Herrenschmidt

powerpc/perf_events: Fix priority of MSR HV vs PR bits

The architecture defines that if MSR PR is set we are in problem state
irrespective of the HV bit.  This fixes perf events to reflect this.

Also, on bare metal systems, samples taken in Linux will now be reported
as kernel rather than hypervisor.
Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
CC: paulus@samba.org
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 964fe080
...@@ -116,20 +116,23 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp) ...@@ -116,20 +116,23 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp)
static inline u32 perf_get_misc_flags(struct pt_regs *regs) static inline u32 perf_get_misc_flags(struct pt_regs *regs)
{ {
unsigned long mmcra = regs->dsisr; unsigned long mmcra = regs->dsisr;
unsigned long sihv = MMCRA_SIHV;
unsigned long sipr = MMCRA_SIPR;
if (TRAP(regs) != 0xf00) if (TRAP(regs) != 0xf00)
return 0; /* not a PMU interrupt */ return 0; /* not a PMU interrupt */
if (ppmu->flags & PPMU_ALT_SIPR) { if (ppmu->flags & PPMU_ALT_SIPR) {
if (mmcra & POWER6_MMCRA_SIHV) sihv = POWER6_MMCRA_SIHV;
return PERF_RECORD_MISC_HYPERVISOR; sipr = POWER6_MMCRA_SIPR;
return (mmcra & POWER6_MMCRA_SIPR) ?
PERF_RECORD_MISC_USER : PERF_RECORD_MISC_KERNEL;
} }
if (mmcra & MMCRA_SIHV)
/* PR has priority over HV, so order below is important */
if (mmcra & sipr)
return PERF_RECORD_MISC_USER;
if ((mmcra & sihv) && (freeze_events_kernel != MMCR0_FCHV))
return PERF_RECORD_MISC_HYPERVISOR; return PERF_RECORD_MISC_HYPERVISOR;
return (mmcra & MMCRA_SIPR) ? PERF_RECORD_MISC_USER : return PERF_RECORD_MISC_KERNEL;
PERF_RECORD_MISC_KERNEL;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment