linux/tools/perf/util
Arnaldo Carvalho de Melo 1be300f4cc perf tools: Make the mmap length autotuning more robust
If /proc/sys/kernel/perf_event_mlock_kb is not (power of 2 + PAGE_SIZE_in_kb)
and we let the perf tools do mmap length autosizing based on that, then, for
non-CAP_IPC_LOCK users when /proc/sys/kernel/perf_event_paranoid is > -1, then
we get an -EINVAL that ends up in:

  [acme@ssdandy linux]$ trace usleep 1
  Invalid argument
  [acme@ssdandy linux]$ perf record usleep 1
  failed to mmap with 22 (Invalid argument)

After this fix:

  [acme@ssdandy linux]$ trace usleep 1
  <SNIP>
   0.806 ( 0.006 ms): munmap(addr: 0x7f7e4740a000, len: 66467) = 0
   0.869 ( 0.002 ms): brk(                                   ) = 0x7bb000
   0.873 ( 0.003 ms): brk(brk: 0x7dc000                      ) = 0x7dc000
   0.877 ( 0.001 ms): brk(                                   ) = 0x7dc000
   0.953 ( 0.058 ms): nanosleep(rqtp: 0x7fff26ab9420         ) = 0
   0.959 ( 0.000 ms): exit_group(
  [acme@ssdandy linux]$ perf record usleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.017 MB perf.data (~759 samples) ]
  [acme@ssdandy linux]$

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-6p6l5ou6jev6o7ymc4nn1n2a@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-12-17 11:58:14 -03:00
..
include tools: Move bitops.h from tools/perf/util to tools/ 2014-12-17 11:17:53 -03:00
scripting-engines perf script python: Removing event cache as it's no longer needed 2014-11-06 17:44:06 -03:00
abspath.c
alias.c perf tools: Introduce zfree 2013-12-27 15:17:00 -03:00
annotate.c perf callchain: Make get_srcline fall back to sym+offset 2014-11-24 18:03:47 -03:00
annotate.h perf annotate: Support source line numbers in annotate 2014-11-19 12:33:48 -03:00
bitmap.c perf tools: Add bitmap_or function into bitmap object 2012-02-13 23:28:10 -02:00
build-id.c perf buildid-cache: Remove extra debugdir variables 2014-12-09 09:14:34 -03:00
build-id.h perf build-id: Move disable_buildid_cache() to util/build-id.c 2014-11-19 12:33:46 -03:00
cache.h perf tools: Add perf_config_u64 function 2014-08-12 12:03:00 -03:00
callchain.c perf callchain: Fixup parameter handling error message 2014-12-09 10:06:11 -03:00
callchain.h perf callchain: Support handling complete branch stacks as histograms 2014-12-01 20:00:31 -03:00
cgroup.c perf evlist: Introduce evlist__for_each() & friends 2014-01-13 10:06:25 -03:00
cgroup.h
cloexec.c perf util: Replace strerror with strerror_r for thread-safety 2014-08-15 10:58:35 -03:00
cloexec.h perf tools: Enable close-on-exec flag on perf file descriptor 2014-07-18 09:09:34 +02:00
color.c perf tools: Make __hpp__fmt() receive an additional len argument 2014-08-12 12:03:05 -03:00
color.h perf tools: Make __hpp__fmt() receive an additional len argument 2014-08-12 12:03:05 -03:00
comm.c perf tools: Identify which comms are from exec 2014-08-13 19:23:08 -03:00
comm.h perf tools: Add facility to export data in database-friendly way 2014-10-29 10:32:49 -02:00
config.c perf tools: Add --buildid-dir option to set cache directory 2014-12-09 09:14:35 -03:00
cpumap.c perf tools: Use cpu/possible instead of cpu/kernel_max 2014-04-22 17:39:16 +02:00
cpumap.h perf tools: Allow ability to map cpus to nodes easily 2014-04-22 17:39:12 +02:00
ctype.c perf tools: ctype.c only wants util.h 2012-02-13 23:17:40 -02:00
data.c perf util: Replace strerror with strerror_r for thread-safety 2014-08-15 10:58:35 -03:00
data.h perf tools: Add perf_data_file__write interface 2013-12-02 09:22:46 -03:00
db-export.c perf tools: Defer export of comms that were not 'set' 2014-11-03 18:11:59 -03:00
db-export.h perf tools: Defer export of comms that were not 'set' 2014-11-03 18:11:59 -03:00
debug.c perf tools: Allow to force redirect pr_debug to stderr. 2014-11-24 18:03:48 -03:00
debug.h perf: Use strerror_r instead of strerror 2014-08-15 10:54:29 -03:00
dso.c perf tools: Add gzip decompression support for kernel module 2014-11-05 10:11:26 -03:00
dso.h perf symbols: Preparation for compressed kernel module support 2014-11-04 10:15:53 -03:00
dwarf-aux.c perf probe: Fix perf probe to find correct variable DIE 2014-06-04 14:49:20 +02:00
dwarf-aux.h perf probe: Fix to find line information for probe list 2013-10-04 15:16:05 -03:00
environment.c
event.c perf tools: Add id index 2014-10-29 11:24:47 -02:00
event.h Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-09 21:18:06 -08:00
evlist.c perf tools: Make the mmap length autotuning more robust 2014-12-17 11:58:14 -03:00
evlist.h perf evlist: Introduce strerror_mmap method 2014-12-11 18:03:01 -03:00
evsel.c perf tools: Remove perf_evsel__read interface 2014-12-01 20:00:30 -03:00
evsel.h perf stat: Add support for per-pkg counters 2014-12-01 20:00:30 -03:00
exec_cmd.c
exec_cmd.h
find-vdso-map.c perf tools: Build programs to copy 32-bit compatibility 2014-10-29 10:32:48 -02:00
generate-cmdlist.sh tools/perf: Standardize feature support define names to: HAVE_{FEATURE}_SUPPORT 2013-10-09 08:48:28 +02:00
header.c perf build-id: Move disable_buildid_cache() to util/build-id.c 2014-11-19 12:33:46 -03:00
header.h perf build-id: Move build-id related functions to util/build-id.c 2014-11-05 10:14:07 -03:00
help.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
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 perf util: Add findnew method to intlist 2013-10-14 10:28:48 -03:00
intlist.h perf util: Add findnew method to intlist 2013-10-14 10:28:48 -03:00
kvm-stat.h perf kvm stat report: Save pid string in opts.target.pid 2014-09-17 17:08:07 -03:00
levenshtein.c
levenshtein.h
machine.c perf callchain: Move cpumode resolve code to add_callchain_ip 2014-12-09 10:06:29 -03:00
machine.h perf tools: Add facility to export data in database-friendly way 2014-10-29 10:32:49 -02:00
map.c perf callchain: Make get_srcline fall back to sym+offset 2014-11-24 18:03:47 -03:00
map.h perf tools: Set thread->mg.machine in all places 2014-10-29 10:32:46 -02:00
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 perf tools: Add cat as fallback pager 2014-05-21 11:48:33 +02:00
parse-events.c perf tools: Add snapshot format file parsing 2014-11-24 18:03:51 -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 perf tools: Add support for exclusive option 2014-10-29 10:32:47 -02:00
parse-options.h perf tools: Add support for exclusive option 2014-10-29 10:32:47 -02:00
path.c tools/perf: Turn strlcpy() into a __weak function 2013-10-09 08:48:49 +02:00
perf_regs.c perf tools: Cache register accesses for unwind processing 2014-06-12 16:53:19 +02:00
perf_regs.h perf tools: Cache register accesses for unwind processing 2014-06-12 16:53:19 +02:00
PERF-VERSION-GEN perf tools: Fix version when building out of tree 2013-11-07 10:40:47 -03:00
pmu.c perf tools: Add snapshot format file parsing 2014-11-24 18:03:51 -03:00
pmu.h perf tools: Add snapshot format file parsing 2014-11-24 18:03:51 -03:00
pmu.l perf tools: Add perf pmu object to access pmu format definition 2012-03-16 14:29:35 -03:00
pmu.y perf tools: Fix build with bison 2.3 and older. 2013-02-14 16:12:34 -03:00
probe-event.c perf probe: Add --quiet option to suppress output result message 2014-10-29 10:32:49 -02:00
probe-event.h perf probe: Do not access kallsyms when analyzing user binaries 2014-09-17 18:01:14 -03:00
probe-finder.c perf probe: Do not use dwfl_module_addrsym if dwarf_diename finds symbol name 2014-09-17 18:01:43 -03:00
probe-finder.h perf probe: Support distro-style debuginfo for uprobe 2014-02-18 09:38:44 -03:00
pstack.c perf tools: Move pr_* debug macros into debug object 2014-07-17 12:58:39 -03:00
pstack.h perf tools: Finish the removal of 'self' arguments 2013-11-05 15:32:36 -03:00
python-ext-sources perf tools: Move fs.* to lib/api/fs/ 2014-02-18 09:34:49 -03:00
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 perf util: Add findnew method to intlist 2013-10-14 10:28:48 -03:00
rblist.h perf util: Add findnew method to intlist 2013-10-14 10:28:48 -03:00
record.c perf tools: Use sysctl__read_int instead of ad-hoc copies 2014-12-11 17:53:04 -03:00
run-command.c perf util: Replace strerror with strerror_r for thread-safety 2014-08-15 10:58:35 -03:00
run-command.h
session.c Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-09 21:18:06 -08:00
session.h perf session: Add perf_session__deliver_synth_event() 2014-10-29 11:36:15 -02:00
setup.py tools/: Convert to new topic libraries 2013-12-16 16:03:27 -03:00
sigchain.c
sigchain.h
sort.c perf callchain: Make get_srcline fall back to sym+offset 2014-11-24 18:03:47 -03:00
sort.h perf tools: Add +field argument support for --field option 2014-08-24 08:11:19 -03:00
srcline.c perf callchain: Make get_srcline fall back to sym+offset 2014-11-24 18:03:47 -03:00
stat.c perf stats: Add max and min stats 2013-08-07 17:35:26 -03:00
stat.h tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
strbuf.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
strbuf.h
strfilter.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
strfilter.h perf tools: Finish the removal of 'self' arguments 2013-11-05 15:32:36 -03:00
string.c Revert "perf tools: Default to cpu// for events v5" 2014-10-15 16:04:33 -03:00
strlist.c perf tools: Fix build error due to zfree() cast 2014-01-15 15:10:04 -03:00
strlist.h perf tools: Stop using 'self' in strlist 2013-01-25 12:49:28 -03:00
svghelper.c perf timechart: Implement IO mode 2014-07-10 00:22:54 +02:00
svghelper.h perf timechart: Implement IO mode 2014-07-10 00:22:54 +02:00
symbol-elf.c perf symbols: Move bfd_demangle stubbing to its only user 2014-11-24 18:03:47 -03:00
symbol-minimal.c perf symbols: Fallback to kallsyms when using the minimal 'ELF' loader 2014-11-19 12:33:46 -03:00
symbol.c perf record: Do not save pathname in ./debug/.build-id directory for vmlinux 2014-11-05 10:14:08 -03:00
symbol.h perf callchain: Support handling complete branch stacks as histograms 2014-12-01 20:00:31 -03:00
target.c perf record: Make per-cpu mmaps the default. 2013-11-27 14:58:36 -03:00
target.h perf target: Move the checking of which map function to call into function. 2013-12-04 13:46:37 -03:00
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-stack.c perf tools: Enhance the thread stack to output call/return data 2014-11-03 17:43:56 -03:00
thread-stack.h perf tools: Enhance the thread stack to output call/return data 2014-11-03 17:43:56 -03:00
thread.c perf tools: Only override the default :tid comm entry 2014-11-19 12:37:26 -03:00
thread.h perf tools: Add a thread stack for synthesizing call chains 2014-11-03 17:10:59 -03:00
tool.h perf tools: Add id index 2014-10-29 11:24:47 -02:00
top.c perf tools: Rename 'perf_record_opts' to 'record_opts 2013-12-19 14:43:45 -03:00
top.h tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
trace-event-info.c perf tools: Move pr_* debug macros into debug object 2014-07-17 12:58:39 -03:00
trace-event-parse.c perf tools: Fix memory leak in event_format__print function 2014-02-18 09:34:47 -03:00
trace-event-read.c perf tools: Remove needless getopt.h includes 2014-07-17 12:59:00 -03:00
trace-event-scripting.c perf scripting: Add 'flush' callback to scripting API 2014-08-22 13:12:11 -03:00
trace-event.c tools lib traceevent: Make plugin unload function receive pevent 2014-01-15 15:10:40 -03:00
trace-event.h perf scripting: Add 'flush' callback to scripting API 2014-08-22 13:12:11 -03:00
tsc.c perf tools: Move rdtsc() function 2014-07-23 11:48:11 -03:00
tsc.h perf tools: Move rdtsc() function 2014-07-23 11:48:11 -03:00
unwind-libdw.c perf callchains: Use thread->mg->machine 2014-10-29 10:32:46 -02:00
unwind-libdw.h perf tools: Add libdw DWARF post unwind support 2014-02-24 09:29:36 -03:00
unwind-libunwind.c perf callchains: Use thread->mg->machine 2014-10-29 10:32:46 -02:00
unwind.h perf callchains: Use thread->mg->machine 2014-10-29 10:32:46 -02:00
usage.c perf target: Introduce perf_target__parse_uid() 2012-05-07 16:46:48 -03:00
util.c perf tools: Use sysctl__read_int instead of ad-hoc copies 2014-12-11 17:53:04 -03:00
util.h tools: Move code originally from linux/log2.h to tools/include/linux/ 2014-12-17 11:09:41 -03:00
values.c perf tools: Use zfree to help detect use after free bugs 2013-12-27 17:08:19 -03:00
values.h tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
vdso.c perf tools: Do not attempt to run perf-read-vdso32 if it wasn't built 2014-10-29 10:32:48 -02:00
vdso.h perf tools: Add support for 32-bit compatibility VDSOs 2014-10-29 10:32:48 -02:00
wrapper.c perf tools: Use __maybe_used for unused variables 2012-09-11 12:19:15 -03:00
xyarray.c
xyarray.h
zlib.c perf tools: Add gzip decompression support for kernel module 2014-11-05 10:11:26 -03:00