[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181203150027.11e5e1e3@cakuba.netronome.com>
Date: Mon, 3 Dec 2018 15:00:27 -0800
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: alexei.starovoitov@...il.com,
Daniel Borkmann <daniel@...earbox.net>
Cc: Matteo Croce <mcroce@...hat.com>, netdev <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Y Song <ys114321@...il.com>
Subject: Re: [PATCH bpf-next v2 0/2] sample: xdp1 improvements
On Sun, 2 Dec 2018 02:23:41 +0000, Matteo Croce wrote:
> On Sat, Dec 1, 2018 at 6:11 AM Alexei Starovoitov wrote:
> >
> > On Sat, Dec 01, 2018 at 01:23:04AM +0100, Matteo Croce wrote:
> > > Small improvements to improve the readability and easiness
> > > to use of the xdp1 sample.
> >
> > Applied to bpf-next.
> >
> > I think that sample code could be more useful if it's wrapped with bash
> > script like selftests/test_xdp* tests do.
> > At that point it can move to selftests to get 0bot coverage.
> > Would you be interested in doing that?
> >
>
> It would be nice, but I think that the samples have more urgent issues
> right now.
> Many examples doesn't compile on my system (Fedora 29, GCC 8.2.1, Clang 7.0.0),
> these are the errors that I encounter:
>
> HOSTCC /home/matteo/src/kernel/linux/samples/bpf/test_lru_dist
> /home/matteo/src/kernel/linux/samples/bpf/test_lru_dist.c:39:8: error:
> redefinition of ‘struct list_head’
> struct list_head {
> ^~~~~~~~~
I wonder if there is a way to catch that, and print "run make
headers_install, please" rather than confuse newcomers. Hm..
Like this?
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 35444f4a846b..b1fdea806d4d 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -205,6 +205,15 @@ HOSTCC = $(CROSS_COMPILE)gcc
CLANG_ARCH_ARGS = -target $(ARCH)
endif
+HDR_PROBE := $(shell echo "\#include <linux/types.h>\n struct list_head { int a; }; int main() { return 0; }" | \
+ gcc $(KBUILD_HOSTCFLAGS) -x c - -o /dev/null 2>/dev/null && \
+ echo okay)
+
+ifeq ($(HDR_PROBE),)
+$(warning Detected possible issues with include path.)
+$(warning Please install kernel headers locally (make headers_install))
+endif
+
BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -mattr=help 2>&1 | grep dwarfris)
BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF)
BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usage.*llvm')
Powered by blists - more mailing lists