[PATCH -stable 4.1 1/2] perf: Restructure perf syscall point of no return

2017-02-24 Thread Wang Nan
Signed-off-by: Peter Zijlstra (Intel) Cc: Alexander Shishkin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar Signed-off-by: Wang Nan --- kernel/events/core.c | 49 - 1 file

[PATCH -stable 4.1 0/2] perf/core: Fix CVE-2017-6001

2017-02-24 Thread Wang Nan
These two patch are needed for stable 4.1. They fix CVE-2017-6001. Peter Zijlstra (2): perf: Restructure perf syscall point of no return perf/core: Fix concurrent sys_perf_event_open() vs. 'move_group' race kernel/events/core.c | 102 +-- 1

[PATCH -improve] tools lib bpf: Fix map offsets in relocation

2017-01-19 Thread Wang Nan
_idx = 3 So, libbpf reports: libbpf: bpf relocation: map_idx 3 large than 2 Fix map relocation by checking the exact offset of maps when doing relocation. Fixes: 4708bbda5cb2 ("tools lib bpf: Fix maps resolution") Signed-off-by: Joe Stringer <j...@ovn.org> Signed-off-by: Wang Na

[PATCH -improve] tools lib bpf: Fix map offsets in relocation

2017-01-19 Thread Wang Nan
pf reports: libbpf: bpf relocation: map_idx 3 large than 2 Fix map relocation by checking the exact offset of maps when doing relocation. Fixes: 4708bbda5cb2 ("tools lib bpf: Fix maps resolution") Signed-off-by: Joe Stringer Signed-off-by: Wang Nan [Allow different map size in an ob

[PATCH] coresight: fix kernel panic caused by invalid CPU

2016-12-25 Thread Wang Nan
---[ end trace 98933da8f92b0c9a ]--- Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Xia Kaixu <xiaka...@huawei.com> Cc: Li Zefan <lize...@huawei.com> Cc: Mathieu Poirier <mathieu.poir...@linaro.org> Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.or

[PATCH] coresight: fix kernel panic caused by invalid CPU

2016-12-25 Thread Wang Nan
---[ end trace 98933da8f92b0c9a ]--- Signed-off-by: Wang Nan Cc: Xia Kaixu Cc: Li Zefan Cc: Mathieu Poirier Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/hwtracing/coresight/coresight-etm-perf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers

[tip:perf/core] perf build: Check LLVM version in feature check

2016-12-07 Thread tip-bot for Wang Nan
Commit-ID: a940cad331e79cc03d9ae74f56a2c7cb810bdce9 Gitweb: http://git.kernel.org/tip/a940cad331e79cc03d9ae74f56a2c7cb810bdce9 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Tue, 6 Dec 2016 07:22:30 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] perf build: Check LLVM version in feature check

2016-12-07 Thread tip-bot for Wang Nan
Commit-ID: a940cad331e79cc03d9ae74f56a2c7cb810bdce9 Gitweb: http://git.kernel.org/tip/a940cad331e79cc03d9ae74f56a2c7cb810bdce9 Author: Wang Nan AuthorDate: Tue, 6 Dec 2016 07:22:30 + Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 6 Dec 2016 13:21:55 -0300 perf build: Check

[tip:perf/core] perf clang: Compile BPF script using builtin clang support

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: edd695b032ba3a90c3bb07d934500b2c390a61ff Gitweb: http://git.kernel.org/tip/edd695b032ba3a90c3bb07d934500b2c390a61ff Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:39 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] perf clang: Compile BPF script using builtin clang support

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: edd695b032ba3a90c3bb07d934500b2c390a61ff Gitweb: http://git.kernel.org/tip/edd695b032ba3a90c3bb07d934500b2c390a61ff Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:39 + Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Dec 2016 15:51:45 -0300 perf clang

[tip:perf/core] perf clang: Support compile IR to BPF object and add testcase

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: 5e08a76525b8f5e9aeb8b27d0466614abec070a9 Gitweb: http://git.kernel.org/tip/5e08a76525b8f5e9aeb8b27d0466614abec070a9 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:38 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] perf clang: Support compile IR to BPF object and add testcase

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: 5e08a76525b8f5e9aeb8b27d0466614abec070a9 Gitweb: http://git.kernel.org/tip/5e08a76525b8f5e9aeb8b27d0466614abec070a9 Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:38 + Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Dec 2016 15:51:44 -0300 perf clang

[tip:perf/core] perf clang: Allow passing CFLAGS to builtin clang

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: a9495fe9dc63bee1166772b6f10e199ef1747892 Gitweb: http://git.kernel.org/tip/a9495fe9dc63bee1166772b6f10e199ef1747892 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:36 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] perf clang: Allow passing CFLAGS to builtin clang

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: a9495fe9dc63bee1166772b6f10e199ef1747892 Gitweb: http://git.kernel.org/tip/a9495fe9dc63bee1166772b6f10e199ef1747892 Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:36 + Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Dec 2016 15:51:44 -0300 perf clang: Allow

[tip:perf/core] perf clang: Update test case to use real BPF script

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: e67d52d411c3562263735479db2efd2ebd178db9 Gitweb: http://git.kernel.org/tip/e67d52d411c3562263735479db2efd2ebd178db9 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:37 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] perf clang: Update test case to use real BPF script

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: e67d52d411c3562263735479db2efd2ebd178db9 Gitweb: http://git.kernel.org/tip/e67d52d411c3562263735479db2efd2ebd178db9 Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:37 + Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Dec 2016 15:51:44 -0300 perf clang: Update

[tip:perf/core] perf clang: Use real file system for #include

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: 77dfa84a843c0bc935a6c8664f2556573e30845f Gitweb: http://git.kernel.org/tip/77dfa84a843c0bc935a6c8664f2556573e30845f Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:35 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] perf clang: Use real file system for #include

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: 77dfa84a843c0bc935a6c8664f2556573e30845f Gitweb: http://git.kernel.org/tip/77dfa84a843c0bc935a6c8664f2556573e30845f Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:35 + Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Dec 2016 15:51:44 -0300 perf clang: Use

[tip:perf/core] perf clang: Add builtin clang support ant test case

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: 00b86691c77c6576861b82a3cfe4d609800758fe Gitweb: http://git.kernel.org/tip/00b86691c77c6576861b82a3cfe4d609800758fe Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:34 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] perf clang: Add builtin clang support ant test case

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: 00b86691c77c6576861b82a3cfe4d609800758fe Gitweb: http://git.kernel.org/tip/00b86691c77c6576861b82a3cfe4d609800758fe Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:34 + Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Dec 2016 15:51:43 -0300 perf clang: Add

[tip:perf/core] perf build: Add clang and llvm compile and linking support

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: d58ac0bf8d1e6ffbfcb0a77e459cf4737b131b75 Gitweb: http://git.kernel.org/tip/d58ac0bf8d1e6ffbfcb0a77e459cf4737b131b75 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:33 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] perf build: Add clang and llvm compile and linking support

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: d58ac0bf8d1e6ffbfcb0a77e459cf4737b131b75 Gitweb: http://git.kernel.org/tip/d58ac0bf8d1e6ffbfcb0a77e459cf4737b131b75 Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:33 + Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Dec 2016 15:51:43 -0300 perf build: Add

[tip:perf/core] tools build: Add feature detection for LLVM

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: cb40d55b595cd117ef7c1880247605875b2115e8 Gitweb: http://git.kernel.org/tip/cb40d55b595cd117ef7c1880247605875b2115e8 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:31 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] tools build: Add feature detection for LLVM

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: cb40d55b595cd117ef7c1880247605875b2115e8 Gitweb: http://git.kernel.org/tip/cb40d55b595cd117ef7c1880247605875b2115e8 Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:31 + Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Dec 2016 15:51:42 -0300 tools build: Add

[tip:perf/core] tools build: Add feature detection for clang

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: c7fb4f62e2a97bd25d555263ef501fe053edcbb6 Gitweb: http://git.kernel.org/tip/c7fb4f62e2a97bd25d555263ef501fe053edcbb6 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:32 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] tools build: Add feature detection for clang

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: c7fb4f62e2a97bd25d555263ef501fe053edcbb6 Gitweb: http://git.kernel.org/tip/c7fb4f62e2a97bd25d555263ef501fe053edcbb6 Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:32 + Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Dec 2016 15:51:43 -0300 tools build: Add

[tip:perf/core] perf llvm: Extract helpers in llvm-utils.c

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: 2bd42de0e196f89994cbae1990d2c7c5a9b6a529 Gitweb: http://git.kernel.org/tip/2bd42de0e196f89994cbae1990d2c7c5a9b6a529 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:30 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] perf llvm: Extract helpers in llvm-utils.c

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: 2bd42de0e196f89994cbae1990d2c7c5a9b6a529 Gitweb: http://git.kernel.org/tip/2bd42de0e196f89994cbae1990d2c7c5a9b6a529 Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:30 + Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Dec 2016 15:51:42 -0300 perf llvm: Extract

[tip:perf/core] perf tools: Pass context to perf hook functions

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: 8ad85e9e6fdaf996bf3ff60303ea00e696bcdd36 Gitweb: http://git.kernel.org/tip/8ad85e9e6fdaf996bf3ff60303ea00e696bcdd36 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:29 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate

[tip:perf/core] perf tools: Pass context to perf hook functions

2016-12-06 Thread tip-bot for Wang Nan
Commit-ID: 8ad85e9e6fdaf996bf3ff60303ea00e696bcdd36 Gitweb: http://git.kernel.org/tip/8ad85e9e6fdaf996bf3ff60303ea00e696bcdd36 Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:29 + Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Dec 2016 15:51:42 -0300 perf tools: Pass

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

2016-12-05 Thread Wang Nan
-by: Wang Nan <wangn...@huawei.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: He Kuang <heku...@huawei.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Joe Stringer <j...@ovn.org> Cc: Zefan Li <lize...@huawei.com> Cc:

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

2016-12-05 Thread Wang Nan
-by: Wang Nan Cc: Alexei Starovoitov Cc: Arnaldo Carvalho de Melo Cc: He Kuang Cc: Jiri Olsa Cc: Joe Stringer Cc: Zefan Li Cc: pi3or...@163.com --- tools/build/feature/Makefile | 8 ++-- tools/build/feature/test-llvm-version.cpp | 11 +++ tools/build/feature/test

[PATCH v4 05/18] perf clang: Pass CFLAGS to builtin clang

2016-12-05 Thread Wang Nan
iled: -95, try external compiler I.e. it falls back to using the external compiler. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: He Kuang <heku...@huawei.com> Cc: Jiri Olsa <jo...@kernel.

[PATCH v4 05/18] perf clang: Pass CFLAGS to builtin clang

2016-12-05 Thread Wang Nan
iled: -95, try external compiler I.e. it falls back to using the external compiler. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/util/c++/clang.cpp | 105 +++

[PATCH v4 03/18] perf clang: Cleanup clang options

2016-12-05 Thread Wang Nan
Follow Alexei's suggestion, remove "-ferror-limit=19", "-fmessage-length=127", "-vectorize-loops" and "-vectorize-slp" clang options: they are meaningless. Add comment for "-Wno-unused-value" and "-Wno-pointer-sign". Signed-off-by:

[PATCH v4 03/18] perf clang: Cleanup clang options

2016-12-05 Thread Wang Nan
Follow Alexei's suggestion, remove "-ferror-limit=19", "-fmessage-length=127", "-vectorize-loops" and "-vectorize-slp" clang options: they are meaningless. Add comment for "-Wno-unused-value" and "-Wno-pointer-sign". Signed-off-by: Wa

[PATCH v4 00/18] perf clang: Builtin clang and perfhook support

2016-12-05 Thread Wang Nan
upport dynamic linking LLVM and clang libraries. 4. Rebase to Arnaldo's newest perf/core. Wang Nan (18): perf build: Check LLVM version in feature check perf build: Support dynamic linking clang libraries perf clang: Cleanup clang options perf clang: Pass full path to builtin clang perf

[PATCH v4 00/18] perf clang: Builtin clang and perfhook support

2016-12-05 Thread Wang Nan
upport dynamic linking LLVM and clang libraries. 4. Rebase to Arnaldo's newest perf/core. Wang Nan (18): perf build: Check LLVM version in feature check perf build: Support dynamic linking clang libraries perf clang: Cleanup clang options perf clang: Pass full path to builtin clang perf

[PATCH v4 04/18] perf clang: Pass full path to builtin clang

2016-12-05 Thread Wang Nan
If clang changes its working directory, relative path passed to perf_clang__compile_bpf() becomes invalid. Before running clang, convert it to absolute path so file can be found even working directory is changed. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho d

[PATCH v4 04/18] perf clang: Pass full path to builtin clang

2016-12-05 Thread Wang Nan
If clang changes its working directory, relative path passed to perf_clang__compile_bpf() becomes invalid. Before running clang, convert it to absolute path so file can be found even working directory is changed. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc

[PATCH v4 02/18] perf build: Support dynamic linking clang libraries

2016-12-05 Thread Wang Nan
/wn/perf $ strip ~/perf $ ls -sh ~/perf 52M /home/wn/perf Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: He Kuang <heku...@huawei.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Zefan Li

[PATCH v4 02/18] perf build: Support dynamic linking clang libraries

2016-12-05 Thread Wang Nan
/wn/perf $ strip ~/perf $ ls -sh ~/perf 52M /home/wn/perf Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/Makefile.perf | 20 ++-- 1 file changed, 18 insertions(+), 2

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

2016-12-05 Thread Wang Nan
-by: Wang Nan <wangn...@huawei.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: He Kuang <heku...@huawei.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Joe Stringer <j...@ovn.org> Cc: Zefan Li <lize...@huawei.com> Cc:

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

2016-12-05 Thread Wang Nan
-by: Wang Nan Cc: Alexei Starovoitov Cc: Arnaldo Carvalho de Melo Cc: He Kuang Cc: Jiri Olsa Cc: Joe Stringer Cc: Zefan Li Cc: pi3or...@163.com --- tools/build/feature/Makefile | 8 ++-- tools/build/feature/test-llvm-version.cpp | 12 tools/build/feature/test

[PATCH v4 07/18] perf clang jit: Insignt BPF and JIT functions in a Module

2016-12-05 Thread Wang Nan
nkage like this so they won't be compiled into BPF objects. Signed-off-by: Wang Nan <wangn...@huawei.com> Acked-by: Alexei Starovoitov <a...@fb.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: He Kuang <heku...@huawei.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Zefan

[PATCH v4 16/18] perf clang: Include helpers to BPF scripts

2016-12-05 Thread Wang Nan
Automatically include some commonly used macros and struct definitions into BPF scripts. Script writers are no longer required to define 'SEC' and 'struct bpf_map_def' in each of their scripts. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com>

[PATCH v4 10/18] perf clang jit: Actually JIT and hook in bpf loader

2016-12-05 Thread Wang Nan
**/ $ perf record -e ./test.c sleep 1 Welcom to perf record [ perf record: Woken up 1 times to write data ] Goodbye, perf record [ perf record: Captured and wrote 0.014 MB perf.data ] Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carv

[PATCH v4 07/18] perf clang jit: Insignt BPF and JIT functions in a Module

2016-12-05 Thread Wang Nan
nkage like this so they won't be compiled into BPF objects. Signed-off-by: Wang Nan Acked-by: Alexei Starovoitov Cc: Arnaldo Carvalho de Melo Cc: He Kuang Cc: Jiri Olsa Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/util/c++/clang.cpp | 38 ++ tools/p

[PATCH v4 16/18] perf clang: Include helpers to BPF scripts

2016-12-05 Thread Wang Nan
Automatically include some commonly used macros and struct definitions into BPF scripts. Script writers are no longer required to define 'SEC' and 'struct bpf_map_def' in each of their scripts. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri

[PATCH v4 10/18] perf clang jit: Actually JIT and hook in bpf loader

2016-12-05 Thread Wang Nan
**/ $ perf record -e ./test.c sleep 1 Welcom to perf record [ perf record: Woken up 1 times to write data ] Goodbye, perf record [ perf record: Captured and wrote 0.014 MB perf.data ] Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov

[PATCH v4 17/18] perf clang builtin: Define hook helpers by default

2016-12-05 Thread Wang Nan
Append declarations of helpers to default include file. All functions appear in exported_funcs array should be declared here except test__clang_callback, because it is used for perf test only. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com>

[PATCH v4 18/18] perf clang jit: Export getpid() to perf hook

2016-12-05 Thread Wang Nan
After this patch perf hooks can retrive pid of perf itself by calling getpid. It is important for excluding event from perf. This commit is also an example to show how to export more helpers to hooked script. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho d

[PATCH v4 11/18] perf clang jit: Collect the lowest address in maps section as map_base

2016-12-05 Thread Wang Nan
During jitting, find the lowest address in maps section and store its value to _map_base. Pass its value out through perf_clang__compile_bpf(). map_base is useful for jitted functions accessing BPF maps. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@r

[PATCH v4 17/18] perf clang builtin: Define hook helpers by default

2016-12-05 Thread Wang Nan
Append declarations of helpers to default include file. All functions appear in exported_funcs array should be declared here except test__clang_callback, because it is used for perf test only. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri

[PATCH v4 18/18] perf clang jit: Export getpid() to perf hook

2016-12-05 Thread Wang Nan
After this patch perf hooks can retrive pid of perf itself by calling getpid. It is important for excluding event from perf. This commit is also an example to show how to export more helpers to hooked script. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He

[PATCH v4 11/18] perf clang jit: Collect the lowest address in maps section as map_base

2016-12-05 Thread Wang Nan
During jitting, find the lowest address in maps section and store its value to _map_base. Pass its value out through perf_clang__compile_bpf(). map_base is useful for jitted functions accessing BPF maps. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang

[PATCH v4 08/18] perf clang jit: add PerfModule::doJIT to JIT perfhook functions

2016-12-05 Thread Wang Nan
right after jitted because bpf_object is unavailable during jitting but it should be the context of jitted functions. Signed-off-by: Wang Nan <wangn...@huawei.com> Acked-by: Alexei Starovoitov <a...@fb.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: He Kuang <heku...

[PATCH v4 09/18] perf clang jit: Export functions for jitted code

2016-12-05 Thread Wang Nan
After this patch functions attached on perf hooks is allowed to invoke external functions. Add a testcase for this feature. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: He Kuang <heku...

[PATCH v4 12/18] perf clang jit: Retrive fd of BPF map from its offset

2016-12-05 Thread Wang Nan
bpf__map_fd() is introduced to retrive fd of a BPF map through its offset in BPF object. This function is going be used in further commits which allow scripts jitted by builtin clang access BPF maps. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redha

[PATCH v4 06/18] perf clang jit: Wrap llvm::Module using PerfModule

2016-12-05 Thread Wang Nan
Use PerfModule wrap llvm::Module and return perf::PerfModule in APIs to replace llvm::Module. Following commits are going to add new functions to PerfModule. getBPFObjectFromModule is merged to a method of perf::PerfModule. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carva

[PATCH v4 12/18] perf clang jit: Retrive fd of BPF map from its offset

2016-12-05 Thread Wang Nan
bpf__map_fd() is introduced to retrive fd of a BPF map through its offset in BPF object. This function is going be used in further commits which allow scripts jitted by builtin clang access BPF maps. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc

[PATCH v4 06/18] perf clang jit: Wrap llvm::Module using PerfModule

2016-12-05 Thread Wang Nan
Use PerfModule wrap llvm::Module and return perf::PerfModule in APIs to replace llvm::Module. Following commits are going to add new functions to PerfModule. getBPFObjectFromModule is merged to a method of perf::PerfModule. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei

[PATCH v4 08/18] perf clang jit: add PerfModule::doJIT to JIT perfhook functions

2016-12-05 Thread Wang Nan
right after jitted because bpf_object is unavailable during jitting but it should be the context of jitted functions. Signed-off-by: Wang Nan Acked-by: Alexei Starovoitov Cc: Arnaldo Carvalho de Melo Cc: He Kuang Cc: Jiri Olsa Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/tests/bpf

[PATCH v4 09/18] perf clang jit: Export functions for jitted code

2016-12-05 Thread Wang Nan
After this patch functions attached on perf hooks is allowed to invoke external functions. Add a testcase for this feature. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/tests/Build

[PATCH v4 15/18] perf clang: Declare BPF functions for BPF scripts automatically

2016-12-05 Thread Wang Nan
defined, and keep undefined when using external clang. Passing a -UBUILTIN_CLANG_DEFAULT_INCLUDE to cancel this defaudefinition. Test cases are updated to avoid redefinition of these functions. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com>

[PATCH v4 15/18] perf clang: Declare BPF functions for BPF scripts automatically

2016-12-05 Thread Wang Nan
defined, and keep undefined when using external clang. Passing a -UBUILTIN_CLANG_DEFAULT_INCLUDE to cancel this defaudefinition. Test cases are updated to avoid redefinition of these functions. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa

[PATCH v4 13/18] perf clang jit: Allow jitted perf hook access BPF maps

2016-12-05 Thread Wang Nan
/ $ sudo perf record -e ./test.c echo Hehe Welcom to perf record Hehe [ perf record: Woken up 1 times to write data ] Goodbye, perf record, value=10644 [ perf record: Captured and wrote 0.014 MB perf.data ] Signed-off-by: Wang Nan <

[PATCH v4 14/18] perf clang: Link BPF functions declaration into perf

2016-12-05 Thread Wang Nan
, that script is fragile so not included by this commit. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: He Kuang <heku...@huawei.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Zefan Li

[PATCH v4 13/18] perf clang jit: Allow jitted perf hook access BPF maps

2016-12-05 Thread Wang Nan
/ $ sudo perf record -e ./test.c echo Hehe Welcom to perf record Hehe [ perf record: Woken up 1 times to write data ] Goodbye, perf record, value=10644 [ perf record: Captured and wrote 0.014 MB perf.data ] Signed-off-by: Wang Nan Acked-by: Alexe

[PATCH v4 14/18] perf clang: Link BPF functions declaration into perf

2016-12-05 Thread Wang Nan
, that script is fragile so not included by this commit. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/util/c++/Build| 1 + tools/perf/util/c++/bpf-funcs-str.c | 49

[tip:perf/core] tools lib bpf: Retrive bpf_map through offset of bpf_map_def

2016-12-02 Thread tip-bot for Wang Nan
Commit-ID: 5a6acad17d2e81765dd4c2fce7346a6f045eab25 Gitweb: http://git.kernel.org/tip/5a6acad17d2e81765dd4c2fce7346a6f045eab25 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:27 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate:

[tip:perf/core] tools lib bpf: Retrive bpf_map through offset of bpf_map_def

2016-12-02 Thread tip-bot for Wang Nan
Commit-ID: 5a6acad17d2e81765dd4c2fce7346a6f045eab25 Gitweb: http://git.kernel.org/tip/5a6acad17d2e81765dd4c2fce7346a6f045eab25 Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:27 + Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 29 Nov 2016 12:10:19 -0300 tools lib bpf

[tip:perf/core] perf tools: Introduce perf hooks

2016-12-02 Thread tip-bot for Wang Nan
Commit-ID: a074865e60edd762b99ec5dacec69b406f702e66 Gitweb: http://git.kernel.org/tip/a074865e60edd762b99ec5dacec69b406f702e66 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:28 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate:

[tip:perf/core] perf tools: Introduce perf hooks

2016-12-02 Thread tip-bot for Wang Nan
Commit-ID: a074865e60edd762b99ec5dacec69b406f702e66 Gitweb: http://git.kernel.org/tip/a074865e60edd762b99ec5dacec69b406f702e66 Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:28 + Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 29 Nov 2016 12:13:27 -0300 perf tools

[tip:perf/core] tools lib bpf: Add missing BPF functions

2016-12-02 Thread tip-bot for Wang Nan
Commit-ID: 9742da0150788e6ea7796372c3e643f876a49741 Gitweb: http://git.kernel.org/tip/9742da0150788e6ea7796372c3e643f876a49741 Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:25 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate:

[tip:perf/core] tools lib bpf: Add missing BPF functions

2016-12-02 Thread tip-bot for Wang Nan
Commit-ID: 9742da0150788e6ea7796372c3e643f876a49741 Gitweb: http://git.kernel.org/tip/9742da0150788e6ea7796372c3e643f876a49741 Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:25 + Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 29 Nov 2016 12:09:36 -0300 tools lib bpf

[tip:perf/core] tools lib bpf: Add private field for bpf_object

2016-12-02 Thread tip-bot for Wang Nan
Commit-ID: 10931d2413478239bdceac5546cce85d7a497a4e Gitweb: http://git.kernel.org/tip/10931d2413478239bdceac5546cce85d7a497a4e Author: Wang Nan <wangn...@huawei.com> AuthorDate: Sat, 26 Nov 2016 07:03:26 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate:

[tip:perf/core] tools lib bpf: Add private field for bpf_object

2016-12-02 Thread tip-bot for Wang Nan
Commit-ID: 10931d2413478239bdceac5546cce85d7a497a4e Gitweb: http://git.kernel.org/tip/10931d2413478239bdceac5546cce85d7a497a4e Author: Wang Nan AuthorDate: Sat, 26 Nov 2016 07:03:26 + Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 29 Nov 2016 12:09:41 -0300 tools lib bpf

[PATCH v3 26/30 - cleanup] perf clang: Link BPF functions declaration into perf

2016-11-30 Thread Wang Nan
, that script is fragile so not included by this commit. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: He Kuang <heku...@huawei.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Zefan Li

[PATCH v3 26/30 - cleanup] perf clang: Link BPF functions declaration into perf

2016-11-30 Thread Wang Nan
, that script is fragile so not included by this commit. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/util/c++/Build| 1 + tools/perf/util/c++/bpf-funcs-str.c | 49

[PATCH v3 08/30] tools build: Add feature detection for clang

2016-11-25 Thread Wang Nan
libraries ordering, use --start-group and --end-group. In this test case, manually identify required clang libs and hope it to be stable. Putting all clang libraries here is possible (use make's wildcard), but then feature checking becomes very slow. Signed-off-by: Wang Nan <wangn...@huawei.

[PATCH v3 05/30] perf tools: Pass context to perf hook functions

2016-11-25 Thread Wang Nan
Pass a pointer to perf hook functions so they receive context information created durnig setup. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: He Kuang <heku...@huawei.com> Cc: Jiri Ol

[PATCH v3 15/30] perf clang: Compile BPF script use builtin clang support

2016-11-25 Thread Wang Nan
e.c >> ./test.c $ ./perf record -v --dry-run -e ./test.c 2>&1 | grep builtin bpf: builtin compiling successful Can't pass cflags so unable to include kernel headers now. Will be fixed by following commits. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Alexei Starovoitov <

[PATCH v3 00/30] perf clang: Builtin clang and perfhook support

2016-11-25 Thread Wang Nan
syscall 293 count: 2 syscall 8 count: 7 syscall 11count: 763 syscall 4 count: 43 syscall 21count: 48 syscall 86count: 1 syscall 5 count: 791 ... Wang Nan (30): tools lib bpf: Add missing BPF functions tools lib bpf: Add private field for bpf_object

[PATCH v3 22/30] perf clang jit: Actually JIT and hook in bpf loader

2016-11-25 Thread Wang Nan
**/ $ perf record -e ./test.c sleep 1 Welcom to perf record [ perf record: Woken up 1 times to write data ] Goodbye, perf record [ perf record: Captured and wrote 0.014 MB perf.data ] Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carv

[PATCH v3 15/30] perf clang: Compile BPF script use builtin clang support

2016-11-25 Thread Wang Nan
e.c >> ./test.c $ ./perf record -v --dry-run -e ./test.c 2>&1 | grep builtin bpf: builtin compiling successful Can't pass cflags so unable to include kernel headers now. Will be fixed by following commits. Signed-off-by: Wang Nan Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa

[PATCH v3 00/30] perf clang: Builtin clang and perfhook support

2016-11-25 Thread Wang Nan
syscall 293 count: 2 syscall 8 count: 7 syscall 11count: 763 syscall 4 count: 43 syscall 21count: 48 syscall 86count: 1 syscall 5 count: 791 ... Wang Nan (30): tools lib bpf: Add missing BPF functions tools lib bpf: Add private field for bpf_object

[PATCH v3 22/30] perf clang jit: Actually JIT and hook in bpf loader

2016-11-25 Thread Wang Nan
**/ $ perf record -e ./test.c sleep 1 Welcom to perf record [ perf record: Woken up 1 times to write data ] Goodbye, perf record [ perf record: Captured and wrote 0.014 MB perf.data ] Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov

[PATCH v3 08/30] tools build: Add feature detection for clang

2016-11-25 Thread Wang Nan
libraries ordering, use --start-group and --end-group. In this test case, manually identify required clang libs and hope it to be stable. Putting all clang libraries here is possible (use make's wildcard), but then feature checking becomes very slow. Signed-off-by: Wang Nan Cc: Alexei Starovoitov

[PATCH v3 05/30] perf tools: Pass context to perf hook functions

2016-11-25 Thread Wang Nan
Pass a pointer to perf hook functions so they receive context information created durnig setup. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/tests/perf-hooks.c | 14

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

2016-11-25 Thread Wang Nan
-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: He Kuang <heku...@huawei.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Zefan Li <lize...@huawei.com> Cc: pi3or...@163.com --- tools/perf/tests/Build

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

2016-11-25 Thread Wang Nan
-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c| 9 tools/perf/tests/clang.c | 42 + tools/perf/tests

[PATCH v3 25/30] perf clang jit: Allow jitted perf hook access BPF maps

2016-11-25 Thread Wang Nan
/ $ sudo perf record -e ./test.c echo Hehe Welcom to perf record Hehe [ perf record: Woken up 1 times to write data ] Goodbye, perf record, value=10644 [ perf record: Captured and wrote 0.014 MB perf.data ] Signed-off-by: Wang Nan <wangn...@h

[PATCH v3 25/30] perf clang jit: Allow jitted perf hook access BPF maps

2016-11-25 Thread Wang Nan
/ $ sudo perf record -e ./test.c echo Hehe Welcom to perf record Hehe [ perf record: Woken up 1 times to write data ] Goodbye, perf record, value=10644 [ perf record: Captured and wrote 0.014 MB perf.data ] Signed-off-by: Wang Nan Cc: Arnal

[PATCH v3 29/30] perf clang builtin: Define hook helpers by default

2016-11-25 Thread Wang Nan
Append declarations of helpers to default include file. All functions appear in exported_funcs array should be declared here except test__clang_callback, because it is used for perf test only. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com>

[PATCH v3 18/30] perf clang jit: Wrap llvm::Module using PerfModule

2016-11-25 Thread Wang Nan
Use PerfModule wrap llvm::Module and return perf::PerfModule in APIs to replace llvm::Module. Following commits are going to add new functions to PerfModule. getBPFObjectFromModule is merged to a method of perf::PerfModule. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carva

[PATCH v3 12/30] perf clang: Allow passing CFLAGS to builtin clang

2016-11-25 Thread Wang Nan
Improve getModuleFromSource() API to accept a cflags list. This feature will be used to pass LINUX_VERSION_CODE and -I flags. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: He Kuang <heku...@huawei.com> Cc: Jiri Olsa <jo...@kernel.or

[PATCH v3 28/30] perf clang: Include helpers to BPF scripts

2016-11-25 Thread Wang Nan
Automatically include some commonly used macros and struct definitions into BPF scripts. Script writers are no longer required to define 'SEC' and 'struct bpf_map_def' in each of their scripts. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com>

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

2016-11-25 Thread Wang Nan
right after jitted because bpf_object is unavailable during jitting but it should be the context of jitted functions. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: He Kuang <heku...@huaw

[PATCH v3 26/30] perf clang: Link BPF functions declaration into perf

2016-11-25 Thread Wang Nan
by a BUILTIN_CLANG_NO_DEFAULT_INCLUDE. This macro will be used by following commits to allow user disable this and other builtin includes. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Alexei Starovoitov <a...@fb.com> Cc: He Kuang <heku...@huawei.c

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