Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1666109

Re: Ftrace vs perf user page fault statistics differences

From Will Hawkins <whh8b@virginia.edu>
Newsgroups linux.kernel
Subject Re: Ftrace vs perf user page fault statistics differences
Date 2017-06-14 19:50 +0200
Message-ID <tSkAx-8cx-5@gated-at.bofh.it> (permalink)
References (4 earlier) <tRTK1-8oY-1@gated-at.bofh.it> <tRYqm-2Pr-23@gated-at.bofh.it> <tS0iu-40M-3@gated-at.bofh.it> <tS5ia-72b-7@gated-at.bofh.it> <tS64y-7Cx-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jun 13, 2017 at 10:13 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Tue, 13 Jun 2017 21:27:20 -0400
> Will Hawkins <whh8b@virginia.edu> wrote:
>
>> But, while I have your ear, I was wondering if you could direct me to
>> where the page_fault_user gathers its information (when tracing) and
>> where that information is formatted for printing (in trace-cmd). I'd
>> really like to investigate modifying that code so that it provides
>> "better" information than
>>
>> address=__per_cpu_end ip=__per_cpu_end
>>
>> Now that I'm into this, I want to really dig in. If you can give me a
>> pointer, that would really help me get started. After that I can
>> attempt to make some patches and see where it leads.
>>
>> For the x86 architecture, the relevant files seem to be
>>
>> mm/fault.c (with the trace_page_fault_entries function)
>>
>> and
>>
>> include/asm/trace/exceptions.h (where the exception class is built)
>
> Correct.
>
>>
>> What seems odd there is that the exception *should* be responding with
>> "better" information -- address is set to the value of the cr2
>> register which should contain the address of the faulting instruction.
>> Perhaps I just don't understand what the symbol __per_cpu_end means.
>>
>> Any information you can shed on this would be really great.
>
> hmm, actually that looks to be translating the ip address into
> functions. It shouldn't be doing that, and it doesn't do it for me with
> the latest kernel and trace-cmd.
>
> What does it give you in trace-cmd report -R ? The -R will not parse
> the printk-fmt of the event format files, and just show raw numbers.

Brilliant advice. And, guess what? It gives me exactly what I expected:

page-7783    6d... 198598.003464: page_fault_user:
address=0x4000e0 ip=0x4000e0 error_code=0x14
...
page-7783    6d... 198598.003466: page_fault_user:
address=0x401473 ip=0x401473 error_code=0x14

Since I don't expect you to be following the details as closely as I
am, those are exactly the addresses that I expected to see. I think
that is the final confirmation of the hypothesis!

>
> Can you give me the contents of:
>
>  cat /sys/kernel/debug/tracing/exceptions/page_fault_user/format
>
> ?
>
> That's how trace-cmd parses it.

In the kernel version that I am running (again, pretty old) I do not
have this file. I do, however, have

/sys/kernel/debug/tracing/events/exceptions/page_fault_user/format

and the contents are:

name: page_fault_user
ID: 79
format:
    field:unsigned short common_type;    offset:0;    size:2;    signed:0;
    field:unsigned char common_flags;    offset:2;    size:1;    signed:0;
    field:unsigned char common_preempt_count;    offset:3;    size:1;signed:0;
    field:int common_pid;    offset:4;    size:4;    signed:1;

    field:unsigned long address;    offset:8;    size:8;    signed:0;
    field:unsigned long ip;    offset:16;    size:8;    signed:0;
    field:unsigned long error_code;    offset:24;    size:8;    signed:0;

print fmt: "address=%pf ip=%pf error_code=0x%lx", (void
*)REC->address, (void *)REC->ip, REC->error_code

Again, this looks like exactly what I would expect since address has
the cr2 value in that function. Plus, we know that the raw value is
correct. I suppose that the "symbolification" of that value is done in
trace-cmd, right? So, perhaps that is where I should start looking for
the problem?

I definitely want to follow up on this and help where I can. That
said, I think I am satisfied with "our" (really, your) answer to the
original problem.

Thank you so much!
Will

>
>
>
>>
>> Thanks again for your patience with me! I think that I now understand
>> what is going on.
>
>
> No problem, it's good to be curious.
>
> -- Steve

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Ftrace vs perf user page fault statistics differences Will Hawkins <whh8b@virginia.edu> - 2017-06-12 22:10 +0200
  Re: Ftrace vs perf user page fault statistics differences Steven Rostedt <rostedt@goodmis.org> - 2017-06-13 03:30 +0200
    Re: Ftrace vs perf user page fault statistics differences Steven Rostedt <rostedt@goodmis.org> - 2017-06-13 15:10 +0200
      Re: Ftrace vs perf user page fault statistics differences Will Hawkins <whh8b@virginia.edu> - 2017-06-13 20:10 +0200
        Re: Ftrace vs perf user page fault statistics differences Steven Rostedt <rostedt@goodmis.org> - 2017-06-13 22:10 +0200
          Re: Ftrace vs perf user page fault statistics differences Will Hawkins <whh8b@virginia.edu> - 2017-06-14 03:30 +0200
            Re: Ftrace vs perf user page fault statistics differences Steven Rostedt <rostedt@goodmis.org> - 2017-06-14 04:20 +0200
              Re: Ftrace vs perf user page fault statistics differences Will Hawkins <whh8b@virginia.edu> - 2017-06-14 19:50 +0200
                Re: Ftrace vs perf user page fault statistics differences Steven Rostedt <rostedt@goodmis.org> - 2017-06-14 22:10 +0200
                Re: Ftrace vs perf user page fault statistics differences Will Hawkins <whh8b@virginia.edu> - 2017-06-19 19:20 +0200
                Re: Ftrace vs perf user page fault statistics differences Steven Rostedt <rostedt@goodmis.org> - 2017-06-19 21:00 +0200
          Re: Ftrace vs perf user page fault statistics differences Namhyung Kim <namhyung@gmail.com> - 2017-06-14 05:10 +0200
            Re: Ftrace vs perf user page fault statistics differences Will Hawkins <whh8b@virginia.edu> - 2017-06-14 19:40 +0200
              Re: Ftrace vs perf user page fault statistics differences Steven Rostedt <rostedt@goodmis.org> - 2017-06-14 19:50 +0200

csiph-web