public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lin Ming <ming.m.lin@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] perf report: add sort by file lines
Date: Wed, 30 Mar 2011 00:45:55 +0800	[thread overview]
Message-ID: <1301417155.3620.8.camel@localhost> (raw)
In-Reply-To: <1301392457.4859.74.camel@twins>

On Tue, 2011-03-29 at 17:54 +0800, Peter Zijlstra wrote:
> On Tue, 2011-03-29 at 17:32 +0800, Lin Ming wrote:
> > 
> > Peter suggested to reverse map the reported IP (PEBS + fixup)
> > to a data access using dwarf info.
> > So I wrote this patch to see if the direction is right. 
> 
> I'm not sure this is quite the same thing, I'm not arguing this might
> not be useful, but this is not about data access.
> 
> Suppose you have a line like:
> 
>   foo->bar->fubar = tmp->blah;
> 
> There's 3 indirections there, a line number doesn't even get you close
> to knowing what data access triggered the event.
> 
> struct bar {
>         int poekoe[5];
>         int fubar;
> };
> 
> struct foo {
>         long poekoe[3];
>         struct bar *bar;
> };
> 
> struct tmp {
>         long poekoe[4];
>         int blah;
> };
> 
> void foo(struct foo *foo, struct tmp *tmp)
> {
>         foo->bar->fubar = tmp->blah;
> }
> 
> Which gives (somewhat simplified):
> 
> foo:
> 	.cfi_startproc
> 	pushq	%rbp
> 	.cfi_def_cfa_offset 16
> 	movq	%rsp, %rbp
> 	.cfi_offset 6, -16
> 	.cfi_def_cfa_register 6
> 	movq	%rdi, -8(%rbp)
> 	movq	%rsi, -16(%rbp)
> 	movq	-8(%rbp), %rax    /* load foo arg from stack */
> 	movq	24(%rax), %rax    /* load foo->bar */
> 	movq	-16(%rbp), %rdx   /* load tmp arg from stack */
> 	movl	32(%rdx), %edx    /* load tmp->blah */
> 	movl	%edx, 20(%rax)    /* store bar->fubar */
> 	leave
> 	ret
> 	.cfi_endproc

I need to have a close look at how dwarf cfi thing works.

> 
> where I annotated the various moves with C comments.
> 
> Now depending on what exact IP you get using PEBS+fixup you could using
> DWARF bits generate similar deductions from the code as I did in those
> comments and thus know exactly what data member was accessed and how
> (read/write).

Is it an unwind of the call frame stack to find out what data member was
accessed?
How to know the access type(read or write)?

> 
> With that data you could then borrow some pahole code and annotate the
> various data structures to illustrate read/write distributions, which
> can then be used as input for data-reorder.

Could you explain a bit more about this?

Thanks,
Lin Ming



  reply	other threads:[~2011-03-29 16:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-29  9:32 [RFC PATCH] perf report: add sort by file lines Lin Ming
2011-03-29  9:46 ` Masami Hiramatsu
2011-03-29  9:54 ` Peter Zijlstra
2011-03-29 16:45   ` Lin Ming [this message]
2011-03-29 17:03     ` Peter Zijlstra
2011-03-29 17:06       ` Peter Zijlstra
2011-03-29 17:08         ` Peter Zijlstra
2011-03-29 17:45           ` Arnaldo Carvalho de Melo
2011-03-30  1:04             ` Masami Hiramatsu
2011-03-30  2:18               ` Arnaldo Carvalho de Melo
2011-03-31  6:57               ` Lin Ming
2011-04-01 10:48                 ` Masami Hiramatsu
2011-03-31  8:45               ` Lin Ming
2011-03-31 13:46                 ` Arnaldo Carvalho de Melo
2011-03-31 14:19                   ` Lin Ming
2011-03-31 15:35                     ` Arnaldo Carvalho de Melo
2011-03-31 14:01                 ` Peter Zijlstra
2011-03-31 14:34                   ` Lin Ming
2011-03-31 14:51                     ` Lin Ming
2011-03-31 16:28                     ` Peter Zijlstra
2011-03-31 16:32                       ` Peter Zijlstra
2011-04-01 13:02                         ` Lin Ming
2011-04-01 13:48                           ` Peter Zijlstra
2011-04-01 10:44                       ` Masami Hiramatsu
2011-04-01 11:05                         ` Peter Zijlstra
2011-04-01 13:22                           ` Lin Ming
2011-04-01 13:49                             ` Peter Zijlstra
2011-04-01 13:57                               ` Lin Ming

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=1301417155.3620.8.camel@localhost \
    --to=ming.m.lin@intel.com \
    --cc=acme@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox