Re: [PATCH v2 1/5] bpf: Add missing header to the library

2017-02-07 Thread Wangnan (F)
Please add me into the cc list of all of the 5 patches. Thank you. On 2017/2/7 4:40, Mickaël Salaün wrote: Include stddef.h to define size_t. Signed-off-by: Mickaël Salaün Cc: Alexei Starovoitov Cc: Arnaldo Carvalho de Melo Cc: Daniel

Re: [PATCH v2 1/5] bpf: Add missing header to the library

2017-02-07 Thread Wangnan (F)
Please add me into the cc list of all of the 5 patches. Thank you. On 2017/2/7 4:40, Mickaël Salaün wrote: Include stddef.h to define size_t. Signed-off-by: Mickaël Salaün Cc: Alexei Starovoitov Cc: Arnaldo Carvalho de Melo Cc: Daniel Borkmann Cc: Wang Nan --- tools/lib/bpf/bpf.h | 1 +

Re: [PATCH v3 1/5] bpf: Add missing header to the library

2017-02-07 Thread Wangnan (F)
On 2017/2/8 4:56, Mickaël Salaün wrote: Include stddef.h to define size_t. Signed-off-by: Mickaël Salaün Cc: Alexei Starovoitov Cc: Arnaldo Carvalho de Melo Cc: Daniel Borkmann Cc: Wang Nan ---

Re: [PATCH v3 1/5] bpf: Add missing header to the library

2017-02-07 Thread Wangnan (F)
On 2017/2/8 4:56, Mickaël Salaün wrote: Include stddef.h to define size_t. Signed-off-by: Mickaël Salaün Cc: Alexei Starovoitov Cc: Arnaldo Carvalho de Melo Cc: Daniel Borkmann Cc: Wang Nan --- tools/lib/bpf/bpf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/bpf/bpf.h

Re: [PATCH v3 2/5] bpf: Simplify bpf_load_program() error handling in the library

2017-02-07 Thread Wangnan (F)
On 2017/2/8 4:56, Mickaël Salaün wrote: Do not call a second time bpf(2) when a program load failed. BPF_PROG_LOAD should success most of the time. Setting log_level to 0 by default and require log buffer when failure can make it faster in normal case. Thank you. Signed-off-by: Mickaël

Re: [PATCH v3 2/5] bpf: Simplify bpf_load_program() error handling in the library

2017-02-07 Thread Wangnan (F)
On 2017/2/8 4:56, Mickaël Salaün wrote: Do not call a second time bpf(2) when a program load failed. BPF_PROG_LOAD should success most of the time. Setting log_level to 0 by default and require log buffer when failure can make it faster in normal case. Thank you. Signed-off-by: Mickaël

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) <wangn...@huawei.com> 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

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

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', 'foo_2

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', 'foo_2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 +-

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

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 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" ---

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 |

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

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

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

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

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

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

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

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

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

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

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 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: [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) <wangn...@huawei.com> 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 gra

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 copy

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

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

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) <wangn...@huawei.com> 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 gra

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 copy

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/

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/

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 ++

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

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) <wangn...@huawei.com> wrote: On 2016/11/15 12:57, Alexei Starovoitov wrote: On Mon, Nov 14, 2016 at 8:05 PM, Wang Nan <wangn...@huawei.com> wrote: This is version 2 of perf builtin

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

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

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

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.

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.

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

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

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

2016-10-24 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

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

2016-10-24 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

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

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

Re: [PATCH 1/8] tools lib bpf: add error functions

2016-10-18 Thread Wangnan (F)
On 2016/10/19 6:52, Joe Stringer wrote: On 16 October 2016 at 14:18, Eric Leblond wrote: The include of err.h is not explicitely needed in exported functions and it was causing include conflict with some existing code due to redefining some macros. To fix this, let's have

Re: [PATCH 1/8] tools lib bpf: add error functions

