Re: [RFC PATCH v2 00/37] perf tools: introduce 'perf bpf' command to load eBPF programs.

2015-05-15 Thread Wangnan (F)
在 2015/5/15 16:03, Ingo Molnar 写道: Just a small stylistic side note: Wang Nan (37): tools perf: set vmlinux_path__nr_entries to 0 in vmlinux_path__exit. tools lib traceevent: install libtraceevent.a into libdir. tools build: Allow other override features to check. tools include:

Re: [BUG] kernel panic after bpf program removed.

2015-05-15 Thread Wangnan (F)
在 2015/5/15 13:37, Alexei Starovoitov 写道: On 5/14/15 8:54 PM, Wangnan (F) wrote: Hi Alexei Starovoitov and other, I triggered a kernel panic when developing my 'perf bpf' facility. The call stack is listed at the bottom of this mail. I attached two bpf programs on 'kmem_cache_free%return

Re: [RFC PATCH v2 00/37] perf tools: introduce 'perf bpf' command to load eBPF programs.

2015-05-15 Thread Wangnan (F)
在 2015/5/15 16:48, Ingo Molnar 写道: * Wangnan (F) wangn...@huawei.com wrote: perf tools: Set vmlinux_path__nr_entries to 0 in vmlinux_path__exit tools lib traceevent: Install libtraceevent.a into libdir tools: Allow other override features to check Hm, to check what? Not sure I can

Re: [RFC PATCH v3 16/37] bpf tools: Collect eBPF programs from their own sections

2015-05-18 Thread Wangnan (F)
在 2015/5/18 20:29, Namhyung Kim 写道: Hi, On Sun, May 17, 2015 at 10:56:41AM +, Wang Nan wrote: This patch collects all programs in an object file into an array of 'struct bpf_program' for further processing. That structure is for representing each eBPF program. 'bpf_prog' should be a

[BUG] kernel panic after bpf program removed.

2015-05-14 Thread Wangnan (F)
Hi Alexei Starovoitov and other, I triggered a kernel panic when developing my 'perf bpf' facility. The call stack is listed at the bottom of this mail. I attached two bpf programs on 'kmem_cache_free%return' and '__alloc_pages_nodemask'. The programs is very simple. The panic is raised

Re: [RFC PATCH v3 06/37] bpf tools: Introduce 'bpf' library to tools

2015-05-19 Thread Wangnan (F)
在 2015/5/19 1:35, Alexei Starovoitov 写道: On 5/17/15 3:56 AM, Wang Nan wrote: This is the first patch of libbpf. The goal of libbpf is to create a standard way for accessing eBPF object files. This patch creates Makefile and Build for it, allows 'make' to build libbpf.a and libbpf.so, 'make

Re: [RFC PATCH v3 06/37] bpf tools: Introduce 'bpf' library to tools

2015-05-20 Thread Wangnan (F)
在 2015/5/20 13:24, Alexei Starovoitov 写道: On 5/19/15 8:48 PM, Wangnan (F) wrote: + +# Version of eBPF elf file +FILE_VERSION = 1 what that comment suppose to mean? The format of eBPF objects can be improved in futher. A version number here is the precaution of backward compatibility

Re: [RFC PATCH v3 06/37] bpf tools: Introduce 'bpf' library to tools

2015-05-21 Thread Wangnan (F)
在 2015/5/19 1:35, Alexei Starovoitov 写道: On 5/17/15 3:56 AM, Wang Nan wrote: This is the first patch of libbpf. The goal of libbpf is to create a standard way for accessing eBPF object files. This patch creates Makefile and Build for it, allows 'make' to build libbpf.a and libbpf.so, 'make

Re: [GIT PULL 0/6] perf/core improvements and fixes

2015-06-05 Thread Wangnan (F)
On 2015/6/5 14:41, Ingo Molnar wrote: * Alexei Starovoitov a...@plumgrid.com wrote: On 6/4/15 7:04 AM, Ingo Molnar wrote: # perf record -e bpf_source.c cmdline to create a eBPF filter from source, Use # perf record -e bpf_object.o cmdline to create a eBPF filter from object

Re: [RFC PATCH v6 22/32] perf tools: Make perf depend on libbpf

2015-06-09 Thread Wangnan (F)
On 2015/6/9 13:50, Wang Nan wrote: [SNIP] +LIBBPF = $(BPF_PATH)libbpf.a + # python extension build directories PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/ PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/ @@ -227,6 +232,9 @@ export PERL_PATH LIB_FILE=$(OUTPUT)libperf.a PERFLIBS

Re: [RFC PATCH v5 03/30] tools build: Add feature check for eBPF API

2015-06-02 Thread Wangnan (F)
On 2015/6/3 6:11, Arnaldo Carvalho de Melo wrote: Em Mon, Jun 01, 2015 at 07:37:49AM +, Wang Nan escreveu: In this patch, eBPF API is checked by compiling a c source file which uses fields in bpf_attr which will be used by libbpf. Something is missing, where is the message saying that I

Re: [GIT PULL 0/6] perf/core improvements and fixes

2015-06-04 Thread Wangnan (F)
On 2015/6/4 13:48, Ingo Molnar wrote: * Arnaldo Carvalho de Melo a...@kernel.org wrote: Hi Ingo, Please consider applying. One of the next requests probably will have the eBPF work by Wang Nan, but I am still going thru it and want to test it thoroughly. BTW: Have

Re: [RFC PATCH v5 06/30] bpf tools: Open eBPF object file and do basic validation

