Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755650AbbHGHQl (ORCPT ); Fri, 7 Aug 2015 03:16:41 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39468 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754542AbbHGHQj (ORCPT ); Fri, 7 Aug 2015 03:16:39 -0400 Date: Fri, 7 Aug 2015 00:15:53 -0700 From: tip-bot for Wang Nan Message-ID: Cc: hekuang@huawei.com, a.p.zijlstra@chello.nl, wangnan0@huawei.com, tglx@linutronix.de, namhyung@kernel.org, brendan.d.gregg@gmail.com, mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, daniel@iogearbox.net, xiakaixu@huawei.com, acme@redhat.com, dsahern@gmail.com, masami.hiramatsu.pt@hitachi.com, lizefan@huawei.com, jolsa@kernel.org, ast@plumgrid.com Reply-To: mingo@kernel.org, daniel@iogearbox.net, linux-kernel@vger.kernel.org, hpa@zytor.com, wangnan0@huawei.com, tglx@linutronix.de, hekuang@huawei.com, a.p.zijlstra@chello.nl, namhyung@kernel.org, brendan.d.gregg@gmail.com, dsahern@gmail.com, masami.hiramatsu.pt@hitachi.com, lizefan@huawei.com, ast@plumgrid.com, jolsa@kernel.org, xiakaixu@huawei.com, acme@redhat.com In-Reply-To: <1435716878-189507-2-git-send-email-wangnan0@huawei.com> References: <1435716878-189507-2-git-send-email-wangnan0@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] bpf: Use correct #ifdef controller for trace_call_bpf() Git-Commit-ID: 098d2164e3441c252eaa28906d45e16b7bf1bd2b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3421 Lines: 80 Commit-ID: 098d2164e3441c252eaa28906d45e16b7bf1bd2b Gitweb: http://git.kernel.org/tip/098d2164e3441c252eaa28906d45e16b7bf1bd2b Author: Wang Nan AuthorDate: Wed, 1 Jul 2015 02:13:49 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 6 Aug 2015 15:27:37 -0300 bpf: Use correct #ifdef controller for trace_call_bpf() Commit e1abf2cc8d5d80b41c4419368ec743ccadbb131e ("bpf: Fix the build on BPF_SYSCALL=y && !CONFIG_TRACING kernels, make it more configurable") updated the building condition of bpf_trace.o from CONFIG_BPF_SYSCALL to CONFIG_BPF_EVENTS, but the corresponding #ifdef controller in trace_events.h for trace_call_bpf() was not changed. Which, in theory, is incorrect. With current Kconfigs, we can create a .config with CONFIG_BPF_SYSCALL=y and CONFIG_BPF_EVENTS=n by unselecting CONFIG_KPROBE_EVENT and selecting CONFIG_BPF_SYSCALL. With these options, trace_call_bpf() will be defined as an extern function, but if anyone calls it a symbol missing error will be triggered since bpf_trace.o was not built. This patch changes the #ifdef controller for trace_call_bpf() from CONFIG_BPF_SYSCALL to CONFIG_BPF_EVENTS. I'll show its correctness: Before this patch: BPF_SYSCALL BPF_EVENTS trace_call_bpf bpf_trace.o y y normal compiled n n inline not compiled y n normal not compiled (incorrect) n y impossible (BPF_EVENTS depends on BPF_SYSCALL) After this patch: BPF_SYSCALL BPF_EVENTS trace_call_bpf bpf_trace.o y y normal compiled n n inline not compiled y n inline not compiled (fixed) n y impossible (BPF_EVENTS depends on BPF_SYSCALL) So this patch doesn't break anything. QED. Signed-off-by: Wang Nan Cc: Alexei Starovoitov Cc: Brendan Gregg Cc: Daniel Borkmann Cc: David Ahern Cc: He Kuang Cc: Jiri Olsa Cc: Kaixu Xia Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1435716878-189507-2-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- include/linux/trace_events.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 1063c85..180dbf8 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -542,7 +542,7 @@ event_trigger_unlock_commit_regs(struct trace_event_file *file, event_triggers_post_call(file, tt); } -#ifdef CONFIG_BPF_SYSCALL +#ifdef CONFIG_BPF_EVENTS unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx); #else static inline unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx) -- 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/