[tip:perf/urgent] perf evsel: Add overwrite attribute and check write_backward

2016-05-23 Thread tip-bot for Wang Nan
Commit-ID: b90dc17a5d14a881f9bb3b58edb3d71075d58afb Gitweb: http://git.kernel.org/tip/b90dc17a5d14a881f9bb3b58edb3d71075d58afb Author: Wang Nan <wangn...@huawei.com> AuthorDate: Fri, 20 May 2016 16:38:23 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate:

[tip:perf/urgent] perf evsel: Add overwrite attribute and check write_backward

2016-05-23 Thread tip-bot for Wang Nan
Commit-ID: b90dc17a5d14a881f9bb3b58edb3d71075d58afb Gitweb: http://git.kernel.org/tip/b90dc17a5d14a881f9bb3b58edb3d71075d58afb Author: Wang Nan AuthorDate: Fri, 20 May 2016 16:38:23 + Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 20 May 2016 14:54:23 -0300 perf evsel: Add

[tip:perf/urgent] perf evsel: Record fd into perf_mmap

2016-05-23 Thread tip-bot for Wang Nan
Commit-ID: d4c6fb36ac2c82f8f0c05b04cf102dcdc2d5a14d Gitweb: http://git.kernel.org/tip/d4c6fb36ac2c82f8f0c05b04cf102dcdc2d5a14d Author: Wang Nan <wangn...@huawei.com> AuthorDate: Fri, 20 May 2016 16:38:24 + Committer: Arnaldo Carvalho de Melo <a...@redhat.com> CommitDate:

[tip:perf/urgent] perf evsel: Record fd into perf_mmap

2016-05-23 Thread tip-bot for Wang Nan
Commit-ID: d4c6fb36ac2c82f8f0c05b04cf102dcdc2d5a14d Gitweb: http://git.kernel.org/tip/d4c6fb36ac2c82f8f0c05b04cf102dcdc2d5a14d Author: Wang Nan AuthorDate: Fri, 20 May 2016 16:38:24 + Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 20 May 2016 14:56:58 -0300 perf evsel

[PATCH v4 3/7] perf tools: Enable overwrite settings

2016-05-23 Thread Wang Nan
and update config term array size because the longest string length is changed. For overwritable events, automatically select attr.write_backward since perf requires it to be backward for reading. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawe

[PATCH v4 3/7] perf tools: Enable overwrite settings

2016-05-23 Thread Wang Nan
and update config term array size because the longest string length is changed. For overwritable events, automatically select attr.write_backward since perf requires it to be backward for reading. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc

[PATCH v4 1/7] perf evlist: Introduce aux perf evlist

2016-05-23 Thread Wang Nan
o 'struct perf_evlist' and points to the evlist itself for normal evlists. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@

[PATCH v4 1/7] perf evlist: Introduce aux perf evlist

2016-05-23 Thread Wang Nan
o 'struct perf_evlist' and points to the evlist itself for normal evlists. Signed-off-by: Wang Nan Cc: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/util/evlist.c | 31 +-- tools/

[PATCH v4 0/7] perf tools: Support overwritable ring buffer

2016-05-23 Thread Wang Nan
e. v3 -> v4: Update commit message to describe auxiliary evlist more clearly. Wang Nan (7): perf evlist: Introduce aux perf evlist perf tools: Don't poll and mmap overwritable events perf tools: Enable overwrite settings perf record: Introduce rec->overwrite_evlist for overwritable e

[PATCH v4 0/7] perf tools: Support overwritable ring buffer

2016-05-23 Thread Wang Nan
e. v3 -> v4: Update commit message to describe auxiliary evlist more clearly. Wang Nan (7): perf evlist: Introduce aux perf evlist perf tools: Don't poll and mmap overwritable events perf tools: Enable overwrite settings perf record: Introduce rec->overwrite_evlist for overwritable e

[PATCH v4 6/7] perf tools: Don't warn about out of order event if write_backward is used

2016-05-23 Thread Wang Nan
-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com> Cc: Namhyung Kim <namhy...@kernel.org>

[PATCH v4 4/7] perf record: Introduce rec->overwrite_evlist for overwritable events

2016-05-23 Thread Wang Nan
rec->evlist or rec->overwrite_evlist. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com> Cc: Namhyung

[PATCH v4 7/7] perf tools: Check write_backward during evlist config

