From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753517AbbCBLvm (ORCPT ); Mon, 2 Mar 2015 06:51:42 -0500 Received: from mail4.hitachi.co.jp ([133.145.228.5]:59148 "EHLO mail4.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751460AbbCBLvj (ORCPT ); Mon, 2 Mar 2015 06:51:39 -0500 Message-ID: <54F44EC3.4070504@hitachi.com> Date: Mon, 02 Mar 2015 20:51:31 +0900 From: Masami Hiramatsu Organization: Hitachi, Ltd., Japan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Daniel Borkmann Cc: Alexei Starovoitov , Ingo Molnar , Steven Rostedt , Namhyung Kim , Arnaldo Carvalho de Melo , Jiri Olsa , "David S. Miller" , Peter Zijlstra , linux-api@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 tip 1/7] bpf: make internal bpf API independent of CONFIG_BPF_SYSCALL ifdefs References: <1425252465-27527-1-git-send-email-ast@plumgrid.com> <1425252465-27527-2-git-send-email-ast@plumgrid.com> <54F44115.40505@hitachi.com> <54F4451B.8000703@iogearbox.net> In-Reply-To: <54F4451B.8000703@iogearbox.net> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (2015/03/02 20:10), Daniel Borkmann wrote: > On 03/02/2015 11:53 AM, Masami Hiramatsu wrote: > ... >> Hmm, it seems that this still doesn't hide some APIs which is provided >> only when CONFIG_BPF_SYSCALL. For example bpf_register_map_type etc. >> I think all those APIs should be hidden in #ifdef or at least be commented >> so that the user doesn't refer that without the kconfig. >> (I don't think we need to provide dummy functions for those APIs, >> but it's better to clarify which API we can use with which kconfig) > > Well, currently all possible map types (hash table, array map) that > would actually call into bpf_register_map_type() are only built when > CONFIG_BPF_SYSCALL is enabled (see kernel/bpf/Makefile). I don't think > new map additions should be added that are not under kernel/bpf/ and/or > enabled outside the CONFIG_BPF_SYSCALL, as it should be considered > part of the eBPF core code. > > The difference here (this patch) is simply that we don't want users to > build ifdef spaghetti constructs in user code, so the API that is > actually used by eBPF _users_ is being properly ifdef'ed in the headers. > > So, I don't think this is a big problem, but we could move these bits > under the ifdef CONFIG_BPF_SYSCALL w/o providing a dummy in the else part. > I can do that outside of the scope of this set. Or, maybe we'd better move them into new include/linux/bpf_prog.h which includes basic include/linux/bpf.h. Then, user can include the bpf_prog.h instead of bpf.h. Also, we can check CONFIG_BPF_SYSCAL=y at the top of bpf_prog.h. This makes things clearer :) Thank you, -- Masami HIRAMATSU Software Platform Research Dept. Linux Technology Research Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: masami.hiramatsu.pt@hitachi.com