* [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings
@ 2018-01-19 8:56 Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 1/5] tools include arch: Grab a copy of errno.h for arch's supported by perf Hendrik Brueckner
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Hendrik Brueckner @ 2018-01-19 8:56 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390
Introduce an interface to perf to resolve errno codes to their names.
This is used by perf trace to display the errno name, for example, ENOENT,
for an system call. The previous implementation used the errno_to_name()
function from the audit library.
With this change, a table of errno codes and their names are created for
each architecture on which perf is supported (others can be easily added
if necessary). The errno_to_name() function from the audit library is
replaced with an arch-specific one, arch_errno_to_name().
The benefit is that perf trace does not longer have a direct dependency
for the audit library and the perf trace output can be displayed across
architectures. For example, collect trace output on s390 and display it
on x86.
The audit library dependency can be further reduced and completely removed
for architectures that support system call tables in perf (see last commit).
See also discussion on:
- https://www.spinics.net/lists/linux-perf-users/msg04782.html
- https://www.spinics.net/lists/linux-perf-users/msg05005.html
Please note that this patch set is bases on the perf/core branch.
Changes in v2:
As the arch_errno_to_name() mapping is used by perf trace only,
move all the scripts and generated files from tools/perf/util/
to the tools/perf/trace/beauty/{generated/} directories.
See also https://www.spinics.net/lists/linux-perf-users/msg05037.html
Hendrik Brueckner (5):
tools include arch: Grab a copy of errno.h for arch's supported by
perf
tools include asm-generic: Grab errno.h and errno-base.h
perf util: Introduce architecture specific errno/name mapping
perf trace: Obtain errno values by using arch_syscalls__strerrno()
perf trace: Remove audit-libs dependency if syscall tables are present
tools/arch/alpha/include/uapi/asm/errno.h | 128 +++++++++++++++++++++++++++
tools/arch/mips/include/asm/errno.h | 17 ++++
tools/arch/mips/include/uapi/asm/errno.h | 130 ++++++++++++++++++++++++++++
tools/arch/parisc/include/uapi/asm/errno.h | 128 +++++++++++++++++++++++++++
tools/arch/powerpc/include/uapi/asm/errno.h | 10 +++
tools/arch/sparc/include/uapi/asm/errno.h | 118 +++++++++++++++++++++++++
tools/arch/x86/include/uapi/asm/errno.h | 1 +
tools/include/uapi/asm-generic/errno-base.h | 40 +++++++++
tools/include/uapi/asm-generic/errno.h | 123 ++++++++++++++++++++++++++
tools/perf/Makefile.config | 10 ++-
tools/perf/Makefile.perf | 13 ++-
tools/perf/builtin-help.c | 2 +-
tools/perf/builtin-trace.c | 14 ++-
tools/perf/check-headers.sh | 9 ++
tools/perf/perf.c | 4 +-
tools/perf/trace/beauty/arch_errno_names.c | 1 +
tools/perf/trace/beauty/arch_errno_names.sh | 100 +++++++++++++++++++++
tools/perf/trace/beauty/beauty.h | 2 +
tools/perf/util/generate-cmdlist.sh | 2 +-
19 files changed, 841 insertions(+), 11 deletions(-)
create mode 100644 tools/arch/alpha/include/uapi/asm/errno.h
create mode 100644 tools/arch/mips/include/asm/errno.h
create mode 100644 tools/arch/mips/include/uapi/asm/errno.h
create mode 100644 tools/arch/parisc/include/uapi/asm/errno.h
create mode 100644 tools/arch/powerpc/include/uapi/asm/errno.h
create mode 100644 tools/arch/sparc/include/uapi/asm/errno.h
create mode 100644 tools/arch/x86/include/uapi/asm/errno.h
create mode 100644 tools/include/uapi/asm-generic/errno-base.h
create mode 100644 tools/include/uapi/asm-generic/errno.h
create mode 100644 tools/perf/trace/beauty/arch_errno_names.c
create mode 100755 tools/perf/trace/beauty/arch_errno_names.sh
--
1.8.3.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/5] tools include arch: Grab a copy of errno.h for arch's supported by perf
2018-01-19 8:56 [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings Hendrik Brueckner
@ 2018-01-19 8:56 ` Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 2/5] tools include asm-generic: Grab errno.h and errno-base.h Hendrik Brueckner
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Hendrik Brueckner @ 2018-01-19 8:56 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390, Arnaldo Carvalho de Melo
For each arch in tools/perf/arch, grab a copy of errno.h.
This is a pre-req to generate an architecture specific mapping of
errno numbers to their names. This errno mapping can be used by
perf trace to support cross-architecture trace reports and to get
rid of the audit-libs dependency.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
---
tools/arch/alpha/include/uapi/asm/errno.h | 128 +++++++++++++++++++++++++++
tools/arch/mips/include/asm/errno.h | 17 ++++
tools/arch/mips/include/uapi/asm/errno.h | 130 ++++++++++++++++++++++++++++
tools/arch/parisc/include/uapi/asm/errno.h | 128 +++++++++++++++++++++++++++
tools/arch/powerpc/include/uapi/asm/errno.h | 10 +++
tools/arch/sparc/include/uapi/asm/errno.h | 118 +++++++++++++++++++++++++
tools/arch/x86/include/uapi/asm/errno.h | 1 +
| 7 ++
8 files changed, 539 insertions(+)
create mode 100644 tools/arch/alpha/include/uapi/asm/errno.h
create mode 100644 tools/arch/mips/include/asm/errno.h
create mode 100644 tools/arch/mips/include/uapi/asm/errno.h
create mode 100644 tools/arch/parisc/include/uapi/asm/errno.h
create mode 100644 tools/arch/powerpc/include/uapi/asm/errno.h
create mode 100644 tools/arch/sparc/include/uapi/asm/errno.h
create mode 100644 tools/arch/x86/include/uapi/asm/errno.h
diff --git a/tools/arch/alpha/include/uapi/asm/errno.h b/tools/arch/alpha/include/uapi/asm/errno.h
new file mode 100644
index 0000000..3d265f6
--- /dev/null
+++ b/tools/arch/alpha/include/uapi/asm/errno.h
@@ -0,0 +1,128 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _ALPHA_ERRNO_H
+#define _ALPHA_ERRNO_H
+
+#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 */
+#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 */
+#define EPROTONOSUPPORT 43 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
+#define EOPNOTSUPP 45 /* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 46 /* Protocol family not supported */
+#define EAFNOSUPPORT 47 /* Address family not supported by protocol */
+#define EADDRINUSE 48 /* Address already in use */
+#define EADDRNOTAVAIL 49 /* Cannot assign requested address */
+#define ENETDOWN 50 /* Network is down */
+#define ENETUNREACH 51 /* Network is unreachable */
+#define ENETRESET 52 /* Network dropped connection because of reset */
+#define ECONNABORTED 53 /* Software caused connection abort */
+#define ECONNRESET 54 /* Connection reset by peer */
+#define ENOBUFS 55 /* No buffer space available */
+#define EISCONN 56 /* Transport endpoint is already connected */
+#define ENOTCONN 57 /* Transport endpoint is not connected */
+#define ESHUTDOWN 58 /* Cannot send after transport endpoint shutdown */
+#define ETOOMANYREFS 59 /* Too many references: cannot splice */
+#define ETIMEDOUT 60 /* Connection timed out */
+#define ECONNREFUSED 61 /* Connection refused */
+#define ELOOP 62 /* Too many symbolic links encountered */
+#define ENAMETOOLONG 63 /* File name too long */
+#define EHOSTDOWN 64 /* Host is down */
+#define EHOSTUNREACH 65 /* No route to host */
+#define ENOTEMPTY 66 /* Directory not empty */
+
+#define EUSERS 68 /* Too many users */
+#define EDQUOT 69 /* Quota exceeded */
+#define ESTALE 70 /* Stale file handle */
+#define EREMOTE 71 /* Object is remote */
+
+#define ENOLCK 77 /* No record locks available */
+#define ENOSYS 78 /* Function not implemented */
+
+#define ENOMSG 80 /* No message of desired type */
+#define EIDRM 81 /* Identifier removed */
+#define ENOSR 82 /* Out of streams resources */
+#define ETIME 83 /* Timer expired */
+#define EBADMSG 84 /* Not a data message */
+#define EPROTO 85 /* Protocol error */
+#define ENODATA 86 /* No data available */
+#define ENOSTR 87 /* Device not a stream */
+
+#define ENOPKG 92 /* Package not installed */
+
+#define EILSEQ 116 /* Illegal byte sequence */
+
+/* The following are just random noise.. */
+#define ECHRNG 88 /* Channel number out of range */
+#define EL2NSYNC 89 /* Level 2 not synchronized */
+#define EL3HLT 90 /* Level 3 halted */
+#define EL3RST 91 /* Level 3 reset */
+
+#define ELNRNG 93 /* Link number out of range */
+#define EUNATCH 94 /* Protocol driver not attached */
+#define ENOCSI 95 /* No CSI structure available */
+#define EL2HLT 96 /* Level 2 halted */
+#define EBADE 97 /* Invalid exchange */
+#define EBADR 98 /* Invalid request descriptor */
+#define EXFULL 99 /* Exchange full */
+#define ENOANO 100 /* No anode */
+#define EBADRQC 101 /* Invalid request code */
+#define EBADSLT 102 /* Invalid slot */
+
+#define EDEADLOCK EDEADLK
+
+#define EBFONT 104 /* Bad font file format */
+#define ENONET 105 /* Machine is not on the network */
+#define ENOLINK 106 /* Link has been severed */
+#define EADV 107 /* Advertise error */
+#define ESRMNT 108 /* Srmount error */
+#define ECOMM 109 /* Communication error on send */
+#define EMULTIHOP 110 /* Multihop attempted */
+#define EDOTDOT 111 /* RFS specific error */
+#define EOVERFLOW 112 /* Value too large for defined data type */
+#define ENOTUNIQ 113 /* Name not unique on network */
+#define EBADFD 114 /* File descriptor in bad state */
+#define EREMCHG 115 /* Remote address changed */
+
+#define EUCLEAN 117 /* Structure needs cleaning */
+#define ENOTNAM 118 /* Not a XENIX named type file */
+#define ENAVAIL 119 /* No XENIX semaphores available */
+#define EISNAM 120 /* Is a named type file */
+#define EREMOTEIO 121 /* Remote I/O error */
+
+#define ELIBACC 122 /* Can not access a needed shared library */
+#define ELIBBAD 123 /* Accessing a corrupted shared library */
+#define ELIBSCN 124 /* .lib section in a.out corrupted */
+#define ELIBMAX 125 /* Attempting to link in too many shared libraries */
+#define ELIBEXEC 126 /* Cannot exec a shared library directly */
+#define ERESTART 127 /* Interrupted system call should be restarted */
+#define ESTRPIPE 128 /* Streams pipe error */
+
+#define ENOMEDIUM 129 /* No medium found */
+#define EMEDIUMTYPE 130 /* Wrong medium type */
+#define ECANCELED 131 /* Operation Cancelled */
+#define ENOKEY 132 /* Required key not available */
+#define EKEYEXPIRED 133 /* Key has expired */
+#define EKEYREVOKED 134 /* Key has been revoked */
+#define EKEYREJECTED 135 /* Key was rejected by service */
+
+/* for robust mutexes */
+#define EOWNERDEAD 136 /* Owner died */
+#define ENOTRECOVERABLE 137 /* State not recoverable */
+
+#define ERFKILL 138 /* Operation not possible due to RF-kill */
+
+#define EHWPOISON 139 /* Memory page has hardware error */
+
+#endif
diff --git a/tools/arch/mips/include/asm/errno.h b/tools/arch/mips/include/asm/errno.h
new file mode 100644
index 0000000..21d91cd
--- /dev/null
+++ b/tools/arch/mips/include/asm/errno.h
@@ -0,0 +1,17 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1995, 1999, 2001, 2002 by Ralf Baechle
+ */
+#ifndef _ASM_ERRNO_H
+#define _ASM_ERRNO_H
+
+#include <uapi/asm/errno.h>
+
+
+/* The biggest error number defined here or in <linux/errno.h>. */
+#define EMAXERRNO 1133
+
+#endif /* _ASM_ERRNO_H */
diff --git a/tools/arch/mips/include/uapi/asm/errno.h b/tools/arch/mips/include/uapi/asm/errno.h
new file mode 100644
index 0000000..2fb714e
--- /dev/null
+++ b/tools/arch/mips/include/uapi/asm/errno.h
@@ -0,0 +1,130 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1995, 1999, 2001, 2002 by Ralf Baechle
+ */
+#ifndef _UAPI_ASM_ERRNO_H
+#define _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 */
+#define EUNATCH 42 /* Protocol driver not attached */
+#define ENOCSI 43 /* No CSI structure available */
+#define EL2HLT 44 /* Level 2 halted */
+#define EDEADLK 45 /* Resource deadlock would occur */
+#define ENOLCK 46 /* No record locks available */
+#define EBADE 50 /* Invalid exchange */
+#define EBADR 51 /* Invalid request descriptor */
+#define EXFULL 52 /* Exchange full */
+#define ENOANO 53 /* No anode */
+#define EBADRQC 54 /* Invalid request code */
+#define EBADSLT 55 /* Invalid slot */
+#define EDEADLOCK 56 /* File locking deadlock error */
+#define EBFONT 59 /* Bad font file format */
+#define ENOSTR 60 /* Device not a stream */
+#define ENODATA 61 /* No data available */
+#define ETIME 62 /* Timer expired */
+#define ENOSR 63 /* Out of streams resources */
+#define ENONET 64 /* Machine is not on the network */
+#define ENOPKG 65 /* Package not installed */
+#define EREMOTE 66 /* Object is remote */
+#define ENOLINK 67 /* Link has been severed */
+#define EADV 68 /* Advertise error */
+#define ESRMNT 69 /* Srmount error */
+#define ECOMM 70 /* Communication error on send */
+#define EPROTO 71 /* Protocol error */
+#define EDOTDOT 73 /* RFS specific error */
+#define EMULTIHOP 74 /* Multihop attempted */
+#define EBADMSG 77 /* Not a data message */
+#define ENAMETOOLONG 78 /* File name too long */
+#define EOVERFLOW 79 /* Value too large for defined data type */
+#define ENOTUNIQ 80 /* Name not unique on network */
+#define EBADFD 81 /* File descriptor in bad state */
+#define EREMCHG 82 /* Remote address changed */
+#define ELIBACC 83 /* Can not access a needed shared library */
+#define ELIBBAD 84 /* Accessing a corrupted shared library */
+#define ELIBSCN 85 /* .lib section in a.out corrupted */
+#define ELIBMAX 86 /* Attempting to link in too many shared libraries */
+#define ELIBEXEC 87 /* Cannot exec a shared library directly */
+#define EILSEQ 88 /* Illegal byte sequence */
+#define ENOSYS 89 /* Function not implemented */
+#define ELOOP 90 /* Too many symbolic links encountered */
+#define ERESTART 91 /* Interrupted system call should be restarted */
+#define ESTRPIPE 92 /* Streams pipe error */
+#define ENOTEMPTY 93 /* Directory not empty */
+#define EUSERS 94 /* Too many users */
+#define ENOTSOCK 95 /* Socket operation on non-socket */
+#define EDESTADDRREQ 96 /* Destination address required */
+#define EMSGSIZE 97 /* Message too long */
+#define EPROTOTYPE 98 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 99 /* Protocol not available */
+#define EPROTONOSUPPORT 120 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 121 /* Socket type not supported */
+#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 123 /* Protocol family not supported */
+#define EAFNOSUPPORT 124 /* Address family not supported by protocol */
+#define EADDRINUSE 125 /* Address already in use */
+#define EADDRNOTAVAIL 126 /* Cannot assign requested address */
+#define ENETDOWN 127 /* Network is down */
+#define ENETUNREACH 128 /* Network is unreachable */
+#define ENETRESET 129 /* Network dropped connection because of reset */
+#define ECONNABORTED 130 /* Software caused connection abort */
+#define ECONNRESET 131 /* Connection reset by peer */
+#define ENOBUFS 132 /* No buffer space available */
+#define EISCONN 133 /* Transport endpoint is already connected */
+#define ENOTCONN 134 /* Transport endpoint is not connected */
+#define EUCLEAN 135 /* Structure needs cleaning */
+#define ENOTNAM 137 /* Not a XENIX named type file */
+#define ENAVAIL 138 /* No XENIX semaphores available */
+#define EISNAM 139 /* Is a named type file */
+#define EREMOTEIO 140 /* Remote I/O error */
+#define EINIT 141 /* Reserved */
+#define EREMDEV 142 /* Error 142 */
+#define ESHUTDOWN 143 /* Cannot send after transport endpoint shutdown */
+#define ETOOMANYREFS 144 /* Too many references: cannot splice */
+#define ETIMEDOUT 145 /* Connection timed out */
+#define ECONNREFUSED 146 /* Connection refused */
+#define EHOSTDOWN 147 /* Host is down */
+#define EHOSTUNREACH 148 /* No route to host */
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define EALREADY 149 /* Operation already in progress */
+#define EINPROGRESS 150 /* Operation now in progress */
+#define ESTALE 151 /* Stale file handle */
+#define ECANCELED 158 /* AIO operation canceled */
+
+/*
+ * These error are Linux extensions.
+ */
+#define ENOMEDIUM 159 /* No medium found */
+#define EMEDIUMTYPE 160 /* Wrong medium type */
+#define ENOKEY 161 /* Required key not available */
+#define EKEYEXPIRED 162 /* Key has expired */
+#define EKEYREVOKED 163 /* Key has been revoked */
+#define EKEYREJECTED 164 /* Key was rejected by service */
+
+/* for robust mutexes */
+#define EOWNERDEAD 165 /* Owner died */
+#define ENOTRECOVERABLE 166 /* State not recoverable */
+
+#define ERFKILL 167 /* Operation not possible due to RF-kill */
+
+#define EHWPOISON 168 /* Memory page has hardware error */
+
+#define EDQUOT 1133 /* Quota exceeded */
+
+
+#endif /* _UAPI_ASM_ERRNO_H */
diff --git a/tools/arch/parisc/include/uapi/asm/errno.h b/tools/arch/parisc/include/uapi/asm/errno.h
new file mode 100644
index 0000000..fc0df35
--- /dev/null
+++ b/tools/arch/parisc/include/uapi/asm/errno.h
@@ -0,0 +1,128 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _PARISC_ERRNO_H
+#define _PARISC_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 */
+#define EUNATCH 42 /* Protocol driver not attached */
+#define ENOCSI 43 /* No CSI structure available */
+#define EL2HLT 44 /* Level 2 halted */
+#define EDEADLK 45 /* Resource deadlock would occur */
+#define EDEADLOCK EDEADLK
+#define ENOLCK 46 /* No record locks available */
+#define EILSEQ 47 /* Illegal byte sequence */
+
+#define ENONET 50 /* Machine is not on the network */
+#define ENODATA 51 /* No data available */
+#define ETIME 52 /* Timer expired */
+#define ENOSR 53 /* Out of streams resources */
+#define ENOSTR 54 /* Device not a stream */
+#define ENOPKG 55 /* Package not installed */
+
+#define ENOLINK 57 /* Link has been severed */
+#define EADV 58 /* Advertise error */
+#define ESRMNT 59 /* Srmount error */
+#define ECOMM 60 /* Communication error on send */
+#define EPROTO 61 /* Protocol error */
+
+#define EMULTIHOP 64 /* Multihop attempted */
+
+#define EDOTDOT 66 /* RFS specific error */
+#define EBADMSG 67 /* Not a data message */
+#define EUSERS 68 /* Too many users */
+#define EDQUOT 69 /* Quota exceeded */
+#define ESTALE 70 /* Stale file handle */
+#define EREMOTE 71 /* Object is remote */
+#define EOVERFLOW 72 /* Value too large for defined data type */
+
+/* these errnos are defined by Linux but not HPUX. */
+
+#define EBADE 160 /* Invalid exchange */
+#define EBADR 161 /* Invalid request descriptor */
+#define EXFULL 162 /* Exchange full */
+#define ENOANO 163 /* No anode */
+#define EBADRQC 164 /* Invalid request code */
+#define EBADSLT 165 /* Invalid slot */
+#define EBFONT 166 /* Bad font file format */
+#define ENOTUNIQ 167 /* Name not unique on network */
+#define EBADFD 168 /* File descriptor in bad state */
+#define EREMCHG 169 /* Remote address changed */
+#define ELIBACC 170 /* Can not access a needed shared library */
+#define ELIBBAD 171 /* Accessing a corrupted shared library */
+#define ELIBSCN 172 /* .lib section in a.out corrupted */
+#define ELIBMAX 173 /* Attempting to link in too many shared libraries */
+#define ELIBEXEC 174 /* Cannot exec a shared library directly */
+#define ERESTART 175 /* Interrupted system call should be restarted */
+#define ESTRPIPE 176 /* Streams pipe error */
+#define EUCLEAN 177 /* Structure needs cleaning */
+#define ENOTNAM 178 /* Not a XENIX named type file */
+#define ENAVAIL 179 /* No XENIX semaphores available */
+#define EISNAM 180 /* Is a named type file */
+#define EREMOTEIO 181 /* Remote I/O error */
+#define ENOMEDIUM 182 /* No medium found */
+#define EMEDIUMTYPE 183 /* Wrong medium type */
+#define ENOKEY 184 /* Required key not available */
+#define EKEYEXPIRED 185 /* Key has expired */
+#define EKEYREVOKED 186 /* Key has been revoked */
+#define EKEYREJECTED 187 /* Key was rejected by service */
+
+/* We now return you to your regularly scheduled HPUX. */
+
+#define ENOSYM 215 /* symbol does not exist in executable */
+#define ENOTSOCK 216 /* Socket operation on non-socket */
+#define EDESTADDRREQ 217 /* Destination address required */
+#define EMSGSIZE 218 /* Message too long */
+#define EPROTOTYPE 219 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 220 /* Protocol not available */
+#define EPROTONOSUPPORT 221 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 222 /* Socket type not supported */
+#define EOPNOTSUPP 223 /* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 224 /* Protocol family not supported */
+#define EAFNOSUPPORT 225 /* Address family not supported by protocol */
+#define EADDRINUSE 226 /* Address already in use */
+#define EADDRNOTAVAIL 227 /* Cannot assign requested address */
+#define ENETDOWN 228 /* Network is down */
+#define ENETUNREACH 229 /* Network is unreachable */
+#define ENETRESET 230 /* Network dropped connection because of reset */
+#define ECONNABORTED 231 /* Software caused connection abort */
+#define ECONNRESET 232 /* Connection reset by peer */
+#define ENOBUFS 233 /* No buffer space available */
+#define EISCONN 234 /* Transport endpoint is already connected */
+#define ENOTCONN 235 /* Transport endpoint is not connected */
+#define ESHUTDOWN 236 /* Cannot send after transport endpoint shutdown */
+#define ETOOMANYREFS 237 /* Too many references: cannot splice */
+#define ETIMEDOUT 238 /* Connection timed out */
+#define ECONNREFUSED 239 /* Connection refused */
+#define EREFUSED ECONNREFUSED /* for HP's NFS apparently */
+#define EREMOTERELEASE 240 /* Remote peer released connection */
+#define EHOSTDOWN 241 /* Host is down */
+#define EHOSTUNREACH 242 /* No route to host */
+
+#define EALREADY 244 /* Operation already in progress */
+#define EINPROGRESS 245 /* Operation now in progress */
+#define EWOULDBLOCK EAGAIN /* Operation would block (Not HPUX compliant) */
+#define ENOTEMPTY 247 /* Directory not empty */
+#define ENAMETOOLONG 248 /* File name too long */
+#define ELOOP 249 /* Too many symbolic links encountered */
+#define ENOSYS 251 /* Function not implemented */
+
+#define ENOTSUP 252 /* Function not implemented (POSIX.4 / HPUX) */
+#define ECANCELLED 253 /* aio request was canceled before complete (POSIX.4 / HPUX) */
+#define ECANCELED ECANCELLED /* SuSv3 and Solaris wants one 'L' */
+
+/* for robust mutexes */
+#define EOWNERDEAD 254 /* Owner died */
+#define ENOTRECOVERABLE 255 /* State not recoverable */
+
+#define ERFKILL 256 /* Operation not possible due to RF-kill */
+
+#define EHWPOISON 257 /* Memory page has hardware error */
+
+#endif
diff --git a/tools/arch/powerpc/include/uapi/asm/errno.h b/tools/arch/powerpc/include/uapi/asm/errno.h
new file mode 100644
index 0000000..cc79856
--- /dev/null
+++ b/tools/arch/powerpc/include/uapi/asm/errno.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _ASM_POWERPC_ERRNO_H
+#define _ASM_POWERPC_ERRNO_H
+
+#include <asm-generic/errno.h>
+
+#undef EDEADLOCK
+#define EDEADLOCK 58 /* File locking deadlock error */
+
+#endif /* _ASM_POWERPC_ERRNO_H */
diff --git a/tools/arch/sparc/include/uapi/asm/errno.h b/tools/arch/sparc/include/uapi/asm/errno.h
new file mode 100644
index 0000000..81a732b
--- /dev/null
+++ b/tools/arch/sparc/include/uapi/asm/errno.h
@@ -0,0 +1,118 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _SPARC_ERRNO_H
+#define _SPARC_ERRNO_H
+
+/* These match the SunOS error numbering scheme. */
+
+#include <asm-generic/errno-base.h>
+
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#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 */
+#define EPROTONOSUPPORT 43 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
+#define EOPNOTSUPP 45 /* Op not supported on transport endpoint */
+#define EPFNOSUPPORT 46 /* Protocol family not supported */
+#define EAFNOSUPPORT 47 /* Address family not supported by protocol */
+#define EADDRINUSE 48 /* Address already in use */
+#define EADDRNOTAVAIL 49 /* Cannot assign requested address */
+#define ENETDOWN 50 /* Network is down */
+#define ENETUNREACH 51 /* Network is unreachable */
+#define ENETRESET 52 /* Net dropped connection because of reset */
+#define ECONNABORTED 53 /* Software caused connection abort */
+#define ECONNRESET 54 /* Connection reset by peer */
+#define ENOBUFS 55 /* No buffer space available */
+#define EISCONN 56 /* Transport endpoint is already connected */
+#define ENOTCONN 57 /* Transport endpoint is not connected */
+#define ESHUTDOWN 58 /* No send after transport endpoint shutdown */
+#define ETOOMANYREFS 59 /* Too many references: cannot splice */
+#define ETIMEDOUT 60 /* Connection timed out */
+#define ECONNREFUSED 61 /* Connection refused */
+#define ELOOP 62 /* Too many symbolic links encountered */
+#define ENAMETOOLONG 63 /* File name too long */
+#define EHOSTDOWN 64 /* Host is down */
+#define EHOSTUNREACH 65 /* No route to host */
+#define ENOTEMPTY 66 /* Directory not empty */
+#define EPROCLIM 67 /* SUNOS: Too many processes */
+#define EUSERS 68 /* Too many users */
+#define EDQUOT 69 /* Quota exceeded */
+#define ESTALE 70 /* Stale file handle */
+#define EREMOTE 71 /* Object is remote */
+#define ENOSTR 72 /* Device not a stream */
+#define ETIME 73 /* Timer expired */
+#define ENOSR 74 /* Out of streams resources */
+#define ENOMSG 75 /* No message of desired type */
+#define EBADMSG 76 /* Not a data message */
+#define EIDRM 77 /* Identifier removed */
+#define EDEADLK 78 /* Resource deadlock would occur */
+#define ENOLCK 79 /* No record locks available */
+#define ENONET 80 /* Machine is not on the network */
+#define ERREMOTE 81 /* SunOS: Too many lvls of remote in path */
+#define ENOLINK 82 /* Link has been severed */
+#define EADV 83 /* Advertise error */
+#define ESRMNT 84 /* Srmount error */
+#define ECOMM 85 /* Communication error on send */
+#define EPROTO 86 /* Protocol error */
+#define EMULTIHOP 87 /* Multihop attempted */
+#define EDOTDOT 88 /* RFS specific error */
+#define EREMCHG 89 /* Remote address changed */
+#define ENOSYS 90 /* Function not implemented */
+
+/* The rest have no SunOS equivalent. */
+#define ESTRPIPE 91 /* Streams pipe error */
+#define EOVERFLOW 92 /* Value too large for defined data type */
+#define EBADFD 93 /* File descriptor in bad state */
+#define ECHRNG 94 /* Channel number out of range */
+#define EL2NSYNC 95 /* Level 2 not synchronized */
+#define EL3HLT 96 /* Level 3 halted */
+#define EL3RST 97 /* Level 3 reset */
+#define ELNRNG 98 /* Link number out of range */
+#define EUNATCH 99 /* Protocol driver not attached */
+#define ENOCSI 100 /* No CSI structure available */
+#define EL2HLT 101 /* Level 2 halted */
+#define EBADE 102 /* Invalid exchange */
+#define EBADR 103 /* Invalid request descriptor */
+#define EXFULL 104 /* Exchange full */
+#define ENOANO 105 /* No anode */
+#define EBADRQC 106 /* Invalid request code */
+#define EBADSLT 107 /* Invalid slot */
+#define EDEADLOCK 108 /* File locking deadlock error */
+#define EBFONT 109 /* Bad font file format */
+#define ELIBEXEC 110 /* Cannot exec a shared library directly */
+#define ENODATA 111 /* No data available */
+#define ELIBBAD 112 /* Accessing a corrupted shared library */
+#define ENOPKG 113 /* Package not installed */
+#define ELIBACC 114 /* Can not access a needed shared library */
+#define ENOTUNIQ 115 /* Name not unique on network */
+#define ERESTART 116 /* Interrupted syscall should be restarted */
+#define EUCLEAN 117 /* Structure needs cleaning */
+#define ENOTNAM 118 /* Not a XENIX named type file */
+#define ENAVAIL 119 /* No XENIX semaphores available */
+#define EISNAM 120 /* Is a named type file */
+#define EREMOTEIO 121 /* Remote I/O error */
+#define EILSEQ 122 /* Illegal byte sequence */
+#define ELIBMAX 123 /* Atmpt to link in too many shared libs */
+#define ELIBSCN 124 /* .lib section in a.out corrupted */
+
+#define ENOMEDIUM 125 /* No medium found */
+#define EMEDIUMTYPE 126 /* Wrong medium type */
+#define ECANCELED 127 /* Operation Cancelled */
+#define ENOKEY 128 /* Required key not available */
+#define EKEYEXPIRED 129 /* Key has expired */
+#define EKEYREVOKED 130 /* Key has been revoked */
+#define EKEYREJECTED 131 /* Key was rejected by service */
+
+/* for robust mutexes */
+#define EOWNERDEAD 132 /* Owner died */
+#define ENOTRECOVERABLE 133 /* State not recoverable */
+
+#define ERFKILL 134 /* Operation not possible due to RF-kill */
+
+#define EHWPOISON 135 /* Memory page has hardware error */
+
+#endif
diff --git a/tools/arch/x86/include/uapi/asm/errno.h b/tools/arch/x86/include/uapi/asm/errno.h
new file mode 100644
index 0000000..4c82b50
--- /dev/null
+++ b/tools/arch/x86/include/uapi/asm/errno.h
@@ -0,0 +1 @@
+#include <asm-generic/errno.h>
--git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index f81ca50..83a65d3 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -36,6 +36,13 @@ 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
+arch/alpha/include/uapi/asm/errno.h
+arch/mips/include/asm/errno.h
+arch/mips/include/uapi/asm/errno.h
+arch/parisc/include/uapi/asm/errno.h
+arch/powerpc/include/uapi/asm/errno.h
+arch/sparc/include/uapi/asm/errno.h
+arch/x86/include/uapi/asm/errno.h
include/asm-generic/bitops/arch_hweight.h
include/asm-generic/bitops/const_hweight.h
include/asm-generic/bitops/__fls.h
--
1.8.3.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/5] tools include asm-generic: Grab errno.h and errno-base.h
2018-01-19 8:56 [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 1/5] tools include arch: Grab a copy of errno.h for arch's supported by perf Hendrik Brueckner
@ 2018-01-19 8:56 ` Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 3/5] perf util: Introduce architecture specific errno/name mapping Hendrik Brueckner
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Hendrik Brueckner @ 2018-01-19 8:56 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390, Arnaldo Carvalho de Melo
This is a pre-req to generate an architecture specific mapping of
errno numbers to their names. This errno mapping can be used by
perf trace to support cross-architecture trace reports and to
get rid of the audit-libs dependency.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
---
tools/include/uapi/asm-generic/errno-base.h | 40 +++++++++
tools/include/uapi/asm-generic/errno.h | 123 ++++++++++++++++++++++++++++
| 2 +
3 files changed, 165 insertions(+)
create mode 100644 tools/include/uapi/asm-generic/errno-base.h
create mode 100644 tools/include/uapi/asm-generic/errno.h
diff --git a/tools/include/uapi/asm-generic/errno-base.h b/tools/include/uapi/asm-generic/errno-base.h
new file mode 100644
index 0000000..9653140
--- /dev/null
+++ b/tools/include/uapi/asm-generic/errno-base.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _ASM_GENERIC_ERRNO_BASE_H
+#define _ASM_GENERIC_ERRNO_BASE_H
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Argument list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No child processes */
+#define EAGAIN 11 /* Try again */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math argument out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+
+#endif
diff --git a/tools/include/uapi/asm-generic/errno.h b/tools/include/uapi/asm-generic/errno.h
new file mode 100644
index 0000000..cf9c51a
--- /dev/null
+++ b/tools/include/uapi/asm-generic/errno.h
@@ -0,0 +1,123 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _ASM_GENERIC_ERRNO_H
+#define _ASM_GENERIC_ERRNO_H
+
+#include <asm-generic/errno-base.h>
+
+#define EDEADLK 35 /* Resource deadlock would occur */
+#define ENAMETOOLONG 36 /* File name too long */
+#define ENOLCK 37 /* No record locks available */
+
+/*
+ * This error code is special: arch syscall entry code will return
+ * -ENOSYS if users try to call a syscall that doesn't exist. To keep
+ * failures of syscalls that really do exist distinguishable from
+ * failures due to attempts to use a nonexistent syscall, syscall
+ * implementations should refrain from returning -ENOSYS.
+ */
+#define ENOSYS 38 /* Invalid system call number */
+
+#define ENOTEMPTY 39 /* Directory not empty */
+#define ELOOP 40 /* Too many symbolic links encountered */
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define ENOMSG 42 /* No message of desired type */
+#define EIDRM 43 /* Identifier removed */
+#define ECHRNG 44 /* Channel number out of range */
+#define EL2NSYNC 45 /* Level 2 not synchronized */
+#define EL3HLT 46 /* Level 3 halted */
+#define EL3RST 47 /* Level 3 reset */
+#define ELNRNG 48 /* Link number out of range */
+#define EUNATCH 49 /* Protocol driver not attached */
+#define ENOCSI 50 /* No CSI structure available */
+#define EL2HLT 51 /* Level 2 halted */
+#define EBADE 52 /* Invalid exchange */
+#define EBADR 53 /* Invalid request descriptor */
+#define EXFULL 54 /* Exchange full */
+#define ENOANO 55 /* No anode */
+#define EBADRQC 56 /* Invalid request code */
+#define EBADSLT 57 /* Invalid slot */
+
+#define EDEADLOCK EDEADLK
+
+#define EBFONT 59 /* Bad font file format */
+#define ENOSTR 60 /* Device not a stream */
+#define ENODATA 61 /* No data available */
+#define ETIME 62 /* Timer expired */
+#define ENOSR 63 /* Out of streams resources */
+#define ENONET 64 /* Machine is not on the network */
+#define ENOPKG 65 /* Package not installed */
+#define EREMOTE 66 /* Object is remote */
+#define ENOLINK 67 /* Link has been severed */
+#define EADV 68 /* Advertise error */
+#define ESRMNT 69 /* Srmount error */
+#define ECOMM 70 /* Communication error on send */
+#define EPROTO 71 /* Protocol error */
+#define EMULTIHOP 72 /* Multihop attempted */
+#define EDOTDOT 73 /* RFS specific error */
+#define EBADMSG 74 /* Not a data message */
+#define EOVERFLOW 75 /* Value too large for defined data type */
+#define ENOTUNIQ 76 /* Name not unique on network */
+#define EBADFD 77 /* File descriptor in bad state */
+#define EREMCHG 78 /* Remote address changed */
+#define ELIBACC 79 /* Can not access a needed shared library */
+#define ELIBBAD 80 /* Accessing a corrupted shared library */
+#define ELIBSCN 81 /* .lib section in a.out corrupted */
+#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
+#define ELIBEXEC 83 /* Cannot exec a shared library directly */
+#define EILSEQ 84 /* Illegal byte sequence */
+#define ERESTART 85 /* Interrupted system call should be restarted */
+#define ESTRPIPE 86 /* Streams pipe error */
+#define EUSERS 87 /* Too many users */
+#define ENOTSOCK 88 /* Socket operation on non-socket */
+#define EDESTADDRREQ 89 /* Destination address required */
+#define EMSGSIZE 90 /* Message too long */
+#define EPROTOTYPE 91 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 92 /* Protocol not available */
+#define EPROTONOSUPPORT 93 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
+#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 96 /* Protocol family not supported */
+#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
+#define EADDRINUSE 98 /* Address already in use */
+#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
+#define ENETDOWN 100 /* Network is down */
+#define ENETUNREACH 101 /* Network is unreachable */
+#define ENETRESET 102 /* Network dropped connection because of reset */
+#define ECONNABORTED 103 /* Software caused connection abort */
+#define ECONNRESET 104 /* Connection reset by peer */
+#define ENOBUFS 105 /* No buffer space available */
+#define EISCONN 106 /* Transport endpoint is already connected */
+#define ENOTCONN 107 /* Transport endpoint is not connected */
+#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
+#define ETOOMANYREFS 109 /* Too many references: cannot splice */
+#define ETIMEDOUT 110 /* Connection timed out */
+#define ECONNREFUSED 111 /* Connection refused */
+#define EHOSTDOWN 112 /* Host is down */
+#define EHOSTUNREACH 113 /* No route to host */
+#define EALREADY 114 /* Operation already in progress */
+#define EINPROGRESS 115 /* Operation now in progress */
+#define ESTALE 116 /* Stale file handle */
+#define EUCLEAN 117 /* Structure needs cleaning */
+#define ENOTNAM 118 /* Not a XENIX named type file */
+#define ENAVAIL 119 /* No XENIX semaphores available */
+#define EISNAM 120 /* Is a named type file */
+#define EREMOTEIO 121 /* Remote I/O error */
+#define EDQUOT 122 /* Quota exceeded */
+
+#define ENOMEDIUM 123 /* No medium found */
+#define EMEDIUMTYPE 124 /* Wrong medium type */
+#define ECANCELED 125 /* Operation Canceled */
+#define ENOKEY 126 /* Required key not available */
+#define EKEYEXPIRED 127 /* Key has expired */
+#define EKEYREVOKED 128 /* Key has been revoked */
+#define EKEYREJECTED 129 /* Key was rejected by service */
+
+/* for robust mutexes */
+#define EOWNERDEAD 130 /* Owner died */
+#define ENOTRECOVERABLE 131 /* State not recoverable */
+
+#define ERFKILL 132 /* Operation not possible due to RF-kill */
+
+#define EHWPOISON 133 /* Memory page has hardware error */
+
+#endif
--git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index 83a65d3..51abdb0 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -49,6 +49,8 @@ include/asm-generic/bitops/__fls.h
include/asm-generic/bitops/fls.h
include/asm-generic/bitops/fls64.h
include/linux/coresight-pmu.h
+include/uapi/asm-generic/errno.h
+include/uapi/asm-generic/errno-base.h
include/uapi/asm-generic/ioctls.h
include/uapi/asm-generic/mman-common.h
'
--
1.8.3.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/5] perf util: Introduce architecture specific errno/name mapping
2018-01-19 8:56 [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 1/5] tools include arch: Grab a copy of errno.h for arch's supported by perf Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 2/5] tools include asm-generic: Grab errno.h and errno-base.h Hendrik Brueckner
@ 2018-01-19 8:56 ` Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 4/5] perf trace: Obtain errno values by using arch_syscalls__strerrno() Hendrik Brueckner
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Hendrik Brueckner @ 2018-01-19 8:56 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390, Arnaldo Carvalho de Melo
Introduce a script that generates a mapping of errno numbers to
their names for each architecture that is supported by perf (i.e.
has a subdirectory in tools/perf/arch/).
The errno mapping is generated as part of the trace beautifiers
and can be used by including the trace/beauty/arch_errno_names.c
file. Then, use arch_syscalls__strerrno() to look up an errno value
to obtain the errno name (e.g. ENOENT) for a particular architecture.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/Makefile.perf | 13 +++-
tools/perf/trace/beauty/arch_errno_names.c | 1 +
tools/perf/trace/beauty/arch_errno_names.sh | 100 ++++++++++++++++++++++++++++
tools/perf/trace/beauty/beauty.h | 2 +
4 files changed, 114 insertions(+), 2 deletions(-)
create mode 100644 tools/perf/trace/beauty/arch_errno_names.c
create mode 100755 tools/perf/trace/beauty/arch_errno_names.sh
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 9fdefd7..9a9b528 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -462,6 +462,13 @@ prctl_option_tbl := $(srctree)/tools/perf/trace/beauty/prctl_option.sh
$(prctl_option_array): $(prctl_hdr_dir)/prctl.h $(prctl_option_tbl)
$(Q)$(SHELL) '$(prctl_option_tbl)' $(prctl_hdr_dir) > $@
+arch_errno_name_array := $(beauty_outdir)/arch_errno_name_array.c
+arch_errno_hdr_dir := $(srctree)/tools
+arch_errno_tbl := $(srctree)/tools/perf/trace/beauty/arch_errno_names.sh
+
+$(arch_errno_name_array): $(arch_errno_tbl)
+ $(Q)$(SHELL) '$(arch_errno_tbl)' $(CC) $(arch_errno_hdr_dir) > $@
+
all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
@@ -565,7 +572,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) \
+ $(arch_errno_name_array)
$(OUTPUT)%.o: %.c prepare FORCE
$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
@@ -847,7 +855,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)$(arch_errno_name_array)
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
#
diff --git a/tools/perf/trace/beauty/arch_errno_names.c b/tools/perf/trace/beauty/arch_errno_names.c
new file mode 100644
index 0000000..ede031c
--- /dev/null
+++ b/tools/perf/trace/beauty/arch_errno_names.c
@@ -0,0 +1 @@
+#include "trace/beauty/generated/arch_errno_name_array.c"
diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh
new file mode 100755
index 0000000..1c9e37d
--- /dev/null
+++ b/tools/perf/trace/beauty/arch_errno_names.sh
@@ -0,0 +1,100 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Generate C file mapping errno codes to errno names.
+#
+# Copyright IBM Corp. 2018
+# 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 '[[:upper:]]' '[[:lower:]]'
+}
+
+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
+}
+
+create_errno_lookup_func()
+{
+ local arch=$(arch_string "$1")
+ local nr name
+
+ cat <<EoFuncBegin
+static const char *errno_to_name__$arch(int err)
+{
+ switch (err) {
+EoFuncBegin
+
+ while read name nr; do
+ printf '\tcase %d: return "%s";\n' $nr $name
+ done
+
+ cat <<EoFuncEnd
+ default:
+ return "(unknown)";
+ }
+}
+
+EoFuncEnd
+}
+
+process_arch()
+{
+ local arch="$1"
+ 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 \
+ |IFS=, create_errno_lookup_func "$arch"
+}
+
+create_arch_errno_table_func()
+{
+ local archlist="$1"
+ local default="$2"
+ local arch
+
+ printf 'const char *arch_syscalls__strerrno(const char *arch, int err)\n'
+ printf '{\n'
+ for arch in $archlist; do
+ printf '\tif (!strcmp(arch, "%s"))\n' $(arch_string "$arch")
+ printf '\t\treturn errno_to_name__%s(err);\n' $(arch_string "$arch")
+ done
+ printf '\treturn errno_to_name__%s(err);\n' $(arch_string "$default")
+ printf '}'
+}
+
+cat <<EoHEADER
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <string.h>
+
+EoHEADER
+
+# Create list of architectures and ignore those that do not appear
+# in tools/perf/arch
+archlist=""
+for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" |sort); do
+ test -d arch/$arch && archlist="$archlist $arch"
+done
+
+for arch in $archlist generic; do
+ process_arch "$arch"
+done
+create_arch_errno_table_func "$archlist" "generic"
diff --git a/tools/perf/trace/beauty/beauty.h b/tools/perf/trace/beauty/beauty.h
index a6dfd04..d8f6b2e 100644
--- a/tools/perf/trace/beauty/beauty.h
+++ b/tools/perf/trace/beauty/beauty.h
@@ -114,4 +114,6 @@ struct syscall_arg {
void syscall_arg__set_ret_scnprintf(struct syscall_arg *arg,
size_t (*ret_scnprintf)(char *bf, size_t size, struct syscall_arg *arg));
+const char *arch_syscalls__strerrno(const char *arch, int err);
+
#endif /* _PERF_TRACE_BEAUTY_H */
--
1.8.3.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 4/5] perf trace: Obtain errno values by using arch_syscalls__strerrno()
2018-01-19 8:56 [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings Hendrik Brueckner
` (2 preceding siblings ...)
2018-01-19 8:56 ` [PATCH v2 3/5] perf util: Introduce architecture specific errno/name mapping Hendrik Brueckner
@ 2018-01-19 8:56 ` Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 5/5] perf trace: Remove audit-libs dependency if syscall tables are present Hendrik Brueckner
2018-01-25 8:00 ` [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings Ravi Bangoria
5 siblings, 0 replies; 10+ messages in thread
From: Hendrik Brueckner @ 2018-01-19 8:56 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390, Arnaldo Carvalho de Melo
Replace the errno_to_name() from the audit-libs with the newly
introduced arch_syscalls__strerrno() function.
With this change:
1. With replacing errno_to_name() from audit-libs, perf trace
does no longer require audit-lib interfaces.
2. In addition to 1, the audit-libs dependency can be removed
for architectures that support syscall tables in perf.
This is achieved in a follow-up commit.
3. With the architecture specific errno number/name mapping,
perf trace reports can work across architectures.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/builtin-trace.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 531d43b..7dece5e 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -21,6 +21,7 @@
#include "builtin.h"
#include "util/color.h"
#include "util/debug.h"
+#include "util/env.h"
#include "util/event.h"
#include "util/evlist.h"
#include <subcmd/exec-cmd.h>
@@ -45,14 +46,12 @@
#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>
@@ -545,6 +544,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size,
{ .scnprintf = SCA_STRARRAY, \
.parm = &strarray__##array, }
+#include "trace/beauty/arch_errno_names.c"
#include "trace/beauty/eventfd.c"
#include "trace/beauty/flock.c"
#include "trace/beauty/futex_op.c"
@@ -1660,6 +1660,14 @@ 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(struct perf_evsel *evsel, int err)
+{
+ struct perf_env *env = perf_evsel__env(evsel);
+ const char *arch_name = perf_env__arch(env);
+
+ return arch_syscalls__strerrno(arch_name, err);
+}
+
static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
union perf_event *event __maybe_unused,
struct perf_sample *sample)
@@ -1730,7 +1738,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(evsel, -ret);
fprintf(trace->output, ") = -1 %s %s", e, emsg);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 5/5] perf trace: Remove audit-libs dependency if syscall tables are present
2018-01-19 8:56 [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings Hendrik Brueckner
` (3 preceding siblings ...)
2018-01-19 8:56 ` [PATCH v2 4/5] perf trace: Obtain errno values by using arch_syscalls__strerrno() Hendrik Brueckner
@ 2018-01-19 8:56 ` Hendrik Brueckner
2018-01-19 14:04 ` Arnaldo Carvalho de Melo
2018-01-25 8:00 ` [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings Ravi Bangoria
5 siblings, 1 reply; 10+ messages in thread
From: Hendrik Brueckner @ 2018-01-19 8:56 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390, Arnaldo Carvalho de Melo
Change the Makefile and build process to no longer require audit-libs
interfaces when the architecture provides system call tables.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.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 12dec6e..f02f370 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -533,8 +533,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] 10+ messages in thread
* Re: [PATCH v2 5/5] perf trace: Remove audit-libs dependency if syscall tables are present
2018-01-19 8:56 ` [PATCH v2 5/5] perf trace: Remove audit-libs dependency if syscall tables are present Hendrik Brueckner
@ 2018-01-19 14:04 ` Arnaldo Carvalho de Melo
2018-01-21 12:27 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-01-19 14:04 UTC (permalink / raw)
To: Hendrik Brueckner
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390, Arnaldo Carvalho de Melo
Em Fri, Jan 19, 2018 at 09:56:17AM +0100, Hendrik Brueckner escreveu:
> Change the Makefile and build process to no longer require audit-libs
> interfaces when the architecture provides system call tables.
>
> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
> Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
So, I need this extra patch to really stop linking against
audit-libs-devel (aka libaudit), which I merged with this 5/5 patch and
have now in my tree, thanks for your work! Now we can get on with this
and, for instance, get rid of those strcmp() and big switch statements,
which I think that could be just an array plus a helper to see if it is
in its bounds, etc, i.e. use an strarray, look at
tools/perf/trace/beauty/beauty.h:
struct strarray {
int offset;
int nr_entries;
const char **entries;
};
#define DEFINE_STRARRAY(array) struct strarray strarray__##array = { \
.nr_entries = ARRAY_SIZE(array), \
.entries = array, \
}
#define DEFINE_STRARRAY_OFFSET(array, off) struct strarray strarray__##array = { \
.offset = off, \
.nr_entries = ARRAY_SIZE(array), \
.entries = array, \
}
size_t strarray__scnprintf(struct strarray *sa, char *bf, size_t size, const char *intfmt, int val);
tools/perf/trace/beauty/ has lots of uses for it.
[acme@seventh perf]$ rpm -q audit-libs-devel
audit-libs-devel-2.8.2-1.fc27.x86_64
[acme@seventh perf]$ ldd ~/bin/perf | grep audit
[acme@seventh perf]$
diff --git a/tools/perf/Build b/tools/perf/Build
index b48ca40fccf9..e5232d567611 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -25,7 +25,7 @@ perf-y += builtin-data.o
perf-y += builtin-version.o
perf-y += builtin-c2c.o
-perf-$(CONFIG_AUDIT) += builtin-trace.o
+perf-$(CONFIG_TRACE) += builtin-trace.o
perf-$(CONFIG_LIBELF) += builtin-probe.o
perf-y += bench/
@@ -50,6 +50,6 @@ libperf-y += util/
libperf-y += arch/
libperf-y += ui/
libperf-y += scripts/
-libperf-$(CONFIG_AUDIT) += trace/beauty/
+libperf-$(CONFIG_TRACE) += trace/beauty/
gtk-y += ui/gtk/
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 896dee62078c..a042ccca4e93 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -531,20 +531,18 @@ ifndef NO_LIBUNWIND
EXTLIBS += $(EXTLIBS_LIBUNWIND)
endif
-ifndef NO_LIBAUDIT
- ifneq ($(feature-libaudit), 1)
- ifeq ($(NO_SYSCALL_TABLE), 1)
+ifeq ($(NO_SYSCALL_TABLE),0)
+ $(call detected,CONFIG_TRACE)
+else
+ 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
else
- # With syscall table support, auditlibs are no longer required to build
- # the trace tool.
- $(call detected,CONFIG_AUDIT)
+ CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
+ EXTLIBS += -laudit
+ $(call detected,CONFIG_TRACE)
endif
- else
- CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
- EXTLIBS += -laudit
- $(call detected,CONFIG_AUDIT)
endif
endif
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 7c6a8b461e24..4eef0c243306 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -44,7 +44,7 @@ libperf-y += machine.o
libperf-y += map.o
libperf-y += pstack.o
libperf-y += session.o
-libperf-$(CONFIG_AUDIT) += syscalltbl.o
+libperf-$(CONFIG_TRACE) += syscalltbl.o
libperf-y += ordered-events.o
libperf-y += namespaces.o
libperf-y += comm.o
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 5/5] perf trace: Remove audit-libs dependency if syscall tables are present
2018-01-19 14:04 ` Arnaldo Carvalho de Melo
@ 2018-01-21 12:27 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-01-21 12:27 UTC (permalink / raw)
To: Hendrik Brueckner
Cc: Thomas-Mich Richter, Michael Petlan, Jiri Olsa, linux-perf-users,
linux-s390, Arnaldo Carvalho de Melo
Em Fri, Jan 19, 2018 at 11:04:26AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Jan 19, 2018 at 09:56:17AM +0100, Hendrik Brueckner escreveu:
> > Change the Makefile and build process to no longer require audit-libs
> > interfaces when the architecture provides system call tables.
> >
> > Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
> > Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
> > Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> > Cc: Jiri Olsa <jolsa@redhat.com>
>
> So, I need this extra patch to really stop linking against
> audit-libs-devel (aka libaudit), which I merged with this 5/5 patch and
> have now in my tree, thanks for your work!
So, test building it on centos:5 fails:
CC /tmp/build/perf/bench/sched-messaging.o
In file included from trace/beauty/arch_errno_names.c:1,
from builtin-trace.c:547:
/tmp/build/perf/trace/beauty/generated/arch_errno_name_array.c:1708:2: error: no newline at end of file
I'm fixing this up.
- Arnaldo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings
2018-01-19 8:56 [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings Hendrik Brueckner
` (4 preceding siblings ...)
2018-01-19 8:56 ` [PATCH v2 5/5] perf trace: Remove audit-libs dependency if syscall tables are present Hendrik Brueckner
@ 2018-01-25 8:00 ` Ravi Bangoria
2018-01-25 9:28 ` Arnaldo Carvalho de Melo
5 siblings, 1 reply; 10+ messages in thread
From: Ravi Bangoria @ 2018-01-25 8:00 UTC (permalink / raw)
To: Hendrik Brueckner
Cc: Arnaldo Carvalho de Melo, Thomas-Mich Richter, Michael Petlan,
Jiri Olsa, linux-perf-users, linux-s390, Ravi Bangoria
Hi Hendrik,
On 01/19/2018 02:26 PM, Hendrik Brueckner wrote:
> Introduce an interface to perf to resolve errno codes to their names.
> This is used by perf trace to display the errno name, for example, ENOENT,
> for an system call. The previous implementation used the errno_to_name()
> function from the audit library.
>
> With this change, a table of errno codes and their names are created for
> each architecture on which perf is supported (others can be easily added
> if necessary). The errno_to_name() function from the audit library is
> replaced with an arch-specific one, arch_errno_to_name().
>
> The benefit is that perf trace does not longer have a direct dependency
> for the audit library and the perf trace output can be displayed across
> architectures. For example, collect trace output on s390 and display it
> on x86.
I haven't tested this but are you sure that we can do cross-arch perf-trace
after this patch set?
Why I'm curious is because, we embed arch specific syscall table in the perf
binary at compile time:
$ cat tools/perf/util/syscalltbl.c
#if defined(__x86_64__)
#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
If we don't have, let's say, s390 syscall table in perf compiled on x86 machine,
we won't be able to do perf-trace across architecture. Right ?
Please let me know if I'm missing anything.
Thanks,
Ravi
P.S.: Seems I can remove libaudit dependency for syscalls on PowerPC as well.
Will prepare patches for that very soon.
>
> The audit library dependency can be further reduced and completely removed
> for architectures that support system call tables in perf (see last commit).
>
> See also discussion on:
> - https://www.spinics.net/lists/linux-perf-users/msg04782.html
> - https://www.spinics.net/lists/linux-perf-users/msg05005.html
>
> Please note that this patch set is bases on the perf/core branch.
>
> Changes in v2:
> As the arch_errno_to_name() mapping is used by perf trace only,
> move all the scripts and generated files from tools/perf/util/
> to the tools/perf/trace/beauty/{generated/} directories.
> See also https://www.spinics.net/lists/linux-perf-users/msg05037.html
>
>
> Hendrik Brueckner (5):
> tools include arch: Grab a copy of errno.h for arch's supported by
> perf
> tools include asm-generic: Grab errno.h and errno-base.h
> perf util: Introduce architecture specific errno/name mapping
> perf trace: Obtain errno values by using arch_syscalls__strerrno()
> perf trace: Remove audit-libs dependency if syscall tables are present
>
> tools/arch/alpha/include/uapi/asm/errno.h | 128 +++++++++++++++++++++++++++
> tools/arch/mips/include/asm/errno.h | 17 ++++
> tools/arch/mips/include/uapi/asm/errno.h | 130 ++++++++++++++++++++++++++++
> tools/arch/parisc/include/uapi/asm/errno.h | 128 +++++++++++++++++++++++++++
> tools/arch/powerpc/include/uapi/asm/errno.h | 10 +++
> tools/arch/sparc/include/uapi/asm/errno.h | 118 +++++++++++++++++++++++++
> tools/arch/x86/include/uapi/asm/errno.h | 1 +
> tools/include/uapi/asm-generic/errno-base.h | 40 +++++++++
> tools/include/uapi/asm-generic/errno.h | 123 ++++++++++++++++++++++++++
> tools/perf/Makefile.config | 10 ++-
> tools/perf/Makefile.perf | 13 ++-
> tools/perf/builtin-help.c | 2 +-
> tools/perf/builtin-trace.c | 14 ++-
> tools/perf/check-headers.sh | 9 ++
> tools/perf/perf.c | 4 +-
> tools/perf/trace/beauty/arch_errno_names.c | 1 +
> tools/perf/trace/beauty/arch_errno_names.sh | 100 +++++++++++++++++++++
> tools/perf/trace/beauty/beauty.h | 2 +
> tools/perf/util/generate-cmdlist.sh | 2 +-
> 19 files changed, 841 insertions(+), 11 deletions(-)
> create mode 100644 tools/arch/alpha/include/uapi/asm/errno.h
> create mode 100644 tools/arch/mips/include/asm/errno.h
> create mode 100644 tools/arch/mips/include/uapi/asm/errno.h
> create mode 100644 tools/arch/parisc/include/uapi/asm/errno.h
> create mode 100644 tools/arch/powerpc/include/uapi/asm/errno.h
> create mode 100644 tools/arch/sparc/include/uapi/asm/errno.h
> create mode 100644 tools/arch/x86/include/uapi/asm/errno.h
> create mode 100644 tools/include/uapi/asm-generic/errno-base.h
> create mode 100644 tools/include/uapi/asm-generic/errno.h
> create mode 100644 tools/perf/trace/beauty/arch_errno_names.c
> create mode 100755 tools/perf/trace/beauty/arch_errno_names.sh
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings
2018-01-25 8:00 ` [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings Ravi Bangoria
@ 2018-01-25 9:28 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-01-25 9:28 UTC (permalink / raw)
To: Ravi Bangoria
Cc: Hendrik Brueckner, Thomas-Mich Richter, Michael Petlan,
Jiri Olsa, linux-perf-users, linux-s390
Em Thu, Jan 25, 2018 at 01:30:13PM +0530, Ravi Bangoria escreveu:
> Hi Hendrik,
>
> On 01/19/2018 02:26 PM, Hendrik Brueckner wrote:
> > Introduce an interface to perf to resolve errno codes to their names.
> > This is used by perf trace to display the errno name, for example, ENOENT,
> > for an system call. The previous implementation used the errno_to_name()
> > function from the audit library.
> >
> > With this change, a table of errno codes and their names are created for
> > each architecture on which perf is supported (others can be easily added
> > if necessary). The errno_to_name() function from the audit library is
> > replaced with an arch-specific one, arch_errno_to_name().
> >
> > The benefit is that perf trace does not longer have a direct dependency
> > for the audit library and the perf trace output can be displayed across
> > architectures. For example, collect trace output on s390 and display it
> > on x86.
>
> I haven't tested this but are you sure that we can do cross-arch perf-trace
> after this patch set?
This patch is a step in that direction
> Why I'm curious is because, we embed arch specific syscall table in the perf
> binary at compile time:
>
> $ cat tools/perf/util/syscalltbl.c
>
> #if defined(__x86_64__)
> #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
>
> If we don't have, let's say, s390 syscall table in perf compiled on x86 machine,
> we won't be able to do perf-trace across architecture. Right ?
Right.
> Please let me know if I'm missing anything.
You are not, we need to start testing running 'perf trace record' for
some workloads on a, say, PowerPC machine, run perf trace -i on that
file to do the beautification, copy this formatted output file + its
perf.data file, copy that to x86_64 or s/390 and try to get the same
output.
We will not, and the differences will tell us what to work on :-)
- Arnaldo
> Thanks,
> Ravi
>
> P.S.: Seems I can remove libaudit dependency for syscalls on PowerPC as well.
> Will prepare patches for that very soon.
Great!
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-01-25 9:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-19 8:56 [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 1/5] tools include arch: Grab a copy of errno.h for arch's supported by perf Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 2/5] tools include asm-generic: Grab errno.h and errno-base.h Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 3/5] perf util: Introduce architecture specific errno/name mapping Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 4/5] perf trace: Obtain errno values by using arch_syscalls__strerrno() Hendrik Brueckner
2018-01-19 8:56 ` [PATCH v2 5/5] perf trace: Remove audit-libs dependency if syscall tables are present Hendrik Brueckner
2018-01-19 14:04 ` Arnaldo Carvalho de Melo
2018-01-21 12:27 ` Arnaldo Carvalho de Melo
2018-01-25 8:00 ` [PATCH v2 0/5] perf trace: Introduce arch-specific errno code/name mappings Ravi Bangoria
2018-01-25 9:28 ` 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.