Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp964710rwr; Thu, 4 May 2023 12:03:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7HHQ9t3EwGt548eygmce/9Gs5vL0spdKJJsRcO6SXfm503eH51f6Ko0ok5/neOhYCU+GFe X-Received: by 2002:a17:902:f68e:b0:1a2:58f1:5e1d with SMTP id l14-20020a170902f68e00b001a258f15e1dmr5488251plg.36.1683227006694; Thu, 04 May 2023 12:03:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683227006; cv=none; d=google.com; s=arc-20160816; b=LIKTufqmW69q7NhQh2zd0PyQQToK6JY0m0sl1hiHFF2DnrZWzYl7REL+ISEXCR64r0 PqCKD3b2bWrF9ADvRbkvGvoNwQoTC7Wm1nO3vSZ4pxXw6u7Q8Q00urYLuo5wOgvh5YZu EBWDoisFjm6Gf2o/KslM4Fb4kzJrMuD0WtDZ0x7SAlJl2+PBgd4wDZ+P1pRNWYAiFRrn xSbnn832K9La2prQNfxCz5oI+V2jgHI3g36VgB96VO5HCUXM3oF3Yo4OX7TuRTRLp9Bm N+g741MinU/wfMPaC4QwirKKg5+PV27r+UCX2nicE+Z+K9jGdmPejShD67J95MgE+mwF Ermw== 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=edJ8JLxHdVmfwm25SDvTJnz/EoID7nCi8CNvbRMsr/Y=; b=p39tCqfHdw74owYhpiIpknrfmKlt1TvL7hyDOmJQkt7CC0s4qNWlNROEjRuJIFdTZa 2q6bKDGCqdPZCZ8iO0kK4NMEgNaYxmVHnewbb0OSbmUf8W30WDG4pYyFEdBt1lKxeWuP yri+f8HDGlC4xEmUyTq7iy21S5Eu7QRAD30JbXhS8kakNxcaC43FjK6feWWN/AQZ20su +Y4H4AAKmcXwAipQVEHNLGy5lko6gMTewHR6o2Cz0kOFOR3PeskrhpnkdpsuVUy+N9at J0vn7vgUxDJ7ydZw6ZiT1nFdFdI1SUI6phi0UOQjFWdTBzZHhw5eHCW+wpnivONmkYfp gwgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HxyUUBEf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bi8-20020a170902bf0800b001aae63a371esi11490786plb.478.2023.05.04.12.03.08; Thu, 04 May 2023 12:03:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HxyUUBEf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbjEDSuY (ORCPT + 99 others); Thu, 4 May 2023 14:50:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjEDSuW (ORCPT ); Thu, 4 May 2023 14:50:22 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B56859FB; Thu, 4 May 2023 11:50:21 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-50bd37ca954so20236240a12.0; Thu, 04 May 2023 11:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683226220; x=1685818220; 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=edJ8JLxHdVmfwm25SDvTJnz/EoID7nCi8CNvbRMsr/Y=; b=HxyUUBEfrNH5+wdQIphnaH4JkB8Qm+HXNhXQrIdD1YlKC6+E23iqMKXUzLeqX8RgaG 3mcS8X3Iz+zi3sHXrz6RQcGMG1vVcUmKuw3s5jiC1eApSYToTo2qTU69u8Dg2D9hmzUl b0gXDCLDrzGP+tGLwiLKfgrvBMCseMU9vSvCNjW4j13iqN+x7P+fDfjVldVvuiZYV8bO Tv7t7v7PjJ1ergexjbbTaUPdTyBDAHCfBlkxfJlIDNXzqgCOM9nG6c6jaqH/tIprdi/D 7C396sHI9PMxUtYD7vvRNgpBPlCLOKnJMY5G8h4Pzke3/IdF2U3Fshi2/xj8yeFmNu8y tcyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683226220; x=1685818220; 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=edJ8JLxHdVmfwm25SDvTJnz/EoID7nCi8CNvbRMsr/Y=; b=lwA7KiZTOiZ4rEQmTGmGAREwdmOE9ErP+qacwpr+VMhJI85Fw1abhSAu5zchN6qByY mWeMcL+sUrQgML0TFyRfDZ/T3RVGs68DWYRghKSfqO6+gGjWsFFFzOmH6EVhYqWXUGcO SiWbjM8Bit2ltw297mLlDrhRb6V5FDGdI0L8e4uWiQL9opNHKlOU3Pu3eYY/1G1ySonQ WbRhFjl6RR1S4FgmFLstqYjL4AxnldRPbBCZ1G2Bi0VCdRwSUVTAWENDZLQJzOUXJsZA YRmxzc1hoKqY0+66rWZerFYN+GmupQqn/68aJl+NhGxGqp3LUEC/AkCywWJlMgyrHdVY uWFw== X-Gm-Message-State: AC+VfDzijT+kda8WjhDUf5D0EKmyNunx6C5rbS+dpq82gu/5U9oXh1Jq L2iI4WDWu/A2HQc1IrDpZLAZRfbBW+6IpmXP94M= X-Received: by 2002:a17:907:36c6:b0:94f:432f:243d with SMTP id bj6-20020a17090736c600b0094f432f243dmr6222943ejc.17.1683226219529; Thu, 04 May 2023 11:50:19 -0700 (PDT) MIME-Version: 1.0 References: <20230503211801.897735-1-acme@kernel.org> In-Reply-To: From: Andrii Nakryiko Date: Thu, 4 May 2023 11:50:07 -0700 Message-ID: Subject: Re: BPF skels in perf .Re: [GIT PULL] perf tools changes for v6.4 To: Arnaldo Carvalho de Melo Cc: Linus Torvalds , Song Liu , Andrii Nakryiko , Ingo Molnar , Thomas Gleixner , Jiri Olsa , Namhyung Kim , Clark Williams , Kate Carcia , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Adrian Hunter , Changbin Du , Hao Luo , Ian Rogers , James Clark , Kan Liang , Roman Lozko , Stephane Eranian , Thomas Richter , Arnaldo Carvalho de Melo , bpf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Thu, May 4, 2023 at 10:52=E2=80=AFAM Arnaldo Carvalho de Melo wrote: > > Em Thu, May 04, 2023 at 10:25:30AM -0700, Linus Torvalds escreveu: > > On Thu, May 4, 2023 at 4:09=E2=80=AFAM Arnaldo Carvalho de Melo wrote: > > > Does building runqslower works for you in this same environment where > > > building perf failed? > > > I don't know, and I don't care. I've never used that thing, and I'm > > not going to. > > > And it's irrelevant. Two wrongs do not make a right. > > > I'm going to ignore perf tools pulls going forward if this is the kind > > of argument for garbage that you use. > > > Because a billion flies *can* be wrong. > > I pushed two reverts there that make this back into a > opt-in/experimental feature till we fix the issue you reported: > > =E2=AC=A2[acme@toolbox perf-tools]$ git log --oneline -3 > e7b7a54767a71c67 (HEAD -> perf-tools, acme/perf-tools) Revert "perf build= : Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL" > 6957bdf37a1e6eca Revert "perf build: Warn for BPF skeletons if endian mis= matches" > 1f85d016768ff19f (tag: perf-tools-for-v6.4-1-2023-05-03) perf test record= +probe_libc_inet_pton: Fix call chain match on x86_64 > =E2=AC=A2[acme@toolbox perf-tools]$ > > Its in: > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git perf-tools > > Using a vmlinux.h file built by bpftool from the BTF info, be it in a > vmlinux file or in /sys/kernel/btf/vmlinux (a RAW BTF file) is used for > building the BPF bytecode, using clang: > > =E2=AC=A2[acme@toolbox perf-tools]$ head tools/perf/util/bpf_skel/sample_= filter.bpf.c > // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > // Copyright (c) 2023 Google > #include "vmlinux.h" > #include > #include > #include > > #include "sample-filter.h" > > /* BPF map that will be filled by user space */ > =E2=AC=A2[acme@toolbox perf-tools]$ > > So that it can access kernel types and store the type info for those > types together with the BPF bytecode, as BTF info, and later use this > and relocation records for libbpf to be able to adjust things when > accessed data structures change in the kernel and needs adjustments > based in both the kernel BTF info (/sys/kernel/btf/vmlinux) and the > BPF bytecode being loaded (in its .BTF ELF section). > > Andrii, can you add some more information about the usage of vmlinux.h > instead of using kernel headers? > I'll just say that vmlinux.h is not a hard requirement to build BPF programs, it's more a convenience allowing easy access to definitions of both UAPI and kernel-internal structures for tracing needs and marking them relocatable using BPF CO-RE machinery. Lots of real-world applications just check-in pregenerated vmlinux.h to avoid build-time dependency on up-to-date host kernel and such. If vmlinux.h generation and usage is causing issues, though, given that perf's BPF programs don't seem to be using many different kernel types, it might be a better option to just use UAPI headers for public kernel type definitions, and just define CO-RE-relocatable minimal definitions locally in perf's BPF code for the other types necessary. E.g., if perf needs only pid and tgid from task_struct, this would suffice: struct task_struct { int pid; int tgid; } __attribute__((preserve_access_index)); > - Arnaldo