mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Will Hawkins <whh8b@virginia.edu>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: Ftrace vs perf user page fault statistics differences
Date: Tue, 13 Jun 2017 09:06:49 -0400	[thread overview]
Message-ID: <20170613090649.2a5edb6a@gandalf.local.home> (raw)
In-Reply-To: <CAE+MWFv=Vu_zVt7snvKgp3vqROZ4+dgGHjc5-nD1MWcP=wgcZQ@mail.gmail.com>

On Mon, 12 Jun 2017 22:05:05 -0400
Will Hawkins <whh8b@virginia.edu> wrote:

> > Can you supply this program. So I can see exactly what it does?  
> 
> I have attached the binary to this email. I also provided the source
> so you can reproduce the situation directly. You can use the makefile
> provided as long as you have nasm installed.
> 
> Although this is a response to a later question, I won't bury the
> lede: The program was written by hand in asm, compiled with nasm to
> object code and then run through gcc to get the output binary. Here is
> how that works:
> 
> nasm -felf64 page.s && gcc -nostdlib page.o -o page
> 
> The result, as far as ldd is concerned:
> 
> hawkinsw@moormans:~/code/one_page_play$ ldd page
>     not a dynamic executable

OK, that makes sense.

> 
> 
> >  
> >>
> >> I looked at the results:
> >>
> >> perf report
> >>
> >> and the results were as I expected. There were two page faults for
> >> loading the code into memory and a page fault to
> >> copy_user_enhanced_fast_string invoked by execve's implementation when
> >> loading the binary.  
> >
> > What does perf script show you?  
> 
> Here is what perf report --stdio shows:
> 
> # Overhead  Command      Shared Object                              Symbol
> # ........  .......  .................  ..................................
> #
>     33.33%     page  page               [.] _start
>                |
>                --- _start
> 
>     33.33%     page  page               [.] target
>                |
>                --- target
> 
>     33.33%     page  [kernel.kallsyms]  [k] copy_user_enhanced_fast_string
>                |
>                --- copy_user_enhanced_fast_string
>                    load_elf_binary
>                    search_binary_handler
>                    do_execve_common.isra.23
>                    sys_execve
>                    stub_execve
>                    0x7f51698a31e7
> 
> 
> 
> Here is what perf script shows:
> 
> page 28787 113626.587935: page-faults:
>         ffffffff81376609 copy_user_enhanced_fast_string ([kernel.kallsyms])
>         ffffffff812197bf load_elf_binary ([kernel.kallsyms])
>         ffffffff811c76df search_binary_handler ([kernel.kallsyms])
>         ffffffff811c8c8e do_execve_common.isra.23 ([kernel.kallsyms])
>         ffffffff811c9176 sys_execve ([kernel.kallsyms])
>         ffffffff8173afc9 stub_execve ([kernel.kallsyms])
>             7f51698a31e7 [unknown] ([unknown])
> 
> page 28787 113626.587961: page-faults:
>                   4000e0 _start (/home/hawkinsw/code/one_page_play/page)
> 
> page 28787 113626.587968: page-faults:
>                   401473 target (/home/hawkinsw/code/one_page_play/page)
> 
> Again, this seems like exactly what I would expect.
> 
> >  
> >>
> >> I decided to run the application under ftrace just for fun. I wanted
> >> an excuse to learn more about it and this seemed like the perfect
> >> chance. I used the incredible trace-cmd suite for the actual
> >> incantation of ftrace. I won't include the actual incantations here
> >> because I used many of them while digging around.  
> >
> > what events did you enable?  
> 
> Sorry for not including this in my first email. I enabled
> exceptions:page_fault_user. I ran the trace-cmd record like this:
> 
> sudo ./trace-cmd record -e exceptions:page_fault_user -T --profile -l
> handle_mm_fault ../one_page_play/page

See if things change if you add -F. Perf by default only traces the
application you specify. trace-cmd by default traces everything.

That is, "trace-cmd record -F" is similar to "perf record". Where as
"trace-cmd record" is similar to "perf record -a".

-- Steve

  reply	other threads:[~2017-06-13 13:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-12 20:08 Will Hawkins
     [not found] ` <CAE+MWFuvAtGc0boe3arhnyoVpCpJBOsBTpk8W7Lh6r5PFE-Hmg@mail.gmail.com>
2017-06-13  1:20   ` Steven Rostedt
2017-06-13  2:05     ` Will Hawkins
2017-06-13 13:06       ` Steven Rostedt [this message]
2017-06-13 18:02         ` Will Hawkins
2017-06-13 20:04           ` Steven Rostedt
2017-06-14  1:27             ` Will Hawkins
2017-06-14  2:13               ` Steven Rostedt
2017-06-14 17:47                 ` Will Hawkins
2017-06-14 20:01                   ` Steven Rostedt
2017-06-19 17:13                     ` Will Hawkins
2017-06-19 18:52                       ` Steven Rostedt
2017-06-14  3:04             ` Namhyung Kim
2017-06-14 17:30               ` Will Hawkins
2017-06-14 17:43                 ` Steven Rostedt

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=20170613090649.2a5edb6a@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=whh8b@virginia.edu \
    /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

all inboxes | Powered by JetHome®