All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Mike Galbraith <efault@gmx.de>, Paul Mackerras <paulus@samba.org>,
	Anton Blanchard <anton@samba.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH 0/3] perfcounter: callchain symbol resolving and fixes
Date: Wed, 1 Jul 2009 18:33:25 +0200	[thread overview]
Message-ID: <20090701163324.GD5097@nowhere> (raw)
In-Reply-To: <20090701081814.GA25593@elte.hu>

On Wed, Jul 01, 2009 at 10:18:14AM +0200, Ingo Molnar wrote:
> 
> * Frederic Weisbecker <fweisbec@gmail.com> wrote:
> 
> > Hi,
> > 
> > This patchset provides the symbol resolving for callchains.
> > Example:
> > 
> > perf report -s sym -c
> > 
> > 5.40%  [k] __d_lookup
> >              3.60%
> >                 __d_lookup
> >                 perf_callchain
> >                 perf_counter_overflow
> >                 intel_pmu_handle_irq
> >                 perf_counter_nmi_handler
> >                 notifier_call_chain
> >                 atomic_notifier_call_chain
> >                 notify_die
> >                 do_nmi
> >                 nmi
> >                 do_lookup
> >                 __link_path_walk
> >                 path_walk
> >                 do_path_lookup
> >                 user_path_at
> >                 vfs_fstatat
> >                 vfs_lstat
> >                 sys_newlstat
> >                 system_call_fastpath
> >                 __lxstat
> >                 0x406fb1
> 
> nice!
> 
> > Sorry about the third patch, it's a kind of all-in-one monolithic 
> > thing which gathers various fixes. I should have granulate it...
> 
> No problem, it's good enough - it's all about the same topic.
> 
> > 
> > Still in my plans:
> > 
> > - 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 another one:
> > 
> > - remove the perfcounter internal nmi call frame (ie: every nmi frame)
> >   so that we drop this header from each callchain:
> > 
> >                 perf_callchain
> >                 perf_counter_overflow
> >                 intel_pmu_handle_irq
> >                 perf_counter_nmi_handler
> >                 notifier_call_chain
> >                 atomic_notifier_call_chain
> >                 notify_die
> >                 do_nmi
> >                 nmi
> 
> Sounds good. I suspect this latter one is the most important one 
> because right now the backtrace output screen real estate is 
> dominated by the repetitive nmi entries, making it hard to interpret 
> the result 'at a glance'.
> 
> I think we should skip those NMI entries right in the kernel - that 
> will also make call-chain event records quite a bit smaller, by 
> about 72 bytes per call-chain record.
> 
> We can do the skipping by using this backtrace-generator callback in 
> arch/x86/kernel/cpu/perf_counter.c:
> 
>  static int backtrace_stack(void *data, char *name)
>  {
>          /* Process all stacks: */
>          return 0;
>  }
> 
> The 'name' parameter passed in signals the type of stack frame we 
> are processing. If you look into arch/x86/kernel/dumpstack_64.c, it 
> can be one of these strings:
> 
>         static char ids[][8] = {
>                 [DEBUG_STACK - 1] = "#DB",
>                 [NMI_STACK - 1] = "NMI",
>                 [DOUBLEFAULT_STACK - 1] = "#DF",
>                 [STACKFAULT_STACK - 1] = "#SS",
>                 [MCE_STACK - 1] = "#MC",
> 
> A quick check to see whether this concept works would be expose the 
> ids array and do:
> 
>  static int PER_CPU(int, is_nmi_frame);
> 
>  static int backtrace_stack(void *data, char *name)
>  {
> 	if (name == x86_stack_ids[NMI_STACK-1])


IIRC, gcc manages to factorize the string table in the elf
format right?
So that a simple == should indeed work here.

Because if you look at dumpstack_64.c, the calls to ->stack()
use plain const string for some of them:

ops->stack(data, "IRQ")

But "NMI" is always passed by its real address in the ids so
that should work without problem here.

(I just feared about using strcmp is such a fastpath).



> 		per_cpu(is_nmi_frame, raw_processor_id()) = 1;
> 	else
> 		per_cpu(is_nmi_frame, raw_processor_id()) = 0;
> 
>         /* Process all stacks: */
>         return 0;
>  }
> 
> and to add something like this to backtrace_address():
> 
> 	if (per_cpu(is_nmi_frame, raw_processor_id())
> 		return;
> 
> 	Ingo


Heh, looks like I'll almost only have to copy-paste this mail :)

Another solution would be to handle an IGNORE return value
from dump_trace() instead of always terminate the trace when
->stack() < 0

Would it be useful for other kind of uses?
For now I just asssume ignoring a stack is not a known pattern
so I'll just implement your solution.

Thanks.


  reply	other threads:[~2009-07-01 16:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-01  3:35 [PATCH 0/3] perfcounter: callchain symbol resolving and fixes Frederic Weisbecker
2009-07-01  3:35 ` [PATCH 1/3] perfcounter: Fix storage size allocation of callchain list Frederic Weisbecker
2009-07-01  8:46   ` [tip:perfcounters/urgent] perf_counter tools: " tip-bot for Frederic Weisbecker
2009-07-01  3:35 ` [PATCH 2/3] perfcounter: Resolve symbols in callchains Frederic Weisbecker
2009-07-01  8:46   ` [tip:perfcounters/urgent] perf_counter tools: " tip-bot for Frederic Weisbecker
2009-07-01  3:35 ` [PATCH 3/3] perfcounter: Various fixes for callchains Frederic Weisbecker
2009-07-01  8:46   ` [tip:perfcounters/urgent] perf_counter tools: " tip-bot for Frederic Weisbecker
2009-07-01  8:18 ` [PATCH 0/3] perfcounter: callchain symbol resolving and fixes Ingo Molnar
2009-07-01 16:33   ` Frederic Weisbecker [this message]
2009-07-01 17:14     ` Frederic Weisbecker

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=20090701163324.GD5097@nowhere \
    --to=fweisbec@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=anton@samba.org \
    --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.