Skip to content

Commit

Permalink
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "No kernel side changes, all tooling fixes plus two tooling cleanups
  that were committed late in the merge window alongside the perf
  annotate fixes, delayed by Arnaldo's European trip"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits)
  perf annotate: Fix segfault with source toggle
  perf annotate: Align struct annotate_args
  perf annotate: Simplify disasm_line allocation and freeing code
  perf annotate: Remove privsize from symbol__annotate() args
  perf probe: Check return value of strlist__add() for -ENOMEM
  perf config: Document missing config options
  perf annotate: Fix perf config option description
  perf annotate: Prefer cmdline option over default config
  perf annotate: Make perf config effective
  perf config: Introduce perf_config_u8()
  perf annotate: Fix --show-nr-samples for tui/stdio2
  perf annotate: Fix --show-total-period for tui/stdio2
  perf annotate/tui: Re-render title bar after switching back from script browser
  tools headers UAPI: Update tools's copy of kvm.h headers
  tools arch x86: Sync the msr-index.h copy with the kernel sources
  perf arch powerpc: Sync powerpc syscall.tbl with the kernel sources
  perf auxtrace: Add auxtrace_record__read_finish()
  perf arm-spe: Fix endless record after being terminated
  perf cs-etm: Fix endless record after being terminated
  perf intel-bts: Fix endless record after being terminated
  ...
  • Loading branch information
Linus Torvalds committed Mar 2, 2020
2 parents e130a92 + 7977fed commit 852fb4a
Show file tree
Hide file tree
Showing 25 changed files with 251 additions and 214 deletions.
2 changes: 2 additions & 0 deletions tools/arch/x86/include/asm/msr-index.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@
#define MSR_K7_HWCR 0xc0010015
#define MSR_K7_HWCR_SMMLOCK_BIT 0
#define MSR_K7_HWCR_SMMLOCK BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT)
#define MSR_K7_HWCR_IRPERF_EN_BIT 30
#define MSR_K7_HWCR_IRPERF_EN BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT)
#define MSR_K7_FID_VID_CTL 0xc0010041
#define MSR_K7_FID_VID_STATUS 0xc0010042

Expand Down
1 change: 1 addition & 0 deletions tools/arch/x86/include/uapi/asm/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ struct kvm_sync_regs {
#define KVM_STATE_NESTED_GUEST_MODE 0x00000001
#define KVM_STATE_NESTED_RUN_PENDING 0x00000002
#define KVM_STATE_NESTED_EVMCS 0x00000004
#define KVM_STATE_NESTED_MTF_PENDING 0x00000008

#define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001
#define KVM_STATE_NESTED_SMM_VMXON 0x00000002
Expand Down
74 changes: 73 additions & 1 deletion tools/perf/Documentation/perf-config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ buildid.*::
set buildid.dir to /dev/null. The default is $HOME/.debug

annotate.*::
These options work only for TUI.
These are in control of addresses, jump function, source code
in lines of assembly code from a specific program.

Expand Down Expand Up @@ -269,6 +268,8 @@ annotate.*::
│ mov (%rdi),%rdx
│ return n;

This option works with tui, stdio2 browsers.

annotate.use_offset::
Basing on a first address of a loaded function, offset can be used.
Instead of using original addresses of assembly code,
Expand All @@ -287,6 +288,8 @@ annotate.*::

368:│ mov 0x8(%r14),%rdi

This option works with tui, stdio2 browsers.

annotate.jump_arrows::
There can be jump instruction among assembly code.
Depending on a boolean value of jump_arrows,
Expand All @@ -306,6 +309,8 @@ annotate.*::
│1330: mov %r15,%r10
│1333: cmp %r15,%r14

This option works with tui browser.

annotate.show_linenr::
When showing source code if this option is 'true',
line numbers are printed as below.
Expand All @@ -325,6 +330,8 @@ annotate.*::
│ array++;
│ }

This option works with tui, stdio2 browsers.

annotate.show_nr_jumps::
Let's see a part of assembly code.

Expand All @@ -335,6 +342,8 @@ annotate.*::

│1 1382: movb $0x1,-0x270(%rbp)

This option works with tui, stdio2 browsers.

annotate.show_total_period::
To compare two records on an instruction base, with this option
provided, display total number of samples that belong to a line
Expand All @@ -348,11 +357,30 @@ annotate.*::

99.93 │ mov %eax,%eax

This option works with tui, stdio2, stdio browsers.

annotate.show_nr_samples::
By default perf annotate shows percentage of samples. This option
can be used to print absolute number of samples. Ex, when set as
false:

Percent│
74.03 │ mov %fs:0x28,%rax

When set as true:

Samples│
6 │ mov %fs:0x28,%rax

This option works with tui, stdio2, stdio browsers.

annotate.offset_level::
Default is '1', meaning just jump targets will have offsets show right beside
the instruction. When set to '2' 'call' instructions will also have its offsets
shown, 3 or higher will show offsets for all instructions.

This option works with tui, stdio2 browsers.

hist.*::
hist.percentage::
This option control the way to calculate overhead of filtered entries -
Expand Down Expand Up @@ -490,6 +518,12 @@ top.*::
column by default.
The default is 'true'.

top.call-graph::
This is identical to 'call-graph.record-mode', except it is
applicable only for 'top' subcommand. This option ONLY setup
the unwind method. To enable 'perf top' to actually use it,
the command line option -g must be specified.

man.*::
man.viewer::
This option can assign a tool to view manual pages when 'help'
Expand Down Expand Up @@ -517,6 +551,16 @@ record.*::
But if this option is 'no-cache', it will not update the build-id cache.
'skip' skips post-processing and does not update the cache.

record.call-graph::
This is identical to 'call-graph.record-mode', except it is
applicable only for 'record' subcommand. This option ONLY setup
the unwind method. To enable 'perf record' to actually use it,
the command line option -g must be specified.

record.aio::
Use 'n' control blocks in asynchronous (Posix AIO) trace writing
mode ('n' default: 1, max: 4).

diff.*::
diff.order::
This option sets the number of columns to sort the result.
Expand Down Expand Up @@ -566,6 +610,11 @@ trace.*::
"libbeauty", the default, to use the same argument beautifiers used in the
strace-like sys_enter+sys_exit lines.

ftrace.*::
ftrace.tracer::
Can be used to select the default tracer. Possible values are
'function' and 'function_graph'.

llvm.*::
llvm.clang-path::
Path to clang. If omit, search it from $PATH.
Expand Down Expand Up @@ -610,6 +659,29 @@ scripts.*::
The script gets the same options passed as a full perf script,
in particular -i perfdata file, --cpu, --tid

convert.*::

convert.queue-size::
Limit the size of ordered_events queue, so we could control
allocation size of perf data files without proper finished
round events.

intel-pt.*::

intel-pt.cache-divisor::

intel-pt.mispred-all::
If set, Intel PT decoder will set the mispred flag on all
branches.

auxtrace.*::

auxtrace.dumpdir::
s390 only. The directory to save the auxiliary trace buffer
can be changed using this option. Ex, auxtrace.dumpdir=/tmp.
If the directory does not exist or has the wrong file type,
the current directory is used.

SEE ALSO
--------
linkperf:perf[1]
18 changes: 2 additions & 16 deletions tools/perf/arch/arm/util/cs-etm.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,21 +858,6 @@ static void cs_etm_recording_free(struct auxtrace_record *itr)
free(ptr);
}

static int cs_etm_read_finish(struct auxtrace_record *itr, int idx)
{
struct cs_etm_recording *ptr =
container_of(itr, struct cs_etm_recording, itr);
struct evsel *evsel;

evlist__for_each_entry(ptr->evlist, evsel) {
if (evsel->core.attr.type == ptr->cs_etm_pmu->type)
return perf_evlist__enable_event_idx(ptr->evlist,
evsel, idx);
}

return -EINVAL;
}

struct auxtrace_record *cs_etm_record_init(int *err)
{
struct perf_pmu *cs_etm_pmu;
Expand All @@ -892,6 +877,7 @@ struct auxtrace_record *cs_etm_record_init(int *err)
}