2016-05-23 Thread Wang Nan
: # ~/perf record -m 1 -e raw_syscalls:*/overwrite/ -a Reading from overwrite event is not supported by this kernel Error: The raw_syscalls:sys_enter event is not supported. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: He Kuang <heku...@huawei.com> Cc: Arnaldo Carv

[PATCH v4 6/7] perf tools: Don't warn about out of order event if write_backward is used

2016-05-23 Thread Wang Nan
-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/util/session.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/perf

[PATCH v4 4/7] perf record: Introduce rec->overwrite_evlist for overwritable events

2016-05-23 Thread Wang Nan
rec->evlist or rec->overwrite_evlist. Signed-off-by: Wang Nan Cc: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/builtin-record.c | 131 1 file cha

[PATCH v4 7/7] perf tools: Check write_backward during evlist config

2016-05-23 Thread Wang Nan
: # ~/perf record -m 1 -e raw_syscalls:*/overwrite/ -a Reading from overwrite event is not supported by this kernel Error: The raw_syscalls:sys_enter event is not supported. Signed-off-by: Wang Nan Cc: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim

[PATCH v4 5/7] perf record: Toggle overwrite ring buffer for reading

2016-05-23 Thread Wang Nan
uffers (3): Resume ring buffers for recording We can't avoid this complexity. Because we deliberately drop records from overwritable ring buffer, we can't detect remaining data by checking head and old pointers. Therefore, DATA_PENDING state is mandatory. Signed-off-by: Wang Nan <wangn...@h

[PATCH v4 5/7] perf record: Toggle overwrite ring buffer for reading

2016-05-23 Thread Wang Nan
uffers (3): Resume ring buffers for recording We can't avoid this complexity. Because we deliberately drop records from overwritable ring buffer, we can't detect remaining data by checking head and old pointers. Therefore, DATA_PENDING state is mandatory. Signed-off-by: Wang Nan Signed-off-by: He

[PATCH v4 2/7] perf tools: Don't poll and mmap overwritable events

2016-05-23 Thread Wang Nan
her commits will expand it when we introduce auxiliary evlists and have multiple mmaps. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami

[PATCH v4 2/7] perf tools: Don't poll and mmap overwritable events

2016-05-23 Thread Wang Nan
her commits will expand it when we introduce auxiliary evlists and have multiple mmaps. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/arch/x86/util/tsc.c | 2 ++ to

[PATCH v3 02/11] perf record: Prevent reading invalid data in record__mmap_read

2016-05-23 Thread Wang Nan
When record__mmap_read() requires data more than the size of ring buffer, drop those data to avoid accessing invalid memory. This can happen when reading from overwritable ring buffer, which should be avoided. However, check this for robustness. Signed-off-by: Wang Nan <wangn...@huawei.

[PATCH v3 02/11] perf record: Prevent reading invalid data in record__mmap_read

2016-05-23 Thread Wang Nan
When record__mmap_read() requires data more than the size of ring buffer, drop those data to avoid accessing invalid memory. This can happen when reading from overwritable ring buffer, which should be avoided. However, check this for robustness. Signed-off-by: Wang Nan Signed-off-by: He Kuang

[PATCH v3 06/11] perf tools: Don't poll and mmap overwritable events

2016-05-23 Thread Wang Nan
her commits will expand it. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com> Cc: Namhyung Kim &

[PATCH v3 04/11] perf record: Read from backward ring buffer

2016-05-23 Thread Wang Nan
Introduce rb_find_range() to find start and end position from a backward ring buffer. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hir

[PATCH v3 06/11] perf tools: Don't poll and mmap overwritable events

2016-05-23 Thread Wang Nan
her commits will expand it. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/arch/x86/util/tsc.c | 2 ++ tools/perf/builtin-record.c| 9 - tools/perf/u

[PATCH v3 04/11] perf record: Read from backward ring buffer

2016-05-23 Thread Wang Nan
Introduce rb_find_range() to find start and end position from a backward ring buffer. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/builtin-record.c | 52

[PATCH v3 09/11] perf record: Toggle overwrite ring buffer for reading

2016-05-23 Thread Wang Nan
e ring buffers for recording We can't avoid this complexity. Because we deliberately drop records from overwritable ring buffer, we can't detect remaining data by checking head and old pointers. Therefore, DATA_PENDING state is mandatory. Signed-off-by: Wang Nan <wangn...@huawei.com> Signe

