Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3671027pxb; Tue, 19 Apr 2022 07:38:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwL9jhtq8daA3aCmzmM+oLZ59q1SJz6n14o4tPt8pnDVHcEFa9Jg2L7F46ktmuRn1gTOMS3 X-Received: by 2002:a65:6c10:0:b0:380:437a:c154 with SMTP id y16-20020a656c10000000b00380437ac154mr14776111pgu.549.1650379126418; Tue, 19 Apr 2022 07:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650379126; cv=none; d=google.com; s=arc-20160816; b=iD6+GcSX2VmIIU/SXuHVQA2MJOqlBXSK7+oZ5yMprxeA5OxoA4acZQAjovmD3jgpRx L0NKvfPJXl3LieirHd4maWhYwUo20dd4t1OQQzXIxQPOh3mqic6VY59RT/Ex5Y1FezjZ UjHr/GCZ8atKH2noxjPh5bt5UKlI3CokUUmxjY7CsdG90v0VQzIKwFVykqvZg0RQEdCQ 4rpN0Chw1NU3iekPC20x+JvThqmggJWamUk45/9OmSNE74uU+ukfCoB7fXgGqg98inba 7cMXtRklFLciXJCQHJAcdgF0BsmPZI05v9LHFOUstcmluAtPxH5MATEfvZ28PGNvQ0Lx NUkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tJv95mQg9EXcrt3p8ZvGMQTsakmmfw1AaQTwIhE1nnE=; b=I6yVQFjDhiD2AyJ8ZYmwH/W9A4Pg64DcPts+/iXjbkVwBtw0cUKWdpVudMp0X+DHMT qRsPajLZLK3Gf8/Jipqaoc0qD17cKUxV4t11x+jV11x2zCYrFV1XVRnNVjkNiLrQofkP vXFnwHCu6gd8I94JHyNOMyByPQQNTtTrHJo5SRJ/+R/jEND0x65NgVbT17mOK1BQg4UG QdXlqUEZUkhpJjdF6TjOa9Xd4oZ2pmJePVxsU7mbzur6dG7YssvhJ69yhZm8c98Smo0w dm/YNVBwXvj7VI4fQR248nxp7tqY5OP9h2Y33UQ3Mbc0BAb4Y2eQsA9ptEw+3SvpaMQa a2IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Ib42ZfuG; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a056a00140700b004fdf6336020si12074611pfu.61.2022.04.19.07.38.29; Tue, 19 Apr 2022 07:38:46 -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=@infradead.org header.s=desiato.20200630 header.b=Ib42ZfuG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350292AbiDSJHf (ORCPT + 99 others); Tue, 19 Apr 2022 05:07:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240297AbiDSJHd (ORCPT ); Tue, 19 Apr 2022 05:07:33 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CD82101D; Tue, 19 Apr 2022 02:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=tJv95mQg9EXcrt3p8ZvGMQTsakmmfw1AaQTwIhE1nnE=; b=Ib42ZfuGQhQogTNLh41qU+s7rN BRAbnqQc1YebQu2SE8eJycbwM5rnxrVzV01lhWWogtc7YfXe/fFYOOfKul6INZN27AAxhe9cF4b6Y kxe7Cp27gTncTOlOpfatmhDKqOzrjoG3bUGTaMJhWsb8S9YtpZbHjlOtOGIGoXOry9C6n83iBpSg6 sZV0VjTQqYvJg7uxZkk0kWg0ifqjNnMHZFF4jfCJ5RF4KXfuvH8Y9l7waFzBdNLDaqLfKytxkGozo OIzVudh0DufesV21MGJcSWu6hmhsMtoQmfa3Fc0BVR5Bg0eFxc6+wJrPo03zB3mULzxQslLelWcjt UrbiTiEQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngjmA-006mQV-2G; Tue, 19 Apr 2022 09:03:58 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 7D15998618A; Tue, 19 Apr 2022 11:03:55 +0200 (CEST) Date: Tue, 19 Apr 2022 11:03:55 +0200 From: Peter Zijlstra To: Alexander Lobakin Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , 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 , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , 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, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH bpf-next 01/11] bpf, perf: fix bpftool compilation with !CONFIG_PERF_EVENTS Message-ID: <20220419090355.GP2731@worktop.programming.kicks-ass.net> References: <20220414223704.341028-1-alobakin@pm.me> <20220414223704.341028-2-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220414223704.341028-2-alobakin@pm.me> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 On Thu, Apr 14, 2022 at 10:44:48PM +0000, Alexander Lobakin wrote: > 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 'struct 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. Urgh, this is nasty.. did you verify nothing relies on that structure actually being empty? Also, why are we changing kernel headers to fix some daft userspace issue? > 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 { > u64 (*clock)(void); > perf_overflow_handler_t overflow_handler; > void *overflow_handler_context; > +#endif /* CONFIG_PERF_EVENTS */ > #ifdef CONFIG_BPF_SYSCALL > perf_overflow_handler_t orig_overflow_handler; > struct bpf_prog *prog; > u64 bpf_cookie; > #endif > > +#ifdef CONFIG_PERF_EVENTS > #ifdef CONFIG_EVENT_TRACING > struct trace_event_call *tp_event; > struct event_filter *filter; > -- > 2.35.2 > >