From patchwork Tue Nov 10 12:55:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 7590261 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C8144C05C6 for ; Tue, 10 Nov 2015 13:06:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC3432047B for ; Tue, 10 Nov 2015 13:06:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD17E20412 for ; Tue, 10 Nov 2015 13:06:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zw8YV-0004Ot-Im; Tue, 10 Nov 2015 13:01:47 +0000 Received: from mout.kundenserver.de ([212.227.17.24]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zw8YS-0004Ln-7s for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2015 13:01:45 +0000 Received: from wuerfel.localnet ([134.3.118.24]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0LzJrN-1aQR010NIv-014XCx; Tue, 10 Nov 2015 13:55:40 +0100 From: Arnd Bergmann To: Steven Rostedt Subject: [PATCH, REPORT] bpf_trace: build error without PERF_EVENTS Date: Tue, 10 Nov 2015 13:55:33 +0100 Message-ID: <4525348.Aq9YoXkChv@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:w215We2iD7ODIVvJE9LWKdhNdMnsLILNaflpteD41+86vrePOcJ ZA8EH4afr8mwS/mB/StcczFTwpxuVzA7OM7eaLL5Fn/Cj55KSI3DLICMJ94Y9FGfGPYuQB3 iNNyLeUsVbKvL/IWWwvtMfwytih9Qm9ElBsJzgIN5f//egp2evLASeNl/npJcrX2i5JK9Nz U9sP7SubQSmgwSSFPWh/Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:bv1UZK0H1NU=:8CPDENMHuz2VNX7SVS8q4c E05YFRv151xTNsegFnV/cmrkZrbErrwneJrbnvFWNQV6gBRvP3K53kHbjI3covZFrfxD4ewql sMUCt6QEgSWYxE6oey1b/b5mMiBDg0i35dFxEUA5JU6fX3f+jMV4NV1WFgjp+nIkmXhRxCgDT OkFhrXXhmG6Mpb7FAokVsVZNhqA+A7TKKKf8gN5zWiAZbjSrAU5L4HmHwtOlVEViJEjjm2SM0 rTIEchRuJLZyneBKD38hE8Yf3ynIS25xXFSallF3bzr77q5NQSp2Vey7RUxBHv9TlAmybvTw5 vh3oB20Q6aRcjHBuyG8BGR8ixJLSfCsJXR/5QwBHUkClvWsV9S2znKIxfXtmG/9U8en+zcbPn joFLWNrlqXq90EpO6czqNfOlfvqt5HpWF8XQFJscXkXaeRzUu83lOqqUk8/CcYa2eYqysIiYp wTz5BCZggy3KAC57aExK4LT6TTWF4jGtHHZJFtRvj4lToDJIWXNetJ34FW9SwS1bmH9XqfbYp jOQeKrAKmgY8X2uI3dPfmmYDGO8XRymB9OilpDGugx1dL6M6By3X53LxdcoEsICTbEI8GNyyd lRRqT4iHHruni0HJyxifNh0K04hivRZn+/9rbi5OulHMeilEw3wuKXB1MjI6/NKVI8QE+TFGH 7vyNtQj40Wt8AcL6LlDPacYSxupZtlu2Ryb0EHvQNhnrvm0RAunRnxfAU9+FR74PfAVLqa8ZP FLP3t0EGmTtyeAe2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151110_050144_642447_B9339207 X-CRM114-Status: GOOD ( 16.33 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wang Nan , Kaixu Xia , Daniel Borkmann , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Alexei Starovoitov , Ingo Molnar , Hannes Frederic Sowa , "David S. Miller" , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In my ARM randconfig tests, I'm getting a build error for newly added code in bpf_perf_event_read and bpf_perf_event_output whenever CONFIG_PERF_EVENTS is disabled: kernel/trace/bpf_trace.c: In function 'bpf_perf_event_read': kernel/trace/bpf_trace.c:203:11: error: 'struct perf_event' has no member named 'oncpu' if (event->oncpu != smp_processor_id() || ^ kernel/trace/bpf_trace.c:204:11: error: 'struct perf_event' has no member named 'pmu' event->pmu->count) This can happen when UPROBE_EVENT is enabled but KPROBE_EVENT is disabled. I'm not sure if that is a configuration we care about, otherwise we could prevent this case from occuring by adding Kconfig dependencies. Simply hiding the broken code inside #ifdef CONFIG_PERF_EVENTS as this patch does seems to reliably fix the error as well, I have built thousands of randconfig kernels since I started seeing this and added the workaround. Signed-off-by: Arnd Bergmann Fixes: 62544ce8e01c ("bpf: fix bpf_perf_event_read() helper") Fixes: a43eec304259 ("bpf: introduce bpf_perf_event_output() helper") --- I suspect my patch is not the right answer, but could someone please fix this? diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 4228fd3682c3..82e0bc9d002a 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -186,6 +186,7 @@ const struct bpf_func_proto *bpf_get_trace_printk_proto(void) return &bpf_trace_printk_proto; } +#if IS_ENABLED(CONFIG_PERF_EVENTS) static u64 bpf_perf_event_read(u64 r1, u64 index, u64 r3, u64 r4, u64 r5) { struct bpf_map *map = (struct bpf_map *) (unsigned long) r1; @@ -263,6 +264,7 @@ static const struct bpf_func_proto bpf_perf_event_output_proto = { .arg4_type = ARG_PTR_TO_STACK, .arg5_type = ARG_CONST_STACK_SIZE, }; +#endif static const struct bpf_func_proto *kprobe_prog_func_proto(enum bpf_func_id func_id) { @@ -289,10 +291,12 @@ static const struct bpf_func_proto *kprobe_prog_func_proto(enum bpf_func_id func return bpf_get_trace_printk_proto(); case BPF_FUNC_get_smp_processor_id: return &bpf_get_smp_processor_id_proto; +#if IS_ENABLED(CONFIG_PERF_EVENTS) case BPF_FUNC_perf_event_read: return &bpf_perf_event_read_proto; case BPF_FUNC_perf_event_output: return &bpf_perf_event_output_proto; +#endif default: return NULL; }