Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4808755ybc; Tue, 26 Nov 2019 15:12:12 -0800 (PST) X-Google-Smtp-Source: APXvYqyjgvd+lKLSK5R1fzkjzqk/lDPMWBasXwkqvj7OmmmCB2Skr2gWDfHOton0zgjbE5KGPbFc X-Received: by 2002:aa7:c5d3:: with SMTP id h19mr28646610eds.120.1574809931910; Tue, 26 Nov 2019 15:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574809931; cv=none; d=google.com; s=arc-20160816; b=OwEWuPiVelI2YJbuu3cGtjhLrtx8qzi2AP3IL982l5FBNY4FQA6fS15xDHBnJKtF25 dVHr2Xwby9gPSkr1eUFwQQG4U9fbcvtw9DyhC1s9HBlUJ1qDaESV8VQ9ozkgA2+Tjux3 H22rCUi29Qr02QC/UvC8ARmPIYxsEoBQ1cP5AHefMdYIlOvFD4cjw/qh21T6BxOwxAid e/uW7Dui7Y7jArHdtiU7+XSqEaXtylbjvXikjymH4kVb+x18a2yI+xQmGjKPsB5ENgdC KzZJBSrNp7saecoLIxGudpx6DrBSOhL0pQPlBqjWj3PGpmP7UPiOdTti+AR4JUW8js7T /lOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KBpvCHEa5sLELqT+roIOkYleYG/FrG+DhoT0SoH7wto=; b=f/7A//bCDb+7iE6iWrBWpbranGxx+wKzqBsMjjGoX7nEJRWmLjGVwO0FMSWjuNOuEZ oqgnDV652mSNSfUPdIFCM+n6OEBj8c3jH5Uvm7wci0OylSOMT/x6wVinCvKOwxghWQt0 4lZ8pYDgSaRdWyhFCC+n1jHG93yjIR9qGnv1uBaVvp7Z7TAO+szDRLmf6Za4cLuR4anW A/MjWfPUieVC5lTdHeCRVbrLi+IFUeHS0MkGggUkCaX8u8UF5ZPtaDU54Nw35WHiAIFm SeXoiICH2ZRaycCf/woJGWOv8A7lAwDTho5db7uR1Lx0EKt3L+Ttt4qdFjm35hOW/WCS REgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fomichev-me.20150623.gappssmtp.com header.s=20150623 header.b=Qcqygajn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dd22si2498123edb.232.2019.11.26.15.11.44; Tue, 26 Nov 2019 15:12:11 -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=@fomichev-me.20150623.gappssmtp.com header.s=20150623 header.b=Qcqygajn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726571AbfKZXKe (ORCPT + 99 others); Tue, 26 Nov 2019 18:10:34 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:46321 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbfKZXKd (ORCPT ); Tue, 26 Nov 2019 18:10:33 -0500 Received: by mail-pf1-f196.google.com with SMTP id 193so9930464pfc.13 for ; Tue, 26 Nov 2019 15:10:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fomichev-me.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=KBpvCHEa5sLELqT+roIOkYleYG/FrG+DhoT0SoH7wto=; b=QcqygajnmtxaddE8/+AVs9ixIiq/T+dAFkPCspbbuZ7uTZB05Nwtu5lcic9Sg8WP4R Xo+tgNd9z2hVN4Tp1KW/2rr7Kavy4k/VAzPhkgzC6bcYQepqYVBhj//ESPxcNPKBEFe+ kOHAoPJY+D49wBam22nG743QpapWP8hQmkY3OGJU6cMdmZYEWDvBUcH9Ni6Ymd5lUAeT BBwfxcLulCDgZda5ti3fY9z4uFQVbB4DPtgRNvoOD2nzBl5p1Iz4xR4OVya5qAy7k7nQ G2mf0521nk7tnXeuWYhRYMvWDjk0j3oC1+9AxnM6w55AsKBFqosPI3nGSp5yn2haHK1z WFjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=KBpvCHEa5sLELqT+roIOkYleYG/FrG+DhoT0SoH7wto=; b=lqZVHjlLBmSdwSh5z2QS+WMjR2vUdylXZbyg6sz3uTQXcJIITuWccMKHu0wlgyLKdo FgThs1DdQDtOJJArC4p89J79Rzb8Ve0SXGqF+/OPccE2mAGhUZpKOQ9JyVUKItWXLYi/ fnhGT5sSX0wdqt40cb2R3b9YkE64PnX9Mg1y98y/d5sfHdsSTz/HYk574v2r9M/Bj7za sS7wxwbmtvADbSbReOtH0Hb4kpP6DvjXu4tU3WDqtaU3AzkKF3gYR6hvWde7MxPZAgHi ihfezfwTam7SMKEc7jS0vto7kVPYecZCUMBBksRBUOMBDKD43ZIFv/+pxfe4pzy1CY6L spAg== X-Gm-Message-State: APjAAAX0DBq2RWIkQJ1FtCiPHoiVPGwdNVxCdfbI/gsX24JMjT0MJG6y AF3aFAjSQdt8Hsq+TOJ9xrIDNw== X-Received: by 2002:a63:190a:: with SMTP id z10mr1111375pgl.153.1574809832264; Tue, 26 Nov 2019 15:10:32 -0800 (PST) Received: from localhost ([2601:646:8f00:18d9:d0fa:7a4b:764f:de48]) by smtp.gmail.com with ESMTPSA id 206sm15686831pfu.45.2019.11.26.15.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 15:10:31 -0800 (PST) Date: Tue, 26 Nov 2019 15:10:30 -0800 From: Stanislav Fomichev To: Andrii Nakryiko Cc: Arnaldo Carvalho de Melo , Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= , Andrii Nakryiko , Adrian Hunter , Alexei Starovoitov , Daniel Borkmann , Jiri Olsa , Martin KaFai Lau , Namhyung Kim , bpf , Networking , linux-perf-users@vger.kernel.org, Linux Kernel Mailing List , Quentin Monnet Subject: Re: [PATCH] libbpf: Fix up generation of bpf_helper_defs.h Message-ID: <20191126231030.GE3145429@mini-arch.hsd1.ca.comcast.net> References: <20191126151045.GB19483@kernel.org> <20191126154836.GC19483@kernel.org> <87imn6y4n9.fsf@toke.dk> <20191126183451.GC29071@kernel.org> <87d0dexyij.fsf@toke.dk> <20191126190450.GD29071@kernel.org> <20191126221018.GA22719@kernel.org> <20191126221733.GB22719@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/26, Andrii Nakryiko wrote: > On Tue, Nov 26, 2019 at 2:17 PM Arnaldo Carvalho de Melo > wrote: > > > > Em Tue, Nov 26, 2019 at 07:10:18PM -0300, Arnaldo Carvalho de Melo escreveu: > > > Em Tue, Nov 26, 2019 at 02:05:41PM -0800, Andrii Nakryiko escreveu: > > > > On Tue, Nov 26, 2019 at 11:12 AM Arnaldo Carvalho de Melo > > > > wrote: > > > > > > > > > > Em Tue, Nov 26, 2019 at 07:50:44PM +0100, Toke H?iland-J?rgensen escreveu: > > > > > > Arnaldo Carvalho de Melo writes: > > > > > > > > > > > > > Em Tue, Nov 26, 2019 at 05:38:18PM +0100, Toke H?iland-J?rgensen escreveu: > > > > > > >> Arnaldo Carvalho de Melo writes: > > > > > > >> > > > > > > >> > Em Tue, Nov 26, 2019 at 12:10:45PM -0300, Arnaldo Carvalho de Melo escreveu: > > > > > > >> >> Hi guys, > > > > > > >> >> > > > > > > >> >> While merging perf/core with mainline I found the problem below for > > > > > > >> >> which I'm adding this patch to my perf/core branch, that soon will go > > > > > > >> >> Ingo's way, etc. Please let me know if you think this should be handled > > > > > > >> >> some other way, > > > > > > >> > > > > > > > >> > This is still not enough, fails building in a container where all we > > > > > > >> > have is the tarball contents, will try to fix later. > > > > > > >> > > > > > > >> Wouldn't the right thing to do not be to just run the script, and then > > > > > > >> put the generated bpf_helper_defs.h into the tarball? > > > > > > > > > > > > I would rather continue just running tar and have the build process > > > > > > > in-tree or outside be the same. > > > > > > > > > > > > Hmm, right. Well that Python script basically just parses > > > > > > include/uapi/linux/bpf.h; and it can be given the path of that file with > > > > > > the --filename argument. So as long as that file is present, it should > > > > > > be possible to make it work, I guess? > > > > > > > > > > > However, isn't the point of the tarball to make a "stand-alone" source > > > > > > distribution? > > > > > > > > > > Yes, it is, and as far as possible without any prep, just include the > > > > > in-source tree files needed to build it. > > > > > > > > > > > I'd argue that it makes more sense to just include the > > > > > > generated header, then: The point of the Python script is specifically > > > > > > to extract the latest version of the helper definitions from the kernel > > > > > > source tree. And if you're "freezing" a version into a tarball, doesn't > > > > > > it make more sense to also freeze the list of BPF helpers? > > > > > > > > > > Your suggestion may well even be the only solution, as older systems > > > > > don't have python3, and that script requires it :-\ > > > > > > > > > > Some containers were showing this: > > > > > > > > > > /bin/sh: 1: /git/linux/scripts/bpf_helpers_doc.py: not found > > > > > Makefile:184: recipe for target 'bpf_helper_defs.h' failed > > > > > make[3]: *** [bpf_helper_defs.h] Error 127 > > > > > make[3]: *** Deleting file 'bpf_helper_defs.h' > > > > > Makefile.perf:778: recipe for target '/tmp/build/perf/libbpf.a' failed > > > > > > > > > > That "not found" doesn't mean what it looks from staring at the above, > > > > > its just that: > > > > > > > > > > nobody@1fb841e33ba3:/tmp/perf-5.4.0$ head -1 /tmp/perf-5.4.0/scripts/bpf_helpers_doc.py > > > > > #!/usr/bin/python3 > > > > > nobody@1fb841e33ba3:/tmp/perf-5.4.0$ ls -la /usr/bin/python3 > > > > > ls: cannot access /usr/bin/python3: No such file or directory > > > > > nobody@1fb841e33ba3:/tmp/perf-5.4.0$ > > > > > > > > > > So, for now, I'll keep my fix and start modifying the containers where > > > > > this fails and disable testing libbpf/perf integration with BPF on those > > > > > containers :-\ > > > > > > > > I don't think there is anything Python3-specific in that script. I > > > > changed first line to > > > > > > > > #!/usr/bin/env python > > > > > > > > and it worked just fine. Do you mind adding this fix and make those > > > > older containers happy(-ier?). > > > > > > I'll try it, was trying the other way around, i.e. adding python3 to > > > those containers and they got happier, but fatter, so I'll remove that > > > and try your way, thanks! > > > > > > I didn't try it that way due to what comes right after the interpreter > > > line: > > > > > > #!/usr/bin/python3 > > > # SPDX-License-Identifier: GPL-2.0-only > > > # > > > # Copyright (C) 2018-2019 Netronome Systems, Inc. > > > > > > # In case user attempts to run with Python 2. > > > from __future__ import print_function > > > > And that is why I think you got it working, that script uses things > > like: > > > > print('Parsed description of %d helper function(s)' % len(self.helpers), > > file=sys.stderr) > > > > That python2 thinks its science fiction, what tuple is that? Can't > > understand, print isn't a function back then. > > Not a Python expert (or even regular user), but quick googling showed > that this import is the way to go to use Python3 semantics of print > within Python2, so seems like that's fine. But maybe Quentin has > anything to say about this. We are using this script with python2.7, works just fine :-) So maybe doing s/python3/python/ is the way to go, whatever default python is installed, it should work with that. > > https://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html#the-print-function > > > > I've been adding python3 to where it is available and not yet in the > > container images, most are working after that, some don't need because > > they need other packages for BPF to work and those are not available, so > > nevermind, lets have just the fix I provided, I'll add python3 and life > > goes on. > > > > - Arnaldo