perf tools fixes for v6.4: 2nd batch
- Fix BPF CO-RE naming convention for checking the availability of fields on 'union perf_mem_data_src' on the running kernel. - Remove the use of llvm-strip on BPF skel object files, not needed, fixes a build breakage when the llvm package, that contains it in most distros, isn't installed. - Fix tools that use both evsel->{bpf_counter_list,bpf_filters}, removing them from a union. - Remove extra "--" from the 'perf ftrace latency' --use-nsec option, previously it was working only when using the '-n' alternative. - Don't stop building when both binutils-devel and a C++ compiler isn't available to compile the alternative C++ demangle support code, disable that feature instead. - Sync the linux/in.h and coresight-pmu.h header copies with the kernel sources. - Fix relative include path to cs-etm.h. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCZHY9egAKCRCyPKLppCJ+ JzbBAQCv+i0j/+garWKCTSe33yztzQGS6jxu/YzQrbQO427DMwEA9fJgp/r2OQC5 wMM5gng2fPaHe6Hs4cnPL/SzMxLC2gQ= =fHRR -----END PGP SIGNATURE----- Merge tag 'perf-tools-fixes-for-v6.4-2-2023-05-30' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux Pull perf tools fixes from Arnaldo Carvalho de Melo: - Fix BPF CO-RE naming convention for checking the availability of fields on 'union perf_mem_data_src' on the running kernel - Remove the use of llvm-strip on BPF skel object files, not needed, fixes a build breakage when the llvm package, that contains it in most distros, isn't installed - Fix tools that use both evsel->{bpf_counter_list,bpf_filters}, removing them from a union - Remove extra "--" from the 'perf ftrace latency' --use-nsec option, previously it was working only when using the '-n' alternative - Don't stop building when both binutils-devel and a C++ compiler isn't available to compile the alternative C++ demangle support code, disable that feature instead - Sync the linux/in.h and coresight-pmu.h header copies with the kernel sources - Fix relative include path to cs-etm.h * tag 'perf-tools-fixes-for-v6.4-2-2023-05-30' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: perf evsel: Separate bpf_counter_list and bpf_filters, can be used at the same time tools headers UAPI: Sync the linux/in.h with the kernel sources perf cs-etm: Copy kernel coresight-pmu.h header perf bpf: Do not use llvm-strip on BPF binary perf build: Don't compile demangle-cxx.cpp if not necessary perf arm: Fix include path to cs-etm.h perf bpf filter: Fix a broken perf sample data naming for BPF CO-RE perf ftrace latency: Remove unnecessary "--" from --use-nsec option
This commit is contained in:
commit
afead42fdf
@ -21,19 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
#define CORESIGHT_LEGACY_CPU_TRACE_ID(cpu) (0x10 + (cpu * 2))
|
#define CORESIGHT_LEGACY_CPU_TRACE_ID(cpu) (0x10 + (cpu * 2))
|
||||||
|
|
||||||
/* CoreSight trace ID is currently the bottom 7 bits of the value */
|
|
||||||
#define CORESIGHT_TRACE_ID_VAL_MASK GENMASK(6, 0)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* perf record will set the legacy meta data values as unused initially.
|
|
||||||
* This allows perf report to manage the decoders created when dynamic
|
|
||||||
* allocation in operation.
|
|
||||||
*/
|
|
||||||
#define CORESIGHT_TRACE_ID_UNUSED_FLAG BIT(31)
|
|
||||||
|
|
||||||
/* Value to set for unused trace ID values */
|
|
||||||
#define CORESIGHT_TRACE_ID_UNUSED_VAL 0x7F
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Below are the definition of bit offsets for perf option, and works as
|
* Below are the definition of bit offsets for perf option, and works as
|
||||||
* arbitrary values for all ETM versions.
|
* arbitrary values for all ETM versions.
|
||||||
|
@ -163,6 +163,7 @@ struct in_addr {
|
|||||||
#define IP_MULTICAST_ALL 49
|
#define IP_MULTICAST_ALL 49
|
||||||
#define IP_UNICAST_IF 50
|
#define IP_UNICAST_IF 50
|
||||||
#define IP_LOCAL_PORT_RANGE 51
|
#define IP_LOCAL_PORT_RANGE 51
|
||||||
|
#define IP_PROTOCOL 52
|
||||||
|
|
||||||
#define MCAST_EXCLUDE 0
|
#define MCAST_EXCLUDE 0
|
||||||
#define MCAST_INCLUDE 1
|
#define MCAST_INCLUDE 1
|
||||||
|
@ -927,6 +927,7 @@ ifndef NO_DEMANGLE
|
|||||||
EXTLIBS += -lstdc++
|
EXTLIBS += -lstdc++
|
||||||
CFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
|
CFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
|
||||||
CXXFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
|
CXXFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
|
||||||
|
$(call detected,CONFIG_CXX_DEMANGLE)
|
||||||
endif
|
endif
|
||||||
ifdef BUILD_NONDISTRO
|
ifdef BUILD_NONDISTRO
|
||||||
ifeq ($(filter -liberty,$(EXTLIBS)),)
|
ifeq ($(filter -liberty,$(EXTLIBS)),)
|
||||||
|
@ -181,7 +181,6 @@ HOSTCC ?= gcc
|
|||||||
HOSTLD ?= ld
|
HOSTLD ?= ld
|
||||||
HOSTAR ?= ar
|
HOSTAR ?= ar
|
||||||
CLANG ?= clang
|
CLANG ?= clang
|
||||||
LLVM_STRIP ?= llvm-strip
|
|
||||||
|
|
||||||
PKG_CONFIG = $(CROSS_COMPILE)pkg-config
|
PKG_CONFIG = $(CROSS_COMPILE)pkg-config
|
||||||
|
|
||||||
@ -1083,7 +1082,7 @@ $(BPFTOOL): | $(SKEL_TMP_OUT)
|
|||||||
|
|
||||||
$(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) | $(SKEL_TMP_OUT)
|
$(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) | $(SKEL_TMP_OUT)
|
||||||
$(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -Wall -Werror $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \
|
$(QUIET_CLANG)$(CLANG) -g -O2 -target bpf -Wall -Werror $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \
|
||||||
-c $(filter util/bpf_skel/%.bpf.c,$^) -o $@ && $(LLVM_STRIP) -g $@
|
-c $(filter util/bpf_skel/%.bpf.c,$^) -o $@
|
||||||
|
|
||||||
$(SKEL_OUT)/%.skel.h: $(SKEL_TMP_OUT)/%.bpf.o | $(BPFTOOL)
|
$(SKEL_OUT)/%.skel.h: $(SKEL_TMP_OUT)/%.bpf.o | $(BPFTOOL)
|
||||||
$(QUIET_GENSKEL)$(BPFTOOL) gen skeleton $< > $@
|
$(QUIET_GENSKEL)$(BPFTOOL) gen skeleton $< > $@
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "arm-spe.h"
|
#include "arm-spe.h"
|
||||||
#include "hisi-ptt.h"
|
#include "hisi-ptt.h"
|
||||||
#include "../../../util/pmu.h"
|
#include "../../../util/pmu.h"
|
||||||
#include "../cs-etm.h"
|
#include "../../../util/cs-etm.h"
|
||||||
|
|
||||||
struct perf_event_attr
|
struct perf_event_attr
|
||||||
*perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
|
*perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
|
||||||
|
@ -1175,7 +1175,7 @@ int cmd_ftrace(int argc, const char **argv)
|
|||||||
OPT_BOOLEAN('b', "use-bpf", &ftrace.target.use_bpf,
|
OPT_BOOLEAN('b', "use-bpf", &ftrace.target.use_bpf,
|
||||||
"Use BPF to measure function latency"),
|
"Use BPF to measure function latency"),
|
||||||
#endif
|
#endif
|
||||||
OPT_BOOLEAN('n', "--use-nsec", &ftrace.use_nsec,
|
OPT_BOOLEAN('n', "use-nsec", &ftrace.use_nsec,
|
||||||
"Use nano-second histogram"),
|
"Use nano-second histogram"),
|
||||||
OPT_PARENT(common_options),
|
OPT_PARENT(common_options),
|
||||||
};
|
};
|
||||||
|
@ -214,7 +214,7 @@ perf-$(CONFIG_ZSTD) += zstd.o
|
|||||||
|
|
||||||
perf-$(CONFIG_LIBCAP) += cap.o
|
perf-$(CONFIG_LIBCAP) += cap.o
|
||||||
|
|
||||||
perf-y += demangle-cxx.o
|
perf-$(CONFIG_CXX_DEMANGLE) += demangle-cxx.o
|
||||||
perf-y += demangle-ocaml.o
|
perf-y += demangle-ocaml.o
|
||||||
perf-y += demangle-java.o
|
perf-y += demangle-java.o
|
||||||
perf-y += demangle-rust.o
|
perf-y += demangle-rust.o
|
||||||
|
@ -25,7 +25,7 @@ struct perf_sample_data___new {
|
|||||||
} __attribute__((preserve_access_index));
|
} __attribute__((preserve_access_index));
|
||||||
|
|
||||||
/* new kernel perf_mem_data_src definition */
|
/* new kernel perf_mem_data_src definition */
|
||||||
union perf_mem_data_src__new {
|
union perf_mem_data_src___new {
|
||||||
__u64 val;
|
__u64 val;
|
||||||
struct {
|
struct {
|
||||||
__u64 mem_op:5, /* type of opcode */
|
__u64 mem_op:5, /* type of opcode */
|
||||||
@ -108,7 +108,7 @@ static inline __u64 perf_get_sample(struct bpf_perf_event_data_kern *kctx,
|
|||||||
if (entry->part == 7)
|
if (entry->part == 7)
|
||||||
return kctx->data->data_src.mem_blk;
|
return kctx->data->data_src.mem_blk;
|
||||||
if (entry->part == 8) {
|
if (entry->part == 8) {
|
||||||
union perf_mem_data_src__new *data = (void *)&kctx->data->data_src;
|
union perf_mem_data_src___new *data = (void *)&kctx->data->data_src;
|
||||||
|
|
||||||
if (bpf_core_field_exists(data->mem_hops))
|
if (bpf_core_field_exists(data->mem_hops))
|
||||||
return data->mem_hops;
|
return data->mem_hops;
|
||||||
|
@ -227,6 +227,19 @@ struct cs_etm_packet_queue {
|
|||||||
#define INFO_HEADER_SIZE (sizeof(((struct perf_record_auxtrace_info *)0)->type) + \
|
#define INFO_HEADER_SIZE (sizeof(((struct perf_record_auxtrace_info *)0)->type) + \
|
||||||
sizeof(((struct perf_record_auxtrace_info *)0)->reserved__))
|
sizeof(((struct perf_record_auxtrace_info *)0)->reserved__))
|
||||||
|
|
||||||
|
/* CoreSight trace ID is currently the bottom 7 bits of the value */
|
||||||
|
#define CORESIGHT_TRACE_ID_VAL_MASK GENMASK(6, 0)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* perf record will set the legacy meta data values as unused initially.
|
||||||
|
* This allows perf report to manage the decoders created when dynamic
|
||||||
|
* allocation in operation.
|
||||||
|
*/
|
||||||
|
#define CORESIGHT_TRACE_ID_UNUSED_FLAG BIT(31)
|
||||||
|
|
||||||
|
/* Value to set for unused trace ID values */
|
||||||
|
#define CORESIGHT_TRACE_ID_UNUSED_VAL 0x7F
|
||||||
|
|
||||||
int cs_etm__process_auxtrace_info(union perf_event *event,
|
int cs_etm__process_auxtrace_info(union perf_event *event,
|
||||||
struct perf_session *session);
|
struct perf_session *session);
|
||||||
struct perf_event_attr *cs_etm_get_default_config(struct perf_pmu *pmu);
|
struct perf_event_attr *cs_etm_get_default_config(struct perf_pmu *pmu);
|
||||||
|
@ -282,6 +282,7 @@ void evsel__init(struct evsel *evsel,
|
|||||||
evsel->bpf_fd = -1;
|
evsel->bpf_fd = -1;
|
||||||
INIT_LIST_HEAD(&evsel->config_terms);
|
INIT_LIST_HEAD(&evsel->config_terms);
|
||||||
INIT_LIST_HEAD(&evsel->bpf_counter_list);
|
INIT_LIST_HEAD(&evsel->bpf_counter_list);
|
||||||
|
INIT_LIST_HEAD(&evsel->bpf_filters);
|
||||||
perf_evsel__object.init(evsel);
|
perf_evsel__object.init(evsel);
|
||||||
evsel->sample_size = __evsel__sample_size(attr->sample_type);
|
evsel->sample_size = __evsel__sample_size(attr->sample_type);
|
||||||
evsel__calc_id_pos(evsel);
|
evsel__calc_id_pos(evsel);
|
||||||
|
@ -151,10 +151,8 @@ struct evsel {
|
|||||||
*/
|
*/
|
||||||
struct bpf_counter_ops *bpf_counter_ops;
|
struct bpf_counter_ops *bpf_counter_ops;
|
||||||
|
|
||||||
union {
|
struct list_head bpf_counter_list; /* for perf-stat -b */
|
||||||
struct list_head bpf_counter_list; /* for perf-stat -b */
|
struct list_head bpf_filters; /* for perf-record --filter */
|
||||||
struct list_head bpf_filters; /* for perf-record --filter */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* for perf-stat --use-bpf */
|
/* for perf-stat --use-bpf */
|
||||||
int bperf_leader_prog_fd;
|
int bperf_leader_prog_fd;
|
||||||
|
@ -31,6 +31,13 @@
|
|||||||
#include <bfd.h>
|
#include <bfd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_LIBBFD_SUPPORT) || defined(HAVE_CPLUS_DEMANGLE_SUPPORT)
|
||||||
|
#ifndef DMGL_PARAMS
|
||||||
|
#define DMGL_PARAMS (1 << 0) /* Include function args */
|
||||||
|
#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef EM_AARCH64
|
#ifndef EM_AARCH64
|
||||||
#define EM_AARCH64 183 /* ARM 64 bit */
|
#define EM_AARCH64 183 /* ARM 64 bit */
|
||||||
#endif
|
#endif
|
||||||
@ -271,6 +278,26 @@ static bool want_demangle(bool is_kernel_sym)
|
|||||||
return is_kernel_sym ? symbol_conf.demangle_kernel : symbol_conf.demangle;
|
return is_kernel_sym ? symbol_conf.demangle_kernel : symbol_conf.demangle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Demangle C++ function signature, typically replaced by demangle-cxx.cpp
|
||||||
|
* version.
|
||||||
|
*/
|
||||||
|
__weak char *cxx_demangle_sym(const char *str __maybe_unused, bool params __maybe_unused,
|
||||||
|
bool modifiers __maybe_unused)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_LIBBFD_SUPPORT
|
||||||
|
int flags = (params ? DMGL_PARAMS : 0) | (modifiers ? DMGL_ANSI : 0);
|
||||||
|
|
||||||
|
return bfd_demangle(NULL, str, flags);
|
||||||
|
#elif defined(HAVE_CPLUS_DEMANGLE_SUPPORT)
|
||||||
|
int flags = (params ? DMGL_PARAMS : 0) | (modifiers ? DMGL_ANSI : 0);
|
||||||
|
|
||||||
|
return cplus_demangle(str, flags);
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
|
static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
|
||||||
{
|
{
|
||||||
char *demangled = NULL;
|
char *demangled = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user