Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1443754rwr; Fri, 5 May 2023 14:21:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7MGTSiprxmoHyzutYnD1l+bp8//IL8OMZgyipgMiUX6/sI6dQpohZbZRVBjyIkiKWJAdB5 X-Received: by 2002:a05:6a20:9594:b0:ee:d553:5cee with SMTP id iu20-20020a056a20959400b000eed5535ceemr3279811pzb.16.1683321711510; Fri, 05 May 2023 14:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683321711; cv=none; d=google.com; s=arc-20160816; b=Ihxocms9b2PLyUNDNjXQZGMYLIx21DlLLAKPfcyY6bwmrstpARYbRlY9TlSkH7XjfO jCuuzokMJLHfP79Urqi85r+60f9g5WHlSny5V8O7Ua3R8P6LoXizoVa8Ljrov2nYqtoX EAOs/njg7Jmi6DM0URnP3raFRVi98hhBd1oTvCpv6us5p11Gt44OjRaebx1goGRJ1tUO 0JDi1p0UiIz4gSltcqjLJzS9dI6MugXrxfEOyEZa3RHzkXBnGoM5vb2lbB9RM7B+ajx9 IKBQ1Zvf3ECEOtR3bLL4318AwMQ/ymMEf6EbSSd0k+X2L+3M0z/W0Rly2yiBn3NZFz0Z R0wg== 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; bh=/EB35DP4SMZdgaO9xFFgAwELra75rshFbcj3JCLNj9U=; b=uHgDL2VSCrruX7ohiLB9/HtD5XYTrDEGPp7NfWvCmxDkurS9+G22X3KAtmVYsE1nfb 0gnkIRdTQRP+5qZ4TnuxCskLhcfHuKDZDQowje4NvFlyEZwZ6fTIWB5800LNeRA+3KUL nPi4MMjonhyAjP2+wcIuBEtIIdphljKC+J4/lYyDz+80X0h8ypWNg1v/Z/9ERupvumr/ WATJMIll90FmrH7eiMjncxAZ/AV13mFQcCouPyglDgHFN++Pg10+7Qy3u7eeaXHGLalf bBz8J3rnVxTukjNkXbBsxJeLokw8PNhK4Gxj1Td6aAGYWHbX55Ii1pJ8uO9bYxbpMd9u yC9A== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n127-20020a632785000000b004fabddccf93si2843542pgn.778.2023.05.05.14.21.37; Fri, 05 May 2023 14:21:51 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjEEUtI convert rfc822-to-8bit (ORCPT + 99 others); Fri, 5 May 2023 16:49:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233235AbjEEUtF (ORCPT ); Fri, 5 May 2023 16:49:05 -0400 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D37E71984; Fri, 5 May 2023 13:49:04 -0700 (PDT) Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-b9d8730fe5aso3052293276.1; Fri, 05 May 2023 13:49:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683319744; x=1685911744; 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=GDe8ZfXyzW9pc+3/vB3tIdG+hkI+ElgK80U8Mo8x89U=; b=C0GWICo+QwGWEBLx61rPsZD5DVSfcL2xBbN8ZAQlJ1X3Cry9gd/KO3aRIMb/UzDfyP XcxlYTIq6yIf7/n+26+oAfw/dU418f2FhsrzTgNd/+UYuL/MNAz24V7gOYmVgXqA/tiO 0flb7FMNp9GfWY3hHa+etbwAZHkLvdn9ZOEP7HMaw7ULQyC6THmvW7XlfZlXWZdFamFU wowIM+R1aI1AcfiwnEh8a4uwqieAcDSBkwxFU3Jb1WZneYp7w3PjqK/aOI1akTy+UbQi 60fRBMcLRNMU3kxqJ7VHLB2A21gCTZUJGaCbmAGNw4DbcdAy1Kx0RGdVgncMdkw2C/xw bt/Q== X-Gm-Message-State: AC+VfDwtO/Zb54OdLOTZhEpcxunkyvQrqstnSsOkvAvCx8WyicivbJIw JxX1QbqSptQKxOIJqJNdqra+67/gKQym4O7E7+o= X-Received: by 2002:a25:e092:0:b0:b9e:4d05:1f97 with SMTP id x140-20020a25e092000000b00b9e4d051f97mr3070988ybg.41.1683319743912; Fri, 05 May 2023 13:49:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Namhyung Kim Date: Fri, 5 May 2023 13:48:52 -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: Ian Rogers Cc: Jiri Olsa , Arnaldo Carvalho de Melo , Linus Torvalds , Andrii Nakryiko , 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: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Fri, May 5, 2023 at 1:46 PM Ian Rogers wrote: > > On Fri, May 5, 2023 at 1:43 PM Jiri Olsa wrote: > > > > On Fri, May 05, 2023 at 10:04:47AM -0700, Ian Rogers wrote: > > > On Fri, May 5, 2023 at 9:56 AM Arnaldo Carvalho de Melo wrote: > > > > > > > > Em Fri, May 05, 2023 at 10:33:15AM -0300, Arnaldo Carvalho de Melo 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 using 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 generated 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 fields the > > > > tools need, marking the structs with __attribute__((preserve_access_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 bpftool > > > > from the kernel BTF information was not needed at all, just including > > > > 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 trimmed down > > > > vmlinux.h file, that then provides the tools with just the structs 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.org/ > but I think that is just in perf-tools-next. Right, but we might still need the empty rq definition. Thanks, Namhyung