From: Adrian Hunter <adrian.hunter@intel.com>
To: Like Xu <like.xu.linux@gmail.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf header: Set proper symbol name for vdso when build-id event found
Date: Wed, 13 Dec 2023 21:26:38 +0200 [thread overview]
Message-ID: <f50149fb-967c-4987-8d08-d6bb2a69bcf3@intel.com> (raw)
In-Reply-To: <20231201111506.37155-1-likexu@tencent.com>
On 1/12/23 13:15, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
>
> If using perf-record to sample a cpu-cycles:P event on a hypervisor process
> when '--kcore' is not enabled, user may find some surprise in perf-report:
>
> # perf report -i perf.data -v:
> # Overhead Command Shared Object Symbol
> 99.71% vcpu0 arch/x86/kvm/kvm-intel.ko 0xffffffffa10d1e30 B [k] 0x0000000000034ed0
>
> build id event received for vmlinux: d12116149f511f7dbd0b21c45d38d3d2ec09b87f [20]
> build id event received for kvm-intel.ko: a8fc0213abbafd97b10ce58ce84bec8519f9abce [20]
> build id event received for [vdso]: 4d56e381df8d2c051f6bc1ef69c0118c59d5c49f [20]
>
> # perf report:
> # Overhead Command Shared Object Symbol
> # ........ ....... ................ .......................................
> #
> 99.71% vcpu0 [kvm_intel] [k] 0x0000000000034ed0
> 0.10% vcpu0 [kernel.vmlinux] [k] __lock_acquire.isra.29
>
> Users may be curious as to how 0x34ed0 was generated and wondered if this
> RIP came from the guest application but perf-script-D does not point to any
> samples of this address.
>
> Based on perf/tool implementation, this is actually an offset pointing to
> the vdso object (in this case it is the assembly __vmx_vcpu_run defined
> in arch/x86/kvm/vmx/vmenter.S). The pattern is not reproduced on perf-tool
> of some distributions, and git-bisect quickly identified the possible root
> cause, which leds to this straightforward fix and after this change:
>
> # perf report -i perf.data -v:
> # Overhead Command Shared Object Symbol
> 99.71% vcpu0 arch/x86/kvm/kvm-intel.ko 0x34ed0 B [k] __vmx_vcpu_run
>
> # perf report:
> # Overhead Command Shared Object Symbol
> # ........ ....... ................ .......................................
> #
> 99.71% vcpu0 [kvm_intel] [k] __vmx_vcpu_run
>
> The fix also gets commit 1deec1bd96cc ("perf header: Set proper module name
> when build-id event found") lit again.
>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Fixes: b2fe96a350de ("perf tools: Fix module symbol processing")
> Signed-off-by: Like Xu <likexu@tencent.com>
> ---
> tools/perf/util/header.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index e86b9439ffee..a33d589511ff 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -2305,8 +2305,8 @@ static int __event_process_build_id(struct perf_record_header_build_id *bev,
>
> if (!kmod_path__parse_name(&m, filename) && m.kmod)
> dso__set_module_info(dso, &m, machine);
> -
> - dso->kernel = dso_space;
> + else
> + dso->kernel = dso_space;
This is undoing some of b2fe96a350de ("perf tools: Fix module
symbol processing") without explanation.
Symbols in the .noinstr.text section don't seem to be
being resolved, so that could be the issue. perf synthesizes
an MMAP record from /proc/modules, which works for .text
but perhaps not for .noinstr.text
> free(m.name);
> }
>
next prev parent reply other threads:[~2023-12-13 19:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 11:15 [PATCH] perf header: Set proper symbol name for vdso when build-id event found Like Xu
2023-12-13 19:26 ` Adrian Hunter [this message]
2023-12-14 2:48 ` Like Xu
2024-02-02 11:16 ` Adrian Hunter
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=f50149fb-967c-4987-8d08-d6bb2a69bcf3@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=like.xu.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.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;
as well as URLs for NNTP newsgroup(s).