diff options
| -rw-r--r-- | tools/arch/arc/include/uapi/asm/unistd.h | 51 | ||||
| -rw-r--r-- | tools/arch/hexagon/include/uapi/asm/unistd.h | 40 | ||||
| -rw-r--r-- | tools/arch/riscv/include/uapi/asm/unistd.h | 42 | ||||
| -rw-r--r-- | tools/arch/x86/include/uapi/asm/vmx.h | 1 | ||||
| -rw-r--r-- | tools/lib/traceevent/parse-utils.c | 2 | ||||
| -rw-r--r-- | tools/perf/Makefile.config | 2 | ||||
| -rw-r--r-- | tools/perf/bench/numa.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/annotate.c | 8 | ||||
| -rw-r--r-- | tools/perf/util/cloexec.c | 1 | ||||
| -rw-r--r-- | tools/perf/util/cs-etm.c | 14 | ||||
| -rw-r--r-- | tools/perf/util/env.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/session.c | 8 |
12 files changed, 154 insertions, 21 deletions
diff --git a/tools/arch/arc/include/uapi/asm/unistd.h b/tools/arch/arc/include/uapi/asm/unistd.h new file mode 100644 index 000000000000..5eafa1115162 --- /dev/null +++ b/tools/arch/arc/include/uapi/asm/unistd.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | */ | ||
| 9 | |||
| 10 | /******** no-legacy-syscalls-ABI *******/ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * Non-typical guard macro to enable inclusion twice in ARCH sys.c | ||
| 14 | * That is how the Generic syscall wrapper generator works | ||
| 15 | */ | ||
| 16 | #if !defined(_UAPI_ASM_ARC_UNISTD_H) || defined(__SYSCALL) | ||
| 17 | #define _UAPI_ASM_ARC_UNISTD_H | ||
| 18 | |||
| 19 | #define __ARCH_WANT_RENAMEAT | ||
| 20 | #define __ARCH_WANT_STAT64 | ||
| 21 | #define __ARCH_WANT_SET_GET_RLIMIT | ||
| 22 | #define __ARCH_WANT_SYS_EXECVE | ||
| 23 | #define __ARCH_WANT_SYS_CLONE | ||
| 24 | #define __ARCH_WANT_SYS_VFORK | ||
| 25 | #define __ARCH_WANT_SYS_FORK | ||
| 26 | #define __ARCH_WANT_TIME32_SYSCALLS | ||
| 27 | |||
| 28 | #define sys_mmap2 sys_mmap_pgoff | ||
| 29 | |||
| 30 | #include <asm-generic/unistd.h> | ||
| 31 | |||
| 32 | #define NR_syscalls __NR_syscalls | ||
| 33 | |||
| 34 | /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */ | ||
| 35 | #define __NR_sysfs (__NR_arch_specific_syscall + 3) | ||
| 36 | |||
| 37 | /* ARC specific syscall */ | ||
| 38 | #define __NR_cacheflush (__NR_arch_specific_syscall + 0) | ||
| 39 | #define __NR_arc_settls (__NR_arch_specific_syscall + 1) | ||
| 40 | #define __NR_arc_gettls (__NR_arch_specific_syscall + 2) | ||
| 41 | #define __NR_arc_usr_cmpxchg (__NR_arch_specific_syscall + 4) | ||
| 42 | |||
| 43 | __SYSCALL(__NR_cacheflush, sys_cacheflush) | ||
| 44 | __SYSCALL(__NR_arc_settls, sys_arc_settls) | ||
| 45 | __SYSCALL(__NR_arc_gettls, sys_arc_gettls) | ||
| 46 | __SYSCALL(__NR_arc_usr_cmpxchg, sys_arc_usr_cmpxchg) | ||
| 47 | __SYSCALL(__NR_sysfs, sys_sysfs) | ||
| 48 | |||
| 49 | #undef __SYSCALL | ||
| 50 | |||
| 51 | #endif | ||
diff --git a/tools/arch/hexagon/include/uapi/asm/unistd.h b/tools/arch/hexagon/include/uapi/asm/unistd.h new file mode 100644 index 000000000000..432c4db1b623 --- /dev/null +++ b/tools/arch/hexagon/include/uapi/asm/unistd.h | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | /* | ||
| 3 | * Syscall support for Hexagon | ||
| 4 | * | ||
| 5 | * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 and | ||
| 9 | * only version 2 as published by the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 19 | * 02110-1301, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | /* | ||
| 23 | * The kernel pulls this unistd.h in three different ways: | ||
| 24 | * 1. the "normal" way which gets all the __NR defines | ||
| 25 | * 2. with __SYSCALL defined to produce function declarations | ||
| 26 | * 3. with __SYSCALL defined to produce syscall table initialization | ||
| 27 | * See also: syscalltab.c | ||
| 28 | */ | ||
| 29 | |||
| 30 | #define sys_mmap2 sys_mmap_pgoff | ||
| 31 | #define __ARCH_WANT_RENAMEAT | ||
| 32 | #define __ARCH_WANT_STAT64 | ||
| 33 | #define __ARCH_WANT_SET_GET_RLIMIT | ||
| 34 | #define __ARCH_WANT_SYS_EXECVE | ||
| 35 | #define __ARCH_WANT_SYS_CLONE | ||
| 36 | #define __ARCH_WANT_SYS_VFORK | ||
| 37 | #define __ARCH_WANT_SYS_FORK | ||
| 38 | #define __ARCH_WANT_TIME32_SYSCALLS | ||
| 39 | |||
| 40 | #include <asm-generic/unistd.h> | ||
diff --git a/tools/arch/riscv/include/uapi/asm/unistd.h b/tools/arch/riscv/include/uapi/asm/unistd.h new file mode 100644 index 000000000000..0e2eeeb1fd27 --- /dev/null +++ b/tools/arch/riscv/include/uapi/asm/unistd.h | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2018 David Abdurachmanov <david.abdurachmanov@gmail.com> | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifdef __LP64__ | ||
| 19 | #define __ARCH_WANT_NEW_STAT | ||
| 20 | #define __ARCH_WANT_SET_GET_RLIMIT | ||
| 21 | #endif /* __LP64__ */ | ||
| 22 | |||
| 23 | #include <asm-generic/unistd.h> | ||
| 24 | |||
| 25 | /* | ||
| 26 | * Allows the instruction cache to be flushed from userspace. Despite RISC-V | ||
| 27 | * having a direct 'fence.i' instruction available to userspace (which we | ||
| 28 | * can't trap!), that's not actually viable when running on Linux because the | ||
| 29 | * kernel might schedule a process on another hart. There is no way for | ||
| 30 | * userspace to handle this without invoking the kernel (as it doesn't know the | ||
| 31 | * thread->hart mappings), so we've defined a RISC-V specific system call to | ||
| 32 | * flush the instruction cache. | ||
| 33 | * | ||
| 34 | * __NR_riscv_flush_icache is defined to flush the instruction cache over an | ||
| 35 | * address range, with the flush applying to either all threads or just the | ||
| 36 | * caller. We don't currently do anything with the address range, that's just | ||
| 37 | * in there for forwards compatibility. | ||
| 38 | */ | ||
| 39 | #ifndef __NR_riscv_flush_icache | ||
| 40 | #define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15) | ||
| 41 | #endif | ||
| 42 | __SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache) | ||
diff --git a/tools/arch/x86/include/uapi/asm/vmx.h b/tools/arch/x86/include/uapi/asm/vmx.h index f0b0c90dd398..d213ec5c3766 100644 --- a/tools/arch/x86/include/uapi/asm/vmx.h +++ b/tools/arch/x86/include/uapi/asm/vmx.h | |||
| @@ -146,6 +146,7 @@ | |||
| 146 | 146 | ||
| 147 | #define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1 | 147 | #define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1 |
| 148 | #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2 | 148 | #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2 |
| 149 | #define VMX_ABORT_VMCS_CORRUPTED 3 | ||
| 149 | #define VMX_ABORT_LOAD_HOST_MSR_FAIL 4 | 150 | #define VMX_ABORT_LOAD_HOST_MSR_FAIL 4 |
| 150 | 151 | ||
| 151 | #endif /* _UAPIVMX_H */ | 152 | #endif /* _UAPIVMX_H */ |
diff --git a/tools/lib/traceevent/parse-utils.c b/tools/lib/traceevent/parse-utils.c index 77e4ec6402dd..e99867111387 100644 --- a/tools/lib/traceevent/parse-utils.c +++ b/tools/lib/traceevent/parse-utils.c | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | void __vwarning(const char *fmt, va_list ap) | 14 | void __vwarning(const char *fmt, va_list ap) |
| 15 | { | 15 | { |
| 16 | if (errno) | 16 | if (errno) |
| 17 | perror("trace-cmd"); | 17 | perror("libtraceevent"); |
| 18 | errno = 0; | 18 | errno = 0; |
| 19 | 19 | ||
| 20 | fprintf(stderr, " "); | 20 | fprintf(stderr, " "); |
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index fe3f97e342fa..6d65874e16c3 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
| @@ -227,7 +227,7 @@ FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS) | |||
| 227 | 227 | ||
| 228 | FEATURE_CHECK_LDFLAGS-libaio = -lrt | 228 | FEATURE_CHECK_LDFLAGS-libaio = -lrt |
| 229 | 229 | ||
| 230 | FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes | 230 | FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl |
| 231 | 231 | ||
| 232 | CFLAGS += -fno-omit-frame-pointer | 232 | CFLAGS += -fno-omit-frame-pointer |
| 233 | CFLAGS += -ggdb3 | 233 | CFLAGS += -ggdb3 |
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index 98ad783efc69..a7784554a80d 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c | |||
| @@ -39,6 +39,10 @@ | |||
| 39 | #include <numa.h> | 39 | #include <numa.h> |
| 40 | #include <numaif.h> | 40 | #include <numaif.h> |
| 41 | 41 | ||
| 42 | #ifndef RUSAGE_THREAD | ||
| 43 | # define RUSAGE_THREAD 1 | ||
| 44 | #endif | ||
| 45 | |||
| 42 | /* | 46 | /* |
| 43 | * Regular printout to the terminal, supressed if -q is specified: | 47 | * Regular printout to the terminal, supressed if -q is specified: |
| 44 | */ | 48 | */ |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index c8b01176c9e1..09762985c713 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
| @@ -1714,8 +1714,8 @@ static int symbol__disassemble_bpf(struct symbol *sym, | |||
| 1714 | if (dso->binary_type != DSO_BINARY_TYPE__BPF_PROG_INFO) | 1714 | if (dso->binary_type != DSO_BINARY_TYPE__BPF_PROG_INFO) |
| 1715 | return -1; | 1715 | return -1; |
| 1716 | 1716 | ||
| 1717 | pr_debug("%s: handling sym %s addr %lx len %lx\n", __func__, | 1717 | pr_debug("%s: handling sym %s addr %" PRIx64 " len %" PRIx64 "\n", __func__, |
| 1718 | sym->name, sym->start, sym->end - sym->start); | 1718 | sym->name, sym->start, sym->end - sym->start); |
| 1719 | 1719 | ||
| 1720 | memset(tpath, 0, sizeof(tpath)); | 1720 | memset(tpath, 0, sizeof(tpath)); |
| 1721 | perf_exe(tpath, sizeof(tpath)); | 1721 | perf_exe(tpath, sizeof(tpath)); |
| @@ -1740,7 +1740,7 @@ static int symbol__disassemble_bpf(struct symbol *sym, | |||
| 1740 | info_linear = info_node->info_linear; | 1740 | info_linear = info_node->info_linear; |
| 1741 | sub_id = dso->bpf_prog.sub_id; | 1741 | sub_id = dso->bpf_prog.sub_id; |
| 1742 | 1742 | ||
| 1743 | info.buffer = (void *)(info_linear->info.jited_prog_insns); | 1743 | info.buffer = (void *)(uintptr_t)(info_linear->info.jited_prog_insns); |
| 1744 | info.buffer_length = info_linear->info.jited_prog_len; | 1744 | info.buffer_length = info_linear->info.jited_prog_len; |
| 1745 | 1745 | ||
| 1746 | if (info_linear->info.nr_line_info) | 1746 | if (info_linear->info.nr_line_info) |
| @@ -1776,7 +1776,7 @@ static int symbol__disassemble_bpf(struct symbol *sym, | |||
| 1776 | const char *srcline; | 1776 | const char *srcline; |
| 1777 | u64 addr; | 1777 | u64 addr; |
| 1778 | 1778 | ||
| 1779 | addr = pc + ((u64 *)(info_linear->info.jited_ksyms))[sub_id]; | 1779 | addr = pc + ((u64 *)(uintptr_t)(info_linear->info.jited_ksyms))[sub_id]; |
| 1780 | count = disassemble(pc, &info); | 1780 | count = disassemble(pc, &info); |
| 1781 | 1781 | ||
| 1782 | if (prog_linfo) | 1782 | if (prog_linfo) |
diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c index ca0fff6272be..06f48312c5ed 100644 --- a/tools/perf/util/cloexec.c +++ b/tools/perf/util/cloexec.c | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include "asm/bug.h" | 7 | #include "asm/bug.h" |
| 8 | #include "debug.h" | 8 | #include "debug.h" |
| 9 | #include <unistd.h> | 9 | #include <unistd.h> |
| 10 | #include <asm/unistd.h> | ||
| 11 | #include <sys/syscall.h> | 10 | #include <sys/syscall.h> |
| 12 | 11 | ||
| 13 | static unsigned long flag = PERF_FLAG_FD_CLOEXEC; | 12 | static unsigned long flag = PERF_FLAG_FD_CLOEXEC; |
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 110804936fc3..de488b43f440 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c | |||
| @@ -422,11 +422,9 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm) | |||
| 422 | if (!etmq->packet) | 422 | if (!etmq->packet) |
| 423 | goto out_free; | 423 | goto out_free; |
| 424 | 424 | ||
| 425 | if (etm->synth_opts.last_branch || etm->sample_branches) { | 425 | etmq->prev_packet = zalloc(szp); |
| 426 | etmq->prev_packet = zalloc(szp); | 426 | if (!etmq->prev_packet) |
| 427 | if (!etmq->prev_packet) | 427 | goto out_free; |
| 428 | goto out_free; | ||
| 429 | } | ||
| 430 | 428 | ||
| 431 | if (etm->synth_opts.last_branch) { | 429 | if (etm->synth_opts.last_branch) { |
| 432 | size_t sz = sizeof(struct branch_stack); | 430 | size_t sz = sizeof(struct branch_stack); |
| @@ -981,7 +979,6 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) | |||
| 981 | * PREV_PACKET is a branch. | 979 | * PREV_PACKET is a branch. |
| 982 | */ | 980 | */ |
| 983 | if (etm->synth_opts.last_branch && | 981 | if (etm->synth_opts.last_branch && |
| 984 | etmq->prev_packet && | ||
| 985 | etmq->prev_packet->sample_type == CS_ETM_RANGE && | 982 | etmq->prev_packet->sample_type == CS_ETM_RANGE && |
| 986 | etmq->prev_packet->last_instr_taken_branch) | 983 | etmq->prev_packet->last_instr_taken_branch) |
| 987 | cs_etm__update_last_branch_rb(etmq); | 984 | cs_etm__update_last_branch_rb(etmq); |
| @@ -1014,7 +1011,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) | |||
| 1014 | etmq->period_instructions = instrs_over; | 1011 | etmq->period_instructions = instrs_over; |
| 1015 | } | 1012 | } |
| 1016 | 1013 | ||
| 1017 | if (etm->sample_branches && etmq->prev_packet) { | 1014 | if (etm->sample_branches) { |
| 1018 | bool generate_sample = false; | 1015 | bool generate_sample = false; |
| 1019 | 1016 | ||
| 1020 | /* Generate sample for tracing on packet */ | 1017 | /* Generate sample for tracing on packet */ |
| @@ -1071,9 +1068,6 @@ static int cs_etm__flush(struct cs_etm_queue *etmq) | |||
| 1071 | struct cs_etm_auxtrace *etm = etmq->etm; | 1068 | struct cs_etm_auxtrace *etm = etmq->etm; |
| 1072 | struct cs_etm_packet *tmp; | 1069 | struct cs_etm_packet *tmp; |
| 1073 | 1070 | ||
| 1074 | if (!etmq->prev_packet) | ||
| 1075 | return 0; | ||
| 1076 | |||
| 1077 | /* Handle start tracing packet */ | 1071 | /* Handle start tracing packet */ |
| 1078 | if (etmq->prev_packet->sample_type == CS_ETM_EMPTY) | 1072 | if (etmq->prev_packet->sample_type == CS_ETM_EMPTY) |
| 1079 | goto swap_packet; | 1073 | goto swap_packet; |
diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index 9494f9dc61ec..6a3eaf7d9353 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c | |||
| @@ -115,8 +115,8 @@ struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id) | |||
| 115 | } | 115 | } |
| 116 | node = NULL; | 116 | node = NULL; |
| 117 | 117 | ||
| 118 | up_read(&env->bpf_progs.lock); | ||
| 119 | out: | 118 | out: |
| 119 | up_read(&env->bpf_progs.lock); | ||
| 120 | return node; | 120 | return node; |
| 121 | } | 121 | } |
| 122 | 122 | ||
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index b17f1c9bc965..bad5f87ae001 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
| @@ -1928,12 +1928,14 @@ more: | |||
| 1928 | 1928 | ||
| 1929 | size = event->header.size; | 1929 | size = event->header.size; |
| 1930 | 1930 | ||
| 1931 | skip = -EINVAL; | ||
| 1932 | |||
| 1931 | if (size < sizeof(struct perf_event_header) || | 1933 | if (size < sizeof(struct perf_event_header) || |
| 1932 | (skip = rd->process(session, event, file_pos)) < 0) { | 1934 | (skip = rd->process(session, event, file_pos)) < 0) { |
| 1933 | pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n", | 1935 | pr_err("%#" PRIx64 " [%#x]: failed to process type: %d [%s]\n", |
| 1934 | file_offset + head, event->header.size, | 1936 | file_offset + head, event->header.size, |
| 1935 | event->header.type); | 1937 | event->header.type, strerror(-skip)); |
| 1936 | err = -EINVAL; | 1938 | err = skip; |
| 1937 | goto out; | 1939 | goto out; |
| 1938 | } | 1940 | } |
| 1939 | 1941 | ||