ptr->cs_etm_pmu = cs_etm_pmu;
ptr->itr.pmu = cs_etm_pmu;
ptr->itr.parse_snapshot_options = cs_etm_parse_snapshot_options;
ptr->itr.recording_options = cs_etm_recording_options;
ptr->itr.info_priv_size = cs_etm_info_priv_size;
Expand All @@ -901,7 +887,7 @@ struct auxtrace_record *cs_etm_record_init(int *err)
ptr->itr.snapshot_finish = cs_etm_snapshot_finish;
ptr->itr.reference = cs_etm_reference;
ptr->itr.free = cs_etm_recording_free;
ptr->itr.read_finish = cs_etm_read_finish;
ptr->itr.read_finish = auxtrace_record__read_finish;

*err = 0;
return &ptr->itr;
Expand Down
17 changes: 2 additions & 15 deletions tools/perf/arch/arm64/util/arm-spe.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,6 @@ static void arm_spe_recording_free(struct auxtrace_record *itr)
free(sper);
}

static int arm_spe_read_finish(struct auxtrace_record *itr, int idx)
{
struct arm_spe_recording *sper =
container_of(itr, struct arm_spe_recording, itr);
struct evsel *evsel;

evlist__for_each_entry(sper->evlist, evsel) {
if (evsel->core.attr.type == sper->arm_spe_pmu->type)
return perf_evlist__enable_event_idx(sper->evlist,
evsel, idx);
}
return -EINVAL;
}

struct auxtrace_record *arm_spe_recording_init(int *err,
struct perf_pmu *arm_spe_pmu)
{
Expand All @@ -189,12 +175,13 @@ struct auxtrace_record *arm_spe_recording_init(int *err,
}

sper->arm_spe_pmu = arm_spe_pmu;
sper->itr.pmu = arm_spe_pmu;
sper->itr.recording_options = arm_spe_recording_options;
sper->itr.info_priv_size = arm_spe_info_priv_size;
sper->itr.info_fill = arm_spe_info_fill;
sper->itr.free = arm_spe_recording_free;
sper->itr.reference = arm_spe_reference;
sper->itr.read_finish = arm_spe_read_finish;
sper->itr.read_finish = auxtrace_record__read_finish;
sper->itr.alignment = 0;

*err = 0;
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,5 @@
433 common fspick sys_fspick
434 common pidfd_open sys_pidfd_open
435 nospu clone3 ppc_clone3
437 common openat2 sys_openat2
438 common pidfd_getfd sys_pidfd_getfd
17 changes: 2 additions & 15 deletions tools/perf/arch/x86/util/intel-bts.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,20 +413,6 @@ static int intel_bts_find_snapshot(struct auxtrace_record *itr, int idx,
return err;
}

static int intel_bts_read_finish(struct auxtrace_record *itr, int idx)
{
struct intel_bts_recording *btsr =
container_of(itr, struct intel_bts_recording, itr);
struct evsel *evsel;

evlist__for_each_entry(btsr->evlist, evsel) {
if (evsel->core.attr.type == btsr->intel_bts_pmu->type)
return perf_evlist__enable_event_idx(btsr->evlist,
evsel, idx);
}
return -EINVAL;
}

struct auxtrace_record *intel_bts_recording_init(int *err)
{
struct perf_pmu *intel_bts_pmu = perf_pmu__find(INTEL_BTS_PMU_NAME);
Expand All @@ -447,6 +433,7 @@ struct auxtrace_record *intel_bts_recording_init(int *err)
}

btsr->intel_bts_pmu = intel_bts_pmu;
btsr->itr.pmu = intel_bts_pmu;
btsr->itr.recording_options = intel_bts_recording_options;
btsr->itr.info_priv_size = intel_bts_info_priv_size;
btsr->itr.info_fill = intel_bts_info_fill;
Expand All @@ -456,7 +443,7 @@ struct auxtrace_record *intel_bts_recording_init(int *err)
btsr->itr.find_snapshot = intel_bts_find_snapshot;
btsr->itr.parse_snapshot_options = intel_bts_parse_snapshot_options;
btsr->itr.reference = intel_bts_reference;
btsr->itr.read_finish = intel_bts_read_finish;
btsr->itr.read_finish = auxtrace_record__read_finish;
btsr->itr.alignment = sizeof(struct branch);
return &btsr->itr;
}
17 changes: 2 additions & 15 deletions tools/perf/arch/x86/util/intel-pt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,20 +1166,6 @@ static u64 intel_pt_reference(struct auxtrace_record *itr __maybe_unused)
return rdtsc();
}

