aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/perf_event.c
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2009-10-14 15:32:15 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-10-27 01:42:38 -0400
commit7abb840b496f834a71a8943bb189683da320f047 (patch)
tree6444e23443d1ddd9c5d7aa7198e6d8c401dda0c0 /arch/powerpc/kernel/perf_event.c
parent964fe080d94db82a3268443e9b9ece4c60246414 (diff)
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: Michael Neuling <mikey@neuling.org> CC: paulus@samba.org Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/perf_event.c')
-rw-r--r--arch/powerpc/kernel/perf_event.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
index bbcbae183e92..87f1663584b0 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -116,20 +116,23 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp)
116static inline u32 perf_get_misc_flags(struct pt_regs *regs) 116static inline u32 perf_get_misc_flags(struct pt_regs *regs)
117{ 117{
118 unsigned long mmcra = regs->dsisr; 118 unsigned long mmcra = regs->dsisr;
119 unsigned long sihv = MMCRA_SIHV;
120 unsigned long sipr = MMCRA_SIPR;
119 121
120 if (TRAP(regs) != 0xf00) 122 if (TRAP(regs) != 0xf00)
121 return 0; /* not a PMU interrupt */ 123 return 0; /* not a PMU interrupt */
122 124
123 if (ppmu->flags & PPMU_ALT_SIPR) { 125 if (ppmu->flags & PPMU_ALT_SIPR) {
124 if (mmcra & POWER6_MMCRA_SIHV) 126 sihv = POWER6_MMCRA_SIHV;
125 return PERF_RECORD_MISC_HYPERVISOR; 127 sipr = POWER6_MMCRA_SIPR;
126 return (mmcra & POWER6_MMCRA_SIPR) ?
127 PERF_RECORD_MISC_USER : PERF_RECORD_MISC_KERNEL;
128 } 128 }
129 if (mmcra & MMCRA_SIHV) 129
130 /* PR has priority over HV, so order below is important */
131 if (mmcra & sipr)
132 return PERF_RECORD_MISC_USER;
133 if ((mmcra & sihv) && (freeze_events_kernel != MMCR0_FCHV))
130 return PERF_RECORD_MISC_HYPERVISOR; 134 return PERF_RECORD_MISC_HYPERVISOR;
131 return (mmcra & MMCRA_SIPR) ? PERF_RECORD_MISC_USER : 135 return PERF_RECORD_MISC_KERNEL;
132 PERF_RECORD_MISC_KERNEL;
133} 136}
134 137
135/* 138/*