netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: Jiri Olsa <jolsa@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	Martin Lau <kafai@fb.com>, Yonghong Song <yhs@fb.com>,
	Andrii Nakryiko <andriin@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@chromium.org>
Subject: Re: [RFC PATCH bpf-next] bpf: Iterate through all PT_NOTE sections when looking for build id
Date: Wed, 12 Aug 2020 15:26:43 +0000	[thread overview]
Message-ID: <5238E896-6A88-4857-B8D4-3C2E8C4E9F2C@fb.com> (raw)
In-Reply-To: <20200812123102.20032-1-jolsa@kernel.org>



> On Aug 12, 2020, at 5:31 AM, Jiri Olsa <jolsa@kernel.org> wrote:
> 
> Currently when we look for build id within bpf_get_stackid helper
> call, we check the first NOTE section and we fail if build id is
> not there.
> 
> However on some system (Fedora) there can be multiple NOTE sections
> in binaries and build id data is not always the first one, like:
> 
>  $ readelf -a /usr/bin/ls
>  ...
>  [ 2] .note.gnu.propert NOTE             0000000000000338  00000338
>       0000000000000020  0000000000000000   A       0     0     8358
>  [ 3] .note.gnu.build-i NOTE             0000000000000358  00000358
>       0000000000000024  0000000000000000   A       0     0     437c
>  [ 4] .note.ABI-tag     NOTE             000000000000037c  0000037c
>  ...
> 
> So the stack_map_get_build_id function will fail on build id retrieval
> and fallback to BPF_STACK_BUILD_ID_IP.
> 
> This patch is changing the stack_map_get_build_id code to iterate
> through all the NOTE sections and try to get build id data from
> each of them.
> 
> When tracing on sched_switch tracepoint that does bpf_get_stackid
> helper call kernel build, I can see about 60% increase of successful
> build id retrieval. The rest seems fails on -EFAULT.
> 
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>

LGTM. Thanks for the fix!

Acked-by: Song Liu <songliubraving@fb.com>



  reply	other threads:[~2020-08-12 15:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 12:31 [RFC PATCH bpf-next] bpf: Iterate through all PT_NOTE sections when looking for build id Jiri Olsa
2020-08-12 15:26 ` Song Liu [this message]
2020-08-13  1:20   ` Alexei Starovoitov

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=5238E896-6A88-4857-B8D4-3C2E8C4E9F2C@fb.com \
    --to=songliubraving@fb.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=netdev@vger.kernel.org \
    --cc=yhs@fb.com \
    /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).