static int intel_pt_read_finish(struct auxtrace_record *itr, int idx)
{
struct intel_pt_recording *ptr =
container_of(itr, struct intel_pt_recording, itr);
struct evsel *evsel;

evlist__for_each_entry(ptr->evlist, evsel) {
if (evsel->core.attr.type == ptr->intel_pt_pmu->type)
return perf_evlist__enable_event_idx(ptr->evlist, evsel,
idx);
}
return -EINVAL;
}

struct auxtrace_record *intel_pt_recording_init(int *err)
{
struct perf_pmu *intel_pt_pmu = perf_pmu__find(INTEL_PT_PMU_NAME);
Expand All @@ -1200,6 +1186,7 @@ struct auxtrace_record *intel_pt_recording_init(int *err)
}

ptr->intel_pt_pmu = intel_pt_pmu;
ptr->itr.pmu = intel_pt_pmu;
ptr->itr.recording_options = intel_pt_recording_options;
ptr->itr.info_priv_size = intel_pt_info_priv_size;
ptr->itr.info_fill = intel_pt_info_fill;
Expand All @@ -1209,7 +1196,7 @@ struct auxtrace_record *intel_pt_recording_init(int *err)
ptr->itr.find_snapshot = intel_pt_find_snapshot;
ptr->itr.parse_snapshot_options = intel_pt_parse_snapshot_options;
ptr->itr.reference = intel_pt_reference;
ptr->itr.read_finish = intel_pt_read_finish;
ptr->itr.read_finish = auxtrace_record__read_finish;
/*
* Decoding starts at a PSB packet. Minimum PSB period is 2K so 4K
* should give at least 1 PSB per sample.
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,8 @@ int cmd_annotate(int argc, const char **argv)
if (ret < 0)
return ret;

annotation_config__init(&annotate.opts);

argc = parse_options(argc, argv, options, annotate_usage, 0);
if (argc) {
/*
Expand Down Expand Up @@ -605,8 +607,6 @@ int cmd_annotate(int argc, const char **argv)
if (ret < 0)
goto out_delete;

annotation_config__init();

symbol_conf.try_vmlinux_path = true;

ret = symbol__init(&annotate.session->header.env);
Expand Down
6 changes: 4 additions & 2 deletions tools/perf/builtin-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ static int perf_del_probe_events(struct strfilter *filter)
ret = probe_file__del_strlist(kfd, klist);
if (ret < 0)
goto error;
}
} else if (ret == -ENOMEM)
goto error;

ret2 = probe_file__get_events(ufd, filter, ulist);
if (ret2 == 0) {
Expand All @@ -459,7 +460,8 @@ static int perf_del_probe_events(struct strfilter *filter)
ret2 = probe_file__del_strlist(ufd, ulist);
if (ret2 < 0)
goto error;
}
} else if (ret2 == -ENOMEM)
goto error;

if (ret == -ENOENT && ret2 == -ENOENT)
pr_warning("\"%s\" does not hit any event.\n", str);
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ int cmd_report(int argc, const char **argv)
symbol_conf.priv_size += sizeof(u32);
symbol_conf.sort_by_name = true;
}
annotation_config__init();
annotation_config__init(&report.annotation_opts);
}

if (symbol__init(&session->header.env) < 0)
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
return err;
}

err = symbol__annotate(&he->ms, evsel, 0, &top->annotation_opts, NULL);
err = symbol__annotate(&he->ms, evsel, &top->annotation_opts, NULL);
if (err == 0) {
top->sym_filter_entry = he;
} else {
Expand Down Expand Up @@ -1683,7 +1683,7 @@ int cmd_top(int argc, const char **argv)
if (status < 0)
goto out_delete_evlist;

annotation_config__init();
annotation_config__init(&top.annotation_opts);

symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
status = symbol__init(NULL);
Expand Down
Loading

0 comments on commit 852fb4a

Please sign in to comment.