2015-06-03 Thread Wangnan (F)
On 2015/6/4 5:35, Arnaldo Carvalho de Melo wrote: Em Wed, Jun 03, 2015 at 06:33:14PM -0300, Arnaldo Carvalho de Melo escreveu: Em Mon, Jun 01, 2015 at 07:37:52AM +, Wang Nan escreveu: This patch defines basic interface of libbpf. 'struct bpf_object' will SNIP Signed-off-by: Wang Nan

Re: [GIT PULL 0/6] perf/core improvements and fixes

2015-06-04 Thread Wangnan (F)
On 2015/6/4 15:21, Ingo Molnar wrote: * Wangnan (F) wangn...@huawei.com wrote: On 2015/6/4 13:48, Ingo Molnar wrote: * Arnaldo Carvalho de Melo a...@kernel.org wrote: Hi Ingo, Please consider applying. One of the next requests probably will have the eBPF work by Wang Nan

[EXPERIENCE] My experience on using perf record BPF filter on a real usecase

2015-06-04 Thread Wangnan (F)
Hi all, I'd like to share my exprience on using 'perf record' BPF filter in a real usecase to show the power and shortcome in my patch series: https://lkml.kernel.org/r/1433144296-74992-1-git-send-email-wangn...@huawei.com and other works on eBPF. My usecase shows that such filter is useful.

Re: [RFC PATCH v6 32/32] perf record: Add LLVM options for compiling BPF scripts

2015-06-09 Thread Wangnan (F)
On 2015/6/10 8:02, Alexei Starovoitov wrote: On 6/8/15 10:50 PM, Wang Nan wrote: Although previous patch allows setting BPF compiler related options in perfconfig, on some ad-hoc situation it still requires passing options through cmdline. This patch introduces 4 options to 'perf record' for

Re: [RFC PATCH v6 00/32] perf tools: filtering events using eBPF programs

2015-06-09 Thread Wangnan (F)
On 2015/6/9 21:59, Arnaldo Carvalho de Melo wrote: Em Tue, Jun 09, 2015 at 05:50:04AM +, Wang Nan escreveu: This is the 6th version which tries to introduce eBPF programs to perf. It enables 'perf record' to filter events using eBPF programs like: # perf record --event bpf-file.c sleep

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-09 Thread Wangnan (F)
On 2015/6/10 5:48, Alexei Starovoitov wrote: On 6/8/15 10:50 PM, Wang Nan wrote: +struct bpf_param bpf_param = { +.clang_path = clang, +.llc_path = llc, +.clang_opt = , +.llc_opt = , +}; the defaults are ok-ish, but llc is never in PATH. So most likely it won't work out of

Re: [RFC PATCH v6 25/32] perf tools: Add 'bpf.' config section to perf default config

2015-06-09 Thread Wangnan (F)
On 2015/6/10 7:43, 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 =

Re: [RFC PATCH v6 25/32] perf tools: Add 'bpf.' config section to perf default config

2015-06-09 Thread Wangnan (F)
On 2015/6/10 9:09, Alexei Starovoitov wrote: On 6/9/15 5:47 PM, Wangnan (F) wrote: On 2015/6/10 7:43, 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

Re: [RFC PATCH v6 32/32] perf record: Add LLVM options for compiling BPF scripts

2015-06-09 Thread Wangnan (F)
On 2015/6/9 13:50, Wang Nan wrote: Although previous patch allows setting BPF compiler related options in perfconfig, on some ad-hoc situation it still requires passing options through cmdline. This patch introduces 4 options to 'perf record' for this propose: --clang-path, --clang-opt,

Re: [EXPERIENCE] My experience on using perf record BPF filter on a real usecase

2015-06-10 Thread Wangnan (F)
On 2015/6/10 14:42, Alexei Starovoitov wrote: On 6/4/15 3:17 AM, Wangnan (F) wrote: Hi all, I'd like to share my exprience on using 'perf record' BPF filter in a real usecase to show the power and shortcome in my patch series: thanks for sharing! Here is another inconvenience. Currently

Re: [RFC PATCH v8 46/49] perf tools: Add prologue for BPF programs for fetching arguments

2015-06-25 Thread Wangnan (F)
On 2015/6/24 20:31, Wang Nan wrote: [SNIP] diff --git a/tools/perf/util/bpf-prologue.h b/tools/perf/util/bpf-prologue.h new file mode 100644 index 000..3f77606 --- /dev/null +++ b/tools/perf/util/bpf-prologue.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2015, He Kuang heku...@huawei.com + *

Re: [PATCH v2] bpf: fix a bug in verification logic when SUB operation taken on FRAME_PTR

2015-06-18 Thread Wangnan (F)
On 2015/6/19 0:00, Alexei Starovoitov wrote: On Thu, Jun 18, 2015 at 08:31:45AM +, Wang Nan wrote: Original code has a problem, cause following code failed to pass verifier: r1 - r10 r1 -= 8 r2 = 8 r3 = unsafe pointer call BPF_FUNC_probe_read -- R1 type=inv expected=fp

Re: [RFC] perf report: introduce --map-anon-mem for anon-executable-memory symbols parsing

2015-06-19 Thread Wangnan (F)
On 2015/6/18 22:01, Hou Pengyang wrote: This patch introduces a --map-anon-mem argument to perf report to deal with anon-executable-memory symbol parsing. --map-anon-mem is not a good name. The user defined map area list introduced in this patch can be used on not only anon mapping but also

Re: [RFC PATCH 1/3] perf probe: Init symbol as kprobe if any pev is kprobe

