Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6736984ybl; Wed, 15 Jan 2020 09:23:25 -0800 (PST) X-Google-Smtp-Source: APXvYqwtz7PvwwOQpGjzRa5NCIZ21R05Qembxt3jlN6xTNj2qLOxjWZhEo24auSRnbNq2/z6kJU1 X-Received: by 2002:a9d:7e99:: with SMTP id m25mr3378103otp.212.1579109004833; Wed, 15 Jan 2020 09:23:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579109004; cv=none; d=google.com; s=arc-20160816; b=ANuh9aUwj1iOp01pWNcoHv7TK9heUANrd2+2jYfB76VD+wiiOCXiqBCyW827gOyUzF VMHEdut+A5zbWZ7P+XDvFUSlp0vqoMzNAVfMRBr7zjiaLna6gPLLsd0uctEcDEaQS3zh WIOWKVH14q69kKA8a0QEVnu1DynJ5+IYw9bhtuORjmlNWn2eGEBn6qAFHWGz/Eyv0CM8 F642r7lKHrTk75e1HN9+usQi6mlRP9xxzCvogsaiCl73Esqg1xE6T1B1iajbw+XMTXzP DMdT9Lo5uCXEJHJ7tDRAORUivynLwHP37tROvwiVI8G/lW1I2P/MV9uND0hfPZ504ejb Jdpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=c+q9bObKfV/TNxL1HH2wA5LqldoKCgE44YTN9MzEObM=; b=llbj3MUWCqZC+wOWwT4gLCQMSPCy2TYZKgotfR4uuKpviAmjwiOzUQx3IRPYekZ2C4 tVaDtaypix8MA38KGLxyCLZfWINXzhpbZRI2RETr63KMlihr2KW5qxYRQxEucitVM1u+ 2aNJ7/DKawa11VqJ5QhD2N7TcD+vrIeIjPrJsnJFWpkirNRwx+mDUHLLI0B2TQBo4Vig +hY9J1fRnwtVdybOBCa62rvCrRAkSI9x88SwaDePsGk86nKSxOGB4V2/gQisBjqSkhmR wH+e4WJg7U8gkbO9hFh3yc8UfGJQCU2A+qkoXOxwzx2w+S6kxyrDny1drZySCrrjL4ti 877Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GrMEzUhQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m20si11077100otq.35.2020.01.15.09.23.11; Wed, 15 Jan 2020 09:23:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GrMEzUhQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729107AbgAORWO (ORCPT + 99 others); Wed, 15 Jan 2020 12:22:14 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:46686 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726574AbgAORWO (ORCPT ); Wed, 15 Jan 2020 12:22:14 -0500 Received: by mail-qk1-f193.google.com with SMTP id r14so16340078qke.13; Wed, 15 Jan 2020 09:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=c+q9bObKfV/TNxL1HH2wA5LqldoKCgE44YTN9MzEObM=; b=GrMEzUhQn0zT6crSejZhHzxJ565zwTFsxUR9ki86EyRy2cx7HvDN74IZyaV6aroql8 K3fgFCmV1hnJaRrk6iJf0Tg94tPjQrxxg4vuKsRva69odUjEQ4f4j2772ygYz+WmMFhL cjrTGWoirgaXuP/24safNCO032yWaugbswo5hvRBFFN/4Ck+Dc1U7D+bf2ToYXx6Josa W3ljqEgmBLdUSYqIwoM7CATcCYyJqse5xecvkBpyk5y2UoWJKzXNJU9v8zFVtbs8/AbH ctM1VPLWN5+dHqy0WrXYem4qJXV+5LScvIQix21l+e/GP2j4mnZa2P2a72TqKUP5PgvQ vx0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=c+q9bObKfV/TNxL1HH2wA5LqldoKCgE44YTN9MzEObM=; b=tDXIFNgiMY6acOiV1NpgEXjQR6zYvEA0TSOfdkFhAxyGbodDwF7z41CrrMr9e3ReXw Mgo8bR9mHKY2JW/A37gx7kteRqcMm2xkmLCe8/qvec1Vl9992g4oH0CNmHUdGvR42FL9 Lwpp63vjegzdjtX+pIzWxI0qUIENRreYVTHrClAB71T0ZR77+mKUv1gdABwJAWlxyVgD 6XbAxrG5p6EIB0Dgv2Qa6Xll7Zw4L1uJdKYXwPJzg8klzXjp1SejJErhoXE1ef+woECI wNPU6ZyczaePQE4s5bnyN27rBh4UW3D0ujaRMNrV22ubQNRwzvDDG7/TuwfTHwBVzZUm vggA== X-Gm-Message-State: APjAAAVmrvtqVMgfGrycNLtD1ciZttIyyrvkVL0sTroVprZAzeXsQiQP 4gb/HUOdp5SZ18k0sD2yn3CSrZRLdK06Cm3ASlY= X-Received: by 2002:a05:620a:5ae:: with SMTP id q14mr24418928qkq.437.1579108932557; Wed, 15 Jan 2020 09:22:12 -0800 (PST) MIME-Version: 1.0 References: <157909756858.1192265.6657542187065456112.stgit@toke.dk> <157909757860.1192265.1725940708658939712.stgit@toke.dk> In-Reply-To: <157909757860.1192265.1725940708658939712.stgit@toke.dk> From: Andrii Nakryiko Date: Wed, 15 Jan 2020 09:22:01 -0800 Message-ID: Subject: Re: [PATCH bpf-next v2 09/10] selftests: Remove tools/lib/bpf from include path To: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Cc: Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , Doug Ledford , Jason Gunthorpe , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Shuah Khan , Networking , bpf , open list , linux-rdma@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , clang-built-linux@googlegroups.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 15, 2020 at 6:16 AM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > From: Toke H=C3=B8iland-J=C3=B8rgensen > > To make sure no new files are introduced that doesn't include the bpf/ > prefix in its #include, remove tools/lib/bpf from the include path > entirely, and use tools/lib instead. To fix the original issue with > bpf_helper_defs.h being stale, change the Makefile rule to regenerate the > file in the lib/bpf dir instead of having a local copy in selftests. > > Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen > --- > tools/testing/selftests/bpf/.gitignore | 3 ++- > tools/testing/selftests/bpf/Makefile | 16 ++++++++-------- > 2 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selft= ests/bpf/.gitignore > index 1d14e3ab70be..17dd02651dee 100644 > --- a/tools/testing/selftests/bpf/.gitignore > +++ b/tools/testing/selftests/bpf/.gitignore > @@ -33,10 +33,11 @@ libbpf.pc > libbpf.so.* > test_hashmap > test_btf_dump > +test_cgroup_attach > +test_select_reuseport These were moved into test_progs, they are not independent binaries anymore, you probably just had old leftovers lying in your selftests/bpf directory. Let's not re-add them. > xdping > test_cpp > *.skel.h > /no_alu32 > /bpf_gcc > /tools > -bpf_helper_defs.h > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftes= ts/bpf/Makefile > index cd98ae875e30..4889cc3ead4b 100644 > --- a/tools/testing/selftests/bpf/Makefile > +++ b/tools/testing/selftests/bpf/Makefile > @@ -21,7 +21,7 @@ LLC ?=3D llc > LLVM_OBJCOPY ?=3D llvm-objcopy > BPF_GCC ?=3D $(shell command -v bpf-gcc;) > CFLAGS +=3D -g -Wall -O2 $(GENFLAGS) -I$(CURDIR) -I$(APIDIR) -I$(LIBDIR)= \ > - -I$(BPFDIR) -I$(GENDIR) -I$(TOOLSINCDIR) \ > + -I$(GENDIR) -I$(TOOLSINCDIR) \ > -Dbpf_prog_load=3Dbpf_prog_test_load = \ > -Dbpf_load_program=3Dbpf_test_load_program > LDLIBS +=3D -lcap -lelf -lz -lrt -lpthread > @@ -129,7 +129,7 @@ $(OUTPUT)/runqslower: force > $(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower = \ > OUTPUT=3D$(CURDIR)/tools/ > > -BPFOBJ :=3D $(OUTPUT)/libbpf.a > +BPFOBJ :=3D $(BPFDIR)/libbpf.a We can't do that. See fa633a0f8919 ("libbpf: Fix build on read-only filesystems") for why and why we have this problem with bpf_helper_defs.h in the first place. > > $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BP= FOBJ) > > @@ -155,17 +155,17 @@ force: > DEFAULT_BPFTOOL :=3D $(OUTPUT)/tools/sbin/bpftool > BPFTOOL ?=3D $(DEFAULT_BPFTOOL) > > -$(DEFAULT_BPFTOOL): force > +$(DEFAULT_BPFTOOL): force $(BPFOBJ) do we need this? bpftool's makefile will build its own libbpf.a independently. We can probably optimize that, but see above, we need to ensure that we build only within selftest/bpf dirs. This "read-only outside of selftests/bpf" requirement actually made me realize that we probably need to specify OUTPUT pointing somewhere inside selftests/bpf/tools subdir to build entire bpftool within selftests/bpf directory and not touch anything outside. Do you mind fixing that while you are at it? > $(Q)$(MAKE) $(submake_extras) -C $(BPFTOOLDIR) = \ > prefix=3D DESTDIR=3D$(OUTPUT)/tools/ install > > $(BPFOBJ): force > - $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) OUTPUT=3D$(OUTPUT)/ > + $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) OUTPUT=3D$(BPFDIR)/ $(= BPFOBJ) > > -BPF_HELPERS :=3D $(OUTPUT)/bpf_helper_defs.h $(wildcard $(BPFDIR)/bpf_*.= h) > -$(OUTPUT)/bpf_helper_defs.h: $(BPFOBJ) > +BPF_HELPERS :=3D $(BPFDIR)/bpf_helper_defs.h $(wildcard $(BPFDIR)/bpf_*.= h) > +$(BPFDIR)/bpf_helper_defs.h: $(BPFOBJ) > $(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) = \ > - OUTPUT=3D$(OUTPUT)/ $(OUTPUT)/bpf_helper_defs.h > + OUTPUT=3D$(BPFDIR)/ $(BPFDIR)/bpf_helper_defs.h > > # Get Clang's default includes on this system, as opposed to those seen = by > # '-target bpf'. This fixes "missing" files on some architectures/distro= s, > @@ -186,7 +186,7 @@ MENDIAN=3D$(if $(IS_LITTLE_ENDIAN),-mlittle-endian,-m= big-endian) > CLANG_SYS_INCLUDES =3D $(call get_sys_includes,$(CLANG)) > BPF_CFLAGS =3D -g -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) = \ > -I$(OUTPUT) -I$(CURDIR) -I$(CURDIR)/include/uapi \ > - -I$(APIDIR) -I$(LIBDIR) -I$(BPFDIR) -I$(abspath $(OUTPUT)/..= /usr/include) > + -I$(APIDIR) -I$(LIBDIR) -I$(abspath $(OUTPUT)/../usr/include= ) > > CLANG_CFLAGS =3D $(CLANG_SYS_INCLUDES) \ > -Wno-compare-distinct-pointer-types >