2016-10-18 Thread Wangnan (F)
On 2016/10/19 6:52, Joe Stringer wrote: On 16 October 2016 at 14:18, Eric Leblond wrote: The include of err.h is not explicitely needed in exported functions and it was causing include conflict with some existing code due to redefining some macros. To fix this, let's have error handling

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

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: It is not correct to assimilate the elf data of the maps section to an array of map definition. In fact the sizes differ. The offset provided in the symbol section has to be used instead. This patch fixes a bug causing a elf with two maps not to load

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

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: It is not correct to assimilate the elf data of the maps section to an array of map definition. In fact the sizes differ. The offset provided in the symbol section has to be used instead. This patch fixes a bug causing a elf with two maps not to load

Re: [PATCH 6/8] tools lib bpf: improve warning

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: Signed-off-by: Eric Leblond Please add some commit messages. Thank you. --- tools/lib/bpf/libbpf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index

Re: [PATCH 6/8] tools lib bpf: improve warning

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: Signed-off-by: Eric Leblond Please add some commit messages. Thank you. --- tools/lib/bpf/libbpf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 7cd341e..1fe4532

Re: [PATCH 5/8] tools lib bpf: add missing functions

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: Some functions were missing in the library to be able to use it in the case where the userspace is handling the maps in kernel. The patch also renames functions to have a homogeneous naming convention. Signed-off-by: Eric Leblond ---

Re: [PATCH 5/8] tools lib bpf: add missing functions

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: Some functions were missing in the library to be able to use it in the case where the userspace is handling the maps in kernel. The patch also renames functions to have a homogeneous naming convention. Signed-off-by: Eric Leblond ---

Re: [PATCH 4/8] tools lib bpf: export function to set type

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: Current API was not allowing the user to set a type like socket filter. To avoid a setter function for each type, the patch simply exports a set function that takes the type in parameter. Signed-off-by: Eric Leblond ---

Re: [PATCH 4/8] tools lib bpf: export function to set type

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: Current API was not allowing the user to set a type like socket filter. To avoid a setter function for each type, the patch simply exports a set function that takes the type in parameter. Signed-off-by: Eric Leblond --- tools/lib/bpf/libbpf.c | 19

Re: [PATCH 3/8] tools: Sync tools/include/uapi/linux/bpf.h with the kernel

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: Signed-off-by: Eric Leblond Commit message is required. Thank you. --- tools/include/uapi/linux/bpf.h | 52 ++ 1 file changed, 52 insertions(+) diff --git a/tools/include/uapi/linux/bpf.h

Re: [PATCH 3/8] tools: Sync tools/include/uapi/linux/bpf.h with the kernel

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: Signed-off-by: Eric Leblond Commit message is required. Thank you. --- tools/include/uapi/linux/bpf.h | 52 ++ 1 file changed, 52 insertions(+) diff --git a/tools/include/uapi/linux/bpf.h

Re: [PATCH 1/8] tools lib bpf: add error functions

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: The include of err.h is not explicitely needed in exported functions and it was causing include conflict with some existing code due to redefining some macros. To fix this, let's have error handling functions provided by the library. Furthermore this

Re: [PATCH 1/8] tools lib bpf: add error functions

2016-10-16 Thread Wangnan (F)
On 2016/10/17 5:18, Eric Leblond wrote: The include of err.h is not explicitely needed in exported functions and it was causing include conflict with some existing code due to redefining some macros. To fix this, let's have error handling functions provided by the library. Furthermore this

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

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

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 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 00/14] perf clang: Support compiling BPF script use builtin clang

2016-09-26 Thread Wangnan (F)
On 2016/9/27 7:58, Arnaldo Carvalho de Melo wrote: Le 26 sept. 2016 8:47 PM, "Alexei Starovoitov" <alexei.starovoi...@gmail.com <mailto:alexei.starovoi...@gmail.com>> a écrit : > > On Mon, Sep 26, 2016 at 09:49:30AM +0800, Wangnan (F) wrote: > >

Re: [PATCH 00/14] perf clang: Support compiling BPF script use builtin clang