2015-06-27 Thread Wangnan (F)
On 2015/6/27 15:29, Masami Hiramatsu wrote: On 2015/06/25 19:37, Wang Nan wrote: Before this patch, add_perf_probe_events() init symbol maps only for uprobe if the first pev passed to it is a uprobe event. However, with the incoming BPF uprobe support, now it will be possible to pass an array

Re: [RFC PATCH 1/3] perf probe: Init symbol as kprobe if any pev is kprobe

2015-06-27 Thread Wangnan (F)
On 2015/6/27 16:30, Masami Hiramatsu wrote: Hi Wang, On 2015/06/27 16:34, Wangnan (F) wrote: On 2015/6/27 15:29, Masami Hiramatsu wrote: On 2015/06/25 19:37, Wang Nan wrote: Before this patch, add_perf_probe_events() init symbol maps only for uprobe if the first pev passed

Re: [RFC PATCH v9 00/50] perf tools: filtering events using eBPF programs

2015-06-26 Thread Wangnan (F)
On 2015/6/27 6:44, Alexei Starovoitov wrote: On 6/26/15 7:15 AM, Wang Nan wrote: This is the 9th version which tries to introduce eBPF programs to perf. This patchset combined with 2 patchset I posted: 1. V8 of 'perf tools: filtering events using eBPF programs'; 2. 'tracing, perf

Re: latency histogram with BPF

2015-06-12 Thread Wangnan (F)
On 2015/6/11 15:25, Daniel Wagner wrote: Hi Steven and Tom, I was playing a bit with BPF to see if it would be possible to get a preempt off latency histogram. On paper this looks like doable but adding kprobes on trace_preempt_[on|off] is not a clever idea. Who would have thought? :) In

Re: [RFC PATCH v7 37/37] perf record: Add clang options for compiling BPF scripts

2015-06-12 Thread Wangnan (F)
On 2015/6/12 13:35, Wang Nan wrote: Although previous patch allows setting BPF compiler related options in perfconfig, on some ad-hoc situation it still requires passing options through cmdline. This patch introduces 2 options to 'perf record' for this propose: --clang-path and --clang-opt.

Re: [PATCH tip] perf tools: Fix a compiling problem

2015-06-17 Thread Wangnan (F)
Please note that a similar patch has been applied by Arnaldo Carvalho de Melo: http://lkml.kernel.org/r/20150616134750.gc10...@kernel.org On 2015/6/3 20:30, Namhyung Kim wrote: Hi Wang, On Wed, Jun 3, 2015 at 5:50 PM, Wang Nan wangn...@huawei.com wrote: Commit

Re: [PATCH] perf unwind: Fix a compile error

2015-06-17 Thread Wangnan (F)
On 2015/6/16 21:47, Arnaldo Carvalho de Melo wrote: Em Tue, Jun 16, 2015 at 11:16:35AM +, Hou Pengyang escreveu: When libunwind is on, there is a compile error as : util/unwind-libunwind.c:363:21: error: 'dso' undeclared (first use in this function) dso__data_put_fd(dso); This

Re: [PATCH RESEND] perf tools: Ignore .config-detected in .gitignore

2015-06-17 Thread Wangnan (F)
This patch has already acked-by Jiri Olsa on March, but I lost the original email on my local mailbox, so send it again. Thank you. On 2015/6/17 19:59, Wang Nan wrote: Commit fcfd6611fbccdbf2593bd949097a5c0e45cd96da (tools build: Add detected config support) dynamically creates

Re: [RFC PATCH v7 00/37] perf tools: filtering events using eBPF programs

2015-06-15 Thread Wangnan (F)
On 2015/6/13 0:58, Alexei Starovoitov wrote: btw, what compile times do you see? On my machine compiling basic hello_world.c with #include bpf_helpers.h and few kernel headers take: 0.02 sec So using .c is quite instant. Feels like interpreted language ;) Sorry I didn't see your question

Re: [RFC PATCH v6 24/32] perf record: Compile scriptlets if pass '.c' to --event

2015-06-11 Thread Wangnan (F)
On 2015/6/11 15:19, Namhyung Kim wrote: Hi Wang, On Wed, Jun 10, 2015 at 08:06:17AM +0800, Wangnan (F) wrote: On 2015/6/10 5:48, Alexei Starovoitov wrote: Once clang integration is complete. One can pull upsteam llvm and clang and just use 'clang -O2 -c -march=bpf file.c' Good news, so

Re: [RFC PATCH v4 10/29] bpf tools: Collect map definitions from 'maps' section

2015-05-28 Thread Wangnan (F)
On 2015/5/29 11:35, Alexei Starovoitov wrote: On Thu, May 28, 2015 at 03:14:44PM +0800, Wangnan (F) wrote: On 2015/5/28 14:09, Alexei Starovoitov wrote: On Thu, May 28, 2015 at 11:09:50AM +0800, Wangnan (F) wrote: However this breaks a law in current design that opening phase doesn't talk

Re: [RFC PATCH v4 10/29] bpf tools: Collect map definitions from 'maps' section

2015-05-31 Thread Wangnan (F)
On 2015/6/1 10:12, Namhyung Kim wrote: Hi Alexei and Wang, On Thu, May 28, 2015 at 08:35:19PM -0700, Alexei Starovoitov wrote: On Thu, May 28, 2015 at 03:14:44PM +0800, Wangnan (F) wrote: On 2015/5/28 14:09, Alexei Starovoitov wrote: On Thu, May 28, 2015 at 11:09:50AM +0800, Wangnan (F

Re: [RFC PATCH v4 17/29] bpf tools: Relocate eBPF programs

2015-06-01 Thread Wangnan (F)
On 2015/6/1 13:32, Namhyung Kim wrote: On Wed, May 27, 2015 at 05:19:52AM +, Wang Nan wrote: If an eBPF program access a map, LLVM generates a relocated load instruction. To enable the usage of that map, relocation must be done by replacing original instructions by map loading

Re: [RFC PATCH v4 01/29] tools: Add __aligned_u64 to types.h

2015-05-27 Thread Wangnan (F)
On 2015/5/27 21:00, Arnaldo Carvalho de Melo wrote: Em Wed, May 27, 2015 at 05:19:36AM +, Wang Nan escreveu: Following patches will introduce linux/bpf.h to a new libbpf library, which requires definition of __aligned_u64. This patch add it to the common types.h for tools. This was

Re: [RFC PATCH v4 09/29] bpf tools: Collect version and license from ELF sections

2015-05-27 Thread Wangnan (F)
On 2015/5/28 9:48, Alexei Starovoitov wrote: On Wed, May 27, 2015 at 05:19:44AM +, Wang Nan wrote: Expand bpf_obj_elf_collect() to collect license and kernel version information in eBPF object file. eBPF object file should have a section named 'license', which contains a string. It should

Re: [PATCH] perf tools: introduce arm64 support unwind test.

2015-05-28 Thread Wangnan (F)
Ping? On 2015/3/27 21:08, Wang Nan wrote: Newest libunwind does support ARM64, and perf is able to utilize it also. This patch enables the missing perf test dwarf unwind for arm64. Test result: # ./perf test unwind 25: Test dwarf unwind : Ok

Re: [RFC PATCH v4 10/29] bpf tools: Collect map definitions from 'maps' section

2015-05-28 Thread Wangnan (F)
On 2015/5/28 14:09, Alexei Starovoitov wrote: On Thu, May 28, 2015 at 11:09:50AM +0800, Wangnan (F) wrote: However this breaks a law in current design that opening phase doesn't talk to kernel with sys_bpf() at all. All related staff is done in loading phase. This principle ensures

Re: [PATCH v6] perf: __kmod_path__parse: deal with kernel module names in '[]' correctly.

2015-05-28 Thread Wangnan (F)
Ping? Does anyone still concern this patch? On 2015/5/28 15:23, www-data wrote: Before patch ba92732e9808df679ddf75c5ea1c0caae6d7dce2 ('perf kmaps: Check kmaps to make code more robust'), perf report and perf annotate will segfault if trace data contains kernel module information like this:

Re: [RFC PATCH v4 10/29] bpf tools: Collect map definitions from 'maps' section

2015-05-27 Thread Wangnan (F)
On 2015/5/28 9:53, Alexei Starovoitov wrote: On Wed, May 27, 2015 at 05:19:45AM +, Wang Nan wrote: If maps are used by eBPF programs, corresponding object file(s) should contain a section named 'map'. Which contains map definitions. This patch copies the data of the whole section. Map

Re: [RFC PATCH v4 10/29] bpf tools: Collect map definitions from 'maps' section

2015-05-27 Thread Wangnan (F)
On 2015/5/28 10:28, Alexei Starovoitov wrote: On Thu, May 28, 2015 at 10:03:04AM +0800, Wangnan (F) wrote: On 2015/5/28 9:53, Alexei Starovoitov wrote: On Wed, May 27, 2015 at 05:19:45AM +, Wang Nan wrote: If maps are used by eBPF programs, corresponding object file(s) should contain

Re: [RFC PATCH v9 49/50 -fix] perf probe: Init symbol as kprobe if any event is kprobe

2015-06-30 Thread Wangnan (F)
On 2015/6/30 22:37, Arnaldo Carvalho de Melo wrote: Em Tue, Jun 30, 2015 at 09:38:26AM +0800, Wangnan (F) escreveu: On 2015/6/29 22:33, Arnaldo Carvalho de Melo wrote: Em Sat, Jun 27, 2015 at 12:25:45PM +, Wang Nan escreveu: Before this patch, add_perf_probe_events() init symbol maps

Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-30 Thread Wangnan (F)
On 2015/6/30 22:34, Arnaldo Carvalho de Melo wrote: Em Tue, Jun 30, 2015 at 10:29:08AM +0800, Wangnan (F) escreveu: On 2015/6/30 3:41, Arnaldo Carvalho de Melo wrote: So, what should I do now? I want to have that OFF line turned to on, so that I can test this stuff. But the changelog says

Re: [RFC PATCH 1/5] bpf: Put perf_events check ahead of bpf prog

2015-07-01 Thread Wangnan (F)
On 2015/7/2 11:50, Alexei Starovoitov wrote: On 6/30/15 7:57 PM, He Kuang wrote: When we add a kprobe point and record events by perf, the execution path of all threads on each cpu will enter this point, but perf may only record events on a particular thread or cpu at this kprobe point, a

Re: [RFC PATCH 0/5] Make eBPF programs output data to perf event

2015-07-02 Thread Wangnan (F)
On 2015/7/2 11:52, Alexei Starovoitov wrote: On 7/1/15 8:38 PM, He Kuang wrote: On 2015/7/2 10:48, Alexei Starovoitov wrote: On 7/1/15 4:58 AM, Peter Zijlstra wrote: But why create a separate trace buffer, it should go into the regular perf buffer. +1 I think +static char __percpu

Re: [PATCH] perf record: Allow passing perf's own pid to '--filter'

2015-07-06 Thread Wangnan (F)
On 2015/7/6 23:40, Arnaldo Carvalho de Melo wrote: Em Mon, Jul 06, 2015 at 11:00:10PM +0800, pi3orama escreveu: 发自我的 iPhone 在 2015年7月6日,下午9:56,Arnaldo Carvalho de Melo a...@kernel.org 写道: I.e. having something in the filter expression that gets transformed into the tools' pid, I have no

Re: [RFC PATCH 0/5] Make eBPF programs output data to perf event

2015-07-01 Thread Wangnan (F)
On 2015/7/1 13:44, Peter Zijlstra wrote: On Wed, Jul 01, 2015 at 02:57:30AM +, He Kuang wrote: This patch adds an extra perf trace buffer for other utilities like bpf to fill extra data to perf events. What!, why? The goal of this patchset is to give BPF program a mean to output

Re: [RFC PATCH v6 25/32] perf tools: Add 'bpf.' config section to perf default config

2015-06-11 Thread Wangnan (F)
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 =

Re: [RFC PATCH v3 21/37] bpf tools: Create eBPF maps defined in an object file

2015-05-25 Thread Wangnan (F)
On 2015/5/19 2:48, Alexei Starovoitov wrote: On 5/17/15 3:56 AM, Wang Nan wrote: This patch creates maps based on 'map' section in object file using bpf_create_map(), and store the fds into an array in 'struct bpf_object'. Since the byte order of the object may differ from the host, swap map

Re: [RFC PATCH v3 18/37] bpf tools: Record map accessing instructions for each program

2015-05-25 Thread Wangnan (F)
On 2015/5/19 2:34, Alexei Starovoitov wrote: On 5/17/15 3:56 AM, Wang Nan wrote: This patch records the indics of instructions which are needed to be relocated. Those information are saved in 'reloc_desc' field in 'struct bpf_program'. In loading phase (this patch takes effect in opening

Re: [RFC PATCH v3 30/37] perf bpf: Add bpf-loader and open ELF object files

2015-05-25 Thread Wangnan (F)
On 2015/5/23 1:24, Jiri Olsa wrote: On Sun, May 17, 2015 at 10:56:55AM +, Wang Nan wrote: SNIP +#define DEFINE_PRINT_FN(name, level) \ +static int libbpf_##name(const char *fmt, ...) \ +{ \ + va_list args; \ +

Re: [RFC PATCH v3 09/37] bpf tools: Open eBPF object file and do basic validation

2015-05-25 Thread Wangnan (F)
On 2015/5/25 21:30, Arnaldo Carvalho de Melo wrote: Em Fri, May 22, 2015 at 06:00:58PM -0700, Alexei Starovoitov escreveu: On 5/22/15 10:23 AM, Jiri Olsa wrote: +struct bpf_object *bpf_open_object(const char *path) another suggestion for the namespace.. Arnaldo forces us ;-) to use the

Re: [RFC PATCH v3 00/37] perf tools: introduce 'perf bpf' command to load eBPF programs.

2015-05-26 Thread Wangnan (F)
On 2015/5/20 4:46, Alexei Starovoitov wrote: On 5/19/15 9:40 AM, Arnaldo Carvalho de Melo wrote: Em Wed, May 20, 2015 at 01:04:48AM +0900, Namhyung Kim escreveu: On Tue, May 19, 2015 at 10:44:58AM -0300, Arnaldo Carvalho de Melo wrote: Em Mon, May 18, 2015 at 02:45:58PM -0700, Alexei

Re: [llvm-dev] llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-08-13 Thread Wangnan (F)
Thank you for your reply. Add He Kuang to CC list. On 2015/8/12 21:15, Brenden Blanco wrote: Hi Wangnan, I've been authoring the BCC development, so I'll answer those specific questions. Could you please give us further information about your clang rewriter? I guess you need a new .so when

Re: [RFC PATCH v6 0/2] Make eBPF programs output data to perf

2015-08-18 Thread Wangnan (F)
On 2015/8/14 5:49, Alexei Starovoitov wrote: On 8/13/15 2:35 PM, pi3orama wrote: I was thinking about whether to add a type field there, so we will have an explicit mov const instruction before the call instruction, which can act as a mark. Also, if we generate the type code automatically, a

Re: [RFC PATCH v8 38/49] bpf tools: Load instructions buffer using load_program()

2015-06-26 Thread Wangnan (F)
On 2015/6/26 16:28, Alexei Starovoitov wrote: On 6/24/15 5:31 AM, Wang Nan wrote: Extract code for loading a 'struct bpf_insn' array into kernel to load_program() and makes bpf_program__load() to call it. Now we have function loads instructions into kernel. It will be used by further patches,

Re: [RFC PATCH 3/3] perf tools: Support attach BPF program on uprobe events

2015-06-26 Thread Wangnan (F)
On 2015/6/26 16:47, Alexei Starovoitov wrote: On 6/25/15 3:37 AM, Wang Nan wrote: This patch append new syntax to BPF object section name to support probing at uprobe event. Now we can use BPF program like this: SEC( target:/lib64/libc.so.6\n libcwrite=__write ) int libcwrite(void

Re: [RFC PATCH v9 49/50 -fix] perf probe: Init symbol as kprobe if any event is kprobe

2015-06-29 Thread Wangnan (F)
On 2015/6/29 22:33, Arnaldo Carvalho de Melo wrote: Em Sat, Jun 27, 2015 at 12:25:45PM +, Wang Nan escreveu: Before this patch, add_perf_probe_events() init symbol maps only for uprobe if the first 'struct perf_probe_event' passed to it is a uprobe event. This is a trick because 'perf

Re: [RFC PATCH v9 02/50] tools build: Add feature check for eBPF API

2015-06-29 Thread Wangnan (F)
On 2015/6/30 3:41, Arnaldo Carvalho de Melo wrote: Em Mon, Jun 29, 2015 at 04:21:51PM -0300, Arnaldo Carvalho de Melo escreveu: Em Fri, Jun 26, 2015 at 02:15:07PM +, Wang Nan escreveu: In this patch, eBPF API is checked by compiling a c source file which uses fields in bpf_attr which

Re: perf eBPF patch ordering. was: Re: perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering events using eBPF programs

2015-08-04 Thread Wangnan (F)
On 2015/8/4 13:28, Wangnan (F) wrote: Hi Arnaldo, The following changes since commit 922cc21746202956acb41c89a6190bb50805fa31: perf tools: Introduce llvm config options (2015-07-31 12:17:50 -0300) are available in the git repository at: https://github.com/WangNan0/linux.git ebpf

Re: perf eBPF patch ordering. was: Re: perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering events using eBPF programs

2015-08-03 Thread Wangnan (F)
Hi Arnaldo, The following changes since commit 922cc21746202956acb41c89a6190bb50805fa31: perf tools: Introduce llvm config options (2015-07-31 12:17:50 -0300) are available in the git repository at: https://github.com/WangNan0/linux.git ebpf for you to fetch changes up to

Cc llvmdev: Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-08-04 Thread Wangnan (F)
but it support global variable only. Following is my response to Alexei. On 2015/8/4 3:44, Alexei Starovoitov wrote: On 7/31/15 3:18 AM, Wangnan (F) wrote: [SNIP] didn't have time to look at it. from your llvm patches looks like you've got quite experienced with it already :) I'll post 2 LLVM

Re: [LLVMdev] Cc llvmdev: Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-08-05 Thread Wangnan (F)
On 2015/8/5 10:05, Wangnan (F) wrote: Send again since llvmdev is moved to llvm-...@lists.llvm.org On 2015/8/5 9:58, Wangnan (F) wrote: On 2015/8/4 3:44, Alexei Starovoitov wrote: On 7/31/15 3:18 AM, Wangnan (F) wrote: [SNIP] didn't have time to look at it. from your llvm patches

Re: [LLVMdev] Cc llvmdev: Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-08-05 Thread Wangnan (F)
On 2015/8/5 15:11, Alexei Starovoitov wrote: On 8/4/15 11:51 PM, Wangnan (F) wrote: void bpf_store_half(void *skb, int off, int val) asm(llvm.bpf.store.half); int func() { bpf_store_half(0, 0, 0); return 0; } Compiled with: $ clang -g -target bpf -O2 -S -c test.c And get

Re: Cc llvmdev: Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-08-04 Thread Wangnan (F)
Send again since llvmdev is moved to llvm-...@lists.llvm.org On 2015/8/5 9:58, Wangnan (F) wrote: On 2015/8/4 17:01, Wangnan (F) wrote: For people who in llvmdev: This mail is belong to a thread in linux kernel mailing list, the first message can be retrived from: http://lkml.kernel.org

Re: Cc llvmdev: Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-08-04 Thread Wangnan (F)
On 2015/8/4 17:01, Wangnan (F) wrote: For people who in llvmdev: This mail is belong to a thread in linux kernel mailing list, the first message can be retrived from: http://lkml.kernel.org/r/55b1535e.8090...@plumgrid.com Our goal is to fild a way to make BPF program get an unique ID

Re: perf eBPF patch ordering. was: Re: perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering events using eBPF programs

2015-08-02 Thread Wangnan (F)
On 2015/8/1 4:31, Arnaldo Carvalho de Melo wrote: Em Fri, Jul 31, 2015 at 12:35:22PM -0300, Arnaldo Carvalho de Melo escreveu: But point here is, when I see enable passing bpf object file to --event I apply the patch and expect to be able to go straight away and do: perf record -e

Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-07-31 Thread Wangnan (F)
On 2015/7/30 1:13, Alexei Starovoitov wrote: [SNIP] probably both A and B won't really work when programs get bigger and optimizations will start moving lines around. the builtin_dwarf_type idea is actually quite interesting. Potentially that builtin can stringify type name and later we can

Re: [llvm-dev] [LLVMdev] Cc llvmdev: Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-08-05 Thread Wangnan (F)
On 2015/8/6 11:22, Alexei Starovoitov wrote: On Wed, Aug 05, 2015 at 04:28:13PM +0800, Wangnan (F) wrote: It doesn't work for me at first since in my llvm there's only llvm.bpf.load.*. I think llvm.bpf.store.* belone to some patches you haven't posted yet? nope. only loads have special

Re: perf eBPF patch ordering. was: Re: perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering events using eBPF programs

2015-08-05 Thread Wangnan (F)
Hi Arnaldo, Have you tried 'perf test BPF'? Is that okay on your environment? Thank you. On 2015/8/5 0:11, Arnaldo Carvalho de Melo wrote: Em Tue, Aug 04, 2015 at 12:55:57PM -0300, Arnaldo Carvalho de Melo escreveu: Em Tue, Aug 04, 2015 at 06:39:39PM +0800, Wangnan (F) escreveu: https

Re: [llvm-dev] [LLVMdev] Cc llvmdev: Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-08-05 Thread Wangnan (F)
On 2015/8/6 11:41, Alexei Starovoitov wrote: On Wed, Aug 05, 2015 at 04:59:01PM +0800, He Kuang wrote: Hi, Alexei On 2015/7/30 1:13, Alexei Starovoitov wrote: On 7/29/15 2:38 AM, He Kuang wrote: Hi, Alexei On 2015/7/28 10:18, Alexei Starovoitov wrote: On 7/25/15 3:04 AM, He Kuang wrote:

Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-08-11 Thread Wangnan (F)
On 2015/8/4 3:44, Alexei Starovoitov wrote: [SNIP] I'll post 2 LLVM patches by replying this mail. Please have a look and help me send them to LLVM if you think my code is correct. [SNIP] patch 2: do we really need to hack clang? Can you just define a function that aliases to intrinsic,

Re: [llvm-dev] llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-08-11 Thread Wangnan (F)
On 2015/8/12 12:57, Alexei Starovoitov wrote: On Wed, Aug 12, 2015 at 10:34:43AM +0800, Wangnan (F) via llvm-dev wrote: Think about a program like this: struct strA { int a; } struct strB { int b; } int func() { struct strA a; struct strB b; a.a = 1; b.b = 2; bpf_output

Re: perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering events using eBPF programs

2015-07-21 Thread Wangnan (F)
it again. Thank you. On 2015/7/21 19:41, Arnaldo Carvalho de Melo wrote: Em Tue, Jul 21, 2015 at 07:09:12PM +0800, Wangnan (F) escreveu: Hi Arnaldo, Have you recovered from your cold? Much better now, thanks. Could you please repick patch perf tools: Introduce llvm config options from my

Re: [PATCH v2 1/5] bpf: Add new bpf map type to store the pointer to struct perf_event

2015-07-22 Thread Wangnan (F)
On 2015/7/23 8:48, Alexei Starovoitov wrote: On 7/22/15 1:09 AM, Kaixu Xia wrote: Introduce a new bpf map type 'BPF_MAP_TYPE_PERF_EVENT_ARRAY'. This map will only store the pointer to struct perf_event. Signed-off-by: Kaixu Xia xiaka...@huawei.com --- include/linux/bpf.h | 2 ++

Re: [RFC PATCH 3/6] bpf: Save the pointer to struct perf_event to map

2015-07-17 Thread Wangnan (F)
On 2015/7/17 19:21, Wangnan (F) wrote: On 2015/7/17 19:06, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 06:43:33PM +0800, kaixu xia wrote: diff --git a/kernel/events/core.c b/kernel/events/core.c index e965cfa..c4e34b7 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c

Re: [RFC PATCH 5/6] bpf: Implement function bpf_read_pmu() that get the selected hardware PMU conuter

2015-07-17 Thread Wangnan (F)
On 2015/7/17 19:39, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 07:29:07PM +0800, Wangnan (F) wrote: On 2015/7/17 19:05, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 06:43:35PM +0800, kaixu xia wrote: The function bpf_read_pmu() can get the specific map key, convert the corresponding

Re: [RFC PATCH 3/6] bpf: Save the pointer to struct perf_event to map

2015-07-17 Thread Wangnan (F)
On 2015/7/17 20:02, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 07:54:55PM +0800, Wangnan (F) wrote: Thanks. In next version we will introduce a new function which do oppsite thing to perf_event_release_kernel() in perf/event/core.c, then fetch the event before fdput. perf_event_get

Re: [RFC PATCH 5/6] bpf: Implement function bpf_read_pmu() that get the selected hardware PMU conuter

2015-07-17 Thread Wangnan (F)
On 2015/7/17 20:18, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 08:01:07PM +0800, Wangnan (F) wrote: On 2015/7/17 19:56, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 01:55:05PM +0200, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 07:45:02PM +0800, Wangnan (F) wrote: Depends on what

Re: [RFC PATCH 3/6] bpf: Save the pointer to struct perf_event to map

2015-07-17 Thread Wangnan (F)
On 2015/7/17 19:40, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 07:34:22PM +0800, Wangnan (F) wrote: On 2015/7/17 19:21, Wangnan (F) wrote: On 2015/7/17 19:06, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 06:43:33PM +0800, kaixu xia wrote: diff --git a/kernel/events/core.c b/kernel

Re: [RFC PATCH 5/6] bpf: Implement function bpf_read_pmu() that get the selected hardware PMU conuter

2015-07-17 Thread Wangnan (F)
On 2015/7/17 19:56, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 01:55:05PM +0200, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 07:45:02PM +0800, Wangnan (F) wrote: Depends on what all you need, if you need full perf events to work then yes perf_event_read_value() is your only option

Re: [RFC PATCH 5/6] bpf: Implement function bpf_read_pmu() that get the selected hardware PMU conuter

2015-07-17 Thread Wangnan (F)
On 2015/7/17 20:01, Wangnan (F) wrote: On 2015/7/17 19:56, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 01:55:05PM +0200, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 07:45:02PM +0800, Wangnan (F) wrote: Depends on what all you need, if you need full perf events to work then yes

Re: [PATCH 14/39] perf tools: Auto detecting kernel build directory

2015-07-14 Thread Wangnan (F)
On 2015/7/14 14:56, Wangnan (F) wrote: On 2015/7/14 5:46, Arnaldo Carvalho de Melo wrote: Em Thu, Jul 09, 2015 at 12:35:17PM +, Wang Nan escreveu: This patch detects kernel build directory using a embedded shell script 'kbuild_detector', which does this by checking existence of include

Re: [PATCH 02/39] bpf tools: Collect eBPF programs from their own sections

2015-07-13 Thread Wangnan (F)
On 2015/7/14 3:51, Arnaldo Carvalho de Melo wrote: Em Fri, Jul 10, 2015 at 11:07:53AM +0800, Wangnan (F) escreveu: On 2015/7/9 23:58, Arnaldo Carvalho de Melo wrote: Em Thu, Jul 09, 2015 at 12:35:05PM +, Wang Nan escreveu: This patch collects all programs in an object file into an array

Re: [PATCH 14/39] perf tools: Auto detecting kernel build directory

2015-07-14 Thread Wangnan (F)
On 2015/7/14 5:46, Arnaldo Carvalho de Melo wrote: Em Thu, Jul 09, 2015 at 12:35:17PM +, Wang Nan escreveu: This patch detects kernel build directory using a embedded shell script 'kbuild_detector', which does this by checking existence of include/generated/autoconf.h. clang working

Re: [PATCH 06/39] bpf tools: Create eBPF maps defined in an object file

2015-07-13 Thread Wangnan (F)
On 2015/7/14 3:54, Arnaldo Carvalho de Melo wrote: Em Thu, Jul 09, 2015 at 12:35:09PM +, Wang Nan escreveu: SNIP +static int +bpf_object__create_maps(struct bpf_object *obj) +{ + unsigned int i; + size_t nr_maps; + int *pfd; + + nr_maps = obj-maps_buf_sz /

Re: perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering events using eBPF programs

2015-07-15 Thread Wangnan (F)
On 2015/7/14 23:36, Arnaldo Carvalho de Melo wrote: Em Thu, Jul 09, 2015 at 12:35:03PM +, Wang Nan escreveu: Hi Arnaldo, The following changes since commit 3381a29cbec5447086c0f726ee9a88c02e60becc: bpf tools: Collect map definitions from 'maps' section (2015-07-07 13:41:45 -0300)

Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event

2015-07-16 Thread Wangnan (F)
On 2015/7/17 12:11, Alexei Starovoitov wrote: On 7/14/15 4:54 AM, He Kuang wrote: I'm not sure llvm generates proper dwarf along with bpf code (I didn't test that part. If there are any issues they should be fixable. If you can prepapre a patch for llvm that would be even better :) I found

Re: [RFC PATCH v5 2/3] tools lib traceevent: Add function to get dynamic arrays length

2015-07-16 Thread Wangnan (F)
On 2015/7/14 9:59, He Kuang wrote: To print a trace event with a dynamic array, __print_array(array, len, element_size) requires the number of items in the array, which can be got by the helper function __get_dynamic_array_len(), currently it is not an available function in the function list

Re: perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering events using eBPF programs

2015-07-16 Thread Wangnan (F)
On 2015/7/15 19:20, Arnaldo Carvalho de Melo wrote: Em Wed, Jul 15, 2015 at 06:49:40PM +0800, Wangnan (F) escreveu: On 2015/7/14 23:36, Arnaldo Carvalho de Melo wrote: I have the trees cloned and plan to follow these instructions to have this test passing, to then move on to the next patches

Re: [RFC PATCH v5 0/3] Make eBPF programs output data to perf

2015-07-16 Thread Wangnan (F)
On 2015/7/17 10:31, He Kuang wrote: On 2015/7/14 21:35, Steven Rostedt wrote: On Mon, 13 Jul 2015 20:10:29 -0700 Alexei Starovoitov a...@plumgrid.com wrote: On 7/13/15 6:59 PM, He Kuang wrote: This version we output bpf trace events in a hex array, the results for three u64 integers in

Re: [RFC PATCH 3/6] bpf: Save the pointer to struct perf_event to map

2015-07-17 Thread Wangnan (F)
On 2015/7/17 19:06, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 06:43:33PM +0800, kaixu xia wrote: diff --git a/kernel/events/core.c b/kernel/events/core.c index e965cfa..c4e34b7 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8582,6 +8582,28 @@ void

Re: [RFC PATCH 5/6] bpf: Implement function bpf_read_pmu() that get the selected hardware PMU conuter

2015-07-17 Thread Wangnan (F)
On 2015/7/17 19:05, Peter Zijlstra wrote: On Fri, Jul 17, 2015 at 06:43:35PM +0800, kaixu xia wrote: The function bpf_read_pmu() can get the specific map key, convert the corresponding map value to the pointer to struct perf_event and return the Hardware PMU counter value. Thanks for having

Re: perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering events using eBPF programs

2015-07-21 Thread Wangnan (F)
) Thank you. On 2015/7/17 11:48, Arnaldo Carvalho de Melo wrote: On Jul 16, 2015 11:34 PM, Wangnan (F) wangn...@huawei.com mailto:wangn...@huawei.com wrote: On 2015/7/15 19:20, Arnaldo Carvalho de Melo wrote: Em Wed, Jul 15, 2015 at 06:49:40PM +0800, Wangnan (F) escreveu: On 2015/7/14 23:36

Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling

2015-10-21 Thread Wangnan (F)
On 2015/10/21 20:17, Peter Zijlstra wrote: On Wed, Oct 21, 2015 at 07:49:34PM +0800, Wangnan (F) wrote: If our task is sampling cycle events during a function is running, and if two cores start that function overlap: Time: ...A Core 0: sys_write

Re: [PATCH v2 net-next] bpf: fix bpf_perf_event_read() helper

2015-10-21 Thread Wangnan (F)
After applying this patch I'm unable to use perf passing perf_event again like this: # perf record -a -e evt=cycles -e ./test_config_map.c/maps.pmu_map.event=evt/ --exclude-perf ls With -v it output: ... adding perf_bpf_probe:func_write adding perf_bpf_probe:func_write to 0x367d6a0 add bpf

  1   2   3   4   5   6   7   8   9   10   >