[bug] wrong result of android callchain

2016-01-05 Thread He Kuang
I found a wrong result of aarch64 callchain when using perf script on a android phone. Here's the callchain record fragment from the output of perf script: init 369 [002] 339.970607: raw_syscalls:sys_enter: NR 22 (b, 7fd9e360a0, 10, , 0, 8) ...

[RFC PATCH v2 00/15] perf bpf: Probing with local variable

2015-05-24 Thread He Kuang
4 regs(R2,R3,R4,R5) for variable passing according to bpf calling convention. - Move bpf prologue code to tools/lib/bpf. - Sample codes in patch instead of comments. - Fix code style problems mentioned by Alexei and Masami. Thanks. He Kuang (15): perf tools: Add lib/bpf

[RFC PATCH v2 01/15] perf tools: Add lib/bpf to cscope target list

2015-05-24 Thread He Kuang
Add lib/bpf folder to cscope list. Signed-off-by: He Kuang --- tools/perf/Makefile.perf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index c69821c..7b77d14 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf

[RFC PATCH v2 14/15] samples/bpf: Add sample for testing bpf fetch args

2015-05-24 Thread He Kuang
-1176 [000] d.h. 87778.533049: : submit_bio count=12288, rw=1, bio=88007c237a80 Signed-off-by: He Kuang --- samples/bpf/Makefile| 1 + samples/bpf/sample_bpf_fetch_args.c | 62 + 2 files changed, 63 insertions(+) create mode 100644 samples

[RFC PATCH v2 15/15] samples/bpf: Add sample for no-debuginfo case

2015-05-24 Thread He Kuang
-off-by: He Kuang --- samples/bpf/Makefile | 1 + samples/bpf/sample_bpf_fetch_args_without_debug.c | 49 +++ 2 files changed, 50 insertions(+) create mode 100644 samples/bpf/sample_bpf_fetch_args_without_debug.c diff --git a/samples/bpf/Makefile b

[RFC PATCH v2 13/15] perf bpf: Combine bpf prologue and bpf prog

2015-05-24 Thread He Kuang
Combine bpf prologue before attaching bpf progs to perf probe event. If prologue is generated, it will be pasted in front of the original bpf prog. Signed-off-by: He Kuang --- tools/lib/bpf/libbpf.c | 27 +++ tools/lib/bpf/libbpf.h | 2 ++ tools/perf/util

