aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-11-01 02:47:40 -0400
committerIngo Molnar <mingo@kernel.org>2016-11-01 02:47:40 -0400
commitc29c716662d0cefc0cda4903aea5ed6794174679 (patch)
tree01d4dc47933e1bcbeca8d53b0cf5c1f70da04535 /tools
parente63650840e8b053aa09ad934877e87e9941ed135 (diff)
parent405c0759712f57b680f66aee9c55cd06ad1cbdef (diff)
Merge branch 'core/urgent' into x86/fpu, to merge fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/arch/x86/include/asm/cpufeatures.h2
-rw-r--r--tools/objtool/arch/x86/decode.c9
-rw-r--r--tools/objtool/builtin-check.c68
-rw-r--r--tools/perf/jvmti/Makefile2
-rw-r--r--tools/perf/ui/browsers/hists.c3
-rw-r--r--tools/perf/util/header.c2
-rw-r--r--tools/perf/util/parse-events.l4
7 files changed, 52 insertions, 38 deletions
diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h
index 2599222215c9..cddd5d06e1cb 100644
--- a/tools/arch/x86/include/asm/cpufeatures.h
+++ b/tools/arch/x86/include/asm/cpufeatures.h
@@ -193,6 +193,8 @@
193#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ 193#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */
194 194
195#define X86_FEATURE_INTEL_PT ( 7*32+15) /* Intel Processor Trace */ 195#define X86_FEATURE_INTEL_PT ( 7*32+15) /* Intel Processor Trace */
196#define X86_FEATURE_AVX512_4VNNIW (7*32+16) /* AVX-512 Neural Network Instructions */
197#define X86_FEATURE_AVX512_4FMAPS (7*32+17) /* AVX-512 Multiply Accumulation Single precision */
196 198
197/* Virtualization flags: Linux defined, word 8 */ 199/* Virtualization flags: Linux defined, word 8 */
198#define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ 200#define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */
diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index c0c0b265e88e..b63a31be1218 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -98,6 +98,15 @@ int arch_decode_instruction(struct elf *elf, struct section *sec,
98 *type = INSN_FP_SETUP; 98 *type = INSN_FP_SETUP;
99 break; 99 break;
100 100
101 case 0x8d:
102 if (insn.rex_prefix.bytes &&
103 insn.rex_prefix.bytes[0] == 0x48 &&
104 insn.modrm.nbytes && insn.modrm.bytes[0] == 0x2c &&
105 insn.sib.nbytes && insn.sib.bytes[0] == 0x24)
106 /* lea %(rsp), %rbp */
107 *type = INSN_FP_SETUP;
108 break;
109
101 case 0x90: 110 case 0x90:
102 *type = INSN_NOP; 111 *type = INSN_NOP;
103 break; 112 break;
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 143b6cdd7f06..e8a1f699058a 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -97,6 +97,19 @@ static struct instruction *next_insn_same_sec(struct objtool_file *file,
97 return next; 97 return next;
98} 98}
99 99
100static bool gcov_enabled(struct objtool_file *file)
101{
102 struct section *sec;
103 struct symbol *sym;
104
105 list_for_each_entry(sec, &file->elf->sections, list)
106 list_for_each_entry(sym, &sec->symbol_list, list)
107 if (!strncmp(sym->name, "__gcov_.", 8))
108 return true;
109
110 return false;
111}
112
100#define for_each_insn(file, insn) \ 113#define for_each_insn(file, insn) \
101 list_for_each_entry(insn, &file->insn_list, list) 114 list_for_each_entry(insn, &file->insn_list, list)
102 115
@@ -713,6 +726,7 @@ static struct rela *find_switch_table(struct objtool_file *file,
713 struct instruction *insn) 726 struct instruction *insn)
714{ 727{
715 struct rela *text_rela, *rodata_rela; 728 struct rela *text_rela, *rodata_rela;
729 struct instruction *orig_insn = insn;
716 730
717 text_rela = find_rela_by_dest_range(insn->sec, insn->offset, insn->len); 731 text_rela = find_rela_by_dest_range(insn->sec, insn->offset, insn->len);
718 if (text_rela && text_rela->sym == file->rodata->sym) { 732 if (text_rela && text_rela->sym == file->rodata->sym) {
@@ -733,10 +747,16 @@ static struct rela *find_switch_table(struct objtool_file *file,
733 747
734 /* case 3 */ 748 /* case 3 */
735 func_for_each_insn_continue_reverse(file, func, insn) { 749 func_for_each_insn_continue_reverse(file, func, insn) {
736 if (insn->type == INSN_JUMP_UNCONDITIONAL || 750 if (insn->type == INSN_JUMP_DYNAMIC)
737 insn->type == INSN_JUMP_DYNAMIC)
738 break; 751 break;
739 752
753 /* allow small jumps within the range */
754 if (insn->type == INSN_JUMP_UNCONDITIONAL &&
755 insn->jump_dest &&
756 (insn->jump_dest->offset <= insn->offset ||
757 insn->jump_dest->offset > orig_insn->offset))
758 break;
759
740 text_rela = find_rela_by_dest_range(insn->sec, insn->offset, 760 text_rela = find_rela_by_dest_range(insn->sec, insn->offset,
741 insn->len); 761 insn->len);
742 if (text_rela && text_rela->sym == file->rodata->sym) 762 if (text_rela && text_rela->sym == file->rodata->sym)
@@ -1034,34 +1054,6 @@ static int validate_branch(struct objtool_file *file,
1034 return 0; 1054 return 0;
1035} 1055}
1036 1056
1037static bool is_gcov_insn(struct instruction *insn)
1038{
1039 struct rela *rela;
1040 struct section *sec;
1041 struct symbol *sym;
1042 unsigned long offset;
1043
1044 rela = find_rela_by_dest_range(insn->sec, insn->offset, insn->len);
1045 if (!rela)
1046 return false;
1047
1048 if (rela->sym->type != STT_SECTION)
1049 return false;
1050
1051 sec = rela->sym->sec;
1052 offset = rela->addend + insn->offset + insn->len - rela->offset;
1053
1054 list_for_each_entry(sym, &sec->symbol_list, list) {
1055 if (sym->type != STT_OBJECT)
1056 continue;
1057
1058 if (offset >= sym->offset && offset < sym->offset + sym->len)
1059 return (!memcmp(sym->name, "__gcov0.", 8));
1060 }
1061
1062 return false;
1063}
1064
1065static bool is_kasan_insn(struct instruction *insn) 1057static bool is_kasan_insn(struct instruction *insn)
1066{ 1058{
1067 return (insn->type == INSN_CALL && 1059 return (insn->type == INSN_CALL &&
@@ -1083,9 +1075,6 @@ static bool ignore_unreachable_insn(struct symbol *func,
1083 if (insn->type == INSN_NOP) 1075 if (insn->type == INSN_NOP)
1084 return true; 1076 return true;
1085 1077
1086 if (is_gcov_insn(insn))
1087 return true;
1088
1089 /* 1078 /*
1090 * Check if this (or a subsequent) instruction is related to 1079 * Check if this (or a subsequent) instruction is related to
1091 * CONFIG_UBSAN or CONFIG_KASAN. 1080 * CONFIG_UBSAN or CONFIG_KASAN.
@@ -1146,6 +1135,19 @@ static int validate_functions(struct objtool_file *file)
1146 ignore_unreachable_insn(func, insn)) 1135 ignore_unreachable_insn(func, insn))
1147 continue; 1136 continue;
1148 1137
1138 /*
1139 * gcov produces a lot of unreachable
1140 * instructions. If we get an unreachable
1141 * warning and the file has gcov enabled, just
1142 * ignore it, and all other such warnings for
1143 * the file.
1144 */
1145 if (!file->ignore_unreachables &&
1146 gcov_enabled(file)) {
1147 file->ignore_unreachables = true;
1148 continue;
1149 }
1150
1149 WARN_FUNC("function has unreachable instruction", insn->sec, insn->offset); 1151 WARN_FUNC("function has unreachable instruction", insn->sec, insn->offset);
1150 warnings++; 1152 warnings++;
1151 } 1153 }
diff --git a/tools/perf/jvmti/Makefile b/tools/perf/jvmti/Makefile
index 5ce61a1bda9c..df14e6b67b63 100644
--- a/tools/perf/jvmti/Makefile
+++ b/tools/perf/jvmti/Makefile
@@ -36,7 +36,7 @@ SOLIBEXT=so
36# The following works at least on fedora 23, you may need the next 36# The following works at least on fedora 23, you may need the next
37# line for other distros. 37# line for other distros.
38ifneq (,$(wildcard /usr/sbin/update-java-alternatives)) 38ifneq (,$(wildcard /usr/sbin/update-java-alternatives))
39JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | cut -d ' ' -f 3) 39JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')
40else 40else
41 ifneq (,$(wildcard /usr/sbin/alternatives)) 41 ifneq (,$(wildcard /usr/sbin/alternatives))
42 JDIR=$(shell alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g') 42 JDIR=$(shell alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g')
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index fb8e42c7507a..4ffff7be9299 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -601,7 +601,8 @@ int hist_browser__run(struct hist_browser *browser, const char *help)
601 u64 nr_entries; 601 u64 nr_entries;
602 hbt->timer(hbt->arg); 602 hbt->timer(hbt->arg);
603 603
604 if (hist_browser__has_filter(browser)) 604 if (hist_browser__has_filter(browser) ||
605 symbol_conf.report_hierarchy)
605 hist_browser__update_nr_entries(browser); 606 hist_browser__update_nr_entries(browser);
606 607
607 nr_entries = hist_browser__nr_entries(browser); 608 nr_entries = hist_browser__nr_entries(browser);
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 85dd0db0a127..2f3eded54b0c 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1895,7 +1895,6 @@ static int process_numa_topology(struct perf_file_section *section __maybe_unuse
1895 if (ph->needs_swap) 1895 if (ph->needs_swap)
1896 nr = bswap_32(nr); 1896 nr = bswap_32(nr);
1897 1897
1898 ph->env.nr_numa_nodes = nr;
1899 nodes = zalloc(sizeof(*nodes) * nr); 1898 nodes = zalloc(sizeof(*nodes) * nr);
1900 if (!nodes) 1899 if (!nodes)
1901 return -ENOMEM; 1900 return -ENOMEM;
@@ -1932,6 +1931,7 @@ static int process_numa_topology(struct perf_file_section *section __maybe_unuse
1932 1931
1933 free(str); 1932 free(str);
1934 } 1933 }
1934 ph->env.nr_numa_nodes = nr;
1935 ph->env.numa_nodes = nodes; 1935 ph->env.numa_nodes = nodes;
1936 return 0; 1936 return 0;
1937 1937
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 9f43fda2570f..660fca05bc93 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -136,8 +136,8 @@ do { \
136group [^,{}/]*[{][^}]*[}][^,{}/]* 136group [^,{}/]*[{][^}]*[}][^,{}/]*
137event_pmu [^,{}/]+[/][^/]*[/][^,{}/]* 137event_pmu [^,{}/]+[/][^/]*[/][^,{}/]*
138event [^,{}/]+ 138event [^,{}/]+
139bpf_object .*\.(o|bpf) 139bpf_object [^,{}]+\.(o|bpf)
140bpf_source .*\.c 140bpf_source [^,{}]+\.c
141 141
142num_dec [0-9]+ 142num_dec [0-9]+
143num_hex 0x[a-fA-F0-9]+ 143num_hex 0x[a-fA-F0-9]+