Commit 1b2f76d7 authored by Ingo Molnar's avatar Ingo Molnar

Merge tag 'perf-core-for-mingo-4.14-20170829' of...

Merge tag 'perf-core-for-mingo-4.14-20170829' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

 - Fix remote HITM detection for Skylake in 'perf c2c' (Jiri Olsa)

 - Fixes for the handling of PERF_RECORD_READ records (Jiri Olsa)

 - Fix kprobes blackist symbol lookup in 'perf probe' (Li Bin)

 - The PLT header and entry sizes are not the same in !x86, fix it for ARM and
   AARCH64 (Li Bin)

 - Beautify pkey_{alloc,free,mprotect} arguments in 'perf trace' (Arnaldo Carvalho de Melo)

 - Fix CC, AR, LD external definition, allow flex and bison to be
   externally defined and other related Makefile fixes (David Carrillo-Cisneros)

 - Sync CPU features kernel ABI headers with tooling headers (Arnaldo Carvalho de Melo)

 - Fix path to PMU formats in 'perf stat' documentation (Jack Henschel)

 - Fix static build with newer toolchains (Jiri Olsa)
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 5da382eb b2f76050
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
#define X86_FEATURE_PERFCTR_NB ( 6*32+24) /* NB performance counter extensions */ #define X86_FEATURE_PERFCTR_NB ( 6*32+24) /* NB performance counter extensions */
#define X86_FEATURE_BPEXT (6*32+26) /* data breakpoint extension */ #define X86_FEATURE_BPEXT (6*32+26) /* data breakpoint extension */
#define X86_FEATURE_PTSC ( 6*32+27) /* performance time-stamp counter */ #define X86_FEATURE_PTSC ( 6*32+27) /* performance time-stamp counter */
#define X86_FEATURE_PERFCTR_L2 ( 6*32+28) /* L2 performance counter extensions */ #define X86_FEATURE_PERFCTR_LLC ( 6*32+28) /* Last Level Cache performance counter extensions */
#define X86_FEATURE_MWAITX ( 6*32+29) /* MWAIT extension (MONITORX/MWAITX) */ #define X86_FEATURE_MWAITX ( 6*32+29) /* MWAIT extension (MONITORX/MWAITX) */
/* /*
...@@ -196,7 +196,6 @@ ...@@ -196,7 +196,6 @@
#define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */ #define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */
#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */
#define X86_FEATURE_SME ( 7*32+10) /* AMD Secure Memory Encryption */
#define X86_FEATURE_INTEL_PPIN ( 7*32+14) /* Intel Processor Inventory Number */ #define X86_FEATURE_INTEL_PPIN ( 7*32+14) /* Intel Processor Inventory Number */
#define X86_FEATURE_INTEL_PT ( 7*32+15) /* Intel Processor Trace */ #define X86_FEATURE_INTEL_PT ( 7*32+15) /* Intel Processor Trace */
...@@ -287,7 +286,7 @@ ...@@ -287,7 +286,7 @@
#define X86_FEATURE_PAUSEFILTER (15*32+10) /* filtered pause intercept */ #define X86_FEATURE_PAUSEFILTER (15*32+10) /* filtered pause intercept */
#define X86_FEATURE_PFTHRESHOLD (15*32+12) /* pause filter threshold */ #define X86_FEATURE_PFTHRESHOLD (15*32+12) /* pause filter threshold */
#define X86_FEATURE_AVIC (15*32+13) /* Virtual Interrupt Controller */ #define X86_FEATURE_AVIC (15*32+13) /* Virtual Interrupt Controller */
#define X86_FEATURE_VIRTUAL_VMLOAD_VMSAVE (15*32+15) /* Virtual VMLOAD VMSAVE */ #define X86_FEATURE_V_VMSAVE_VMLOAD (15*32+15) /* Virtual VMSAVE VMLOAD */
/* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */
#define X86_FEATURE_AVX512VBMI (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/ #define X86_FEATURE_AVX512VBMI (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/
......
...@@ -21,13 +21,11 @@ ...@@ -21,13 +21,11 @@
# define DISABLE_K6_MTRR (1<<(X86_FEATURE_K6_MTRR & 31)) # define DISABLE_K6_MTRR (1<<(X86_FEATURE_K6_MTRR & 31))
# define DISABLE_CYRIX_ARR (1<<(X86_FEATURE_CYRIX_ARR & 31)) # define DISABLE_CYRIX_ARR (1<<(X86_FEATURE_CYRIX_ARR & 31))
# define DISABLE_CENTAUR_MCR (1<<(X86_FEATURE_CENTAUR_MCR & 31)) # define DISABLE_CENTAUR_MCR (1<<(X86_FEATURE_CENTAUR_MCR & 31))
# define DISABLE_PCID 0
#else #else
# define DISABLE_VME 0 # define DISABLE_VME 0
# define DISABLE_K6_MTRR 0 # define DISABLE_K6_MTRR 0
# define DISABLE_CYRIX_ARR 0 # define DISABLE_CYRIX_ARR 0
# define DISABLE_CENTAUR_MCR 0 # define DISABLE_CENTAUR_MCR 0
# define DISABLE_PCID (1<<(X86_FEATURE_PCID & 31))
#endif /* CONFIG_X86_64 */ #endif /* CONFIG_X86_64 */
#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
...@@ -51,7 +49,7 @@ ...@@ -51,7 +49,7 @@
#define DISABLED_MASK1 0 #define DISABLED_MASK1 0
#define DISABLED_MASK2 0 #define DISABLED_MASK2 0
#define DISABLED_MASK3 (DISABLE_CYRIX_ARR|DISABLE_CENTAUR_MCR|DISABLE_K6_MTRR) #define DISABLED_MASK3 (DISABLE_CYRIX_ARR|DISABLE_CENTAUR_MCR|DISABLE_K6_MTRR)
#define DISABLED_MASK4 (DISABLE_PCID) #define DISABLED_MASK4 0
#define DISABLED_MASK5 0 #define DISABLED_MASK5 0
#define DISABLED_MASK6 0 #define DISABLED_MASK6 0
#define DISABLED_MASK7 0 #define DISABLED_MASK7 0
......
...@@ -8,7 +8,7 @@ ex: ...@@ -8,7 +8,7 @@ ex:
include $(srctree)/tools/build/Makefile.include include $(srctree)/tools/build/Makefile.include
ex: ex-in.o libex-in.o ex: ex-in.o libex-in.o
gcc -o $@ $^ $(CC) -o $@ $^
ex.%: fixdep FORCE ex.%: fixdep FORCE
make -f $(srctree)/tools/build/Makefile.build dir=. $@ make -f $(srctree)/tools/build/Makefile.build dir=. $@
......
...@@ -8,9 +8,9 @@ srctree := $(patsubst %/,%,$(dir $(srctree))) ...@@ -8,9 +8,9 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
#$(info Determined 'srctree' to be $(srctree)) #$(info Determined 'srctree' to be $(srctree))
endif endif
CC = $(CROSS_COMPILE)gcc CC ?= $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar AR ?= $(CROSS_COMPILE)ar
LD = $(CROSS_COMPILE)ld LD ?= $(CROSS_COMPILE)ld
MAKEFLAGS += --no-print-directory MAKEFLAGS += --no-print-directory
...@@ -19,7 +19,7 @@ LIBFILE = $(OUTPUT)libapi.a ...@@ -19,7 +19,7 @@ LIBFILE = $(OUTPUT)libapi.a
CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
ifeq ($(CC), clang) ifeq ($(CC_NO_CLANG), 0)
CFLAGS += -O3 CFLAGS += -O3
else else
CFLAGS += -O6 CFLAGS += -O6
......
...@@ -21,7 +21,7 @@ LIBFILE = $(OUTPUT)libsubcmd.a ...@@ -21,7 +21,7 @@ LIBFILE = $(OUTPUT)libsubcmd.a
CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
ifeq ($(CC), clang) ifeq ($(CC_NO_CLANG), 0)
CFLAGS += -O3 CFLAGS += -O3
else else
CFLAGS += -O6 CFLAGS += -O6
......
...@@ -41,13 +41,13 @@ report:: ...@@ -41,13 +41,13 @@ report::
- a symbolically formed event like 'pmu/param1=0x3,param2/' where - a symbolically formed event like 'pmu/param1=0x3,param2/' where
param1 and param2 are defined as formats for the PMU in param1 and param2 are defined as formats for the PMU in
/sys/bus/event_sources/devices/<pmu>/format/* /sys/bus/event_source/devices/<pmu>/format/*
- a symbolically formed event like 'pmu/config=M,config1=N,config2=K/' - a symbolically formed event like 'pmu/config=M,config1=N,config2=K/'
where M, N, K are numbers (in decimal, hex, octal format). where M, N, K are numbers (in decimal, hex, octal format).
Acceptable values for each of 'config', 'config1' and 'config2' Acceptable values for each of 'config', 'config1' and 'config2'
parameters are defined by corresponding entries in parameters are defined by corresponding entries in
/sys/bus/event_sources/devices/<pmu>/format/* /sys/bus/event_source/devices/<pmu>/format/*
-i:: -i::
--no-inherit:: --no-inherit::
......
...@@ -148,7 +148,7 @@ ifndef DEBUG ...@@ -148,7 +148,7 @@ ifndef DEBUG
endif endif
ifeq ($(DEBUG),0) ifeq ($(DEBUG),0)
ifeq ($(CC), clang) ifeq ($(CC_NO_CLANG), 0)
CFLAGS += -O3 CFLAGS += -O3
else else
CFLAGS += -O6 CFLAGS += -O6
...@@ -184,7 +184,7 @@ ifdef PYTHON_CONFIG ...@@ -184,7 +184,7 @@ ifdef PYTHON_CONFIG
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
ifeq ($(CC), clang) ifeq ($(CC_NO_CLANG), 1)
PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
endif endif
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
......
...@@ -164,8 +164,8 @@ LN = ln -f ...@@ -164,8 +164,8 @@ LN = ln -f
MKDIR = mkdir MKDIR = mkdir
FIND = find FIND = find
INSTALL = install INSTALL = install
FLEX = flex FLEX ?= flex
BISON = bison BISON ?= bison
STRIP = strip STRIP = strip
AWK = awk AWK = awk
...@@ -240,7 +240,7 @@ endif ...@@ -240,7 +240,7 @@ endif
ifeq ($(FEATURES_DUMP),) ifeq ($(FEATURES_DUMP),)
FEATURE_DUMP_EXPORT := $(realpath $(OUTPUT)FEATURE-DUMP) FEATURE_DUMP_EXPORT := $(realpath $(OUTPUT)FEATURE-DUMP)
else else
FEATURE_DUMP_EXPORT := $(FEATURES_DUMP) FEATURE_DUMP_EXPORT := $(realpath $(FEATURES_DUMP))
endif endif
export prefix bindir sharedir sysconfdir DESTDIR export prefix bindir sharedir sysconfdir DESTDIR
...@@ -279,7 +279,13 @@ LIBTRACEEVENT = $(TE_PATH)libtraceevent.a ...@@ -279,7 +279,13 @@ LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
export LIBTRACEEVENT export LIBTRACEEVENT
LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list
LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)
#
# The static build has no dynsym table, so this does not work for
# static build. Looks like linker starts to scream about that now
# (in Fedora 26) so we need to switch it off for static build.
DYNAMIC_LIST_LDFLAGS = -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)
LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = $(if $(findstring -static,$(LDFLAGS)),,$(DYNAMIC_LIST_LDFLAGS))
LIBAPI = $(API_PATH)libapi.a LIBAPI = $(API_PATH)libapi.a
export LIBAPI export LIBAPI
...@@ -381,7 +387,8 @@ export INSTALL SHELL_PATH ...@@ -381,7 +387,8 @@ export INSTALL SHELL_PATH
SHELL = $(SHELL_PATH) SHELL = $(SHELL_PATH)
beauty_ioctl_outdir := $(OUTPUT)trace/beauty/generated/ioctl beauty_outdir := $(OUTPUT)trace/beauty/generated
beauty_ioctl_outdir := $(beauty_outdir)/ioctl
drm_ioctl_array := $(beauty_ioctl_outdir)/drm_ioctl_array.c drm_ioctl_array := $(beauty_ioctl_outdir)/drm_ioctl_array.c
drm_hdr_dir := $(srctree)/tools/include/uapi/drm drm_hdr_dir := $(srctree)/tools/include/uapi/drm
drm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/drm_ioctl.sh drm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/drm_ioctl.sh
...@@ -392,6 +399,13 @@ _dummy := $(shell [ -d '$(beauty_ioctl_outdir)' ] || mkdir -p '$(beauty_ioctl_ou ...@@ -392,6 +399,13 @@ _dummy := $(shell [ -d '$(beauty_ioctl_outdir)' ] || mkdir -p '$(beauty_ioctl_ou
$(drm_ioctl_array): $(drm_hdr_dir)/drm.h $(drm_hdr_dir)/i915_drm.h $(drm_ioctl_tbl) $(drm_ioctl_array): $(drm_hdr_dir)/drm.h $(drm_hdr_dir)/i915_drm.h $(drm_ioctl_tbl)
$(Q)$(SHELL) '$(drm_ioctl_tbl)' $(drm_hdr_dir) > $@ $(Q)$(SHELL) '$(drm_ioctl_tbl)' $(drm_hdr_dir) > $@
pkey_alloc_access_rights_array := $(beauty_outdir)/pkey_alloc_access_rights_array.c
asm_generic_hdr_dir := $(srctree)/tools/include/uapi/asm-generic/
pkey_alloc_access_rights_tbl := $(srctree)/tools/perf/trace/beauty/pkey_alloc_access_rights.sh
$(pkey_alloc_access_rights_array): $(asm_generic_hdr_dir)/mman-common.h $(pkey_alloc_access_rights_tbl)
$(Q)$(SHELL) '$(pkey_alloc_access_rights_tbl)' $(asm_generic_hdr_dir) > $@
sndrv_ctl_ioctl_array := $(beauty_ioctl_outdir)/sndrv_ctl_ioctl_array.c sndrv_ctl_ioctl_array := $(beauty_ioctl_outdir)/sndrv_ctl_ioctl_array.c
sndrv_ctl_hdr_dir := $(srctree)/tools/include/uapi/sound sndrv_ctl_hdr_dir := $(srctree)/tools/include/uapi/sound
sndrv_ctl_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/sndrv_ctl_ioctl.sh sndrv_ctl_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/sndrv_ctl_ioctl.sh
...@@ -522,6 +536,7 @@ __build-dir = $(subst $(OUTPUT),,$(dir $@)) ...@@ -522,6 +536,7 @@ __build-dir = $(subst $(OUTPUT),,$(dir $@))
build-dir = $(if $(__build-dir),$(__build-dir),.) build-dir = $(if $(__build-dir),$(__build-dir),.)
prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioctl_array) \ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioctl_array) \
$(pkey_alloc_access_rights_array) \
$(sndrv_pcm_ioctl_array) \ $(sndrv_pcm_ioctl_array) \
$(sndrv_ctl_ioctl_array) \ $(sndrv_ctl_ioctl_array) \
$(kvm_ioctl_array) \ $(kvm_ioctl_array) \
...@@ -797,6 +812,7 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea ...@@ -797,6 +812,7 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
$(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \ $(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \
$(OUTPUT)pmu-events/pmu-events.c \ $(OUTPUT)pmu-events/pmu-events.c \
$(OUTPUT)$(drm_ioctl_array) \ $(OUTPUT)$(drm_ioctl_array) \
$(OUTPUT)$(pkey_alloc_access_rights_array) \
$(OUTPUT)$(sndrv_ctl_ioctl_array) \ $(OUTPUT)$(sndrv_ctl_ioctl_array) \
$(OUTPUT)$(sndrv_pcm_ioctl_array) \ $(OUTPUT)$(sndrv_pcm_ioctl_array) \
$(OUTPUT)$(kvm_ioctl_array) \ $(OUTPUT)$(kvm_ioctl_array) \
......
...@@ -241,7 +241,7 @@ static int process_read_event(struct perf_tool *tool, ...@@ -241,7 +241,7 @@ static int process_read_event(struct perf_tool *tool,
const char *name = evsel ? perf_evsel__name(evsel) : "unknown"; const char *name = evsel ? perf_evsel__name(evsel) : "unknown";
int err = perf_read_values_add_value(&rep->show_threads_values, int err = perf_read_values_add_value(&rep->show_threads_values,
event->read.pid, event->read.tid, event->read.pid, event->read.tid,
event->read.id, evsel->idx,
name, name,
event->read.value); event->read.value);
...@@ -249,10 +249,6 @@ static int process_read_event(struct perf_tool *tool, ...@@ -249,10 +249,6 @@ static int process_read_event(struct perf_tool *tool,
return err; return err;
} }
dump_printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid,
evsel ? perf_evsel__name(evsel) : "FAIL",
event->read.value);
return 0; return 0;
} }
......
...@@ -693,6 +693,14 @@ static struct syscall_fmt { ...@@ -693,6 +693,14 @@ static struct syscall_fmt {
[4] = { .scnprintf = SCA_PERF_FLAGS, /* flags */ }, }, }, [4] = { .scnprintf = SCA_PERF_FLAGS, /* flags */ }, }, },
{ .name = "pipe2", { .name = "pipe2",
.arg = { [1] = { .scnprintf = SCA_PIPE_FLAGS, /* flags */ }, }, }, .arg = { [1] = { .scnprintf = SCA_PIPE_FLAGS, /* flags */ }, }, },
{ .name = "pkey_alloc",
.arg = { [1] = { .scnprintf = SCA_PKEY_ALLOC_ACCESS_RIGHTS, /* access_rights */ }, }, },
{ .name = "pkey_free",
.arg = { [0] = { .scnprintf = SCA_INT, /* key */ }, }, },
{ .name = "pkey_mprotect",
.arg = { [0] = { .scnprintf = SCA_HEX, /* start */ },
[2] = { .scnprintf = SCA_MMAP_PROT, /* prot */ },
[3] = { .scnprintf = SCA_INT, /* pkey */ }, }, },
{ .name = "poll", .timeout = true, }, { .name = "poll", .timeout = true, },
{ .name = "ppoll", .timeout = true, }, { .name = "ppoll", .timeout = true, },
{ .name = "pread", .alias = "pread64", }, { .name = "pread", .alias = "pread64", },
......
...@@ -3,4 +3,5 @@ libperf-y += fcntl.o ...@@ -3,4 +3,5 @@ libperf-y += fcntl.o
ifeq ($(SRCARCH),$(filter $(SRCARCH),x86)) ifeq ($(SRCARCH),$(filter $(SRCARCH),x86))
libperf-y += ioctl.o libperf-y += ioctl.o
endif endif
libperf-y += pkey_alloc.o
libperf-y += statx.o libperf-y += statx.o
...@@ -78,6 +78,9 @@ size_t syscall_arg__scnprintf_fcntl_arg(char *bf, size_t size, struct syscall_ar ...@@ -78,6 +78,9 @@ size_t syscall_arg__scnprintf_fcntl_arg(char *bf, size_t size, struct syscall_ar
size_t syscall_arg__scnprintf_ioctl_cmd(char *bf, size_t size, struct syscall_arg *arg); size_t syscall_arg__scnprintf_ioctl_cmd(char *bf, size_t size, struct syscall_arg *arg);
#define SCA_IOCTL_CMD syscall_arg__scnprintf_ioctl_cmd #define SCA_IOCTL_CMD syscall_arg__scnprintf_ioctl_cmd
size_t syscall_arg__scnprintf_pkey_alloc_access_rights(char *bf, size_t size, struct syscall_arg *arg);
#define SCA_PKEY_ALLOC_ACCESS_RIGHTS syscall_arg__scnprintf_pkey_alloc_access_rights
size_t syscall_arg__scnprintf_open_flags(char *bf, size_t size, struct syscall_arg *arg); size_t syscall_arg__scnprintf_open_flags(char *bf, size_t size, struct syscall_arg *arg);
#define SCA_OPEN_FLAGS syscall_arg__scnprintf_open_flags #define SCA_OPEN_FLAGS syscall_arg__scnprintf_open_flags
......
/*
* trace/beauty/pkey_alloc.c
*
* Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
*
* Released under the GPL v2. (and only v2, not any later version)
*/
#include "trace/beauty/beauty.h"
#include <linux/kernel.h>
#include <linux/log2.h>
static size_t pkey_alloc__scnprintf_access_rights(int access_rights, char *bf, size_t size)
{
int i, printed = 0;
#include "trace/beauty/generated/pkey_alloc_access_rights_array.c"
static DEFINE_STRARRAY(pkey_alloc_access_rights);
if (access_rights == 0) {
const char *s = strarray__pkey_alloc_access_rights.entries[0];
if (s)
return scnprintf(bf, size, "%s", s);
return scnprintf(bf, size, "%d", 0);
}
for (i = 1; i < strarray__pkey_alloc_access_rights.nr_entries; ++i) {
int bit = 1 << (i - 1);
if (!(access_rights & bit))
continue;
if (printed != 0)
printed += scnprintf(bf + printed, size - printed, "|");
if (strarray__pkey_alloc_access_rights.entries[i] != NULL)
printed += scnprintf(bf + printed, size - printed, "%s", strarray__pkey_alloc_access_rights.entries[i]);
else
printed += scnprintf(bf + printed, size - printed, "0x%#", bit);
}
return printed;
}
size_t syscall_arg__scnprintf_pkey_alloc_access_rights(char *bf, size_t size, struct syscall_arg *arg)
{
unsigned long cmd = arg->val;
return pkey_alloc__scnprintf_access_rights(cmd, bf, size);
}
#!/bin/sh
header_dir=$1
printf "static const char *pkey_alloc_access_rights[] = {\n"
regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+PKEY_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*'
egrep $regex ${header_dir}/mman-common.h | \
sed -r "s/$regex/\2 \2 \1/g" | \
sort | xargs printf "\t[%s ? (ilog2(%s) + 1) : 0] = \"%s\",\n"
printf "};\n"
...@@ -902,8 +902,13 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts, ...@@ -902,8 +902,13 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
if (opts->no_samples) if (opts->no_samples)
attr->sample_freq = 0; attr->sample_freq = 0;
if (opts->inherit_stat) if (opts->inherit_stat) {
evsel->attr.read_format |=
PERF_FORMAT_TOTAL_TIME_ENABLED |
PERF_FORMAT_TOTAL_TIME_RUNNING |
PERF_FORMAT_ID;
attr->inherit_stat = 1; attr->inherit_stat = 1;
}
if (opts->sample_address) { if (opts->sample_address) {
perf_evsel__set_sample_bit(evsel, ADDR); perf_evsel__set_sample_bit(evsel, ADDR);
......
...@@ -25,6 +25,6 @@ $(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/in ...@@ -25,6 +25,6 @@ $(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/in
CFLAGS_intel-pt-insn-decoder.o += -I$(OUTPUT)util/intel-pt-decoder CFLAGS_intel-pt-insn-decoder.o += -I$(OUTPUT)util/intel-pt-decoder
ifneq ($(CC), clang) ifeq ($(CC_NO_CLANG), 1)
CFLAGS_intel-pt-insn-decoder.o += -Wno-override-init CFLAGS_intel-pt-insn-decoder.o += -Wno-override-init
endif endif
...@@ -316,6 +316,11 @@ int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi) ...@@ -316,6 +316,11 @@ int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi)
u64 lvl = data_src->mem_lvl; u64 lvl = data_src->mem_lvl;
u64 snoop = data_src->mem_snoop; u64 snoop = data_src->mem_snoop;
u64 lock = data_src->mem_lock; u64 lock = data_src->mem_lock;
/*
* Skylake might report unknown remote level via this
* bit, consider it when evaluating remote HITMs.
*/
bool mrem = data_src->mem_remote;
int err = 0; int err = 0;
#define HITM_INC(__f) \ #define HITM_INC(__f) \
...@@ -361,7 +366,8 @@ do { \ ...@@ -361,7 +366,8 @@ do { \
} }
if ((lvl & P(LVL, REM_RAM1)) || if ((lvl & P(LVL, REM_RAM1)) ||
(lvl & P(LVL, REM_RAM2))) { (lvl & P(LVL, REM_RAM2)) ||
mrem) {
stats->rmt_dram++; stats->rmt_dram++;
if (snoop & P(SNOOP, HIT)) if (snoop & P(SNOOP, HIT))
stats->ld_shared++; stats->ld_shared++;
...@@ -371,7 +377,8 @@ do { \ ...@@ -371,7 +377,8 @@ do { \
} }
if ((lvl & P(LVL, REM_CCE1)) || if ((lvl & P(LVL, REM_CCE1)) ||
(lvl & P(LVL, REM_CCE2))) { (lvl & P(LVL, REM_CCE2)) ||
mrem) {
if (snoop & P(SNOOP, HIT)) if (snoop & P(SNOOP, HIT))
stats->rmt_hit++; stats->rmt_hit++;
else if (snoop & P(SNOOP, HITM)) else if (snoop & P(SNOOP, HITM))
......
...@@ -2395,7 +2395,7 @@ kprobe_blacklist__find_by_address(struct list_head *blacklist, ...@@ -2395,7 +2395,7 @@ kprobe_blacklist__find_by_address(struct list_head *blacklist,
struct kprobe_blacklist_node *node; struct kprobe_blacklist_node *node;
list_for_each_entry(node, blacklist, list) { list_for_each_entry(node, blacklist, list) {
if (node->start <= address && address <= node->end) if (node->start <= address && address < node->end)
return node; return node;
} }
......
...@@ -1127,6 +1127,30 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event, ...@@ -1127,6 +1127,30 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event,
sample_read__printf(sample, evsel->attr.read_format); sample_read__printf(sample, evsel->attr.read_format);
} }
static void dump_read(struct perf_evsel *evsel, union perf_event *event)
{
struct read_event *read_event = &event->read;
u64 read_format;
if (!dump_trace)
return;
printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid,
evsel ? perf_evsel__name(evsel) : "FAIL",
event->read.value);
read_format = evsel->attr.read_format;
if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
printf("... time enabled : %" PRIu64 "\n", read_event->time_enabled);
if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
printf("... time running : %" PRIu64 "\n", read_event->time_running);
if (read_format & PERF_FORMAT_ID)
printf("... id : %" PRIu64 "\n", read_event->id);
}
static struct machine *machines__find_for_cpumode(struct machines *machines, static struct machine *machines__find_for_cpumode(struct machines *machines,
union perf_event *event, union perf_event *event,
struct perf_sample *sample) struct perf_sample *sample)
...@@ -1271,6 +1295,7 @@ static int machines__deliver_event(struct machines *machines, ...@@ -1271,6 +1295,7 @@ static int machines__deliver_event(struct machines *machines,
evlist->stats.total_lost_samples += event->lost_samples.lost; evlist->stats.total_lost_samples += event->lost_samples.lost;
return tool->lost_samples(tool, event, sample, machine); return tool->lost_samples(tool, event, sample, machine);
case PERF_RECORD_READ: case PERF_RECORD_READ:
dump_read(evsel, event);
return tool->read(tool, event, sample, evsel, machine); return tool->read(tool, event, sample, evsel, machine);
case PERF_RECORD_THROTTLE: case PERF_RECORD_THROTTLE:
return tool->throttle(tool, event, sample, machine); return tool->throttle(tool, event, sample, machine);
......
...@@ -259,7 +259,7 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map * ...@@ -259,7 +259,7 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map *
{ {
uint32_t nr_rel_entries, idx; uint32_t nr_rel_entries, idx;
GElf_Sym sym; GElf_Sym sym;
u64 plt_offset; u64 plt_offset, plt_header_size, plt_entry_size;
GElf_Shdr shdr_plt; GElf_Shdr shdr_plt;
struct symbol *f; struct symbol *f;
GElf_Shdr shdr_rel_plt, shdr_dynsym; GElf_Shdr shdr_rel_plt, shdr_dynsym;
...@@ -326,6 +326,23 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map * ...@@ -326,6 +326,23 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map *
nr_rel_entries = shdr_rel_plt.sh_size / shdr_rel_plt.sh_entsize; nr_rel_entries = shdr_rel_plt.sh_size / shdr_rel_plt.sh_entsize;
plt_offset = shdr_plt.sh_offset; plt_offset = shdr_plt.sh_offset;
switch (ehdr.e_machine) {
case EM_ARM:
plt_header_size = 20;
plt_entry_size = 12;
break;
case EM_AARCH64:
plt_header_size = 32;
plt_entry_size = 16;
break;
default: /* FIXME: s390/alpha/mips/parisc/poperpc/sh/sparc/xtensa need to be checked */
plt_header_size = shdr_plt.sh_entsize;
plt_entry_size = shdr_plt.sh_entsize;
break;
}
plt_offset += plt_header_size;
if (shdr_rel_plt.sh_type == SHT_RELA) { if (shdr_rel_plt.sh_type == SHT_RELA) {
GElf_Rela pos_mem, *pos; GElf_Rela pos_mem, *pos;
...@@ -335,7 +352,6 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map * ...@@ -335,7 +352,6 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map *
const char *elf_name = NULL; const char *elf_name = NULL;
char *demangled = NULL; char *demangled = NULL;
symidx = GELF_R_SYM(pos->r_info); symidx = GELF_R_SYM(pos->r_info);
plt_offset += shdr_plt.sh_entsize;
gelf_getsym(syms, symidx, &sym); gelf_getsym(syms, symidx, &sym);
elf_name = elf_sym__name(&sym, symstrs); elf_name = elf_sym__name(&sym, symstrs);
...@@ -346,11 +362,12 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map * ...@@ -346,11 +362,12 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map *
"%s@plt", elf_name); "%s@plt", elf_name);
free(demangled); free(demangled);
f = symbol__new(plt_offset, shdr_plt.sh_entsize, f = symbol__new(plt_offset, plt_entry_size,
STB_GLOBAL, sympltname); STB_GLOBAL, sympltname);
if (!f) if (!f)
goto out_elf_end; goto out_elf_end;
plt_offset += plt_entry_size;
symbols__insert(&dso->symbols[map->type], f); symbols__insert(&dso->symbols[map->type], f);
++nr; ++nr;
} }
...@@ -361,7 +378,6 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map * ...@@ -361,7 +378,6 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map *
const char *elf_name = NULL; const char *elf_name = NULL;
char *demangled = NULL; char *demangled = NULL;
symidx = GELF_R_SYM(pos->r_info); symidx = GELF_R_SYM(pos->r_info);
plt_offset += shdr_plt.sh_entsize;
gelf_getsym(syms, symidx, &sym); gelf_getsym(syms, symidx, &sym);
elf_name = elf_sym__name(&sym, symstrs); elf_name = elf_sym__name(&sym, symstrs);
...@@ -372,11 +388,12 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map * ...@@ -372,11 +388,12 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map *
"%s@plt", elf_name); "%s@plt", elf_name);
free(demangled); free(demangled);
f = symbol__new(plt_offset, shdr_plt.sh_entsize, f = symbol__new(plt_offset, plt_entry_size,
STB_GLOBAL, sympltname); STB_GLOBAL, sympltname);
if (!f) if (!f)
goto out_elf_end; goto out_elf_end;
plt_offset += plt_entry_size;
symbols__insert(&dso->symbols[map->type], f); symbols__insert(&dso->symbols[map->type], f);
++nr; ++nr;
} }
......
...@@ -12,7 +12,7 @@ int perf_read_values_init(struct perf_read_values *values) ...@@ -12,7 +12,7 @@ int perf_read_values_init(struct perf_read_values *values)
values->threads_max = 16; values->threads_max = 16;
values->pid = malloc(values->threads_max * sizeof(*values->pid)); values->pid = malloc(values->threads_max * sizeof(*values->pid));
values->tid = malloc(values->threads_max * sizeof(*values->tid)); values->tid = malloc(values->threads_max * sizeof(*values->tid));
values->value = malloc(values->threads_max * sizeof(*values->value)); values->value = zalloc(values->threads_max * sizeof(*values->value));
if (!values->pid || !values->tid || !values->value) { if (!values->pid || !values->tid || !values->value) {
pr_debug("failed to allocate read_values threads arrays"); pr_debug("failed to allocate read_values threads arrays");
goto out_free_pid; goto out_free_pid;
...@@ -98,15 +98,16 @@ static int perf_read_values__findnew_thread(struct perf_read_values *values, ...@@ -98,15 +98,16 @@ static int perf_read_values__findnew_thread(struct perf_read_values *values,
return i; return i;
} }
i = values->threads + 1; i = values->threads;
values->value[i] = malloc(values->counters_max * sizeof(**values->value));
values->value[i] = zalloc(values->counters_max * sizeof(**values->value));
if (!values->value[i]) { if (!values->value[i]) {
pr_debug("failed to allocate read_values counters array"); pr_debug("failed to allocate read_values counters array");
return -ENOMEM; return -ENOMEM;
} }
values->pid[i] = pid; values->pid[i] = pid;
values->tid[i] = tid; values->tid[i] = tid;
values->threads = i; values->threads = i + 1;
return i; return i;
} }
...@@ -130,12 +131,16 @@ static int perf_read_values__enlarge_counters(struct perf_read_values *values) ...@@ -130,12 +131,16 @@ static int perf_read_values__enlarge_counters(struct perf_read_values *values)
for (i = 0; i < values->threads; i++) { for (i = 0; i < values->threads; i++) {
u64 *value = realloc(values->value[i], counters_max * sizeof(**values->value)); u64 *value = realloc(values->value[i], counters_max * sizeof(**values->value));
int j;
if (value) { if (!value) {
pr_debug("failed to enlarge read_values ->values array"); pr_debug("failed to enlarge read_values ->values array");
goto out_free_name; goto out_free_name;
} }
for (j = values->counters_max; j < counters_max; j++)
value[j] = 0;
values->value[i] = value; values->value[i] = value;
} }
...@@ -187,7 +192,7 @@ int perf_read_values_add_value(struct perf_read_values *values, ...@@ -187,7 +192,7 @@ int perf_read_values_add_value(struct perf_read_values *values,
if (cindex < 0) if (cindex < 0)
return cindex; return cindex;
values->value[tindex][cindex] = value; values->value[tindex][cindex] += value;
return 0; return 0;
} }
......
...@@ -39,7 +39,9 @@ EXTRA_WARNINGS += -Wundef ...@@ -39,7 +39,9 @@ EXTRA_WARNINGS += -Wundef
EXTRA_WARNINGS += -Wwrite-strings EXTRA_WARNINGS += -Wwrite-strings
EXTRA_WARNINGS += -Wformat EXTRA_WARNINGS += -Wformat
ifneq ($(CC), clang) CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?)
ifeq ($(CC_NO_CLANG), 1)
EXTRA_WARNINGS += -Wstrict-aliasing=3 EXTRA_WARNINGS += -Wstrict-aliasing=3
endif endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment