Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2637893pxb; Mon, 18 Apr 2022 05:18:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/zqbd8jWjNfRSQQ99++DhJjN1SSJ4tHmhdOH/LMGP8Yrno4bOF24YnPKx/ve3ugQp/UgN X-Received: by 2002:aa7:9255:0:b0:505:a44b:275c with SMTP id 21-20020aa79255000000b00505a44b275cmr12016131pfp.40.1650284334063; Mon, 18 Apr 2022 05:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650284334; cv=none; d=google.com; s=arc-20160816; b=rQFk0FnmUl8z+l8gz3Pl/AY6QHHnIldHm9QvLMa+O9jhc8Oh/up0VOYCHf+5sJx/TG 3InzSN+QvRV2MvcugflKQpuidfIIvFSwDys+qAhIJhv7BYXV6taT7IoYiDWryLs2/son bSGrUrJ+3Zu6L+yx6pVK0OzVIg+nwZxglmwZs5ibuip4eBkZy8q98wFrNMFoGFpW/8Wp e66jmojE6cgx0Z9sPp/wHnXstvOZZkN8mmt6SM16o94JKhXNxSJOumF4qAAx2ER+6lyu 8vceiqqEQ3auHBOefpDiEb8f1g3R4lKYZOyiHJZbrtLnhoHCTnLQh+BBa6BZlcFfbqQa Uqyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=dUBVYxJ9KjFGdWAPZ3BpuTxFmDw0xhV4VjL0SW5G2Cs=; b=eIA9hIzWmHanOwOI0HJG0teuePymu5vRlre2R22BX4/HkjffJHIVbHIiPDEvnTeCiy wngEN9zGadakGwm0vIjvd+C+JRSFOxdTqzGlaBZC1ShvOG3C5J8olApam1Bs/cMr5ATw I+MzRK3/4kYSLvMnymjCKBz5x/PAfH/zbvTR2I7Ib9my2A7/hvIcdgC9WeBE90QvbX0q 1dMGGJ2P5CPjTD43CxxzQaxavjbIIXC1PZBLhu2RFbHfDGhekiwOePHbnOJX2h+eGJv5 W44OHCP82M77BqohSOArLVoiuFDlLSik3aydESWOvZs9efZzX/WsGP00G33/BKJEvyAL DZ9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail2 header.b=amXLMAut; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w23-20020a17090a529700b001d28802aac8si3565128pjh.135.2022.04.18.05.18.40; Mon, 18 Apr 2022 05:18:54 -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=@pm.me header.s=protonmail2 header.b=amXLMAut; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232721AbiDPRxU (ORCPT + 99 others); Sat, 16 Apr 2022 13:53:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232450AbiDPRxT (ORCPT ); Sat, 16 Apr 2022 13:53:19 -0400 Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0690E34; Sat, 16 Apr 2022 10:50:46 -0700 (PDT) Date: Sat, 16 Apr 2022 17:50:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail2; t=1650131444; bh=dUBVYxJ9KjFGdWAPZ3BpuTxFmDw0xhV4VjL0SW5G2Cs=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=amXLMAutJGPxMzbDaeGMyXFJX9zlX6dkXXT2t9TYkA46iUHC/JG9DfVb84E1JOr3v 5i7k7LSd6DCTZ9xQKZwi5NNgJfHv/MWn3SPTSbUKs5djHd6HpB83Jpha6uCFBEKI2S ooJYv4Nu0+mGX154G/bDnvnCNY35Fs70h23GR1G3Q9iqkEV/9dfNmBjoz+J4sVs0EG R3cAIWN/RYxouBCKNFFiV+kSnSqMug8na3JtHvmg/YEO5OSMTeVOeAAiKi/TnqiBIW 0lZthWkwvsFWIICVz4tefCNwyM0eB0/EOg5Tzqc/tR+5qvYDOiUyacvmPEMLFeeF5Q 1/fmwoe9vwpLw== To: Song Liu From: Alexander Lobakin Cc: Alexander Lobakin , 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?Q?Bj=C3=B6rn_T=C3=B6pel?= , 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 , Thomas Graf , Ong Boon Leong , linux-perf-users@vger.kernel.org, open list , Networking , bpf , llvm@lists.linux.dev Reply-To: Alexander Lobakin Subject: Re: [PATCH bpf-next 02/11] bpf: always emit struct bpf_perf_link BTF Message-ID: <20220416174330.195496-1-alobakin@pm.me> In-Reply-To: References: <20220414223704.341028-1-alobakin@pm.me> <20220414223704.341028-3-alobakin@pm.me> MIME-Version: 1.0 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,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 From: Song Liu Date: Fri, 15 Apr 2022 16:24:41 -0700 > On Thu, Apr 14, 2022 at 3:45 PM Alexander Lobakin wrote: > > > > When building bpftool with !CONFIG_PERF_EVENTS: > > > > skeleton/pid_iter.bpf.c:47:14: error: incomplete definition of type 'st= ruct bpf_perf_link' > > perf_link =3D container_of(link, struct bpf_perf_link, link); > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h:74:22: not= e: expanded from macro 'container_of' > > ((type *)(__mptr - offsetof(type, member))); \ > > ^~~~~~~~~~~~~~~~~~~~~~ > > tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h:68:60: not= e: expanded from macro 'offsetof' > > #define offsetof(TYPE, MEMBER) ((unsigned long)&((TYPE *)0)->MEMBER) > > ~~~~~~~~~~~^ > > skeleton/pid_iter.bpf.c:44:9: note: forward declaration of 'struct bpf_= perf_link' > > struct bpf_perf_link *perf_link; > > ^ > > > > &bpf_perf_link is being defined and used only under the ifdef. > > Move it out of the block and explicitly emit a BTF to fix > > compilation. > > > > Fixes: cbdaf71f7e65 ("bpftool: Add bpf_cookie to link output") > > Signed-off-by: Alexander Lobakin > > Similar to v1, this fix is weird to me. I hope we have can fix it in user > space. I've been thinking on this, but userspace is not provided with any autoconf.h definitions (only selftests have them), so its code must be sort of universal. Both this and 01/11 are compile time and due to imcomplete and/or absent BTF struct declarations. I'm not familiar with bpf_core_field_exists(), and it might be that it's able to solve 01/11, but not this one. &bpf_perf_link must be present unconditionally, otherwise it won't be defined in the generated vmlinux.h at all. Thanks, Al