Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp932214pxb; Fri, 22 Apr 2022 14:40:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwahd4I5sVn5JIW24lZSmerM/3FQxakfxMRXp63T0l3yprKGiDgw8gRaSdB0XSMIZTXRkCr X-Received: by 2002:a05:6a00:2489:b0:50a:754c:c557 with SMTP id c9-20020a056a00248900b0050a754cc557mr7032502pfv.37.1650663649074; Fri, 22 Apr 2022 14:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650663649; cv=none; d=google.com; s=arc-20160816; b=WYx92aXJzCDt0P44pN2PXkuRi/dck27rZwp2mDAmjOU9R1K8SAnu4vgAAMMBaOwlHF wMe5Gv+oK2MmmGqVQ7PkHz9ErBtkT5QxxhraSKhkHe8jhZUatJHjBBFb3F0g7wWqfYlk IIYiG9TvClSga+N1mb7aGxQBvxZ6FqdPa/7R+DVpN1J1Jv0F71t5UB9BVsbRwHJEUKsi sdmxeNFYGBzGkw4+zbZjB+D2J+vloBMX/Hgssd53x7g76sTw9o84g5xwcKxlX8NYRS8G Bc16j0JwbUATV65wBiIfDUWZYOYQj0ffWAWvyw9xjQLScSEcqem4awWNJF0wOpmiyXpj dQUw== 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=pYT8LiXPjG72JXyjXh0PA/0j6snOgjAInfuhdQQzK4A=; b=p7cEEqXBFnwXLTbpEX77uREPCf4ICO48vWzg3rBaUk/vjhj+/xoiFW1MGLPmzJJq4Z PHtnLdUxWHMHJjq3Xtiqth+8pfETu8FKLvrXo1kwJroSz4RrtQC9TyrZls6nE5ixes6a 4Zl9qnSceqrLbH5HiDDFlJae+pxoxAO229x6Q8wRYzdD7pGnwUGiTogPVMawp3PoqWUz tklKgTvCipEdXswMWNEFfebmDBkuS7irpBsKjs32T+9DCy5MxMQ74wtADq/LX8KabrBX S2BvJP0+j4pd/KIMLTknt3ekjl4VWhTas48gyVdeha9sSBZXAExBh9kZ3jOqctgu/lep 9ZBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZiyMakZP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b10-20020a631b4a000000b0039f79dbe674si9520457pgm.309.2022.04.22.14.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:40:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZiyMakZP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 33DDC313D34; Fri, 22 Apr 2022 12:48:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380940AbiDTRPB (ORCPT + 99 others); Wed, 20 Apr 2022 13:15:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380918AbiDTRPA (ORCPT ); Wed, 20 Apr 2022 13:15:00 -0400 Received: from mail-vk1-xa2d.google.com (mail-vk1-xa2d.google.com [IPv6:2607:f8b0:4864:20::a2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F0E4578A; Wed, 20 Apr 2022 10:12:13 -0700 (PDT) Received: by mail-vk1-xa2d.google.com with SMTP id j4so1097916vki.8; Wed, 20 Apr 2022 10:12:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pYT8LiXPjG72JXyjXh0PA/0j6snOgjAInfuhdQQzK4A=; b=ZiyMakZPe2qW167OmeXyl2TuWZG/d54+3LqcHKYeCbiytsFzupldZcNEbtc3woraMi WuZQ+m7C4d9rEtCo8dS0y+0oipuQi3dRdUE78C8HHIGJOduFOGUFCTxyH/J+xxMObUeo 3fx2WciP5/4tsVV5rAi1F2Rjh5wBollI5V+EK2kAG90dGELPOYf3oi7PG7tVGwYw9Oqs 38Jjf6kXP8UYlQkmvWHW62Hj8xWG/XVyj/kAmay4gjQ4liV5GP258qHLLDahX87U4Zce TRodUG0FEsekwpItF7t9i66GVhDI7kAzoaTbxbuxVpnEzRABk4BlKz0aQ1H7VVD+nloQ 4k0w== 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=pYT8LiXPjG72JXyjXh0PA/0j6snOgjAInfuhdQQzK4A=; b=PcaOulyZDpfPeuCc4tNbK28k45lRdo0dRQzBXGotTiqvMnzfw983G1iIun8UG9pRZv 3Y0ZHIrSLwtGEry5YLQj/bQXnruGC9ZEECmnkaS4ls8/mh61vma3rE7VOdzBOosiB9ts pkIt8RpfpgQL0wPzDhO5Fp/HvqZPWJ0eUWN1wWXpBuBEH8+pf3OhNxtKCZ3TKCabaNBH IE896RFVkfNe2KvvWFnyQ3dlRZn52VimRBbORjYwjquSme9mJPqL0HiLjoEPjOZYQ2Mf ejq6JtC8X5wMvtjsBVCaKnB9HqFnQkbVZjIwtA0MhskMzA0/WNH2tm+nzzGI2XGrRYDp yPbw== X-Gm-Message-State: AOAM532A6QbIluQTjvo5y2gJc6ton/biNuFYMi/XI0wexHQtJwyDHTaK PAv+Bikdsi1cfwJg54GEmlIPHdi17pH6uw7QDM8= X-Received: by 2002:a1f:abc5:0:b0:343:20e4:890f with SMTP id u188-20020a1fabc5000000b0034320e4890fmr6765514vke.20.1650474732358; Wed, 20 Apr 2022 10:12:12 -0700 (PDT) MIME-Version: 1.0 References: <20220414223704.341028-1-alobakin@pm.me> <20220414223704.341028-4-alobakin@pm.me> In-Reply-To: <20220414223704.341028-4-alobakin@pm.me> From: Andrii Nakryiko Date: Wed, 20 Apr 2022 10:12:01 -0700 Message-ID: Subject: Re: [PATCH bpf-next 03/11] tools, bpf: fix bpftool build with !CONFIG_BPF_EVENTS To: Alexander Lobakin Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Jonathan Lemon , Nathan Chancellor , Nick Desaulniers , Dmitrii Dolgov <9erthalion6@gmail.com>, Quentin Monnet , Tiezhu Yang , Kumar Kartikeya Dwivedi , Chenbo Feng , Willem de Bruijn , Daniel Wagner , Thomas Graf , Ong Boon Leong , "linux-perf-use." , open list , Networking , bpf , llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE 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 Thu, Apr 14, 2022 at 3:45 PM Alexander Lobakin wrote: > > Fix the following error when building bpftool: > > CLANG profiler.bpf.o > CLANG pid_iter.bpf.o > skeleton/profiler.bpf.c:18:21: error: invalid application of 'sizeof' to an incomplete type 'struct bpf_perf_event_value' > __uint(value_size, sizeof(struct bpf_perf_event_value)); > ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h:13:39: note: expanded from macro '__uint' > ^~~ > tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helper_defs.h:7:8: note: forward declaration of 'struct bpf_perf_event_value' > struct bpf_perf_event_value; > ^ > > struct bpf_perf_event_value is being used in the kernel only when > CONFIG_BPF_EVENTS is enabled, so it misses a BTF entry then. > Emit the type unconditionally to fix the problem. > > Fixes: 47c09d6a9f67 ("bpftool: Introduce "prog profile" command") > Signed-off-by: Alexander Lobakin > --- > kernel/bpf/syscall.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c > index 34fdf27d14cf..dd8284a60a8e 100644 > --- a/kernel/bpf/syscall.c > +++ b/kernel/bpf/syscall.c > @@ -4286,6 +4286,7 @@ static int link_create(union bpf_attr *attr, bpfptr_t uattr) > goto out; > case BPF_PROG_TYPE_PERF_EVENT: > case BPF_PROG_TYPE_TRACEPOINT: > + BTF_TYPE_EMIT(struct bpf_perf_event_value); same as for previous two patches, if there are types that bpftool expects and might not be in vmlinux.h due to different kernel configurations, it's cleaner to just define their minimal local definitions with __attribute__((preserve_access_index)) > if (attr->link_create.attach_type != BPF_PERF_EVENT) { > ret = -EINVAL; > goto out; > -- > 2.35.2 > >