linux_dsm_epyc7002/tools/perf/util
Alexander Yarygin 54bf53b1cb perf session: Add option to copy events when queueing
When processing events the session code has an ordered samples queue
which is used to time-sort events coming in across multiple mmaps. At a
later point in time samples on the queue are flushed up to some
timestamp at which point the event is actually processed.

When analyzing events live (ie., record/analysis path in the same
command) there is a race that leads to corrupted events and parse errors
which cause perf to terminate. The problem is that when the event is
placed in the ordered samples queue it is only a reference to the event
which is really sitting in the mmap buffer. Even though the event is
queued for later processing the mmap tail pointer is updated which
indicates to the kernel that the event has been processed. The race is
flushing the event from the queue before it gets overwritten by some
other event. For commands trying to process events live (versus just
writing to a file) and processing a high rate of events this leads to
parse failures and perf terminates.

Examples hitting this problem are 'perf kvm stat live', especially with
nested VMs which generate 100,000+ traces per second, and a command
processing scheduling events with a high rate of context switching --
e.g., running 'perf bench sched pipe'.

This patch offers live commands an option to copy the event when it is
placed in the ordered samples queue.

Based on a patch from David Ahern <dsahern@gmail.com>

Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
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-2-git-send-email-yarygin@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-10-15 17:39:03 -03:00
..
include Revert "perf tools: Default to cpu// for events v5" 2014-10-15 16:04:33 -03:00
scripting-engines perf callchain: Move the callchain_param extern to callchain.h 2014-10-14 17:32:51 -03:00
abspath.c
alias.c
annotate.c perf symbols: Make sym->end be the first address after the symbol range 2014-10-14 17:50:58 -03:00
annotate.h
bitmap.c
build-id.c
build-id.h
cache.h
callchain.c perf tools: Introduce perf_callchain_config() 2014-09-26 12:43:24 -03:00
callchain.h perf callchain: Move the callchain_param extern to callchain.h 2014-10-14 17:32:51 -03:00
cgroup.c
cgroup.h
cloexec.c
cloexec.h
color.c
color.h
comm.c
comm.h
config.c perf tools: Fix line number in the config file error message 2014-09-26 12:45:23 -03:00
cpumap.c
cpumap.h
ctype.c
data.c
data.h
debug.c
debug.h
dso.c perf symbols: Improve DSO long names lookup speed with rbtree 2014-10-01 14:39:57 -03:00
dso.h perf symbols: Improve DSO long names lookup speed with rbtree 2014-10-01 14:39:57 -03:00
dwarf-aux.c
dwarf-aux.h
environment.c
event.c perf tools: Fix perf record as non root with kptr_restrict == 1 2014-09-26 10:51:41 -03:00
event.h perf tools: Move events_stats struct to event.h 2014-10-10 15:53:07 -03:00
evlist.c perf evlist: Fix for double free in tools/perf stat 2014-10-15 16:16:53 -03:00
evlist.h perf evlist: Refcount mmaps 2014-09-25 16:46:55 -03:00
evsel.c perf evsel: Make some exit routines static 2014-10-14 17:32:55 -03:00
evsel.h perf evsel: Make some exit routines static 2014-10-14 17:32:55 -03:00
exec_cmd.c
exec_cmd.h
generate-cmdlist.sh
header.c perf symbols: Encapsulate dsos list head into struct dsos 2014-09-30 12:11:49 -03:00
header.h
help.c
help.h
hist.c perf tools: Remove hists from evsel 2014-10-14 17:32:52 -03:00
hist.h perf tools: Remove hists from evsel 2014-10-14 17:32:52 -03:00
hweight.c
intlist.c
intlist.h
kvm-stat.h
levenshtein.c
levenshtein.h
machine.c perf machine: Add missing dsos->root rbtree root initialization 2014-10-14 17:50:44 -03:00
machine.h perf symbols: Encapsulate dsos list head into struct dsos 2014-09-30 12:11:49 -03:00
map.c perf tools: Fixup off-by-one comparision in maps__find 2014-10-14 17:50:56 -03:00
map.h
ordered-events.c perf session: Add option to copy events when queueing 2014-10-15 17:39:03 -03:00
ordered-events.h perf session: Add option to copy events when queueing 2014-10-15 17:39:03 -03:00
pager.c
parse-events.c perf tools: Parse the pmu event prefix and suffix 2014-10-15 16:05:01 -03:00
parse-events.h perf tools: Parse the pmu event prefix and suffix 2014-10-15 16:05:01 -03:00
parse-events.l perf tools: Add support to new style format of kernel PMU event 2014-10-15 16:05:45 -03:00
parse-events.y perf tools: Add support to new style format of kernel PMU event 2014-10-15 16:05:45 -03:00
parse-options.c
parse-options.h
path.c
perf_regs.c
perf_regs.h
PERF-VERSION-GEN
pmu.c perf tools: Parse the pmu event prefix and suffix 2014-10-15 16:05:01 -03:00
pmu.h perf tools: Parse the pmu event prefix and suffix 2014-10-15 16:05:01 -03:00
pmu.l
pmu.y
probe-event.c perf symbols: Encapsulate dsos list head into struct dsos 2014-09-30 12:11:49 -03:00
probe-event.h
probe-finder.c
probe-finder.h
pstack.c
pstack.h
python-ext-sources
python.c tools lib api: Adopt fdarray class from perf's evlist 2014-09-25 16:46:55 -03:00
quote.c
quote.h
rblist.c
rblist.h
record.c
run-command.c
run-command.h
session.c perf session: Add option to copy events when queueing 2014-10-15 17:39:03 -03:00
session.h perf session: Remove last reference to hists struct 2014-10-14 11:41:25 -03:00
setup.py
sigchain.c
sigchain.h
sort.c perf evsel: Add hists helper 2014-10-09 13:13:41 -03:00
sort.h
srcline.c
stat.c
stat.h
strbuf.c
strbuf.h
strfilter.c
strfilter.h
string.c Revert "perf tools: Default to cpu// for events v5" 2014-10-15 16:04:33 -03:00
strlist.c
strlist.h
svghelper.c
svghelper.h
symbol-elf.c perf symbols: Encapsulate dsos list head into struct dsos 2014-09-30 12:11:49 -03:00
symbol-minimal.c
symbol.c perf symbols: Make sym->end be the first address after the symbol range 2014-10-14 17:50:58 -03:00
symbol.h perf symbols: Make sym->end be the first address after the symbol range 2014-10-14 17:50:58 -03:00
target.c
target.h
thread_map.c perf thread_map: Create dummy constructor out of open coded equivalent 2014-10-14 17:32:52 -03:00
thread_map.h perf thread_map: Create dummy constructor out of open coded equivalent 2014-10-14 17:32:52 -03:00
thread.c perf callchain: Create an address space per thread 2014-10-15 17:38:23 -03:00
thread.h
tool.h
top.c
top.h
trace-event-info.c
trace-event-parse.c
trace-event-read.c
trace-event-scripting.c
trace-event.c
trace-event.h
tsc.c
tsc.h
unwind-libdw.c
unwind-libdw.h
unwind-libunwind.c perf callchain: Create an address space per thread 2014-10-15 17:38:23 -03:00
unwind.h perf callchain: Create an address space per thread 2014-10-15 17:38:23 -03:00
usage.c
util.c perf callchain: Move callchain_param to util object in to fix python test 2014-10-03 09:39:48 -03:00
util.h
values.c
values.h
vdso.c
vdso.h
wrapper.c
xyarray.c
xyarray.h