Skip to content

Commit 673d659

Browse files
zpp0acmel
authored andcommitted
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 <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 54bf53b commit 673d659

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/perf/builtin-kvm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
13581358
}
13591359
kvm->session->evlist = kvm->evlist;
13601360
perf_session__set_id_hdr_size(kvm->session);
1361+
ordered_events__set_copy_on_queue(&kvm->session->ordered_events, true);
13611362
machine__synthesize_threads(&kvm->session->machines.host, &kvm->opts.target,
13621363
kvm->evlist->threads, false);
13631364
err = kvm_live_open_events(kvm);

0 commit comments

Comments
 (0)