All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andriin@fb.com>, Yonghong Song <yhs@fb.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	andriy.shevchenko@linux.intel.com, Petr Mladek <pmladek@suse.com>,
	Martin Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	john fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@chromium.org>, Shuah Khan <shuah@kernel.org>,
	Andrey Ignatov <rdna@fb.com>,
	scott.branden@broadcom.com,
	Quentin Monnet <quentin@isovalent.com>,
	Carlos Neira <cneirabustos@gmail.com>,
	Jakub Sitnicki <jakub@cloudflare.com>,
	Ingo Molnar <mingo@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH v7 bpf-next 8/8] selftests/bpf: add test for bpf_seq_printf_btf helper
Date: Mon, 28 Sep 2020 21:42:22 -0700	[thread overview]
Message-ID: <CAEf4Bzb+V-EKgqMFWUGoQLiC_560mCUCdjD4UTPuqnN26-qnvA@mail.gmail.com> (raw)
In-Reply-To: <1601292670-1616-9-git-send-email-alan.maguire@oracle.com>

On Mon, Sep 28, 2020 at 4:36 AM Alan Maguire <alan.maguire@oracle.com> wrote:
>
> Add a test verifying iterating over tasks and displaying BTF
> representation of task_struct succeeds.
>
> Suggested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> ---

Hey Alan,

These selftests rely on having struct btf_ptr and BTF_F_COMPACT (and
other) flags to be present in vmlinux.h. While there is nothing wrong
with that per se, it does break selftests builds on older kernels,
because there struct btf_ptr isn't yet present in kernel:

progs/netif_receive_skb.c:131:21: error: use of undeclared identifier
'BTF_F_NONAME'
        TEST_BTF(str, int, BTF_F_NONAME, "0", 0);
                           ^
progs/netif_receive_skb.c:131:2: error: use of undeclared identifier
'BTF_F_COMPACT'; did you mean 'TT_COMPAT'?
        TEST_BTF(str, int, BTF_F_NONAME, "0", 0);
        ^
progs/netif_receive_skb.c:50:28: note: expanded from macro 'TEST_BTF'
                __u64 _hflags = _flags | BTF_F_COMPACT;                 \
                                         ^
/data/users/andriin/linux/tools/testing/selftests/bpf/tools/include/vmlinux.h:330:2:
note: 'TT_COMPAT' declared here
        TT_COMPAT = 2,
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]

progs/bpf_iter_task_btf.c:21:24: error: variable has incomplete type
'struct btf_ptr'
        static struct btf_ptr ptr = { };
                              ^
/data/users/andriin/linux/tools/testing/selftests/bpf/tools/include/bpf/bpf_helper_defs.h:33:8:
note: forward declaration of 'struct btf_ptr'
struct btf_ptr;


We actually do build the very latest selftests against old kernels
(4.9 and 5.5 at the moment) as part of libbpf CI, so it would be nice
to fix this problem and keep selftests compilable.

Do you mind following up with a change to define struct btf_ptr and
those BTF_F_xxx flags explicitly for selftests only, similarly to how
we do it for bpf_iter context structs? See progs/bpf_iter.h for
examples. Thanks.

>  tools/testing/selftests/bpf/prog_tests/bpf_iter.c  | 74 ++++++++++++++++++++++
>  .../selftests/bpf/progs/bpf_iter_task_btf.c        | 50 +++++++++++++++
>  2 files changed, 124 insertions(+)
>  create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_task_btf.c
>

[...]

  reply	other threads:[~2020-09-29  4:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 11:31 [PATCH v7 bpf-next 0/8] bpf: add helpers to support BTF-based kernel data display Alan Maguire
2020-09-28 11:31 ` [PATCH v7 bpf-next 1/8] bpf: provide function to get vmlinux BTF information Alan Maguire
2020-09-28 11:31 ` [PATCH v7 bpf-next 2/8] bpf: move to generic BTF show support, apply it to seq files/strings Alan Maguire
2020-09-28 11:31 ` [PATCH v7 bpf-next 3/8] bpf: add bpf_snprintf_btf helper Alan Maguire
2020-09-28 11:31 ` [PATCH v7 bpf-next 4/8] selftests/bpf: add bpf_snprintf_btf helper tests Alan Maguire
2020-09-29  8:50   ` Daniel Borkmann
2020-09-28 11:31 ` [PATCH v7 bpf-next 5/8] bpf: bump iter seq size to support BTF representation of large data structures Alan Maguire
2020-09-28 11:31 ` [PATCH v7 bpf-next 6/8] selftests/bpf: fix overflow tests to reflect iter size increase Alan Maguire
2020-09-28 11:31 ` [PATCH v7 bpf-next 7/8] bpf: add bpf_seq_printf_btf helper Alan Maguire
2020-09-28 11:31 ` [PATCH v7 bpf-next 8/8] selftests/bpf: add test for " Alan Maguire
2020-09-29  4:42   ` Andrii Nakryiko [this message]
2020-09-29  1:41 ` [PATCH v7 bpf-next 0/8] bpf: add helpers to support BTF-based kernel data display Alexei Starovoitov

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=CAEf4Bzb+V-EKgqMFWUGoQLiC_560mCUCdjD4UTPuqnN26-qnvA@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andriin@fb.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cneirabustos@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=quentin@isovalent.com \
    --cc=rdna@fb.com \
    --cc=rostedt@goodmis.org \
    --cc=scott.branden@broadcom.com \
    --cc=shuah@kernel.org \
    --cc=songliubraving@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.