Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp639336rdb; Thu, 19 Oct 2023 14:57:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMX3fu+Iz8Nkdmoz1H3RHKLY4rJM7qPvSy7j6nSmNPD75jIUnv/z/hsTvtSuSwwVLgB98S X-Received: by 2002:a05:6358:6117:b0:143:321:f36b with SMTP id 23-20020a056358611700b001430321f36bmr2883984rws.18.1697752647313; Thu, 19 Oct 2023 14:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697752647; cv=none; d=google.com; s=arc-20160816; b=FdMQba+zQBlfApX0xKfrlCmpOO/JNGVXn3XZkegEPfp+f0lFxTgLyIwYGCpv6lQPry ex5YdJD8qhs/fzfd4OV9zC7pb30RcINywsw2eFIyyrdM389vpINT6rJVpo35G3kt49oR k5j707Um5y2qi1ZVKdhXsy0/gYcV9+vGE3zZYjt08kaOD4EQz977OUZDGmaEVVAqG6D8 QsZn/JgOzIw/hRxcaZzMEw6CMyNNVM5VTc/7GrSiAnH1rJSD59KcWaupjayD6qdogfox Hc4uAVnoA37UWUf3MV7LqPGqrms38/5jXngxk+1/apEzXapevO8rGSx/KAXNuwrFI7Th mhbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=XajYlYAO8Kk7inISBTtrUw4bdn+rl2BtGkmrWxdlT40=; fh=uoi+B6prAUoGzsAECIEbykG9laZBIqtTJeD92hDum5c=; b=U9K567V1uwODSYS7R2jQqZ8z8gUc33AOkLn/Mtz12KzqIgC7Opu4Kmr2yNgJOOA/0V BQpCE3Df0/yOFqRmbwd+4EhvC/42NsQjSby7V1OYOZ8iFf8grDmpyWJEOHJXncL2bHaV wwPlV4Qin4c3a/Jt6Es0s3rttISumIp8kfSvZ92nyocEoE8KhDrkkuYlpEHNQB8NJD/v GlDLfzqoKPVCtjClrY6SqP9LW+39mXIaTwS4M35sroZT8r60MxcnrYVVYEy0+GS7ari4 DHB97QPtf3/+UAN21UYvRTFED31PxEvuPmm+aq4c9PCW+/38bnYDXkhmJiVONYwAWS2S kNhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ArzAO0WT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f17-20020aa79d91000000b0068fe9c452acsi474972pfq.376.2023.10.19.14.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 14:57:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ArzAO0WT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6092A806E4C1; Thu, 19 Oct 2023 14:57:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346626AbjJSV5U (ORCPT + 99 others); Thu, 19 Oct 2023 17:57:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235540AbjJSV5S (ORCPT ); Thu, 19 Oct 2023 17:57:18 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64C9E116 for ; Thu, 19 Oct 2023 14:57:16 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-507a5edc2ebso407e87.1 for ; Thu, 19 Oct 2023 14:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697752634; x=1698357434; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XajYlYAO8Kk7inISBTtrUw4bdn+rl2BtGkmrWxdlT40=; b=ArzAO0WTS7lHFUI+IYunE+dQkaAWbfx4sCzlH248DNc8OZeXw4EEG1Goa5bgrUo8uY qivCEttsgruQTYchqg31D+XjBbN2WlQJD96vxBHM75oH8HQwIS02yIEf90IpOIQu/NHU 5cMBzv6C3YjRQz/SJ8GtviFLigx5H3xe8mJsHR/G8c7wje+i0iYLVGcNW9+IvMekODDA O1peJE29o3XGMKDqz9wfETt05RHF1MFnE6iyfJgdkrDeprWgm6NE3dVMU4qVHjuxFgbm ne7XnFGFMcuWCXmvL5LGiGbjUv9SPfSDtg/WD9IfYMq9LTkAnWUVg0SXPXndOuryXNLO oarQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697752634; x=1698357434; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XajYlYAO8Kk7inISBTtrUw4bdn+rl2BtGkmrWxdlT40=; b=v8xkTfM7ub5wZCZRtsJkkaqBnU7PtwvooCD1/EY3cqP9FoS69sQHE4DoEDHmX3LnDv v3wc1tOz7ocX7m+yJwB8infbB/V+QzoqUWcp96gQG0q7GBFc8AZMcSafZwuYICY60PPc qYB6zpOFKK9hYgkFHHY4uRgYTkRfEd9mbAibJM3w1SNMiZgmEWeMQV0pvAcA9WfGEh6D MOo5LH0kgo+8X6eze/ggClzGEayNrgo3LUJKgxf4ZC6xwmMkGn1z0q1uWGPJNfcwuVle YAyax4IePuTfp7Ut9xFNWSj3y2UBbehKf91OVF/uTsWUv4EZG7JvFs69QhEkK9E6aU9P nbqg== X-Gm-Message-State: AOJu0Yy8+gkTc82ZED8kDvpZm9LdT0OFxQkhvaLsgfAn51EDpFP+DrZ+ eZLz8Yz6/VjxJc4MtZuGs27PZXxuZTH20EuHvjeDBQ== X-Received: by 2002:a05:6512:754:b0:502:a55e:fec0 with SMTP id c20-20020a056512075400b00502a55efec0mr19637lfs.6.1697752634350; Thu, 19 Oct 2023 14:57:14 -0700 (PDT) MIME-Version: 1.0 References: <20230810184853.2860737-1-irogers@google.com> <20230810184853.2860737-2-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Thu, 19 Oct 2023 14:57:00 -0700 Message-ID: Subject: Re: [PATCH v1 1/4] perf parse-events: Remove BPF event support To: Arnaldo Carvalho de Melo Cc: Manu Bretelle , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 19 Oct 2023 14:57:26 -0700 (PDT) On Thu, Oct 19, 2023 at 2:08=E2=80=AFPM Arnaldo Carvalho de Melo wrote: > > 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 wrot= e: > > > Em Fri, Aug 11, 2023 at 11:43:22AM -0300, Arnaldo Carvalho de Melo es= creveu: > > > > Right now it is not applying due to some clash with other changes a= nd > > > > when I tried to apply it manually there were some formatting issues= : > > > > > > > > =E2=AC=A2[acme@toolbox perf-tools-next]$ head ~/wb/1.patch > > > > From SRS0=3DEALy=3DD3=3Dflex--irogers.bounces.google.com=3D3IDHVZAc= KBAUnwtljwxlttlqj.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 -03= 00 (-03) > > > > Received: by 2002:a0c:ab03:0:b0:63d:780e:9480 with SMTP id h3csp908= 198qvb; > > > > Thu, 10 Aug 2023 11:49:52 -0700 (PDT) > > > > X-Google-Smtp-Source: AGHT+IH9N/knUCyQ0tQ2Q0XBH0gqf8A8DB8/37YHWAJDK= Bmz7AGSV9CvCKYDuE3EwxriZFBwtZMs > > > > X-Received: by 2002:a4a:6b4f:0:b0:56c:b2ab:9820 with SMTP id > > > > h15-20020a4a6b4f000000b0056cb2ab9820mr2695332oof.8.1691693392493; = Thu, 10 Aug > > > > =E2=AC=A2[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 > > > > > > > > =E2=AC=A2[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 serie= s: > > > > > > >From adc61b5774a9de62f34d593f164ca02daa6fb44c Mon Sep 17 00:00:00 20= 01 > > > 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 maintai= n > > > 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.fea= ture` [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/feat= ure | \ > > 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 +=3D -DHAVE_LLVM_SUPPORT > LLVM_CONFIG_LIB_COMPONENTS :=3D mcdisassembler all-targets > CFLAGS +=3D $(shell $(LLVM_CONFIG) --cflags --libs $(LLVM_CONFIG_LIB_C= OMPONENTS)) > LIBS +=3D $(shell $(LLVM_CONFIG) --libs $(LLVM_CONFIG_LIB_COMPONENTS= )) > ifeq ($(shell $(LLVM_CONFIG) --shared-mode),static) > LIBS +=3D $(shell $(LLVM_CONFIG) --system-libs $(LLVM_CONFIG_LIB_COMP= ONENTS)) > LIBS +=3D -lstdc++ > endif > LDFLAGS +=3D $(shell $(LLVM_CONFIG) --ldflags) > else > # Fall back on libbfd > ifeq ($(feature-libbfd),1) > LIBS +=3D -lbfd -ldl -lopcodes > else ifeq ($(feature-libbfd-liberty),1) > LIBS +=3D -lbfd -ldl -lopcodes -liberty > else ifeq ($(feature-libbfd-liberty-z),1) > LIBS +=3D -lbfd -ldl -lopcodes -liberty -lz > endif > > # If one of the above feature combinations is set, we support libbfd > ifneq ($(filter -lbfd,$(LIBS)),) > CFLAGS +=3D -DHAVE_LIBBFD_SUPPORT > > # Libbfd interface changed over time, figure out what we need > ifeq ($(feature-disassembler-four-args), 1) > CFLAGS +=3D -DDISASM_FOUR_ARGS_SIGNATURE > endif > ifeq ($(feature-disassembler-init-styled), 1) > CFLAGS +=3D -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: > > =E2=AC=A2[acme@toolbox perf-tools-next]$ cat tools/build/feature/test-llv= m.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; > } > =E2=AC=A2[acme@toolbox perf-tools-next]$ > > And install the llvm-devel package then it back working: > > =E2=AC=A2[acme@toolbox perf-tools-next]$ make -C tools/bpf/bpftool > make: Entering directory '/home/acme/git/perf-tools-next/tools/bpf/bpftoo= l' > > Auto-detecting system features: > ... clang-bpf-co-re: [ on ] > ... llvm: [ on ] > ... libcap: [ on ] > ... libbfd: [ on ] > > =E2=AC=A2[acme@toolbox perf-tools-next]$ cat tools/build/feature/test-llv= m.make.output > =E2=AC=A2[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 > =E2=AC=A2[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 > =E2=AC=A2[acme@toolbox perf-tools-next]$ ldd tools/build/feature/test-llv= m.bin > linux-vdso.so.1 (0x00007ffcaf5d9000) > libLLVM-16.so =3D> /lib64/libLLVM-16.so (0x00007fc4faefa000) > libstdc++.so.6 =3D> /lib64/libstdc++.so.6 (0x00007fc4faca6000) > libm.so.6 =3D> /lib64/libm.so.6 (0x00007fc4fabc5000) > libgcc_s.so.1 =3D> /lib64/libgcc_s.so.1 (0x00007fc4faba1000) > libc.so.6 =3D> /lib64/libc.so.6 (0x00007fc4fa9c3000) > libffi.so.8 =3D> /lib64/libffi.so.8 (0x00007fc4fa9b7000) > libedit.so.0 =3D> /lib64/libedit.so.0 (0x00007fc4fa978000) > libz.so.1 =3D> /lib64/libz.so.1 (0x00007fc4fa95e000) > libtinfo.so.6 =3D> /lib64/libtinfo.so.6 (0x00007fc4fa92b000) > /lib64/ld-linux-x86-64.so.2 (0x00007fc502404000) > =E2=AC=A2[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 fo= r compiling BPF events (-e foo.c)") > > Ok? Reviewed-by: Ian Rogers Thanks, Ian > - Arnaldo