Commit 673d659f5c5918b7ddbafebf1f129c9eb82973b4

Authored by Alexander Yarygin
Committed by Arnaldo Carvalho de Melo
1 parent 54bf53b1cb

perf kvm stat live: Enable events copying

Process of analyzing events caused by 2 functions: mmap_read() and
finished_round().

During mmap_read(), perf receives events from shared memory, queues
their pointers for further processing in finished_round() and notifies
the kernel that the events have been processed.

By the time when finished_round() is invoked, queued events can be
overwritten by the kernel, so the finished_round() occurs on potentially
corrupted memory.

Since there is no place where the event can be safely consumed, let's
copy events when queueing.

Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1412347212-28237-3-git-send-email-yarygin@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Showing 1 changed file with 1 additions and 0 deletions Side-by-side Diff

tools/perf/builtin-kvm.c
... ... @@ -1358,6 +1358,7 @@
1358 1358 }
1359 1359 kvm->session->evlist = kvm->evlist;
1360 1360 perf_session__set_id_hdr_size(kvm->session);
  1361 + ordered_events__set_copy_on_queue(&kvm->session->ordered_events, true);
1361 1362 machine__synthesize_threads(&kvm->session->machines.host, &kvm->opts.target,
1362 1363 kvm->evlist->threads, false);
1363 1364 err = kvm_live_open_events(kvm);