[PATCH v3 07/11] perf tools: Enable overwrite settings

2016-05-23 Thread Wang Nan
and update config term array size because the longest string length is changed. For overwritable events, automatically select attr.write_backward since perf requires it to be backward for reading. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawe

[PATCH v3 03/11] perf record: Rename variable to make code clear

2016-05-23 Thread Wang Nan
change behavior since: buf = [old & md->mask]; size = head - old; old += size; <--- Here, old == head Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri

[PATCH v3 03/11] perf record: Rename variable to make code clear

2016-05-23 Thread Wang Nan
change behavior since: buf = [old & md->mask]; size = head - old; old += size; <--- Here, old == head Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com

[PATCH v3 09/11] perf record: Toggle overwrite ring buffer for reading

2016-05-23 Thread Wang Nan
e ring buffers for recording We can't avoid this complexity. Because we deliberately drop records from overwritable ring buffer, we can't detect remaining data by checking head and old pointers. Therefore, DATA_PENDING state is mandatory. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: A

[PATCH v3 07/11] perf tools: Enable overwrite settings

2016-05-23 Thread Wang Nan
and update config term array size because the longest string length is changed. For overwritable events, automatically select attr.write_backward since perf requires it to be backward for reading. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc

[PATCH v3 10/11] perf tools: Don't warn about out of order event if write_backward is used

2016-05-23 Thread Wang Nan
-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com> Cc: Namhyung Kim <namhy...@kernel.org>

[PATCH v3 10/11] perf tools: Don't warn about out of order event if write_backward is used

2016-05-23 Thread Wang Nan
-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/util/session.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/perf

[PATCH v3 00/11] perf tools: Support overwritable ring buffer

2016-05-23 Thread Wang Nan
rg> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com> Cc: Namhyung Kim <namhy...@kernel.org> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Wang Nan <wangn...@huawei.com> Cc: Zefan Li <lize...@huawei.com> Cc: pi3or...@163.com -- 1.8.3.4

[PATCH v3 00/11] perf tools: Support overwritable ring buffer

2016-05-23 Thread Wang Nan
-events.l | 2 + tools/perf/util/record.c | 17 ++ tools/perf/util/session.c| 22 +- 13 files changed, 498 insertions(+), 69 deletions(-) Cc: Arnaldo Carvalho de Melo Cc: He Kuang Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wan

[PATCH v3 11/11] perf tools: Check write_backward during evlist config

2016-05-23 Thread Wang Nan
: # ~/perf record -m 1 -e raw_syscalls:*/overwrite/ -a Reading from overwrite event is not supported by this kernel Error: The raw_syscalls:sys_enter event is not supported. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: He Kuang <heku...@huawei.com> Cc: Arnaldo Carv

[PATCH v3 11/11] perf tools: Check write_backward during evlist config

2016-05-23 Thread Wang Nan
: # ~/perf record -m 1 -e raw_syscalls:*/overwrite/ -a Reading from overwrite event is not supported by this kernel Error: The raw_syscalls:sys_enter event is not supported. Signed-off-by: Wang Nan Cc: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim

[PATCH v3 01/11] perf tools: Add API to pause/resume a evlist

2016-05-23 Thread Wang Nan
perf_evlist__toggle_{pause,resume}() are introduced to pause/resume events in an evlist. Utilize PERF_EVENT_IOC_PAUSE_OUTPUT ioctl. Following commits use them to ensure overwrite ring buffer is paused before reading. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang

[PATCH v3 08/11] perf record: Introduce rec->overwrite_evlist for overwritable events

2016-05-23 Thread Wang Nan
evlist or rec->overwrite_evlist. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com> Cc: Namhyung Kim &

[PATCH v3 01/11] perf tools: Add API to pause/resume a evlist

2016-05-23 Thread Wang Nan
perf_evlist__toggle_{pause,resume}() are introduced to pause/resume events in an evlist. Utilize PERF_EVENT_IOC_PAUSE_OUTPUT ioctl. Following commits use them to ensure overwrite ring buffer is paused before reading. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo

[PATCH v3 08/11] perf record: Introduce rec->overwrite_evlist for overwritable events

2016-05-23 Thread Wang Nan
evlist or rec->overwrite_evlist. Signed-off-by: Wang Nan Cc: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/builtin-record.c | 125 1 file cha