Re: [PATCH v3 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins

2015-05-24 Thread He Kuang
hi, jirka ping.. Thanks. On 2015/5/15 16:01, He Kuang wrote: Traceevent plugins need dynamic symbols exported from libtraceevent.a, otherwise a dlopen error will occur during plugins loading. This patch uses dynamic-list-file to export dynamic symbols which will be used in plugins to perf

[RFC PATCH v2 08/15] bpf tools: Fetch calling regs to bpf arglist

2015-05-24 Thread He Kuang
For generating bpf prologue which fetches function formal parameters when debuginfo is not provided. Signed-off-by: He Kuang --- tools/lib/bpf/gen_prologue.c | 19 +++ tools/lib/bpf/libbpf.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/tools/lib/bpf

[RFC PATCH v2 06/15] bpf tools: Add headers for generating bpf bytecode

2015-05-24 Thread He Kuang
Copying bpf instruction macros from sample/bpf/libbpf.h, and register alias from include/linux/ftrace.h, so we can generating bpf bytecode by using these macros. Signed-off-by: He Kuang --- tools/lib/bpf/bpf.h | 187 1 file changed, 187

[RFC PATCH v2 12/15] perf bpf: Generate bpf prologue without debuginfo

2015-05-24 Thread He Kuang
When probing at function entry, fallback to generate bpf prologue by calling args if '$param' is the only args and no debuginfo is provided. Signed-off-by: He Kuang --- tools/perf/util/probe-event.c | 54 ++- 1 file changed, 53 insertions(+),

[RFC PATCH v2 03/15] perf bpf: Save pt_regs info from debuginfo

2015-05-24 Thread He Kuang
Save reg number in function convert_variable_location() instead of the register string name, so we can fetch the target register from bpf context register later. Signed-off-by: He Kuang --- tools/perf/util/include/dwarf-regs.h | 13 + tools/perf/util/probe-event.h| 1

[RFC PATCH v2 02/15] perf bpf: Support custom vmlinux path

2015-05-24 Thread He Kuang
Make bpf command support -k option, when inserting probe point which needs debuginfo, a customized vmlinux path can be specified. Signed-off-by: He Kuang --- tools/perf/builtin-bpf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/builtin-bpf.c b/tools/perf/builtin-bpf.c index

[RFC PATCH v2 11/15] perf bpf: Synthesize vars to generate bpf prologue

2015-05-24 Thread He Kuang
After gethered all vars represented in trace_probe_arg, we can now use functions in libbpf to generate the args prologue. Signed-off-by: He Kuang --- tools/perf/util/probe-finder.c | 83 +- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a

[RFC PATCH v2 09/15] perf probe: Support $params without debuginfo

2015-05-24 Thread He Kuang
arg5=0x556062e3 arg6=0x12a8010 Signed-off-by: He Kuang --- tools/perf/util/probe-event.c | 42 ++ 1 file changed, 42 insertions(+) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index d05b77c..7f9f431 100644 --- a/tools/perf/util

[RFC PATCH v2 04/15] perf tools: Add functions to get calling regs

2015-05-24 Thread He Kuang
For generating function formal parameters without debuginfo, add function to get names and offsets of architecture dependent calling regs. Signed-off-by: He Kuang --- tools/perf/util/include/dwarf-regs.h | 2 ++ tools/perf/util/probe-finder.c | 10 ++ 2 files changed, 12

[RFC PATCH v2 10/15] perf bpf: Process debuginfo for generating bpf prologue

2015-05-24 Thread He Kuang
Process debuginfo for bpf prologue, the process function is copied and modified from debuginfo__find_trace_events(), with a different callback function for generating bpf prologue bytecode. Signed-off-by: He Kuang --- tools/perf/util/probe-event.c | 27 tools/perf/util/probe

[RFC PATCH v2 07/15] bpf tools: Convert arglist to bpf prologue

2015-05-24 Thread He Kuang
steps: 1. alloc dst address in stack -> r1 2. set size -> r2 3. fetch base register and offset -> r3 4. call BPF_FUNC_probe_read 5. loop 1 6. save intermediate result and process next arg 7. restore intermediate result to arg2~5 Signed-off-by: He Kuang --- tools/lib/bpf/Build | 2

[RFC PATCH v2 05/15] perf tools: Add pt_regs offsets and calling regs for x86

2015-05-24 Thread He Kuang
Combine pt_regs offset of each registers into arch_regs_table. And add architecture dependent calling_regs_table. Signed-off-by: He Kuang --- tools/perf/arch/x86/util/dwarf-regs.c | 100 +++--- 1 file changed, 79 insertions(+), 21 deletions(-) diff --git a/tools

Re: [RFC PATCH v2 03/15] perf bpf: Save pt_regs info from debuginfo

2015-05-25 Thread He Kuang
On 2015/5/24 21:31, Masami Hiramatsu wrote: > On 2015/05/24 17:27, He Kuang wrote: >> Save reg number in function convert_variable_location() instead of the >> register string name, so we can fetch the target register from bpf >> context register later. > > This is

Re: [RFC PATCH v2 09/15] perf probe: Support $params without debuginfo

2015-05-25 Thread He Kuang
hi, On 2015/5/24 16:49, Masami Hiramatsu wrote: > On 2015/05/24 17:28, He Kuang wrote: >> When probing at function entry, fallback $params to calling regs if no >> debuginfo is provided. >> >> Before this path: >>$ perf probe -v --add='generic_perform_wr

Re: [PATCH v2 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins

2015-05-15 Thread He Kuang
On 2015/5/14 21:31, Jiri Olsa wrote: On Thu, May 14, 2015 at 08:56:15PM +0800, He Kuang wrote: SNIP It seems new targets are needed. In the v2 patch, hum, I dont get it.. why ? dynamic-list-file gets rebuilt any time plugins are rebuilt.. why not keep just the 'plugins' depende

[PATCH v3 2/2] tools lib traceevent: Ignore libtrace-dynamic-list file

2015-05-15 Thread He Kuang
The libtrace-dynamic-list file is used to export symbols used by traceevent plugins. Signed-off-by: He Kuang --- tools/lib/traceevent/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/traceevent/.gitignore b/tools/lib/traceevent/.gitignore index 35f56be..3c60335 100644

[PATCH v3 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins

2015-05-15 Thread He Kuang
1049 [000] 9666.754487: ftrace:function: __set_task_comm :1049 1049 [000] 9666.754487: ftrace:function:_raw_spin_lock :1049 1049 [000] 9666.754487: ftrace:function: task_tgid_nr_ns ... Signed-off-by: He Kuang --- tools/lib/traceevent/Makefile | 14 +-

[RFC PATCH 1/5] perf bpf: Add -k option for testing convenience

2015-05-17 Thread He Kuang
Add -k option to perf bpf command. Signed-off-by: He Kuang --- tools/perf/builtin-bpf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/builtin-bpf.c b/tools/perf/builtin-bpf.c index 4ef294a..9ea34b3 100644 --- a/tools/perf/builtin-bpf.c +++ b/tools/perf/builtin-bpf.c @@ -11,6

[RFC PATCH 3/5] bpf: Add helper function for fetching variables at probe point

2015-05-17 Thread He Kuang
This helper function uses kernel structure trace_probe and related fetch functions for fetching variables described in 'SEC' to bpf stack. Signed-off-by: He Kuang --- include/uapi/linux/bpf.h | 1 + kernel/trace/bpf_trace.c | 38 ++ s

[RFC PATCH 2/5] bpf: Pass trace_probe to bpf_prog for variable fetching

2015-05-17 Thread He Kuang
Add new structure bpf_pt_regs, which contains both original 'ctx'(pt_regs) and trabe_probe pointer, and pass this new pointer to bpf prog for variable fetching. Signed-off-by: He Kuang --- kernel/trace/trace_kprobe.c | 11 +-- kernel/trace/trace_probe.h | 5 + 2 files c

[RFC PATCH 0/5] Fetching local variables for bpf prog

2015-05-17 Thread He Kuang
nt functionality of parsing args. cons: - User should add the 'structure param' code themselves. Looking forward for disscusions. He Kuang (5): perf bpf: Add -k option for testing convenience bpf: Pass trace_probe to bpf_prog for variable fetching bpf: Add helper function for fetching

[RFC PATCH 5/5] samples/bpf: Add sample for testing bpf fetch args

2015-05-17 Thread He Kuang
: : NODE_write1 a_ops=81a20160, bytes=1000 dd-1098 [000] d... 6892.829842: : NODE_write2 page =ea0001c49f80, pos =2000 Signed-off-by: He Kuang --- samples/bpf/Makefile| 1 + samples/bpf/sample_bpf_fetch_args.c | 43

[RFC PATCH 4/5] samples/bpf: Add proper prefix to objects in Makefile

2015-05-17 Thread He Kuang
Always use $(obj) when referring to generated files and use $(src) when referring to files located in the src tree. Signed-off-by: He Kuang --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 76e3458

[PATCH 1/3] perf probe: Remove length limitation for showing available variables

2015-05-08 Thread He Kuang
Use struct strbuf instead of bare char[] to remove the length limitation of variables in variable_list, so they will not disappear due to overlength, and make preparation for adding more description for variables. Signed-off-by: He Kuang --- tools/perf/util/dwarf-aux.c| 50

[PATCH 2/3] perf probe: Add flag for options when showing variables

2015-05-08 Thread He Kuang
Change current boolean flag 'externs' to unsigned long 'var_flags' for more options related to variables. These options work with --vars only. Signed-off-by: He Kuang --- tools/perf/builtin-probe.c | 8 +++- tools/perf/util/probe-event.c | 12 ++-- t

[PATCH 3/3] perf probe: Add --range option to show variable location range

2015-05-08 Thread He Kuang
struct page*page[byte offset]: <70-307>,<346-411> Then it is more clearly for us to do the probe with this variable: $ perf probe --add 'generic_perform_write+170 a_ops' Added new event: probe:generic_perform_write (on generic_perform_write+170 with a_ops) S

[RFC PATCH 0/6] perf bpf: Probing with local variable

2015-05-05 Thread He Kuang
033e sh-1260 [000] d... 112600.790977: : NODE_generic_perform_write, a_ops=81a20160, bytes=000a, offset=0355 He Kuang (6): perf bpf: Add headers for generate bpf bytecode perf bpf: Add pt_regs convert table for x86 perf bpf: Save pt_regs i

[RFC PATCH 6/6] perf bpf: Generate bpf prologue for arguments

2015-05-05 Thread He Kuang
Generate bpf prologue before attaching bpf progs to perf probe event. If prologue is generated, it will be pasted in front of the original bpf prog. Signed-off-by: He Kuang --- tools/perf/util/bpf-loader.c | 66 1 file changed, 66 insertions(+) diff

[RFC PATCH 1/6] perf bpf: Add headers for generate bpf bytecode

2015-05-05 Thread He Kuang
Including bpf instruction macros and register alias. Signed-off-by: He Kuang --- tools/perf/util/bpf-loader.h | 188 +++ 1 file changed, 188 insertions(+) diff --git a/tools/perf/util/bpf-loader.h b/tools/perf/util/bpf-loader.h index baa4404..840f96d

[RFC PATCH 2/6] perf bpf: Add pt_regs convert table for x86

2015-05-05 Thread He Kuang
Convert register number in debuginfo to its index in pt_regs. Signed-off-by: He Kuang --- tools/perf/arch/x86/util/dwarf-regs.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/arch/x86/util/dwarf-regs.c

[RFC PATCH 4/6] perf bpf: Convert arglist to bpf prologue

2015-05-05 Thread He Kuang
h base register and offset -> r3 4. call BPF_FUNC_probe_read 5. loop 1 6. save intermediate result and process next arg 7. restore intermediate result to arg2~5 Signed-off-by: He Kuang --- tools/perf/util/probe-event.c | 94 +++ tools/perf/util/probe-eve

[RFC PATCH 3/6] perf bpf: Save pt_regs info from debuginfo

2015-05-05 Thread He Kuang
Save pt_regs number and size information in function convert_variable_location() instead of the register string name, so we can fetch the target register from bpf context register later. Signed-off-by: He Kuang --- tools/perf/util/include/dwarf-regs.h | 2 ++ tools/perf/util/probe-event.h

[RFC PATCH 5/6] perf bpf: Process debuginfo for generating bpf prologue

2015-05-05 Thread He Kuang
Process debuginfo for bpf prologue, the process function is copied and modified from debuginfo__find_trace_events(), but use a different callback function for generating bpf prologue bytecode. Signed-off-by: He Kuang --- tools/perf/util/probe-event.c | 27 + tools/perf/util/probe

Re: [PATCH v2 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins

2015-05-14 Thread He Kuang
Hi, jirka On 2015/5/13 22:50, Jiri Olsa wrote: On Tue, May 12, 2015 at 11:25:45PM +0800, hekuang wrote: Hi, jirka On 05/12/2015 08:37 PM, Jiri Olsa wrote: On Tue, May 12, 2015 at 06:41:56AM +, He Kuang wrote: SNIP $(Q)$(MAKE) $(build)=perf -$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN

Re: [PATCH 2/3] perf probe: Add flag for options when showing variables

2015-05-08 Thread He Kuang
hi, Masami On 2015/5/8 21:15, Masami Hiramatsu wrote: > On 2015/05/08 21:23, He Kuang wrote: >> Change current boolean flag 'externs' to unsigned long 'var_flags' for >> more options related to variables. These options work with --vars only. > NAK, p

Re: [PATCH 1/3] perf probe: Remove length limitation for showing available variables

2015-05-09 Thread He Kuang
On 2015/5/8 22:17, Masami Hiramatsu wrote: > On 2015/05/08 21:23, He Kuang wrote: >> Use struct strbuf instead of bare char[] to remove the length limitation >> of variables in variable_list, so they will not disappear due to >> overlength, and make preparation for adding

Re: [PATCH 3/3] perf probe: Add --range option to show variable location range

2015-05-09 Thread He Kuang
On 2015/5/8 22:08, Masami Hiramatsu wrote: On 2015/05/08 21:23, He Kuang wrote: It is not easy for users to get the accurate byte offset or the line number where a local variable can be probed. With '--range' option, local variables in scope of the probe point are showed with byte of

[PATCH v2 3/3] perf probe: Show better error message when failed to find variable

2015-05-09 Thread He Kuang
led to add events. After this patch: $ perf probe --add 'generic_perform_write+118 bytes' Failed to find the location of bytes at this address. Perhaps, it has been optimized out. Use -V with --range option to show variable location range. Error: Failed to add events. Sig

[PATCH v2 1/3] perf probe: Remove length limitation for showing available variables

2015-05-09 Thread He Kuang
Use struct strbuf instead of bare char[] to remove the length limitation of variables in variable_list, so they will not disappear due to overlength, and make preparation for adding more description for variables. Signed-off-by: He Kuang --- tools/perf/util/dwarf-aux.c| 50

[PATCH v2 2/3] perf probe: Add --range option to show variable location range

2015-05-09 Thread He Kuang
$ perf probe --add 'generic_perform_write+170 a_ops' Added new event: probe:generic_perform_write (on generic_perform_write+170 with a_ops) Signed-off-by: He Kuang --- tools/perf/builtin-probe.c | 2 + tools/perf/util/dwarf-aux.c| 121

Re: [PATCH v2 2/3] perf probe: Add --range option to show variable location range

2015-05-10 Thread He Kuang
Hi, Masami On 2015/5/10 11:21, Masami Hiramatsu wrote: On 2015/05/09 18:55, He Kuang wrote: It is not easy for users to get the accurate byte offset or the line number where a local variable can be probed. With '--range' option, local variables in scope of the probe point are showed

[PATCH v3 3/3] perf probe: Show better error message when failed to find variable

2015-05-11 Thread He Kuang
led to add events. After this patch: $ perf probe --add 'generic_perform_write+118 bytes' Failed to find the location of bytes at this address. Perhaps, it has been optimized out. Use -V with --range option to show variable location range. Error: Failed to add events. Sig

[PATCH v3 1/3] perf probe: Remove length limitation for showing available variables

2015-05-11 Thread He Kuang
Use struct strbuf instead of bare char[] to remove the length limitation of variables in variable_list, so they will not disappear due to overlength, and make preparation for adding more description for variables. Signed-off-by: He Kuang Acked-by: Masami Hiramatsu --- tools/perf/util/dwarf

[PATCH v3 2/3] perf probe: Add --range option to show variable location range

2015-05-11 Thread He Kuang
$ perf probe --add 'generic_perform_write+170 a_ops' Added new event: probe:generic_perform_write (on generic_perform_write+170 with a_ops) Signed-off-by: He Kuang --- tools/perf/builtin-probe.c | 2 + tools/perf/util/dwarf-aux.c| 121

[PATCH 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins

2015-05-11 Thread He Kuang
1049 [000] 9666.754487: ftrace:function: __set_task_comm :1049 1049 [000] 9666.754487: ftrace:function:_raw_spin_lock :1049 1049 [000] 9666.754487: ftrace:function: task_tgid_nr_ns ... Signed-off-by: He Kuang --- tools/lib/traceevent/Makefile | 14 ++

[PATCH 2/2] tools lib traceevent: Ignore libtrace-dynamic-list file

2015-05-11 Thread He Kuang
The libtrace-dynamic-list file is used to export symbols used by traceevent plugins. Signed-off-by: He Kuang --- tools/lib/traceevent/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/traceevent/.gitignore b/tools/lib/traceevent/.gitignore index 35f56be..3c60335 100644

Re: [PATCH v3 3/3] perf probe: Show better error message when failed to find variable

2015-05-11 Thread He Kuang
Hi, Ingo On 2015/5/11 17:30, Ingo Molnar wrote: * He Kuang wrote: Indicate to check variable location range in error message when we got failed to find the variable. Before this patch: $ perf probe --add 'generic_perform_write+118 bytes' Failed to find the location of byt

Re: [PATCH v3 3/3] perf probe: Show better error message when failed to find variable

2015-05-11 Thread He Kuang
On 2015/5/11 17:50, Ingo Molnar wrote: * He Kuang wrote: Hi, Ingo On 2015/5/11 17:30, Ingo Molnar wrote: * He Kuang wrote: Indicate to check variable location range in error message when we got failed to find the variable. Before this patch: $ perf probe --add

Re: [PATCH 2/2] perf trace: Fix segmentfault on perf trace

2015-05-11 Thread He Kuang
Hi, Arnaldo On 2015/4/8 11:15, He Kuang wrote: Hi, Arnaldo On 2015/4/7 20:36, Arnaldo Carvalho de Melo wrote: Em Tue, Apr 07, 2015 at 05:31:11PM +0800, He Kuang escreveu: After perf_evlist__filter_pollfd() filters out fds and releases perf_mmap by using perf_evlist__mmap_put(), refcnt of

[PATCH 2/2] perf trace: Fix typo in builtin-trace.c

2015-05-11 Thread He Kuang
Duplication NULL test for trace.evlist. Signed-off-by: He Kuang --- tools/perf/builtin-trace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index bb05e44..ca39530 100644 --- a/tools/perf/builtin-trace.c +++ b/tools

[PATCH 1/2] perf tests: Fix to get negative exit codes

2015-05-11 Thread He Kuang
-by: He Kuang --- tools/perf/tests/builtin-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 4f40981..f42af98 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -21

[PATCH v4 2/3] perf probe: Add --range option to show variable location range

2015-05-11 Thread He Kuang
$ perf probe --add 'generic_perform_write+170 a_ops' Added new event: probe:generic_perform_write (on generic_perform_write+170 with a_ops) Signed-off-by: He Kuang Acked-by: Masami Hiramatsu --- tools/perf/builtin-probe.c | 2 + tools/perf/util/dwarf-aux.c| 121

[PATCH v4 3/3] perf probe: Show better error message when failed to find variable

2015-05-11 Thread He Kuang
o show variable location range. Error: Failed to add events. Signed-off-by: He Kuang --- tools/perf/util/probe-finder.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index f032329..0fc2ae8 100644 --- a/

[PATCH v4 1/3] perf probe: Remove length limitation for showing available variables

2015-05-11 Thread He Kuang
Use struct strbuf instead of bare char[] to remove the length limitation of variables in variable_list, so they will not disappear due to overlength, and make preparation for adding more description for variables. Signed-off-by: He Kuang Acked-by: Masami Hiramatsu --- tools/perf/util/dwarf

[PATCH v2 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins

2015-05-11 Thread He Kuang
1049 [000] 9666.754487: ftrace:function: __set_task_comm :1049 1049 [000] 9666.754487: ftrace:function:_raw_spin_lock :1049 1049 [000] 9666.754487: ftrace:function: task_tgid_nr_ns ... Signed-off-by: He Kuang --- tools/lib/traceevent/Makefile | 14 +-

[PATCH v2 2/2] tools lib traceevent: Ignore libtrace-dynamic-list file

2015-05-11 Thread He Kuang
The libtrace-dynamic-list file is used to export symbols used by traceevent plugins. Signed-off-by: He Kuang --- tools/lib/traceevent/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/traceevent/.gitignore b/tools/lib/traceevent/.gitignore index 35f56be..3c60335 100644

Re: [PATCH 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins

2015-05-11 Thread He Kuang
Hi, jirka On 2015/5/11 22:33, Jiri Olsa wrote: On Mon, May 11, 2015 at 09:35:26AM +, He Kuang wrote: Traceevent plugins need dynamic symbols exported from libtraceevent.a, otherwise a dlopen error will occur during plugins loading. This patch uses dynamic-list-file to export dynamic

Re: [PATCH v2 00/15] tracing: 'hist' triggers

2015-03-09 Thread He Kuang
hi, Tom On 2015/3/3 3:55, Tom Zanussi wrote: BTW, I've actually tried to play around with the BPF samples/, but it seems they're not actually hooked into the system i.e. the samples Makefile doesn't build them, and it even looks for tools/llvm that's not there. I got as far as getting the late

Re: [PATCH] perf tools: Fix possible double free on error

2015-03-09 Thread He Kuang
Hi, It seems this patch not appeared in any repo, so ping.. On 2015/3/4 20:46, Masami Hiramatsu wrote: (2015/03/04 19:01), He Kuang wrote: A double free occurred when get source file path failed. If lr->path failed to assign a new value, it will be freed as the old path and then be fr

Re: [PATCH] perf hists browser: Fix segfault when all entries be filtered

2015-03-09 Thread He Kuang
ping.. On 2015/3/4 12:13, He Kuang wrote: When all perf report entries be filtered, the result of hists__filter_entries() can be NULL, check the result before processing. Miss this checking will cause segmentation fault like this: $ perf report (filter all entries and left nothing, then

Re: [PATCH 1/2] tracing: remove ftrace:function TRACE_EVENT_FL_USE_CALL_FILTER flag

2015-03-09 Thread He Kuang
ping.. On 2015/3/3 15:21, He Kuang wrote: TRACE_EVENT_FL_USE_CALL_FILTER flag in ftrace:functon event can be removed. This flag was first introduced in commit f306cc82a93d ("tracing: Update event filters for multibuffer"). Now, the only place uses this flag is ftrace:function, but the

Re: [PATCH] perf hists browser: Fix UI bug after fold/unfold

2015-03-10 Thread He Kuang
hi, On 2015/3/10 14:28, Namhyung Kim wrote: On Fri, Mar 06, 2015 at 08:51:44PM +0800, He Kuang wrote: In perf hists browser, the fold/unfold stat of each hist entry is recorded but hb->nr_callchain_rows loses its value after zoom out and zoom in back. This causes a wrong row cursor range t

[PATCHv2 1/2] perf hists browser: Fix UI bug after fold/unfold

2015-03-11 Thread He Kuang
8.33% 0x65 - 16.67% 0.00% ls [unknown] [.]0x6469702e64 0x6469702e64 This patch recalculates hb->nr_callchain_rows to fix the bug. Signed-off-by: He Kuang --- tools/perf/ui/browsers/hists.c | 20 1 file changed, 20 insertions(+) diff

[PATCHv2 2/2] perf hists browser: Fix UI bug after zoom into thread/dso/symbol

2015-03-11 Thread He Kuang
ld64.so [.] _dl_load_shared_library _dl_load_shared_library _dl_get_ready_to_run <= [cursor may stop here, can't move down] _start ... This patch clear h->nr_rows to fix this bug. Signed-off-by: He Kuang --- tools/perf/util/hist.c | 1 + 1 file changed, 1 insertion(+) d

[PATCHv3] perf hists browser: Fix UI bug after fold/unfold

2015-03-12 Thread He Kuang
8.33% 0x65 - 16.67% 0.00% ls [unknown] [.]0x6469702e64 0x6469702e64 This patch recalculates hb->nr_callchain_rows to fix the bug. Signed-off-by: He Kuang --- tools/perf/ui/browsers/hists.c | 19 +++ 1 file changed, 19 insertions(+) diff

[RFC] bpf: Suggestion on bpf syscall interface

2015-03-28 Thread He Kuang
Hi, Alexei In our end-end IO module project, we use bpf maps to record configurations. According to current bpf syscall interface, we should specify map_fd to lookup/update bpf maps, so we are restricted to do config in the same user program. My suggestion is to export this kind of operations to

Re: [RFC] bpf: Suggestion on bpf syscall interface

2015-03-29 Thread He Kuang
On 2015/3/29 1:21, Alexei Starovoitov wrote: On 3/28/15 4:36 AM, He Kuang wrote: Hi, Alexei In our end-end IO module project, we use bpf maps to record configurations. According to current bpf syscall interface, we should specify map_fd to lookup/update bpf maps, so we are restricted to do

[BUG] uprobe: failed to work on 9pfs

2015-03-05 Thread He Kuang
Uprobe uses inode address to index all registered uprobes in a rb_tree, this works well in most filesystems but failed on 9pfs. 9pfs allocate more than one vfs inode to the same file, the inode address when we create uprobe is not same as the inode address we run later. As a result, neither perf

[PATCH] perf hists browser: Fix UI bug after fold/unfold

2015-03-06 Thread He Kuang
7% 0.00% ls [unknown] [.]0x6469702e64 0x6469702e64 When zoom into DSO or thread, nr_rows is not cleared which causes a similar problem. This patch recalculates hb->nr_callchain_rows and clears nr_rows to fix the bug. Signed-off-by: He Kuang --- tools/perf/ui/br

[PATCH] perf tools: Fix a compiling error in probe-event.c for 32 bits machine

2015-03-17 Thread He Kuang
27;u64' [-Werror=format] cc1: all warnings being treated as errors make[3]: *** [util/probe-event.o] Error 1 Fix it by using the PRIx64 for u64. Signed-off-by: He Kuang --- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/ut

[PATCH] perf probe: Fix failure to add multiple probes without debuginfo

2015-03-19 Thread He Kuang
--add='sys_open' Added new event: probe:sys_write (on sys_write) You can now use it in all perf tools, such as: perf record -e probe:sys_write -aR sleep 1 Added new event: probe:sys_open (on sys_open) You can now use it in all perf tools, such as: p

[PATCH] perf probe: Fix failure to add multiple probes without debuginfo

2015-03-19 Thread He Kuang
n' Added new event: probe:sys_write (on sys_write) You can now use it in all perf tools, such as: perf record -e probe:sys_write -aR sleep 1 Added new event: probe:sys_open (on sys_open) You can now use it in all perf tools, such as: perf record -e pro

Re: [PATCH v6 tip 3/8] tracing: allow BPF programs to call bpf_ktime_get_ns()

2015-03-13 Thread He Kuang
Hi, Alexei I've followed up your bpf version. In bpf filter, sometimes we need to get 'pid' and some other context informations to decide whether to filter or not. For example, to trace a vfs read procedure, we can insert bpf program to '__vfs_read(struct file *file, char __user *buf ...)', mark

[RFC 0/2] Experience on full stack profiling using eBPF.

2015-02-05 Thread He Kuang
r those events filtered out. 4. Provide a more user-friendly interface for user to use. Thanks for your work. Signed-off-by: He Kuang He Kuang (2): tracing: add additional IO tracepoints samples: bpf: IO profiling example block/bio.c| 1 + block/blk-core.c

[RFC 1/2] tracing: add additional IO tracepoints

2015-02-05 Thread He Kuang
Add tracepoints according to IO data stream to trace data propagate in vfs, fs, block layers. Signed-off-by: He Kuang --- block/bio.c| 1 + block/blk-core.c | 4 +++ drivers/scsi/virtio_scsi.c | 3 ++ fs/ext4/page-io.c | 4 +++ include

[RFC 2/2] samples: bpf: IO profiling example

2015-02-05 Thread He Kuang
For the first node, we sample and record its characteristic (eg. address), and add the result to a global hash table. For other nodes, they'll be traced when their context matches the characteristics in previous tables. Signed-off-by: He Kuang --- samples/bpf/Makefile | 4 + sa

[PATCH 2/2] tracing: remove macro TRACE_EVENT_FL_USE_CALL_FILTER and related codes

2015-03-02 Thread He Kuang
After applying the previous patch, TRACE_EVENT_FL_USE_CALL_FILTER and the codes relate to it can be removed. Signed-off-by: He Kuang --- include/linux/ftrace_event.h | 2 -- kernel/trace/trace_events_filter.c | 68 ++ 2 files changed, 11 insertions

[PATCH 1/2] tracing: remove ftrace:function TRACE_EVENT_FL_USE_CALL_FILTER flag

2015-03-02 Thread He Kuang
or file->filter is used. So we can safely remove TRACE_EVENT_FL_USE_CALL_FILTER flag from ftrace:function events. Signed-off-by: He Kuang --- kernel/trace/trace_export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_

[PATCH] perf hists browser: Fix segfault when all entries be filtered

2015-03-03 Thread He Kuang
] ../bin/perf[0x408584] Signed-off-by: He Kuang --- tools/perf/ui/browsers/hists.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 788506e..1106bb8 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers

[PATCH] perf tools: Fix possible double free on error

2015-03-04 Thread He Kuang
rruption (fasttop): 0x00a9ac50 *** === Backtrace: = ../lib64/libc.so.6(+0x6eeef)[0x75e44eef] ../lib64/libc.so.6(+0x78cae)[0x75e4ecae] ../lib64/libc.so.6(+0x79987)[0x75e4f987] ../bin/perf[0x4ab41f] ... This patch fix this problem. Signed-off-by:

[PATCH] perf: fix building error in x86_64

2015-02-10 Thread He Kuang
t c6e5e9fbc3ea1 ("perf tools: Fix building error in x86_64 when dwarf unwind is on"), ARCH test in Makefile.perf conflicts with tests/builtin-test.c's __x86_64__. To x86/x86_64 platform, ARCH should always override to x86 while IS_64_BIT stands for the actual architecture. Signed-off

[PATCH v2] perf: fix building error in x86_64

2015-02-12 Thread He Kuang
t c6e5e9fbc3ea1 ("perf tools: Fix building error in x86_64 when dwarf unwind is on"), ARCH test in Makefile.perf conflicts with tests/builtin-test.c's __x86_64__. To x86/x86_64 platform, ARCH should always override to x86 while IS_64_BIT stands for the actual architecture. Signed-off

[PATCH] perf report: Fix branch stack mode cannot be set

2015-02-14 Thread He Kuang
allsyms] [k] zap_pte_range 6.25% ls [kernel.kallsyms] [k] change_pte_range [kernel.kallsyms] [k] change_pte_range 0.39% ls [kernel.kallsyms] [k] prio_tree_remove [kernel.kallsyms] [k] prio_tree_remove ... Signe

[RFC]kprobes functionality with kernel-hacking disabled

2014-12-18 Thread He Kuang
abled too. Do you have any advices on the conflicts between kernel hacking tools and practical kernel which compiled without it? If there is no kprobes module, what should we use? Signed-off-by: He Kuang -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel&q

[PATCH] perf: Fix a precedence bug

2015-02-27 Thread He Kuang
The minus operator has higher precedence than ?: Add parentheses around ?: fix this. --- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 919937e..bed8d0f 100644 --- a/tools/perf/ut

Re: [PATCH] perf report: Fix branch stack mode cannot be set

2015-02-27 Thread He Kuang
ping.. 在 2015/2/15 10:33, He Kuang 写道: When perf.data file be abtained by using 'perf record -b', perf report should use branch stack mode to generate output. But this function is broken by improper comparison between boolean and constant -1. before this patch: $perf report -b -i

[PATCH] perf: fix building error

2015-02-27 Thread He Kuang
s caused commit c6e5e9fbc3ea1 ("perf tools: Fix building error in x86_64 when dwarf unwind is on"), ARCH test in Makefile.perf conflicts with tests/builtin-test.c's __x86_64__. To x86/x86_64 platform, ARCH should always override to x86 while IS_64_BIT stands for the actual architecture. Signe

Re: [PATCH] perf: Fix a precedence bug

2015-02-27 Thread He Kuang
Signed-off-by: He Kuang 在 2015/2/27 17:35, He Kuang 写道: The minus operator has higher precedence than ?: Add parentheses around ?: fix this. --- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util

[PATCH] perf: Fix a precedence bug

2015-02-27 Thread He Kuang
yprobe do_sys_open' > /sys/kernel/debug/tracing/kprobe_events $ perf probe -l -k ../vmlinux kprobes:myprobe (on do_sys_o...@linux.git/fs/open.c) Signed-off-by: He Kuang --- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/

Re: [PATCH] perf: fix building error

2015-02-28 Thread He Kuang
Well, I've tested and it worked. On 2015/2/28 10:49, Namhyung Kim wrote: Hi He, On Fri, Feb 27, 2015 at 06:05:37PM +0800, He Kuang wrote: When build with ARCH=x86_64/i386, perf failed to compile with following error: tests/builtin-test.o:(.data+0x158): undefined referen

Re: [PATCH v3 linux-trace 1/8] tracing: attach eBPF programs to tracepoints and syscalls

2015-02-16 Thread He Kuang
Hi, Alexei Another suggestion on bpf syscall interface. Currently, BPF + syscalls/kprobes depends on CONFIG_BPF_SYSCALL. In kernel used on commercial products, CONFIG_BPF_SYSCALL is probably disabled, in this case, bpf bytecode cannot be loaded to the kernel. If we turn the functionality of BPF_

[PATCH] Revert "mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE"

2016-03-30 Thread He Kuang
This reverts commit 998d39cb236fe464af86a3492a24d2f67ee1efc2. When local irq is disabled, a percpu variable does not change, so we can remove the access macros and let the compiler optimize the code safely. Signed-off-by: He Kuang --- mm/page_alloc.c | 10 -- 1 file changed, 4

[PATCH] perf tools: Fix build errors on tsc functions for archs other than x86

2016-03-31 Thread He Kuang
rror 1 Makefile:68: recipe for target 'all' failed make: *** [all] Error 2 Since tsc conversion functions were moved out from arch dir, move 'tsc.h' out from x86 dir to make it possible to compile for other archs. Signed-off-by: He Kuang --- tools/perf/arch/x86/util/tsc.c |

[RFC PATCH 4/5] bpf: Introduce function for outputing sample data to perf event

2015-06-30 Thread He Kuang
the corresponding trace buffer of the context, new function perf_swevent_current_context_type() is added, this function only gets the current context type but does not increase the recursion count. Signed-off-by: He Kuang --- include/linux/perf_event.h | 2 ++ include/uapi/linux/bpf.h | 1

<    1   2   3   4   5   >