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: a

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_ca

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) 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 parse this sentence

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 bette

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 ins

Re: [PATCH v5 3/6] perf record: Force enable --timestamp-filename when --switch-output is provided

2016-04-20 Thread Wangnan (F)
On 2016/4/20 15:59, Jiri Olsa wrote: On Mon, Apr 18, 2016 at 02:55:29PM +, Wang Nan wrote: Without this patch, the last output doesn't have timestamp appended if --timestamp-filename is not explicitly provided. For example: # perf record -a --switch-output & [1] 11224 # kill -s S

Re: [RFC PATCH 00/13] perf tools: Support uBPF script

2016-04-21 Thread Wangnan (F)
On 2016/4/21 6:06, Alexei Starovoitov wrote: On Wed, Apr 20, 2016 at 06:01:40PM +, Wang Nan wrote: This patch set allows to perf invoke some user space BPF scripts on some point. uBPF scripts and kernel BPF scripts reside in one BPF object. They communicate with each other with BPF maps. u

[BUG] arm64 kprobe: Allow probing at rodata

2016-04-07 Thread Wangnan (F)
Hi, When testing kprobe v12 we find a bug # echo 'p:kprobes/mykprobe1 ftrace_enable_fops' > /sys/kernel/debug/tracing/kprobe_events # echo 1 > /sys/kernel/debug/tracing/events/kprobes/mykprobe1/enable Unable to handle kernel paging request at virtual address d42003f0 pgd = ffc009f64000 [d

Re: [PATCH 17/19] perf tools: Build syscall table .c header from kernel's syscall_64.tbl

2016-04-07 Thread Wangnan (F)
On 2016/4/8 4:58, Arnaldo Carvalho de Melo wrote: From: Arnaldo Carvalho de Melo We used libaudit to map ids to syscall names and vice-versa, but that imposes a delay in supporting new syscalls, having to wait for libaudit to get those new syscalls on its tables. To remove that delay, for x8

Re: [PATCH] scripts: Fallback to KBUILD_OUTPUT if O is not specified

2016-04-08 Thread Wangnan (F)
On 2016/4/8 22:58, Arnaldo Carvalho de Melo wrote: Em Fri, Apr 08, 2016 at 11:14:09AM +0200, Thierry Reding escreveu: From: Thierry Reding The KBUILD_OUTPUT environment can be used to set the build directory as an alternative to passing the O variable on the command-line. This works with reg

Re: [PATCH 2/4] perf trace: Print content of bpf-output event

2016-04-08 Thread Wangnan (F)
Sorry. This patch should be squash into patch 1/4. The commit message is wrong. The main part of described patch is already accepted and merged: 1d6c940 perf trace: Print content of bpf-output event Thank you. On 2016/4/8 23:07, Wang Nan wrote: With this patch the contend of BPF output event i

Re: [PATCH 1/4] perf trace: Improve error message when receive non-tracepoint events

2016-04-08 Thread Wangnan (F)
On 2016/4/8 23:22, Arnaldo Carvalho de Melo wrote: Em Fri, Apr 08, 2016 at 03:07:22PM +, Wang Nan escreveu: Before this patch, strange error message is provided if passed a non-tracepoint event to 'perf trace': # perf trace -a --ev cycles sleep 1 Failed to set filter "common_pid != 2

Re: [PATCH 4/4] perf core: Add backward attribute to perf event

2016-04-05 Thread Wangnan (F)
On 2016/3/30 10:38, Wangnan (F) wrote: On 2016/3/30 10:28, Wangnan (F) wrote: On 2016/3/29 22:04, Peter Zijlstra wrote: On Mon, Mar 28, 2016 at 06:41:32AM +, Wang Nan wrote: Could you maybe write a perf/tests thingy for this so that _some_ userspace exists that exercises this new

Re: [PATCH 4/4] perf core: Add backward attribute to perf event

2016-04-07 Thread Wangnan (F)
On 2016/3/29 22:04, Peter Zijlstra wrote: On Mon, Mar 28, 2016 at 06:41:32AM +, Wang Nan wrote: Could you maybe write a perf/tests thingy for this so that _some_ userspace exists that exercises this new code? Yes. Please see: http://lkml.kernel.org/r/1460022180-61262-1-git-send-email-

Re: [PATCH v3 1/6] perf tools: Derive trigger class from auxtrace_snapshot

2016-04-17 Thread Wangnan (F)
On 2016/4/17 19:50, Jiri Olsa wrote: On Fri, Apr 15, 2016 at 06:20:15PM +, Wang Nan wrote: Create a new class named 'trigger' to model the state of a trigger and implement auxtrace_snapshot with it. auxtrace_record__snapshot_started and auxtrace_snapshot_err are absorbed. 'trigger' defin

Re: [PATCH v4 1/6] perf tools: Derive trigger class from auxtrace_snapshot

2016-04-18 Thread Wangnan (F)
On 2016/4/18 21:45, Jiri Olsa wrote: On Mon, Apr 18, 2016 at 06:32:08AM +, Wang Nan wrote: Use 'trigger' to model operations which need to be executed when an event (a signal, for example) is observed. States and transits: OFF--(on)--> READY --(toggle)--> TOGGLED --(process)--> PROCESS

