Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp160389iob; Tue, 17 May 2022 22:19:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNG6jpKDyYo2LO//XdSBAzbBrGi0HHdFbJfilOJ3JUxoqrdEGrCz05isgaF7PaahuRZ9R8 X-Received: by 2002:a17:902:f652:b0:156:701b:9a2a with SMTP id m18-20020a170902f65200b00156701b9a2amr25294954plg.14.1652851192808; Tue, 17 May 2022 22:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652851192; cv=none; d=google.com; s=arc-20160816; b=ApO/s8nWeLHc63GukeDwdOlDYUgHKcGMeP/82/DXW2Dq8/fW2Fk+LvciodxCLH3dR6 YhGnNtL6g2BIzWSddGPNodeNDSNAkkVANMH17DXWaK0mhV8ugEJnxh73CgNQqwzsIy7V iMKzYx4bv3ZLpPwxhkxh0a7q4ujXsqyRFId9F3V5ydFW9grFAOaRH6ztZqViLDMBYySM NFQTUsgxB+Qqxxlsy6tZJ6ApRx6V6nLRVeTNI0ph7TXhVAzryIcraPEfaRoxGWQWGebU v5txaLupNMWea1vg/kX73CdDqLTWCNjxej6OQ0d/HP4isBaIGTztMdJL7X9PG817OKPp 9xdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=YRzf4o3j3p6GE9ok9UjKci6UUosoBdJH+R8gXtS/sMo=; b=oz1UtLzYXsnZcuOS5YfstvKRNBeX8kO73Uh21xTmN032XMC8Yf1pI5WmARcWylfGx3 TbgKNogHPFNa4A4gMs66GXnrkFZ6oqyM2whIJRxf7vxdSECvimAJYHOWHi3LuPfo840/ VlXHu/zwWpATFO+hGV6+LFO81cEkrf0pyxrp+IiK/oi51PJZbuF2ymoisqjTw/9ebQdn ygFV5AeSIiyOS/8oGI4Qn71XgVIQgrb+l02mFNK9Q0elOoOXz12ljZmBMVRxzFtdBfyO 9R6Tdyeh6PvvDDmvPI4t5UpwLOsKlwfhjnZ5Th8gTt3bi8lm5bfMnSFr8FU4HaxG5g1Z +CVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IQNCaBIJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q137-20020a632a8f000000b003aba3fbb424si1197169pgq.669.2022.05.17.22.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 22:19:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IQNCaBIJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EA422BF75; Tue, 17 May 2022 21:38:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229904AbiEREiG (ORCPT + 99 others); Wed, 18 May 2022 00:38:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229881AbiEREiE (ORCPT ); Wed, 18 May 2022 00:38:04 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0AF7BF46 for ; Tue, 17 May 2022 21:38:02 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id r23so935665wrr.2 for ; Tue, 17 May 2022 21:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YRzf4o3j3p6GE9ok9UjKci6UUosoBdJH+R8gXtS/sMo=; b=IQNCaBIJdHcM5HtQWBdGF+DwM1G99rX1X3ZdEbUEWuQyKNeaoFxWs5No54ZhbeOwFG 5xZzvWkr+3zHTcS8WqJ5uLJKKO0XoXwQz1YIZzK3yhlUTuLJXbe71Je21E/JbEIGjqCW bLgaRVlAlxF7lgY5aj50Ai60FwCorxoLeRToLq25n9WljTUUcpeQVn5MbhIRNhL97njH UJgd9P24WjSWBkw1li4P9j8qAEWAfsWtOjpkqEm1zXKbDfm3d7sSzRz2e/VFEdzswDL+ 5kQ6qwkDOGu4UE2i50mROS0rteKR14i57v4deZoP7d9n10bJsXZNHcgf7SFn0rDDUoUy Y+ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YRzf4o3j3p6GE9ok9UjKci6UUosoBdJH+R8gXtS/sMo=; b=o/EbXX7FfwxBFaCeFQE319kin2Wt1u9NQA3/PXF4/j6/5cvKhvfMkp98S1KttcW4ZA AeZGVLKWR71nrUbc4vpC0Sc+FkC/nr5+A65BihyNHUcnH+oVKxsqF3FnMTwjgn029kFN XZnzPA+SpxyD6dWIvWFDlvJ1YryjEgCq9gpAEd9lEf2G7hh4XDdc9Cpy+yXBxT34LYob k2HhAeLsY8u+C8DOhcTF1RhSHja9DuAV1v1nFrbZGAZd+EtOPvLWJuF+WO0nDz5JaQUX bDoEqnyNPIdimvbQ1XV9wG6gA9WGq4D9dsz2YCLeLtc2H3yBtY9dmw/vNYwBsbAc0oWZ vqlw== X-Gm-Message-State: AOAM532+joNa9X/grDhQZTNnqnxlzy4fPrXnO7msjnAiGk/tHJfZWwhN QziU9D/I6RWQxtqhfZSQwvu0EyHqJqx/usiNwLZpVA== X-Received: by 2002:a5d:448d:0:b0:20d:744:7663 with SMTP id j13-20020a5d448d000000b0020d07447663mr12363014wrq.654.1652848681060; Tue, 17 May 2022 21:38:01 -0700 (PDT) MIME-Version: 1.0 References: <20220511211526.1021908-1-irogers@google.com> <20220511211526.1021908-7-irogers@google.com> <1e9d2bce-b967-dccb-e6af-241830e5b38e@huawei.com> In-Reply-To: <1e9d2bce-b967-dccb-e6af-241830e5b38e@huawei.com> From: Ian Rogers Date: Tue, 17 May 2022 21:37:49 -0700 Message-ID: Subject: Re: [PATCH v2 6/7] perf jevents: Switch build to use jevents.py To: John Garry Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Kan Liang , Andi Kleen , Zhengjun Xing , Felix Fietkau , Qi Liu , Like Xu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Nick Forrington , Kajol Jain , James Clark , Andrew Kilroy , "Paul A . Clarke" , Will Deacon , Mathieu Poirier , ananth.narayan@amd.com, ravi.bangoria@amd.com, santosh.shukla@amd.com, sandipan.das@amd.com, Caleb Biggers , Perry Taylor , Kshipra Bopardikar , Stephane Eranian Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 17, 2022 at 3:32 AM John Garry wrote: > > On 13/05/2022 16:58, Ian Rogers wrote: > > On Fri, May 13, 2022 at 8:38 AM John Garry wrote: > >> > >> On 11/05/2022 22:15, Ian Rogers wrote: > >>> # jevents.py uses os.scandir and type hints present in Python 3.5 released in Sept. 2015. > >>> + JEVENTS_PYTHON_GOOD := $(shell $(PYTHON) -c 'import sys;print("1" if(sys.version_info.major >= 3 and sys.version_info.minor >= 5) else "0")') > >> > >> I think that many - like me - will have python 2.7, so now will find no > >> pmu-events generated any longer after missing this message in the build :( > >> > >> Maybe many will have python >= 3.5 - but I don't know... > > > > So Python 2 has been end-of-life for over 2 years now: > > https://www.python.org/doc/sunset-python-2/ > > There have been a number of LKML patches upgrading python to version 3. > > > > Python 3.5 has some very nice features of os.scandir and type hints, > > so if I set the bar lower than this it hurts the code quality. It is > > also at least 6 years old at this point, and so hopefully not > > unreasonable for a distribution to have picked it up :-) Looking at > > the change to C11 thread: > > https://lore.kernel.org/lkml/20220228103142.3301082-1-arnd@kernel.org/ > > It seems the motivation for picking a language version is the features > > it provides and compatibility. If we choose pre-Python 3.5 we get more > > compatibility but we lose language features. > > > > My feeling is that we shouldn't need to support things that are no > > longer maintained (like Python 2) but I'm less clear if Python 3.5 is > > sufficiently compatible for everyone's needs. I kind of hope so, hence > > making the patches this way. > > Fine, I just think that you need to make this transition as seamless as > possible, otherwise it can be judged as a regression. Agreed. > For example, I have now python 3.6 (default) and 2.7 but it still > doesn't seem to work: > > john@localhost:~/acme/tools/perf> make > BUILD: Doing 'make -j4' parallel build > Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h' > differs from latest version at 'include/linux/coresight-pmu.h' > diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h > Makefile.config:593: No sys/sdt.h found, no SDT events are defined, > please install systemtap-sdt-devel or systemtap-sdt-dev > Makefile.config:871: Python interpreter too old (older than 3.5) > disabling jevent generation > Makefile.config:904: Old version of libbfd/binutils things like PE > executable profiling will not be available > Makefile.config:1092: No openjdk development package found, please > install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel > > Auto-detecting system features: > ... dwarf: [ on ] > ... dwarf_getlocations: [ on ] > ... glibc: [ on ] > ... libbfd: [ OFF ] > ... libbfd-buildid: [ OFF ] > ... libcap: [ on ] > ... libelf: [ on ] > ... libnuma: [ on ] > ... numa_num_possible_cpus: [ on ] > ... libperl: [ on ] > ... libpython: [ on ] > ... libcrypto: [ on ] > ... libunwind: [ on ] > ... libdw-dwarf-unwind: [ on ] > ... zlib: [ on ] > ... lzma: [ on ] > ... get_cpuid: [ on ] > ... bpf: [ on ] > ... libaio: [ on ] > ... libzstd: [ on ] > ... disassembler-four-args: [ on ] > > > make[3]: Nothing to be done for 'install_headers'. > john@localhost:~/acme/tools/perf> python --version > Python 3.6.12 > john@localhost:~/acme/tools/perf> > > which I need to figure out... Yep, I can't explain that :-) You could try something like adding a $(warning ... or similar to the build and running: python3 -c 'import sys; print(sys.version_info)' the jevents.py uses f-strings and so I'll need to bump the version from 3.5 to 3.6 in v2. Python 3.6 was released in December 2016. Thanks, Ian > > > >> > + ifneq ($(JEVENTS_PYTHON_GOOD), 1) > >> > + $(warning Python interpreter too old (older than 3.5) disabling > >> jevent generation) > >> > + NO_JEVENTS := 1 > >> > >> It is possible to flip NO_JEVENTS to be JEVENTS, i.e. no > >> double-negatives, like NO_JEVENTS := 0 > > > > Agreed that double negatives are bad. The NO_... pattern is kind of > > throughout the make files and build files. I preferred the NO_... for > > consistency but if there's a consensus I'm happy to change. > > > > I have no strong preference. I just find that double negatives boggle > the mind. > > Thanks, > john