Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752471AbbLNFve (ORCPT ); Mon, 14 Dec 2015 00:51:34 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:36483 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751128AbbLNFvd (ORCPT ); Mon, 14 Dec 2015 00:51:33 -0500 Date: Sun, 13 Dec 2015 21:51:25 -0800 From: Alexei Starovoitov To: "Wangnan (F)" Cc: pi3orama , Arnaldo Carvalho de Melo , namhyung@kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org, lizefan@huawei.com, Alexei Starovoitov , Masami Hiramatsu Subject: Re: [PATCH v4 09/16] perf tools: Enable indices setting syntax for BPF maps Message-ID: <20151214055123.GA18340@ast-mbp.thefacebook.com> References: <1449541544-67621-1-git-send-email-wangnan0@huawei.com> <1449541544-67621-10-git-send-email-wangnan0@huawei.com> <20151211121145.GP17996@kernel.org> <20151211121521.GQ17996@kernel.org> <20151211182157.GC59096@ast-mbp.thefacebook.com> <566E3728.2090306@huawei.com> <20151214042820.GA17953@ast-mbp.thefacebook.com> <566E480C.7030702@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <566E480C.7030702@huawei.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1232 Lines: 28 On Mon, Dec 14, 2015 at 12:39:40PM +0800, Wangnan (F) wrote: > > And what do you think about the BPF function prototype? Should we put them > into kernel headers? What about:: > +#define DEFINE_BPF_FUNC(rettype, name, arglist...) static rettype > (*name)(arglist) = (void *)BPF_FUNC_##name tldr: let's keep it as a part of user headers until better solution found. frankly static void *(*bpf_map_lookup_elem)(void *map, void *key) = (void *) BPF_FUNC_map_lookup_elem; was llvm hack that I thought will be fixed quickly. That was the easiest way to make C/llvm/bpf_loader to agree on passing 'bpf_call #num' insn into the kernel. It works, but it works only with -O2 and higher. At lower optimization levels llvm generates load of constant into register and indirect call by register, so that's not suitable as clean api. bcc with clang::rewriter can solve it, but we don't want to always depend on that, so currently it's a status quo. Don't mess with what ain't broken. -- 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/