From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753998AbbHCQL1 (ORCPT ); Mon, 3 Aug 2015 12:11:27 -0400 Received: from mail.kernel.org ([198.145.29.136]:54583 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753061AbbHCQLZ (ORCPT ); Mon, 3 Aug 2015 12:11:25 -0400 Date: Mon, 3 Aug 2015 13:11:16 -0300 From: Arnaldo Carvalho de Melo To: pi3orama Cc: "Wangnan (F)" , He Kuang , Li Zefan , "ast@plumgrid.com" , "xiakaixu@huawei.com" , "linux-kernel@vger.kernel.org" , Ingo Molnar , Jiri Olsa , David Ahern , Namhyung Kim Subject: Re: perf eBPF patch ordering. was: Re: perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering events using eBPF programs Message-ID: <20150803161116.GB5498@kernel.org> References: <55AE2858.6040409@huawei.com> <20150721114151.GF5368@kernel.org> <55AF1EA5.5020500@huawei.com> <20150731153522.GA16700@kernel.org> <20150731203125.GB16700@kernel.org> <55BED407.9090009@huawei.com> <20150803150728.GA3864@kernel.org> <20150803151905.GE3864@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Aug 03, 2015 at 11:53:05PM +0800, pi3orama escreveu: > > > 发自我的 iPhone > > > 在 2015年8月3日,下午11:19,Arnaldo Carvalho de Melo 写道: > > > > Em Mon, Aug 03, 2015 at 12:07:28PM -0300, Arnaldo Carvalho de Melo escreveu: > >> Em Mon, Aug 03, 2015 at 10:37:59AM +0800, Wangnan (F) escreveu: > >>> On 2015/8/1 4:31, Arnaldo Carvalho de Melo wrote: > >>>> Somehow it is not calling what the changeset says it would call when passing > >>>> "-e foo.o", investigating... > >> > >>> Have you tried > >> > >>> /root/bin/perf record -e ./foo.o sleep 1 > >> > >>> The key is './'. > >> > >> Nope, trying it now I get: > >> > >> [root@felicio ~]# perf record -e ./foo.o sleep 1 > >> libbpf: failed to open ./foo.o: No such file or directory > >> bpf: failed to load ./foo.o > > > > And with a .c suffix: > > > > [root@felicio ~]# perf record -e ./foo.c sleep 1 > > clang-3.8: error: no such file or directory: '/root/./foo.c' > > clang-3.8: error: no input files > > What's the content of your foo.c? Could you please have a look? I said: > > Now to find a hello.c BPF scriptlet... Because, as clang says: "error: no such file or directory: '/root/./foo.c'" It doesn't exists :-) > I considered moving .o enabler down so when you see that patch the filter will be > workable. However , like the llvm support, doing so will enable a bulk of code by > one patch, that's not good. Moving .c enabler down is easy. Right, probably leaving the .c enabler to be the last one, together with a "hello_bpf.c" that we can use in testing it is best. > Now I'm working on a BPF testcase. Tomorrow you will see a new test: > # perf test BPF > It enforces test__llvm, and forks a 'perf record' to do the filtering, then checks the > result using perf report -D. The patch of the new test is a mark which indicates the > basic function of BPF filter is done. What do you think about this idea? Excellent idea, you could even save the intermediary .o file and use it in another test :-) Sometimes we can't straight away test some infrastructure because the patch at hand is just glue, that will later be used by a tool, 'perf record', say, in those cases we can test this glue by using it in a 'perf test' entry. Thanks! - Arnaldo > Thank you. > > > ERROR: unable to compile ./foo.c > > Hint: Check error message shown above. > > LLVM 3.7 or newer is required. Which can be found from http://llvm.org > > You may want to try git trunk: > > git clone http://llvm.org/git/llvm.git > > and > > git clone http://llvm.org/git/clang.git > > > > Or fetch the latest clang/llvm 3.7 from pre-built llvm packages for > > debian/ubuntu: > > http://llvm.org/apt > > > > If you are using old version of clang, change 'clang-bpf-cmd-template' > > option in [llvm] section of ~/.perfconfig to: > > > > "$CLANG_EXEC $CLANG_OPTIONS $KERNEL_INC_OPTIONS \ > > -working-directory $WORKING_DIR -c $CLANG_SOURCE \ > > -emit-llvm -o - | /path/to/llc -march=bpf -filetype=obj -o -" > > (Replace /path/to/llc with path to your llc) > > > > Hint: You can also pre-compile it into .o > > invalid or unsupported event: './foo.c' > > Run 'perf list' for a list of valid events > > > > usage: perf record [] [] > > or: perf record [] -- [] > > > > -e, --event event selector. use 'perf list' to list available events > > [root@felicio ~]# > > > > Now to find a hello.c BPF scriptlet... > > > > - Arnaldo