Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752528AbbFKILF (ORCPT ); Thu, 11 Jun 2015 04:11:05 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:42103 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750956AbbFKIKv (ORCPT ); Thu, 11 Jun 2015 04:10:51 -0400 Message-ID: <55794240.7060009@huawei.com> Date: Thu, 11 Jun 2015 16:09:36 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Namhyung Kim , Alexei Starovoitov CC: , , , , , , , , , , , , , Subject: Re: [RFC PATCH v6 25/32] perf tools: Add 'bpf.' config section to perf default config References: <1433829036-23687-1-git-send-email-wangnan0@huawei.com> <1433829036-23687-26-git-send-email-wangnan0@huawei.com> <55777A17.7030000@plumgrid.com> <20150611074553.GB11184@sejong> In-Reply-To: <20150611074553.GB11184@sejong> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.55794255.0057,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 60da3a1300350e825ae124a8cb601290 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2170 Lines: 59 On 2015/6/11 15:45, Namhyung Kim wrote: > On Tue, Jun 09, 2015 at 04:43:19PM -0700, Alexei Starovoitov wrote: >> On 6/8/15 10:50 PM, Wang Nan wrote: >>> perf_bpf_config() is added to parse 'bpf' section in perf config file. >>> Following is an example: >>> >>> [bpf] >>> clang-path = /llvm/bin/x86_64-linux-clang" >>> llc-path = /llvm/bin/x86_64-linux-llc" >>> clang-opt = "-nostdinc -isystem /llvm/lib/clang/include -I/kernel/arch/x86/include ..." >>> llc-opt = "" >> a section to specify -I flags to compile prog.c is useful, >> but users shouldn't be populating it manually for kernel headers. >> How about adding a script that can figure out $(LINUXINCLUDE) >> automatically ? > Maybe a dummy question. For what reason it needs such headers? Is it > possible to have a (part of?) copy of needed bits in the perf source? > > Thanks, > Namhyung It is improtant for eBPF script that it should be able to extract information from kernel pointers. For example: to extract registers from 'struct pt_regs' and to extract fields from 'struct page *'. I believe this is an improtant reason why we decide to use C-like language instead of designing a DLS. Therefore, when compiling .c to .o, kernel source is mandatory. Since we don't want to limit the ability of data accessing of eBPF scripts, we have to give it ability to access all kernel headers. Thank you for reviewing. >> You can even invoke such flag detector from perf via something like: >> f = open /tmpdir/Makefile >> fprintf(f, "obj-y := dummy.o\n"); >> fprintf(f, "$(obj)/%%.o: $(src)/%%.c\n"); >> fprintf(f, "\t@echo -n \"$(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS)\" >>> %s\n", cachefile); >> snprintf(cmd, "make -s -C /lib/modules/%s/build M=%s dummy.o", >> uts_release, tmpdir); >> system(cmd); >> read flags from cachefile and cache it for the future. >> ... >> or as independent script that populates .perfconfig >> -- 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/