[PATCH v3 05/11] perf evlist: Introduce aux perf evlist

2016-05-23 Thread Wang Nan
t' in all functions in the patch of 'perf_evlist__mmap_ex', except 'evlist->mmap' related operations, to make sure all evlist modifications like pollfd and event id hash tables goes to original evlist. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: He Kuang <heku...@huawei.com> Cc:

[PATCH v3 05/11] perf evlist: Introduce aux perf evlist

2016-05-23 Thread Wang Nan
t' in all functions in the patch of 'perf_evlist__mmap_ex', except 'evlist->mmap' related operations, to make sure all evlist modifications like pollfd and event id hash tables goes to original evlist. Signed-off-by: Wang Nan Cc: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami H

[PATCH v2 02/13] perf tools: Record fd into perf_mmap

2016-05-20 Thread Wang Nan
Add a fd field into perf_mmap so perf can track fd from mmap. This feature will be used for toggling overwrite ring buffers. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa

[PATCH v2 02/13] perf tools: Record fd into perf_mmap

2016-05-20 Thread Wang Nan
Add a fd field into perf_mmap so perf can track fd from mmap. This feature will be used for toggling overwrite ring buffers. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com

[PATCH v2 12/13] perf tools: Don't warn about out of order event if write_backward is used

2016-05-20 Thread Wang Nan
-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com> Cc: Namhyung Kim <namhy...@kernel.org>

[PATCH v2 05/13] perf record: Rename variable to make code clear

2016-05-20 Thread Wang Nan
change behavior since: buf = [old & md->mask]; size = head - old; old += size; <--- Here, old == head Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri

[PATCH v2 12/13] perf tools: Don't warn about out of order event if write_backward is used

2016-05-20 Thread Wang Nan
-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/util/session.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/perf

[PATCH v2 05/13] perf record: Rename variable to make code clear

2016-05-20 Thread Wang Nan
change behavior since: buf = [old & md->mask]; size = head - old; old += size; <--- Here, old == head Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com

[PATCH v2 08/13] perf tools: Don't poll and mmap overwritable events

2016-05-20 Thread Wang Nan
her commits will expand it. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com> Cc: Namhyung Kim &

[PATCH v2 08/13] perf tools: Don't poll and mmap overwritable events

2016-05-20 Thread Wang Nan
her commits will expand it. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/arch/x86/util/tsc.c | 2 ++ tools/perf/builtin-record.c| 9 - tools/perf/u

[PATCH v2 03/13] perf tools: Add API to pause a evlist

2016-05-20 Thread Wang Nan
perf_evlist__toggle_paused() is introduced to pause/resume events in an evlist. Utilize PERF_EVENT_IOC_PAUSE_OUTPUT ioctl. Following commits use perf_evlist__toggle_paused() to ensure overwrite ring buffer is paused before reading. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-

[PATCH v2 03/13] perf tools: Add API to pause a evlist

2016-05-20 Thread Wang Nan
perf_evlist__toggle_paused() is introduced to pause/resume events in an evlist. Utilize PERF_EVENT_IOC_PAUSE_OUTPUT ioctl. Following commits use perf_evlist__toggle_paused() to ensure overwrite ring buffer is paused before reading. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo

[PATCH v2 00/13] perf tools: Support overwritable ring buffer

2016-05-20 Thread Wang Nan
.2016051323512215 -rw--- 1 root root 5135157 May 13 23:51 ./perf.data.2016051323512387 v1 -> v2: Totally redesign: drop the principle of 'channal', use auxiliary evlist instead. Fix missing documentation. Wang Nan (13): perf tools: Add overwrite attribute to evsel and ch

[PATCH v2 00/13] perf tools: Support overwritable ring buffer

2016-05-20 Thread Wang Nan
.2016051323512215 -rw--- 1 root root 5135157 May 13 23:51 ./perf.data.2016051323512387 v1 -> v2: Totally redesign: drop the principle of 'channal', use auxiliary evlist instead. Fix missing documentation. Wang Nan (13): perf tools: Add overwrite attribute to evsel and ch

[PATCH v2 07/13] perf evlist: Introduce aux perf evlist

2016-05-20 Thread Wang Nan
t' in all functions in the patch of 'perf_evlist__mmap_ex', except 'evlist->mmap' related operations, to make sure all evlist modifications like pollfd and event id hash tables goes to original evlist. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: He Kuang <heku...@huawei.com> Cc:

