Skip to content

Commit 629ae2e

Browse files
author
Ingo Molnar
committed
Merge tag 'perf-urgent-for-mingo-4.16-20180306' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/urgent fixes from Arnaldo Carvalho de Melo: - Be more robust when drawing arrows in the annotation TUI, avoiding a segfault when jump instructions have as a target addresses in functions other that the one currently being annotated. The full fix will come in the following days, when jumping to other functions will work as call instructions (Arnaldo Carvalho de Melo) - Prevent auxtrace_queues__process_index() from queuing AUX area data for decoding when the --no-itrace option has been used (Adrian Hunter) - Sync copy of kvm UAPI headers and x86's cpufeatures.h (Arnaldo Carvalho de Melo) - Fix 'perf stat' CSV output format for non-supported counters (Ilya Pronin) - Fix crash in 'perf record|perf report' pipe mode (Jiri Olsa) - Fix annoying 'perf top' overwrite fallback message on older kernels (Kan Liang) - Fix the usage on the 'perf kallsyms' man page (Sangwon Hong) Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2 parents 3176609 + de19e5c commit 629ae2e

File tree

11 files changed

+61
-15
lines changed

11 files changed

+61
-15
lines changed

tools/arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@
213213
#define X86_FEATURE_SEV ( 7*32+20) /* AMD Secure Encrypted Virtualization */
214214

215215
#define X86_FEATURE_USE_IBPB ( 7*32+21) /* "" Indirect Branch Prediction Barrier enabled */
216+
#define X86_FEATURE_USE_IBRS_FW ( 7*32+22) /* "" Use IBRS during runtime firmware calls */
216217

217218
/* Virtualization flags: Linux defined, word 8 */
218219
#define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */

