From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Yonghong Song <yhs@fb.com>, Andrii Nakryiko <andrii@kernel.org>,
bpf <bpf@vger.kernel.org>,
Network Development <netdev@vger.kernel.org>,
Alexei Starovoitov <ast@fb.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v3 bpf-next 17/18] selftests/bpf: add map linking selftest
Date: Fri, 23 Apr 2021 14:39:34 -0700 [thread overview]
Message-ID: <CAEf4BzbRH-5-1MVtEnfLKOMO4f2sVFrdROBLTBT8GrESs1p1XQ@mail.gmail.com> (raw)
In-Reply-To: <CAADnVQ+20NcPHKYyMpAYr6SQ2fuvr4yqu5eiY90hL8J9-t1L9w@mail.gmail.com>
On Fri, Apr 23, 2021 at 2:23 PM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Fri, Apr 23, 2021 at 11:54 AM Yonghong Song <yhs@fb.com> wrote:
> >
> >
> >
> > On 4/23/21 11:13 AM, Andrii Nakryiko wrote:
> > > Add selftest validating various aspects of statically linking BTF-defined map
> > > definitions. Legacy map definitions do not support extern resolution between
> > > object files. Some of the aspects validated:
> > > - correct resolution of extern maps against concrete map definitions;
> > > - extern maps can currently only specify map type and key/value size and/or
> > > type information;
> > > - weak concrete map definitions are resolved properly.
> > >
> > > Static map definitions are not yet supported by libbpf, so they are not
> > > explicitly tested, though manual testing showes that BPF linker handles them
> > > properly.
> > >
> > > Acked-by: Yonghong Song <yhs@fb.com>
> > > Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> > [...]
> > > +
> > > +SEC("raw_tp/sys_exit")
> > > +int BPF_PROG(handler_exit1)
> > > +{
> > > + /* lookup values with key = 2, set in another file */
> > > + int key = 2, *val;
> > > + struct my_key key_struct = { .x = 2 };
> > > + struct my_value *value_struct;
> > > +
> > > + value_struct = bpf_map_lookup_elem(&map1, &key_struct);
> > > + if (value_struct)
> > > + output_first1 = value_struct->x;
> > > +
> > > + val = bpf_map_lookup_elem(&map2, &key);
> > > + if (val)
> > > + output_second1 = *val;
> > > +
> > > + val = bpf_map_lookup_elem(&map_weak, &key);
> > > + if (val)
> > > + output_weak1 = *val;
> > > +
> >
> > There is an extra tab in the above line. There is no need for new
> > revision just for this. If no new revision is needed, maybe
> > the maintainer can help fix it.
>
> Sorry. I applied without it. Pls fold the fix in some of the future patches.
Ok, no problem, I'll do it in v3 of statics support patch set.
next prev parent reply other threads:[~2021-04-23 21:39 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 18:13 [PATCH v3 bpf-next 00/18] BPF static linker: support externs Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 01/18] bpftool: support dumping BTF VAR's "extern" linkage Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 02/18] bpftool: dump more info about DATASEC members Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 03/18] libbpf: suppress compiler warning when using SEC() macro with externs Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 04/18] libbpf: mark BPF subprogs with hidden visibility as static for BPF verifier Andrii Nakryiko
2021-04-23 18:23 ` Yonghong Song
2021-04-23 18:13 ` [PATCH v3 bpf-next 05/18] libbpf: allow gaps in BPF program sections to support overriden weak functions Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 06/18] libbpf: refactor BTF map definition parsing Andrii Nakryiko
2021-04-23 18:36 ` Yonghong Song
2021-04-23 18:13 ` [PATCH v3 bpf-next 07/18] libbpf: factor out symtab and relos sanity checks Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 08/18] libbpf: make few internal helpers available outside of libbpf.c Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 09/18] libbpf: extend sanity checking ELF symbols with externs validation Andrii Nakryiko
2021-04-23 18:39 ` Yonghong Song
2021-04-23 18:13 ` [PATCH v3 bpf-next 10/18] libbpf: tighten BTF type ID rewriting with error checking Andrii Nakryiko
2021-04-23 18:40 ` Yonghong Song
2021-04-23 18:13 ` [PATCH v3 bpf-next 11/18] libbpf: add linker extern resolution support for functions and global variables Andrii Nakryiko
2021-04-23 18:46 ` Yonghong Song
2021-04-23 18:13 ` [PATCH v3 bpf-next 12/18] libbpf: support extern resolution for BTF-defined maps in .maps section Andrii Nakryiko
2021-04-23 18:49 ` Yonghong Song
2021-04-23 18:13 ` [PATCH v3 bpf-next 13/18] selftests/bpf: use -O0 instead of -Og in selftests builds Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 14/18] selftests/bpf: omit skeleton generation for multi-linked BPF object files Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 15/18] selftests/bpf: add function linking selftest Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 16/18] selftests/bpf: add global variables " Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 17/18] selftests/bpf: add map " Andrii Nakryiko
2021-04-23 18:53 ` Yonghong Song
2021-04-23 21:23 ` Alexei Starovoitov
2021-04-23 21:39 ` Andrii Nakryiko [this message]
2021-04-23 18:13 ` [PATCH v3 bpf-next 18/18] selftests/bpf: document latest Clang fix expectations for linking tests Andrii Nakryiko
2021-04-23 18:51 ` Yonghong 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=CAEf4BzbRH-5-1MVtEnfLKOMO4f2sVFrdROBLTBT8GrESs1p1XQ@mail.gmail.com \
--to=andrii.nakryiko@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--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 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).