mirror of https://gitee.com/openkylin/linux.git
perf/urgent fixes:
tools UAPI: Arnaldo Carvalho de Melo: - Sync x86's vmx.h with the kernel. - Copy missing unistd.h headers for arc, hexagon and riscv, fixing a reported build regression on the ARC 32-bit architecture. perf bench numa: Arnaldo Carvalho de Melo: - Add define for RUSAGE_THREAD if not present, fixing the build on the ARC architecture when only zlib and libnuma are present. perf BPF: Arnaldo Carvalho de Melo: - The disassembler-four-args feature test needs -ldl on distros such as Mageia 7. Bo YU: - Fix unlocking on success in perf_env__find_btf(), detected with the coverity tool. libtraceevent: Leo Yan: - Change misleading hard coded 'trace-cmd' string in error messages. ARM hardware tracing: Leo Yan: - Always allocate memory for cs_etm_queue::prev_packet, fixing a segfault when processing CoreSight perf data. perf annotate: Thadeu Lima de Souza Cascardo: - Fix build on 32 bit for BPF. perf report: Thomas Richter: - Report OOM in status line in the GTK UI. core libs: - Remove needless asm/unistd.h that, used with sys/syscall.h ended up redefining the syscalls defines in environments such as the ARC arch when using uClibc. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCXMuF3QAKCRCyPKLppCJ+ J4IRAP4sNWq2Y0pJE1yJlNt/e5Ia8o7v+RYSD1VAxY++sErrcwEAva84+DMvTBdj FGHqhvhWrfV/L3h3AU/QOMfRwphcOwg= =aIaf -----END PGP SIGNATURE----- Merge tag 'perf-urgent-for-mingo-5.1-20190502' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent Pull perf/urgent fixes from Arnaldo Carvalho de Melo: tools UAPI: Arnaldo Carvalho de Melo: - Sync x86's vmx.h with the kernel. - Copy missing unistd.h headers for arc, hexagon and riscv, fixing a reported build regression on the ARC 32-bit architecture. perf bench numa: Arnaldo Carvalho de Melo: - Add define for RUSAGE_THREAD if not present, fixing the build on the ARC architecture when only zlib and libnuma are present. perf BPF: Arnaldo Carvalho de Melo: - The disassembler-four-args feature test needs -ldl on distros such as Mageia 7. Bo YU: - Fix unlocking on success in perf_env__find_btf(), detected with the coverity tool. libtraceevent: Leo Yan: - Change misleading hard coded 'trace-cmd' string in error messages. ARM hardware tracing: Leo Yan: - Always allocate memory for cs_etm_queue::prev_packet, fixing a segfault when processing CoreSight perf data. perf annotate: Thadeu Lima de Souza Cascardo: - Fix build on 32 bit for BPF. perf report: Thomas Richter: - Report OOM in status line in the GTK UI. core libs: - Remove needless asm/unistd.h that, used with sys/syscall.h ended up redefining the syscalls defines in environments such as the ARC arch when using uClibc. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
221856b16e
|
@ -0,0 +1,51 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******** no-legacy-syscalls-ABI *******/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Non-typical guard macro to enable inclusion twice in ARCH sys.c
|
||||||
|
* That is how the Generic syscall wrapper generator works
|
||||||
|
*/
|
||||||
|
#if !defined(_UAPI_ASM_ARC_UNISTD_H) || defined(__SYSCALL)
|
||||||
|
#define _UAPI_ASM_ARC_UNISTD_H
|
||||||
|
|
||||||
|
#define __ARCH_WANT_RENAMEAT
|
||||||
|
#define __ARCH_WANT_STAT64
|
||||||
|
#define __ARCH_WANT_SET_GET_RLIMIT
|
||||||
|
#define __ARCH_WANT_SYS_EXECVE
|
||||||
|
#define __ARCH_WANT_SYS_CLONE
|
||||||
|
#define __ARCH_WANT_SYS_VFORK
|
||||||
|
#define __ARCH_WANT_SYS_FORK
|
||||||
|
#define __ARCH_WANT_TIME32_SYSCALLS
|
||||||
|
|
||||||
|
#define sys_mmap2 sys_mmap_pgoff
|
||||||
|
|
||||||
|
#include <asm-generic/unistd.h>
|
||||||
|
|
||||||
|
#define NR_syscalls __NR_syscalls
|
||||||
|
|
||||||
|
/* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
|
||||||
|
#define __NR_sysfs (__NR_arch_specific_syscall + 3)
|
||||||
|
|
||||||
|
/* ARC specific syscall */
|
||||||
|
#define __NR_cacheflush (__NR_arch_specific_syscall + 0)
|
||||||
|
#define __NR_arc_settls (__NR_arch_specific_syscall + 1)
|
||||||
|
#define __NR_arc_gettls (__NR_arch_specific_syscall + 2)
|
||||||
|
#define __NR_arc_usr_cmpxchg (__NR_arch_specific_syscall + 4)
|
||||||
|
|
||||||
|
__SYSCALL(__NR_cacheflush, sys_cacheflush)
|
||||||
|
__SYSCALL(__NR_arc_settls, sys_arc_settls)
|
||||||
|
__SYSCALL(__NR_arc_gettls, sys_arc_gettls)
|
||||||
|
__SYSCALL(__NR_arc_usr_cmpxchg, sys_arc_usr_cmpxchg)
|
||||||
|
__SYSCALL(__NR_sysfs, sys_sysfs)
|
||||||
|
|
||||||
|
#undef __SYSCALL
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,40 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||||
|
/*
|
||||||
|
* Syscall support for Hexagon
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
* only version 2 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The kernel pulls this unistd.h in three different ways:
|
||||||
|
* 1. the "normal" way which gets all the __NR defines
|
||||||
|
* 2. with __SYSCALL defined to produce function declarations
|
||||||
|
* 3. with __SYSCALL defined to produce syscall table initialization
|
||||||
|
* See also: syscalltab.c
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define sys_mmap2 sys_mmap_pgoff
|
||||||
|
#define __ARCH_WANT_RENAMEAT
|
||||||
|
#define __ARCH_WANT_STAT64
|
||||||
|
#define __ARCH_WANT_SET_GET_RLIMIT
|
||||||
|
#define __ARCH_WANT_SYS_EXECVE
|
||||||
|
#define __ARCH_WANT_SYS_CLONE
|
||||||
|
#define __ARCH_WANT_SYS_VFORK
|
||||||
|
#define __ARCH_WANT_SYS_FORK
|
||||||
|
#define __ARCH_WANT_TIME32_SYSCALLS
|
||||||
|
|
||||||
|
#include <asm-generic/unistd.h>
|
|
@ -0,0 +1,42 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 David Abdurachmanov <david.abdurachmanov@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __LP64__
|
||||||
|
#define __ARCH_WANT_NEW_STAT
|
||||||
|
#define __ARCH_WANT_SET_GET_RLIMIT
|
||||||
|
#endif /* __LP64__ */
|
||||||
|
|
||||||
|
#include <asm-generic/unistd.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Allows the instruction cache to be flushed from userspace. Despite RISC-V
|
||||||
|
* having a direct 'fence.i' instruction available to userspace (which we
|
||||||
|
* can't trap!), that's not actually viable when running on Linux because the
|
||||||
|
* kernel might schedule a process on another hart. There is no way for
|
||||||
|
* userspace to handle this without invoking the kernel (as it doesn't know the
|
||||||
|
* thread->hart mappings), so we've defined a RISC-V specific system call to
|
||||||
|
* flush the instruction cache.
|
||||||
|
*
|
||||||
|
* __NR_riscv_flush_icache is defined to flush the instruction cache over an
|
||||||
|
* address range, with the flush applying to either all threads or just the
|
||||||
|
* caller. We don't currently do anything with the address range, that's just
|
||||||
|
* in there for forwards compatibility.
|
||||||
|
*/
|
||||||
|
#ifndef __NR_riscv_flush_icache
|
||||||
|
#define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15)
|
||||||
|
#endif
|
||||||
|
__SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache)
|
|
@ -146,6 +146,7 @@
|
||||||
|
|
||||||
#define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1
|
#define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1
|
||||||
#define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2
|
#define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2
|
||||||
|
#define VMX_ABORT_VMCS_CORRUPTED 3
|
||||||
#define VMX_ABORT_LOAD_HOST_MSR_FAIL 4
|
#define VMX_ABORT_LOAD_HOST_MSR_FAIL 4
|
||||||
|
|
||||||
#endif /* _UAPIVMX_H */
|
#endif /* _UAPIVMX_H */
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
void __vwarning(const char *fmt, va_list ap)
|
void __vwarning(const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
if (errno)
|
if (errno)
|
||||||
perror("trace-cmd");
|
perror("libtraceevent");
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
fprintf(stderr, " ");
|
fprintf(stderr, " ");
|
||||||
|
|
|
@ -227,7 +227,7 @@ FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
|
||||||
|
|
||||||
FEATURE_CHECK_LDFLAGS-libaio = -lrt
|
FEATURE_CHECK_LDFLAGS-libaio = -lrt
|
||||||
|
|
||||||
FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes
|
FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl
|
||||||
|
|
||||||
CFLAGS += -fno-omit-frame-pointer
|
CFLAGS += -fno-omit-frame-pointer
|
||||||
CFLAGS += -ggdb3
|
CFLAGS += -ggdb3
|
||||||
|
|
|
@ -39,6 +39,10 @@
|
||||||
#include <numa.h>
|
#include <numa.h>
|
||||||
#include <numaif.h>
|
#include <numaif.h>
|
||||||
|
|
||||||
|
#ifndef RUSAGE_THREAD
|
||||||
|
# define RUSAGE_THREAD 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Regular printout to the terminal, supressed if -q is specified:
|
* Regular printout to the terminal, supressed if -q is specified:
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1714,7 +1714,7 @@ static int symbol__disassemble_bpf(struct symbol *sym,
|
||||||
if (dso->binary_type != DSO_BINARY_TYPE__BPF_PROG_INFO)
|
if (dso->binary_type != DSO_BINARY_TYPE__BPF_PROG_INFO)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
pr_debug("%s: handling sym %s addr %lx len %lx\n", __func__,
|
pr_debug("%s: handling sym %s addr %" PRIx64 " len %" PRIx64 "\n", __func__,
|
||||||
sym->name, sym->start, sym->end - sym->start);
|
sym->name, sym->start, sym->end - sym->start);
|
||||||
|
|
||||||
memset(tpath, 0, sizeof(tpath));
|
memset(tpath, 0, sizeof(tpath));
|
||||||
|
@ -1740,7 +1740,7 @@ static int symbol__disassemble_bpf(struct symbol *sym,
|
||||||
info_linear = info_node->info_linear;
|
info_linear = info_node->info_linear;
|
||||||
sub_id = dso->bpf_prog.sub_id;
|
sub_id = dso->bpf_prog.sub_id;
|
||||||
|
|
||||||
info.buffer = (void *)(info_linear->info.jited_prog_insns);
|
info.buffer = (void *)(uintptr_t)(info_linear->info.jited_prog_insns);
|
||||||
info.buffer_length = info_linear->info.jited_prog_len;
|
info.buffer_length = info_linear->info.jited_prog_len;
|
||||||
|
|
||||||
if (info_linear->info.nr_line_info)
|
if (info_linear->info.nr_line_info)
|
||||||
|
@ -1776,7 +1776,7 @@ static int symbol__disassemble_bpf(struct symbol *sym,
|
||||||
const char *srcline;
|
const char *srcline;
|
||||||
u64 addr;
|
u64 addr;
|
||||||
|
|
||||||
addr = pc + ((u64 *)(info_linear->info.jited_ksyms))[sub_id];
|
addr = pc + ((u64 *)(uintptr_t)(info_linear->info.jited_ksyms))[sub_id];
|
||||||
count = disassemble(pc, &info);
|
count = disassemble(pc, &info);
|
||||||
|
|
||||||
if (prog_linfo)
|
if (prog_linfo)
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "asm/bug.h"
|
#include "asm/bug.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <asm/unistd.h>
|
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
static unsigned long flag = PERF_FLAG_FD_CLOEXEC;
|
static unsigned long flag = PERF_FLAG_FD_CLOEXEC;
|
||||||
|
|
|
@ -422,11 +422,9 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm)
|
||||||
if (!etmq->packet)
|
if (!etmq->packet)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
||||||
if (etm->synth_opts.last_branch || etm->sample_branches) {
|
|
||||||
etmq->prev_packet = zalloc(szp);
|
etmq->prev_packet = zalloc(szp);
|
||||||
if (!etmq->prev_packet)
|
if (!etmq->prev_packet)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
|
||||||
|
|
||||||
if (etm->synth_opts.last_branch) {
|
if (etm->synth_opts.last_branch) {
|
||||||
size_t sz = sizeof(struct branch_stack);
|
size_t sz = sizeof(struct branch_stack);
|
||||||
|
@ -981,7 +979,6 @@ static int cs_etm__sample(struct cs_etm_queue *etmq)
|
||||||
* PREV_PACKET is a branch.
|
* PREV_PACKET is a branch.
|
||||||
*/
|
*/
|
||||||
if (etm->synth_opts.last_branch &&
|
if (etm->synth_opts.last_branch &&
|
||||||
etmq->prev_packet &&
|
|
||||||
etmq->prev_packet->sample_type == CS_ETM_RANGE &&
|
etmq->prev_packet->sample_type == CS_ETM_RANGE &&
|
||||||
etmq->prev_packet->last_instr_taken_branch)
|
etmq->prev_packet->last_instr_taken_branch)
|
||||||
cs_etm__update_last_branch_rb(etmq);
|
cs_etm__update_last_branch_rb(etmq);
|
||||||
|
@ -1014,7 +1011,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq)
|
||||||
etmq->period_instructions = instrs_over;
|
etmq->period_instructions = instrs_over;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (etm->sample_branches && etmq->prev_packet) {
|
if (etm->sample_branches) {
|
||||||
bool generate_sample = false;
|
bool generate_sample = false;
|
||||||
|
|
||||||
/* Generate sample for tracing on packet */
|
/* Generate sample for tracing on packet */
|
||||||
|
@ -1071,9 +1068,6 @@ static int cs_etm__flush(struct cs_etm_queue *etmq)
|
||||||
struct cs_etm_auxtrace *etm = etmq->etm;
|
struct cs_etm_auxtrace *etm = etmq->etm;
|
||||||
struct cs_etm_packet *tmp;
|
struct cs_etm_packet *tmp;
|
||||||
|
|
||||||
if (!etmq->prev_packet)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Handle start tracing packet */
|
/* Handle start tracing packet */
|
||||||
if (etmq->prev_packet->sample_type == CS_ETM_EMPTY)
|
if (etmq->prev_packet->sample_type == CS_ETM_EMPTY)
|
||||||
goto swap_packet;
|
goto swap_packet;
|
||||||
|
|
|
@ -115,8 +115,8 @@ struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id)
|
||||||
}
|
}
|
||||||
node = NULL;
|
node = NULL;
|
||||||
|
|
||||||
up_read(&env->bpf_progs.lock);
|
|
||||||
out:
|
out:
|
||||||
|
up_read(&env->bpf_progs.lock);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1928,12 +1928,14 @@ reader__process_events(struct reader *rd, struct perf_session *session,
|
||||||
|
|
||||||
size = event->header.size;
|
size = event->header.size;
|
||||||
|
|
||||||
|
skip = -EINVAL;
|
||||||
|
|
||||||
if (size < sizeof(struct perf_event_header) ||
|
if (size < sizeof(struct perf_event_header) ||
|
||||||
(skip = rd->process(session, event, file_pos)) < 0) {
|
(skip = rd->process(session, event, file_pos)) < 0) {
|
||||||
pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
|
pr_err("%#" PRIx64 " [%#x]: failed to process type: %d [%s]\n",
|
||||||
file_offset + head, event->header.size,
|
file_offset + head, event->header.size,
|
||||||
event->header.type);
|
event->header.type, strerror(-skip));
|
||||||
err = -EINVAL;
|
err = skip;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue