summaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile.perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2019-05-21 15:34:03 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-05-28 17:37:43 -0400
commitf6af095668b7799a7514378824dcc74869df3994 (patch)
treec54e5cbf83ab72ab997243b613508d619ef12069 /tools/perf/Makefile.perf
parentf5b91dbba1a51d30a3fe78a5c6096392fa99471e (diff)
perf trace: Beautify 'fsmount' arguments
Use existing beautifiers for the first arg, fd, assigned using the heuristic that looks for syscall arg names and associates SCA_FD with 'fd' named argumes, and wire up the recently introduced fsmount attr_flags table generator. Now it should be possible to just use: perf trace -e fsmount As root and see all fsmount syscalls with its args beautified. # cat sys_fsmount.c #define _GNU_SOURCE /* See feature_test_macros(7) */ #include <unistd.h> #include <sys/syscall.h> /* For SYS_xxx definitions */ #define __NR_fsmount 432 #define MOUNT_ATTR_RDONLY 0x00000001 /* Mount read-only */ #define MOUNT_ATTR_NOSUID 0x00000002 /* Ignore suid and sgid bits */ #define MOUNT_ATTR_NODEV 0x00000004 /* Disallow access to device special files */ #define MOUNT_ATTR_NOEXEC 0x00000008 /* Disallow program execution */ #define MOUNT_ATTR__ATIME 0x00000070 /* Setting on how atime should be updated */ #define MOUNT_ATTR_RELATIME 0x00000000 /* - Update atime relative to mtime/ctime. */ #define MOUNT_ATTR_NOATIME 0x00000010 /* - Do not update access times. */ #define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */ #define MOUNT_ATTR_NODIRATIME 0x00000080 /* Do not update directory access times */ static inline int sys_fsmount(int fs_fd, int flags, int attr_flags) { syscall(__NR_fsmount, fs_fd, flags, attr_flags); } int main(int argc, char *argv[]) { int attr_flags = 0, fs_fd = 0; sys_fsmount(fs_fd++, 0, attr_flags); attr_flags |= MOUNT_ATTR_RDONLY; sys_fsmount(fs_fd++, 1, attr_flags); attr_flags |= MOUNT_ATTR_NOSUID; sys_fsmount(fs_fd++, 0, attr_flags); attr_flags |= MOUNT_ATTR_NODEV; sys_fsmount(fs_fd++, 1, attr_flags); attr_flags |= MOUNT_ATTR_NOEXEC; sys_fsmount(fs_fd++, 0, attr_flags); attr_flags |= MOUNT_ATTR_NOATIME; sys_fsmount(fs_fd++, 1, attr_flags); attr_flags |= MOUNT_ATTR_STRICTATIME; sys_fsmount(fs_fd++, 0, attr_flags); attr_flags |= MOUNT_ATTR_NODIRATIME; sys_fsmount(fs_fd++, 0, attr_flags); return 0; } # # perf trace -e fsmount ./sys_fsmount fsmount(0, 0, MOUNT_ATTR_RELATIME) = -1 EINVAL (Invalid argument) fsmount(1, FSMOUNT_CLOEXEC, MOUNT_ATTR_RDONLY|MOUNT_ATTR_RELATIME) = -1 EINVAL (Invalid argument) fsmount(2, 0, MOUNT_ATTR_RDONLY|MOUNT_ATTR_NOSUID|MOUNT_ATTR_RELATIME) = -1 EINVAL (Invalid argument) fsmount(3, FSMOUNT_CLOEXEC, MOUNT_ATTR_RDONLY|MOUNT_ATTR_NOSUID|MOUNT_ATTR_NODEV|MOUNT_ATTR_RELATIME) = -1 EBADF (Bad file descriptor) fsmount(4, 0, MOUNT_ATTR_RDONLY|MOUNT_ATTR_NOSUID|MOUNT_ATTR_NODEV|MOUNT_ATTR_NOEXEC|MOUNT_ATTR_RELATIME) = -1 EBADF (Bad file descriptor) fsmount(5, FSMOUNT_CLOEXEC, MOUNT_ATTR_RDONLY|MOUNT_ATTR_NOSUID|MOUNT_ATTR_NODEV|MOUNT_ATTR_NOEXEC|MOUNT_ATTR_NOATIME) = -1 EBADF (Bad file descriptor) fsmount(6, 0, MOUNT_ATTR_RDONLY|MOUNT_ATTR_NOSUID|MOUNT_ATTR_NODEV|MOUNT_ATTR_NOEXEC|MOUNT_ATTR_NOATIME|MOUNT_ATTR_STRICTATIME) = -1 EINVAL (Invalid argument) fsmount(7, 0, MOUNT_ATTR_RDONLY|MOUNT_ATTR_NOSUID|MOUNT_ATTR_NODEV|MOUNT_ATTR_NOEXEC|MOUNT_ATTR_NOATIME|MOUNT_ATTR_STRICTATIME|MOUNT_ATTR_NODIRATIME) = -1 EINVAL (Invalid argument) # Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-w71uge0sfo6ns9uclhwtthca@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/Makefile.perf')
-rw-r--r--tools/perf/Makefile.perf8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 22e92a9ee871..326ca5d6a7ef 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -419,6 +419,12 @@ fadvise_advice_tbl := $(srctree)/tools/perf/trace/beauty/fadvise.sh
419$(fadvise_advice_array): $(linux_uapi_dir)/in.h $(fadvise_advice_tbl) 419$(fadvise_advice_array): $(linux_uapi_dir)/in.h $(fadvise_advice_tbl)
420 $(Q)$(SHELL) '$(fadvise_advice_tbl)' $(linux_uapi_dir) > $@ 420 $(Q)$(SHELL) '$(fadvise_advice_tbl)' $(linux_uapi_dir) > $@
421 421
422fsmount_arrays := $(beauty_outdir)/fsmount_arrays.c
423fsmount_tbls := $(srctree)/tools/perf/trace/beauty/fsmount.sh
424
425$(fsmount_arrays): $(linux_uapi_dir)/fs.h $(fsmount_tbls)
426 $(Q)$(SHELL) '$(fsmount_tbls)' $(linux_uapi_dir) > $@
427
422fspick_arrays := $(beauty_outdir)/fspick_arrays.c 428fspick_arrays := $(beauty_outdir)/fspick_arrays.c
423fspick_tbls := $(srctree)/tools/perf/trace/beauty/fspick.sh 429fspick_tbls := $(srctree)/tools/perf/trace/beauty/fspick.sh
424 430
@@ -647,6 +653,7 @@ build-dir = $(if $(__build-dir),$(__build-dir),.)
647prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioctl_array) \ 653prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioctl_array) \
648 $(fadvise_advice_array) \ 654 $(fadvise_advice_array) \
649 $(fsconfig_arrays) \ 655 $(fsconfig_arrays) \
656 $(fsmount_arrays) \
650 $(fspick_arrays) \ 657 $(fspick_arrays) \
651 $(pkey_alloc_access_rights_array) \ 658 $(pkey_alloc_access_rights_array) \
652 $(sndrv_pcm_ioctl_array) \ 659 $(sndrv_pcm_ioctl_array) \
@@ -944,6 +951,7 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
944 $(OUTPUT)pmu-events/pmu-events.c \ 951 $(OUTPUT)pmu-events/pmu-events.c \
945 $(OUTPUT)$(fadvise_advice_array) \ 952 $(OUTPUT)$(fadvise_advice_array) \
946 $(OUTPUT)$(fsconfig_arrays) \ 953 $(OUTPUT)$(fsconfig_arrays) \
954 $(OUTPUT)$(fsmount_arrays) \
947 $(OUTPUT)$(fspick_arrays) \ 955 $(OUTPUT)$(fspick_arrays) \
948 $(OUTPUT)$(madvise_behavior_array) \ 956 $(OUTPUT)$(madvise_behavior_array) \
949 $(OUTPUT)$(mmap_flags_array) \ 957 $(OUTPUT)$(mmap_flags_array) \