bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Yonghong Song <yhs@fb.com>, bpf <bpf@vger.kernel.org>,
	Alexei Starovoitov <ast@fb.com>, Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH bpf-next] selftests/bpf: change llvm flag -mcpu=probe to -mcpu=v3
Date: Thu, 20 Feb 2020 01:15:30 +0100	[thread overview]
Message-ID: <e53c30a2-5979-6358-025a-bae11a8d01a3@iogearbox.net> (raw)
In-Reply-To: <CAADnVQ+CtuOkpidngFxEXWU_efLOv9_ozj=eSgNo1os1w3b8Sw@mail.gmail.com>

On 2/20/20 12:17 AM, Alexei Starovoitov wrote:
> On Wed, Feb 19, 2020 at 9:06 AM Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
>> On Wed, Feb 19, 2020 at 8:56 AM Daniel Borkmann <daniel@iogearbox.net> wrote:
>>> On 2/19/20 1:42 AM, Yonghong Song wrote:
>>>> The latest llvm supports cpu version v3, which is cpu version v1
>>>> plus some additional 64bit jmp insns and 32bit jmp insn support.
>>>>
>>>> In selftests/bpf Makefile, the llvm flag -mcpu=probe did runtime
>>>> probe into the host system. Depending on compilation environments,
>>>> it is possible that runtime probe may fail, e.g., due to
>>>> memlock issue. This will cause generated code with cpu version v1.
>>>
>>> But those are tiny BPF progs that LLVM is probing. If memlock is not
>>> sufficient, should it try to bump the limit with the diff needed and
>>> only if that fails as well then it bails out to v1.
>>
>> with hundred parallel clangs running and all stamping on the same rlimit
>> I don't think bumping that limit can work.

Right, my main worry is that the default memlock limit is usually very
low, so it would be quite ugly to have the probe fail and fall-back to
v1 even though the underlying kernel would be totally fine to support v3
in general. Hard-coding v3 for selftests is okay; perhaps we need to
resurrect the old CAP_IPC_LOCK patch or some different accounting, the
memlock limit has never been working great from a usability pov.

>> Also building on older kernel should still do v3, since build should
>> produce selftest binaries for the same vmlinux as this kernel tree.
>> We hit this issue with github/libbpf CI. The vm used to do the build
>> was too old. So far we cannot build vmlinux out of latest tree,
>> boot into it and only then build selftests inside. It's too complex
>> for CI system.
>> So we build vmlinux and build selftests in that CI's VM, and then boot into it
>> and run selftests.
>> Upgrading VM is an easy fix for now, but the issue will cause the problems
>> later. So imo fixing selftests build to predictable -mcpu=v3 is the
>> most sensible way.

It would definitely be great to test all at some point, meaning, test run
with v1, v2, v3 to ensure there are no regressions e.g. on verifier side
for all of them.

Thanks,
Daniel

      reply	other threads:[~2020-02-20  0:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19  0:42 [PATCH bpf-next] selftests/bpf: change llvm flag -mcpu=probe to -mcpu=v3 Yonghong Song
2020-02-19  7:34 ` Andrii Nakryiko
2020-02-19 16:56 ` Daniel Borkmann
2020-02-19 17:04   ` Yonghong Song
2020-02-19 17:06   ` Alexei Starovoitov
2020-02-19 23:17     ` Alexei Starovoitov
2020-02-20  0:15       ` Daniel Borkmann [this message]

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=e53c30a2-5979-6358-025a-bae11a8d01a3@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --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).