On 2016/1/25 17:56, Wang Nan wrote:
Reading from a overwrite ring buffer is unrelible. perf_evsel__pause()
should be called before reading from them.
Toggel overwrite_evt_paused director after receiving done or switch
output.
Signed-off-by: Wang Nan <[email protected]>
Signed-off-by: He Kuang <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Zefan Li <[email protected]>
Cc: [email protected]
---
tools/perf/builtin-record.c | 77 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
[SNIP]
+static void
+record__toggle_overwrite_evsels(struct record *rec,
+ enum overwrite_evt_state state)
+{
[SNIP]
+ rec->overwrite_evt_state = state;
+
+ if (action == NONE)
+ return;
+
+ evlist__for_each(evlist, pos) {
+ if (!pos->overwrite)
+ continue;
+ perf_evsel__pause(pos, action == PAUSE);
+ }
+}
+
This part is incorrect. We should pause ring buffers for each CPU
in a channel, not each evsel.
Already fixed at:
https://git.kernel.org/cgit/linux/kernel/git/pi3orama/linux.git/commit/?h=perf/overwrite&id=fe59d9c6621c60087ce7e6e269f2f15f152d6d71
Thank you.