Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp980979pxb; Fri, 15 Apr 2022 17:18:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvbyXrvIBKOnMcAkfoRTgmpD86/ZEwOTeN/gfIRu6rFJwdyuwyAvHfg6j50hmSmO357Dmo X-Received: by 2002:a17:903:31cd:b0:158:542b:908d with SMTP id v13-20020a17090331cd00b00158542b908dmr1382821ple.16.1650068304772; Fri, 15 Apr 2022 17:18:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650068304; cv=none; d=google.com; s=arc-20160816; b=TpsrdDTlwMHn6a2/L8kjzK0ECv81TD+wyD1PuDE3pb4UDX4eNjrTbPRAxIQWnW1g/Q 395BXj3Fi8bEVG+TvbKf5IzS3Z1a952+nf8ukCAfphmM+K6xYehRj/IjxQ2RYJKSOCdw YUwcXWwh9YdTLmkb++LUyVtiqr06DsD9O6a9kC2SOnbZZcSdc9hUcSKOmnD+B3zhVEeW bqWAz1xbkXok6sMlf2peYd7Z5SpYDdy2J/+g3UdSXXJxy/FAuqv3hS04DxY7KIhkP4cB aI+TuJxSN+GVj6TrZvu+ZGJ/uXr7x+E6YHnXJycY42R/mJU8ayp+clcWuSlSieL5vcOi gHNw== 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=uv61apQIeQt8drF2A52PZrs8AoOA0Lvm41y6dOx4zW4=; b=YX/8F2PQvhHAiIUty6o5UGaw5xMOiOYmKnb+VNVHwygBGExujBuHLJwD7ipUUulwYO hBfLeNnXpmjdPa0KIhMclxflza2qYrW4jAtebLRKifMiT+UM2jKUuTiGRCjKKEznXorC D89h3qjalFUZSFiynwed6UCOva2fPpGykXmSE+/oDZJTp0ncGdalwF8yp+8ONJws1SJ5 Qmy2u7W7sbY6MWBAPe5hGD+ZDlmGfSjHXRTbraAcxsku7yDNEj/FRj3nX7G6xr6iurcG q4F8P2WMU72vaBRJZaijIA1Y0pjlwmhPfyEEriAJNQih58vXjwVJeAtPSnOogNWCLQTc h8xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail2 header.b=dWY+JprL; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l14-20020a170902f68e00b00156984a1cb4si2814248plg.306.2022.04.15.17.18.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:18:24 -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=@pm.me header.s=protonmail2 header.b=dWY+JprL; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BEA085DE6E; Fri, 15 Apr 2022 17:18:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347178AbiDNWrl (ORCPT + 99 others); Thu, 14 Apr 2022 18:47:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347153AbiDNWrj (ORCPT ); Thu, 14 Apr 2022 18:47:39 -0400 Received: from mail-0301.mail-europe.com (mail-0301.mail-europe.com [188.165.51.139]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6B2FC559B; Thu, 14 Apr 2022 15:45:13 -0700 (PDT) Date: Thu, 14 Apr 2022 22:45:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail2; t=1649976310; bh=uv61apQIeQt8drF2A52PZrs8AoOA0Lvm41y6dOx4zW4=; 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=dWY+JprLs4JIrIWoJF/Ubs58DGuvqgzq0bbgkJbERbj+vlcFLFU4rLtZoy/LqcBem j5UIXLMFErTLjO5XpUmTD1bJor/Sv45lvgS54UbUxhe4TFAvY2KbYulb1Bc6QfZ7YY GEluu1k5+/WyknMrfSSIHY3WTmzhoGSpwCUZ/dwyv/lZGHRo3ell+m8rxkxWI34P0t zg2nC6c1GBM5nxedFuxOziSD0uwPAUxoWlzIYpkXqeG1VlJpQ+eowVW9yrtjgdiWVJ +zQtLu/qJJaA85eYPNHDmu6+wcUeI06oX1xMr9mrHwF3zuEkxafI4uQ2aEkxqHe7xu InZyBMxrBp/Gg== To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko From: Alexander Lobakin Cc: 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 , Alexander Lobakin , 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, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Reply-To: Alexander Lobakin Subject: [PATCH bpf-next 02/11] bpf: always emit struct bpf_perf_link BTF Message-ID: <20220414223704.341028-3-alobakin@pm.me> In-Reply-To: <20220414223704.341028-1-alobakin@pm.me> References: <20220414223704.341028-1-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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,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 When building bpftool with !CONFIG_PERF_EVENTS: skeleton/pid_iter.bpf.c:47:14: error: incomplete definition of type 'struct= 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: note: e= xpanded from macro 'container_of' ((type *)(__mptr - offsetof(type, member))); \ ^~~~~~~~~~~~~~~~~~~~~~ tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h:68:60: note: e= xpanded 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 --- kernel/bpf/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index e9621cfa09f2..34fdf27d14cf 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -2952,12 +2952,12 @@ static const struct bpf_link_ops bpf_raw_tp_link_lo= ps =3D { =09.fill_link_info =3D bpf_raw_tp_link_fill_link_info, }; -#ifdef CONFIG_PERF_EVENTS struct bpf_perf_link { =09struct bpf_link link; =09struct file *perf_file; }; +#ifdef CONFIG_PERF_EVENTS static void bpf_perf_link_release(struct bpf_link *link) { =09struct bpf_perf_link *perf_link =3D container_of(link, struct bpf_perf_= link, link); @@ -4333,6 +4333,7 @@ static int link_create(union bpf_attr *attr, bpfptr_t= uattr) #endif =09case BPF_PROG_TYPE_PERF_EVENT: =09case BPF_PROG_TYPE_TRACEPOINT: +=09=09BTF_TYPE_EMIT(struct bpf_perf_link); =09=09ret =3D bpf_perf_link_attach(attr, prog); =09=09break; =09case BPF_PROG_TYPE_KPROBE: -- 2.35.2