aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/perf/core-book3s.c
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2012-06-25 21:02:15 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-07-10 05:18:43 -0400
commit5c093efa6f2dd07d45835be870a20ed3b05b6ef5 (patch)
tree3f089f5c5c4c2a6bc2633df1e3b4f28289361402 /arch/powerpc/perf/core-book3s.c
parent75382aa72f06823db7312ad069c3bae2eb3f8548 (diff)
powerpc/perf: Always use pt_regs for userspace samples
At the moment we always use the SIAR if the PMU supports continuous sampling. Unfortunately the SIAR and the PMU exception are not synchronised for non marked events so we can end up with callchains that dont make sense. The following patch checks the HV and PR bits for samples coming from userspace and always uses pt_regs for them. Userspace will never have interrupts off so there is no real advantage to using the SIAR for non marked events in userspace. I had experimented with a patch that did a similar thing for kernel samples but we lost a significant amount of information. I was unable to profile any of our early exception code for example. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/perf/core-book3s.c')
-rw-r--r--arch/powerpc/perf/core-book3s.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index dcb6a798f111..77b49ddda9d3 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -189,9 +189,30 @@ static inline void perf_read_regs(struct pt_regs *regs)
189 int marked = mmcra & MMCRA_SAMPLE_ENABLE; 189 int marked = mmcra & MMCRA_SAMPLE_ENABLE;
190 int use_siar; 190 int use_siar;
191 191
192 /*
193 * If this isn't a PMU exception (eg a software event) the SIAR is
194 * not valid. Use pt_regs.
195 *
196 * If it is a marked event use the SIAR.
197 *
198 * If the PMU doesn't update the SIAR for non marked events use
199 * pt_regs.
200 *
201 * If the PMU has HV/PR flags then check to see if they
202 * place the exception in userspace. If so, use pt_regs. In
203 * continuous sampling mode the SIAR and the PMU exception are
204 * not synchronised, so they may be many instructions apart.
205 * This can result in confusing backtraces. We still want
206 * hypervisor samples as well as samples in the kernel with
207 * interrupts off hence the userspace check.
208 */
192 if (TRAP(regs) != 0xf00) 209 if (TRAP(regs) != 0xf00)
193 use_siar = 0; 210 use_siar = 0;
194 else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING) && !marked) 211 else if (marked)
212 use_siar = 1;
213 else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING))
214 use_siar = 0;
215 else if (!(ppmu->flags & PPMU_NO_SIPR) && mmcra_sipr(mmcra))
195 use_siar = 0; 216 use_siar = 0;
196 else 217 else
197 use_siar = 1; 218 use_siar = 1;