From: Stanislav Fomichev <sdf@fomichev.me>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Stanislav Fomichev <sdf@google.com>,
netdev@vger.kernel.org, ast@kernel.org, davem@davemloft.net,
daniel@iogearbox.net, ecree@solarflare.com,
quentin.monnet@netronome.com
Subject: Re: [PATCH bpf-next v2 0/6] skip verifier/map tests if kernel support is missing
Date: Tue, 18 Dec 2018 13:30:13 -0800 [thread overview]
Message-ID: <20181218213013.GD20955@mini-arch.hsd1.ca.comcast.net> (raw)
In-Reply-To: <20181218212501.bw5qn3fae6snubze@ast-mbp>
On 12/18, Alexei Starovoitov wrote:
> On Mon, Dec 17, 2018 at 10:25:48AM -0800, Stanislav Fomichev wrote:
> > If test_maps/test_verifier is running against the kernel which doesn't
> > have _all_ BPF features enabled, it fails with an error. This patch
> > series tries to probe kernel support for each failed test and skip
> > it instead. This lets users run BPF selftests in the not-all-bpf-yes
> > environments and received correct PASS/NON-PASS result.
> >
> > See https://www.spinics.net/lists/netdev/msg539331.html for more
> > context.
> >
> > The series goes like this:
> >
> > * patch #1 adds bpf_prog_type_supported() and
> > bpf_map_type_supported() which query the kernel (insert 'return 0'
> > program or try to create empty map with correct key/value sizes) and
> > return supported/unsupported.
> > Note: this functionality can later be reimplemented on top of Quentin's
> > recent 'bpftool feature' patchset if he decides to move the probes
> > into libbpf.
> > * patch #2 skips sockmap tests in test_maps.c if BPF_MAP_TYPE_SOCKMAP
> > map is not supported (if bpf_create_map fails, we probe the kernel
> > for support)
> > * patch #3 skips verifier tests if test->prog_type is not supported (if
> > bpf_verify_program fails, we probe the kernel for support)
> > * patch #4 skips verifier tests if test fixup map is not supported (if
> > create_map fails, we probe the kernel for support)
> > Note: we can probably move this probe into create_map helper and
> > return some argument instead of adding skip_unsupported_map()
> > to each fixup; but I'm not sure it's better.
> > Also note: in current implementation we still print 'Failed to
> > create hash map' from the create_map, but still skip the test.
> > * next patches fix various small issues that arise from the first four:
> > * patch #5 sets "unknown func bpf_trace_printk#6" prog_type to
> > BPF_PROG_TYPE_TRACEPOINT so it is correctly skipped in
> > CONFIG_BPF_EVENTS=n case
> > * patch #6 exposes BPF_PROG_TYPE_CGROUP_{SKB,SOCK,SOCK_ADDR} only when
> > CONFIG_CGROUP_BPF=y, this makes verifier correctly skip appropriate
> > tests
> >
> > v2 changes:
> >
> > * don't sprinkle "ifdef CONFIG_CGROUP_BPF" all around net/core/filter.c,
> > doing it only in the bpf_types.h is enough to disable
> > BPF_PROG_TYPE_CGROUP_{SKB,SOCK,SOCK_ADDR} prog types for non-cgroup
> > enabled kernels
>
> the patches look good to me.
> I think it's ok to proceed this way though long term we probably
> want to have such bpf_prog_type_supported() to be part of libbpf
> and reused in test_verifier.c and in bpftool.
Quentin is working on adding more generic bpf_xyz_type_supported() to
libbpf. My plan is to switch to them as soon as they are merged.
> Daniel, thoughts?
>
next prev parent reply other threads:[~2018-12-18 21:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-17 18:25 [PATCH bpf-next v2 0/6] skip verifier/map tests if kernel support is missing Stanislav Fomichev
2018-12-17 18:25 ` [PATCH bpf-next v2 1/6] selftests/bpf: add map/prog type probe helpers Stanislav Fomichev
2018-12-18 23:21 ` Daniel Borkmann
2018-12-18 23:35 ` Stanislav Fomichev
2018-12-17 18:25 ` [PATCH bpf-next v2 2/6] selftests/bpf: skip sockmap in test_maps if kernel doesn't have support Stanislav Fomichev
2018-12-17 18:25 ` [PATCH bpf-next v2 3/6] selftests/bpf: skip verifier tests for unsupported program types Stanislav Fomichev
2018-12-17 18:25 ` [PATCH bpf-next v2 4/6] selftests/bpf: skip verifier tests for unsupported map types Stanislav Fomichev
2018-12-18 23:25 ` Daniel Borkmann
2018-12-19 0:02 ` Stanislav Fomichev
2018-12-20 20:51 ` Stanislav Fomichev
2018-12-20 22:38 ` Daniel Borkmann
2018-12-20 22:51 ` Stanislav Fomichev
2018-12-17 18:25 ` [PATCH bpf-next v2 5/6] selftests/bpf: mark verifier test that uses bpf_trace_printk as BPF_PROG_TYPE_TRACEPOINT Stanislav Fomichev
2018-12-17 18:25 ` [PATCH bpf-next v2 6/6] bpf: BPF_PROG_TYPE_CGROUP_{SKB,SOCK,SOCK_ADDR} require cgroups enabled Stanislav Fomichev
2018-12-18 21:25 ` [PATCH bpf-next v2 0/6] skip verifier/map tests if kernel support is missing Alexei Starovoitov
2018-12-18 21:30 ` Stanislav Fomichev [this message]
2018-12-18 23:18 ` Daniel Borkmann
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=20181218213013.GD20955@mini-arch.hsd1.ca.comcast.net \
--to=sdf@fomichev.me \
--cc=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=ecree@solarflare.com \
--cc=netdev@vger.kernel.org \
--cc=quentin.monnet@netronome.com \
--cc=sdf@google.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).