[PATCH v2 07/13] perf evlist: Introduce aux perf evlist

2016-05-20 Thread Wang Nan
t' in all functions in the patch of 'perf_evlist__mmap_ex', except 'evlist->mmap' related operations, to make sure all evlist modifications like pollfd and event id hash tables goes to original evlist. Signed-off-by: Wang Nan Cc: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami H

[PATCH v2 01/13] perf tools: Add overwrite attribute to evsel and check write_backward

2016-05-20 Thread Wang Nan
Add 'overwrite' attribute to evsel to mark whether this event is set overwritable. Following commits will support syntax like # perf record -e cycles/overwrite/ ... Overwritable evsel require kernel support write_backward. Add it to perf_missing_feature. Signed-off-by: Wang Nan <wa

[PATCH v2 01/13] perf tools: Add overwrite attribute to evsel and check write_backward

2016-05-20 Thread Wang Nan
Add 'overwrite' attribute to evsel to mark whether this event is set overwritable. Following commits will support syntax like # perf record -e cycles/overwrite/ ... Overwritable evsel require kernel support write_backward. Add it to perf_missing_feature. Signed-off-by: Wang Nan Cc: He Kuang

[PATCH v2 11/13] perf record: Toggle overwrite ring buffer for reading

2016-05-20 Thread Wang Nan
e ring buffers for recording We can't avoid this complexity. Because we deliberately drop records from overwritable ring buffer, we can't detect remaining data by checking head and old pointers. Therefore, DATA_PENDING state is mandatory. Signed-off-by: Wang Nan <wangn...@huawei.com> Signe

[PATCH v2 09/13] perf tools: Enable overwrite settings

2016-05-20 Thread Wang Nan
and update config term array size because the longest string length is changed. For overwritable events, automatically select attr.write_backward since perf requires it to be backward for reading. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawe

[PATCH v2 11/13] perf record: Toggle overwrite ring buffer for reading

2016-05-20 Thread Wang Nan
e ring buffers for recording We can't avoid this complexity. Because we deliberately drop records from overwritable ring buffer, we can't detect remaining data by checking head and old pointers. Therefore, DATA_PENDING state is mandatory. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: A

[PATCH v2 09/13] perf tools: Enable overwrite settings

2016-05-20 Thread Wang Nan
and update config term array size because the longest string length is changed. For overwritable events, automatically select attr.write_backward since perf requires it to be backward for reading. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc

[PATCH v2 13/13] perf tools: Check write_backward during evlist config

2016-05-20 Thread Wang Nan
: # ~/perf record -m 1 -e raw_syscalls:*/overwrite/ -a Reading from overwrite event is not supported by this kernel Error: The raw_syscalls:sys_enter event is not supported. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: He Kuang <heku...@huawei.com> Cc: Arnaldo Carv

[PATCH v2 10/13] perf record: Introduce rec->overwrite_evlist for overwritable events

2016-05-20 Thread Wang Nan
evlist or rec->overwrite_evlist. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com> Cc: Namhyung Kim &

[PATCH v2 13/13] perf tools: Check write_backward during evlist config

2016-05-20 Thread Wang Nan
: # ~/perf record -m 1 -e raw_syscalls:*/overwrite/ -a Reading from overwrite event is not supported by this kernel Error: The raw_syscalls:sys_enter event is not supported. Signed-off-by: Wang Nan Cc: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim

[PATCH v2 10/13] perf record: Introduce rec->overwrite_evlist for overwritable events

2016-05-20 Thread Wang Nan
evlist or rec->overwrite_evlist. Signed-off-by: Wang Nan Cc: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/builtin-record.c | 125 1 file cha

[PATCH v2 06/13] perf record: Read from backward ring buffer

2016-05-20 Thread Wang Nan
Introduce rb_find_range() to find start and end position from a backward ring buffer. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hir

[PATCH v2 06/13] perf record: Read from backward ring buffer

2016-05-20 Thread Wang Nan
Introduce rb_find_range() to find start and end position from a backward ring buffer. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/builtin-record.c | 52

[PATCH v2 04/13] perf record: Prevent reading invalid data in record__mmap_read