tools/include/uapi/linux/kvm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ struct kvm_ppc_resize_hpt {
761761
#define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07
762762
#define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08
763763
#define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2)
764+
#define KVM_GET_MSR_FEATURE_INDEX_LIST _IOWR(KVMIO, 0x0a, struct kvm_msr_list)
764765

765766
/*
766767
* Extension capability list.
@@ -934,6 +935,7 @@ struct kvm_ppc_resize_hpt {
934935
#define KVM_CAP_S390_AIS_MIGRATION 150
935936
#define KVM_CAP_PPC_GET_CPU_CHAR 151
936937
#define KVM_CAP_S390_BPB 152
938+
#define KVM_CAP_GET_MSR_FEATURES 153
937939

938940
#ifdef KVM_CAP_IRQ_ROUTING
939941

tools/perf/Documentation/perf-kallsyms.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ perf-kallsyms - Searches running kernel for symbols
88
SYNOPSIS
99
--------
1010
[verse]
11-
'perf kallsyms <options> symbol_name[,symbol_name...]'
11+
'perf kallsyms' [<options>] symbol_name[,symbol_name...]
1212

1313
DESCRIPTION
1414
-----------

tools/perf/builtin-record.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,15 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
881881
}
882882
}
883883

884+
/*
885+
* If we have just single event and are sending data
886+
* through pipe, we need to force the ids allocation,
887+
* because we synthesize event name through the pipe
888+
* and need the id for that.
889+
*/
890+
if (data->is_pipe && rec->evlist->nr_entries == 1)
891+
rec->opts.sample_id = true;
892+
884893
if (record__open(rec) != 0) {
885894
err = -1;
886895
goto out_child;

tools/perf/builtin-stat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ static void print_metric_csv(void *ctx,
917917
char buf[64], *vals, *ends;
918918

919919
if (unit == NULL || fmt == NULL) {
920-
fprintf(out, "%s%s%s%s", csv_sep, csv_sep, csv_sep, csv_sep);
920+
fprintf(out, "%s%s", csv_sep, csv_sep);
921921
return;
922922
}
923923
snprintf(buf, sizeof(buf), fmt, val);

tools/perf/builtin-top.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ static int perf_top_overwrite_fallback(struct perf_top *top,
991991
evlist__for_each_entry(evlist, counter)
992992
counter->attr.write_backward = false;
993993
opts->overwrite = false;
994-
ui__warning("fall back to non-overwrite mode\n");
994+
pr_debug2("fall back to non-overwrite mode\n");
995995
return 1;
996996
}
997997

tools/perf/perf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct record_opts {
6161
bool tail_synthesize;
6262
bool overwrite;
6363
bool ignore_missing_thread;
64+
bool sample_id;
6465
unsigned int freq;
6566
unsigned int mmap_pages;
6667
unsigned int auxtrace_mmap_pages;

tools/perf/ui/browsers/annotate.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,32 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)
327327
if (!disasm_line__is_valid_jump(cursor, sym))
328328
return;
329329

330+
/*
331+
* This first was seen with a gcc function, _cpp_lex_token, that
332+
* has the usual jumps:
333+
*
334+
* │1159e6c: ↓ jne 115aa32 <_cpp_lex_token@@Base+0xf92>
335+
*
336+
* I.e. jumps to a label inside that function (_cpp_lex_token), and
337+
* those works, but also this kind:
338+
*
339+
* │1159e8b: ↓ jne c469be <cpp_named_operator2name@@Base+0xa72>
340+
*
341+
* I.e. jumps to another function, outside _cpp_lex_token, which
342+
* are not being correctly handled generating as a side effect references
343+
* to ab->offset[] entries that are set to NULL, so to make this code
344+
* more robust, check that here.
345+
*
346+
* A proper fix for will be put in place, looking at the function
347+
* name right after the '<' token and probably treating this like a
348+
* 'call' instruction.
349+
*/
330350
target = ab->offsets[cursor->ops.target.offset];
351+
if (target == NULL) {
352+
ui_helpline__printf("WARN: jump target inconsistency, press 'o', ab->offsets[%#x] = NULL\n",
353+
cursor->ops.target.offset);
354+
return;
355+
}
331356

332357
bcursor = browser_line(&cursor->al);
333358
btarget = browser_line(target);

tools/perf/util/auxtrace.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@
6060
#include "sane_ctype.h"
6161
#include "symbol/kallsyms.h"
6262

63+
static bool auxtrace__dont_decode(struct perf_session *session)
64+
{
65+
return !session->itrace_synth_opts ||
66+
session->itrace_synth_opts->dont_decode;
67+
}
68+
6369
int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
6470
struct auxtrace_mmap_params *mp,
6571
void *userpg, int fd)
@@ -762,6 +768,9 @@ int auxtrace_queues__process_index(struct auxtrace_queues *queues,
762768
size_t i;
763769
int err;
764770

771+
if (auxtrace__dont_decode(session))
772+
return 0;
773+
765774
list_for_each_entry(auxtrace_index, &session->auxtrace_index, list) {
766775
for (i = 0; i < auxtrace_index->nr; i++) {
767776
ent = &auxtrace_index->entries[i];
@@ -892,12 +901,6 @@ int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr,
892901
return err;
893902
}
894903

895-
static bool auxtrace__dont_decode(struct perf_session *session)
896-
{
897-
return !session->itrace_synth_opts ||
898-
session->itrace_synth_opts->dont_decode;
899-
}
900-
901904
int perf_event__process_auxtrace_info(struct perf_tool *tool __maybe_unused,
902905
union perf_event *event,
903906
struct perf_session *session)

tools/perf/util/record.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts,
137137
struct perf_evsel *evsel;
138138
bool use_sample_identifier = false;
139139
bool use_comm_exec;
140+
bool sample_id = opts->sample_id;
140141

141142
/*
142143
* Set the evsel leader links before we configure attributes,
@@ -163,8 +164,7 @@ void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts,
163164
* match the id.
164165
*/
165166
use_sample_identifier = perf_can_sample_identifier();
166-
evlist__for_each_entry(evlist, evsel)
167-
perf_evsel__set_sample_id(evsel, use_sample_identifier);
167+
sample_id = true;
168168
} else if (evlist->nr_entries > 1) {
169169
struct perf_evsel *first = perf_evlist__first(evlist);
170170

@@ -174,6 +174,10 @@ void perf_evlist__config(struct perf_evlist *evlist, struct record_opts *opts,
174174
use_sample_identifier = perf_can_sample_identifier();
175175
break;
176176
}
177+
sample_id = true;
178+
}
179+
180+
if (sample_id) {
177181
evlist__for_each_entry(evlist, evsel)
178182
perf_evsel__set_sample_id(evsel, use_sample_identifier);
179183
}

tools/perf/util/trigger.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* States and transits:
1313
*
1414
*
15-
* OFF--(on)--> READY --(hit)--> HIT
15+
* OFF--> ON --> READY --(hit)--> HIT
1616
* ^ |
1717
* | (ready)
1818
* | |
@@ -27,8 +27,9 @@ struct trigger {
2727
volatile enum {
2828
TRIGGER_ERROR = -2,
2929
TRIGGER_OFF = -1,
30-
TRIGGER_READY = 0,
31-
TRIGGER_HIT = 1,
30+
TRIGGER_ON = 0,
31+
TRIGGER_READY = 1,
32+
TRIGGER_HIT = 2,
3233
} state;
3334
const char *name;
3435
};
@@ -50,7 +51,7 @@ static inline bool trigger_is_error(struct trigger *t)
5051
static inline void trigger_on(struct trigger *t)
5152
{
5253
TRIGGER_WARN_ONCE(t, TRIGGER_OFF);
53-
t->state = TRIGGER_READY;
54+
t->state = TRIGGER_ON;
5455
}
5556

5657
static inline void trigger_ready(struct trigger *t)

0 commit comments

Comments
 (0)