From: Jakub Kicinski Subject: Re: [PATCH bpf-next v2 0/2] sample: xdp1 improvements Date: Mon, 3 Dec 2018 15:00:27 -0800 Message-ID: <20181203150027.11e5e1e3@cakuba.netronome.com> References: <20181201002306.25834-1-mcroce@redhat.com> <20181201061115.pxm7duta6t23cpvy@ast-mbp.dhcp.thefacebook.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Matteo Croce , netdev , Alexei Starovoitov , John Fastabend , Y Song To: alexei.starovoitov@gmail.com, Daniel Borkmann Return-path: Received: from mail-qk1-f196.google.com ([209.85.222.196]:43958 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbeLCXAc (ORCPT ); Mon, 3 Dec 2018 18:00:32 -0500 Received: by mail-qk1-f196.google.com with SMTP id r71so8460697qkr.10 for ; Mon, 03 Dec 2018 15:00:31 -0800 (PST) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: 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: =20 > > > Small improvements to improve the readability and easiness > > > to use of the xdp1 sample. =20 > > > > 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? > > =20 >=20 > 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: >=20 > 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 =E2=80=98struct list_head=E2=80=99 > 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 =3D $(CROSS_COMPILE)gcc CLANG_ARCH_ARGS =3D -target $(ARCH) endif =20 +HDR_PROBE :=3D $(shell echo "\#include \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 :=3D $(shell $(LLC) -march=3Dbpf -mattr=3Dhelp 2>&1 | grep d= warfris) BTF_PAHOLE_PROBE :=3D $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF) BTF_OBJCOPY_PROBE :=3D $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usag= e.*llvm')