Skip to content

Commit

Permalink
Merge tag 'perf-core-for-mingo-5.4-20190920-2' of git://git.kernel.or…
Browse files Browse the repository at this point in the history
…g/pub/scm/linux/kernel/git/acme/linux into perf/urgent

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

perf stat:

  Srikar Dronamraju:

  - Fix a segmentation fault when using repeat forever.

  - Reset previous counts on repeat with interval.

aarch64:

  James Clark:

  - Add PMU event JSON files for Cortex-A76 and Neoverse N1.

PowerPC:

  Anju T Sudhakar:

  - Make 'trace_cycles' the default event for 'perf kvm record' in PowerPC.

S/390:

  - Link libjvmti to tools/lib/string.o to have a weak strlcpy()
    implementation, providing previously unresolved symbol on s/390.

perf test:

  Jiri Olsa:

  - Add libperf automated tests to 'make -C tools/perf build-test'.

  Colin Ian King:

  - Fix spelling mistake.

Tree wide:

  Arnaldo Carvalho de Melo:

  - Some more header file sanitization.

libperf:

  Jiri Olsa:

  - Add dependency on libperf for python.so binding.

libtraceevent:

  Sakari Ailus:

  - Convert remaining %p[fF] users to %p[sS].

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Sep 20, 2019
2 parents 7f2444d + 2bff2b8 commit 351a1f5
Show file tree
Hide file tree
Showing 180 changed files with 2,763 additions and 2,256 deletions.
10 changes: 5 additions & 5 deletions tools/lib/traceevent/Documentation/libtraceevent-func_apis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ parser context.

The _tep_register_function()_ function registers a function name mapped to an
address and (optional) module. This mapping is used in case the function tracer
or events have "%pF" or "%pS" parameter in its format string. It is common to
pass in the kallsyms function names with their corresponding addresses with this
or events have "%pS" parameter in its format string. It is common to pass in
the kallsyms function names with their corresponding addresses with this
function. The _tep_ argument is the trace event parser context. The _name_ is
the name of the function, the string is copied internally. The _addr_ is
the start address of the function. The _mod_ is the kernel module
the function may be in (NULL for none).
the name of the function, the string is copied internally. The _addr_ is the
start address of the function. The _mod_ is the kernel module the function may
be in (NULL for none).

