Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752780AbbKJNBv (ORCPT ); Tue, 10 Nov 2015 08:01:51 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:65512 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751027AbbKJNBu (ORCPT ); Tue, 10 Nov 2015 08:01:50 -0500 From: Arnd Bergmann To: Steven Rostedt Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Alexei Starovoitov , "David S. Miller" , Daniel Borkmann , Kaixu Xia , Hannes Frederic Sowa , Wang Nan , netdev@vger.kernel.org, Arnaldo Carvalho de Melo , linux-arm-kernel@lists.infradead.org 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 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2594 Lines: 67 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; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/