Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp707359pxb; Fri, 15 Apr 2022 09:20:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJAnPmW+KyTDOFwr3JKYdHH9QNkQV8khqKf8A1RUSbsp3F9SuCQ7wNuzmFoqO40cJ9SkIf X-Received: by 2002:a63:602:0:b0:3a1:ec9d:1533 with SMTP id 2-20020a630602000000b003a1ec9d1533mr5634278pgg.470.1650039625652; Fri, 15 Apr 2022 09:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650039625; cv=none; d=google.com; s=arc-20160816; b=gGg9tiJ8mqSXmUgB3R+EibRE1W53aQMsqJgYELpt+KXxhNuECZ3BhCdPrWoOx793H6 ZzuZvEifEVWBjCoFVmzApKSKE+tNfdu8XVqFkddagN9tITsMQXw2ChGbfxhaAhMGQ/ah N3gem0oMnmumr8eSX7CFmxCbzth29liqkqA3i+NPrxvCJB4PWyWOY9JEGtu/bcL6jyUM dvlYz+nNKLOvp7BHfa7TjZ4BYThU7cmTYIguZwtns33+pZR7xbm1Vgi2B6Tfd1s4eeMH H6T75lNoMI4HJWsQohH+QiJsIy11iBzZEt3iK+cq6eDVTYpMbHOgXniWRQO7/2SWMVmn xd0w== 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=m39CgK5yAeTLeYnreGilY1UHwXX8icQa6tZk1rsB5Sc=; b=tHKnNG7qq7WyOsmsI9JCD7UCUqOjFK5G/VwSpk8uvI5zfKOuS0gW919x0WUAVDCi2n mISYG7tPH08CQ73EPAFOScOteu/EyiWwiV8TxED0Mxj2HYd7iV5jScpmYSQLyzMWqCac /Zcjwp4heALxXUUCDqdMbsCZ2aVx3CfF5oItqabyKXylWHEc8UCGIIFIuFYdcmdTOCfL NVuaZboCOdRMUEzyZwAf1XuE0QkGAByd0eimmcfW6sR1TWzd/HVryZwfoqy3S9tocfeq sjH08GnjRuaWUGhT3csmECTyY4Vy4ou85xFtH7YZRBgHNbNsa1vnSETr6jJGzLKAQe6f MTtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail2 header.b=TkUjN83L; 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 a23-20020a631a57000000b0039859d7cf84si1898241pgm.256.2022.04.15.09.20.11; Fri, 15 Apr 2022 09:20:25 -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=TkUjN83L; 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 S1347158AbiDNWrY (ORCPT + 99 others); Thu, 14 Apr 2022 18:47:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347139AbiDNWrV (ORCPT ); Thu, 14 Apr 2022 18:47:21 -0400 Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DDD15F4FE for ; Thu, 14 Apr 2022 15:44:54 -0700 (PDT) Date: Thu, 14 Apr 2022 22:44:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail2; t=1649976293; bh=m39CgK5yAeTLeYnreGilY1UHwXX8icQa6tZk1rsB5Sc=; 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=TkUjN83LOR7KPiP6/BtDcJy9T5A0SCRrwKRt1UzFAetbS3c2v+4YvxILXankuuXKA 4HY05YFja8QYjbogtEz/s3wWHsySjkzwMmMmTQe/GZkAKHlTVVzgr2BOFKMUlYdunH rlfQ0yZrJiUMxNdi/r5H9DIqgAc5zLN8ybeswQmgTg7NUzgVx050NOn/FYpLVcfwaf POZh9VZIGI9C+ZjD+HeOg87Gpvtxhol39CYLQ9cTVYgA+ymIpw0NTL02KXjOxWRu3j V2oO+f4NaEvXJWVWqIMY7N935zYLBKulFFf/y0Q9/PDR1Pc6f/JDUGJcRR8dSV0C9U bTqx92pK+L0rg== 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 01/11] bpf, perf: fix bpftool compilation with !CONFIG_PERF_EVENTS Message-ID: <20220414223704.341028-2-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.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 When CONFIG_PERF_EVENTS is not set, struct perf_event remains empty. However, the structure is being used by bpftool indirectly via BTF. This leads to: skeleton/pid_iter.bpf.c:49:30: error: no member named 'bpf_cookie' in 'stru= ct perf_event' return BPF_CORE_READ(event, bpf_cookie); ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ ... skeleton/pid_iter.bpf.c:49:9: error: returning 'void' from a function with = incompatible result type '__u64' (aka 'unsigned long long') return BPF_CORE_READ(event, bpf_cookie); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tools and samples can't use any CONFIG_ definitions, so the fields used there should always be present. Move CONFIG_BPF_SYSCALL block out of the CONFIG_PERF_EVENTS block to make it available unconditionally. Fixes: cbdaf71f7e65 ("bpftool: Add bpf_cookie to link output") Signed-off-by: Alexander Lobakin --- include/linux/perf_event.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index af97dd427501..b1d5715b8b34 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -762,12 +762,14 @@ struct perf_event { =09u64=09=09=09=09(*clock)(void); =09perf_overflow_handler_t=09=09overflow_handler; =09void=09=09=09=09*overflow_handler_context; +#endif /* CONFIG_PERF_EVENTS */ #ifdef CONFIG_BPF_SYSCALL =09perf_overflow_handler_t=09=09orig_overflow_handler; =09struct bpf_prog=09=09=09*prog; =09u64=09=09=09=09bpf_cookie; #endif +#ifdef CONFIG_PERF_EVENTS #ifdef CONFIG_EVENT_TRACING =09struct trace_event_call=09=09*tp_event; =09struct event_filter=09=09*filter; -- 2.35.2