2016-05-20 Thread Wang Nan
When record__mmap_read() requires data more than the size of ring buffer, drop those data to avoid accessing invalid memory. This can happen when reading from overwritable ring buffer, which should be avoided. However, check this for robustness. Signed-off-by: Wang Nan <wangn...@huawei.

[PATCH v2 04/13] perf record: Prevent reading invalid data in record__mmap_read

2016-05-20 Thread Wang Nan
When record__mmap_read() requires data more than the size of ring buffer, drop those data to avoid accessing invalid memory. This can happen when reading from overwritable ring buffer, which should be avoided. However, check this for robustness. Signed-off-by: Wang Nan Signed-off-by: He Kuang

[PATCH 06/17] perf tools: Squash overwrite setting into channel

2016-05-13 Thread Wang Nan
. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com> Cc: Namhyung Kim <namhy...@kernel.org>

[PATCH 03/17] perf tools: Automatically add new channel according to evlist

2016-05-13 Thread Wang Nan
perf_evlist__channel_find() can be used to find a proper channel based on propreties of a evsel. If the channel doesn't exist, it can create new one for it. After this patch there's no need to create default channel explicitly. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He

[PATCH 06/17] perf tools: Squash overwrite setting into channel

2016-05-13 Thread Wang Nan
. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/builtin-record.c | 2 +- tools/perf/util/evlist.c| 43 --- tools/perf

[PATCH 03/17] perf tools: Automatically add new channel according to evlist

2016-05-13 Thread Wang Nan
perf_evlist__channel_find() can be used to find a proper channel based on propreties of a evsel. If the channel doesn't exist, it can create new one for it. After this patch there's no need to create default channel explicitly. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo

[PATCH 04/17] perf tools: Operate multiple channels

2016-05-13 Thread Wang Nan
Before this patch perf operates on only the first channel. Make perf mmap and read from multiple channels. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@k

[PATCH 04/17] perf tools: Operate multiple channels

2016-05-13 Thread Wang Nan
Before this patch perf operates on only the first channel. Make perf mmap and read from multiple channels. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf

[PATCH 02/17] perf tools: Add evlist channel helpers

2016-05-13 Thread Wang Nan
ing that function nr_mmaps mmaps for each channel are allocated together as a big array. perf_evlist__channel_idx() converts index in the big array and the channel number. For API functions which accept idx, _ex() versions are introduced to accept selecting an mmap from a channel. Signed-off-by: Wang

[PATCH 02/17] perf tools: Add evlist channel helpers

2016-05-13 Thread Wang Nan
ing that function nr_mmaps mmaps for each channel are allocated together as a big array. perf_evlist__channel_idx() converts index in the big array and the channel number. For API functions which accept idx, _ex() versions are introduced to accept selecting an mmap from a channel. Signed-off-by: Wang

[PATCH 14/17] perf record: Rename variable to make code clear

2016-05-13 Thread Wang Nan
change behavior since: buf = [old & md->mask]; size = head - old; old += size; <--- Here, old == head Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri

[PATCH 14/17] perf record: Rename variable to make code clear

2016-05-13 Thread Wang Nan
change behavior since: buf = [old & md->mask]; size = head - old; old += size; <--- Here, old == head Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com

[PATCH 12/17] perf tools: Record fd into perf_mmap

2016-05-13 Thread Wang Nan
Add a fd field into perf_mmap so perf can track fd from mmap. This feature will be used for toggling overwrite ring buffers. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa

[PATCH 17/17] perf tools: Don't warn about out of order event if write_backward is used

2016-05-13 Thread Wang Nan
-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@hitachi.com> Cc: Namhyung Kim <namhy...@kernel.org>

[PATCH 12/17] perf tools: Record fd into perf_mmap

2016-05-13 Thread Wang Nan
Add a fd field into perf_mmap so perf can track fd from mmap. This feature will be used for toggling overwrite ring buffers. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com

[PATCH 17/17] perf tools: Don't warn about out of order event if write_backward is used

2016-05-13 Thread Wang Nan
-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/util/session.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/perf

[PATCH 11/17] perf tools: Set write_backward attribut bit for overwrite events

2016-05-13 Thread Wang Nan
nly mmap users (most of them are in perf/tests). Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Jiri Olsa <jo...@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu...@hitach

[PATCH 16/17] perf record: Toggle overwrite ring buffer for reading

