Re: [PATCH 50/54] perf record: Toggle overwrite ring buffer for reading

From: Wangnan (F)
Date: Tue Jan 26 2016 - 03:27:56 EST




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 <wangnan0@xxxxxxxxxx>
Signed-off-by: He Kuang <hekuang@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Zefan Li <lizefan@xxxxxxxxxx>
Cc: pi3orama@xxxxxxx
---
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.