Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753545AbdLUMIi (ORCPT ); Thu, 21 Dec 2017 07:08:38 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:38014 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752586AbdLUMIe (ORCPT ); Thu, 21 Dec 2017 07:08:34 -0500 Date: Thu, 21 Dec 2017 12:07:42 +0000 From: Roman Gushchin To: Jakub Kicinski CC: , , , , Alexei Starovoitov , Daniel Borkmann , Arnaldo Carvalho de Melo Subject: Re: [RFC PATCH net-next] tools/bpftool: use version from the kernel source tree Message-ID: <20171221120736.GA7054@castle.DHCP.thefacebook.com> References: <20171220201943.24440-1-guro@fb.com> <20171220122921.62e10f33@cakuba.netronome.com> <20171220205332.GA28352@castle> <20171220135218.1ed54acb@cakuba.netronome.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20171220135218.1ed54acb@cakuba.netronome.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Originating-IP: [2620:10d:c092:200::1:ed36] X-ClientProxiedBy: DB6P189CA0014.EURP189.PROD.OUTLOOK.COM (2603:10a6:6:2e::27) To CO1PR15MB1077.namprd15.prod.outlook.com (2a01:111:e400:7b66::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00d9ef57-18ff-4a30-b165-08d5486b7810 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060);SRVR:CO1PR15MB1077; X-Microsoft-Exchange-Diagnostics: 1;CO1PR15MB1077;3:39sWnw3YYpkng8qx0tpHbaszGf52PYKDveYl2Dn0p5MIlyVLAGLfg47wzT+UXIBOxqlOmftdQpwZDlZwJSQrp9v+FYMv1cEDY8tfm/p/UptAfwTsSSC6/pCo4G6OlPlNKqyiGVigRx/y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Ir5k05boRzfTzFFJnpUl30lRQ8ST9xQQ5cGNnBjbtHi54zAQUOSBQZ/oH6xwBHD0Bo7+vaamlBcOuokU+v0vgg0FDX3/xQ0aCGyHdwXQQi5TP/L5xP2dEIV/PIY1yOO8sI2S3lkBvnPHFFZ1gJY2TQluJzsROUeQI9nZUstXBOK5Q18LF4vpgNsuruAAT82KMeMvUiAwjO;4:y6bCPOXWhbvlZYT+ItUt+FbvH+IIFAD1iPP9QJbUAd6Qeb6koDkJjtEsyzaUfg4DW9M7p7GxJpsZGfrgQB5MzOSMIFl9OX6yyz5ADsW0BjuK9YQvINHLBzhAyCwpUZArz7SiwvE7P/xHrDyQZpfD1ryoQ+mpOT9gxUxjd8fS//sHkDSfzob9kPi9vgSmw6oEgPOTS17loqRx0vMYqv6lYlgXLN3SPfsUmcK/CRpjVrKTYbbxp3wEIriVFawgYobf8XfCoflvGmXwmos1L7MpxQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(11241501184)(3002001)(10201501046)(93006095)(93001095)(6041268)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:CO1PR15MB1077;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:CO1PR15MB1077; X-Forefront-PRVS: 0528942FD8 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(39380400002)(346002)(396003)(376002)(366004)(39860400002)(24454002)(51914003)(199004)(189003)(25786009)(39060400002)(55016002)(6246003)(4326008)(478600001)(9686003)(6666003)(76176011)(54906003)(52396003)(386003)(16586007)(6506007)(52116002)(86362001)(47776003)(229853002)(7696005)(316002)(97736004)(58126008)(8936002)(1076002)(83506002)(105586002)(81166006)(33656002)(23726003)(106356001)(6116002)(7736002)(68736007)(8676002)(81156014)(93886005)(2906002)(50466002)(305945005)(2950100002)(5660300001)(6916009)(53936002)(18370500001)(217873001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:CO1PR15MB1077;H:castle.DHCP.thefacebook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CO1PR15MB1077;23:JyFYCDa2YKDj8k35nDsnvGRbUjmJiW9X6nTPMvbx+?= =?us-ascii?Q?lui4tSn1FvBzEwI7K+xcb7c6V88bmY7Hhr6XHEQEPGjnXx2+sfQM2AT2DnvV?= =?us-ascii?Q?n6tVXS/Z13odNO/4SrNPS6ME/qbtUWUnKe99rHAXP5M+50EI+ad84jFUqbnk?= =?us-ascii?Q?Tqb64MCfRUFsJ5upJ/T1OuD8krel2hvd3O6D35OXoTFhLf7aKkdy6MAPxSgK?= =?us-ascii?Q?Qpbx1/lEozo8UVB6jUGAfb8GfEokXUcrCfbOC2OwYnq8Sj6KrAh4Gd60N7Ju?= =?us-ascii?Q?IrhU+jaGgK3tWqty2YGZx4C4HhJS8TMLLXTpA1aXT/uGdCfpx/ANW9Irw35c?= =?us-ascii?Q?NeF4hv41k1YpLJqiH5VdHBEJicFvu/S8ilDgEALfSbKNkR96BSv8hnlZrseh?= =?us-ascii?Q?FwPm6TqBF7ShwSJUYwMIICqpzc+lOusg16WFGHPmVj/82TwLDu+07Oy1aXpf?= =?us-ascii?Q?EcoYXi2rhR5gJ0L1q9w7KhpJwiMLEGBSq4BoW7TIAWXiBOsqkhYk2bYI4KaK?= =?us-ascii?Q?YL/mSJPgBxb4tL77AR94Rk3oMqKEZsBVFhDKDzaenvuAhy8vd7FfAcvQHZnM?= =?us-ascii?Q?wsTxH72WxxOhi0AdAvOiNP/uaWR3shvPT/eeI75dHDPuVfNWCseR0iMe+zo9?= =?us-ascii?Q?HGJdN8O0gRWyBact5BGR8x6kowLCkS9NAYLNCkc4HD7vVdgOxtaMSZkNx5im?= =?us-ascii?Q?k84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w/cmbsPSt8TFeOaOB9blh7d4lDVbUvnDEYOD8Uh2tlCNqklaZQoXmdhC7EQ6IeCBvRi2nU=;5:CGT70sE4BVzjhnulevuAhLBtPQ9ThP+4FKfiyu9F/VSLGmm+f4ExP8qA9C/zvzA6Nli9EaYv5qVjJPEr57xi1yPlV6KmZvlLZsc8qL4cNxQKrxyv6z7Klfkn1uqh1UfySaTroBgc9GwdWW7ktafF15Sg9iVO++G2QcWmIesnssg=;24:hSr7NguU16R+wBF2sc3JjBTYw+6dJGXlB2izfx7RlZcAO9OvmxyXQBynpalaqy3FVAv/0HfGIk9Xnb9bow6gYa4vMgSQGdzbl4Yir+iWlUk=;7:DfZCVJ/Gq1ZvlB3XOJygfDA+ZiZDFMTtRtYk+XTi1HemmD1DBTU9vhbAOAb83HZVJOv0DYCfpO5ibA5JzOBXk3P8Uh0A7sh80OHKw1cWaSDBoTxJbirpu/KyPgOkLmYXiTRU/MuYSFB+trBC+0lA/6aj2BPFkxek+I0OuXy9awh+1p3NQiAsDM3jUfaBmhtUVW9Qtt5860Ueom26w50ty65pgYkVDgHz7IgcQuVnLgBRju36DPmsCYMoWvR2Q7iQ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CO1PR15MB1077;20:hPLNY2b5HAAU0iqH/ouWeLCSrUx3GBt5qsU9d6nBtQC7qm8C8C1J7iuI1gTFfyxEPXkwJNZQu3dLeQrk0YTooFJUN4azTKLXs6soDPKcD9NFFkhNj4Lf+vp/tEjtp8AJdzzwRioT6W2v1XnKIQOsDRJBerGmro9pOA2gi5zgOzg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 12:07:53.9603 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00d9ef57-18ff-4a30-b165-08d5486b7810 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR15MB1077 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-21_03:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3290 Lines: 66 On Wed, Dec 20, 2017 at 01:52:18PM -0800, Jakub Kicinski wrote: > On Wed, 20 Dec 2017 20:53:41 +0000, Roman Gushchin wrote: > > On Wed, Dec 20, 2017 at 12:29:21PM -0800, Jakub Kicinski wrote: > > > On Wed, 20 Dec 2017 20:19:43 +0000, Roman Gushchin wrote: > > > > Bpftool determines it's own version based on the kernel > > > > version, which is picked from the linux/version.h header. > > > > > > > > It's strange to use the version of the installed kernel > > > > headers, and makes much more sense to use the version > > > > of the actual source tree, where bpftool sources are. > > > > > > > > This patch adds $(srctree)/usr/include to the list > > > > of include files, which causes bpftool to use the version > > > > from the source tree. > > > > > > > > Example: > > > > before: > > > > > > > > $ bpftool version > > > > bpftool v4.14.6 > > > > > > > > after: > > > > $ bpftool version > > > > bpftool v4.15.0 > > > > > > Thanks for the patch, this would indeed use some improvement. > > > > > > How about we just run make to get the version like liblockdep does? > > > > > > LIBLOCKDEP_VERSION=$(shell make --no-print-directory -sC ../../.. kernelversion) > > > > > > probably s@../../..@$(srctree)@ > > > > > > $(srctree)/usr/include is not going to be there for out-of-source builds. > > > > Hm, why it's better? It's not only about the kernel version, > > IMO it's generally better to use includes from the source tree, > > rather then system-wide installed kernel headers. > > Right I agree the kernel headers are preferred. I'm not entirely sure > why we don't use them, if it was OK to assume usr/ is there we wouldn't > need the tools/include/uapi/ contraption. Maybe Arnaldo could explain? > > > I've got about out-of-source builds, but do we support it in general? > > How can I build bpftool outside of the kernel tree? > > I've tried a bit, but failed. > > This is what I do: > > make -C tools/bpf/bpftool/ W=1 O=/tmp/builds/bpftool This works perfectly with my patch: $ make -C ~/linux/tools/bpf/ W=1 O=/home/guro/build/ --trace <...> echo ' CC '/home/guro/build/main.o;gcc -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow -D__EXPORTED_HEADERS__ -I/home/guro/linux/tools/include/uapi -I/home/guro/linux/tools/include -I/home/guro/linux/tools/lib/bpf -I/home/guro/linux/kernel/bpf/ -I/home/guro/linux/usr/include -DNEW_DISSASSEMBLER_SIGNATURE -c -MMD -o /home/guro/build/main.o main.c <...> echo ' LINK '/home/guro/build/bpftool;gcc -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow -D__EXPORTED_HEADERS__ -I/home/guro/linux/tools/include/uapi -I/home/guro/linux/tools/include -I/home/guro/linux/tools/lib/bpf -I/home/guro/linux/kernel/bpf/ -I/home/guro/linux/usr/include -DNEW_DISSASSEMBLER_SIGNATURE -o /home/guro/build/bpftool /home/guro/build/common.o /home/guro/build/cgroup.o /home/guro/build/main.o /home/guro/build/json_writer.o /home/guro/build/prog.o /home/guro/build/map.o /home/guro/build/jit_disasm.o /home/guro/build/disasm.o /home/guro/build/libbpf.a -lelf -lbfd -lopcodes /home/guro/build/libbpf.a LINK /home/guro/build/bpftool make[1]: Leaving directory '/home/guro/linux/tools/bpf/bpftool' make: Leaving directory '/home/guro/linux/tools/bpf' $ ./build/bpftool version ./build/bpftool v4.15.0 Thanks!