Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp58883lfe; Fri, 15 Apr 2022 19:25:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+wOQXCnS0A9ca2tJBCi89lh2to8+sI4sUQX1mZs48AfOnJk+8avHJlorj4Uus7e+SEOKD X-Received: by 2002:a65:6bd6:0:b0:39d:4f85:9ecf with SMTP id e22-20020a656bd6000000b0039d4f859ecfmr1428207pgw.336.1650075917243; Fri, 15 Apr 2022 19:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650075917; cv=none; d=google.com; s=arc-20160816; b=bT5IvOFDVlq5nphEuDLjGX36aXi8KRJ2txAhx3nGJGMWbQevsw6/gHagUfMfihGKtl RRYR52f7OoZ/cLsuINdgCp8lwIII98jnTDoUl3ga9TzFyrTSgJxNdKzMPRxHVlpHWXtr VhR8Y2Fvf0wA9CX4PBatCyYb4rk//GUDi+qaZdJBqvw5Hl9K2TGeMfbptCDgShULWv3K Dho6RAKSOJGQUEH3oJEA3iSKPI0R3D5gvGRUzhvFEVe3mwQdSxqojJ7QyEdQzPv+E1Fe G1htLD6PYsc6qpbmrbsAAZ4I0g2mem0wgE1p1UzNTvtQ6X32JyKqCH+TEThUYoG6Saxh BznA== 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=jj6inam9nH0b3isxSIrxTREipb0FLmvhmEeWdoqcCdo=; b=ZcvrgGkpbJvN3zdcwlki9zE5gpS2JJYRCMCJVLDvctlI1jAAoKuQqvAURmk16ZJ5Oc +VjPxc+aGHM3dyWbZ5jAab0ito9MVamO/kB0u3NRT9kRe4xduuR4pdI5svtdY4pcwGxO qNsfF8fu7f1/AH4Mt/FiJ7/UbiuCX7dm431BKzrCFgfNKv19oVCSz3zUh2BidwPd5NVH exdfprTmy07QCwgTWlZyORVzeOxnLTOzBHJnWTRd2bR+loPMZJ1C3lZ+4Dad96z3G18I LJHxkY9GP+P8cg6ZbrrOKuyqCy/Ooid7wLL8CiUPx5cL3MuHA4kqi/f/RDRS+8HVr+lu AXJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gIDIFML5; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q11-20020a056a00150b00b005058be0ff8fsi3336933pfu.210.2022.04.15.19.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 19:25:17 -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=@kernel.org header.s=k20201202 header.b=gIDIFML5; 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=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A29B349FA0; Fri, 15 Apr 2022 18:37:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232888AbiDOXhU (ORCPT + 99 others); Fri, 15 Apr 2022 19:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230282AbiDOXhT (ORCPT ); Fri, 15 Apr 2022 19:37:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3605940E59; Fri, 15 Apr 2022 16:34:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DDB69B82CE7; Fri, 15 Apr 2022 23:34:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EF28C385A8; Fri, 15 Apr 2022 23:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650065686; bh=H8TG9TaTkxthyp0a78kt3dMEbKUO8m3PltS7yJt03Lk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=gIDIFML52510OKuQReILMZhX3fFpruAsOz8I2y/UUWSS/XA9np+igAuQ9J71VVmaI yc8pvY+JCT6UUVSGrSR28Ayfzg/8ReygDBjTJSLAShxwB5Q1Qo9/MOMFj3FAGgFIFR b+quTWnBobJaTM9heJhVac+VBoK7X8aOPkPesZjtk8Sw8CgLhMwjtdcnPb2R0zdM+R b0IRTjA8BaIlnt3lHEL4f2tkElrFZItoG10MxYNsonfzToHNWoxA30Y2vSy9nx+Wsv Spv7lDZszmOJuMuhvCckvgwOwqBC0cMLNzx3iUNLR2OxRTtmfNwJJFOnS20TCvMtzG A0718dSkj3OuA== Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-2ebf4b91212so95347557b3.8; Fri, 15 Apr 2022 16:34:46 -0700 (PDT) X-Gm-Message-State: AOAM533UrQlHQSa+Mhg0xgFELEHrKjqqmCWoghMhVlH/knn2FAWhiuBE chXG7QpxApc4ACMRS4jIvSh6RtzQ2blyiRGoRHI= X-Received: by 2002:a81:688:0:b0:2ec:239:d1e with SMTP id 130-20020a810688000000b002ec02390d1emr1124694ywg.211.1650065685677; Fri, 15 Apr 2022 16:34:45 -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: Song Liu Date: Fri, 15 Apr 2022 16:34:34 -0700 X-Gmail-Original-Message-ID: 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-users@vger.kernel.org, open list , Networking , bpf , llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 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 Acked-by: Song Liu > --- > 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); > if (attr->link_create.attach_type != BPF_PERF_EVENT) { > ret = -EINVAL; > goto out; > -- > 2.35.2 > >