Alexander Shishkin
b9835a9008
tools lib api fs: Introduce sysfs__read_bool
...
Will be used in a upcoming patch warning about PERF_RECORD_AUX data
gaps, reading the "module/kvm_intel/parameters/vmm_exclusive" sysfs
entry.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Stephane Eranian <eranian@google.com >
Cc: Vince Weaver <vince@deater.net >
Link: http://lkml.kernel.org/r/8760j941ig.fsf@ashishki-desk.ger.corp.intel.com
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-03-17 11:49:09 -03:00
Ravi Bangoria
27cf5706a0
perf sdt: Show proper hint when event not yet in place via 'perf probe'
...
All events from 'perf list', except SDT events, can be directly recorded
with 'perf record'. But, the flow is little different for SDT events.
Probe points for SDT event needs to be created using 'perf probe' before
recording it using 'perf record'.
Perf shows misleading hint when a user tries to record SDT event without
first creating a probe point. Show proper hint there.
Before patch:
$ perf record -a -e sdt_glib:idle__add
event syntax error: 'sdt_glib:idle__add'
\___ unknown tracepoint
Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found.
Hint: Perhaps this kernel misses some CONFIG_ setting to enable this feature?.
...
After patch:
$ perf record -a -e sdt_glib:idle__add
event syntax error: 'sdt_glib:idle__add'
\___ unknown tracepoint
Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found.
Hint: SDT event cannot be directly recorded on.
Please first use 'perf probe sdt_glib:idle__add' before recording it.
...
$ perf probe sdt_glib:idle__add
Added new event:
sdt_glib:idle__add (on %idle__add in /usr/lib64/libglib-2.0.so.0.5000.2)
You can now use it in all perf tools, such as:
perf record -e sdt_glib:idle__add -aR sleep 1
$ perf record -a -e sdt_glib:idle__add
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.175 MB perf.data ]
Suggested-and-Acked-by: Ingo Molnar <mingo@redhat.com >
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Masami Hiramatsu <mhiramat@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexis Berlemont <alexis.berlemont@gmail.com >
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20170203102642.17258-1-ravi.bangoria@linux.vnet.ibm.com
[ s/Please use/Please first use/ and break the Hint line in two ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-02-08 09:28:54 -03:00
Joe Stringer
71dc4c3068
tools lib api fs: Add bpf_fs filesystem detector
...
Allow mounting of the BPF filesystem at /sys/fs/bpf.
Signed-off-by: Joe Stringer <joe@ovn.org >
Cc: Alexei Starovoitov <ast@fb.com >
Cc: Daniel Borkmann <daniel@iogearbox.net >
Cc: Wang Nan <wangnan0@huawei.com >
Cc: netdev@vger.kernel.org
Link: http://lkml.kernel.org/r/20170126212001.14103-6-joe@ovn.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-01-31 16:20:07 -03:00
Wang Nan
5e7be3e1f9
tools lib api fs: Add hugetlbfs filesystem detector
...
Detect hugetlbfs. hugetlbfs__mountpoint() will be used during recording
to help identifying hugetlb mmaps: which should be recognized as anon
mapping.
Signed-off-by: Wang Nan <wangnan0@huawei.com >
Reviewed-by: Nilay Vaish <nilayvaish@gmail.com >
Cc: He Kuang <hekuang@huawei.com >
Cc: Hou Pengyang <houpengyang@huawei.com >
Cc: Zefan Li <lizefan@huawei.com >
Link: http://lkml.kernel.org/r/1473137909-142064-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-09-08 12:34:43 -03:00
Jiri Olsa
db49120a32
tools lib api fs: Use base 0 in filename__read_ull
...
By using 0 for base, the strtoull() detects the base automatically (see
'man strtoull').
ATM we have just one user of this function, the cpu__get_max_freq
function reading the "cpuinfo_max_freq" sysfs file. It should not get
affected by this change.
Committer note:
This change seems motivated by this discussion:
"[PATCH] [RFC V1]s390/perf: fix 'start' address of module's map"
http://lkml.kernel.org/r/20160711120155.GA29929@krava
I.e. this patches paves the way for filename__read_ull() to be used in a
S/390 related fix.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Songshan Gong <gongss@linux.vnet.ibm.com >
Link: http://lkml.kernel.org/r/1468567797-27564-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-15 13:38:05 -03:00
Arnaldo Carvalho de Melo
b31e3e3316
tools lib api fs: Use str_error_r()
...
To make it portable to non-glibc systems, that follow the XSI variant
instead of the GNU specific one that gets in place when _GNU_SOURCE is
defined.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-mixgnh3iyajuqogn2opsocdy@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-07-12 15:20:29 -03:00
Arnaldo Carvalho de Melo
4bd112df3e
tools lib api fs: Add helper to read string from procfs file
...
To read things like /proc/self/comm.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Milian Wolff <milian.wolff@kdab.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-ztpkbmseidt0hq2psr46o0h9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-04-26 13:15:00 -03:00
Jiri Olsa
51c0396c60
tools lib api fs: Add sysfs__read_str function
...
Adding sysfs__read_str function to ease up reading string files from
sysfs. New interface is:
int sysfs__read_str(const char *entry, char **buf, size_t *sizep);
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1455465826-8426-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-02-16 17:12:57 -03:00
Jiri Olsa
607bfbd7ff
tools lib api fs: Adopt filename__read_str from perf
...
We already moved similar functions in here, also it'll be useful for
sysfs__read_str addition in following patch.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1455465826-8426-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2016-02-16 17:12:56 -03:00
Jiri Olsa
ccb5597f9b
tools lib api fs: No need to use PATH_MAX + 1
...
Because there's no point, PATH_MAX is big enough.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Don Zickus <dzickus@redhat.com >
Cc: Kan Liang <kan.liang@intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lkml.kernel.org/r/1444068369-20978-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-10-05 16:12:09 -03:00
Jiri Olsa
dc240c5dc2
tools lib api fs: Store tracing mountpoint for better error message
...
Storing the actual tracing path mountpoint to display correct
error message hint ('Hint:' line). The error hint rediscovers
mountpoints, but it could be different from what we actually
used in tracing path.
Before we'd display debugfs mount even though tracefs was used:
$ perf record -e sched:sched_krava ls
event syntax error: 'sched:sched_krava'
\___ can't access trace events
Error: No permissions to read /sys/kernel/debug/tracing/events/sched/sched_krava
Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug'
...
After this change, correct mountpoint is displayed:
$ perf record -e sched:sched_krava ls
event syntax error: 'sched:sched_krava'
\___ can't access trace events
Error: No permissions to read /sys/kernel/debug/tracing/events/sched/sched_krava
Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/tracing'
...
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Raphael Beamonte <raphael.beamonte@gmail.com >
Link: http://lkml.kernel.org/r/1442674027-19427-1-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-28 15:50:54 -03:00
Arnaldo Carvalho de Melo
2d729f6a8a
tools lib api fs: Introduce sysfs__read_{int,ull}()
...
To read either an int or an unsigned long long value from the given
file.
E.g.:
$ cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
3200000
$ ./sysfs__read_ull
devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq=3200000
$
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Kan Liang <kan.liang@intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Stephane Eranian <eranian@google.com >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-4a12m4d5k8m4qgc1vguocvei@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-14 12:50:25 -03:00
Jiri Olsa
60a1133a5b
tools lib api fs: Remove debugfs, tracefs and findfs objects
...
We have all the functionality in fs.c, let's remove unneeded
objects.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Raphael Beamonte <raphael.beamonte@gmail.com >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1441180605-24737-15-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-14 12:50:15 -03:00
Jiri Olsa
4605eab348
tools lib api fs: Replace debugfs/tracefs objects interface with fs.c
...
Switching to the fs.c related filesystem framework.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Raphael Beamonte <raphael.beamonte@gmail.com >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1441180605-24737-14-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-14 12:50:15 -03:00
Jiri Olsa
4f234f06d6
tools lib api fs: Make tracing_path_strerror_open message generic
...
Making tracing_path__strerror_open_tp message generic by mentioning both
debugfs/tracefs words in error message plus the tracing_path instead of
debugfs_mountpoint.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: David Ahern <dsahern@gmail.com >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Raphael Beamonte <raphael.beamonte@gmail.com >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1441180605-24737-7-git-send-email-jolsa@kernel.org
[ Add comment for the ENOENT case out of this patch discussion thread ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-14 12:50:14 -03:00
Jiri Olsa
709adcb339
tools lib api fs: Add FSTYPE__configured() method
...
Add FSTYPE__configured() (where FSTYPE is one of sysfs, procfs, debugfs,
tracefs) interface that returns bool state of the filesystem mount:
true - mounted, false - not mounted
It will not try to mount the filesystem.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Raphael Beamonte <raphael.beamonte@gmail.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1441180605-24737-13-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-04 12:01:01 -03:00
Jiri Olsa
73ca85ad36
tools lib api fs: Add FSTYPE__mount() method
...
Adding FSTYPE__mount (where FSTYPE is, as of now, one of sysfs, procfs,
debugfs, tracefs) method that tries to mount the filesystem in case no
mount of FSTYPE is found.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Raphael Beamonte <raphael.beamonte@gmail.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1441180605-24737-12-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-04 12:01:00 -03:00
Jiri Olsa
c495afb498
tools lib api fs: Add tracefs into fs.c object
...
Adding tracefs support into fs.c framework. It'll replace the tracefs
object functionality in following patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Raphael Beamonte <raphael.beamonte@gmail.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1441180605-24737-11-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-04 12:01:00 -03:00
Jiri Olsa
8ccfabdb87
tools lib api fs: Add debugfs into fs.c object
...
Adding debugfs support into fs.c framework. It'll replace the debugfs
object functionality in following patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Raphael Beamonte <raphael.beamonte@gmail.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1441180605-24737-10-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-04 12:00:59 -03:00
Jiri Olsa
41e3a1fece
tools lib api fs: Move SYSFS_MAGIC PROC_SUPER_MAGIC into fs.c
...
There's no need to export SYSFS_MAGIC PROC_SUPER_MAGIC in fs.h. Leave
them in the fs.c.
Link: http://lkml.kernel.org/n/tip-b2cd1bb7yvbazq5oua24oz18@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Raphael Beamonte <raphael.beamonte@gmail.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1441180605-24737-9-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-04 12:00:59 -03:00
Jiri Olsa
b86b0d3570
tools lib api fs: Add STR and PATH_MAX macros to fs object
...
We're going to get rid of findfs.h in following patches, but we'll still
need these macros.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Raphael Beamonte <raphael.beamonte@gmail.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Matt Fleming <matt@codeblueprint.co.uk >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1441180605-24737-8-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-04 12:00:58 -03:00
Jiri Olsa
988bdb3192
tools lib api fs: Move debugfs__strerror_open into tracing_path.c object
...
Moving debugfs__strerror_open out of api/fs/debugfs.c, because it's not
debugfs specific. It'll be changed to consider tracefs mount as well in
following patches.
Renaming it into tracing_path__strerror_open_tp to fit into the
namespace. No functional change is intended.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Reviewed-by: Matt Fleming <matt.fleming@intel.com >
Cc: Raphael Beamonte <raphael.beamonte@gmail.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1441180605-24737-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-04 12:00:58 -03:00
Jiri Olsa
592d5a6ba8
tools lib api fs: Move tracing_path interface into api/fs/tracing_path.c
...
Moving tracing_path interface into api/fs/tracing_path.c out of util.c.
It seems generic enough to be used by others, and I couldn't think of
better place.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Reviewed-by: Matt Fleming <matt.fleming@intel.com >
Reviewed-by: Raphael Beamonte <raphael.beamonte@gmail.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1441180605-24737-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-09-04 12:00:45 -03:00
Arnaldo Carvalho de Melo
ab85785aa1
tools lib api debugfs: Check for tracefs when reporting errors
...
Now that we have two mountpoints, one for debugfs and another, for
tracefs, we end up needing to check permissions for both, so, on
a system with default config we were always asking the user to
check the permission of the debugfs mountpoint, even when it was
already sufficient. Fix it.
E.g.:
$ trace -e nanosleep usleep 1
Error: No permissions to read /sys/kernel/debug/tracing/events/raw_syscalls/sys_(enter|exit)
Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug'
$ sudo mount -o remount,mode=755 /sys/kernel/debug
$ trace -e nanosleep usleep 1
Error: No permissions to read /sys/kernel/debug/tracing/events/raw_syscalls/sys_(enter|exit)
Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/tracing'
$ sudo mount -o remount,mode=755 /sys/kernel/debug/tracing
$ trace -e nanosleep usleep 1
0.326 ( 0.061 ms): usleep/11961 nanosleep(rqtp: 0x7ffef1081c50) = 0
$
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Borislav Petkov <bp@suse.de >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Stephane Eranian <eranian@google.com >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/n/tip-0viljeuhc7q84ic8kobsna43@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-07-06 12:22:14 -03:00
Jiri Olsa
285a8f247b
tools lib api: Rename libapikfs.a to libapi.a
...
Renaming libapikfs.a to libapi.a, because it's not just 'fs' specific
library now.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Tested-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com >
Tested-by: Will Deacon <will.deacon@arm.com >
Cc: Alexis Berlemont <alexis.berlemont@gmail.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
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-g1mk5oj2ayq4vn653ovfg3gv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-02-12 17:55:18 -03:00
Jiri Olsa
b4f9166847
tools lib api: Use tools build framework
...
Move the libapikfs library building under tools build framework.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Tested-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com >
Tested-by: Will Deacon <will.deacon@arm.com >
Cc: Alexis Berlemont <alexis.berlemont@gmail.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
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-xjo8r7nuqy9mvlfrmx9zcfwb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-02-12 17:54:39 -03:00
Steven Rostedt (Red Hat)
dd6dda27a8
tools lib api fs: Add {tracefs,debugfs}_configured() functions
...
Add tracefs_configured() to return true if tracefs is configured in the
kernel (succeeds to find tracefs), and debugfs_configured() if debugfs
is configured in the kernel (succeeds to find debugfs).
Signed-off-by: Steven Rostedt <rostedt@goodmis.org >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: http://lkml.kernel.org/r/20150202193553.190606690@goodmis.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-02-07 14:00:10 +01:00
Steven Rostedt (Red Hat)
a9edf60749
tools lib api debugfs: Add DEBUGFS_DEFAULT_PATH macro
...
Instead of hard coding "/sys/kernel/debug" everywhere, create a macro to
hold where the default path exists.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: http://lkml.kernel.org/r/20150202193553.032117017@goodmis.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-02-07 13:56:32 +01:00
Steven Rostedt (Red Hat)
4ef92c2ecd
tools lib api fs: Add tracefs mount helper functions
...
Since tracefs will now hold the event directory for perf, and even
though by default, debugfs still mounts tracefs on the debugfs/tracing
directory, the system admin may now choose to not mount debugfs and
instead just mount tracefs instead.
Having tracefs helper functions will facilitate having perf look for
tracefs first, and then try debugfs as a fallback.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: http://lkml.kernel.org/r/20150202193552.898934751@goodmis.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-02-07 13:55:20 +01:00
Steven Rostedt (Red Hat)
cde164aee9
tools lib fs: Add helper to find mounted file systems
...
In preparation for adding tracefs for perf to use, create a findfs
helper utility that find_debugfs uses instead of hard coding the search
in the code. This will allow for a find_tracefs to be used as well.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: http://lkml.kernel.org/r/20150202193552.735023362@goodmis.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-02-07 13:51:34 +01:00
Steven Rostedt (Red Hat)
5693c92660
perf tools: Do not check debugfs MAGIC for tracing files
...
It's rather strange to be checking the debugfs MAGIC number for the
tracing directory. A system admin may want to have a custom set of
events to trace and it should be allowed to let the admin make a temp
file (even for tracing virtual boxes, this is useful).
Also with the coming tracefs, the files may not even be under debugfs,
so checking the debugfs MAGIC number is pointless.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: http://lkml.kernel.org/r/20150202193552.546175764@goodmis.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-02-07 13:51:30 +01:00
Arnaldo Carvalho de Melo
f816b3cc99
tools lib fs debugfs: Check if debugfs is mounted when handling ENOENT
...
If debugfs was already mounted, then its a matter of not finding the
tracepoint, tell the user that perhaps a CONFIG_ setting is not enabled.
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: Namhyung Kim <namhyung@kernel.org >
Cc: Stephane Eranian <eranian@google.com >
Link: http://lkml.kernel.org/n/tip-6chfytoflyx3jwfqm7ebltu0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-01-22 17:02:23 -03:00
Arnaldo Carvalho de Melo
2cc990ba3a
tools lib fs debugfs: Introduce debugfs__strerror_open_tp
...
There will be other cases where not just a tracepoint event is being
opened below the debugfs mountpoint, but it is rather common, so provide
one helper for that.
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: Namhyung Kim <namhyung@kernel.org >
Cc: Stephane Eranian <eranian@google.com >
Link: http://lkml.kernel.org/n/tip-q6e6zct49ql6nbcw8kkg0lbj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-01-22 17:02:20 -03:00
Arnaldo Carvalho de Melo
801c67b05f
tools lib fs: Pass filename to debugfs__strerror_open
...
It was hardcoded for one specific tracepoint, leftover from its initial
user: 'perf trace'.
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: Namhyung Kim <namhyung@kernel.org >
Cc: Stephane Eranian <eranian@google.com >
Link: http://lkml.kernel.org/n/tip-j1jicvwljy5qx1nah4mkmyke@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-01-22 11:16:31 -03:00
Arnaldo Carvalho de Melo
e2726d9964
tools lib fs: Adopt debugfs open strerrno method
...
As this is not specific to an evlist and may be used with other tools.
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: Namhyung Kim <namhyung@kernel.org >
Cc: Stephane Eranian <eranian@google.com >
Link: http://lkml.kernel.org/n/tip-a9up9mivx1pzdf5tqrqsx62d@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
tools/perf/util/include/asm/hash.h
2015-01-22 10:34:22 -03:00
Alexey Brodkin
db1806edcf
perf tools: Fix statfs.f_type data type mismatch build error with uclibc
...
ARC Linux uses the no legacy syscalls abi and corresponding uClibc headers
statfs defines f_type to be U32 which causes perf build breakage
http://git.uclibc.org/uClibc/tree/libc/sysdeps/linux/common-generic/bits/statfs.h
----------->8---------------
CC fs/fs.o
fs/fs.c: In function 'fs__valid_mount':
fs/fs.c:82:24: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
else if (st_fs.f_type != magic)
^
cc1: all warnings being treated as errors
----------->8---------------
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Borislav Petkov <bp@suse.de >
Cc: Cody P Schafer <dev@codyps.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com >
Link: http://lkml.kernel.org/r/1420888254-17504-2-git-send-email-vgupta@synopsys.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2015-01-16 17:49:29 -03:00
Arnaldo Carvalho de Melo
42e3c4a127
tools lib fs: Add sysctl__read_int helper
...
Will come in handy for tools, see next patches.
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-nay9j62ztxpytt4ew1tkl4op@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2014-12-11 17:53:00 -03:00
Arnaldo Carvalho de Melo
3a351127cb
tools lib fs: Adopt filename__read_int from tools/perf/
...
Will be useful for new helpers to read sysctl values.
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 >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2014-12-11 13:17:46 -03:00
Cody P Schafer
f2d9627b2b
perf tools: Allow overriding sysfs and proc finding with env var
...
SYSFS_PATH and PROC_PATH environment variables now let the user override
the detection of sysfs and proc locations for testing purposes.
Signed-off-by: Cody P Schafer <dev@codyps.com >
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com >
Link: http://lkml.kernel.org/r/1401236684-10579-2-git-send-email-dev@codyps.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-06-03 21:34:29 +02:00
Xia Kaixu
603940b6b8
perf tools: Remove extra '/' character in events file path
...
The array debugfs_known_mountpoints[] will cause extra '/'
character output.
Remove it.
pre:
$ perf probe -l
/sys/kernel/debug//tracing/uprobe_events file does not exist -
please rebuild kernel with CONFIG_UPROBE_EVENTS.
post:
$ perf probe -l
/sys/kernel/debug/tracing/uprobe_events file does not exist -
please rebuild kernel with CONFIG_UPROBE_EVENTS.
Signed-off-by: Xia Kaixu <xiakaixu@huawei.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Link: http://lkml.kernel.org/r/535B6660.2060001@huawei.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
2014-04-30 17:02:24 +02:00
Borislav Petkov
cd0cfad74e
perf tools: Move fs.* to lib/api/fs/
...
Move to generic library and kill magic.h as it is needed only in fs.h.
Signed-off-by: Borislav Petkov <bp@suse.de >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Frederic Weisbecker <fweisbec@gmail.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Mike Galbraith <efault@gmx.de >
Cc: Namhyung Kim <namhyung@gmail.com >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Pekka Enberg <penberg@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Robert Richter <rric@kernel.org >
Cc: Stanislav Fomichev <stfomichev@yandex-team.ru >
Cc: Stephane Eranian <eranian@google.com >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1386605664-24041-3-git-send-email-bp@alien8.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2014-02-18 09:34:49 -03:00
Borislav Petkov
553873e1df
tools/: Convert to new topic libraries
...
Move debugfs.* to api/fs/. We have a common tools/lib/api/ place where
the Makefile lives and then we place the headers in subdirs.
For example, all the fs-related stuff goes to tools/lib/api/fs/ from
which we get libapikfs.a (acme got almost the naming he wanted :-)) and
we link it into the tools which need it - in this case perf and
tools/vm/page-types.
acme:
"Looking at the implementation, I think some tools can even link
directly to the .o files, avoiding the .a file altogether.
But that is just an optimization/finer granularity tools/lib/
cherrypicking that toolers can make use of."
Fixup documentation cleaning target while at it.
Signed-off-by: Borislav Petkov <bp@suse.de >
Acked-by: Ingo Molnar <mingo@kernel.org >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Arjan van de Ven <arjan@linux.intel.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@gmail.com >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Pekka Enberg <penberg@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Robert Richter <rric@kernel.org >
Cc: Stanislav Fomichev <stfomichev@yandex-team.ru >
Cc: Stephane Eranian <eranian@google.com >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/1386605664-24041-2-git-send-email-bp@alien8.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2013-12-16 16:03:27 -03:00