Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3027921ybl; Mon, 20 Jan 2020 14:22:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxCSYaZqmb59CgliNPpCvqlCXTv/7G90Y93DU77t1Ux5S6HmPNqTKd5QBuJZjm1ekEtR4sw X-Received: by 2002:a9d:6e03:: with SMTP id e3mr1300478otr.46.1579558946640; Mon, 20 Jan 2020 14:22:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579558946; cv=none; d=google.com; s=arc-20160816; b=Ry71EJftZh44jcxXuKQtkBWXrueYvcMr7uwY5zOaPdGkMbvm7aPbk1WR2Am9xk5Iy8 69rg7PmYwSy3ce0wSAmXilkgQ8KuUJZfq/SU6BM3X4el2IGkhoZZroAqtesToPWucoUL iJCn0/hMqdaFcYLpc/12NR9eWzOSvVQjs0HCJ1S9XkrPbK1fYVtPmfJavWkV1wP4iqrv 68z49paY4SuFEH4D3DAFNrVn7NpTlCJ5Gb7qe+XUY4afYIe8aBXcsT4SF7rpkaR7QYGu J6gj7465InctYOfADZA+XbcpF5M1AYwN4vI68mgHAGwHnwjZYHKQbGQV0l+6RVod2ymA e79A== 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=wvKfZKzY5I12j5SecEs/3JRExvNNhiJqlDDq3iBdhXo=; b=t5Qgu6IHQbZQNmtEENHdH2iHMP+hGHV1ppeAiZR9Mxs0Lc8F2GXr7bJ9r5QqU+tZlF 8i5ayeIXLPrqgpIRs1IxBv38gttF8OVEZ1R289rgobH/CS/CKntD2CiBoNJ2UpqhBLxc GUdQgN7C/sk4SLorTr+hVCgmSZbW93b5g5GA2Z0x87DqgF5MlNbgHzWGqyw+00xyzJ6H zRp3sWQuMZ0mNTlgY74L/RzRAvfUZJSr4lJgc2G56F0pvitAKyu6tvoOJXBC3aCnKPCl cqFfuKjxA0c88BtyI5PFUwbR9A6RIpX6CwctaDbDBZMe/xdYHHALGi49X3vNh4oQc5K/ 6mmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fhdl7qM8; 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 n139si18652937oig.121.2020.01.20.14.22.12; Mon, 20 Jan 2020 14:22:26 -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=Fhdl7qM8; 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 S1727665AbgATWVJ (ORCPT + 99 others); Mon, 20 Jan 2020 17:21:09 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:35310 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726843AbgATWVJ (ORCPT ); Mon, 20 Jan 2020 17:21:09 -0500 Received: by mail-qk1-f195.google.com with SMTP id z76so833088qka.2; Mon, 20 Jan 2020 14:21:07 -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=wvKfZKzY5I12j5SecEs/3JRExvNNhiJqlDDq3iBdhXo=; b=Fhdl7qM8LX4IpvsWr1dAEePrn5SGSIoS+8d0TlyQlPt13eQ7tARY4+HE6YuYgqcSdu foKFK+ghLxfMRowd4DXEVN1FkPSkcmmwsIrJLE+WCmNbWCsnc8U+BeJirtYaVdneTZ1/ 4T0rpqUmrJKQc0ejJ1JoBDEa2YAmNVzOyhGZr99MuHcsZUoIocUxJs2FaOPGNr2DRCgK sUvB8wfeJhOHREZH9FxmSDcMzXtzb9cjrA09HOtFpgGA8xG9k9YOKzUsFOfLVTro0VJ9 guuFC6M3ZeMDFRPp9gK316GweOHR9EN6AuPKUd8fBmAB9qB89aqCDnhtGvcXgT9Lv90k Y+4A== 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=wvKfZKzY5I12j5SecEs/3JRExvNNhiJqlDDq3iBdhXo=; b=MUv0wpHkptdsblcyUAKdEO6QWwccDulA+vu7ppEpgNihS0Ke1MaWhLidqJDrWYn4gF HhDBxGiOLLkha6+tnmPZyt8aj9UyrmD6Fbl+YMehPuzkOUOn/MYdpAkPeZoS1RTpz7Pj F+5DfPoXoIGW9168FxjpLGEXA44yZt3sKT5PB6SMnimiL9Lym8Or7nuB1Cfnmn1rOLB8 C9DjKVKYjACE2Bk9pijy0Y4dCSFJIoW2RUxtIlrgQdLvhYkX1b0xamAeOWcM590OijtC ORoMqJic23TJxd/3cplMqLGcQYuX3l/khwIO8PhCfaV9xZuZyQgx4KEesx8hRIltXc/r yxwg== X-Gm-Message-State: APjAAAWcKgtk82tDtN/3mHgKr501rwjjFQlKdUAWNOTAlTQU18IJa7DE PY6LXZ2Ljb1G/hFuudinRUQqi/wSXU/lyFbBHJE= X-Received: by 2002:a05:620a:5ae:: with SMTP id q14mr1755114qkq.437.1579558867281; Mon, 20 Jan 2020 14:21:07 -0800 (PST) MIME-Version: 1.0 References: <157952560001.1683545.16757917515390545122.stgit@toke.dk> In-Reply-To: <157952560001.1683545.16757917515390545122.stgit@toke.dk> From: Andrii Nakryiko Date: Mon, 20 Jan 2020 14:20:55 -0800 Message-ID: Subject: Re: [PATCH bpf-next v5 00/11] tools: Use consistent libbpf include paths everywhere 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 Mon, Jan 20, 2020 at 5:08 AM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > We are currently being somewhat inconsistent with the libbpf include path= s, > which makes it difficult to move files from the kernel into an external > libbpf-using project without adjusting include paths. > > Having the bpf/ subdir of $INCLUDEDIR in the include path has never been = a > requirement for building against libbpf before, and indeed the libbpf pkg= -config > file doesn't include it. So let's make all libbpf includes across the ker= nel > tree use the bpf/ prefix in their includes. Since bpftool skeleton genera= tion > emits code with a libbpf include, this also ensures that those can be use= d in > existing external projects using the regular pkg-config include path. > > This turns out to be a somewhat invasive change in the number of files to= uched; > however, the actual changes to files are fairly trivial (most of them are= simply > made with 'sed'). The series is split to make the change for one tool sub= dir at > a time, while trying not to break the build along the way. It is structur= ed like > this: > > - Patch 1-3: Trivial fixes to Makefiles for issues I discovered while cha= nging > the include paths. > > - Patch 4-8: Change the include directives to use the bpf/ prefix, and up= dates > Makefiles to make sure tools/lib/ is part of the include path, but with= out > removing tools/lib/bpf > > - Patch 9-11: Remove tools/lib/bpf from include paths to make sure we don= 't > inadvertently re-introduce includes without the bpf/ prefix. > > Changelog: > > v5: > - Combine the libbpf build rules in selftests Makefile (using Andrii's > suggestion for a make rule). > - Re-use self-tests libbpf build for runqslower (new patch 10) > - Formatting fixes > > v4: > - Move runqslower error on missing BTF into make rule > - Make sure we don't always force a rebuild selftests > - Rebase on latest bpf-next (dropping patch 11) > > v3: > - Don't add the kernel build dir to the runqslower Makefile, pass it in= from > selftests instead. > - Use libbpf's 'make install_headers' in selftests instead of trying to > generate bpf_helper_defs.h in-place (to also work on read-only filesy= stems). > - Use a scratch builddir for both libbpf and bpftool when building in s= elftests. > - Revert bpf_helpers.h to quoted include instead of angled include with= a bpf/ > prefix. > - Fix a few style nits from Andrii > > v2: > - Do a full cleanup of libbpf includes instead of just changing the > bpf_helper_defs.h include. > > --- > Looks good, it's a clear improvement on what we had before, thanks! It doesn't re-build bpftool when bpftool sources changes, but I think it was like that even before, so no need to block on that. Would be nice to have a follow up fixing that, though. $(wildcard $(BPFTOOL_DIR)/*.[ch] $(BPFTOOL_DIR)/Makefile) should do it, same as for libbpf. So, for the series: Acked-by: Andrii Nakryiko Tested-by: Andrii Nakryiko > Toke H=C3=B8iland-J=C3=B8rgensen (11): > samples/bpf: Don't try to remove user's homedir on clean > tools/bpf/runqslower: Fix override option for VMLINUX_BTF > selftests: Pass VMLINUX_BTF to runqslower Makefile > tools/runqslower: Use consistent include paths for libbpf > selftests: Use consistent include paths for libbpf > bpftool: Use consistent include paths for libbpf > perf: Use consistent include paths for libbpf > samples/bpf: Use consistent include paths for libbpf > tools/runqslower: Remove tools/lib/bpf from include path > runsqslower: Support user-specified libbpf include and object paths > selftests: Refactor build to remove tools/lib/bpf from include path > > [...]