2016-09-26 Thread Wangnan (F)
On 2016/9/27 7:58, Arnaldo Carvalho de Melo wrote: Le 26 sept. 2016 8:47 PM, "Alexei Starovoitov" mailto:alexei.starovoi...@gmail.com>> a écrit : > > On Mon, Sep 26, 2016 at 09:49:30AM +0800, Wangnan (F) wrote: > > > > > > On 2016/9/24 23:16, Alexe

Re: [PATCH 00/14] perf clang: Support compiling BPF script use builtin clang

2016-09-25 Thread Wangnan (F)
On 2016/9/24 23:16, Alexei Starovoitov wrote: On Fri, Sep 23, 2016 at 12:49:47PM +, Wang Nan wrote: This patch set is the first step to implement features I announced in LinuxCon NA 2016. See page 31 of:

Re: [PATCH 00/14] perf clang: Support compiling BPF script use builtin clang

2016-09-25 Thread Wangnan (F)
On 2016/9/24 23:16, Alexei Starovoitov wrote: On Fri, Sep 23, 2016 at 12:49:47PM +, Wang Nan wrote: This patch set is the first step to implement features I announced in LinuxCon NA 2016. See page 31 of:

Re: [PATCH] perf record: Fix segfault when running with suid and kptr_restrict is 1

2016-09-23 Thread Wangnan (F)
On 2016/9/22 23:41, Arnaldo Carvalho de Melo wrote: Em Wed, Sep 21, 2016 at 03:56:20AM +, Wang Nan escreveu: Before this patch perf panic if kptr_restrict set to 1 and perf is owned by root with suid set: $ whoami wangnan $ ls -l ./perf -rwsr-xr-x 1 root root 19781908 Sep 21

Re: [PATCH] perf record: Fix segfault when running with suid and kptr_restrict is 1

2016-09-23 Thread Wangnan (F)
On 2016/9/22 23:41, Arnaldo Carvalho de Melo wrote: Em Wed, Sep 21, 2016 at 03:56:20AM +, Wang Nan escreveu: Before this patch perf panic if kptr_restrict set to 1 and perf is owned by root with suid set: $ whoami wangnan $ ls -l ./perf -rwsr-xr-x 1 root root 19781908 Sep 21

Re: [PATCH] perf record: Fix segfault when running with suid and kptr_restrict is 1

2016-09-20 Thread Wangnan (F)
On 2016/9/21 11:48, Wang Nan wrote: Before this patch perf panic if kptr_restrict set to 1 and perf is owned by root with suid set: $ whoami wangnan $ ls -l ./perf -rwsr-xr-x 1 root root 19781908 Sep 21 19:29 /home/wangnan/perf $ cat /proc/sys/kernel/kptr_restrict 1 $ cat

Re: [PATCH] perf record: Fix segfault when running with suid and kptr_restrict is 1

2016-09-20 Thread Wangnan (F)
On 2016/9/21 11:48, Wang Nan wrote: Before this patch perf panic if kptr_restrict set to 1 and perf is owned by root with suid set: $ whoami wangnan $ ls -l ./perf -rwsr-xr-x 1 root root 19781908 Sep 21 19:29 /home/wangnan/perf $ cat /proc/sys/kernel/kptr_restrict 1 $ cat

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

2016-09-18 Thread Wangnan (F)
On 2016/9/18 22:56, Andi Kleen wrote: On Sun, Sep 18, 2016 at 06:20:04PM +0800, Wangnan (F) wrote: On 2016/9/18 9:02, Andi Kleen wrote: From: Andi Kleen <a...@linux.intel.com> This is a generic bug fix, but it helps with Sukadev's JSON event tree where such events can happen. Any

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

2016-09-18 Thread Wangnan (F)
On 2016/9/18 22:56, Andi Kleen wrote: On Sun, Sep 18, 2016 at 06:20:04PM +0800, Wangnan (F) wrote: On 2016/9/18 9:02, Andi Kleen wrote: 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

<    1   2   3   4   5   6   7   8   9   10   >