Re: [PATCH v4 1/6] perf tools: Derive trigger class from auxtrace_snapshot

2016-04-18 Thread Wangnan (F)
On 2016/4/18 22:29, Jiri Olsa wrote: On Mon, Apr 18, 2016 at 10:20:23PM +0800, Wangnan (F) wrote: On 2016/4/18 21:45, Jiri Olsa wrote: On Mon, Apr 18, 2016 at 06:32:08AM +, Wang Nan wrote: Use 'trigger' to model operations which need to be executed when an event (a signal, f

Re: [RFC] perf probe: Fix offline module name missmatch issue

2016-04-26 Thread Wangnan (F)
On 2016/4/26 16:56, Ravi Bangoria wrote: Thanks Masami for reviewing. Please find my replies to your comment. On Tuesday 26 April 2016 02:54 AM, Masami Hiramatsu wrote: Hi Ravi, On Mon, 25 Apr 2016 16:08:27 +0530 Ravi Bangoria wrote: Perf can add a probe on kernel module which has not be

Re: [PATCH 1/4] perf core: Introduce new ioctl options to pause and resume ring buffer

2016-03-29 Thread Wangnan (F)
On 2016/3/29 20:54, Peter Zijlstra wrote: On Mon, Mar 28, 2016 at 06:41:29AM +, Wang Nan wrote: Add new ioctl() to pause/resume ring-buffer output. In some situations we want to read from ring buffer only when we ensure nothing can write to the ring buffer during reading. Without this pat

Re: [PATCH 4/4] perf core: Add backward attribute to perf event

2016-03-29 Thread Wangnan (F)
On 2016/3/29 22:04, Peter Zijlstra wrote: On Mon, Mar 28, 2016 at 06:41:32AM +, Wang Nan wrote: Could you maybe write a perf/tests thingy for this so that _some_ userspace exists that exercises this new code? int perf_output_begin(struct perf_output_handle *handle,

Re: [PATCH 4/4] perf core: Add backward attribute to perf event

2016-03-29 Thread Wangnan (F)
On 2016/3/30 10:28, Wangnan (F) wrote: On 2016/3/29 22:04, Peter Zijlstra wrote: On Mon, Mar 28, 2016 at 06:41:32AM +, Wang Nan wrote: Could you maybe write a perf/tests thingy for this so that _some_ userspace exists that exercises this new code? int perf_output_begin(struct

Re: perf trace + BPF

2016-04-01 Thread Wangnan (F)
On 2016/4/1 2:08, Arnaldo Carvalho de Melo wrote: Hi Wang, Trying to get back at working with 'perf trace' + BPF and I'm noticing that the perf_event_attr->sample_type for the BPF events are different than the ones for the raw_syscalls:sys_{enter,exit} or to other tracepoint events we

Re: [PATCH tip] perf core: Add backward attribute to perf event

2016-04-12 Thread Wangnan (F)
Hi Peter, When would you consider collection this patch? You have collected all dependencies, this is the last patch to enable the backward attribute. I have already posted a 'perf test' testcase for it so there will be some usable user space code. I will start posting my perf side code again

Re: [PATCH 1/4] perf tools: Pass available CPU number to clang compiler

2015-11-04 Thread Wangnan (F)
On 2015/11/5 6:09, Arnaldo Carvalho de Melo wrote: Em Wed, Nov 04, 2015 at 11:20:04AM +, Wang Nan escreveu: This patch introduces a new macro "__NR_CPUS__" to perf's embedded clang compiler, which represent the available CPU counters in this available "CPU counters"? ENOPARSE :-) Your c

Re: [PATCH v2 3/4] bpf tools: Improve libbpf error reporting

2015-11-04 Thread Wangnan (F)
On 2015/11/5 6:01, Arnaldo Carvalho de Melo wrote: Em Wed, Nov 04, 2015 at 02:25:58AM +, Wang Nan escreveu: In this patch, a series libbpf specific error numbers and libbpf_strerror() are created to help reporting error to caller. Functions are updated to pass correct error number through

Re: [PATCH v2 3/4] bpf tools: Improve libbpf error reporting

2015-11-04 Thread Wangnan (F)
On 2015/11/5 9:48, Wangnan (F) wrote: On 2015/11/5 6:01, Arnaldo Carvalho de Melo wrote: Em Wed, Nov 04, 2015 at 02:25:58AM +, Wang Nan escreveu: In this patch, a series libbpf specific error numbers and libbpf_strerror() are created to help reporting error to caller. Functions are

Re: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success

2015-11-06 Thread Wangnan (F)
On 2015/11/6 15:12, 平松雅巳 / HIRAMATU,MASAMI wrote: From: a...@kernel.org [mailto:a...@kernel.org] Em Thu, Nov 05, 2015 at 02:08:48PM +, 平松雅巳 / HIRAMATU,MASAMI escreveu: From: Wang Nan [mailto:wangn...@huawei.com] It is possible that find_perf_probe_point_from_map() fails to find symbol bu

Re: [PATCH 2/2] perf tools: Fix find_perf_probe_point_from_map() which incorrectly returns success

2015-11-06 Thread Wangnan (F)
On 2015/11/6 16:30, Wangnan (F) wrote: On 2015/11/6 15:12, 平松雅巳 / HIRAMATU,MASAMI wrote: From: a...@kernel.org [mailto:a...@kernel.org] Em Thu, Nov 05, 2015 at 02:08:48PM +, 平松雅巳 / HIRAMATU,MASAMI escreveu: From: Wang Nan [mailto:wangn...@huawei.com] [SNIP] Ah, finally I got what

Re: [PATCH] perf symbols/KCORE: Rebuild rbtree when adjusting symbols for kcore

2015-11-06 Thread Wangnan (F)
On 2015/11/6 21:19, Arnaldo Carvalho de Melo wrote: Em Fri, Nov 06, 2015 at 09:46:12AM +, Wang Nan escreveu: In dso__split_kallsyms_for_kcore(), current code adjusts symbol's address but only reinsert it into rbtree if the symbol belongs to another map. However, the expression for adjustin

Re: [PATCH 10/31] perf test: Enforce LLVM test for BPF test

2015-10-30 Thread Wangnan (F)
On 2015/10/30 6:37, Arnaldo Carvalho de Melo wrote: Em Wed, Oct 14, 2015 at 12:41:21PM +, Wang Nan escreveu: This patch replaces the original toy BPF program with previous introduced bpf-script-example.c. Dynamically embedded it into 'llvm-src.c'. The newly introduced BPF program attaches

Re: [PATCH 13/31] bpf tools: Load a program with different instances using preprocessor

2015-10-31 Thread Wangnan (F)
On 2015/10/30 6:44, Arnaldo Carvalho de Melo wrote: Em Wed, Oct 14, 2015 at 12:41:24PM +, Wang Nan escreveu: In this patch, caller of libbpf is able to control the loaded programs by installing a preprocessor callback for a BPF program. With preprocessor, different instances can be created

Re: [RFC PATCH 5/7] perf tools: Support setting different slots in a BPF map separately

2015-11-22 Thread Wangnan (F)
On 2015/11/20 23:34, Arnaldo Carvalho de Melo wrote: Em Fri, Nov 20, 2015 at 09:25:36PM +0800, Wangnan (F) escreveu: + case BPF_MAP_PRIV_KEY_INDICS: + for (i = 0; i < priv->key.indics.nr_indics; i++) { + u64 _idx

Re: [RFC PATCH 5/7] perf tools: Support setting different slots in a BPF map separately

2015-11-22 Thread Wangnan (F)
On 2015/11/23 10:01, Wangnan (F) wrote: On 2015/11/20 23:34, Arnaldo Carvalho de Melo wrote: Em Fri, Nov 20, 2015 at 09:25:36PM +0800, Wangnan (F) escreveu: +case BPF_MAP_PRIV_KEY_INDICS: +for (i = 0; i < priv->key.indics.nr_indics; i++) { +u6

Re: [RFC PATCH 1/7] perf tools: Add API to config maps in bpf object

2015-11-23 Thread Wangnan (F)
On 2015/10/17 18:48, Wang Nan wrote: bpf__config_obj() is introduced as a core API to config BPF object after loading. One configuration option of maps is introduced. After this patch BPF object can accept configuration like: maps.my_map.value=1234 This patch is more complex than the work i

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 prob

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 will

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 chan

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 0/5] Make eBPF programs output data to perf event

2015-06-30 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 someth

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 chec

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 *per

Re: [PATCH 19/27] perf tools: Introduce regs_query_register_offset() for x86

2015-09-14 Thread Wangnan (F)
On 2015/9/15 5:37, Arnaldo Carvalho de Melo wrote: Em Sun, Sep 06, 2015 at 07:13:35AM +, Wang Nan escreveu: regs_query_register_offset() is a helper function which converts register name like "%rax" to offset of a register in 'struct pt_regs', which is required by BPF prologue generator. S

Re: [PATCH v2] perf probe: Verify parameters for two functions

2015-11-10 Thread Wangnan (F)
Hi Arnaldo, Could you please collect this patch to your tree? It fixes a segfault when only one of kprobe and uprobe is enabled. Thank you. On 2015/11/6 17:50, Wang Nan wrote: On kernel with only one of CONFIG_KPROBE_EVENTS and CONFIG_UPROBE_EVENTS enabled, 'perf probe -d' causes segfault beca

Re: [PATCH] perf symbols/KCORE: Rebuild rbtree when adjusting symbols for kcore

2015-11-10 Thread Wangnan (F)
On 2015/11/6 21:59, Adrian Hunter wrote: On 06/11/15 15:19, Arnaldo Carvalho de Melo wrote: Em Fri, Nov 06, 2015 at 09:46:12AM +, Wang Nan escreveu: In dso__split_kallsyms_for_kcore(), current code adjusts symbol's address but only reinsert it into rbtree if the symbol belongs to another

Re: [PATCH 05/12] perf tools: Allow BPF program config probing options

2015-11-16 Thread Wangnan (F)
On 2015/11/13 23:46, Arnaldo Carvalho de Melo wrote: Em Fri, Nov 13, 2015 at 12:29:14PM +, Wang Nan escreveu: By extending the syntax of BPF object section names, this patch allows user to config probing options like what they can do in 'perf probe'. Test result: For following BPF file b

Re: [PATCH 12/13] perf test: Test BPF prologue

2015-11-16 Thread Wangnan (F)
On 2015/11/17 9:29, Arnaldo Carvalho de Melo wrote: Em Mon, Nov 16, 2015 at 12:10:14PM +, Wang Nan escreveu: This patch introduces a new BPF script to test BPF prologue. The new script probes at null_lseek, which is the function pointer when we try to lseek on '/dev/null'. null_lseek is c

Re: [PATCH 13/13] perf tools: Use same BPF program if arguments are identical

2015-11-16 Thread Wangnan (F)
On 2015/11/16 20:10, Wang Nan wrote: This patch allows creating only one BPF program for different 'probe_trace_event'(tev) generated by one 'perf_probe_event'(pev), if their prologues are identical. This is done by comparing argument list of different tev, and maps type of prologue and tev us

Re: [PATCH 07/13] bpf tools: Load a program with different instances using preprocessor

2015-11-16 Thread Wangnan (F)
On 2015/11/17 3:02, Arnaldo Carvalho de Melo wrote: Em Mon, Nov 16, 2015 at 12:10:09PM +, Wang Nan escreveu: This patch is a preparation for BPF prologue support which allows generating a series of BPF bytecode for fetching kernel data before calling program code. With the newly introduced

Re: [PATCH 12/13] perf test: Test BPF prologue

2015-11-16 Thread Wangnan (F)
On 2015/11/17 9:29, Arnaldo Carvalho de Melo wrote: Em Mon, Nov 16, 2015 at 12:10:14PM +, Wang Nan escreveu: This patch introduces a new BPF script to test BPF prologue. The new script probes at null_lseek, which is the function pointer when we try to lseek on '/dev/null'. null_lseek is c

Re: [PATCH 12/13] perf test: Test BPF prologue

2015-11-17 Thread Wangnan (F)
Hi Arnaldo, On 2015/11/17 9:29, Arnaldo Carvalho de Melo wrote: [SNIP] I've pushed everything to my perf/ebpf branch, please let me know if what is there is acceptable, then it will be up to Ingo to decide where to put this, if in perf/urgent for this merge window, or in perf/core, for the next

Re: [PATCH 2/5] perf tools: Mute libbpf when '-v' not set

2015-11-03 Thread Wangnan (F)
On 2015/11/3 18:44, Wang Nan wrote: According to [1], libbpf should be muted. This patch reset info and warning message level to ensure libbpf doesn't output anything even if error happened. [1] http://lkml.kernel.org/r/20151020151255.gf5...@kernel.org Sorry... Signed-off-by: Wang Nan Cc:

Re: [PATCH 10/31] perf test: Enforce LLVM test for BPF test

2015-11-03 Thread Wangnan (F)
On 2015/11/4 2:24, Arnaldo Carvalho de Melo wrote: Em Thu, Oct 15, 2015 at 07:58:38PM +0800, Wangnan (F) escreveu: +void test__llvm_prepare(void) +{ + p_test_llvm__bpf_result = mmap(NULL, SHARED_BUF_INIT_SIZE, + PROT_READ | PROT_WRITE

Re: [PATCH 0/5] perf bpf: Improve error code delivering and output

2015-11-03 Thread Wangnan (F)
On 2015/11/3 23:43, Arnaldo Carvalho de Melo wrote: Em Tue, Nov 03, 2015 at 10:44:41AM +, Wang Nan escreveu: This patchset is based on tip/core. Arnaldo found some confusing error reports when reviewing BPF related patches. This patch set makes some changes: Thanks for working on this!

Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test case

2016-12-05 Thread Wangnan (F)
On 2016/12/6 5:48, Arnaldo Carvalho de Melo wrote: Em Mon, Dec 05, 2016 at 07:02:48PM -0200, Arnaldo Carvalho de Melo escreveu: Em Mon, Dec 05, 2016 at 08:51:01AM -0800, Alexei Starovoitov escreveu: yeah. it's kinda high. I'm guessing rpm llvm libs are in debug mode. Try llvm-config --build-m

Re: [PATCH v4 01/18] perf build: Check LLVM version in feature check

2016-12-05 Thread Wangnan (F)
On 2016/12/6 15:13, Wang Nan wrote: Cancel builtin llvm and clang support when LLVM version is less than 3.9.0: following commits uses newer API. Since Clang/LLVM's API is not guaranteed to be stable, add a test-llvm-version.cpp feature checker, issue warning if LLVM found in compiling environ

Re: [PATCH perf/core 1/6] tools lib bpf: Fix map offsets in relocation

2017-01-18 Thread Wangnan (F)
On 2017/1/19 7:57, Joe Stringer wrote: Commit 4708bbda5cb2 ("tools lib bpf: Fix maps resolution") attempted to fix map resolution by identifying the number of symbols that point to maps, and using this number to resolve each of the maps. However, during relocation the original definition of th

Re: [PATCH perf/core 2/6] tools lib bpf: Fix grammar in map_idx warning

2017-01-19 Thread Wangnan (F)
On 2017/1/19 7:57, Joe Stringer wrote: "Larger" is the comparative adjective form of "large". Signed-off-by: Joe Stringer --- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 350ee4c59f85..653b1

Re: [PATCH perf/core 6/6] tools lib bpf: Add bpf_object__pin()

2017-01-19 Thread Wangnan (F)
On 2017/1/19 7:57, Joe Stringer wrote: Add a new API to pin a BPF object to the filesystem. The user can specify a subdirectory under the BPF filesystem to pin these programs. For example, with the subdirectory 'foo', programs and maps are pinned: /sys/fs/bpf/foo/progs/PROG_NAME /sys/fs/bpf/fo

Re: [PATCH perf/core 0/6] Libbpf improvements

2017-01-19 Thread Wangnan (F)
On 2017/1/19 7:57, Joe Stringer wrote: Patch 1 fixes an issue when using drastically different BPF map definitions inside ELFs from a client using libbpf, vs the map definition libbpf uses. Patch 2 is a trivial typo fix. Patches 3-5 add some simple, useful helper functions for setting prog ty

Re: [PATCHv2 perf/core 5/7] tools lib bpf: Add bpf_program__pin()

2017-01-24 Thread Wangnan (F)
On 2017/1/23 9:11, Joe Stringer wrote: Add a new API to pin a BPF program to the filesystem. The user can specify the path full path within a BPF filesystem to pin the program. Programs with multiple instances are pinned as 'foo', 'foo_1', 'foo_2', and so on. Signed-off-by: Joe Stringer --- v

Re: [PATCHv2 perf/core 5/7] tools lib bpf: Add bpf_program__pin()

2017-01-24 Thread Wangnan (F)
On 2017/1/25 9:04, Wangnan (F) wrote: On 2017/1/23 9:11, Joe Stringer wrote: Add a new API to pin a BPF program to the filesystem. The user can specify the path full path within a BPF filesystem to pin the program. Programs with multiple instances are pinned as 'foo', 'foo_1

Re: [PATCHv2 perf/core 5/7] tools lib bpf: Add bpf_program__pin()

2017-01-24 Thread Wangnan (F)
On 2017/1/25 9:16, Joe Stringer wrote: On 24 January 2017 at 17:06, Wangnan (F) wrote: On 2017/1/25 9:04, Wangnan (F) wrote: On 2017/1/23 9:11, Joe Stringer wrote: Add a new API to pin a BPF program to the filesystem. The user can specify the path full path within a BPF filesystem to

Re: [PATCH v9 5/8] perf record: Toggle overwrite ring buffer for reading

2016-06-22 Thread Wangnan (F)
On 2016/6/22 22:33, Nilay Vaish wrote: On 22 June 2016 at 04:08, Wang Nan wrote: @@ -549,17 +573,72 @@ static struct perf_event_header finished_round_event = { .type = PERF_RECORD_FINISHED_ROUND, }; -static int record__mmap_read_all(struct record *rec) +static void +record__toggle

Re: [PATCH v9 1/8] perf evlist: Introduce aux evlist

2016-06-22 Thread Wangnan (F)
On 2016/6/22 21:40, Arnaldo Carvalho de Melo wrote: Em Wed, Jun 22, 2016 at 08:17:02AM -0500, Nilay Vaish escreveu: On 22 June 2016 at 04:08, Wang Nan wrote: +struct perf_evlist *perf_evlist__new_aux(struct perf_evlist *parent) +{ + struct perf_evlist *evlist; + + if (perf_evlist

Re: [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found

2016-06-22 Thread Wangnan (F)
Hi, This patch fixes a real crash problem when we do 'perf report' on an arm64 platform with arm32 program. It is introduced by commit f9b2bdf228 ("perf tools: Find vdso with the consider of cross-platform"). From dmesg report, perf crashes in dso__type() because dso is NULL. Still don't know wh

Re: [PATCH v13 1/8] perf tools: Drop redundant evsel->overwrite indicator

2016-07-06 Thread Wangnan (F)
On 2016/7/6 18:53, Jiri Olsa wrote: On Mon, Jul 04, 2016 at 06:20:02AM +, Wang Nan wrote: SNIP diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 0fea724..3abe519 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1359,6 +1359,9 @@ static int __perf_

Re: [PATCH v13 5/8] perf record: Read from overwritable ring buffer

2016-07-06 Thread Wangnan (F)
On 2016/7/6 19:38, Jiri Olsa wrote: On Mon, Jul 04, 2016 at 06:20:06AM +, Wang Nan wrote: SNIP +static void +record__toggle_overwrite_evsels(struct record *rec, + enum overwrite_evt_state state) +{ + struct perf_evlist *evlist = rec->overwrite_evlist;

Re: [PATCH v13 2/8] perf evlist: Introduce aux evlist

2016-07-06 Thread Wangnan (F)
On 2016/7/6 19:36, Jiri Olsa wrote: On Mon, Jul 04, 2016 at 06:20:03AM +, Wang Nan wrote: SNIP +struct perf_evlist *perf_evlist__new_aux(struct perf_evlist *parent) +{ + struct perf_evlist *evlist; + + if (perf_evlist__is_aux(parent)) { + pr_err("Internal error:

Re: [PATCH v13 5/8] perf record: Read from overwritable ring buffer

2016-07-06 Thread Wangnan (F)
On 2016/7/6 20:34, Jiri Olsa wrote: On Wed, Jul 06, 2016 at 08:03:28PM +0800, Wangnan (F) wrote: On 2016/7/6 19:38, Jiri Olsa wrote: On Mon, Jul 04, 2016 at 06:20:06AM +, Wang Nan wrote: SNIP +static void +record__toggle_overwrite_evsels(struct record *rec

Re: perf bpf examples

2016-07-07 Thread Wangnan (F)
On 2016/7/8 1:58, Brendan Gregg wrote: On Thu, Jul 7, 2016 at 10:54 AM, Brendan Gregg wrote: On Wed, Jul 6, 2016 at 6:49 PM, Wangnan (F) wrote: On 2016/7/7 4:29, Brendan Gregg wrote: G'Day, Are perf bpf examples shared anywhere? I've seen many posted to lkml (by Wang Nan),

Re: perf bpf examples

2016-07-08 Thread Wangnan (F)
On 2016/7/8 15:57, Brendan Gregg wrote: On Thu, Jul 7, 2016 at 9:18 PM, Wangnan (F) wrote: On 2016/7/8 1:58, Brendan Gregg wrote: On Thu, Jul 7, 2016 at 10:54 AM, Brendan Gregg wrote: On Wed, Jul 6, 2016 at 6:49 PM, Wangnan (F) wrote: [...] ... Also, has anyone looked into perf

Re: [PATCH v15 03/12] perf tools: Update perf evlist mmap related APIs and helpers

2016-07-13 Thread Wangnan (F)
On 2016/7/13 22:06, Jiri Olsa wrote: On Tue, Jul 12, 2016 at 10:00:03AM +, Wang Nan wrote: SNIP -union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist, int idx) +union perf_event *perf_mmap__read_forward(struct perf_mmap *md, bool overwrite) { - struct perf

Re: [PATCH] tools lib bpf: Use official ELF e_machine value

2016-07-25 Thread Wangnan (F)
Hi Arnaldo, Please don't forget this patch. Thank you. On 2016/7/19 5:37, Alexei Starovoitov wrote: On Mon, Jul 18, 2016 at 06:01:08AM +, Wang Nan wrote: New LLVM will issue newly assigned EM_BPF machine code. The new code will be propogated to glibc and libelf. This patch introduces the

Re: 'perf test backward' failing with older kernels, should Skip

2016-06-30 Thread Wangnan (F)
On 2016/7/1 5:00, Arnaldo Carvalho de Melo wrote: Hi Wang, I booted a machine with the f24 distro kernel and the backward ring buffer test started FAILing, when it should've noticed that the kernel doesn't support it and Skip instead: [root@jouet ~]# perf test -v backward 45: Test bac

Re: [PATCH 7/8] tools lib bpf: fix maps resolution

2016-11-07 Thread Wangnan (F)
Hi Eric, Are you still working in this patch set? Now I know why maps section is not a simple array from a patch set from Joe Stringer: https://www.mail-archive.com/netdev@vger.kernel.org/msg135088.html So I think this patch is really useful. Are you going to resend the whole patch set? If no

Re: [PATCH 7/8] tools lib bpf: fix maps resolution

2016-11-08 Thread Wangnan (F)
Hi Eric, During testing this patch I find a segfault, please see inline comment. In addition, since both the BPF map array and map names should be done after symbol table is collected, merging bpf_object__init_maps and bpf_object__init_maps_name would be a good practice, making code simpler. So

Re: [PATCHv2 perf/core 1/2] tools lib bpf: Sync {tools,}/include/uapi/linux/bpf.h

2016-11-16 Thread Wangnan (F)
On 2016/11/17 1:43, Joe Stringer wrote: The tools version of this header is out of date; update it to the latest version from the kernel headers. Signed-off-by: Joe Stringer --- v2: No change. --- tools/include/uapi/linux/bpf.h | 51 ++ 1 file change

Re: [PATCHv2 perf/core 2/2] tools lib bpf: Sync with samples/bpf/libbpf

2016-11-16 Thread Wangnan (F)
I'm also working on improving bpf.c. Please have a look at: https://lkml.org/lkml/2016/11/14/1078 Since bpf.c is simple, I think we can add more functions and fixes gradually, instead of a full copy. See my inline comment below. On 2016/11/17 1:43, Joe Stringer wrote: Extend the tools/ versio

Re: [PATCHv2 perf/core 2/2] tools lib bpf: Sync with samples/bpf/libbpf

2016-11-16 Thread Wangnan (F)
On 2016/11/17 10:46, Joe Stringer wrote: On 16 November 2016 at 18:10, Wangnan (F) wrote: I'm also working on improving bpf.c. Please have a look at: https://lkml.org/lkml/2016/11/14/1078 Since bpf.c is simple, I think we can add more functions and fixes gradually, instead of a full

Re: [PATCH 05/34] tools lib bpf: Add missing bpf map functions

2016-11-16 Thread Wangnan (F)
On 2016/11/15 12:05, Wang Nan wrote: Add more BPF map operations to libbpf. Signed-off-by: Wang Nan Cc: Alexei Starovoitov Cc: Arnaldo Carvalho de Melo Cc: Li Zefan --- tools/lib/bpf/bpf.c | 56 + tools/lib/bpf/bpf.h | 7 +++ 2 f

Re: [PATCHv2 perf/core 2/2] tools lib bpf: Sync with samples/bpf/libbpf

2016-11-16 Thread Wangnan (F)
On 2016/11/17 10:46, Joe Stringer wrote: On 16 November 2016 at 18:10, Wangnan (F) wrote: I'm also working on improving bpf.c. Please have a look at: https://lkml.org/lkml/2016/11/14/1078 Since bpf.c is simple, I think we can add more functions and fixes gradually, instead of a full

Re: [PATCH v2 00/18] perf clang: Support compiling BPF script on the fly

2016-10-07 Thread Wangnan (F)
On 2016/10/6 7:20, Arnaldo Carvalho de Melo wrote: Em Mon, Sep 26, 2016 at 07:26:54AM +, Wang Nan escreveu: This patch add builtin clang, allow perf compile BPF scripts on the fly. This is the first step to implement what I announced at LinuxCon 2016 NA: Ok, so I refreshed this series to

Re: [PATCH 1/3] perf, tools: Handle events including .c and .o

2016-10-07 Thread Wangnan (F)
On 2016/10/7 4:18, Arnaldo Carvalho de Melo wrote: Em Wed, Oct 05, 2016 at 12:47:10PM -0700, Andi Kleen escreveu: From: Andi Kleen This is a generic bug fix, but it helps with Sukadev's JSON event tree where such events can happen. Any event inclduing a .c/.o/.bpf currently triggers BPF com

Re: [PATCH 00/34] perf clang: Builtin clang and perfhook support

2016-11-14 Thread Wangnan (F)
On 2016/11/15 12:05, Wang Nan wrote: $ sudo -s # ulimit -l unlimited # perf record -e ./count_syscalls.c echo "Haha" Start count, perfpid=25209 Haha [ perf record: Woken up 1 times to write data ] syscall 8count: 6 syscall 11 count: 1 syscall 4count: 6 sy

Re: [PATCH 00/34] perf clang: Builtin clang and perfhook support

2016-11-14 Thread Wangnan (F)
On 2016/11/15 12:57, Alexei Starovoitov wrote: On Mon, Nov 14, 2016 at 8:05 PM, Wang Nan wrote: This is version 2 of perf builtin clang patch series. Compare to v1, add an exciting feature: jit compiling perf hook functions. This features allows script writer report result through BPF map in

Re: [PATCH 00/34] perf clang: Builtin clang and perfhook support

2016-11-14 Thread Wangnan (F)
On 2016/11/15 13:21, Alexei Starovoitov wrote: On Mon, Nov 14, 2016 at 9:03 PM, Wangnan (F) wrote: On 2016/11/15 12:57, Alexei Starovoitov wrote: On Mon, Nov 14, 2016 at 8:05 PM, Wang Nan wrote: This is version 2 of perf builtin clang patch series. Compare to v1, add an exciting feature

Re: [PATCH 1/5] perf core: Introduce new ioctl options to pause and resume ring buffer

2016-10-21 Thread Wangnan (F)
On 2016/10/21 15:06, Michael Kerrisk (man-pages) wrote: Hello Wangnan, The patch below seems to have landed in Linux 4.7, commit 86e7972f690c1017fd086cdfe53d8524e68c661c Could you draft a man-pages patch for this interface change, please? Or, failing that, a plain-text description that we can

Re: [PATCH 2/2] perf_event_open.2: Document write_backward

2016-10-23 Thread Wangnan (F)
On 2016/10/22 18:05, Michael Kerrisk (man-pages) wrote: On 10/21/2016 11:25 PM, Vince Weaver wrote: On Fri, 21 Oct 2016, Wang Nan wrote: context_switch : 1, /* context switch data */ - - __reserved_1 : 37; + write_backward : 1, /* Write ring buffer from en

Re: [PATCH v3 14/30] perf clang: Support compile IR to BPF object and add testcase

2016-11-27 Thread Wangnan (F)
On 2016/11/27 1:25, Alexei Starovoitov wrote: On Sat, Nov 26, 2016 at 07:03:38AM +, Wang Nan wrote: getBPFObjectFromModule() is introduced to compile LLVM IR(Module) to BPF object. Add new testcase for it. Test result: $ ./buildperf/perf test -v clang 51: Test builtin clang support

Re: [PATCH v3 20/30] perf clang jit: add PerfModule::doJIT to JIT perfhook functions

2016-11-27 Thread Wangnan (F)
On 2016/11/27 1:29, Alexei Starovoitov wrote: On Sat, Nov 26, 2016 at 07:03:44AM +, Wang Nan wrote: PerfModule::doJIT JIT compile perfhook functions and saves result into a map. Add a test case for it. At this stage perfhook functions can do no useful things because they can't invoke exte

Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test case

2016-11-27 Thread Wangnan (F)
On 2016/11/27 1:17, Alexei Starovoitov wrote: On Sat, Nov 26, 2016 at 07:03:34AM +, Wang Nan wrote: Add basic clang support in clang.cpp and test__clang() testcase. The first testcase checks if builtin clang is able to generate LLVM IR. tests/clang.c is a proxy. Real testcase resides in u

Re: [PATCH v3 14/30] perf clang: Support compile IR to BPF object and add testcase

2016-11-28 Thread Wangnan (F)
On 2016/11/28 14:32, Wangnan (F) wrote: On 2016/11/27 1:25, Alexei Starovoitov wrote: On Sat, Nov 26, 2016 at 07:03:38AM +, Wang Nan wrote: getBPFObjectFromModule() is introduced to compile LLVM IR(Module) to BPF object. Add new testcase for it. Test result: $ ./buildperf/perf test

Re: [PATCH 0/7] perf tools: Add switch-output size and time threshold options

2017-01-03 Thread Wangnan (F)
On 2017/1/3 16:19, Jiri Olsa wrote: hi, adding a way to configure switch data output for size and time, like: $ sudo perf record -e 'sched:*' --switch-output=10M -avg callchain: type FP switch-output with 10M size threshold mmap size 528384B [ perf record: dump data: Woken up 37

coresight: Problem caused by resetting enable_sink

2016-12-26 Thread Wangnan (F)
Hi Mathieu, I meet problems caused by your commit d52c9750f150 ('coresight: reset "enable_sink" flag when need be'). Not only the one I posted in the previous patch. My use case is a simple 'perf record -e cs_etm// ls'. It works properly before this commit, and failed when allocating aux buffer

Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test case

2016-12-04 Thread Wangnan (F)
On 2016/12/2 23:44, Arnaldo Carvalho de Melo wrote: Em Sat, Nov 26, 2016 at 07:03:34AM +, Wang Nan escreveu: Add basic clang support in clang.cpp and test__clang() testcase. The first testcase checks if builtin clang is able to generate LLVM IR. tests/clang.c is a proxy. Real testcase res

Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test case

2016-12-04 Thread Wangnan (F)
On 2016/12/5 10:36, Wangnan (F) wrote: On 2016/12/2 23:44, Arnaldo Carvalho de Melo wrote: Em Sat, Nov 26, 2016 at 07:03:34AM +, Wang Nan escreveu: Add basic clang support in clang.cpp and test__clang() testcase. The first testcase checks if builtin clang is able to generate LLVM IR

Re: [PATCHv3 perf/core 2/7] tools lib bpf: use __u32 from linux/types.h

2016-12-08 Thread Wangnan (F)
On 2016/12/9 10:46, Joe Stringer wrote: Fixes the following issue when building without access to 'u32' type: ./tools/lib/bpf/bpf.h:27:23: error: unknown type name ‘u32’ Signed-off-by: Joe Stringer --- v3: Split from "tools lib bpf: Sync with samples/bpf/libbpf" --- tools/lib/bpf/bpf.c | 4

Re: [PATCHv3 perf/core 3/7] tools lib bpf: Add flags to bpf_create_map()

2016-12-08 Thread Wangnan (F)
On 2016/12/9 10:46, Joe Stringer wrote: The map_flags argument to bpf_create_map() was previously not exposed. By exposing it, users can access flags such as whether or not to preallocate the map. Signed-off-by: Joe Stringer Please mention commit 6c90598174322b029e40dd84a4eb01f56afe in

Re: [PATCHv3 perf/core 5/7] samples/bpf: Switch over to libbpf

2016-12-08 Thread Wangnan (F)
On 2016/12/9 10:46, Joe Stringer wrote: Now that libbpf under tools/lib/bpf/* is synced with the version from samples/bpf, we can get rid most of the libbpf library here. Signed-off-by: Joe Stringer --- v3: First post. --- samples/bpf/Makefile | 60 +- samples/bp

Re: [PATCHv3 perf/core 5/7] samples/bpf: Switch over to libbpf

2016-12-08 Thread Wangnan (F)
On 2016/12/9 13:04, Wangnan (F) wrote: On 2016/12/9 10:46, Joe Stringer wrote: [SNIP] diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index 62d89d50fcbd..616bd55f3be8 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -149,6 +149,8 @@ CMD_TARGETS

<    1   2   3   4   5   6   >