Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp792675iog; Wed, 29 Jun 2022 10:16:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t5xhB8TgN6Vb9UD8ZNIAK/0iCPlIg047nMZ9qGXyXfFDi3iqLaHTBIrV0v+Bfbkn2SpTe8 X-Received: by 2002:a17:907:b06:b0:72a:4d2a:1913 with SMTP id h6-20020a1709070b0600b0072a4d2a1913mr802405ejl.666.1656522960178; Wed, 29 Jun 2022 10:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656522960; cv=none; d=google.com; s=arc-20160816; b=bDZeCnilYWMOP/tdhUgWsKm8sYawGylAmUyBsSk46CCG38p+8XH13jkoumZS+bWnS+ /14LaAr1+h1QNwCSdxgMrETFLlWlorvmu0W/BzGYSfku4DbnMc+fz6M2co1eeBo4sGbW wyzeqIuJ2prFW/6CRL7Yokd15x3p2TZDbukjPASzSOl+f8AGwjtdoAAuTqTHEkZyL/uA 3uBQs1dhv4CR0hAy/47NtSarfhlneTkCdkO0VXXL88F/ZSFyXrr0H5fx+XjpjnYixPDY xZsFRX2ifXSII186+VeBT7Jx4capZ/vZyZSAvlluw7kYNOSvV4OhOGZBY30HNkLivEPw ucMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=uyNdAiqX42nvqZ9JWQ/ZZaNT635XeywxS5XfMuA1CNA=; b=erE8cGoyF4Nqqo9SKCrM6q3pHxP6niAp+M4HzXEJ83MVNjMF5advpgkAzeuRNrLcUi Xsrrph/XJVBPSWpdxapHRMC/P1x1a31kp2iCgSq0tcUT9TLSfN/lGsERQ+Z7b2zySBJ3 xlZtCwTU3eqcLi/qb+ujxArnVskfTb9cTPacZ0lIyoy49d+3k92YFuKyiv8wJYLjzdny BL7QFdD4SDRHzuA7COQj8JiwKIGj4cO4YNrJi8KY4KPuv2ih4K2adOI8PW+wKKtQO1QM TaStRrubAQ7MKAsluYkqvAwIwXSXNebdgNzStQ9KB+52VTY1GiHq4uCLs0ALOPGuU3DL d2kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=opEEI8h3; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a056402354e00b0043580e5e8bdsi23159079edd.459.2022.06.29.10.15.33; Wed, 29 Jun 2022 10:16:00 -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=@google.com header.s=20210112 header.b=opEEI8h3; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230060AbiF2Qnf (ORCPT + 99 others); Wed, 29 Jun 2022 12:43:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229641AbiF2Qnd (ORCPT ); Wed, 29 Jun 2022 12:43:33 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3763205ED for ; Wed, 29 Jun 2022 09:43:31 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id m184so9719551wme.1 for ; Wed, 29 Jun 2022 09:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uyNdAiqX42nvqZ9JWQ/ZZaNT635XeywxS5XfMuA1CNA=; b=opEEI8h3+r0PCqDkmte4H0kX0dHSW0KHKiFIN9QkbQDYyw9MZk+K4YkwZZpBiNBh5o PHZ00wpnpy09QVuA596YHI1IXuFiGKStIGwr355sBtLqirvwyu+X+pzoba8Hvl4CeSRA 951rV2x5tz49mFgmEZagaOIQnxeC4i8gdj/ncHjPxVj5ni2WdWP19l3dcdTgAVeh9NPn KWshRxNd3Tv9VpnUv4FcBVmyHC4rXb/yTMURlMZNdKCCiE7mkMm1GktD2EkgvU4BLw7M M1SCUkOyRIzFw7gmJnN5el0E6eFz9I1sVr3cLEt/TDOEOnh6RFLIhD9R3JEx/fNOqD++ 0Dvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uyNdAiqX42nvqZ9JWQ/ZZaNT635XeywxS5XfMuA1CNA=; b=IJBXxy1YnPhgToS8XiN8RdX+fASzOusHmPa9YYTj2v/a/8s3wZ47wQ8u8nX6Cl3zG8 S+PJZqPMShkOag0YmOvbDzsXRXax9YYdTUFn/rNVpm37Xmt7Pka53RPfT4RvPi/r4DOP 2twNEYZt/dSNlo6ZCON7SynBQeXZJHmN0hxo5t77W6bd2TeNa09w811Pcg64VYhrXf4+ AJPWjgesSxLJmXPWC2jTZv3GoKt3hB/czPmOEaJGZoA2V8PeJd+SksrVTdeKrc3ieJmm TrfEeHe1bPGqZ4dNiG/Do773UZbaBKBSi1LCPxsip7Ox32ODA9FQTcxVV30j2HrCMZBs yvxQ== X-Gm-Message-State: AJIora8n3TfhKOkSeX6DkrqASZsw9Y+BKzd/H5nIdb6qrrE505fGmar6 Wjlsid4GQ81YuA210VZdG96oyuKZ7i1J12uc+SY4Og== X-Received: by 2002:a05:600c:4e4c:b0:3a0:53a2:48b5 with SMTP id e12-20020a05600c4e4c00b003a053a248b5mr4628041wmq.174.1656521010316; Wed, 29 Jun 2022 09:43:30 -0700 (PDT) MIME-Version: 1.0 References: <20220629112717.125927-1-jolsa@kernel.org> In-Reply-To: <20220629112717.125927-1-jolsa@kernel.org> From: Ian Rogers Date: Wed, 29 Jun 2022 09:43:17 -0700 Message-ID: Subject: Re: [PATCH] perf tools: Convert legacy map definition to BTF-defined To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, Andrii Nakryiko Content-Type: text/plain; charset="UTF-8" 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_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Wed, Jun 29, 2022 at 4:27 AM Jiri Olsa wrote: > > The libbpf is switching off support for legacy map definitions [1], > which will break the perf llvm tests. > > Moving the base source map definition to BTF-defined, so we need > to use -g compile option for to add debug/BTF info. > > [1] https://lore.kernel.org/bpf/20220627211527.2245459-1-andrii@kernel.org/ > Signed-off-by: Jiri Olsa > --- > tools/perf/tests/bpf-script-example.c | 15 +++++++++------ > tools/perf/util/llvm-utils.c | 2 +- > 2 files changed, 10 insertions(+), 7 deletions(-) > > diff --git a/tools/perf/tests/bpf-script-example.c b/tools/perf/tests/bpf-script-example.c > index ab4b98b3165d..065a4ac5d8e5 100644 > --- a/tools/perf/tests/bpf-script-example.c > +++ b/tools/perf/tests/bpf-script-example.c > @@ -24,13 +24,16 @@ struct bpf_map_def { > unsigned int max_entries; > }; > > +#define __uint(name, val) int (*name)[val] > +#define __type(name, val) typeof(val) *name This is probably worth a comment, reading it hurts :-) I expect that libbpf provides a definition that the rest of the world uses. Fwiw, the pre bpf counters BPF in perf needs a good overhaul. Arnaldo mentioned switching perf trace's BPF to use BPF skeletons in another post. The tests we have on event filters are flaky. One fewer bpf.h in the world seems like a service to humanity (I'm looking at you tools/perf/include/bpf/bpf.h). Thanks, Ian > + > #define SEC(NAME) __attribute__((section(NAME), used)) > -struct bpf_map_def SEC("maps") flip_table = { > - .type = BPF_MAP_TYPE_ARRAY, > - .key_size = sizeof(int), > - .value_size = sizeof(int), > - .max_entries = 1, > -}; > +struct { > + __uint(type, BPF_MAP_TYPE_ARRAY); > + __uint(max_entries, 1); > + __type(key, int); > + __type(value, int); > +} flip_table SEC(".maps"); > > SEC("func=do_epoll_wait") > int bpf_func__SyS_epoll_pwait(void *ctx) > diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c > index 96c8ef60f4f8..2dc797007419 100644 > --- a/tools/perf/util/llvm-utils.c > +++ b/tools/perf/util/llvm-utils.c > @@ -25,7 +25,7 @@ > "$CLANG_OPTIONS $PERF_BPF_INC_OPTIONS $KERNEL_INC_OPTIONS " \ > "-Wno-unused-value -Wno-pointer-sign " \ > "-working-directory $WORKING_DIR " \ > - "-c \"$CLANG_SOURCE\" -target bpf $CLANG_EMIT_LLVM -O2 -o - $LLVM_OPTIONS_PIPE" > + "-c \"$CLANG_SOURCE\" -target bpf $CLANG_EMIT_LLVM -g -O2 -o - $LLVM_OPTIONS_PIPE" > > struct llvm_param llvm_param = { > .clang_path = "clang", > -- > 2.35.3 >