The _tep_register_print_string()_ function registers a string by the address
it was stored in the kernel. Some strings internal to the kernel with static
Expand Down
18 changes: 14 additions & 4 deletions tools/lib/traceevent/event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -4367,10 +4367,20 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s
switch (*ptr) {
case 's':
case 'S':
case 'f':
case 'F':
case 'x':
break;
case 'f':
case 'F':
/*
* Pre-5.5 kernels use %pf and
* %pF for printing symbols
* while kernels since 5.5 use
* %pfw for fwnodes. So check
* %p[fF] isn't followed by 'w'.
*/
if (ptr[1] != 'w')
break;
/* fall through */
default:
/*
* Older kernels do not process
Expand Down Expand Up @@ -4487,12 +4497,12 @@ get_bprint_format(void *data, int size __maybe_unused,

printk = find_printk(tep, addr);
if (!printk) {
if (asprintf(&format, "%%pf: (NO FORMAT FOUND at %llx)\n", addr) < 0)
if (asprintf(&format, "%%ps: (NO FORMAT FOUND at %llx)\n", addr) < 0)
return NULL;
return format;
}

if (asprintf(&format, "%s: %s", "%pf", printk->printk) < 0)
if (asprintf(&format, "%s: %s", "%ps", printk->printk) < 0)
return NULL;

return format;
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/Makefile.perf
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
# Create python binding output directory if not already present
_dummy := $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python')

$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST) $(LIBPERF)
$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
$(PYTHON_WORD) util/setup.py \
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/arch/arm/util/cs-etm.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "../../util/evsel.h"
#include "../../util/pmu.h"
#include "../../util/cs-etm.h"
#include "../../util/util.h"
#include "../../util/util.h" // page_size
#include "../../util/session.h"

#include <errno.h>
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/arch/arm64/util/arm-spe.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "../../util/evsel.h"
#include "../../util/evlist.h"
#include "../../util/session.h"
#include "../../util/util.h"
#include "../../util/util.h" // page_size
#include "../../util/pmu.h"
#include "../../util/debug.h"
#include "../../util/auxtrace.h"
Expand Down
1 change: 0 additions & 1 deletion tools/perf/arch/arm64/util/dwarf-regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <dwarf-regs.h>
#include <linux/ptrace.h> /* for struct user_pt_regs */
#include <linux/stringify.h>
#include "util.h"

struct pt_regs_dwarfnum {
const char *name;
Expand Down
4 changes: 3 additions & 1 deletion tools/perf/arch/arm64/util/header.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <perf/cpumap.h>
#include <internal/cpumap.h>
#include <api/fs/fs.h>
#include "debug.h"
#include "header.h"
Expand Down Expand Up @@ -29,7 +31,7 @@ char *get_cpuid_str(struct perf_pmu *pmu)

/* read midr from list of cpus mapped to this pmu */
cpus = perf_cpu_map__get(pmu->cpus);
for (cpu = 0; cpu < cpus->nr; cpu++) {
for (cpu = 0; cpu < perf_cpu_map__nr(cpus); cpu++) {
scnprintf(path, PATH_MAX, "%s/devices/system/cpu/cpu%d"MIDR,
sysfs, cpus->map[cpu]);

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/arch/arm64/util/unwind-libunwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <libunwind.h>
#include "perf_regs.h"
#include "../../util/unwind.h"
#include "../../util/debug.h"
#endif
#include "../../util/debug.h"

int LIBUNWIND__ARCH_REG_ID(int regnum)
{
Expand Down
1 change: 0 additions & 1 deletion tools/perf/arch/powerpc/util/dwarf-regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <linux/ptrace.h>
#include <linux/kernel.h>
#include <linux/stringify.h>
#include "util.h"

struct pt_regs_dwarfnum {
const char *name;
Expand Down
1 change: 0 additions & 1 deletion tools/perf/arch/powerpc/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <string.h>
#include <linux/stringify.h>
#include "header.h"
#include "util.h"

#define mfspr(rn) ({unsigned long rval; \
asm volatile("mfspr %0," __stringify(rn) \
Expand Down
45 changes: 45 additions & 0 deletions tools/perf/arch/powerpc/util/kvm-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
#include "util/debug.h"
#include "util/evsel.h"
#include "util/evlist.h"
#include "util/pmu.h"

#include "book3s_hv_exits.h"
#include "book3s_hcalls.h"
#include <subcmd/parse-options.h>

#define NR_TPS 4

Expand Down Expand Up @@ -172,3 +174,46 @@ int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid __maybe_unused)

return ret;
}

/*
* Incase of powerpc architecture, pmu registers are programmable
* by guest kernel. So monitoring guest via host may not provide
* valid samples with default 'cycles' event. It is better to use
* 'trace_imc/trace_cycles' event for guest profiling, since it
* can track the guest instruction pointer in the trace-record.
*
* Function to parse the arguments and return appropriate values.
*/
int kvm_add_default_arch_event(int *argc, const char **argv)
{
const char **tmp;
bool event = false;
int i, j = *argc;

const struct option event_options[] = {
OPT_BOOLEAN('e', "event", &event, NULL),
OPT_END()
};

tmp = calloc(j + 1, sizeof(char *));
if (!tmp)
return -EINVAL;

for (i = 0; i < j; i++)
tmp[i] = argv[i];

parse_options(j, tmp, event_options, NULL, PARSE_OPT_KEEP_UNKNOWN);
if (!event) {
if (pmu_have_event("trace_imc", "trace_cycles")) {
argv[j++] = strdup("-e");
argv[j++] = strdup("trace_imc/trace_cycles/");
*argc += 2;
} else {
free(tmp);
return -EINVAL;
}
}

free(tmp);
return 0;
}
1 change: 1 addition & 0 deletions tools/perf/arch/powerpc/util/skip-callchain-idx.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "util/callchain.h"
#include "util/debug.h"
#include "util/dso.h"
#include "util/event.h" // struct ip_callchain
#include "util/map.h"
#include "util/symbol.h"

Expand Down
1 change: 0 additions & 1 deletion tools/perf/arch/powerpc/util/sym-handling.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Copyright (C) 2015 Naveen N. Rao, IBM Corporation
*/

#include "debug.h"
#include "dso.h"
#include "symbol.h"
#include "map.h"
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/arch/s390/util/machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "util.h"
#include "util.h" // page_size
#include "machine.h"
#include "api/fs/fs.h"
#include "debug.h"
Expand Down
1 change: 0 additions & 1 deletion tools/perf/arch/x86/tests/intel-cqm.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "evlist.h"
#include "evsel.h"
#include "arch-tests.h"
#include "util.h"

#include <signal.h>
#include <sys/mman.h>
Expand Down
1 change: 0 additions & 1 deletion tools/perf/arch/x86/tests/perf-time-to-tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "evlist.h"
#include "evsel.h"
#include "thread_map.h"
#include "cpumap.h"
#include "record.h"
#include "tsc.h"
#include "tests/tests.h"
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/arch/x86/tests/rdpmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "tests/tests.h"
#include "cloexec.h"
#include "event.h"
#include "util.h"
#include "util.h" // page_size
#include "arch-tests.h"

static u64 rdpmc(unsigned int counter)
Expand Down
1 change: 1 addition & 0 deletions tools/perf/arch/x86/util/archinsn.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "../../../../arch/x86/include/asm/insn.h"
#include "archinsn.h"
#include "event.h"
#include "machine.h"
#include "thread.h"
#include "symbol.h"
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/arch/x86/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <linux/string.h>
#include <linux/zalloc.h>

#include "../../util/event.h"
#include "../../util/synthetic-events.h"
#include "../../util/machine.h"
#include "../../util/tool.h"
#include "../../util/map.h"
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/arch/x86/util/intel-bts.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "../../util/tsc.h"
#include "../../util/auxtrace.h"
#include "../../util/intel-bts.h"
#include "../../util/util.h"
#include "../../util/util.h" // page_size

#define KiB(x) ((x) * 1024)
#define MiB(x) ((x) * 1024 * 1024)
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/arch/x86/util/intel-pt.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "../../util/record.h"
#include "../../util/target.h"
#include "../../util/tsc.h"
#include "../../util/util.h"
#include "../../util/util.h" // page_size
#include "../../util/intel-pt.h"

#define KiB(x) ((x) * 1024)
Expand Down
3 changes: 2 additions & 1 deletion tools/perf/arch/x86/util/machine.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/types.h>
#include <linux/string.h>
#include <limits.h>
#include <stdlib.h>

#include "../../util/util.h"
#include "../../util/util.h" // page_size
#include "../../util/machine.h"
#include "../../util/map.h"
#include "../../util/symbol.h"
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/arch/x86/util/tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <linux/types.h>
#include <asm/barrier.h>
#include "../../../util/debug.h"
#include "../../../util/event.h"
#include "../../../util/synthetic-events.h"
#include "../../../util/tsc.h"

int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/bench/epoll-ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
#include <sys/resource.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
#include <internal/cpumap.h>
#include <perf/cpumap.h>

#include "../util/stat.h"
#include <subcmd/parse-options.h>
#include "bench.h"
#include "cpumap.h"

#include <err.h>

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/bench/epoll-wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@
#include <sys/epoll.h>
#include <sys/eventfd.h>
#include <sys/types.h>
#include <internal/cpumap.h>
#include <perf/cpumap.h>

#include "../util/stat.h"
#include <subcmd/parse-options.h>
#include "bench.h"
#include "cpumap.h"

#include <err.h>

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/bench/futex-hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
#include <linux/kernel.h>
#include <linux/zalloc.h>
#include <sys/time.h>
#include <internal/cpumap.h>
#include <perf/cpumap.h>

#include "../util/stat.h"
#include <subcmd/parse-options.h>
#include "bench.h"
#include "futex.h"
#include "cpumap.h"

#include <err.h>

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/bench/futex-lock-pi.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#include <linux/kernel.h>
#include <linux/zalloc.h>
#include <errno.h>
#include <internal/cpumap.h>
#include <perf/cpumap.h>
#include "bench.h"
#include "futex.h"
#include "cpumap.h"

#include <err.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/bench/futex-requeue.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#include <linux/kernel.h>
#include <linux/time64.h>
#include <errno.h>
#include <internal/cpumap.h>
#include <perf/cpumap.h>
#include "bench.h"
#include "futex.h"
#include "cpumap.h"

#include <err.h>
#include <stdlib.h>
Expand Down
3 changes: 2 additions & 1 deletion tools/perf/bench/futex-wake-parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ int bench_futex_wake_parallel(int argc __maybe_unused, const char **argv __maybe
#include <linux/time64.h>
#include <errno.h>
#include "futex.h"
#include "cpumap.h"
#include <internal/cpumap.h>
#include <perf/cpumap.h>

#include <err.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/bench/futex-wake.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#include <linux/kernel.h>
#include <linux/time64.h>
#include <errno.h>
#include <internal/cpumap.h>
#include <perf/cpumap.h>
#include "bench.h"
#include "futex.h"
#include "cpumap.h"

#include <err.h>
#include <stdlib.h>
Expand Down
1 change: 0 additions & 1 deletion tools/perf/bench/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/* For the CLR_() macros */
#include <pthread.h>

#include "../builtin.h"
#include <subcmd/parse-options.h>
#include "../util/cloexec.h"

Expand Down
Loading

0 comments on commit 351a1f5

Please sign in to comment.