From: Frederic Weisbecker <fweisbec@gmail.com>
To: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Mike Galbraith <efault@gmx.de>
Subject: Re: [PATCH 0/2] perfcounter: callchains with perf report
Date: Sun, 28 Jun 2009 23:05:56 +0200 [thread overview]
Message-ID: <20090628210554.GA6267@nowhere> (raw)
In-Reply-To: <19013.29199.123045.531291@cargo.ozlabs.ibm.com>
On Sat, Jun 27, 2009 at 11:12:47AM +1000, Paul Mackerras wrote:
> Frederic Weisbecker writes:
>
> > Here is a first shot for the sorted callchains per entries handling
> > with per report.
> >
> > I'll continue to improve it:
> >
> > - symbol resolution
> > - profit we have a tree to display a better graph hierarchy
> > - let the user provide a limit for hit percentage, depth, number of
> > backtraces, etc...
> > - better output
> > - colors
> > - and so on....
>
> Nice!
>
> I have just about finished doing the kernel piece of callchain support
> on powerpc. Because of the way function calls and returns work on
> powerpc, working out the first one or two return addresses can be
> tricky. We potentially have a valid return address in the link
> register (LR), or in the LR save area in the second stack frame, or
> both, and you need extra information such as DWARF unwind tables to
> work out which of those three possibilities you have, in general.
> This is the case at each point where an interrupt or signal has
> occurred.
>
> Because I didn't want to go trawling through CFI tables at interrupt
> time, particularly for user code, I made the kernel save both possible
> return addresses in the callchain. For the kernel part of the
> callchain, I check those two addresses to see if they're valid kernel
> addresses and set them to 0 if not, or if they're equal.
>
> That means I need to make some changes to builtin-report.c to ignore
> zero addresses. I may need to add stuff to look for and use unwind
> tables as well, if we want completely accurate call chains.
Well, I guess I can ignore them in my further patches.
But wouldn't it be better to discard them from the kernel?
Unless it's somewhat useful to know we had an unknown entry?
> The other thing I did is to put PERF_CONTEXT_KERNEL markers in the
> callchain every time we find an interrupt frame, and PERF_CONTEXT_USER
> markers every time we find a signal frame, so that userspace knows
> when it needs to do the unwinding.
>
> Oh, and a third point is that on powerpc the sampled IP recorded if
> you ask for PERF_SAMPLE_IP won't in general be the same as the first
> IP in the callchain. The reason is that the PERF_SAMPLE_IP value
> points to the instruction that caused the counter overflow whereas the
> first IP in the callchain tells you where the CPU took the interrupt.
> That is almost always a few instructions further on, and can be quite
> a way further on if interrupts were disabled when the counter overflow
> occur. In fact we regularly see the PERF_SAMPLE_IP value being in the
> hypervisor but the first IP in the callchain being in the kernel.
Ok.
>
> Paul.
next prev parent reply other threads:[~2009-06-28 21:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-26 14:27 [PATCH 0/2] perfcounter: callchains with perf report Frederic Weisbecker
2009-06-26 14:28 ` [PATCH 1/2] perfcounter: prepare a small callchain framework Frederic Weisbecker
2009-06-26 15:51 ` [tip:perfcounters/urgent] perf_counter tools: Prepare " tip-bot for Frederic Weisbecker
2009-06-26 14:28 ` [PATCH 2/2] perfcounter: print sorted callchains per histogram entries Frederic Weisbecker
2009-06-26 15:52 ` [tip:perfcounters/urgent] perf report: Print " tip-bot for Frederic Weisbecker
2009-06-26 14:48 ` [PATCH 0/2] perfcounter: callchains with perf report Ingo Molnar
2009-06-27 1:12 ` Paul Mackerras
2009-06-28 21:05 ` Frederic Weisbecker [this message]
2009-06-28 23:40 ` Paul Mackerras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090628210554.GA6267@nowhere \
--to=fweisbec@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.