dwarves.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>,
	Yonghong Song <yhs@fb.com>, bpf <bpf@vger.kernel.org>,
	dwarves@vger.kernel.org, siudin@fb.com
Subject: Re: latest pahole breaks libbpf CI and let's talk about staging
Date: Fri, 18 Jun 2021 14:21:00 -0300	[thread overview]
Message-ID: <YMzV/C2A0PAHsLuD@kernel.org> (raw)
In-Reply-To: <CAEf4BzZWq21zP+1C4=qqWGQ3WUXK-pvt+rWpcsh_971qAw4Wzw@mail.gmail.com>

Em Thu, Jun 17, 2021 at 02:52:57PM -0700, Andrii Nakryiko escreveu:
> On Thu, Jun 17, 2021 at 1:39 PM Arnaldo Carvalho de Melo
> <arnaldo.melo@gmail.com> wrote:
> >
> > Em Thu, Jun 17, 2021 at 01:00:11PM -0700, Andrii Nakryiko escreveu:
> > > On Thu, Jun 17, 2021 at 7:48 AM Arnaldo Carvalho de Melo
> > > <arnaldo.melo@gmail.com> wrote:
> > > >
> > > > Em Wed, Jun 16, 2021 at 03:36:54PM -0700, Andrii Nakryiko escreveu:
> > > > > On Wed, Jun 16, 2021 at 1:41 PM Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
> > > > > > And if I use pahole's BTF loader I find the info about that function:
> > > > > >
> > > > > > [acme@seventh linux]$ strace -e openat -o /tmp/bla pfunct -F btf tcp_cong_avoid_ai  ; grep vmlinux /tmp/bla
> > > > > > void tcp_cong_avoid_ai(struct tcp_sock * tp, u32 w, u32 acked);
> > > > > > openat(AT_FDCWD, "/sys/kernel/btf/vmlinux", O_RDONLY) = 3
> > > > > >
> > > > > > So this should be unrelated to the breakage you noticed in the CI.
> > > > > >
> > > > > > I'm trying to to reproduce the CI breakage by building the kernel and
> > > > > > running selftests after a reboot.
> > > > > >
> > > > > > I suspect I'm missing something, can you see what it is?
> > > > >
> > > > > Oh, I didn't realize initially what it is. This is not kernel-related,
> > > > > you are right. You just need newer Clang. Can you please use nightly
> > > > > version or build from sources? Basically, your Clang is too old and it
> > > > > doesn't generate BTF information for extern functions in BPF code.
> > > >
> > > > Oh well, I thought that that clang was new enough, the system being
> > > > Fedora rawhide:
> > > >
> > > > [acme@seventh ~]$ clang -v |& head -1
> > > > clang version 12.0.0 (https://github.com/llvm/llvm-project 87369c626114ae17f4c637635c119e6de0856a9a)
> > > >
> > > > I'm now building the single-repo main...
> > > >
> > > > Would you consider a patch for libbpf that would turn this:
> > > >
> > > > > > > libbpf: failed to find BTF for extern 'tcp_cong_avoid_ai' [27] section: -2
> > > > > > > Error: failed to open BPF object file: No such file or directory
> > > > > > > make: *** [Makefile:460: /mnt/linux/tools/testing/selftests/bpf/bpf_cubic.skel.h] Error 255
> > > > > > > make: *** Deleting file '/mnt/linux/tools/testing/selftests/bpf/bpf_cubic.skel.h'
> > > > > > > make: Leaving directory '/mnt/linux/tools/testing/selftests/bpf'
> > > >
> > > > Into:
> > > >
> > > > libbpf: failed to find BTF for extern 'tcp_cong_avoid_ai' [27] section: -2
> > > > HINT: Please update your clang/llvm toolchain to at least cset abcdef123456
> > > > HINT: That is where clang started generating BTF information for extern functions in BPF code.
> > > >
> > > > ?
> > > >
> > > > :-)
> > >
> > > I'd rather not :)
> >
> > Not even a "please update clang?"
> >
> 
> It could be old clang, it could also be because BPF program wasn't
> built with BTF (i.e., you didn't specify -g during clang invocation),
> it could probably be due to some other problems as well.

Perhaps:

"Please look at http://bla.html/known-reasons-for-failure.html?

Perhaps we could even ask the Cilium people to take care of that since
they have such wonderful, detailed docs? 8-)

I understand that it is indeed difficult (albeit I find it valid/useful)
to give useful information about the myriad ways this can blown up, but
reducing to some degree the difficulties of testing libbpf, etc, is
something I think is important.
 
> I don't want libbpf to turn into a library that's constantly trying to
> guess possible problems. It will become a complete mess to maintain.
> And when it will still be wrong sometimes, causing more harm than
> being helpful. Especially for relatively uncommon problems like this.
> 
> Those people who are trying to use features like BPF unstable helpers
> (calling whitelisted kernel functions), should know that they need
> Clang of some version and build with BTF. We have that also mentioned
> in selftest/bpf/README.rst. I'd rather not duplicate all that in
> libbpf code as well.

Perhaps then just say:

"Please run: cat tools/testing/selftest/bpf/README.rst"

8-)

This could be in the makefile, no need to bother libbpf with that.

You're working on this daily, some people do it from time to time, but
nah, I'll stop here, felt just that I had to say it fwiw.

- Arnaldo
 
> > "-2" and "Error 255" doesn't seem that helpful :-\
> 
> But "failed to find BTF for extern 'tcp_cong_avoid_ai'" is pretty
> helpful. -2 is for more involved debugging, if necessary.

  reply	other threads:[~2021-06-18 17:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 23:30 latest pahole breaks libbpf CI and let's talk about staging Andrii Nakryiko
2021-06-16 14:56 ` Arnaldo Carvalho de Melo
2021-06-16 16:40   ` Arnaldo Carvalho de Melo
2021-06-16 20:41     ` Arnaldo Carvalho de Melo
2021-06-16 22:36       ` Andrii Nakryiko
2021-06-17 14:48         ` Arnaldo Carvalho de Melo
2021-06-17 19:53           ` Arnaldo Carvalho de Melo
2021-06-17 20:03             ` Andrii Nakryiko
2021-06-17 20:41               ` Arnaldo Carvalho de Melo
2021-06-17 21:56                 ` Andrii Nakryiko
2021-06-17 20:00           ` Andrii Nakryiko
2021-06-17 20:39             ` Arnaldo Carvalho de Melo
2021-06-17 21:52               ` Andrii Nakryiko
2021-06-18 17:21                 ` Arnaldo Carvalho de Melo [this message]
2021-06-16 17:40   ` Andrii Nakryiko
2021-06-16 18:25     ` Arnaldo Carvalho de Melo
2021-06-16 22:38       ` Andrii Nakryiko
2021-06-17  0:16         ` Arnaldo Carvalho de Melo
2021-06-17  4:26           ` 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=YMzV/C2A0PAHsLuD@kernel.org \
    --to=acme@kernel.org \
    --cc=andrii.nakryiko@gmail.com \
    --cc=arnaldo.melo@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=siudin@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).