Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1460789rwr; Fri, 5 May 2023 14:42:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5lCDPcHIOuj/y4i6wRtvQ4YEwTtPKRd3JdlrlScSFQrHx1pRCnNsPu3pUXPNElgsSD7Bge X-Received: by 2002:a17:90b:230c:b0:24e:4d53:a9e6 with SMTP id mt12-20020a17090b230c00b0024e4d53a9e6mr2703201pjb.35.1683322959322; Fri, 05 May 2023 14:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683322959; cv=none; d=google.com; s=arc-20160816; b=n5Ef/w9Oyq6tMkjUxytDWrOapgB39AZal/utKNg5/y32uxGe6R6fZ4AjNR5B9+9IbT 0KMq4Ifm5YubGKM4lijlmNqZ+IqLG2wSMxG0GuZUPqXa2Ezg8f6+aGT7CJhcjeoD13La 6NAIHF3I7H91+B1UwIHnD1hzcFr6MLSDO5PDL3jJtmbTy+abiH35VQPbBurRKtbwffhS x857L+iDBhfhg/IXmD1pl7w+lVGYx09oHTOM9hep1QoTsBIVXDiuWcc/bP+N9WZUkun8 kugzC9nt7wbUvbV04xDKRWB4Y4Mxhp8f4U3Cg30v3jIffBMUXwA7oYyh97H2xK8QMty5 VeZQ== 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=9iSu+Yykp6XGckSvEiitdzG1woWv/JpoYcxey89suLQ=; b=YWJQwnShg5A3zjX8Vg7cSkNtMOLzNomSiHF1rdYJC1xBe3+eShVUGVQDcv8dD9groH SneU6aBkbgQ69CSdW0wWZR574Ntp+TKSfDJWaethAs/K1fOWNlVHj7GluzFc+3or/QbP bMm8sZ4+XTh5MiFyUinebap2uLEbjOG1voOQfs8sKSxYSojNxHZcdwPM6cw6xtTE5HrL N4Jv7EA9Glz6dXGljNc6fW8tcJa9YdxZ8kYhh5SRuOVLMLw3yMs6hPt7F5xlr5D2t8PK VsCnjJv2kSY5ZTE0Xy+RAVjnsHwBa6z5P4K6Y19m1HVXoDEZc/8HQaA/+5vQAe81LsBf qp9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=VD5uT5M9; 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 n7-20020a17090a9f0700b00247bd63c3c5si7286217pjp.37.2023.05.05.14.42.24; Fri, 05 May 2023 14:42:39 -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=VD5uT5M9; 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 S232605AbjEEVWT (ORCPT + 99 others); Fri, 5 May 2023 17:22:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231271AbjEEVWR (ORCPT ); Fri, 5 May 2023 17:22:17 -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 23A46A3; Fri, 5 May 2023 14:22:10 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-50bc22805d3so3530081a12.1; Fri, 05 May 2023 14:22:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683321728; x=1685913728; 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=9iSu+Yykp6XGckSvEiitdzG1woWv/JpoYcxey89suLQ=; b=VD5uT5M9IjT9ROk4WPIHEMcVdkhE8+7NWpHk/h9xbqRUtJ8PWIX+bspAlxGvU6UrL8 30d8m+tjMsEcXZhA1bB+XnUnfBj89Q3v+Mmmo454J40Om2cCTMQtmAfpS2ADjo/JN4Ke 6VxuOnkulrMrsrzzRRETm4vSf723x0QsSuYp/MATl3/9aTTDqe0MMGVsi5Zaj50lSyoU HYKfDsJq/J8Q5BnWfTubDpYBfDhhUWlkc3SLKKle1dLhJnHiQgauhZpmM4YhcwA8WOZm UvhNmrt+zoEiMxn2sMFW+/ylg/QH9i5ewSp84IQBkXtlpfUHBTJw3OrQRzfCbwIF7sAf Tlfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683321728; x=1685913728; 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=9iSu+Yykp6XGckSvEiitdzG1woWv/JpoYcxey89suLQ=; b=CdDYj20Heil5vTUshcyFfk18pfOzpRw6cO6PmIDKz/MbwSxBStmp+ghNujwfok6uET dbsQCcMfuka1KbqFcVMqjcXZFRvloYb/+0jrMBLvI49omSPt8WsjDv14vO/fWW4U9HoM U+dXyA/pyjRH4T+QerOcF953uG1YV/TbT+IJSccSa+jKvfRLQOVYqG6ET8wSkujFL+yM E9SLgj/I4UvyWxuben+u5JQiY0gkBDEaeQkzTbrecO1o7kljKCRi5KOWGP5wa3EfKr9x qoPasmx5KNdVRD30CnFwCEuuf95iPM7lIUQSY7vAdwAWurbL8TsKPI1u2wM1tqedLpP7 ZzhQ== X-Gm-Message-State: AC+VfDy2UyuST2ibWobvZz3qj7QvsfJSSlh9UA+dfXyj5s4GtzA/xMPt rMwxUYgFwOuvPa0YaIRzCs3kGwq0imr7v/YOzFc= X-Received: by 2002:a17:906:fd83:b0:94a:845c:3529 with SMTP id xa3-20020a170906fd8300b0094a845c3529mr2580529ejb.9.1683321728433; Fri, 05 May 2023 14:22:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andrii Nakryiko Date: Fri, 5 May 2023 14:21:56 -0700 Message-ID: Subject: Re: [PATCH RFC/RFT] perf bpf skels: Stop using vmlinux.h generated from BTF, use subset of used structs + CO-RE. was Re: BPF skels in perf .Re: [GIT PULL] perf tools changes for v6.4 To: Jiri Olsa Cc: Ian Rogers , Arnaldo Carvalho de Melo , Linus Torvalds , Namhyung Kim , Song Liu , Andrii Nakryiko , Ingo Molnar , Thomas Gleixner , Clark Williams , Kate Carcia , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Adrian Hunter , Changbin Du , Hao Luo , James Clark , Kan Liang , Roman Lozko , Stephane Eranian , Thomas Richter , Arnaldo Carvalho de Melo , bpf , Alexei Starovoitov , Yang Jihong , Mark Rutland , Paul Clarke 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 Fri, May 5, 2023 at 2:15=E2=80=AFPM Jiri Olsa wrote= : > > On Fri, May 05, 2023 at 01:46:30PM -0700, Ian Rogers wrote: > > On Fri, May 5, 2023 at 1:43=E2=80=AFPM Jiri Olsa w= rote: > > > > > > On Fri, May 05, 2023 at 10:04:47AM -0700, Ian Rogers wrote: > > > > On Fri, May 5, 2023 at 9:56=E2=80=AFAM Arnaldo Carvalho de Melo wrote: > > > > > > > > > > Em Fri, May 05, 2023 at 10:33:15AM -0300, Arnaldo Carvalho de Mel= o escreveu: > > > > > > Em Fri, May 05, 2023 at 01:03:14AM +0200, Jiri Olsa escreveu: > > > > > > That with the preserve_access_index isn't needed, we need just = the > > > > > > fields that we access in the tools, right? > > > > > > > > > > I'm now doing build test this in many distro containers, without = the two > > > > > reverts, i.e. BPF skels continue as opt-out as in my pull request= , to > > > > > test build and also for the functionality tests on the tools usin= g such > > > > > bpf skels, see below, no touching of vmlinux nor BTF data during = the > > > > > build. > > > > > > > > > > - Arnaldo > > > > > > > > > > From 882adaee50bc27f85374aeb2fbaa5b76bef60d05 Mon Sep 17 00:00:00= 2001 > > > > > From: Arnaldo Carvalho de Melo > > > > > Date: Thu, 4 May 2023 19:03:51 -0300 > > > > > Subject: [PATCH 1/1] perf bpf skels: Stop using vmlinux.h generat= ed from BTF, > > > > > use subset of used structs + CO-RE > > > > > > > > > > Linus reported a build break due to using a vmlinux without a BTF= elf > > > > > section to generate the vmlinux.h header with bpftool for use in = the BPF > > > > > tools in tools/perf/util/bpf_skel/*.bpf.c. > > > > > > > > > > Instead add a vmlinux.h file with the structs needed with the fie= lds the > > > > > tools need, marking the structs with __attribute__((preserve_acce= ss_index)), > > > > > so that libbpf's CO-RE code can fixup the struct field offsets. > > > > > > > > > > In some cases the vmlinux.h file that was being generated by bpft= ool > > > > > from the kernel BTF information was not needed at all, just inclu= ding > > > > > linux/bpf.h, sometimes linux/perf_event.h was enough as non-UAPI > > > > > types were not being used. > > > > > > > > > > To keep te patch small, include those UAPI headers from the trimm= ed down > > > > > vmlinux.h file, that then provides the tools with just the struct= s and > > > > > the subset of its fields needed for them. > > > > > > > > > > Testing it: > > > > > > > > > > # perf lock contention -b find / > /dev/null > > > > > > I tested perf lock con -abv -L rcu_state sleep 1 > > > and needed fix below > > > > > > jirka > > > > I thought this was fixed by: > > https://lore.kernel.org/lkml/20230427234833.1576130-1-namhyung@kernel.o= rg/ > > but I think that is just in perf-tools-next. > > ah ok, missed that one Please try validating with veristat to check if all of perf's .bpf.o files are successful. Veristat is part of selftests and can be built with just `make -C tools/testing/selftests/bpf veristat`. After that; sudo ~/bin/veristat tools/perf/util/bpf_skel/.tmp/*.bpf.o This is a surer way to check that BPF object files are ok at least on your currently running kernel, than trying to exercise each BPF program through perf commands. > > thanks, > jirka