All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Andrii Nakryiko <andriin@fb.com>, bpf <bpf@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	Alexei Starovoitov <ast@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Yonghong Song <yhs@fb.com>, Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v6 bpf-next 04/14] libbpf: implement BPF CO-RE offset relocation algorithm
Date: Wed, 7 Aug 2019 15:25:40 -0700	[thread overview]
Message-ID: <CAEf4BzZuqPLJ=ModfYqKpU6bDMqZpt_NfDZyPTCOp=Ws0MnAhA@mail.gmail.com> (raw)
In-Reply-To: <20190807221649.fiqo2kqj73qjcakr@ast-mbp>

On Wed, Aug 7, 2019 at 3:16 PM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Wed, Aug 07, 2019 at 02:39:51PM -0700, Andrii Nakryiko wrote:
> > This patch implements the core logic for BPF CO-RE offsets relocations.
> > Every instruction that needs to be relocated has corresponding
> > bpf_offset_reloc as part of BTF.ext. Relocations are performed by trying
> > to match recorded "local" relocation spec against potentially many
> > compatible "target" types, creating corresponding spec. Details of the
> > algorithm are noted in corresponding comments in the code.
> >
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> > Acked-by: Song Liu <songliubraving@fb.com>
> ...
> > +static struct btf *bpf_core_find_kernel_btf(void)
> > +{
> > +     const char *locations[] = {
> > +             "/lib/modules/%1$s/vmlinux-%1$s",
> > +             "/usr/lib/modules/%1$s/kernel/vmlinux",
> > +     };
>
> the vmlinux finding logic didn't work out of the box for me.
> My vmlinux didn't have -`uname -r` suffix.
> Probably worth adding /boot/vmlinux-uname too.

Yeah, there doesn't appear to be a consensus about standard location.
For completeness, I'll add a set of paths perf is using in follow-up
patch. But overall this mess with searching for vmlinux is one of
motivational factors for https://patchwork.ozlabs.org/patch/1143622/,
which should fix this problem.

> May be vmlinuz can have BTF as well?

Probably, but it might be too expensive to extract it? Either way,
once .BTF is loadable inside kernel, there won't be a need to search
for vmlinux/vmlinux location.

>
> Overall looks great. Applied to bpf-next. Thanks!
>

Thanks!

  reply	other threads:[~2019-08-07 22:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 21:39 [PATCH v6 bpf-next 00/14] CO-RE offset relocations Andrii Nakryiko
2019-08-07 21:39 ` [PATCH v6 bpf-next 01/14] libbpf: add helpers for working with BTF types Andrii Nakryiko
2019-08-07 21:39 ` [PATCH v6 bpf-next 02/14] libbpf: convert libbpf code to use new btf helpers Andrii Nakryiko
2019-08-07 21:39 ` [PATCH v6 bpf-next 03/14] libbpf: add .BTF.ext offset relocation section loading Andrii Nakryiko
2019-08-07 21:39 ` [PATCH v6 bpf-next 04/14] libbpf: implement BPF CO-RE offset relocation algorithm Andrii Nakryiko
2019-08-07 22:16   ` Alexei Starovoitov
2019-08-07 22:25     ` Andrii Nakryiko [this message]
2019-08-07 21:39 ` [PATCH v6 bpf-next 05/14] selftests/bpf: add BPF_CORE_READ relocatable read macro Andrii Nakryiko
2019-08-07 21:39 ` [PATCH v6 bpf-next 06/14] selftests/bpf: add CO-RE relocs testing setup Andrii Nakryiko
2019-08-07 21:39 ` [PATCH v6 bpf-next 07/14] selftests/bpf: add CO-RE relocs struct flavors tests Andrii Nakryiko
2019-08-07 21:39 ` [PATCH v6 bpf-next 08/14] selftests/bpf: add CO-RE relocs nesting tests Andrii Nakryiko
2019-08-07 21:39 ` [PATCH v6 bpf-next 09/14] selftests/bpf: add CO-RE relocs array tests Andrii Nakryiko
2019-08-07 21:39 ` [PATCH v6 bpf-next 10/14] selftests/bpf: add CO-RE relocs enum/ptr/func_proto tests Andrii Nakryiko
2019-08-07 21:39 ` [PATCH v6 bpf-next 11/14] selftests/bpf: add CO-RE relocs modifiers/typedef tests Andrii Nakryiko
2019-08-07 21:39 ` [PATCH v6 bpf-next 12/14] selftests/bpf: add CO-RE relocs ptr-as-array tests Andrii Nakryiko
2019-08-07 21:40 ` [PATCH v6 bpf-next 13/14] selftests/bpf: add CO-RE relocs ints tests Andrii Nakryiko
2019-08-07 21:40 ` [PATCH v6 bpf-next 14/14] selftests/bpf: add CO-RE relocs misc tests Andrii Nakryiko

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='CAEf4BzZuqPLJ=ModfYqKpU6bDMqZpt_NfDZyPTCOp=Ws0MnAhA@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.