bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>, bpf <bpf@vger.kernel.org>,
	Song Liu <liu.song.a23@gmail.com>,
	Quentin Monnet <quentin.monnet@netronome.com>
Subject: Re: [PATCH v2 bpf-next] selftests/bpf: do not ignore clang failures
Date: Tue, 9 Jul 2019 11:14:03 -0700	[thread overview]
Message-ID: <CAEf4BzZEs24=Cp8CdQiXtGXCcMtW430ER7wDHND7YA7OVfz3XA@mail.gmail.com> (raw)
In-Reply-To: <59B1630A-537D-43A1-B75C-87BE80709F93@linux.ibm.com>

On Mon, Jul 8, 2019 at 8:01 AM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> > Am 05.07.2019 um 16:22 schrieb Daniel Borkmann <daniel@iogearbox.net>:
> >
> > On 07/01/2019 08:40 PM, Ilya Leoshkevich wrote:
> >> Am 01.07.2019 um 17:31 schrieb Andrii Nakryiko <andrii.nakryiko@gmail.com>:
> >>> Do we still need clang | llc pipeline with new clang? Could the same
> >>> be achieved with single clang invocation? That would solve the problem
> >>> of not detecting pipeline failures.
> >>
> >> I’ve experimented with this a little, and found that new clang:
> >>
> >> - Does not understand -march, but -target is sufficient.
> >> - Understands -mcpu.
> >> - Understands -Xclang -target-feature -Xclang +foo as a replacement for
> >>  -mattr=foo.
> >>
> >> However, there are two issues with that:
> >>
> >> - Don’t older clangs need to be supported? For example, right now alu32
> >>  progs are built conditionally.
> >
> > We usually require latest clang to be able to test most recent features like
> > BTF such that it helps to catch potential bugs in either of the projects
> > before release.
> >
> >> - It does not seem to be possible to build test_xdp.o without -target
> >>  bpf.
> >
> > For everything non-tracing, it does not make sense to invoke clang w/o
> > the -target bpf flag, see also Documentation/bpf/bpf_devel_QA.rst +573
> > for more explanation, so this needs to be present for building test_xdp.o.
>
> I'm referring to the test introduced in [1]. test_xdp.o might not be an
> ideal target, but even if it's replaced with a more suitable one, the
> llc invocation would still be required. So I could redo the patch as
> follows:
>
> - Replace test_xdp.o with get_cgroup_id_kern.o, use an intermediate .bc
>   file.
> - Use clang without llc for all other eBPF programs.
> - Split out Kbuild include and order-only prerequisites.
>
> What do you think?

How about just forcing llc to fail as well like this:

(clang <whatever> || echo "clain failed") | llc <whatever>

While not pretty, it will get us what we need with very clear
messaging as well. E.g.:

progs/test_btf_newkv.c:21:37: error: expected identifier
PF_ANNOTATE_KV_PAIR(btf_map_legacy, int, struct ipv_counts);
                                    ^
progs/test_btf_newkv.c:21:1: warning: type specifier missing, defaults
to 'int' [-Wimplicit-int]
PF_ANNOTATE_KV_PAIR(btf_map_legacy, int, struct ipv_counts);
^
1 warning and 1 error generated.
llc: error: llc: <stdin>:1:1: error: expected top-level entity
clang failed
^

>
> [1] https://lore.kernel.org/netdev/1541593725-27703-1-git-send-email-quentin.monnet@netronome.com/
>
> Best regards,
> Ilya

  reply	other threads:[~2019-07-09 18:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-27  9:14 [PATCH bpf-next] selftests/bpf: do not ignore clang failures Ilya Leoshkevich
2019-06-28 20:35 ` Song Liu
2019-07-01  8:55   ` Ilya Leoshkevich
2019-07-01 15:31     ` Andrii Nakryiko
2019-07-01 18:40       ` [PATCH v2 " Ilya Leoshkevich
2019-07-05 14:22         ` Daniel Borkmann
2019-07-08 15:01           ` Ilya Leoshkevich
2019-07-09 18:14             ` Andrii Nakryiko [this message]
2019-07-10 13:25               ` Ilya Leoshkevich
2019-07-10 16:04                 ` 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='CAEf4BzZEs24=Cp8CdQiXtGXCcMtW430ER7wDHND7YA7OVfz3XA@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=iii@linux.ibm.com \
    --cc=liu.song.a23@gmail.com \
    --cc=quentin.monnet@netronome.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).