* [PATCH 0/3] perf: generate s390 syscall table and remove auditlibs dependency
@ 2017-12-07 8:27 Hendrik Brueckner
2017-12-07 8:27 ` [PATCH 1/3] perf s390: generate system call table from asm/unistd.h Hendrik Brueckner
` (3 more replies)
0 siblings, 4 replies; 20+ messages in thread
From: Hendrik Brueckner @ 2017-12-07 8:27 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
With the perf trace command you can specify system calls with wildcards.
To support this on s390, a system call table must be provided to perf.
Provide a script to create the perf system call table based on the defines
in arch/s390/include/uapi/asm/unistd.h (copied to tools/arch/s390/...).
Note that the first patch can be applied independent of the second and
third patch. In case they need further discussion, please consider to
integrate the first one.
The second and third patches complete the work to remove the audit library
dependency for perf trace when an architecture supports system call tables.
Inspired by the generation of the system call tables, create a similar
approach to generate errno name mappings. Introduce the errno_to_name()
function to replace audit_errno_to_name() in perf trace. The third
patch changes the build process to build and run perf trace without
requiring the audit library anymore (for those architectures that have
system call table support).
Note: The patch set is based on the linux master branch (968edbd93c0cbb).
Hendrik Brueckner (3):
perf s390: generate system call table from asm/unistd.h
perf: introduce errno_to_name() function
perf trace: no longer require auditlibs if syscall tables are present
tools/arch/s390/include/uapi/asm/unistd.h | 412 +++++++++++++++++++++++
tools/perf/.gitignore | 1 +
tools/perf/Makefile.config | 22 +-
tools/perf/Makefile.perf | 12 +-
tools/perf/arch/s390/Makefile | 21 ++
tools/perf/arch/s390/entry/syscalls/mksyscalltbl | 36 ++
tools/perf/builtin-help.c | 2 +-
tools/perf/builtin-trace.c | 17 +-
tools/perf/check-headers.sh | 1 +
tools/perf/perf.c | 4 +-
tools/perf/util/generate-cmdlist.sh | 2 +-
tools/perf/util/generate-errno-names.sh | 32 ++
tools/perf/util/syscalltbl.c | 4 +
13 files changed, 553 insertions(+), 13 deletions(-)
create mode 100644 tools/arch/s390/include/uapi/asm/unistd.h
create mode 100755 tools/perf/arch/s390/entry/syscalls/mksyscalltbl
create mode 100755 tools/perf/util/generate-errno-names.sh
--
1.8.3.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 1/3] perf s390: generate system call table from asm/unistd.h
2017-12-07 8:27 [PATCH 0/3] perf: generate s390 syscall table and remove auditlibs dependency Hendrik Brueckner
@ 2017-12-07 8:27 ` Hendrik Brueckner
2017-12-07 15:30 ` Arnaldo Carvalho de Melo
2017-12-07 8:28 ` [PATCH 2/3] perf: introduce errno_to_name() function Hendrik Brueckner
` (2 subsequent siblings)
3 siblings, 1 reply; 20+ messages in thread
From: Hendrik Brueckner @ 2017-12-07 8:27 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
This should speed up accessing new system calls introduced with
the kernel rather than waiting for libaudit updates to include
them.
It also enables users to specify wildcards, for example,
perf trace -e 'open*'.
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
tools/arch/s390/include/uapi/asm/unistd.h | 412 +++++++++++++++++++++++
tools/perf/Makefile.config | 10 +-
tools/perf/arch/s390/Makefile | 21 ++
tools/perf/arch/s390/entry/syscalls/mksyscalltbl | 36 ++
| 1 +
tools/perf/util/syscalltbl.c | 4 +
6 files changed, 483 insertions(+), 1 deletion(-)
create mode 100644 tools/arch/s390/include/uapi/asm/unistd.h
create mode 100755 tools/perf/arch/s390/entry/syscalls/mksyscalltbl
diff --git a/tools/arch/s390/include/uapi/asm/unistd.h b/tools/arch/s390/include/uapi/asm/unistd.h
new file mode 100644
index 0000000..7251209
--- /dev/null
+++ b/tools/arch/s390/include/uapi/asm/unistd.h
@@ -0,0 +1,412 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * S390 version
+ *
+ * Derived from "include/asm-i386/unistd.h"
+ */
+
+#ifndef _UAPI_ASM_S390_UNISTD_H_
+#define _UAPI_ASM_S390_UNISTD_H_
+
+/*
+ * This file contains the system call numbers.
+ */
+
+#define __NR_exit 1
+#define __NR_fork 2
+#define __NR_read 3
+#define __NR_write 4
+#define __NR_open 5
+#define __NR_close 6
+#define __NR_restart_syscall 7
+#define __NR_creat 8
+#define __NR_link 9
+#define __NR_unlink 10
+#define __NR_execve 11
+#define __NR_chdir 12
+#define __NR_mknod 14
+#define __NR_chmod 15
+#define __NR_lseek 19
+#define __NR_getpid 20
+#define __NR_mount 21
+#define __NR_umount 22
+#define __NR_ptrace 26
+#define __NR_alarm 27
+#define __NR_pause 29
+#define __NR_utime 30
+#define __NR_access 33
+#define __NR_nice 34
+#define __NR_sync 36
+#define __NR_kill 37
+#define __NR_rename 38
+#define __NR_mkdir 39
+#define __NR_rmdir 40
+#define __NR_dup 41
+#define __NR_pipe 42
+#define __NR_times 43
+#define __NR_brk 45
+#define __NR_signal 48
+#define __NR_acct 51
+#define __NR_umount2 52
+#define __NR_ioctl 54
+#define __NR_fcntl 55
+#define __NR_setpgid 57
+#define __NR_umask 60
+#define __NR_chroot 61
+#define __NR_ustat 62
+#define __NR_dup2 63
+#define __NR_getppid 64
+#define __NR_getpgrp 65
+#define __NR_setsid 66
+#define __NR_sigaction 67
+#define __NR_sigsuspend 72
+#define __NR_sigpending 73
+#define __NR_sethostname 74
+#define __NR_setrlimit 75
+#define __NR_getrusage 77
+#define __NR_gettimeofday 78
+#define __NR_settimeofday 79
+#define __NR_symlink 83
+#define __NR_readlink 85
+#define __NR_uselib 86
+#define __NR_swapon 87
+#define __NR_reboot 88
+#define __NR_readdir 89
+#define __NR_mmap 90
+#define __NR_munmap 91
+#define __NR_truncate 92
+#define __NR_ftruncate 93
+#define __NR_fchmod 94
+#define __NR_getpriority 96
+#define __NR_setpriority 97
+#define __NR_statfs 99
+#define __NR_fstatfs 100
+#define __NR_socketcall 102
+#define __NR_syslog 103
+#define __NR_setitimer 104
+#define __NR_getitimer 105
+#define __NR_stat 106
+#define __NR_lstat 107
+#define __NR_fstat 108
+#define __NR_lookup_dcookie 110
+#define __NR_vhangup 111
+#define __NR_idle 112
+#define __NR_wait4 114
+#define __NR_swapoff 115
+#define __NR_sysinfo 116
+#define __NR_ipc 117
+#define __NR_fsync 118
+#define __NR_sigreturn 119
+#define __NR_clone 120
+#define __NR_setdomainname 121
+#define __NR_uname 122
+#define __NR_adjtimex 124
+#define __NR_mprotect 125
+#define __NR_sigprocmask 126
+#define __NR_create_module 127
+#define __NR_init_module 128
+#define __NR_delete_module 129
+#define __NR_get_kernel_syms 130
+#define __NR_quotactl 131
+#define __NR_getpgid 132
+#define __NR_fchdir 133
+#define __NR_bdflush 134
+#define __NR_sysfs 135
+#define __NR_personality 136
+#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
+#define __NR_getdents 141
+#define __NR_flock 143
+#define __NR_msync 144
+#define __NR_readv 145
+#define __NR_writev 146
+#define __NR_getsid 147
+#define __NR_fdatasync 148
+#define __NR__sysctl 149
+#define __NR_mlock 150
+#define __NR_munlock 151
+#define __NR_mlockall 152
+#define __NR_munlockall 153
+#define __NR_sched_setparam 154
+#define __NR_sched_getparam 155
+#define __NR_sched_setscheduler 156
+#define __NR_sched_getscheduler 157
+#define __NR_sched_yield 158
+#define __NR_sched_get_priority_max 159
+#define __NR_sched_get_priority_min 160
+#define __NR_sched_rr_get_interval 161
+#define __NR_nanosleep 162
+#define __NR_mremap 163
+#define __NR_query_module 167
+#define __NR_poll 168
+#define __NR_nfsservctl 169
+#define __NR_prctl 172
+#define __NR_rt_sigreturn 173
+#define __NR_rt_sigaction 174
+#define __NR_rt_sigprocmask 175
+#define __NR_rt_sigpending 176
+#define __NR_rt_sigtimedwait 177
+#define __NR_rt_sigqueueinfo 178
+#define __NR_rt_sigsuspend 179
+#define __NR_pread64 180
+#define __NR_pwrite64 181
+#define __NR_getcwd 183
+#define __NR_capget 184
+#define __NR_capset 185
+#define __NR_sigaltstack 186
+#define __NR_sendfile 187
+#define __NR_getpmsg 188
+#define __NR_putpmsg 189
+#define __NR_vfork 190
+#define __NR_pivot_root 217
+#define __NR_mincore 218
+#define __NR_madvise 219
+#define __NR_getdents64 220
+#define __NR_readahead 222
+#define __NR_setxattr 224
+#define __NR_lsetxattr 225
+#define __NR_fsetxattr 226
+#define __NR_getxattr 227
+#define __NR_lgetxattr 228
+#define __NR_fgetxattr 229
+#define __NR_listxattr 230
+#define __NR_llistxattr 231
+#define __NR_flistxattr 232
+#define __NR_removexattr 233
+#define __NR_lremovexattr 234
+#define __NR_fremovexattr 235
+#define __NR_gettid 236
+#define __NR_tkill 237
+#define __NR_futex 238
+#define __NR_sched_setaffinity 239
+#define __NR_sched_getaffinity 240
+#define __NR_tgkill 241
+/* Number 242 is reserved for tux */
+#define __NR_io_setup 243
+#define __NR_io_destroy 244
+#define __NR_io_getevents 245
+#define __NR_io_submit 246
+#define __NR_io_cancel 247
+#define __NR_exit_group 248
+#define __NR_epoll_create 249
+#define __NR_epoll_ctl 250
+#define __NR_epoll_wait 251
+#define __NR_set_tid_address 252
+#define __NR_fadvise64 253
+#define __NR_timer_create 254
+#define __NR_timer_settime 255
+#define __NR_timer_gettime 256
+#define __NR_timer_getoverrun 257
+#define __NR_timer_delete 258
+#define __NR_clock_settime 259
+#define __NR_clock_gettime 260
+#define __NR_clock_getres 261
+#define __NR_clock_nanosleep 262
+/* Number 263 is reserved for vserver */
+#define __NR_statfs64 265
+#define __NR_fstatfs64 266
+#define __NR_remap_file_pages 267
+#define __NR_mbind 268
+#define __NR_get_mempolicy 269
+#define __NR_set_mempolicy 270
+#define __NR_mq_open 271
+#define __NR_mq_unlink 272
+#define __NR_mq_timedsend 273
+#define __NR_mq_timedreceive 274
+#define __NR_mq_notify 275
+#define __NR_mq_getsetattr 276
+#define __NR_kexec_load 277
+#define __NR_add_key 278
+#define __NR_request_key 279
+#define __NR_keyctl 280
+#define __NR_waitid 281
+#define __NR_ioprio_set 282
+#define __NR_ioprio_get 283
+#define __NR_inotify_init 284
+#define __NR_inotify_add_watch 285
+#define __NR_inotify_rm_watch 286
+#define __NR_migrate_pages 287
+#define __NR_openat 288
+#define __NR_mkdirat 289
+#define __NR_mknodat 290
+#define __NR_fchownat 291
+#define __NR_futimesat 292
+#define __NR_unlinkat 294
+#define __NR_renameat 295
+#define __NR_linkat 296
+#define __NR_symlinkat 297
+#define __NR_readlinkat 298
+#define __NR_fchmodat 299
+#define __NR_faccessat 300
+#define __NR_pselect6 301
+#define __NR_ppoll 302
+#define __NR_unshare 303
+#define __NR_set_robust_list 304
+#define __NR_get_robust_list 305
+#define __NR_splice 306
+#define __NR_sync_file_range 307
+#define __NR_tee 308
+#define __NR_vmsplice 309
+#define __NR_move_pages 310
+#define __NR_getcpu 311
+#define __NR_epoll_pwait 312
+#define __NR_utimes 313
+#define __NR_fallocate 314
+#define __NR_utimensat 315
+#define __NR_signalfd 316
+#define __NR_timerfd 317
+#define __NR_eventfd 318
+#define __NR_timerfd_create 319
+#define __NR_timerfd_settime 320
+#define __NR_timerfd_gettime 321
+#define __NR_signalfd4 322
+#define __NR_eventfd2 323
+#define __NR_inotify_init1 324
+#define __NR_pipe2 325
+#define __NR_dup3 326
+#define __NR_epoll_create1 327
+#define __NR_preadv 328
+#define __NR_pwritev 329
+#define __NR_rt_tgsigqueueinfo 330
+#define __NR_perf_event_open 331
+#define __NR_fanotify_init 332
+#define __NR_fanotify_mark 333
+#define __NR_prlimit64 334
+#define __NR_name_to_handle_at 335
+#define __NR_open_by_handle_at 336
+#define __NR_clock_adjtime 337
+#define __NR_syncfs 338
+#define __NR_setns 339
+#define __NR_process_vm_readv 340
+#define __NR_process_vm_writev 341
+#define __NR_s390_runtime_instr 342
+#define __NR_kcmp 343
+#define __NR_finit_module 344
+#define __NR_sched_setattr 345
+#define __NR_sched_getattr 346
+#define __NR_renameat2 347
+#define __NR_seccomp 348
+#define __NR_getrandom 349
+#define __NR_memfd_create 350
+#define __NR_bpf 351
+#define __NR_s390_pci_mmio_write 352
+#define __NR_s390_pci_mmio_read 353
+#define __NR_execveat 354
+#define __NR_userfaultfd 355
+#define __NR_membarrier 356
+#define __NR_recvmmsg 357
+#define __NR_sendmmsg 358
+#define __NR_socket 359
+#define __NR_socketpair 360
+#define __NR_bind 361
+#define __NR_connect 362
+#define __NR_listen 363
+#define __NR_accept4 364
+#define __NR_getsockopt 365
+#define __NR_setsockopt 366
+#define __NR_getsockname 367
+#define __NR_getpeername 368
+#define __NR_sendto 369
+#define __NR_sendmsg 370
+#define __NR_recvfrom 371
+#define __NR_recvmsg 372
+#define __NR_shutdown 373
+#define __NR_mlock2 374
+#define __NR_copy_file_range 375
+#define __NR_preadv2 376
+#define __NR_pwritev2 377
+#define __NR_s390_guarded_storage 378
+#define __NR_statx 379
+#define __NR_s390_sthyi 380
+#define NR_syscalls 381
+
+/*
+ * There are some system calls that are not present on 64 bit, some
+ * have a different name although they do the same (e.g. __NR_chown32
+ * is __NR_chown on 64 bit).
+ */
+#ifndef __s390x__
+
+#define __NR_time 13
+#define __NR_lchown 16
+#define __NR_setuid 23
+#define __NR_getuid 24
+#define __NR_stime 25
+#define __NR_setgid 46
+#define __NR_getgid 47
+#define __NR_geteuid 49
+#define __NR_getegid 50
+#define __NR_setreuid 70
+#define __NR_setregid 71
+#define __NR_getrlimit 76
+#define __NR_getgroups 80
+#define __NR_setgroups 81
+#define __NR_fchown 95
+#define __NR_ioperm 101
+#define __NR_setfsuid 138
+#define __NR_setfsgid 139
+#define __NR__llseek 140
+#define __NR__newselect 142
+#define __NR_setresuid 164
+#define __NR_getresuid 165
+#define __NR_setresgid 170
+#define __NR_getresgid 171
+#define __NR_chown 182
+#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
+#define __NR_mmap2 192
+#define __NR_truncate64 193
+#define __NR_ftruncate64 194
+#define __NR_stat64 195
+#define __NR_lstat64 196
+#define __NR_fstat64 197
+#define __NR_lchown32 198
+#define __NR_getuid32 199
+#define __NR_getgid32 200
+#define __NR_geteuid32 201
+#define __NR_getegid32 202
+#define __NR_setreuid32 203
+#define __NR_setregid32 204
+#define __NR_getgroups32 205
+#define __NR_setgroups32 206
+#define __NR_fchown32 207
+#define __NR_setresuid32 208
+#define __NR_getresuid32 209
+#define __NR_setresgid32 210
+#define __NR_getresgid32 211
+#define __NR_chown32 212
+#define __NR_setuid32 213
+#define __NR_setgid32 214
+#define __NR_setfsuid32 215
+#define __NR_setfsgid32 216
+#define __NR_fcntl64 221
+#define __NR_sendfile64 223
+#define __NR_fadvise64_64 264
+#define __NR_fstatat64 293
+
+#else
+
+#define __NR_select 142
+#define __NR_getrlimit 191 /* SuS compliant getrlimit */
+#define __NR_lchown 198
+#define __NR_getuid 199
+#define __NR_getgid 200
+#define __NR_geteuid 201
+#define __NR_getegid 202
+#define __NR_setreuid 203
+#define __NR_setregid 204
+#define __NR_getgroups 205
+#define __NR_setgroups 206
+#define __NR_fchown 207
+#define __NR_setresuid 208
+#define __NR_getresuid 209
+#define __NR_setresgid 210
+#define __NR_getresgid 211
+#define __NR_chown 212
+#define __NR_setuid 213
+#define __NR_setgid 214
+#define __NR_setfsuid 215
+#define __NR_setfsgid 216
+#define __NR_newfstatat 293
+
+#endif
+
+#endif /* _UAPI_ASM_S390_UNISTD_H_ */
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index ed65e82..ab16aab 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -22,6 +22,7 @@ include $(srctree)/tools/scripts/Makefile.arch
$(call detected_var,SRCARCH)
NO_PERF_REGS := 1
+NO_SYSCALL_TABLE := 1
# Additional ARCH settings for ppc
ifeq ($(SRCARCH),powerpc)
@@ -33,7 +34,8 @@ endif
ifeq ($(SRCARCH),x86)
$(call detected,CONFIG_X86)
ifeq (${IS_64_BIT}, 1)
- CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -DHAVE_SYSCALL_TABLE -I$(OUTPUT)arch/x86/include/generated
+ NO_SYSCALL_TABLE := 0
+ CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma
$(call detected,CONFIG_X86_64)
@@ -55,12 +57,18 @@ endif
ifeq ($(ARCH),s390)
NO_PERF_REGS := 0
+ NO_SYSCALL_TABLE := 0
+ CFLAGS += -I$(OUTPUT)arch/s390/include/generated
endif
ifeq ($(NO_PERF_REGS),0)
$(call detected,CONFIG_PERF_REGS)
endif
+ifneq ($(NO_SYSCALL_TABLE),1)
+ CFLAGS += -DHAVE_SYSCALL_TABLE
+endif
+
# So far there's only x86 and arm libdw unwind support merged in perf.
# Disable it on all other architectures in case libdw unwind
# support is detected in system. Add supported architectures
diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
index 21322e0..ce38831 100644
--- a/tools/perf/arch/s390/Makefile
+++ b/tools/perf/arch/s390/Makefile
@@ -2,3 +2,24 @@ ifndef NO_DWARF
PERF_HAVE_DWARF_REGS := 1
endif
HAVE_KVM_STAT_SUPPORT := 1
+
+#
+# Syscall table generation for perf
+#
+
+out := $(OUTPUT)arch/s390/include/generated/asm
+header := $(out)/syscalls_64.c
+sysdef := $(srctree)/tools/arch/s390/include/uapi/asm/unistd.h
+sysprf := $(srctree)/tools/perf/arch/s390/entry/syscalls/
+systbl := $(sysprf)/mksyscalltbl
+
+# Create output directory if not already present
+_dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)')
+
+$(header): $(sysdef) $(systbl)
+ $(Q)$(SHELL) '$(systbl)' '$(CC)' $(sysdef) > $@
+
+clean::
+ $(call QUIET_CLEAN, s390) $(RM) $(header)
+
+archheaders: $(header)
diff --git a/tools/perf/arch/s390/entry/syscalls/mksyscalltbl b/tools/perf/arch/s390/entry/syscalls/mksyscalltbl
new file mode 100755
index 0000000..7fa0d0a
--- /dev/null
+++ b/tools/perf/arch/s390/entry/syscalls/mksyscalltbl
@@ -0,0 +1,36 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Generate system call table for perf
+#
+#
+# Copyright IBM Corp. 2017
+# Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
+#
+
+gcc=$1
+input=$2
+
+if ! test -r $input; then
+ echo "Could not read input file" >&2
+ exit 1
+fi
+
+create_table()
+{
+ local max_nr
+
+ echo 'static const char *syscalltbl_s390_64[] = {'
+ while read sc nr; do
+ printf '\t[%d] = "%s",\n' $nr $sc
+ max_nr=$nr
+ done
+ echo '};'
+ echo "#define SYSCALLTBL_S390_64_MAX_ID $max_nr"
+}
+
+
+$gcc -m64 -E -dM -x c $input \
+ |sed -ne 's/^#define __NR_//p' \
+ |sort -t' ' -k2 -nu \
+ |create_table
--git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index 77406d2..23543c0 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -31,6 +31,7 @@ arch/powerpc/include/uapi/asm/kvm.h
arch/s390/include/uapi/asm/kvm.h
arch/s390/include/uapi/asm/kvm_perf.h
arch/s390/include/uapi/asm/sie.h
+arch/s390/include/uapi/asm/unistd.h
arch/arm/include/uapi/asm/kvm.h
arch/arm64/include/uapi/asm/kvm.h
include/asm-generic/bitops/arch_hweight.h
diff --git a/tools/perf/util/syscalltbl.c b/tools/perf/util/syscalltbl.c
index 6eea7cf..303bdb8 100644
--- a/tools/perf/util/syscalltbl.c
+++ b/tools/perf/util/syscalltbl.c
@@ -26,6 +26,10 @@
#include <asm/syscalls_64.c>
const int syscalltbl_native_max_id = SYSCALLTBL_x86_64_MAX_ID;
static const char **syscalltbl_native = syscalltbl_x86_64;
+#elif defined(__s390x__)
+#include <asm/syscalls_64.c>
+const int syscalltbl_native_max_id = SYSCALLTBL_S390_64_MAX_ID;
+static const char **syscalltbl_native = syscalltbl_s390_64;
#endif
struct syscall {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/3] perf: introduce errno_to_name() function
2017-12-07 8:27 [PATCH 0/3] perf: generate s390 syscall table and remove auditlibs dependency Hendrik Brueckner
2017-12-07 8:27 ` [PATCH 1/3] perf s390: generate system call table from asm/unistd.h Hendrik Brueckner
@ 2017-12-07 8:28 ` Hendrik Brueckner
2017-12-07 8:37 ` [PATCH 2/3] fixup! " Hendrik Brueckner
2017-12-07 8:28 ` [PATCH 3/3] perf trace: no longer require auditlibs if syscall tables are present Hendrik Brueckner
2017-12-07 15:29 ` [PATCH 0/3] perf: generate s390 syscall table and remove auditlibs dependency Arnaldo Carvalho de Melo
3 siblings, 1 reply; 20+ messages in thread
From: Hendrik Brueckner @ 2017-12-07 8:28 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
Introduce an errno_to_name() function to return the name of a
give errno number as string.
With this change, the dependency to libaudit can be removed for
architectures that support syscall tables. Hence, remove the
audit_errno_to_name() call in builtin-trace.c and just link
util/syscalltbl.c against libaudit. A follow-up commit could
then clean-up this dependency with respect to the syscall table.
The errno name strings are generated by util/generate-errno-names.sh
script and saved as util/errno-names.h.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
tools/perf/.gitignore | 1 +
tools/perf/Makefile.config | 2 +-
tools/perf/Makefile.perf | 12 ++++++++++--
tools/perf/builtin-trace.c | 17 ++++++++++++++---
tools/perf/util/generate-errno-names.sh | 32 ++++++++++++++++++++++++++++++++
5 files changed, 58 insertions(+), 6 deletions(-)
create mode 100755 tools/perf/util/generate-errno-names.sh
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 643cc4ba..4e022f9 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -14,6 +14,7 @@ perf*.1
perf*.xml
perf*.html
common-cmds.h
+errno-names.h
perf.data
perf.data.old
output.svg
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index ab16aab..d8447b1 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -251,7 +251,7 @@ INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
-# $(obj-perf) for generated common-cmds.h
+# $(obj-perf) for generated common-cmds.h and errno-names.h
# $(obj-perf)/util for generated bison/flex headers
ifneq ($(OUTPUT),)
INC_FLAGS += -I$(obj-perf)/util
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 68cf136..82aed33d 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -518,6 +518,12 @@ $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
$(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
+$(OUTPUT)util/errno-names.h: util/generate-errno-names.sh
+ $(QUIET_GEN). util/generate-errno-names.sh \
+ $(srctree)/include/uapi/asm-generic/errno-base.h \
+ $(srctree)/include/uapi/asm-generic/errno.h \
+ > $@+ && mv $@+ $@
+
$(SCRIPTS) : % : %.sh
$(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
@@ -565,7 +571,8 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc
$(vhost_virtio_ioctl_array) \
$(madvise_behavior_array) \
$(perf_ioctl_array) \
- $(prctl_option_array)
+ $(prctl_option_array) \
+ $(OUTPUT)util/errno-names.h
$(OUTPUT)%.o: %.c prepare FORCE
$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
@@ -847,7 +854,8 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
$(OUTPUT)$(kcmp_type_array) \
$(OUTPUT)$(vhost_virtio_ioctl_array) \
$(OUTPUT)$(perf_ioctl_array) \
- $(OUTPUT)$(prctl_option_array)
+ $(OUTPUT)$(prctl_option_array) \
+ $(OUTPUT)util/errno-names.h
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
#
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 84debdb..b7aef0f 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -42,17 +42,16 @@
#include "string2.h"
#include "syscalltbl.h"
#include "rb_resort.h"
+#include "util/errno-names.h"
#include <errno.h>
#include <inttypes.h>
-#include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */
#include <poll.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <linux/err.h>
#include <linux/filter.h>
-#include <linux/audit.h>
#include <linux/kernel.h>
#include <linux/random.h>
#include <linux/stringify.h>
@@ -1659,6 +1658,18 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sam
return sample__fprintf_callchain(sample, 38, print_opts, &callchain_cursor, trace->output);
}
+static const char *errno_to_name(int err)
+{
+ switch (err) {
+#define ERRNO_NAME_MAP(_err, _num) case _num: return #_err;
+ ALL_ERRNO_NAME_MAPPINGS
+#undef ONE_ERRNO_NAME
+ default:
+ return "(unknown)";
+ break;
+ };
+}
+
static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
union perf_event *event __maybe_unused,
struct perf_sample *sample)
@@ -1729,7 +1740,7 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
errno_print: {
char bf[STRERR_BUFSIZE];
const char *emsg = str_error_r(-ret, bf, sizeof(bf)),
- *e = audit_errno_to_name(-ret);
+ *e = errno_to_name(-ret);
fprintf(trace->output, ") = -1 %s %s", e, emsg);
}
diff --git a/tools/perf/util/generate-errno-names.sh b/tools/perf/util/generate-errno-names.sh
new file mode 100755
index 0000000..6c114a8
--- /dev/null
+++ b/tools/perf/util/generate-errno-names.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Generate errno names header file
+#
+# Copyright IBM Corp. 2017
+# Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
+
+infiles="$@"
+tmpfile=$(mktemp -t generate-errno-names.XXXXXXXXX)
+
+trap 'rm -f $tmpfile' 0
+
+grep -hE '^#define[[:blank:]]+([^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' $infiles \
+ |awk '{ print $2", "$3; }' \
+ |sort -t, -k2 -nu \
+ |sed -e 's/^/\tERRNO_NAME_MAP(/' -e 's/$/)/' \
+ > $tmpfile
+
+cat <<EoHeader
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _UTIL_ERRNO_NAMES_H
+#define _UTIL_ERRNO_NAMES_H
+
+#define ALL_ERRNO_NAME_MAPPINGS \\
+EoHeader
+head -n -1 $tmpfile |sed -e 's/$/ \\/'
+tail -1 $tmpfile
+
+cat <<EoFooter
+#endif /* _UTIL_ERRNO_NAMES_H */
+EoFooter
--
1.8.3.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 3/3] perf trace: no longer require auditlibs if syscall tables are present
2017-12-07 8:27 [PATCH 0/3] perf: generate s390 syscall table and remove auditlibs dependency Hendrik Brueckner
2017-12-07 8:27 ` [PATCH 1/3] perf s390: generate system call table from asm/unistd.h Hendrik Brueckner
2017-12-07 8:28 ` [PATCH 2/3] perf: introduce errno_to_name() function Hendrik Brueckner
@ 2017-12-07 8:28 ` Hendrik Brueckner
2017-12-07 17:53 ` Arnaldo Carvalho de Melo
2017-12-07 15:29 ` [PATCH 0/3] perf: generate s390 syscall table and remove auditlibs dependency Arnaldo Carvalho de Melo
3 siblings, 1 reply; 20+ messages in thread
From: Hendrik Brueckner @ 2017-12-07 8:28 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
Change the Makefile and build process to no longer require auditlibs
interfaces when the architecture provides system call tables.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
tools/perf/Makefile.config | 10 ++++++++--
tools/perf/builtin-help.c | 2 +-
tools/perf/perf.c | 4 ++--
tools/perf/util/generate-cmdlist.sh | 2 +-
4 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index d8447b1..6a948bf 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -531,8 +531,14 @@ endif
ifndef NO_LIBAUDIT
ifneq ($(feature-libaudit), 1)
- msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
- NO_LIBAUDIT := 1
+ ifeq ($(NO_SYSCALL_TABLE), 1)
+ msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
+ NO_LIBAUDIT := 1
+ else
+ # With syscall table support, auditlibs are no longer required to build
+ # the trace tool.
+ $(call detected,CONFIG_AUDIT)
+ endif
else
CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
EXTLIBS += -laudit
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index a0f7ed2..4aca13f 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -439,7 +439,7 @@ int cmd_help(int argc, const char **argv)
#ifdef HAVE_LIBELF_SUPPORT
"probe",
#endif
-#ifdef HAVE_LIBAUDIT_SUPPORT
+#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE)
"trace",
#endif
NULL };
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 62b1351..1b3fc8e 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -73,7 +73,7 @@ struct cmd_struct {
{ "lock", cmd_lock, 0 },
{ "kvm", cmd_kvm, 0 },
{ "test", cmd_test, 0 },
-#ifdef HAVE_LIBAUDIT_SUPPORT
+#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE)
{ "trace", cmd_trace, 0 },
#endif
{ "inject", cmd_inject, 0 },
@@ -485,7 +485,7 @@ int main(int argc, const char **argv)
argv[0] = cmd;
}
if (strstarts(cmd, "trace")) {
-#ifdef HAVE_LIBAUDIT_SUPPORT
+#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE)
setup_path();
argv[0] = "trace";
return cmd_trace(argc, argv);
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 9bbcec4..ff17920 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -38,7 +38,7 @@ do
done
echo "#endif /* HAVE_LIBELF_SUPPORT */"
-echo "#ifdef HAVE_LIBAUDIT_SUPPORT"
+echo "#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE)"
sed -n -e 's/^perf-\([^ ]*\)[ ].* audit*/\1/p' command-list.txt |
sort |
while read cmd
--
1.8.3.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] fixup! perf: introduce errno_to_name() function
2017-12-07 8:28 ` [PATCH 2/3] perf: introduce errno_to_name() function Hendrik Brueckner
@ 2017-12-07 8:37 ` Hendrik Brueckner
2017-12-07 14:48 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 20+ messages in thread
From: Hendrik Brueckner @ 2017-12-07 8:37 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
Hi Arnaldo,
just looking through my posting and just need a fixup for one hunk. Please
let me know whether I shall re-post the series again. Sorry for this
inconvenience.
On Thu, Dec 07, 2017 at 09:28:00AM +0100, Hendrik Brueckner wrote:
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
[...]
> @@ -1659,6 +1658,18 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sam
> return sample__fprintf_callchain(sample, 38, print_opts, &callchain_cursor, trace->output);
> }
>
> +static const char *errno_to_name(int err)
> +{
> + switch (err) {
> +#define ERRNO_NAME_MAP(_err, _num) case _num: return #_err;
> + ALL_ERRNO_NAME_MAPPINGS
> +#undef ONE_ERRNO_NAME
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index b7aef0f..04af6a1 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1663,7 +1663,7 @@ static const char *errno_to_name(int err)
switch (err) {
#define ERRNO_NAME_MAP(_err, _num) case _num: return #_err;
ALL_ERRNO_NAME_MAPPINGS
-#undef ONE_ERRNO_NAME
+#undef ERRNO_NAME_MAP
default:
return "(unknown)";
break;
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] fixup! perf: introduce errno_to_name() function
2017-12-07 8:37 ` [PATCH 2/3] fixup! " Hendrik Brueckner
@ 2017-12-07 14:48 ` Arnaldo Carvalho de Melo
2017-12-07 15:00 ` [PATCH 2/3 v2] perf trace: Introduce errno_to_name() Hendrik Brueckner
0 siblings, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-07 14:48 UTC (permalink / raw)
To: Hendrik Brueckner
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
Em Thu, Dec 07, 2017 at 09:37:17AM +0100, Hendrik Brueckner escreveu:
> Hi Arnaldo,
>
> just looking through my posting and just need a fixup for one hunk. Please
> let me know whether I shall re-post the series again. Sorry for this
> inconvenience.
NP, in these cases please resend the affected patch with a v2 in the
subject line, i.e.:
Subject: [PATCH 2/3 v2] perf: introduce errno_to_name() function
Some other issues with that subject line, please check the differences:
Subject: [PATCH 2/3 v2] perf trace: Introduce errno_to_name()
Regards,
- Arnaldo
> On Thu, Dec 07, 2017 at 09:28:00AM +0100, Hendrik Brueckner wrote:
> > --- a/tools/perf/builtin-trace.c
> > +++ b/tools/perf/builtin-trace.c
> [...]
> > @@ -1659,6 +1658,18 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sam
> > return sample__fprintf_callchain(sample, 38, print_opts, &callchain_cursor, trace->output);
> > }
> >
> > +static const char *errno_to_name(int err)
> > +{
> > + switch (err) {
> > +#define ERRNO_NAME_MAP(_err, _num) case _num: return #_err;
> > + ALL_ERRNO_NAME_MAPPINGS
> > +#undef ONE_ERRNO_NAME
>
>
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index b7aef0f..04af6a1 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -1663,7 +1663,7 @@ static const char *errno_to_name(int err)
> switch (err) {
> #define ERRNO_NAME_MAP(_err, _num) case _num: return #_err;
> ALL_ERRNO_NAME_MAPPINGS
> -#undef ONE_ERRNO_NAME
> +#undef ERRNO_NAME_MAP
> default:
> return "(unknown)";
> break;
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/3 v2] perf trace: Introduce errno_to_name()
2017-12-07 14:48 ` Arnaldo Carvalho de Melo
@ 2017-12-07 15:00 ` Hendrik Brueckner
2017-12-07 17:52 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 20+ messages in thread
From: Hendrik Brueckner @ 2017-12-07 15:00 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
Introduce an errno_to_name() function to return the name of a
give errno number as string.
With this change, the dependency to libaudit can be removed for
architectures that support syscall tables. Hence, remove the
audit_errno_to_name() call in builtin-trace.c and just link
util/syscalltbl.c against libaudit. A follow-up commit could
then clean-up this dependency with respect to the syscall table.
The errno name strings are generated by util/generate-errno-names.sh
script and saved as util/errno-names.h.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
tools/perf/.gitignore | 1 +
tools/perf/Makefile.config | 2 +-
tools/perf/Makefile.perf | 12 ++++++++++--
tools/perf/builtin-trace.c | 17 ++++++++++++++---
tools/perf/util/generate-errno-names.sh | 32 ++++++++++++++++++++++++++++++++
5 files changed, 58 insertions(+), 6 deletions(-)
create mode 100755 tools/perf/util/generate-errno-names.sh
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 643cc4ba..4e022f9 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -14,6 +14,7 @@ perf*.1
perf*.xml
perf*.html
common-cmds.h
+errno-names.h
perf.data
perf.data.old
output.svg
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index ab16aab..d8447b1 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -251,7 +251,7 @@ INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
-# $(obj-perf) for generated common-cmds.h
+# $(obj-perf) for generated common-cmds.h and errno-names.h
# $(obj-perf)/util for generated bison/flex headers
ifneq ($(OUTPUT),)
INC_FLAGS += -I$(obj-perf)/util
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 68cf136..82aed33d 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -518,6 +518,12 @@ $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
$(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
+$(OUTPUT)util/errno-names.h: util/generate-errno-names.sh
+ $(QUIET_GEN). util/generate-errno-names.sh \
+ $(srctree)/include/uapi/asm-generic/errno-base.h \
+ $(srctree)/include/uapi/asm-generic/errno.h \
+ > $@+ && mv $@+ $@
+
$(SCRIPTS) : % : %.sh
$(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
@@ -565,7 +571,8 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc
$(vhost_virtio_ioctl_array) \
$(madvise_behavior_array) \
$(perf_ioctl_array) \
- $(prctl_option_array)
+ $(prctl_option_array) \
+ $(OUTPUT)util/errno-names.h
$(OUTPUT)%.o: %.c prepare FORCE
$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
@@ -847,7 +854,8 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
$(OUTPUT)$(kcmp_type_array) \
$(OUTPUT)$(vhost_virtio_ioctl_array) \
$(OUTPUT)$(perf_ioctl_array) \
- $(OUTPUT)$(prctl_option_array)
+ $(OUTPUT)$(prctl_option_array) \
+ $(OUTPUT)util/errno-names.h
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
#
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 84debdb..04af6a1 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -42,17 +42,16 @@
#include "string2.h"
#include "syscalltbl.h"
#include "rb_resort.h"
+#include "util/errno-names.h"
#include <errno.h>
#include <inttypes.h>
-#include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */
#include <poll.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <linux/err.h>
#include <linux/filter.h>
-#include <linux/audit.h>
#include <linux/kernel.h>
#include <linux/random.h>
#include <linux/stringify.h>
@@ -1659,6 +1658,18 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sam
return sample__fprintf_callchain(sample, 38, print_opts, &callchain_cursor, trace->output);
}
+static const char *errno_to_name(int err)
+{
+ switch (err) {
+#define ERRNO_NAME_MAP(_err, _num) case _num: return #_err;
+ ALL_ERRNO_NAME_MAPPINGS
+#undef ERRNO_NAME_MAP
+ default:
+ return "(unknown)";
+ break;
+ };
+}
+
static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
union perf_event *event __maybe_unused,
struct perf_sample *sample)
@@ -1729,7 +1740,7 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
errno_print: {
char bf[STRERR_BUFSIZE];
const char *emsg = str_error_r(-ret, bf, sizeof(bf)),
- *e = audit_errno_to_name(-ret);
+ *e = errno_to_name(-ret);
fprintf(trace->output, ") = -1 %s %s", e, emsg);
}
diff --git a/tools/perf/util/generate-errno-names.sh b/tools/perf/util/generate-errno-names.sh
new file mode 100755
index 0000000..6c114a8
--- /dev/null
+++ b/tools/perf/util/generate-errno-names.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Generate errno names header file
+#
+# Copyright IBM Corp. 2017
+# Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
+
+infiles="$@"
+tmpfile=$(mktemp -t generate-errno-names.XXXXXXXXX)
+
+trap 'rm -f $tmpfile' 0
+
+grep -hE '^#define[[:blank:]]+([^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' $infiles \
+ |awk '{ print $2", "$3; }' \
+ |sort -t, -k2 -nu \
+ |sed -e 's/^/\tERRNO_NAME_MAP(/' -e 's/$/)/' \
+ > $tmpfile
+
+cat <<EoHeader
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _UTIL_ERRNO_NAMES_H
+#define _UTIL_ERRNO_NAMES_H
+
+#define ALL_ERRNO_NAME_MAPPINGS \\
+EoHeader
+head -n -1 $tmpfile |sed -e 's/$/ \\/'
+tail -1 $tmpfile
+
+cat <<EoFooter
+#endif /* _UTIL_ERRNO_NAMES_H */
+EoFooter
--
1.8.3.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 0/3] perf: generate s390 syscall table and remove auditlibs dependency
2017-12-07 8:27 [PATCH 0/3] perf: generate s390 syscall table and remove auditlibs dependency Hendrik Brueckner
` (2 preceding siblings ...)
2017-12-07 8:28 ` [PATCH 3/3] perf trace: no longer require auditlibs if syscall tables are present Hendrik Brueckner
@ 2017-12-07 15:29 ` Arnaldo Carvalho de Melo
3 siblings, 0 replies; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-07 15:29 UTC (permalink / raw)
To: Hendrik Brueckner
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
Em Thu, Dec 07, 2017 at 09:27:58AM +0100, Hendrik Brueckner escreveu:
> With the perf trace command you can specify system calls with wildcards.
> To support this on s390, a system call table must be provided to perf.
> Provide a script to create the perf system call table based on the defines
> in arch/s390/include/uapi/asm/unistd.h (copied to tools/arch/s390/...).
>
> Note that the first patch can be applied independent of the second and
> third patch. In case they need further discussion, please consider to
> integrate the first one.
>
> The second and third patches complete the work to remove the audit library
> dependency for perf trace when an architecture supports system call tables.
>
> Inspired by the generation of the system call tables, create a similar
> approach to generate errno name mappings. Introduce the errno_to_name()
> function to replace audit_errno_to_name() in perf trace. The third
> patch changes the build process to build and run perf trace without
> requiring the audit library anymore (for those architectures that have
> system call table support).
Excellent!
I'm reviewing this now, will take care of that fixup.
This should make the goal of doing a
'perf trace -i perf.data.from.other.arch'
Use the right conversion tables, allowing for instance to get a
perf.data file generated by 'perf trace record' and have it decoded
properly on a machine of a different arch, i.e. record on s390, use
'perf trace -i' to decoded it on x86_64 :-)
- Arnaldo
> Note: The patch set is based on the linux master branch (968edbd93c0cbb).
Please try this in the future using my perf/core branch, where bleeding
edge stuff gets developed, I'll see if something doesn't apply.
- Arnaldo
>
> Hendrik Brueckner (3):
> perf s390: generate system call table from asm/unistd.h
> perf: introduce errno_to_name() function
> perf trace: no longer require auditlibs if syscall tables are present
>
> tools/arch/s390/include/uapi/asm/unistd.h | 412 +++++++++++++++++++++++
> tools/perf/.gitignore | 1 +
> tools/perf/Makefile.config | 22 +-
> tools/perf/Makefile.perf | 12 +-
> tools/perf/arch/s390/Makefile | 21 ++
> tools/perf/arch/s390/entry/syscalls/mksyscalltbl | 36 ++
> tools/perf/builtin-help.c | 2 +-
> tools/perf/builtin-trace.c | 17 +-
> tools/perf/check-headers.sh | 1 +
> tools/perf/perf.c | 4 +-
> tools/perf/util/generate-cmdlist.sh | 2 +-
> tools/perf/util/generate-errno-names.sh | 32 ++
> tools/perf/util/syscalltbl.c | 4 +
> 13 files changed, 553 insertions(+), 13 deletions(-)
> create mode 100644 tools/arch/s390/include/uapi/asm/unistd.h
> create mode 100755 tools/perf/arch/s390/entry/syscalls/mksyscalltbl
> create mode 100755 tools/perf/util/generate-errno-names.sh
>
> --
> 1.8.3.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/3] perf s390: generate system call table from asm/unistd.h
2017-12-07 8:27 ` [PATCH 1/3] perf s390: generate system call table from asm/unistd.h Hendrik Brueckner
@ 2017-12-07 15:30 ` Arnaldo Carvalho de Melo
2017-12-07 17:37 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-07 15:30 UTC (permalink / raw)
To: Hendrik Brueckner
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
Em Thu, Dec 07, 2017 at 09:27:59AM +0100, Hendrik Brueckner escreveu:
> This should speed up accessing new system calls introduced with
> the kernel rather than waiting for libaudit updates to include
> them.
So, this needs to be split in multiple patches, one grabbing the
tools/arch/s390/include/uapi/asm/unistd.h copy and adding it to
check-headers.sh (cool, you did it! :))
I'll take a stab at splitting it here.
> It also enables users to specify wildcards, for example,
> perf trace -e 'open*'.
>
> Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
> ---
> tools/arch/s390/include/uapi/asm/unistd.h | 412 +++++++++++++++++++++++
> tools/perf/Makefile.config | 10 +-
> tools/perf/arch/s390/Makefile | 21 ++
> tools/perf/arch/s390/entry/syscalls/mksyscalltbl | 36 ++
> tools/perf/check-headers.sh | 1 +
> tools/perf/util/syscalltbl.c | 4 +
> 6 files changed, 483 insertions(+), 1 deletion(-)
> create mode 100644 tools/arch/s390/include/uapi/asm/unistd.h
> create mode 100755 tools/perf/arch/s390/entry/syscalls/mksyscalltbl
>
> diff --git a/tools/arch/s390/include/uapi/asm/unistd.h b/tools/arch/s390/include/uapi/asm/unistd.h
> new file mode 100644
> index 0000000..7251209
> --- /dev/null
> +++ b/tools/arch/s390/include/uapi/asm/unistd.h
> @@ -0,0 +1,412 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +/*
> + * S390 version
> + *
> + * Derived from "include/asm-i386/unistd.h"
> + */
> +
> +#ifndef _UAPI_ASM_S390_UNISTD_H_
> +#define _UAPI_ASM_S390_UNISTD_H_
> +
> +/*
> + * This file contains the system call numbers.
> + */
> +
> +#define __NR_exit 1
> +#define __NR_fork 2
> +#define __NR_read 3
> +#define __NR_write 4
> +#define __NR_open 5
> +#define __NR_close 6
> +#define __NR_restart_syscall 7
> +#define __NR_creat 8
> +#define __NR_link 9
> +#define __NR_unlink 10
> +#define __NR_execve 11
> +#define __NR_chdir 12
> +#define __NR_mknod 14
> +#define __NR_chmod 15
> +#define __NR_lseek 19
> +#define __NR_getpid 20
> +#define __NR_mount 21
> +#define __NR_umount 22
> +#define __NR_ptrace 26
> +#define __NR_alarm 27
> +#define __NR_pause 29
> +#define __NR_utime 30
> +#define __NR_access 33
> +#define __NR_nice 34
> +#define __NR_sync 36
> +#define __NR_kill 37
> +#define __NR_rename 38
> +#define __NR_mkdir 39
> +#define __NR_rmdir 40
> +#define __NR_dup 41
> +#define __NR_pipe 42
> +#define __NR_times 43
> +#define __NR_brk 45
> +#define __NR_signal 48
> +#define __NR_acct 51
> +#define __NR_umount2 52
> +#define __NR_ioctl 54
> +#define __NR_fcntl 55
> +#define __NR_setpgid 57
> +#define __NR_umask 60
> +#define __NR_chroot 61
> +#define __NR_ustat 62
> +#define __NR_dup2 63
> +#define __NR_getppid 64
> +#define __NR_getpgrp 65
> +#define __NR_setsid 66
> +#define __NR_sigaction 67
> +#define __NR_sigsuspend 72
> +#define __NR_sigpending 73
> +#define __NR_sethostname 74
> +#define __NR_setrlimit 75
> +#define __NR_getrusage 77
> +#define __NR_gettimeofday 78
> +#define __NR_settimeofday 79
> +#define __NR_symlink 83
> +#define __NR_readlink 85
> +#define __NR_uselib 86
> +#define __NR_swapon 87
> +#define __NR_reboot 88
> +#define __NR_readdir 89
> +#define __NR_mmap 90
> +#define __NR_munmap 91
> +#define __NR_truncate 92
> +#define __NR_ftruncate 93
> +#define __NR_fchmod 94
> +#define __NR_getpriority 96
> +#define __NR_setpriority 97
> +#define __NR_statfs 99
> +#define __NR_fstatfs 100
> +#define __NR_socketcall 102
> +#define __NR_syslog 103
> +#define __NR_setitimer 104
> +#define __NR_getitimer 105
> +#define __NR_stat 106
> +#define __NR_lstat 107
> +#define __NR_fstat 108
> +#define __NR_lookup_dcookie 110
> +#define __NR_vhangup 111
> +#define __NR_idle 112
> +#define __NR_wait4 114
> +#define __NR_swapoff 115
> +#define __NR_sysinfo 116
> +#define __NR_ipc 117
> +#define __NR_fsync 118
> +#define __NR_sigreturn 119
> +#define __NR_clone 120
> +#define __NR_setdomainname 121
> +#define __NR_uname 122
> +#define __NR_adjtimex 124
> +#define __NR_mprotect 125
> +#define __NR_sigprocmask 126
> +#define __NR_create_module 127
> +#define __NR_init_module 128
> +#define __NR_delete_module 129
> +#define __NR_get_kernel_syms 130
> +#define __NR_quotactl 131
> +#define __NR_getpgid 132
> +#define __NR_fchdir 133
> +#define __NR_bdflush 134
> +#define __NR_sysfs 135
> +#define __NR_personality 136
> +#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
> +#define __NR_getdents 141
> +#define __NR_flock 143
> +#define __NR_msync 144
> +#define __NR_readv 145
> +#define __NR_writev 146
> +#define __NR_getsid 147
> +#define __NR_fdatasync 148
> +#define __NR__sysctl 149
> +#define __NR_mlock 150
> +#define __NR_munlock 151
> +#define __NR_mlockall 152
> +#define __NR_munlockall 153
> +#define __NR_sched_setparam 154
> +#define __NR_sched_getparam 155
> +#define __NR_sched_setscheduler 156
> +#define __NR_sched_getscheduler 157
> +#define __NR_sched_yield 158
> +#define __NR_sched_get_priority_max 159
> +#define __NR_sched_get_priority_min 160
> +#define __NR_sched_rr_get_interval 161
> +#define __NR_nanosleep 162
> +#define __NR_mremap 163
> +#define __NR_query_module 167
> +#define __NR_poll 168
> +#define __NR_nfsservctl 169
> +#define __NR_prctl 172
> +#define __NR_rt_sigreturn 173
> +#define __NR_rt_sigaction 174
> +#define __NR_rt_sigprocmask 175
> +#define __NR_rt_sigpending 176
> +#define __NR_rt_sigtimedwait 177
> +#define __NR_rt_sigqueueinfo 178
> +#define __NR_rt_sigsuspend 179
> +#define __NR_pread64 180
> +#define __NR_pwrite64 181
> +#define __NR_getcwd 183
> +#define __NR_capget 184
> +#define __NR_capset 185
> +#define __NR_sigaltstack 186
> +#define __NR_sendfile 187
> +#define __NR_getpmsg 188
> +#define __NR_putpmsg 189
> +#define __NR_vfork 190
> +#define __NR_pivot_root 217
> +#define __NR_mincore 218
> +#define __NR_madvise 219
> +#define __NR_getdents64 220
> +#define __NR_readahead 222
> +#define __NR_setxattr 224
> +#define __NR_lsetxattr 225
> +#define __NR_fsetxattr 226
> +#define __NR_getxattr 227
> +#define __NR_lgetxattr 228
> +#define __NR_fgetxattr 229
> +#define __NR_listxattr 230
> +#define __NR_llistxattr 231
> +#define __NR_flistxattr 232
> +#define __NR_removexattr 233
> +#define __NR_lremovexattr 234
> +#define __NR_fremovexattr 235
> +#define __NR_gettid 236
> +#define __NR_tkill 237
> +#define __NR_futex 238
> +#define __NR_sched_setaffinity 239
> +#define __NR_sched_getaffinity 240
> +#define __NR_tgkill 241
> +/* Number 242 is reserved for tux */
> +#define __NR_io_setup 243
> +#define __NR_io_destroy 244
> +#define __NR_io_getevents 245
> +#define __NR_io_submit 246
> +#define __NR_io_cancel 247
> +#define __NR_exit_group 248
> +#define __NR_epoll_create 249
> +#define __NR_epoll_ctl 250
> +#define __NR_epoll_wait 251
> +#define __NR_set_tid_address 252
> +#define __NR_fadvise64 253
> +#define __NR_timer_create 254
> +#define __NR_timer_settime 255
> +#define __NR_timer_gettime 256
> +#define __NR_timer_getoverrun 257
> +#define __NR_timer_delete 258
> +#define __NR_clock_settime 259
> +#define __NR_clock_gettime 260
> +#define __NR_clock_getres 261
> +#define __NR_clock_nanosleep 262
> +/* Number 263 is reserved for vserver */
> +#define __NR_statfs64 265
> +#define __NR_fstatfs64 266
> +#define __NR_remap_file_pages 267
> +#define __NR_mbind 268
> +#define __NR_get_mempolicy 269
> +#define __NR_set_mempolicy 270
> +#define __NR_mq_open 271
> +#define __NR_mq_unlink 272
> +#define __NR_mq_timedsend 273
> +#define __NR_mq_timedreceive 274
> +#define __NR_mq_notify 275
> +#define __NR_mq_getsetattr 276
> +#define __NR_kexec_load 277
> +#define __NR_add_key 278
> +#define __NR_request_key 279
> +#define __NR_keyctl 280
> +#define __NR_waitid 281
> +#define __NR_ioprio_set 282
> +#define __NR_ioprio_get 283
> +#define __NR_inotify_init 284
> +#define __NR_inotify_add_watch 285
> +#define __NR_inotify_rm_watch 286
> +#define __NR_migrate_pages 287
> +#define __NR_openat 288
> +#define __NR_mkdirat 289
> +#define __NR_mknodat 290
> +#define __NR_fchownat 291
> +#define __NR_futimesat 292
> +#define __NR_unlinkat 294
> +#define __NR_renameat 295
> +#define __NR_linkat 296
> +#define __NR_symlinkat 297
> +#define __NR_readlinkat 298
> +#define __NR_fchmodat 299
> +#define __NR_faccessat 300
> +#define __NR_pselect6 301
> +#define __NR_ppoll 302
> +#define __NR_unshare 303
> +#define __NR_set_robust_list 304
> +#define __NR_get_robust_list 305
> +#define __NR_splice 306
> +#define __NR_sync_file_range 307
> +#define __NR_tee 308
> +#define __NR_vmsplice 309
> +#define __NR_move_pages 310
> +#define __NR_getcpu 311
> +#define __NR_epoll_pwait 312
> +#define __NR_utimes 313
> +#define __NR_fallocate 314
> +#define __NR_utimensat 315
> +#define __NR_signalfd 316
> +#define __NR_timerfd 317
> +#define __NR_eventfd 318
> +#define __NR_timerfd_create 319
> +#define __NR_timerfd_settime 320
> +#define __NR_timerfd_gettime 321
> +#define __NR_signalfd4 322
> +#define __NR_eventfd2 323
> +#define __NR_inotify_init1 324
> +#define __NR_pipe2 325
> +#define __NR_dup3 326
> +#define __NR_epoll_create1 327
> +#define __NR_preadv 328
> +#define __NR_pwritev 329
> +#define __NR_rt_tgsigqueueinfo 330
> +#define __NR_perf_event_open 331
> +#define __NR_fanotify_init 332
> +#define __NR_fanotify_mark 333
> +#define __NR_prlimit64 334
> +#define __NR_name_to_handle_at 335
> +#define __NR_open_by_handle_at 336
> +#define __NR_clock_adjtime 337
> +#define __NR_syncfs 338
> +#define __NR_setns 339
> +#define __NR_process_vm_readv 340
> +#define __NR_process_vm_writev 341
> +#define __NR_s390_runtime_instr 342
> +#define __NR_kcmp 343
> +#define __NR_finit_module 344
> +#define __NR_sched_setattr 345
> +#define __NR_sched_getattr 346
> +#define __NR_renameat2 347
> +#define __NR_seccomp 348
> +#define __NR_getrandom 349
> +#define __NR_memfd_create 350
> +#define __NR_bpf 351
> +#define __NR_s390_pci_mmio_write 352
> +#define __NR_s390_pci_mmio_read 353
> +#define __NR_execveat 354
> +#define __NR_userfaultfd 355
> +#define __NR_membarrier 356
> +#define __NR_recvmmsg 357
> +#define __NR_sendmmsg 358
> +#define __NR_socket 359
> +#define __NR_socketpair 360
> +#define __NR_bind 361
> +#define __NR_connect 362
> +#define __NR_listen 363
> +#define __NR_accept4 364
> +#define __NR_getsockopt 365
> +#define __NR_setsockopt 366
> +#define __NR_getsockname 367
> +#define __NR_getpeername 368
> +#define __NR_sendto 369
> +#define __NR_sendmsg 370
> +#define __NR_recvfrom 371
> +#define __NR_recvmsg 372
> +#define __NR_shutdown 373
> +#define __NR_mlock2 374
> +#define __NR_copy_file_range 375
> +#define __NR_preadv2 376
> +#define __NR_pwritev2 377
> +#define __NR_s390_guarded_storage 378
> +#define __NR_statx 379
> +#define __NR_s390_sthyi 380
> +#define NR_syscalls 381
> +
> +/*
> + * There are some system calls that are not present on 64 bit, some
> + * have a different name although they do the same (e.g. __NR_chown32
> + * is __NR_chown on 64 bit).
> + */
> +#ifndef __s390x__
> +
> +#define __NR_time 13
> +#define __NR_lchown 16
> +#define __NR_setuid 23
> +#define __NR_getuid 24
> +#define __NR_stime 25
> +#define __NR_setgid 46
> +#define __NR_getgid 47
> +#define __NR_geteuid 49
> +#define __NR_getegid 50
> +#define __NR_setreuid 70
> +#define __NR_setregid 71
> +#define __NR_getrlimit 76
> +#define __NR_getgroups 80
> +#define __NR_setgroups 81
> +#define __NR_fchown 95
> +#define __NR_ioperm 101
> +#define __NR_setfsuid 138
> +#define __NR_setfsgid 139
> +#define __NR__llseek 140
> +#define __NR__newselect 142
> +#define __NR_setresuid 164
> +#define __NR_getresuid 165
> +#define __NR_setresgid 170
> +#define __NR_getresgid 171
> +#define __NR_chown 182
> +#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
> +#define __NR_mmap2 192
> +#define __NR_truncate64 193
> +#define __NR_ftruncate64 194
> +#define __NR_stat64 195
> +#define __NR_lstat64 196
> +#define __NR_fstat64 197
> +#define __NR_lchown32 198
> +#define __NR_getuid32 199
> +#define __NR_getgid32 200
> +#define __NR_geteuid32 201
> +#define __NR_getegid32 202
> +#define __NR_setreuid32 203
> +#define __NR_setregid32 204
> +#define __NR_getgroups32 205
> +#define __NR_setgroups32 206
> +#define __NR_fchown32 207
> +#define __NR_setresuid32 208
> +#define __NR_getresuid32 209
> +#define __NR_setresgid32 210
> +#define __NR_getresgid32 211
> +#define __NR_chown32 212
> +#define __NR_setuid32 213
> +#define __NR_setgid32 214
> +#define __NR_setfsuid32 215
> +#define __NR_setfsgid32 216
> +#define __NR_fcntl64 221
> +#define __NR_sendfile64 223
> +#define __NR_fadvise64_64 264
> +#define __NR_fstatat64 293
> +
> +#else
> +
> +#define __NR_select 142
> +#define __NR_getrlimit 191 /* SuS compliant getrlimit */
> +#define __NR_lchown 198
> +#define __NR_getuid 199
> +#define __NR_getgid 200
> +#define __NR_geteuid 201
> +#define __NR_getegid 202
> +#define __NR_setreuid 203
> +#define __NR_setregid 204
> +#define __NR_getgroups 205
> +#define __NR_setgroups 206
> +#define __NR_fchown 207
> +#define __NR_setresuid 208
> +#define __NR_getresuid 209
> +#define __NR_setresgid 210
> +#define __NR_getresgid 211
> +#define __NR_chown 212
> +#define __NR_setuid 213
> +#define __NR_setgid 214
> +#define __NR_setfsuid 215
> +#define __NR_setfsgid 216
> +#define __NR_newfstatat 293
> +
> +#endif
> +
> +#endif /* _UAPI_ASM_S390_UNISTD_H_ */
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index ed65e82..ab16aab 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -22,6 +22,7 @@ include $(srctree)/tools/scripts/Makefile.arch
> $(call detected_var,SRCARCH)
>
> NO_PERF_REGS := 1
> +NO_SYSCALL_TABLE := 1
>
> # Additional ARCH settings for ppc
> ifeq ($(SRCARCH),powerpc)
> @@ -33,7 +34,8 @@ endif
> ifeq ($(SRCARCH),x86)
> $(call detected,CONFIG_X86)
> ifeq (${IS_64_BIT}, 1)
> - CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -DHAVE_SYSCALL_TABLE -I$(OUTPUT)arch/x86/include/generated
> + NO_SYSCALL_TABLE := 0
> + CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -I$(OUTPUT)arch/x86/include/generated
> ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
> LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma
> $(call detected,CONFIG_X86_64)
> @@ -55,12 +57,18 @@ endif
>
> ifeq ($(ARCH),s390)
> NO_PERF_REGS := 0
> + NO_SYSCALL_TABLE := 0
> + CFLAGS += -I$(OUTPUT)arch/s390/include/generated
> endif
>
> ifeq ($(NO_PERF_REGS),0)
> $(call detected,CONFIG_PERF_REGS)
> endif
>
> +ifneq ($(NO_SYSCALL_TABLE),1)
> + CFLAGS += -DHAVE_SYSCALL_TABLE
> +endif
> +
> # So far there's only x86 and arm libdw unwind support merged in perf.
> # Disable it on all other architectures in case libdw unwind
> # support is detected in system. Add supported architectures
> diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
> index 21322e0..ce38831 100644
> --- a/tools/perf/arch/s390/Makefile
> +++ b/tools/perf/arch/s390/Makefile
> @@ -2,3 +2,24 @@ ifndef NO_DWARF
> PERF_HAVE_DWARF_REGS := 1
> endif
> HAVE_KVM_STAT_SUPPORT := 1
> +
> +#
> +# Syscall table generation for perf
> +#
> +
> +out := $(OUTPUT)arch/s390/include/generated/asm
> +header := $(out)/syscalls_64.c
> +sysdef := $(srctree)/tools/arch/s390/include/uapi/asm/unistd.h
> +sysprf := $(srctree)/tools/perf/arch/s390/entry/syscalls/
> +systbl := $(sysprf)/mksyscalltbl
> +
> +# Create output directory if not already present
> +_dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)')
> +
> +$(header): $(sysdef) $(systbl)
> + $(Q)$(SHELL) '$(systbl)' '$(CC)' $(sysdef) > $@
> +
> +clean::
> + $(call QUIET_CLEAN, s390) $(RM) $(header)
> +
> +archheaders: $(header)
> diff --git a/tools/perf/arch/s390/entry/syscalls/mksyscalltbl b/tools/perf/arch/s390/entry/syscalls/mksyscalltbl
> new file mode 100755
> index 0000000..7fa0d0a
> --- /dev/null
> +++ b/tools/perf/arch/s390/entry/syscalls/mksyscalltbl
> @@ -0,0 +1,36 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Generate system call table for perf
> +#
> +#
> +# Copyright IBM Corp. 2017
> +# Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
> +#
> +
> +gcc=$1
> +input=$2
> +
> +if ! test -r $input; then
> + echo "Could not read input file" >&2
> + exit 1
> +fi
> +
> +create_table()
> +{
> + local max_nr
> +
> + echo 'static const char *syscalltbl_s390_64[] = {'
> + while read sc nr; do
> + printf '\t[%d] = "%s",\n' $nr $sc
> + max_nr=$nr
> + done
> + echo '};'
> + echo "#define SYSCALLTBL_S390_64_MAX_ID $max_nr"
> +}
> +
> +
> +$gcc -m64 -E -dM -x c $input \
> + |sed -ne 's/^#define __NR_//p' \
> + |sort -t' ' -k2 -nu \
> + |create_table
> diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
> index 77406d2..23543c0 100755
> --- a/tools/perf/check-headers.sh
> +++ b/tools/perf/check-headers.sh
> @@ -31,6 +31,7 @@ arch/powerpc/include/uapi/asm/kvm.h
> arch/s390/include/uapi/asm/kvm.h
> arch/s390/include/uapi/asm/kvm_perf.h
> arch/s390/include/uapi/asm/sie.h
> +arch/s390/include/uapi/asm/unistd.h
> arch/arm/include/uapi/asm/kvm.h
> arch/arm64/include/uapi/asm/kvm.h
> include/asm-generic/bitops/arch_hweight.h
> diff --git a/tools/perf/util/syscalltbl.c b/tools/perf/util/syscalltbl.c
> index 6eea7cf..303bdb8 100644
> --- a/tools/perf/util/syscalltbl.c
> +++ b/tools/perf/util/syscalltbl.c
> @@ -26,6 +26,10 @@
> #include <asm/syscalls_64.c>
> const int syscalltbl_native_max_id = SYSCALLTBL_x86_64_MAX_ID;
> static const char **syscalltbl_native = syscalltbl_x86_64;
> +#elif defined(__s390x__)
> +#include <asm/syscalls_64.c>
> +const int syscalltbl_native_max_id = SYSCALLTBL_S390_64_MAX_ID;
> +static const char **syscalltbl_native = syscalltbl_s390_64;
> #endif
>
> struct syscall {
> --
> 1.8.3.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/3] perf s390: generate system call table from asm/unistd.h
2017-12-07 15:30 ` Arnaldo Carvalho de Melo
@ 2017-12-07 17:37 ` Arnaldo Carvalho de Melo
2017-12-11 9:06 ` Hendrik Brueckner
0 siblings, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-07 17:37 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Hendrik Brueckner, Thomas-Mich Richter, Michael Petlan,
Jiri Olsa, linux-perf-users, linux-s390
Em Thu, Dec 07, 2017 at 12:30:40PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Dec 07, 2017 at 09:27:59AM +0100, Hendrik Brueckner escreveu:
> > This should speed up accessing new system calls introduced with
> > the kernel rather than waiting for libaudit updates to include
> > them.
>
> So, this needs to be split in multiple patches, one grabbing the
> tools/arch/s390/include/uapi/asm/unistd.h copy and adding it to
> check-headers.sh (cool, you did it! :))
>
> I'll take a stab at splitting it here.
So, splitted it into three patches and tested the generation, showing
the steps and results on the second patch commit message:
[acme@jouet perf]$ git log -3 --oneline
b91e81b8e967 (HEAD -> perf/core, acme.korg/perf/core) perf trace: Use generated syscall table on s390 too
8fe39fe5058d perf s390: Generate system call table from asm/unistd.h
fdd7d74b2782 tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h
[acme@jouet perf]$
And pushed it to my perf/core branch on:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
Please take a look and check that I didn't mess anything up :-)
- Arnaldo
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3 v2] perf trace: Introduce errno_to_name()
2017-12-07 15:00 ` [PATCH 2/3 v2] perf trace: Introduce errno_to_name() Hendrik Brueckner
@ 2017-12-07 17:52 ` Arnaldo Carvalho de Melo
2017-12-11 11:32 ` Hendrik Brueckner
0 siblings, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-07 17:52 UTC (permalink / raw)
To: Hendrik Brueckner
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
Em Thu, Dec 07, 2017 at 04:00:10PM +0100, Hendrik Brueckner escreveu:
> Introduce an errno_to_name() function to return the name of a
> give errno number as string.
Humm, we cannot use asm-generic for all, as there are differences in the
errno numbers from arch to arch, for instance:
In arch/alpha/include/uapi/asm/errno.h we use errno-base.h but even in
that part one of its entries gets a different number on the Alpha arch,
EAGAIN:
-------------------
#include <asm-generic/errno-base.h>
#undef EAGAIN /* 11 in errno-base.h */
#define EDEADLK 11 /* Resource deadlock would occur */
#define EAGAIN 35 /* Try again */
#define EWOULDBLOCK EAGAIN /* Operation would block */
-------------------
And then all these are different:
-------------------
#define EINPROGRESS 36 /* Operation now in progress */
#define EALREADY 37 /* Operation already in progress */
#define ENOTSOCK 38 /* Socket operation on non-socket */
#define EDESTADDRREQ 39 /* Destination address required */
#define EMSGSIZE 40 /* Message too long */
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
#define ENOPROTOOPT 42 /* Protocol not available */
<SNIP>
-------------------
mips also has differences, shares errno-base.h completely but:
arch/mips/include/uapi/asm/errno.h
-------------------
/*
* These error numbers are intended to be MIPS ABI compatible
*/
#include <asm-generic/errno-base.h>
#define ENOMSG 35 /* No message of desired type */
#define EIDRM 36 /* Identifier removed */
#define ECHRNG 37 /* Channel number out of range */
#define EL2NSYNC 38 /* Level 2 not synchronized */
#define EL3HLT 39 /* Level 3 halted */
#define EL3RST 40 /* Level 3 reset */
#define ELNRNG 41 /* Link number out of range */
<SNIP>
-------------------
PARISC looks like MIPS, at least in this little excerpt:
arch/parisc/include/uapi/asm/errno.h
-------------------
#include <asm-generic/errno-base.h>
#define ENOMSG 35 /* No message of desired type */
#define EIDRM 36 /* Identifier removed */
#define ECHRNG 37 /* Channel number out of range */
#define EL2NSYNC 38 /* Level 2 not synchronized */
#define EL3HLT 39 /* Level 3 halted */
#define EL3RST 40 /* Level 3 reset */
#define ELNRNG 41 /* Link number out of range */
<SNIP>
-------------------
PowerPC is more modest, wants only to change one entry:
#include <asm-generic/errno.h>
#undef EDEADLOCK
#define EDEADLOCK 58 /* File locking deadlock error */
:-)
So you can try to copy all arch/*/include/uapi/asm/errno.h files and
use the arch to key that, i.e. its almost what you did, but needs to
take the arch into consideration.
Later we'll generate a two dimensional table of sorts, having the first
dimension be the arch name, so that we can translate errnos in a
perf.data file collected on, say, mips (one of these routers) in a tool
running on x86_64 (or S/390 :)).
- Arnaldo
> With this change, the dependency to libaudit can be removed for
> architectures that support syscall tables. Hence, remove the
> audit_errno_to_name() call in builtin-trace.c and just link
> util/syscalltbl.c against libaudit. A follow-up commit could
> then clean-up this dependency with respect to the syscall table.
>
> The errno name strings are generated by util/generate-errno-names.sh
> script and saved as util/errno-names.h.
>
> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
> ---
> tools/perf/.gitignore | 1 +
> tools/perf/Makefile.config | 2 +-
> tools/perf/Makefile.perf | 12 ++++++++++--
> tools/perf/builtin-trace.c | 17 ++++++++++++++---
> tools/perf/util/generate-errno-names.sh | 32 ++++++++++++++++++++++++++++++++
> 5 files changed, 58 insertions(+), 6 deletions(-)
> create mode 100755 tools/perf/util/generate-errno-names.sh
>
> diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
> index 643cc4ba..4e022f9 100644
> --- a/tools/perf/.gitignore
> +++ b/tools/perf/.gitignore
> @@ -14,6 +14,7 @@ perf*.1
> perf*.xml
> perf*.html
> common-cmds.h
> +errno-names.h
> perf.data
> perf.data.old
> output.svg
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index ab16aab..d8447b1 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -251,7 +251,7 @@ INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
> INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
> INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
>
> -# $(obj-perf) for generated common-cmds.h
> +# $(obj-perf) for generated common-cmds.h and errno-names.h
> # $(obj-perf)/util for generated bison/flex headers
> ifneq ($(OUTPUT),)
> INC_FLAGS += -I$(obj-perf)/util
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 68cf136..82aed33d 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -518,6 +518,12 @@ $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
> $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
> $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
>
> +$(OUTPUT)util/errno-names.h: util/generate-errno-names.sh
> + $(QUIET_GEN). util/generate-errno-names.sh \
> + $(srctree)/include/uapi/asm-generic/errno-base.h \
> + $(srctree)/include/uapi/asm-generic/errno.h \
> + > $@+ && mv $@+ $@
> +
> $(SCRIPTS) : % : %.sh
> $(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
>
> @@ -565,7 +571,8 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc
> $(vhost_virtio_ioctl_array) \
> $(madvise_behavior_array) \
> $(perf_ioctl_array) \
> - $(prctl_option_array)
> + $(prctl_option_array) \
> + $(OUTPUT)util/errno-names.h
>
> $(OUTPUT)%.o: %.c prepare FORCE
> $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
> @@ -847,7 +854,8 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
> $(OUTPUT)$(kcmp_type_array) \
> $(OUTPUT)$(vhost_virtio_ioctl_array) \
> $(OUTPUT)$(perf_ioctl_array) \
> - $(OUTPUT)$(prctl_option_array)
> + $(OUTPUT)$(prctl_option_array) \
> + $(OUTPUT)util/errno-names.h
> $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
>
> #
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 84debdb..04af6a1 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -42,17 +42,16 @@
> #include "string2.h"
> #include "syscalltbl.h"
> #include "rb_resort.h"
> +#include "util/errno-names.h"
>
> #include <errno.h>
> #include <inttypes.h>
> -#include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */
> #include <poll.h>
> #include <signal.h>
> #include <stdlib.h>
> #include <string.h>
> #include <linux/err.h>
> #include <linux/filter.h>
> -#include <linux/audit.h>
> #include <linux/kernel.h>
> #include <linux/random.h>
> #include <linux/stringify.h>
> @@ -1659,6 +1658,18 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sam
> return sample__fprintf_callchain(sample, 38, print_opts, &callchain_cursor, trace->output);
> }
>
> +static const char *errno_to_name(int err)
> +{
> + switch (err) {
> +#define ERRNO_NAME_MAP(_err, _num) case _num: return #_err;
> + ALL_ERRNO_NAME_MAPPINGS
> +#undef ERRNO_NAME_MAP
> + default:
> + return "(unknown)";
> + break;
> + };
> +}
> +
> static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
> union perf_event *event __maybe_unused,
> struct perf_sample *sample)
> @@ -1729,7 +1740,7 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
> errno_print: {
> char bf[STRERR_BUFSIZE];
> const char *emsg = str_error_r(-ret, bf, sizeof(bf)),
> - *e = audit_errno_to_name(-ret);
> + *e = errno_to_name(-ret);
>
> fprintf(trace->output, ") = -1 %s %s", e, emsg);
> }
> diff --git a/tools/perf/util/generate-errno-names.sh b/tools/perf/util/generate-errno-names.sh
> new file mode 100755
> index 0000000..6c114a8
> --- /dev/null
> +++ b/tools/perf/util/generate-errno-names.sh
> @@ -0,0 +1,32 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Generate errno names header file
> +#
> +# Copyright IBM Corp. 2017
> +# Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
> +
> +infiles="$@"
> +tmpfile=$(mktemp -t generate-errno-names.XXXXXXXXX)
> +
> +trap 'rm -f $tmpfile' 0
> +
> +grep -hE '^#define[[:blank:]]+([^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' $infiles \
> + |awk '{ print $2", "$3; }' \
> + |sort -t, -k2 -nu \
> + |sed -e 's/^/\tERRNO_NAME_MAP(/' -e 's/$/)/' \
> + > $tmpfile
> +
> +cat <<EoHeader
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _UTIL_ERRNO_NAMES_H
> +#define _UTIL_ERRNO_NAMES_H
> +
> +#define ALL_ERRNO_NAME_MAPPINGS \\
> +EoHeader
> +head -n -1 $tmpfile |sed -e 's/$/ \\/'
> +tail -1 $tmpfile
> +
> +cat <<EoFooter
> +#endif /* _UTIL_ERRNO_NAMES_H */
> +EoFooter
> --
> 1.8.3.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] perf trace: no longer require auditlibs if syscall tables are present
2017-12-07 8:28 ` [PATCH 3/3] perf trace: no longer require auditlibs if syscall tables are present Hendrik Brueckner
@ 2017-12-07 17:53 ` Arnaldo Carvalho de Melo
2017-12-11 9:35 ` Hendrik Brueckner
0 siblings, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-07 17:53 UTC (permalink / raw)
To: Hendrik Brueckner
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
Em Thu, Dec 07, 2017 at 09:28:01AM +0100, Hendrik Brueckner escreveu:
> Change the Makefile and build process to no longer require auditlibs
> interfaces when the architecture provides system call tables.
And this one will have to wait for the fix in how the errno translation
tables are generated, ok?
- Arnaldo
> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
> ---
> tools/perf/Makefile.config | 10 ++++++++--
> tools/perf/builtin-help.c | 2 +-
> tools/perf/perf.c | 4 ++--
> tools/perf/util/generate-cmdlist.sh | 2 +-
> 4 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index d8447b1..6a948bf 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -531,8 +531,14 @@ endif
>
> ifndef NO_LIBAUDIT
> ifneq ($(feature-libaudit), 1)
> - msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
> - NO_LIBAUDIT := 1
> + ifeq ($(NO_SYSCALL_TABLE), 1)
> + msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
> + NO_LIBAUDIT := 1
> + else
> + # With syscall table support, auditlibs are no longer required to build
> + # the trace tool.
> + $(call detected,CONFIG_AUDIT)
> + endif
> else
> CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
> EXTLIBS += -laudit
> diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
> index a0f7ed2..4aca13f 100644
> --- a/tools/perf/builtin-help.c
> +++ b/tools/perf/builtin-help.c
> @@ -439,7 +439,7 @@ int cmd_help(int argc, const char **argv)
> #ifdef HAVE_LIBELF_SUPPORT
> "probe",
> #endif
> -#ifdef HAVE_LIBAUDIT_SUPPORT
> +#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE)
> "trace",
> #endif
> NULL };
> diff --git a/tools/perf/perf.c b/tools/perf/perf.c
> index 62b1351..1b3fc8e 100644
> --- a/tools/perf/perf.c
> +++ b/tools/perf/perf.c
> @@ -73,7 +73,7 @@ struct cmd_struct {
> { "lock", cmd_lock, 0 },
> { "kvm", cmd_kvm, 0 },
> { "test", cmd_test, 0 },
> -#ifdef HAVE_LIBAUDIT_SUPPORT
> +#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE)
> { "trace", cmd_trace, 0 },
> #endif
> { "inject", cmd_inject, 0 },
> @@ -485,7 +485,7 @@ int main(int argc, const char **argv)
> argv[0] = cmd;
> }
> if (strstarts(cmd, "trace")) {
> -#ifdef HAVE_LIBAUDIT_SUPPORT
> +#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE)
> setup_path();
> argv[0] = "trace";
> return cmd_trace(argc, argv);
> diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
> index 9bbcec4..ff17920 100755
> --- a/tools/perf/util/generate-cmdlist.sh
> +++ b/tools/perf/util/generate-cmdlist.sh
> @@ -38,7 +38,7 @@ do
> done
> echo "#endif /* HAVE_LIBELF_SUPPORT */"
>
> -echo "#ifdef HAVE_LIBAUDIT_SUPPORT"
> +echo "#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE)"
> sed -n -e 's/^perf-\([^ ]*\)[ ].* audit*/\1/p' command-list.txt |
> sort |
> while read cmd
> --
> 1.8.3.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/3] perf s390: generate system call table from asm/unistd.h
2017-12-07 17:37 ` Arnaldo Carvalho de Melo
@ 2017-12-11 9:06 ` Hendrik Brueckner
2017-12-11 14:19 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 20+ messages in thread
From: Hendrik Brueckner @ 2017-12-11 9:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Arnaldo Carvalho de Melo, Hendrik Brueckner, Thomas-Mich Richter,
Michael Petlan, Jiri Olsa, linux-perf-users, linux-s390
Hi Arnaldo,
On Thu, Dec 07, 2017 at 02:37:31PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Dec 07, 2017 at 12:30:40PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Thu, Dec 07, 2017 at 09:27:59AM +0100, Hendrik Brueckner escreveu:
> > > This should speed up accessing new system calls introduced with
> > > the kernel rather than waiting for libaudit updates to include
> > > them.
> >
> > So, this needs to be split in multiple patches, one grabbing the
> > tools/arch/s390/include/uapi/asm/unistd.h copy and adding it to
> > check-headers.sh (cool, you did it! :))
> >
> > I'll take a stab at splitting it here.
>
> So, splitted it into three patches and tested the generation, showing
> the steps and results on the second patch commit message:
>
> [acme@jouet perf]$ git log -3 --oneline
> b91e81b8e967 (HEAD -> perf/core, acme.korg/perf/core) perf trace: Use generated syscall table on s390 too
> 8fe39fe5058d perf s390: Generate system call table from asm/unistd.h
> fdd7d74b2782 tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h
> [acme@jouet perf]$
>
> And pushed it to my perf/core branch on:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
>
> Please take a look and check that I didn't mess anything up :-)
They look fine. I have tested them again. Many thanks for splitting them.
I will try to follow your split guidelines for future commits.
Thanks,
Hendrik
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] perf trace: no longer require auditlibs if syscall tables are present
2017-12-07 17:53 ` Arnaldo Carvalho de Melo
@ 2017-12-11 9:35 ` Hendrik Brueckner
0 siblings, 0 replies; 20+ messages in thread
From: Hendrik Brueckner @ 2017-12-11 9:35 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Hendrik Brueckner, Thomas-Mich Richter, Michael Petlan,
Jiri Olsa, linux-perf-users, linux-s390
On Thu, Dec 07, 2017 at 02:53:52PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Dec 07, 2017 at 09:28:01AM +0100, Hendrik Brueckner escreveu:
> > Change the Makefile and build process to no longer require auditlibs
> > interfaces when the architecture provides system call tables.
>
> And this one will have to wait for the fix in how the errno translation
> tables are generated, ok?
Yes, it has to wait.
Regards,
Hendrik
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3 v2] perf trace: Introduce errno_to_name()
2017-12-07 17:52 ` Arnaldo Carvalho de Melo
@ 2017-12-11 11:32 ` Hendrik Brueckner
2017-12-11 15:00 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 20+ messages in thread
From: Hendrik Brueckner @ 2017-12-11 11:32 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Hendrik Brueckner, Thomas-Mich Richter, Michael Petlan,
Jiri Olsa, linux-perf-users, linux-s390
Hi Arnaldo,
On Thu, Dec 07, 2017 at 02:52:56PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Dec 07, 2017 at 04:00:10PM +0100, Hendrik Brueckner escreveu:
> > Introduce an errno_to_name() function to return the name of a
> > give errno number as string.
>
> Humm, we cannot use asm-generic for all, as there are differences in the
> errno numbers from arch to arch, for instance:
>
> In arch/alpha/include/uapi/asm/errno.h we use errno-base.h but even in
> that part one of its entries gets a different number on the Alpha arch,
> EAGAIN:
> -------------------
> #include <asm-generic/errno-base.h>
>
> #undef EAGAIN /* 11 in errno-base.h */
>
> #define EDEADLK 11 /* Resource deadlock would occur */
>
> #define EAGAIN 35 /* Try again */
> #define EWOULDBLOCK EAGAIN /* Operation would block */
> -------------------
With that in the mind, I have changed the generation in a way similar
I did for s390 syscall table generation. The util/generate-errno-names.sh
script can simply process the arch specific errno.h with cpp/gcc.
This approach will work fine if the arch errno.h does only include the
asm-generic/errno*.h files and does not have any differences between 32/64
bit. Otherwise it becomes more difficult.
> So you can try to copy all arch/*/include/uapi/asm/errno.h files and
> use the arch to key that, i.e. its almost what you did, but needs to
> take the arch into consideration.
util/generate-errno-names.sh is also extended to process architectures
for which there is a resp. directory below the tools/arch/ directory.
Generation of the errno name mappings is still the same but one ALL_
define for each architecture.
>
> Later we'll generate a two dimensional table of sorts, having the first
> dimension be the arch name, so that we can translate errnos in a
> perf.data file collected on, say, mips (one of these routers) in a tool
> running on x86_64 (or S/390 :)).
Yep... for this I need your help: How to obtain the arch string/ID whatever
in builtin-trace to use the correct errno map?
Below you can find an update on the patch (excluding the patch(es) to grab
the header files, one can do that simply with
cp --parents -v $(find arch/ -name errno.h) tools/
in the linux source tree.)
---->8---------
Introduce an errno_to_name() function to return the name of a
give errno number as string.
With this change, the dependency to libaudit can be removed for
architectures that support syscall tables. Hence, remove the
audit_errno_to_name() call in builtin-trace.c and just link
util/syscalltbl.c against libaudit. A follow-up commit could
then clean-up this dependency with respect to the syscall table.
The errno name strings are generated by util/generate-errno-names.sh
script and saved as util/errno-names.h. Errno mappings are created
for the architectures that are available in the tool/arch/ directory
in the Linux source tree.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
tools/perf/.gitignore | 1 +
tools/perf/Makefile.config | 2 +-
tools/perf/Makefile.perf | 9 ++++-
tools/perf/builtin-trace.c | 26 +++++++++++--
tools/perf/util/generate-errno-names.sh | 67 +++++++++++++++++++++++++++++++++
5 files changed, 99 insertions(+), 6 deletions(-)
create mode 100755 tools/perf/util/generate-errno-names.sh
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 643cc4ba..4e022f9 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -14,6 +14,7 @@ perf*.1
perf*.xml
perf*.html
common-cmds.h
+errno-names.h
perf.data
perf.data.old
output.svg
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index ab16aab..d8447b1 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -251,7 +251,7 @@ INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
-# $(obj-perf) for generated common-cmds.h
+# $(obj-perf) for generated common-cmds.h and errno-names.h
# $(obj-perf)/util for generated bison/flex headers
ifneq ($(OUTPUT),)
INC_FLAGS += -I$(obj-perf)/util
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 68cf136..73a2616 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -518,6 +518,9 @@ $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
$(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
+$(OUTPUT)util/errno-names.h: util/generate-errno-names.sh
+ $(QUIET_GEN). util/generate-errno-names.sh "$(CC)" "$(srctree)/tools" > $@+ && mv $@+ $@
+
$(SCRIPTS) : % : %.sh
$(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
@@ -565,7 +568,8 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc
$(vhost_virtio_ioctl_array) \
$(madvise_behavior_array) \
$(perf_ioctl_array) \
- $(prctl_option_array)
+ $(prctl_option_array) \
+ $(OUTPUT)util/errno-names.h
$(OUTPUT)%.o: %.c prepare FORCE
$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
@@ -847,7 +851,8 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
$(OUTPUT)$(kcmp_type_array) \
$(OUTPUT)$(vhost_virtio_ioctl_array) \
$(OUTPUT)$(perf_ioctl_array) \
- $(OUTPUT)$(prctl_option_array)
+ $(OUTPUT)$(prctl_option_array) \
+ $(OUTPUT)util/errno-names.h
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
#
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 84debdb..4c7805d 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -42,17 +42,16 @@
#include "string2.h"
#include "syscalltbl.h"
#include "rb_resort.h"
+#include "util/errno-names.h"
#include <errno.h>
#include <inttypes.h>
-#include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */
#include <poll.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <linux/err.h>
#include <linux/filter.h>
-#include <linux/audit.h>
#include <linux/kernel.h>
#include <linux/random.h>
#include <linux/stringify.h>
@@ -1659,6 +1658,27 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sam
return sample__fprintf_callchain(sample, 38, print_opts, &callchain_cursor, trace->output);
}
+static const char *__generic_errno_to_name(int err)
+{
+#define ERRNO_NAME_MAP(_err, _num) case _num: return #_err;
+#define ERRNO_NAME_MAP(_err, _num) case _num: return #_err;
+ switch (err) {
+ ALL_ERRNO_NAME_MAPPINGS__GENERIC
+#undef ERRNO_NAME_MAP
+ default:
+ return "(unknown)";
+ break;
+ }
+}
+
+static const char *errno_to_name(const int arch, int err)
+{
+ switch (arch) {
+ default:
+ return __generic_errno_to_name(err);
+ }
+}
+
static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
union perf_event *event __maybe_unused,
struct perf_sample *sample)
@@ -1729,7 +1749,7 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
errno_print: {
char bf[STRERR_BUFSIZE];
const char *emsg = str_error_r(-ret, bf, sizeof(bf)),
- *e = audit_errno_to_name(-ret);
+ *e = errno_to_name(0, -ret);
fprintf(trace->output, ") = -1 %s %s", e, emsg);
}
diff --git a/tools/perf/util/generate-errno-names.sh b/tools/perf/util/generate-errno-names.sh
new file mode 100755
index 0000000..57f74d4
--- /dev/null
+++ b/tools/perf/util/generate-errno-names.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Generate errno names header file
+#
+# Copyright IBM Corp. 2017
+# Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
+
+gcc="$1"
+toolsdir="$2"
+include_path="-I$toolsdir/include/uapi"
+
+arch_string()
+{
+ echo "$1" |sed -e 'y/- /__/' |tr '[[:lower:]]' '[[:upper:]]'
+}
+
+asm_errno_file()
+{
+ local arch="$1"
+ local header
+
+ header="$toolsdir/arch/$arch/include/uapi/asm/errno.h"
+ if test -r "$header"; then
+ echo "$header"
+ else
+ echo "$toolsdir/include/uapi/asm-generic/errno.h"
+ fi
+}
+
+process_arch()
+{
+ local arch="$1"
+ local tmpfile=$(mktemp -t generate-errno-names.XXXXXXXXX)
+ local asm_errno=$(asm_errno_file "$arch")
+
+ $gcc $include_path -E -dM -x c $asm_errno \
+ |grep -hE '^#define[[:blank:]]+(E[^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' \
+ |awk '{ print $2", "$3; }' \
+ |sort -t, -k2 -nu \
+ |sed -e 's/^/\tERRNO_NAME_MAP(/' -e 's/$/)/' \
+ > $tmpfile
+
+ printf '#define ALL_ERRNO_NAME_MAPPINGS__%s \\\n' $(arch_string "$arch")
+ head -n -1 $tmpfile |sed -e 's/$/ \\/'
+ tail -1 $tmpfile
+ printf "\n"
+ rm $tmpfile
+}
+
+cat <<EoHeader
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _UTIL_ERRNO_NAMES_H
+#define _UTIL_ERRNO_NAMES_H
+
+EoHeader
+
+for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" |sort); do
+ process_arch "$arch"
+done
+
+# Generic fallback
+process_arch "generic"
+
+cat <<EoFooter
+#endif /* _UTIL_ERRNO_NAMES_H */
+EoFooter
--
1.8.3.1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 1/3] perf s390: generate system call table from asm/unistd.h
2017-12-11 9:06 ` Hendrik Brueckner
@ 2017-12-11 14:19 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-11 14:19 UTC (permalink / raw)
To: Hendrik Brueckner
Cc: Arnaldo Carvalho de Melo, Thomas-Mich Richter, Michael Petlan,
Jiri Olsa, linux-perf-users, linux-s390
Em Mon, Dec 11, 2017 at 10:06:39AM +0100, Hendrik Brueckner escreveu:
> Hi Arnaldo,
>
> On Thu, Dec 07, 2017 at 02:37:31PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Thu, Dec 07, 2017 at 12:30:40PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Thu, Dec 07, 2017 at 09:27:59AM +0100, Hendrik Brueckner escreveu:
> > > > This should speed up accessing new system calls introduced with
> > > > the kernel rather than waiting for libaudit updates to include
> > > > them.
> > >
> > > So, this needs to be split in multiple patches, one grabbing the
> > > tools/arch/s390/include/uapi/asm/unistd.h copy and adding it to
> > > check-headers.sh (cool, you did it! :))
> > >
> > > I'll take a stab at splitting it here.
> >
> > So, splitted it into three patches and tested the generation, showing
> > the steps and results on the second patch commit message:
> >
> > [acme@jouet perf]$ git log -3 --oneline
> > b91e81b8e967 (HEAD -> perf/core, acme.korg/perf/core) perf trace: Use generated syscall table on s390 too
> > 8fe39fe5058d perf s390: Generate system call table from asm/unistd.h
> > fdd7d74b2782 tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h
> > [acme@jouet perf]$
> >
> > And pushed it to my perf/core branch on:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
> >
> > Please take a look and check that I didn't mess anything up :-)
>
>
> They look fine. I have tested them again. Many thanks for splitting them.
> I will try to follow your split guidelines for future commits.
Thanks!
- Arnaldo
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3 v2] perf trace: Introduce errno_to_name()
2017-12-11 11:32 ` Hendrik Brueckner
@ 2017-12-11 15:00 ` Arnaldo Carvalho de Melo
[not found] ` <20171211161640.GH4369@linux.vnet.ibm.com>
0 siblings, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-11 15:00 UTC (permalink / raw)
To: Hendrik Brueckner
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
Em Mon, Dec 11, 2017 at 12:32:59PM +0100, Hendrik Brueckner escreveu:
> Hi Arnaldo,
>
> On Thu, Dec 07, 2017 at 02:52:56PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Thu, Dec 07, 2017 at 04:00:10PM +0100, Hendrik Brueckner escreveu:
> > > Introduce an errno_to_name() function to return the name of a
> > > give errno number as string.
> >
> > Humm, we cannot use asm-generic for all, as there are differences in the
> > errno numbers from arch to arch, for instance:
> >
> > In arch/alpha/include/uapi/asm/errno.h we use errno-base.h but even in
> > that part one of its entries gets a different number on the Alpha arch,
> > EAGAIN:
> > -------------------
> > #include <asm-generic/errno-base.h>
> >
> > #undef EAGAIN /* 11 in errno-base.h */
> >
> > #define EDEADLK 11 /* Resource deadlock would occur */
> >
> > #define EAGAIN 35 /* Try again */
> > #define EWOULDBLOCK EAGAIN /* Operation would block */
> > -------------------
> With that in the mind, I have changed the generation in a way similar
> I did for s390 syscall table generation. The util/generate-errno-names.sh
> script can simply process the arch specific errno.h with cpp/gcc.
> This approach will work fine if the arch errno.h does only include the
> asm-generic/errno*.h files and does not have any differences between 32/64
> bit. Otherwise it becomes more difficult.
> > So you can try to copy all arch/*/include/uapi/asm/errno.h files and
> > use the arch to key that, i.e. its almost what you did, but needs to
> > take the arch into consideration.
> util/generate-errno-names.sh is also extended to process architectures
> for which there is a resp. directory below the tools/arch/ directory.
> Generation of the errno name mappings is still the same but one ALL_
> define for each architecture.
> > Later we'll generate a two dimensional table of sorts, having the first
> > dimension be the arch name, so that we can translate errnos in a
> > perf.data file collected on, say, mips (one of these routers) in a tool
> > running on x86_64 (or S/390 :)).
>
> Yep... for this I need your help: How to obtain the arch string/ID whatever
> in builtin-trace to use the correct errno map?
you can get it from the running system, for live sessions, from uname(),
and for a perf.data file from its header, see the annotation code, but
the function is this:
perf_evsel__env_arch(evsel)
Will return a perf_env pointer, and that has a lot of details about the
environment where that perf.data file was recorded:
struct perf_env {
char *hostname;
char *os_release;
char *version;
char *arch;
int nr_cpus_online;
int nr_cpus_avail;
char *cpu_desc;
char *cpuid;
unsigned long long total_mem;
unsigned int msr_pmu_type;
int nr_cmdline;
int nr_sibling_cores;
int nr_sibling_threads;
int nr_numa_nodes;
int nr_pmu_mappings;
int nr_groups;
char *cmdline;
const char **cmdline_argv;
char *sibling_cores;
char *sibling_threads;
char *pmu_mappings;
struct cpu_topology_map *cpu;
struct cpu_cache_level *caches;
int caches_cnt;
struct numa_node *numa_nodes;
};
The annotate code does some more massaging:
tools/perf/util/annotate.c
arch_name = annotate__norm_arch(arch_name);
static const char *annotate__norm_arch(const char *arch_name)
{
struct utsname uts;
if (!arch_name) { /* Assume we are annotating locally. */
if (uname(&uts) < 0)
return NULL;
arch_name = uts.machine;
}
return normalize_arch((char *)arch_name);
}
We need to first move this from annotate to a more generally available
function, say renaming annotate__norm_arch() to perf_env__norm_arch()
and using it.
I'll do this now and push to my perf/core branch, so that you can
continue from there.
> Below you can find an update on the patch (excluding the patch(es) to grab
> the header files, one can do that simply with
> cp --parents -v $(find arch/ -name errno.h) tools/
> in the linux source tree.)
Ok, I'll play with it and report back,
- Arnaldo
> ---->8---------
>
> Introduce an errno_to_name() function to return the name of a
> give errno number as string.
>
> With this change, the dependency to libaudit can be removed for
> architectures that support syscall tables. Hence, remove the
> audit_errno_to_name() call in builtin-trace.c and just link
> util/syscalltbl.c against libaudit. A follow-up commit could
> then clean-up this dependency with respect to the syscall table.
>
> The errno name strings are generated by util/generate-errno-names.sh
> script and saved as util/errno-names.h. Errno mappings are created
> for the architectures that are available in the tool/arch/ directory
> in the Linux source tree.
>
> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
> ---
> tools/perf/.gitignore | 1 +
> tools/perf/Makefile.config | 2 +-
> tools/perf/Makefile.perf | 9 ++++-
> tools/perf/builtin-trace.c | 26 +++++++++++--
> tools/perf/util/generate-errno-names.sh | 67 +++++++++++++++++++++++++++++++++
> 5 files changed, 99 insertions(+), 6 deletions(-)
> create mode 100755 tools/perf/util/generate-errno-names.sh
>
> diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
> index 643cc4ba..4e022f9 100644
> --- a/tools/perf/.gitignore
> +++ b/tools/perf/.gitignore
> @@ -14,6 +14,7 @@ perf*.1
> perf*.xml
> perf*.html
> common-cmds.h
> +errno-names.h
> perf.data
> perf.data.old
> output.svg
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index ab16aab..d8447b1 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -251,7 +251,7 @@ INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
> INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
> INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
>
> -# $(obj-perf) for generated common-cmds.h
> +# $(obj-perf) for generated common-cmds.h and errno-names.h
> # $(obj-perf)/util for generated bison/flex headers
> ifneq ($(OUTPUT),)
> INC_FLAGS += -I$(obj-perf)/util
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 68cf136..73a2616 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -518,6 +518,9 @@ $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
> $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
> $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
>
> +$(OUTPUT)util/errno-names.h: util/generate-errno-names.sh
> + $(QUIET_GEN). util/generate-errno-names.sh "$(CC)" "$(srctree)/tools" > $@+ && mv $@+ $@
> +
> $(SCRIPTS) : % : %.sh
> $(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
>
> @@ -565,7 +568,8 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc
> $(vhost_virtio_ioctl_array) \
> $(madvise_behavior_array) \
> $(perf_ioctl_array) \
> - $(prctl_option_array)
> + $(prctl_option_array) \
> + $(OUTPUT)util/errno-names.h
>
> $(OUTPUT)%.o: %.c prepare FORCE
> $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
> @@ -847,7 +851,8 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
> $(OUTPUT)$(kcmp_type_array) \
> $(OUTPUT)$(vhost_virtio_ioctl_array) \
> $(OUTPUT)$(perf_ioctl_array) \
> - $(OUTPUT)$(prctl_option_array)
> + $(OUTPUT)$(prctl_option_array) \
> + $(OUTPUT)util/errno-names.h
> $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
>
> #
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 84debdb..4c7805d 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -42,17 +42,16 @@
> #include "string2.h"
> #include "syscalltbl.h"
> #include "rb_resort.h"
> +#include "util/errno-names.h"
>
> #include <errno.h>
> #include <inttypes.h>
> -#include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */
> #include <poll.h>
> #include <signal.h>
> #include <stdlib.h>
> #include <string.h>
> #include <linux/err.h>
> #include <linux/filter.h>
> -#include <linux/audit.h>
> #include <linux/kernel.h>
> #include <linux/random.h>
> #include <linux/stringify.h>
> @@ -1659,6 +1658,27 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sam
> return sample__fprintf_callchain(sample, 38, print_opts, &callchain_cursor, trace->output);
> }
>
> +static const char *__generic_errno_to_name(int err)
> +{
> +#define ERRNO_NAME_MAP(_err, _num) case _num: return #_err;
> +#define ERRNO_NAME_MAP(_err, _num) case _num: return #_err;
> + switch (err) {
> + ALL_ERRNO_NAME_MAPPINGS__GENERIC
> +#undef ERRNO_NAME_MAP
> + default:
> + return "(unknown)";
> + break;
> + }
> +}
> +
> +static const char *errno_to_name(const int arch, int err)
> +{
> + switch (arch) {
> + default:
> + return __generic_errno_to_name(err);
> + }
> +}
> +
> static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
> union perf_event *event __maybe_unused,
> struct perf_sample *sample)
> @@ -1729,7 +1749,7 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
> errno_print: {
> char bf[STRERR_BUFSIZE];
> const char *emsg = str_error_r(-ret, bf, sizeof(bf)),
> - *e = audit_errno_to_name(-ret);
> + *e = errno_to_name(0, -ret);
>
> fprintf(trace->output, ") = -1 %s %s", e, emsg);
> }
> diff --git a/tools/perf/util/generate-errno-names.sh b/tools/perf/util/generate-errno-names.sh
> new file mode 100755
> index 0000000..57f74d4
> --- /dev/null
> +++ b/tools/perf/util/generate-errno-names.sh
> @@ -0,0 +1,67 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Generate errno names header file
> +#
> +# Copyright IBM Corp. 2017
> +# Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
> +
> +gcc="$1"
> +toolsdir="$2"
> +include_path="-I$toolsdir/include/uapi"
> +
> +arch_string()
> +{
> + echo "$1" |sed -e 'y/- /__/' |tr '[[:lower:]]' '[[:upper:]]'
> +}
> +
> +asm_errno_file()
> +{
> + local arch="$1"
> + local header
> +
> + header="$toolsdir/arch/$arch/include/uapi/asm/errno.h"
> + if test -r "$header"; then
> + echo "$header"
> + else
> + echo "$toolsdir/include/uapi/asm-generic/errno.h"
> + fi
> +}
> +
> +process_arch()
> +{
> + local arch="$1"
> + local tmpfile=$(mktemp -t generate-errno-names.XXXXXXXXX)
> + local asm_errno=$(asm_errno_file "$arch")
> +
> + $gcc $include_path -E -dM -x c $asm_errno \
> + |grep -hE '^#define[[:blank:]]+(E[^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' \
> + |awk '{ print $2", "$3; }' \
> + |sort -t, -k2 -nu \
> + |sed -e 's/^/\tERRNO_NAME_MAP(/' -e 's/$/)/' \
> + > $tmpfile
> +
> + printf '#define ALL_ERRNO_NAME_MAPPINGS__%s \\\n' $(arch_string "$arch")
> + head -n -1 $tmpfile |sed -e 's/$/ \\/'
> + tail -1 $tmpfile
> + printf "\n"
> + rm $tmpfile
> +}
> +
> +cat <<EoHeader
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _UTIL_ERRNO_NAMES_H
> +#define _UTIL_ERRNO_NAMES_H
> +
> +EoHeader
> +
> +for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" |sort); do
> + process_arch "$arch"
> +done
> +
> +# Generic fallback
> +process_arch "generic"
> +
> +cat <<EoFooter
> +#endif /* _UTIL_ERRNO_NAMES_H */
> +EoFooter
> --
> 1.8.3.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* container test for cross building s390 tools failing
[not found] ` <20171211161640.GH4369@linux.vnet.ibm.com>
@ 2017-12-13 16:31 ` Arnaldo Carvalho de Melo
2017-12-14 13:26 ` Thomas-Mich Richter
0 siblings, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-13 16:31 UTC (permalink / raw)
To: Hendrik Brueckner
Cc: Thomas-Mich Richter, Linux Kernel Mailing List, Adrian Hunter,
Ingo Molnar, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
Hi, noticed this with my perf/core branch, will investigate later.
[root@jouet ubuntu]# cat /tmp/dm.log.JAK3XV/ubuntu\:16.04-x-s390
ubuntu:16.04-x-s390
Downloading http://192.168.124.1/perf/perf-4.15.0-rc3.tar.xz...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1237k 100 1237k 0 0 236M 0 --:--:-- --:--:-- --:--:-- 402M
make: Entering directory '/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
HOSTCC /tmp/build/perf/fixdep.o
HOSTLD /tmp/build/perf/fixdep-in.o
LINK /tmp/build/perf/fixdep
sh: 1: command: Illegal option -c
Auto-detecting system features:
... dwarf: [ on ]
... dwarf_getlocations: [ on ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ OFF ]
... libbfd: [ OFF ]
... libelf: [ on ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ OFF ]
... libcrypto: [ OFF ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ OFF ]
... get_cpuid: [ OFF ]
... bpf: [ on ]
Makefile.config:414: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev
Makefile.config:537: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
Makefile.config:548: No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev
Makefile.config:563: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev
Makefile.config:577: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
Makefile.config:604: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev
Makefile.config:630: No python interpreter was found: disables Python support - please install python-devel/python-dev
Makefile.config:699: No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling
Makefile.config:728: No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev
Makefile.config:741: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
Makefile.config:818: No alternatives command found, you need to set JDIR= to point to the root of your Java directory
GEN /tmp/build/perf/common-cmds.h
PERF_VERSION = 4.15.rc3.g5e73c6
MKDIR /tmp/build/perf/fd/
CC /tmp/build/perf/fd/array.o
CC /tmp/build/perf/event-parse.o
CC /tmp/build/perf/exec-cmd.o
CC /tmp/build/perf/libbpf.o
LD /tmp/build/perf/fd/libapi-in.o
CC /tmp/build/perf/help.o
MKDIR /tmp/build/perf/fs/
CC /tmp/build/perf/fs/fs.o
CC /tmp/build/perf/bpf.o
MKDIR /tmp/build/perf/fs/
CC /tmp/build/perf/fs/tracing_path.o
LD /tmp/build/perf/libbpf-in.o
LINK /tmp/build/perf/libbpf.a
CC /tmp/build/perf/pager.o
LD /tmp/build/perf/fs/libapi-in.o
CC /tmp/build/perf/cpu.o
CC /tmp/build/perf/debug.o
CC /tmp/build/perf/str_error_r.o
CC /tmp/build/perf/event-plugin.o
LD /tmp/build/perf/libapi-in.o
AR /tmp/build/perf/libapi.a
MKDIR /tmp/build/perf/pmu-events/
HOSTCC /tmp/build/perf/pmu-events/json.o
CC /tmp/build/perf/parse-options.o
CC /tmp/build/perf/trace-seq.o
CC /tmp/build/perf/parse-filter.o
CC /tmp/build/perf/parse-utils.o
CC /tmp/build/perf/kbuffer-parse.o
MKDIR /tmp/build/perf/pmu-events/
HOSTCC /tmp/build/perf/pmu-events/jsmn.o
HOSTCC /tmp/build/perf/pmu-events/jevents.o
LD /tmp/build/perf/libtraceevent-in.o
LINK /tmp/build/perf/libtraceevent.a
CC /tmp/build/perf/run-command.o
CC /tmp/build/perf/plugin_jbd2.o
CC /tmp/build/perf/sigchain.o
HOSTLD /tmp/build/perf/pmu-events/jevents-in.o
GEN perf-archive
CC /tmp/build/perf/subcmd-config.o
GEN perf-with-kcore
LD /tmp/build/perf/plugin_jbd2-in.o
MKDIR /tmp/build/perf/util/
CC /tmp/build/perf/util/annotate.o
CC /tmp/build/perf/plugin_hrtimer.o
CC /tmp/build/perf/plugin_kmem.o
LD /tmp/build/perf/plugin_kmem-in.o
LD /tmp/build/perf/libsubcmd-in.o
LD /tmp/build/perf/plugin_hrtimer-in.o
CC /tmp/build/perf/plugin_kvm.o
AR /tmp/build/perf/libsubcmd.a
CC /tmp/build/perf/builtin-bench.o
In file included from util/perf_regs.h:27:0,
from util/event.h:11,
from util/symbol.h:16,
from util/sort.h:12,
from util/annotate.c:14:
/git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
compilation terminated.
CC /tmp/build/perf/builtin-annotate.o
mv: cannot stat '/tmp/build/perf/util/.annotate.o.tmp': No such file or directory
/git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/util/annotate.o' failed
make[4]: *** [/tmp/build/perf/util/annotate.o] Error 1
/git/linux/tools/build/Makefile.build:139: recipe for target 'util' failed
make[3]: *** [util] Error 2
Makefile.perf:619: recipe for target '/tmp/build/perf/libperf-in.o' failed
make[2]: *** [/tmp/build/perf/libperf-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....
CC /tmp/build/perf/builtin-config.o
In file included from util/perf_regs.h:27:0,
from util/event.h:11,
from util/symbol.h:16,
from builtin-annotate.c:16:
/git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
In file included from util/perf_regs.h:27:0,
from util/event.h:11,
from util/debug.h:9,
from builtin-config.c:15:
/git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
compilation terminated.
compilation terminated.
mv: cannot stat '/tmp/build/perf/.builtin-config.o.tmp': No such file or directory
/git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/builtin-config.o' failed
make[3]: *** [/tmp/build/perf/builtin-config.o] Error 1
make[3]: *** Waiting for unfinished jobs....
mv: cannot stat '/tmp/build/perf/.builtin-annotate.o.tmp': No such file or directory
/git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/builtin-annotate.o' failed
make[3]: *** [/tmp/build/perf/builtin-annotate.o] Error 1
CC /tmp/build/perf/plugin_mac80211.o
CC /tmp/build/perf/plugin_sched_switch.o
LD /tmp/build/perf/plugin_sched_switch-in.o
LD /tmp/build/perf/plugin_mac80211-in.o
LD /tmp/build/perf/plugin_kvm-in.o
CC /tmp/build/perf/plugin_xen.o
CC /tmp/build/perf/plugin_scsi.o
CC /tmp/build/perf/plugin_function.o
Makefile.perf:495: recipe for target '/tmp/build/perf/perf-in.o' failed
make[2]: *** [/tmp/build/perf/perf-in.o] Error 2
CC /tmp/build/perf/plugin_cfg80211.o
LD /tmp/build/perf/plugin_xen-in.o
LD /tmp/build/perf/plugin_function-in.o
LINK /tmp/build/perf/plugin_jbd2.so
LINK /tmp/build/perf/plugin_hrtimer.so
LD /tmp/build/perf/plugin_scsi-in.o
LINK /tmp/build/perf/plugin_kmem.so
LINK /tmp/build/perf/plugin_kvm.so
LD /tmp/build/perf/plugin_cfg80211-in.o
LINK /tmp/build/perf/plugin_mac80211.so
LINK /tmp/build/perf/plugin_sched_switch.so
LINK /tmp/build/perf/plugin_function.so
LINK /tmp/build/perf/plugin_xen.so
LINK /tmp/build/perf/plugin_scsi.so
LINK /tmp/build/perf/plugin_cfg80211.so
Makefile.perf:209: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
Makefile:69: recipe for target 'all' failed
make: *** [all] Error 2
make: Leaving directory '/git/linux/tools/perf'
[root@jouet ubuntu]#
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: container test for cross building s390 tools failing
2017-12-13 16:31 ` container test for cross building s390 tools failing Arnaldo Carvalho de Melo
@ 2017-12-14 13:26 ` Thomas-Mich Richter
2017-12-14 14:03 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 20+ messages in thread
From: Thomas-Mich Richter @ 2017-12-14 13:26 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Hendrik Brueckner
Cc: Linux Kernel Mailing List, Adrian Hunter, Ingo Molnar,
David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
On 12/13/2017 05:31 PM, Arnaldo Carvalho de Melo wrote:
> Hi, noticed this with my perf/core branch, will investigate later.
>
> [root@jouet ubuntu]# cat /tmp/dm.log.JAK3XV/ubuntu\:16.04-x-s390
> ubuntu:16.04-x-s390
> Downloading http://192.168.124.1/perf/perf-4.15.0-rc3.tar.xz...
> % Total % Received % Xferd Average Speed Time Time Time Current
> Dload Upload Total Spent Left Speed
> 100 1237k 100 1237k 0 0 236M 0 --:--:-- --:--:-- --:--:-- 402M
> make: Entering directory '/git/linux/tools/perf'
> BUILD: Doing 'make -j4' parallel build
> HOSTCC /tmp/build/perf/fixdep.o
> HOSTLD /tmp/build/perf/fixdep-in.o
> LINK /tmp/build/perf/fixdep
> sh: 1: command: Illegal option -c
>
> Auto-detecting system features:
> ... dwarf: [ on ]
> ... dwarf_getlocations: [ on ]
> ... glibc: [ on ]
> ... gtk2: [ OFF ]
> ... libaudit: [ OFF ]
> ... libbfd: [ OFF ]
> ... libelf: [ on ]
> ... libnuma: [ OFF ]
> ... numa_num_possible_cpus: [ OFF ]
> ... libperl: [ OFF ]
> ... libpython: [ OFF ]
> ... libslang: [ OFF ]
> ... libcrypto: [ OFF ]
> ... libunwind: [ OFF ]
> ... libdw-dwarf-unwind: [ on ]
> ... zlib: [ on ]
> ... lzma: [ OFF ]
> ... get_cpuid: [ OFF ]
> ... bpf: [ on ]
>
> Makefile.config:414: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev
> Makefile.config:537: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
> Makefile.config:548: No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev
> Makefile.config:563: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev
> Makefile.config:577: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
> Makefile.config:604: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev
> Makefile.config:630: No python interpreter was found: disables Python support - please install python-devel/python-dev
> Makefile.config:699: No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling
> Makefile.config:728: No liblzma found, disables xz kernel module decompression, please install xz-devel/liblzma-dev
> Makefile.config:741: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
> Makefile.config:818: No alternatives command found, you need to set JDIR= to point to the root of your Java directory
> GEN /tmp/build/perf/common-cmds.h
> PERF_VERSION = 4.15.rc3.g5e73c6
> MKDIR /tmp/build/perf/fd/
> CC /tmp/build/perf/fd/array.o
> CC /tmp/build/perf/event-parse.o
> CC /tmp/build/perf/exec-cmd.o
> CC /tmp/build/perf/libbpf.o
> LD /tmp/build/perf/fd/libapi-in.o
> CC /tmp/build/perf/help.o
> MKDIR /tmp/build/perf/fs/
> CC /tmp/build/perf/fs/fs.o
> CC /tmp/build/perf/bpf.o
> MKDIR /tmp/build/perf/fs/
> CC /tmp/build/perf/fs/tracing_path.o
> LD /tmp/build/perf/libbpf-in.o
> LINK /tmp/build/perf/libbpf.a
> CC /tmp/build/perf/pager.o
> LD /tmp/build/perf/fs/libapi-in.o
> CC /tmp/build/perf/cpu.o
> CC /tmp/build/perf/debug.o
> CC /tmp/build/perf/str_error_r.o
> CC /tmp/build/perf/event-plugin.o
> LD /tmp/build/perf/libapi-in.o
> AR /tmp/build/perf/libapi.a
> MKDIR /tmp/build/perf/pmu-events/
> HOSTCC /tmp/build/perf/pmu-events/json.o
> CC /tmp/build/perf/parse-options.o
> CC /tmp/build/perf/trace-seq.o
> CC /tmp/build/perf/parse-filter.o
> CC /tmp/build/perf/parse-utils.o
> CC /tmp/build/perf/kbuffer-parse.o
> MKDIR /tmp/build/perf/pmu-events/
> HOSTCC /tmp/build/perf/pmu-events/jsmn.o
> HOSTCC /tmp/build/perf/pmu-events/jevents.o
> LD /tmp/build/perf/libtraceevent-in.o
> LINK /tmp/build/perf/libtraceevent.a
> CC /tmp/build/perf/run-command.o
> CC /tmp/build/perf/plugin_jbd2.o
> CC /tmp/build/perf/sigchain.o
> HOSTLD /tmp/build/perf/pmu-events/jevents-in.o
> GEN perf-archive
> CC /tmp/build/perf/subcmd-config.o
> GEN perf-with-kcore
> LD /tmp/build/perf/plugin_jbd2-in.o
> MKDIR /tmp/build/perf/util/
> CC /tmp/build/perf/util/annotate.o
> CC /tmp/build/perf/plugin_hrtimer.o
> CC /tmp/build/perf/plugin_kmem.o
> LD /tmp/build/perf/plugin_kmem-in.o
> LD /tmp/build/perf/libsubcmd-in.o
> LD /tmp/build/perf/plugin_hrtimer-in.o
> CC /tmp/build/perf/plugin_kvm.o
> AR /tmp/build/perf/libsubcmd.a
> CC /tmp/build/perf/builtin-bench.o
> In file included from util/perf_regs.h:27:0,
> from util/event.h:11,
> from util/symbol.h:16,
> from util/sort.h:12,
> from util/annotate.c:14:
> /git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
> compilation terminated.
> CC /tmp/build/perf/builtin-annotate.o
> mv: cannot stat '/tmp/build/perf/util/.annotate.o.tmp': No such file or directory
> /git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/util/annotate.o' failed
> make[4]: *** [/tmp/build/perf/util/annotate.o] Error 1
> /git/linux/tools/build/Makefile.build:139: recipe for target 'util' failed
> make[3]: *** [util] Error 2
> Makefile.perf:619: recipe for target '/tmp/build/perf/libperf-in.o' failed
> make[2]: *** [/tmp/build/perf/libperf-in.o] Error 2
> make[2]: *** Waiting for unfinished jobs....
> CC /tmp/build/perf/builtin-config.o
> In file included from util/perf_regs.h:27:0,
> from util/event.h:11,
> from util/symbol.h:16,
> from builtin-annotate.c:16:
> /git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
> In file included from util/perf_regs.h:27:0,
> from util/event.h:11,
> from util/debug.h:9,
> from builtin-config.c:15:
> /git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
> compilation terminated.
> compilation terminated.
> mv: cannot stat '/tmp/build/perf/.builtin-config.o.tmp': No such file or directory
> /git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/builtin-config.o' failed
> make[3]: *** [/tmp/build/perf/builtin-config.o] Error 1
> make[3]: *** Waiting for unfinished jobs....
> mv: cannot stat '/tmp/build/perf/.builtin-annotate.o.tmp': No such file or directory
> /git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/builtin-annotate.o' failed
> make[3]: *** [/tmp/build/perf/builtin-annotate.o] Error 1
> CC /tmp/build/perf/plugin_mac80211.o
> CC /tmp/build/perf/plugin_sched_switch.o
> LD /tmp/build/perf/plugin_sched_switch-in.o
> LD /tmp/build/perf/plugin_mac80211-in.o
> LD /tmp/build/perf/plugin_kvm-in.o
> CC /tmp/build/perf/plugin_xen.o
> CC /tmp/build/perf/plugin_scsi.o
> CC /tmp/build/perf/plugin_function.o
> Makefile.perf:495: recipe for target '/tmp/build/perf/perf-in.o' failed
> make[2]: *** [/tmp/build/perf/perf-in.o] Error 2
> CC /tmp/build/perf/plugin_cfg80211.o
> LD /tmp/build/perf/plugin_xen-in.o
> LD /tmp/build/perf/plugin_function-in.o
> LINK /tmp/build/perf/plugin_jbd2.so
> LINK /tmp/build/perf/plugin_hrtimer.so
> LD /tmp/build/perf/plugin_scsi-in.o
> LINK /tmp/build/perf/plugin_kmem.so
> LINK /tmp/build/perf/plugin_kvm.so
> LD /tmp/build/perf/plugin_cfg80211-in.o
> LINK /tmp/build/perf/plugin_mac80211.so
> LINK /tmp/build/perf/plugin_sched_switch.so
> LINK /tmp/build/perf/plugin_function.so
> LINK /tmp/build/perf/plugin_xen.so
> LINK /tmp/build/perf/plugin_scsi.so
> LINK /tmp/build/perf/plugin_cfg80211.so
> Makefile.perf:209: recipe for target 'sub-make' failed
> make[1]: *** [sub-make] Error 2
> Makefile:69: recipe for target 'all' failed
> make: *** [all] Error 2
> make: Leaving directory '/git/linux/tools/perf'
> [root@jouet ubuntu]#
>
Maybe I miss something.
I just downloded the latest linux-4.15.0-rc3 and built the kernel and the perf tool on an s390x LPAR
without any errors:
[root@s35lp76 perf]# git tag|fgrep 4.15
v4.15-rc1
v4.15-rc2
v4.15-rc3
[root@s35lp76 perf]# pwd
/root/linux2/tools/perf
[root@s35lp76 perf]# make
BUILD: Doing 'make -j1' parallel build
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
Auto-detecting system features:
... dwarf: [ on ]
... dwarf_getlocations: [ on ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libcrypto: [ on ]
... libunwind: [ OFF ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ OFF ]
... bpf: [ on ]
Makefile.config:566: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
Makefile.config:817: No openjdk development package found, please install JDK package
[root@s35lp76 perf]#
The perf build went smoothly and when I type 'make'
again, the build process does not complain about missing files.
--
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: container test for cross building s390 tools failing
2017-12-14 13:26 ` Thomas-Mich Richter
@ 2017-12-14 14:03 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-14 14:03 UTC (permalink / raw)
To: Thomas-Mich Richter
Cc: Hendrik Brueckner, Linux Kernel Mailing List, Adrian Hunter,
Ingo Molnar, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan
Em Thu, Dec 14, 2017 at 02:26:56PM +0100, Thomas-Mich Richter escreveu:
> On 12/13/2017 05:31 PM, Arnaldo Carvalho de Melo wrote:
> > Hi, noticed this with my perf/core branch, will investigate later.
> > [root@jouet ubuntu]# cat /tmp/dm.log.JAK3XV/ubuntu\:16.04-x-s390
> > ubuntu:16.04-x-s390
> > Downloading http://192.168.124.1/perf/perf-4.15.0-rc3.tar.xz...
> > % Total % Received % Xferd Average Speed Time Time Time Current
> > Dload Upload Total Spent Left Speed
> > 100 1237k 100 1237k 0 0 236M 0 --:--:-- --:--:-- --:--:-- 402M
> > make: Entering directory '/git/linux/tools/perf'
> > BUILD: Doing 'make -j4' parallel build
> > HOSTCC /tmp/build/perf/fixdep.o
<SNIP>
> > CC /tmp/build/perf/builtin-bench.o
> > In file included from util/perf_regs.h:27:0,
> > from util/event.h:11,
> > from util/symbol.h:16,
> > from util/sort.h:12,
> > from util/annotate.c:14:
> > /git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
> > compilation terminated.
> > CC /tmp/build/perf/builtin-annotate.o
> > mv: cannot stat '/tmp/build/perf/util/.annotate.o.tmp': No such file or directory
> > /git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/util/annotate.o' failed
> > make[4]: *** [/tmp/build/perf/util/annotate.o] Error 1
> > /git/linux/tools/build/Makefile.build:139: recipe for target 'util' failed
> > make[3]: *** [util] Error 2
> > Makefile.perf:619: recipe for target '/tmp/build/perf/libperf-in.o' failed
> > make[2]: *** [/tmp/build/perf/libperf-in.o] Error 2
> > make[2]: *** Waiting for unfinished jobs....
> > CC /tmp/build/perf/builtin-config.o
> > In file included from util/perf_regs.h:27:0,
> > from util/event.h:11,
> > from util/symbol.h:16,
> > from builtin-annotate.c:16:
> > /git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
> > In file included from util/perf_regs.h:27:0,
> > from util/event.h:11,
> > from util/debug.h:9,
> > from builtin-config.c:15:
> > /git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
> > compilation terminated.
> > compilation terminated.
> > mv: cannot stat '/tmp/build/perf/.builtin-config.o.tmp': No such file or directory
> > /git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/builtin-config.o' failed
> > make[3]: *** [/tmp/build/perf/builtin-config.o] Error 1
> > make[3]: *** Waiting for unfinished jobs....
> > mv: cannot stat '/tmp/build/perf/.builtin-annotate.o.tmp': No such file or directory
> > /git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/builtin-annotate.o' failed
> > make[3]: *** [/tmp/build/perf/builtin-annotate.o] Error 1
> > CC /tmp/build/perf/plugin_mac80211.o
<SNIP>
> > Makefile.perf:495: recipe for target '/tmp/build/perf/perf-in.o' failed
> > make[2]: *** [/tmp/build/perf/perf-in.o] Error 2
> > CC /tmp/build/perf/plugin_cfg80211.o
<SNIP>
> > Makefile.perf:209: recipe for target 'sub-make' failed
> > make[1]: *** [sub-make] Error 2
> > Makefile:69: recipe for target 'all' failed
> > make: *** [all] Error 2
> > make: Leaving directory '/git/linux/tools/perf'
> > [root@jouet ubuntu]#
> Maybe I miss something.
> I just downloded the latest linux-4.15.0-rc3 and built the kernel and the perf tool on an s390x LPAR
> without any errors:
> [root@s35lp76 perf]# git tag|fgrep 4.15
> v4.15-rc1
> v4.15-rc2
> v4.15-rc3
> [root@s35lp76 perf]# pwd
> /root/linux2/tools/perf
> [root@s35lp76 perf]# make
> BUILD: Doing 'make -j1' parallel build
> Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
> Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
>
> Auto-detecting system features:
> ... dwarf: [ on ]
> ... dwarf_getlocations: [ on ]
> ... glibc: [ on ]
> ... gtk2: [ OFF ]
> ... libaudit: [ on ]
> ... libbfd: [ on ]
> ... libelf: [ on ]
> ... libnuma: [ on ]
> ... numa_num_possible_cpus: [ on ]
> ... libperl: [ on ]
> ... libpython: [ on ]
> ... libslang: [ on ]
> ... libcrypto: [ on ]
> ... libunwind: [ OFF ]
> ... libdw-dwarf-unwind: [ on ]
> ... zlib: [ on ]
> ... lzma: [ on ]
> ... get_cpuid: [ OFF ]
> ... bpf: [ on ]
> Makefile.config:566: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
> Makefile.config:817: No openjdk development package found, please install JDK package
> [root@s35lp76 perf]#
> The perf build went smoothly and when I type 'make'
> again, the build process does not complain about missing files.
Right, when you build tools/perf inside a checked out copy of the kernel
sources, you'll be able to access files outside tools/ and everything
will build just fine.
But tools/ living code shouldn't access anything outside tools/, so when
you do:
[acme@jouet perf]$ make help | grep perf
perf-tar-src-pkg - Build perf-4.15.0-rc3.tar source tarball
perf-targz-src-pkg - Build perf-4.15.0-rc3.tar.gz source tarball
perf-tarbz2-src-pkg - Build perf-4.15.0-rc3.tar.bz2 source tarball
perf-tarxz-src-pkg - Build perf-4.15.0-rc3.tar.xz source tarball
[acme@jouet perf]$
And grab the resulting tarball (just run ls -lart), extract it, say,
under /tmp/, or in some other machine, and try to build it, it'll fail.
I've fixed this already, please check:
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=642d3d0964efb216c2823af78147c46913f26804
Doing it this way will also warn us when something changes in the files
used by tools/perf/ that may be of interest to tooling, just like with
the other tools/{arch,include/lib}/ files we copied from the kernel
sources.
- Arnaldo
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2017-12-14 14:03 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-07 8:27 [PATCH 0/3] perf: generate s390 syscall table and remove auditlibs dependency Hendrik Brueckner
2017-12-07 8:27 ` [PATCH 1/3] perf s390: generate system call table from asm/unistd.h Hendrik Brueckner
2017-12-07 15:30 ` Arnaldo Carvalho de Melo
2017-12-07 17:37 ` Arnaldo Carvalho de Melo
2017-12-11 9:06 ` Hendrik Brueckner
2017-12-11 14:19 ` Arnaldo Carvalho de Melo
2017-12-07 8:28 ` [PATCH 2/3] perf: introduce errno_to_name() function Hendrik Brueckner
2017-12-07 8:37 ` [PATCH 2/3] fixup! " Hendrik Brueckner
2017-12-07 14:48 ` Arnaldo Carvalho de Melo
2017-12-07 15:00 ` [PATCH 2/3 v2] perf trace: Introduce errno_to_name() Hendrik Brueckner
2017-12-07 17:52 ` Arnaldo Carvalho de Melo
2017-12-11 11:32 ` Hendrik Brueckner
2017-12-11 15:00 ` Arnaldo Carvalho de Melo
[not found] ` <20171211161640.GH4369@linux.vnet.ibm.com>
2017-12-13 16:31 ` container test for cross building s390 tools failing Arnaldo Carvalho de Melo
2017-12-14 13:26 ` Thomas-Mich Richter
2017-12-14 14:03 ` Arnaldo Carvalho de Melo
2017-12-07 8:28 ` [PATCH 3/3] perf trace: no longer require auditlibs if syscall tables are present Hendrik Brueckner
2017-12-07 17:53 ` Arnaldo Carvalho de Melo
2017-12-11 9:35 ` Hendrik Brueckner
2017-12-07 15:29 ` [PATCH 0/3] perf: generate s390 syscall table and remove auditlibs dependency Arnaldo Carvalho de Melo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.