Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp620310rdb; Thu, 19 Oct 2023 14:09:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHO+MqyejwHmeQEnf/zUQ+luj7mD1XCPTx9O1zuKs1x+dBmyUbWYAnICtRxx6X4maiGQUfQ X-Received: by 2002:a17:903:2ac8:b0:1ca:8306:688c with SMTP id lw8-20020a1709032ac800b001ca8306688cmr71701plb.3.1697749746009; Thu, 19 Oct 2023 14:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697749745; cv=none; d=google.com; s=arc-20160816; b=XTxrlnb4Fsmd6CpN0QrNs50j2/RIrhJLjgdR4MSESXKH1+DxmxzkVr8vVSw45CQUfA qZg7OiHTBCW0M/UBmuZJVdSKH8v685f8K/lbpZ42HNKbUJnMOLHjpSu8TCXaYWc/A8HN Y9uQ6ikMrYSUQ0J3fI1+WBv2JUgcLhubeIID12w66/s2Ys9V9LoSFSKMEdO2ac1FIZMA W9WnDCXudYwawjsfp0qO5jD40ONCaVJAh+RUsoqEJaxdIQMyknfjEJQCj7mG7bybdlH6 haauAJziOBwMgjZhxIfYKVThznKmEQemgrUjOnQ6p1njxtPSl7V9ces6pQei+ndM//Zq ttmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/vo65KYQ0LTjmvMpdA8wr4rjdGlFC1MmXZ80J66kkv8=; fh=Hay7INyl2bzQVS30gEYVnTWGEa+NuS6rK/CSsP1FzCc=; b=juWs4bGHsn5ZDEwB/HbX08XbBsBHa0ekaVWC3WRiJMEKMuAB3A7bk2ZiUsF3BwZoix cGj6/7bys/6bUSQNv3gQUXJNAtETdOByhOQdzE1xmXwLRdXoBtbOwsmPlKt9tLiTylGV xCluCpTZhdgR8l3DjoXgDSy7gjkPCM3btdmQ5FT6thTLcBP+tcWRIgucTIz7TVhQqr9W UMO+LvrY2yUMsTJDN/x6FC64tCKnq25b8v+cnF/sa5W7oslbwEXU3fOxl1ZCfkf8VslG zyJaeE3P0jYwkm+i3ldRHb2gMLQGC6TnkWobP/BuIx/FkxAeClMeZTJW94E1/eEtUdNW k1CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="cX+nY9t/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id e6-20020a170902d38600b001c3b4cb8c88si319562pld.338.2023.10.19.14.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 14:09:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="cX+nY9t/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id E8F9280BA668; Thu, 19 Oct 2023 14:09:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346549AbjJSVIk (ORCPT + 99 others); Thu, 19 Oct 2023 17:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232131AbjJSVIj (ORCPT ); Thu, 19 Oct 2023 17:08:39 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49E94C2 for ; Thu, 19 Oct 2023 14:08:37 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7034BC433C8; Thu, 19 Oct 2023 21:08:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697749716; bh=H0JSXdQwr27GBoH0/fMX6fSYgLkqdrKVJuYB9tG8i1E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cX+nY9t/ak6xNjlOvV4hpYu77dyqggBi89tcXakzQrYV72t18gsnOwENnXitGzCkw qpCpVU/7P6x5FbQMa+C9FU+xcsps4cwI0R+EtLsdfTnOoatS9j9tClJUl7WOeQEns5 f5DeHRyLdl8oyH+hGtrJlsDLOC3z+tvpoevyjswTuQQgeEd/sUiINrSKYIahsobPqe V7qX8dw6jnwjgwkwtEM2gl+B6wYkrcpCfhRKUdDNbUtex8jOB1NFkz7t6tCgDCbnrD nFVjeNdN0iYFRcTQ7vwtukdTDtRhd9ebZw969VY2lVlA0/rmuJ/rOm4YmcsIwjzO7S OLFyN1urnAVUQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id C43D740016; Thu, 19 Oct 2023 18:08:33 -0300 (-03) Date: Thu, 19 Oct 2023 18:08:33 -0300 From: Arnaldo Carvalho de Melo To: Manu Bretelle Cc: Ian Rogers , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Tom Rix , Fangrui Song , Anshuman Khandual , Andi Kleen , Leo Yan , Madhavan Srinivasan , Carsten Haitzler , Ravi Bangoria , "Naveen N. Rao" , Athira Rajeev , Kan Liang , Yang Jihong , James Clark , Tiezhu Yang , Eduard Zingerman , Andrii Nakryiko , Yonghong Song , Rob Herring , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev, Wang Nan , Wang ShaoBo , YueHaibing , He Kuang , Brendan Gregg , Quentin Monnet Subject: Re: [PATCH v1 1/4] perf parse-events: Remove BPF event support Message-ID: References: <20230810184853.2860737-1-irogers@google.com> <20230810184853.2860737-2-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 19 Oct 2023 14:09:03 -0700 (PDT) Em Thu, Oct 19, 2023 at 12:45:08PM -0700, Manu Bretelle escreveu: > cc @quentin > > On Fri, Aug 11, 2023 at 12:41:36PM -0300, Arnaldo Carvalho de Melo wrote: > > Em Fri, Aug 11, 2023 at 11:43:22AM -0300, Arnaldo Carvalho de Melo escreveu: > > > Right now it is not applying due to some clash with other changes and > > > when I tried to apply it manually there were some formatting issues: > > > > > > ⬢[acme@toolbox perf-tools-next]$ head ~/wb/1.patch > > > From SRS0=EALy=D3=flex--irogers.bounces.google.com=3IDHVZAcKBAUnwtljwxlttlqj.htrfhrjpjwsjq.twl@kernel.org Thu Aug 10 17:53:46 2023 > > > Delivered-To: arnaldo.melo@gmail.com > > > Received: from imap.gmail.com [64.233.186.109] > > > by quaco with IMAP (fetchmail-6.4.37) > > > for (single-drop); Thu, 10 Aug 2023 17:53:46 -0300 (-03) > > > Received: by 2002:a0c:ab03:0:b0:63d:780e:9480 with SMTP id h3csp908198qvb; > > > Thu, 10 Aug 2023 11:49:52 -0700 (PDT) > > > X-Google-Smtp-Source: AGHT+IH9N/knUCyQ0tQ2Q0XBH0gqf8A8DB8/37YHWAJDKBmz7AGSV9CvCKYDuE3EwxriZFBwtZMs > > > X-Received: by 2002:a4a:6b4f:0:b0:56c:b2ab:9820 with SMTP id > > > h15-20020a4a6b4f000000b0056cb2ab9820mr2695332oof.8.1691693392493; Thu, 10 Aug > > > ⬢[acme@toolbox perf-tools-next]$ patch -p1 < ~/wb/1.patch > > > patching file tools/perf/Documentation/perf-config.txt > > > patch: **** malformed patch at line 234: ith > > > > > > ⬢[acme@toolbox perf-tools-next]$ > > > > > > I'm trying to apply it manually. > > > > I have this extracted from this patch as the first patch in the series: > > > > >From adc61b5774a9de62f34d593f164ca02daa6fb44c Mon Sep 17 00:00:00 2001 > > From: Ian Rogers > > Date: Fri, 11 Aug 2023 12:19:48 -0300 > > Subject: [PATCH 1/1] perf bpf: Remove support for embedding clang for > > compiling BPF events (-e foo.c) > > > > This never was in the default build for perf, is difficult to maintain > > as it uses clang/llvm internals so ditch it, keeping, for now, the > > external compilation of .c BPF into .o bytecode and its subsequent > > loading, that is also going to be removed, do it separately to help > > bisection and to properly document what is being removed and why. > > > > Committer notes: > > > > Extracted from a larger patch and removed some leftovers, namely > > deleting these now unused feature tests: > > > > tools/build/feature/test-clang.cpp > > tools/build/feature/test-cxx.cpp > > tools/build/feature/test-llvm-version.cpp > > tools/build/feature/test-llvm.cpp > > > > This seem to have broken `llvm` feature detection for `bpftool`. > > The feature detections are still available in `tools/build/Makefile.feature` [0] > but the .cpp files are gone. > > `bpftool` still rely on the `llvm` feature: > > $ git --no-pager grep 'feature-llvm' > tools/bpf/bpftool/Makefile:ifeq ($(feature-llvm),1) > > The result of testing llvm feature is: > > $ cat tools/build/feature/test-llvm.make.output > cc1plus: fatal error: test-llvm.cpp: No such file or directory > compilation terminated. > > With current head: > > make -j $((4*$(nproc))) -C tools/bpf/bpftool && ./tools/bpf/bpftool/bpftool --version > ... > Auto-detecting system features: > ... clang-bpf-co-re: [ on ] > ... llvm: [ OFF ] > ... libcap: [ on ] > ... libbfd: [ on ] > ... > ... > ... > bpftool v7.3.0 > using libbpf v1.3 > features: libbfd, skeletons > > After applying > > git show 56b11a2126bf2f422831ecf6112b87a4485b221b tools/build/feature | \ > patch -p1 -R Ouch, so probably we need just to reintroduce that one tools/build/feature/test-llvm.cpp file. Building perf these days ends up using bpftool, and the end result as noticed with me testing perf, perf trace with bpf, etc didn't change, so I didn't notice :-\ And: ifeq ($(feature-llvm),1) # If LLVM is available, use it for JIT disassembly CFLAGS += -DHAVE_LLVM_SUPPORT LLVM_CONFIG_LIB_COMPONENTS := mcdisassembler all-targets CFLAGS += $(shell $(LLVM_CONFIG) --cflags --libs $(LLVM_CONFIG_LIB_COMPONENTS)) LIBS += $(shell $(LLVM_CONFIG) --libs $(LLVM_CONFIG_LIB_COMPONENTS)) ifeq ($(shell $(LLVM_CONFIG) --shared-mode),static) LIBS += $(shell $(LLVM_CONFIG) --system-libs $(LLVM_CONFIG_LIB_COMPONENTS)) LIBS += -lstdc++ endif LDFLAGS += $(shell $(LLVM_CONFIG) --ldflags) else # Fall back on libbfd ifeq ($(feature-libbfd),1) LIBS += -lbfd -ldl -lopcodes else ifeq ($(feature-libbfd-liberty),1) LIBS += -lbfd -ldl -lopcodes -liberty else ifeq ($(feature-libbfd-liberty-z),1) LIBS += -lbfd -ldl -lopcodes -liberty -lz endif # If one of the above feature combinations is set, we support libbfd ifneq ($(filter -lbfd,$(LIBS)),) CFLAGS += -DHAVE_LIBBFD_SUPPORT # Libbfd interface changed over time, figure out what we need ifeq ($(feature-disassembler-four-args), 1) CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE endif ifeq ($(feature-disassembler-init-styled), 1) CFLAGS += -DDISASM_INIT_STYLED endif endif endif And there is a fallback to using binutils, so most people ended up not noticing. I wonder how to improve the current situation to detect these kinds of problems in the future, i.e. how to notice that some file needed by some Makefile, etc got removed or that some feature test fails because some change in the test .c files makes them fail and thus activates fallbacks like the one above :-\ So if I just get this back: ⬢[acme@toolbox perf-tools-next]$ cat tools/build/feature/test-llvm.cpp // SPDX-License-Identifier: GPL-2.0 #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/raw_ostream.h" #define NUM_VERSION (((LLVM_VERSION_MAJOR) << 16) + (LLVM_VERSION_MINOR << 8) + LLVM_VERSION_PATCH) #if NUM_VERSION < 0x030900 # error "LLVM version too low" #endif int main() { llvm::errs() << "Hello World!\n"; llvm::llvm_shutdown(); return 0; } ⬢[acme@toolbox perf-tools-next]$ And install the llvm-devel package then it back working: ⬢[acme@toolbox perf-tools-next]$ make -C tools/bpf/bpftool make: Entering directory '/home/acme/git/perf-tools-next/tools/bpf/bpftool' Auto-detecting system features: ... clang-bpf-co-re: [ on ] ... llvm: [ on ] ... libcap: [ on ] ... libbfd: [ on ] ⬢[acme@toolbox perf-tools-next]$ cat tools/build/feature/test-llvm.make.output ⬢[acme@toolbox perf-tools-next]$ ls -la tools/build/feature/test-llvm. test-llvm.bin test-llvm.cpp test-llvm.d test-llvm.make.output ⬢[acme@toolbox perf-tools-next]$ ls -la tools/build/feature/test-llvm.bin -rwxr-xr-x. 1 acme acme 17712 Oct 19 18:04 tools/build/feature/test-llvm.bin ⬢[acme@toolbox perf-tools-next]$ ldd tools/build/feature/test-llvm.bin linux-vdso.so.1 (0x00007ffcaf5d9000) libLLVM-16.so => /lib64/libLLVM-16.so (0x00007fc4faefa000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fc4faca6000) libm.so.6 => /lib64/libm.so.6 (0x00007fc4fabc5000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fc4faba1000) libc.so.6 => /lib64/libc.so.6 (0x00007fc4fa9c3000) libffi.so.8 => /lib64/libffi.so.8 (0x00007fc4fa9b7000) libedit.so.0 => /lib64/libedit.so.0 (0x00007fc4fa978000) libz.so.1 => /lib64/libz.so.1 (0x00007fc4fa95e000) libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007fc4fa92b000) /lib64/ld-linux-x86-64.so.2 (0x00007fc502404000) ⬢[acme@toolbox perf-tools-next]$ sudo dnf install llvm-devel I'll get this merged in my perf-tools-fixes-for-v6.6 that I'll submit tomorrow to Linus, thanks for reporting! I'll add your: Reported-by: Manu Bretelle And: Fixes: 56b11a2126bf2f42 ("perf bpf: Remove support for embedding clang for compiling BPF events (-e foo.c)") Ok? - Arnaldo