linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Kairui Song <kasong@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
	Dave Young <dyoung@redhat.com>
Subject: Re: [RFC PATCH] perf/x86: make perf callchain work without CONFIG_FRAME_POINTER
Date: Fri, 5 Apr 2019 09:09:29 -0500	[thread overview]
Message-ID: <20190405140929.pycfea7drnpb2sug@treble> (raw)
In-Reply-To: <20190404172545.20928-1-kasong@redhat.com>

On Fri, Apr 05, 2019 at 01:25:45AM +0800, Kairui Song wrote:
> Currently perf callchain is not working properly with ORC unwinder,
> we'll get useless in kernel callchain like this:
> 
> perf  6429 [000]    22.498450:             kmem:mm_page_alloc: page=0x176a17 pfn=1534487 order=0 migratetype=0 gfp_flags=GFP_KERNEL
>         ffffffffbe23e32e __alloc_pages_nodemask+0x22e (/lib/modules/5.1.0-rc3+/build/vmlinux)
>             7efdf7f7d3e8 __poll+0x18 (/usr/lib64/libc-2.28.so)
>             5651468729c1 [unknown] (/usr/bin/perf)
>             5651467ee82a main+0x69a (/usr/bin/perf)
>             7efdf7eaf413 __libc_start_main+0xf3 (/usr/lib64/libc-2.28.so)
>         5541f689495641d7 [unknown] ([unknown])
> 
> Without CONFIG_FRAME_POINTER, bp is not reserved as frame pointer so
> can't get callers frame pointer, instead current frame pointer is
> returned when trying to fetch caller registers. The unwinder will error
> out early, and end the stacktrace early.
> 
> So instead of let the unwinder start with the dumped register, we start
> it right where the unwinding started when the stacktrace is triggered by
> trace event directly. And skip until the frame pointer is reached.
> 
> This makes the callchain get the full in kernel stacktrace again:
> 
> perf  6503 [000]  1567.570191:             kmem:mm_page_alloc: page=0x16c904 pfn=1493252 order=0 migratetype=0 gfp_flags=GFP_KERNEL
>         ffffffffb523e2ae __alloc_pages_nodemask+0x22e (/lib/modules/5.1.0-rc3+/build/vmlinux)
>         ffffffffb52383bd __get_free_pages+0xd (/lib/modules/5.1.0-rc3+/build/vmlinux)
>         ffffffffb52fd28a __pollwait+0x8a (/lib/modules/5.1.0-rc3+/build/vmlinux)
>         ffffffffb521426f perf_poll+0x2f (/lib/modules/5.1.0-rc3+/build/vmlinux)
>         ffffffffb52fe3e2 do_sys_poll+0x252 (/lib/modules/5.1.0-rc3+/build/vmlinux)
>         ffffffffb52ff027 __x64_sys_poll+0x37 (/lib/modules/5.1.0-rc3+/build/vmlinux)
>         ffffffffb500418b do_syscall_64+0x5b (/lib/modules/5.1.0-rc3+/build/vmlinux)
>         ffffffffb5a0008c entry_SYSCALL_64_after_hwframe+0x44 (/lib/modules/5.1.0-rc3+/build/vmlinux)
>             7f71e92d03e8 __poll+0x18 (/usr/lib64/libc-2.28.so)
>             55a22960d9c1 [unknown] (/usr/bin/perf)
>             55a22958982a main+0x69a (/usr/bin/perf)
>             7f71e9202413 __libc_start_main+0xf3 (/usr/lib64/libc-2.28.so)
>         5541f689495641d7 [unknown] ([unknown])
> 
> ----
> 
> Just found with ORC unwinder the perf callchain is unusable, and this
> seems fixes it well, any suggestion is welcome, thanks!

Hi Kairui,

Without CONFIG_FRAME_POINTER, the BP register has no meaning, so I don't
see how this patch could work.

Also, perf stack traces seem to work fine for me with ORC.  Can you give
some details on how to recreate the issue?

-- 
Josh

  parent reply	other threads:[~2019-04-05 14:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04 17:25 [RFC PATCH] perf/x86: make perf callchain work without CONFIG_FRAME_POINTER Kairui Song
2019-04-05  7:17 ` Peter Zijlstra
2019-04-05 15:21   ` Kairui Song
2019-04-05 14:09 ` Josh Poimboeuf [this message]
2019-04-05 15:13   ` Kairui Song
2019-04-05 16:57     ` Josh Poimboeuf
2019-04-05 17:05       ` Kairui Song
2019-04-05 17:26         ` Josh Poimboeuf
2019-04-05 18:55           ` Kairui Song

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=20190405140929.pycfea7drnpb2sug@treble \
    --to=jpoimboe@redhat.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dyoung@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=kasong@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).