2016-05-13 Thread Wang Nan
Reading from a overwrite ring buffer is unrelible. perf_evlist__channel_toggle_paused() should be called before reading from them. Toggel overwrite_evt_paused director after receiving done or switch output. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@h

[PATCH 11/17] perf tools: Set write_backward attribut bit for overwrite events

2016-05-13 Thread Wang Nan
nly mmap users (most of them are in perf/tests). Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/builtin-record.c | 7 +++ tools/perf/util/evlist.c|

[PATCH 16/17] perf record: Toggle overwrite ring buffer for reading

2016-05-13 Thread Wang Nan
Reading from a overwrite ring buffer is unrelible. perf_evlist__channel_toggle_paused() should be called before reading from them. Toggel overwrite_evt_paused director after receiving done or switch output. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri

[PATCH 08/17] perf record: Don't poll on overwrite channel

2016-05-13 Thread Wang Nan
There's no need to receive events from overwritable ring buffer. Instead, perf should make them run background until something happen. This patch makes normal events from overwrite ring buffer ignored. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawe

[PATCH 08/17] perf record: Don't poll on overwrite channel

2016-05-13 Thread Wang Nan
There's no need to receive events from overwritable ring buffer. Instead, perf should make them run background until something happen. This patch makes normal events from overwrite ring buffer ignored. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa

[PATCH 00/17] perf tools: Support overwritable ring buffer

2016-05-13 Thread Wang Nan
.2016051323512215 -rw--- 1 root root 5135157 May 13 23:51 ./perf.data.2016051323512387 Wang Nan (17): perf tools: Extract __perf_evlist__mmap_read() perf tools: Add evlist channel helpers perf tools: Automatically add new channel according to evlist perf tools: Operate multiple channels

[PATCH 07/17] perf record: Don't read from and poll overwrite channel

2016-05-13 Thread Wang Nan
Reading from overwritable ring buffer is unreliable. Introduce record__mmap_should_read() and prevent reading from such ring buffers in 'perf record'. The rule in record__mmap_should_read() will be changed when perf support reading from backward writing ring buffer. Signed-off-by: Wang Nan <wa

[PATCH 09/17] perf tools: Detect avalibility of write_backward

2016-05-13 Thread Wang Nan
Detect avalibility of write_backward and save the result into record_opts. With write_backward the start pointer of a ring buffer mapped read only can be found reliably. Signed-off-by: Wang Nan <wangn...@huawei.com> Signed-off-by: He Kuang <heku...@huawei.com> Cc: Arnaldo Carv

[PATCH 00/17] perf tools: Support overwritable ring buffer

2016-05-13 Thread Wang Nan
.2016051323512215 -rw--- 1 root root 5135157 May 13 23:51 ./perf.data.2016051323512387 Wang Nan (17): perf tools: Extract __perf_evlist__mmap_read() perf tools: Add evlist channel helpers perf tools: Automatically add new channel according to evlist perf tools: Operate multiple channels

[PATCH 07/17] perf record: Don't read from and poll overwrite channel

2016-05-13 Thread Wang Nan
Reading from overwritable ring buffer is unreliable. Introduce record__mmap_should_read() and prevent reading from such ring buffers in 'perf record'. The rule in record__mmap_should_read() will be changed when perf support reading from backward writing ring buffer. Signed-off-by: Wang Nan

[PATCH 09/17] perf tools: Detect avalibility of write_backward

2016-05-13 Thread Wang Nan
Detect avalibility of write_backward and save the result into record_opts. With write_backward the start pointer of a ring buffer mapped read only can be found reliably. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Masami Hiramatsu Cc

[PATCH 01/17] perf tools: Extract __perf_evlist__mmap_read()

2016-05-13 Thread Wang Nan
Extract event reader to __perf_evlist__mmap_read(). Future commit will feed it with manually computed 'head' and 'old' pointers. Signed-off-by: Wang Nan <wangn...@huawei.com> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Zefan Li &

[PATCH 01/17] perf tools: Extract __perf_evlist__mmap_read()

2016-05-13 Thread Wang Nan
Extract event reader to __perf_evlist__mmap_read(). Future commit will feed it with manually computed 'head' and 'old' pointers. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo Cc: Peter Zijlstra Cc: Zefan Li Cc: pi3or...@163.com --- tools/perf/util/evlist.c | 10 +- 1 file

<    5   6   7   8   9   10   11   12   13   14   >