Skip to content

Commit

Permalink
Merge tag 'perf-urgent-for-mingo-5.6-20200228' 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/urgent fixes from Arnaldo Carvalho de Melo:

perf annotate:

  Ravi Bangoria:

  - Fix segfault with source toggle.

  - Fix --show-total-period and --show-nr-samples for tui/stdio2.

  - Fix handling of settings in ~/.perfconfig versus the ones passed
    in the command line

  - Re-render title bar after switching back from script browser.

  - Fix options man page, document some missing ones.

perf probe:

  He Zhe:

  - Check return value of strlist__add() for -ENOMEM.

tools UAPI:

  Arnaldo Carvalho de Melo:

  - Sync x86's msr-index.h copy with the kernel sources.

  - Update tools's copy of x86's kvm.h headers.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Feb 29, 2020
2 parents 4c45945 + e0560ba commit 7977fed
Show file tree
Hide file tree
Showing 14 changed files with 210 additions and 148 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]
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
19 changes: 9 additions & 10 deletions tools/perf/ui/browsers/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,10 +754,9 @@ static int annotate_browser__run(struct annotate_browser *browser,
"? Search string backwards\n");
continue;
case 'r':
{
script_browse(NULL, NULL);
continue;
}
script_browse(NULL, NULL);
annotate_browser__show(&browser->b, title, help);
continue;
case 'k':
notes->options->show_linenr = !notes->options->show_linenr;
break;
Expand Down Expand Up @@ -834,13 +833,13 @@ static int annotate_browser__run(struct annotate_browser *browser,
map_symbol__annotation_dump(ms, evsel, browser->opts);
continue;
case 't':
if (notes->options->show_total_period) {
notes->options->show_total_period = false;
notes->options->show_nr_samples = true;
} else if (notes->options->show_nr_samples)
notes->options->show_nr_samples = false;
if (symbol_conf.show_total_period) {
symbol_conf.show_total_period = false;
symbol_conf.show_nr_samples = true;
} else if (symbol_conf.show_nr_samples)
symbol_conf.show_nr_samples = false;
else
notes->options->show_total_period = true;
symbol_conf.show_total_period = true;
annotation__update_column_widths(notes);
continue;
case 'c':
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/ui/gtk/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,
if (ms->map->dso->annotate_warned)
return -1;

err = symbol__annotate(ms, evsel, 0, &annotation__default_options, NULL);
err = symbol__annotate(ms, evsel, &annotation__default_options, NULL);
if (err) {
char msg[BUFSIZ];
symbol__strerror_disassemble(ms, err, msg, sizeof(msg));
Expand Down
Loading

0 comments on commit 7977fed

Please sign in to comment.