From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752547AbbJUB4r (ORCPT ); Tue, 20 Oct 2015 21:56:47 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:5673 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751773AbbJUB4q (ORCPT ); Tue, 20 Oct 2015 21:56:46 -0400 Message-ID: <5626F09F.3070609@huawei.com> Date: Wed, 21 Oct 2015 09:55:43 +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: Arnaldo Carvalho de Melo CC: , , , , , , , , , , , , , Subject: Re: [PATCH 03/31] perf tools: Enable passing bpf object file to --event References: <1444826502-49291-1-git-send-email-wangnan0@huawei.com> <1444826502-49291-4-git-send-email-wangnan0@huawei.com> <20151020151255.GF5119@kernel.org> <20151020151558.GG5119@kernel.org> In-Reply-To: <20151020151558.GG5119@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/10/20 23:15, Arnaldo Carvalho de Melo wrote: > Em Tue, Oct 20, 2015 at 12:12:55PM -0300, Arnaldo Carvalho de Melo escreveu: >> Em Wed, Oct 14, 2015 at 12:41:14PM +0000, Wang Nan escreveu: >>> By introducing new rules in tools/perf/util/parse-events.[ly], this >>> patch enables 'perf record --event bpf_file.o' to select events by an >>> eBPF object file. It calls parse_events_load_bpf() to load that file, >>> which uses bpf__prepare_load() and finally calls bpf_object__open() for >>> the object files. >>> >>> After applying this patch, commands like: >>> >>> # perf record --event foo.o sleep >>> >>> become possible. >> So, trying the above command I get almost perfect output: >> >> [root@felicio ~]# perf record --event foo.o sleep >> libbpf: failed to open foo.o: No such file or directory >> event syntax error: 'foo.o' >> \___ BPF object file 'foo.o' is invalid >> >> (add -v to see detail) >> 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 ~]# >> >> >> Good thing would be to not have any message from libbpf and the right error >> message from the parser, i.e. the first three lines become these two: >> >> >> event syntax error: 'foo.o' >> \___ BPF object file 'foo.o' not found.o >> >> But that can be fixed up in an upcoming patch, so I am applying this one now in >> my new attempt at processing this patchkit. I think fixing that is not very hard. When designing libbpf, I thought the problem like this so makes libbpf output controled by caller using 'libbpf_set_print()'. What we need to do is to pass different output functions to libbpf. We can easily disable all output from libbpf if verbose is set 0. The only question is: do you want me to provide a new version of patch 'perf ebpf: Add the libbpf glue' or you prefer another patch to adjust the output functions? Thank you. > Ditto for: > > [acme@felicio linux]$ perf record --event /tmp/build/perf/perf.o sleep > libbpf: /tmp/build/perf/perf.o is not an eBPF object file > event syntax error: '/tmp/build/perf/perf.o' > \___ BPF object file '/tmp/build/perf/perf.o' is invalid > > (add -v to see detail) > 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 > [acme@felicio linux]$ > > Now trying to find a _valid_ ebpf object file to test with. > > - Arnaldo