aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-05-14 05:22:59 -0400
committerIngo Molnar <mingo@kernel.org>2018-05-14 05:22:59 -0400
commit4b96583869c4d990b779eca72976063970d41b8d (patch)
treef2fdb7760a06f6445f33fdee3ec512fbdb46fcb4 /tools
parent53667c670fe00d63246fb3cfb4480bb1ba247bcc (diff)
parent67b8d5c7081221efa252e111cd52532ec6d4266f (diff)
Merge tag 'v4.17-rc5' into irq/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/arch/arm/include/uapi/asm/kvm.h6
-rw-r--r--tools/arch/arm64/include/uapi/asm/kvm.h6
-rw-r--r--tools/arch/x86/include/asm/cpufeatures.h1
-rw-r--r--tools/bpf/Makefile2
-rw-r--r--tools/bpf/bpf_dbg.c7
-rw-r--r--tools/include/uapi/linux/kvm.h7
-rw-r--r--tools/perf/Documentation/perf-mem.txt41
-rw-r--r--tools/perf/arch/s390/util/auxtrace.c1
-rw-r--r--tools/perf/arch/s390/util/header.c18
-rw-r--r--tools/perf/bench/numa.c2
-rw-r--r--tools/perf/builtin-stat.c40
-rw-r--r--tools/perf/pmu-events/arch/s390/mapfile.csv10
-rw-r--r--tools/perf/pmu-events/arch/x86/mapfile.csv1
-rw-r--r--tools/perf/tests/attr/test-record-group-sampling3
-rwxr-xr-xtools/perf/tests/shell/record+probe_libc_inet_pton.sh6
-rw-r--r--tools/perf/util/evsel.c18
-rw-r--r--tools/perf/util/evsel.h1
-rw-r--r--tools/perf/util/machine.c30
-rw-r--r--tools/perf/util/pmu.c22
-rw-r--r--tools/power/acpi/Makefile.config1
-rw-r--r--tools/testing/selftests/bpf/.gitignore3
-rw-r--r--tools/testing/selftests/bpf/test_progs.c4
-rw-r--r--tools/testing/selftests/bpf/test_sock.c1
-rw-r--r--tools/testing/selftests/bpf/test_sock_addr.c1
-rwxr-xr-xtools/testing/selftests/bpf/test_sock_addr.sh4
-rw-r--r--tools/testing/selftests/firmware/Makefile1
-rwxr-xr-xtools/testing/selftests/firmware/fw_lib.sh10
-rwxr-xr-xtools/testing/selftests/firmware/fw_run_tests.sh2
-rw-r--r--tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc2
-rw-r--r--tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc44
-rw-r--r--tools/testing/selftests/lib.mk8
-rw-r--r--tools/testing/selftests/net/Makefile3
-rw-r--r--tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json11
-rw-r--r--tools/testing/selftests/x86/test_syscall_vdso.c35
34 files changed, 245 insertions, 107 deletions
diff --git a/tools/arch/arm/include/uapi/asm/kvm.h b/tools/arch/arm/include/uapi/asm/kvm.h
index 2ba95d6fe852..caae4843cb70 100644
--- a/tools/arch/arm/include/uapi/asm/kvm.h
+++ b/tools/arch/arm/include/uapi/asm/kvm.h
@@ -195,6 +195,12 @@ struct kvm_arch_memory_slot {
195#define KVM_REG_ARM_VFP_FPINST 0x1009 195#define KVM_REG_ARM_VFP_FPINST 0x1009
196#define KVM_REG_ARM_VFP_FPINST2 0x100A 196#define KVM_REG_ARM_VFP_FPINST2 0x100A
197 197
198/* KVM-as-firmware specific pseudo-registers */
199#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
200#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM | KVM_REG_SIZE_U64 | \
201 KVM_REG_ARM_FW | ((r) & 0xffff))
202#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
203
198/* Device Control API: ARM VGIC */ 204/* Device Control API: ARM VGIC */
199#define KVM_DEV_ARM_VGIC_GRP_ADDR 0 205#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
200#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 206#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h
index 9abbf3044654..04b3256f8e6d 100644
--- a/tools/arch/arm64/include/uapi/asm/kvm.h
+++ b/tools/arch/arm64/include/uapi/asm/kvm.h
@@ -206,6 +206,12 @@ struct kvm_arch_memory_slot {
206#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2) 206#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2)
207#define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2) 207#define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2)
208 208
209/* KVM-as-firmware specific pseudo-registers */
210#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
211#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \
212 KVM_REG_ARM_FW | ((r) & 0xffff))
213#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
214
209/* Device Control API: ARM VGIC */ 215/* Device Control API: ARM VGIC */
210#define KVM_DEV_ARM_VGIC_GRP_ADDR 0 216#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
211#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 217#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h
index d554c11e01ff..578793e97431 100644
--- a/tools/arch/x86/include/asm/cpufeatures.h
+++ b/tools/arch/x86/include/asm/cpufeatures.h
@@ -320,6 +320,7 @@
320#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */ 320#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */
321#define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */ 321#define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */
322#define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */ 322#define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */
323#define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */
323 324
324/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ 325/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */
325#define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */ 326#define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */
diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
index 1ea545965ee3..53b60ad452f5 100644
--- a/tools/bpf/Makefile
+++ b/tools/bpf/Makefile
@@ -76,6 +76,8 @@ $(OUTPUT)bpf_asm: $(OUTPUT)bpf_asm.o $(OUTPUT)bpf_exp.yacc.o $(OUTPUT)bpf_exp.le
76 $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^ 76 $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^
77 77
78$(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c 78$(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c
79$(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c
80$(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
79 81
80clean: bpftool_clean 82clean: bpftool_clean
81 $(call QUIET_CLEAN, bpf-progs) 83 $(call QUIET_CLEAN, bpf-progs)
diff --git a/tools/bpf/bpf_dbg.c b/tools/bpf/bpf_dbg.c
index 4f254bcc4423..61b9aa5d6415 100644
--- a/tools/bpf/bpf_dbg.c
+++ b/tools/bpf/bpf_dbg.c
@@ -1063,7 +1063,7 @@ static int cmd_load_pcap(char *file)
1063 1063
1064static int cmd_load(char *arg) 1064static int cmd_load(char *arg)
1065{ 1065{
1066 char *subcmd, *cont, *tmp = strdup(arg); 1066 char *subcmd, *cont = NULL, *tmp = strdup(arg);
1067 int ret = CMD_OK; 1067 int ret = CMD_OK;
1068 1068
1069 subcmd = strtok_r(tmp, " ", &cont); 1069 subcmd = strtok_r(tmp, " ", &cont);
@@ -1073,7 +1073,10 @@ static int cmd_load(char *arg)
1073 bpf_reset(); 1073 bpf_reset();
1074 bpf_reset_breakpoints(); 1074 bpf_reset_breakpoints();
1075 1075
1076 ret = cmd_load_bpf(cont); 1076 if (!cont)
1077 ret = CMD_ERR;
1078 else
1079 ret = cmd_load_bpf(cont);
1077 } else if (matches(subcmd, "pcap") == 0) { 1080 } else if (matches(subcmd, "pcap") == 0) {
1078 ret = cmd_load_pcap(cont); 1081 ret = cmd_load_pcap(cont);
1079 } else { 1082 } else {
diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h
index 1065006c9bf5..b02c41e53d56 100644
--- a/tools/include/uapi/linux/kvm.h
+++ b/tools/include/uapi/linux/kvm.h
@@ -676,6 +676,13 @@ struct kvm_ioeventfd {
676 __u8 pad[36]; 676 __u8 pad[36];
677}; 677};
678 678
679#define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0)
680#define KVM_X86_DISABLE_EXITS_HTL (1 << 1)
681#define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2)
682#define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | \
683 KVM_X86_DISABLE_EXITS_HTL | \
684 KVM_X86_DISABLE_EXITS_PAUSE)
685
679/* for KVM_ENABLE_CAP */ 686/* for KVM_ENABLE_CAP */
680struct kvm_enable_cap { 687struct kvm_enable_cap {
681 /* in */ 688 /* in */
diff --git a/tools/perf/Documentation/perf-mem.txt b/tools/perf/Documentation/perf-mem.txt
index 8806ed5f3802..f8d2167cf3e7 100644
--- a/tools/perf/Documentation/perf-mem.txt
+++ b/tools/perf/Documentation/perf-mem.txt
@@ -28,29 +28,46 @@ OPTIONS
28<command>...:: 28<command>...::
29 Any command you can specify in a shell. 29 Any command you can specify in a shell.
30 30
31-i::
32--input=<file>::
33 Input file name.
34
31-f:: 35-f::
32--force:: 36--force::
33 Don't do ownership validation 37 Don't do ownership validation
34 38
35-t:: 39-t::
36--type=:: 40--type=<type>::
37 Select the memory operation type: load or store (default: load,store) 41 Select the memory operation type: load or store (default: load,store)
38 42
39-D:: 43-D::
40--dump-raw-samples=:: 44--dump-raw-samples::
41 Dump the raw decoded samples on the screen in a format that is easy to parse with 45 Dump the raw decoded samples on the screen in a format that is easy to parse with
42 one sample per line. 46 one sample per line.
43 47
44-x:: 48-x::
45--field-separator:: 49--field-separator=<separator>::
46 Specify the field separator used when dump raw samples (-D option). By default, 50 Specify the field separator used when dump raw samples (-D option). By default,
47 The separator is the space character. 51 The separator is the space character.
48 52
49-C:: 53-C::
50--cpu-list:: 54--cpu=<cpu>::
51 Restrict dump of raw samples to those provided via this option. Note that the same 55 Monitor only on the list of CPUs provided. Multiple CPUs can be provided as a
52 option can be passed in record mode. It will be interpreted the same way as perf 56 comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2. Default
53 record. 57 is to monitor all CPUS.
58-U::
59--hide-unresolved::
60 Only display entries resolved to a symbol.
61
62-p::
63--phys-data::
64 Record/Report sample physical addresses
65
66RECORD OPTIONS
67--------------
68-e::
69--event <event>::
70 Event selector. Use 'perf mem record -e list' to list available events.
54 71
55-K:: 72-K::
56--all-kernel:: 73--all-kernel::
@@ -60,12 +77,12 @@ OPTIONS
60--all-user:: 77--all-user::
61 Configure all used events to run in user space. 78 Configure all used events to run in user space.
62 79
63--ldload:: 80-v::
64 Specify desired latency for loads event. 81--verbose::
82 Be more verbose (show counter open errors, etc)
65 83
66-p:: 84--ldlat <n>::
67--phys-data:: 85 Specify desired latency for loads event.
68 Record/Report sample physical addresses
69 86
70In addition, for report all perf report options are valid, and for record 87In addition, for report all perf report options are valid, and for record
71all perf record options. 88all perf record options.
diff --git a/tools/perf/arch/s390/util/auxtrace.c b/tools/perf/arch/s390/util/auxtrace.c
index 6cb48e4cffd9..3afe8256eff2 100644
--- a/tools/perf/arch/s390/util/auxtrace.c
+++ b/tools/perf/arch/s390/util/auxtrace.c
@@ -87,6 +87,7 @@ struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
87 struct perf_evsel *pos; 87 struct perf_evsel *pos;
88 int diagnose = 0; 88 int diagnose = 0;
89 89
90 *err = 0;
90 if (evlist->nr_entries == 0) 91 if (evlist->nr_entries == 0)
91 return NULL; 92 return NULL;
92 93
diff --git a/tools/perf/arch/s390/util/header.c b/tools/perf/arch/s390/util/header.c
index a4c30f1c70be..163b92f33998 100644
--- a/tools/perf/arch/s390/util/header.c
+++ b/tools/perf/arch/s390/util/header.c
@@ -146,21 +146,3 @@ char *get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
146 zfree(&buf); 146 zfree(&buf);
147 return buf; 147 return buf;
148} 148}
149
150/*
151 * Compare the cpuid string returned by get_cpuid() function
152 * with the name generated by the jevents file read from
153 * pmu-events/arch/s390/mapfile.csv.
154 *
155 * Parameter mapcpuid is the cpuid as stored in the
156 * pmu-events/arch/s390/mapfile.csv. This is just the type number.
157 * Parameter cpuid is the cpuid returned by function get_cpuid().
158 */
159int strcmp_cpuid_str(const char *mapcpuid, const char *cpuid)
160{
161 char *cp = strchr(cpuid, ',');
162
163 if (cp == NULL)
164 return -1;
165 return strncmp(cp + 1, mapcpuid, strlen(mapcpuid));
166}
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index 944070e98a2c..63eb49082774 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -175,7 +175,7 @@ static const struct option options[] = {
175 OPT_UINTEGER('s', "nr_secs" , &p0.nr_secs, "max number of seconds to run (default: 5 secs)"), 175 OPT_UINTEGER('s', "nr_secs" , &p0.nr_secs, "max number of seconds to run (default: 5 secs)"),
176 OPT_UINTEGER('u', "usleep" , &p0.sleep_usecs, "usecs to sleep per loop iteration"), 176 OPT_UINTEGER('u', "usleep" , &p0.sleep_usecs, "usecs to sleep per loop iteration"),
177 177
178 OPT_BOOLEAN('R', "data_reads" , &p0.data_reads, "access the data via writes (can be mixed with -W)"), 178 OPT_BOOLEAN('R', "data_reads" , &p0.data_reads, "access the data via reads (can be mixed with -W)"),
179 OPT_BOOLEAN('W', "data_writes" , &p0.data_writes, "access the data via writes (can be mixed with -R)"), 179 OPT_BOOLEAN('W', "data_writes" , &p0.data_writes, "access the data via writes (can be mixed with -R)"),
180 OPT_BOOLEAN('B', "data_backwards", &p0.data_backwards, "access the data backwards as well"), 180 OPT_BOOLEAN('B', "data_backwards", &p0.data_backwards, "access the data backwards as well"),
181 OPT_BOOLEAN('Z', "data_zero_memset", &p0.data_zero_memset,"access the data via glibc bzero only"), 181 OPT_BOOLEAN('Z', "data_zero_memset", &p0.data_zero_memset,"access the data via glibc bzero only"),
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 147a27e8c937..f17dc601b0f3 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -172,6 +172,7 @@ static bool interval_count;
172static const char *output_name; 172static const char *output_name;
173static int output_fd; 173static int output_fd;
174static int print_free_counters_hint; 174static int print_free_counters_hint;
175static int print_mixed_hw_group_error;
175 176
176struct perf_stat { 177struct perf_stat {
177 bool record; 178 bool record;
@@ -1126,6 +1127,30 @@ static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg)
1126 fprintf(output, "%s%s", csv_sep, evsel->cgrp->name); 1127 fprintf(output, "%s%s", csv_sep, evsel->cgrp->name);
1127} 1128}
1128 1129
1130static bool is_mixed_hw_group(struct perf_evsel *counter)
1131{
1132 struct perf_evlist *evlist = counter->evlist;
1133 u32 pmu_type = counter->attr.type;
1134 struct perf_evsel *pos;
1135
1136 if (counter->nr_members < 2)
1137 return false;
1138
1139 evlist__for_each_entry(evlist, pos) {
1140 /* software events can be part of any hardware group */
1141 if (pos->attr.type == PERF_TYPE_SOFTWARE)
1142 continue;
1143 if (pmu_type == PERF_TYPE_SOFTWARE) {
1144 pmu_type = pos->attr.type;
1145 continue;
1146 }
1147 if (pmu_type != pos->attr.type)
1148 return true;
1149 }
1150
1151 return false;
1152}
1153
1129static void printout(int id, int nr, struct perf_evsel *counter, double uval, 1154static void printout(int id, int nr, struct perf_evsel *counter, double uval,
1130 char *prefix, u64 run, u64 ena, double noise, 1155 char *prefix, u64 run, u64 ena, double noise,
1131 struct runtime_stat *st) 1156 struct runtime_stat *st)
@@ -1178,8 +1203,11 @@ static void printout(int id, int nr, struct perf_evsel *counter, double uval,
1178 counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED, 1203 counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED,
1179 csv_sep); 1204 csv_sep);
1180 1205
1181 if (counter->supported) 1206 if (counter->supported) {
1182 print_free_counters_hint = 1; 1207 print_free_counters_hint = 1;
1208 if (is_mixed_hw_group(counter))
1209 print_mixed_hw_group_error = 1;
1210 }
1183 1211
1184 fprintf(stat_config.output, "%-*s%s", 1212 fprintf(stat_config.output, "%-*s%s",
1185 csv_output ? 0 : unit_width, 1213 csv_output ? 0 : unit_width,
@@ -1256,7 +1284,8 @@ static void uniquify_event_name(struct perf_evsel *counter)
1256 char *new_name; 1284 char *new_name;
1257 char *config; 1285 char *config;
1258 1286
1259 if (!counter->pmu_name || !strncmp(counter->name, counter->pmu_name, 1287 if (counter->uniquified_name ||
1288 !counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
1260 strlen(counter->pmu_name))) 1289 strlen(counter->pmu_name)))
1261 return; 1290 return;
1262 1291
@@ -1274,6 +1303,8 @@ static void uniquify_event_name(struct perf_evsel *counter)
1274 counter->name = new_name; 1303 counter->name = new_name;
1275 } 1304 }
1276 } 1305 }
1306
1307 counter->uniquified_name = true;
1277} 1308}
1278 1309
1279static void collect_all_aliases(struct perf_evsel *counter, 1310static void collect_all_aliases(struct perf_evsel *counter,
@@ -1757,6 +1788,11 @@ static void print_footer(void)
1757" echo 0 > /proc/sys/kernel/nmi_watchdog\n" 1788" echo 0 > /proc/sys/kernel/nmi_watchdog\n"
1758" perf stat ...\n" 1789" perf stat ...\n"
1759" echo 1 > /proc/sys/kernel/nmi_watchdog\n"); 1790" echo 1 > /proc/sys/kernel/nmi_watchdog\n");
1791
1792 if (print_mixed_hw_group_error)
1793 fprintf(output,
1794 "The events in group usually have to be from "
1795 "the same PMU. Try reorganizing the group.\n");
1760} 1796}
1761 1797
1762static void print_counters(struct timespec *ts, int argc, const char **argv) 1798static void print_counters(struct timespec *ts, int argc, const char **argv)
diff --git a/tools/perf/pmu-events/arch/s390/mapfile.csv b/tools/perf/pmu-events/arch/s390/mapfile.csv
index ca7682748a4b..78bcf7f8e206 100644
--- a/tools/perf/pmu-events/arch/s390/mapfile.csv
+++ b/tools/perf/pmu-events/arch/s390/mapfile.csv
@@ -1,6 +1,6 @@
1Family-model,Version,Filename,EventType 1Family-model,Version,Filename,EventType
2209[78],1,cf_z10,core 2^IBM.209[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z10,core
3281[78],1,cf_z196,core 3^IBM.281[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z196,core
4282[78],1,cf_zec12,core 4^IBM.282[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_zec12,core
5296[45],1,cf_z13,core 5^IBM.296[45].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z13,core
63906,3,cf_z14,core 6^IBM.390[67].*[13]\.[1-5].[[:xdigit:]]+$,3,cf_z14,core
diff --git a/tools/perf/pmu-events/arch/x86/mapfile.csv b/tools/perf/pmu-events/arch/x86/mapfile.csv
index 93656f2fd53a..7e3cce3bcf3b 100644
--- a/tools/perf/pmu-events/arch/x86/mapfile.csv
+++ b/tools/perf/pmu-events/arch/x86/mapfile.csv
@@ -29,7 +29,6 @@ GenuineIntel-6-4D,v13,silvermont,core
29GenuineIntel-6-4C,v13,silvermont,core 29GenuineIntel-6-4C,v13,silvermont,core
30GenuineIntel-6-2A,v15,sandybridge,core 30GenuineIntel-6-2A,v15,sandybridge,core
31GenuineIntel-6-2C,v2,westmereep-dp,core 31GenuineIntel-6-2C,v2,westmereep-dp,core
32GenuineIntel-6-2C,v2,westmereep-dp,core
33GenuineIntel-6-25,v2,westmereep-sp,core 32GenuineIntel-6-25,v2,westmereep-sp,core
34GenuineIntel-6-2F,v2,westmereex,core 33GenuineIntel-6-2F,v2,westmereex,core
35GenuineIntel-6-55,v1,skylakex,core 34GenuineIntel-6-55,v1,skylakex,core
diff --git a/tools/perf/tests/attr/test-record-group-sampling b/tools/perf/tests/attr/test-record-group-sampling
index f906b793196f..8a33ca4f9e1f 100644
--- a/tools/perf/tests/attr/test-record-group-sampling
+++ b/tools/perf/tests/attr/test-record-group-sampling
@@ -35,3 +35,6 @@ inherit=0
35# sampling disabled 35# sampling disabled
36sample_freq=0 36sample_freq=0
37sample_period=0 37sample_period=0
38freq=0
39write_backward=0
40sample_id_all=0
diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
index 1ecc1f0ff84a..016882dbbc16 100755
--- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
@@ -19,12 +19,10 @@ trace_libc_inet_pton_backtrace() {
19 expected[1]=".*inet_pton[[:space:]]\($libc\)$" 19 expected[1]=".*inet_pton[[:space:]]\($libc\)$"
20 case "$(uname -m)" in 20 case "$(uname -m)" in
21 s390x) 21 s390x)
22 eventattr='call-graph=dwarf' 22 eventattr='call-graph=dwarf,max-stack=4'
23 expected[2]="gaih_inet.*[[:space:]]\($libc|inlined\)$" 23 expected[2]="gaih_inet.*[[:space:]]\($libc|inlined\)$"
24 expected[3]="__GI_getaddrinfo[[:space:]]\($libc|inlined\)$" 24 expected[3]="(__GI_)?getaddrinfo[[:space:]]\($libc|inlined\)$"
25 expected[4]="main[[:space:]]\(.*/bin/ping.*\)$" 25 expected[4]="main[[:space:]]\(.*/bin/ping.*\)$"
26 expected[5]="__libc_start_main[[:space:]]\($libc\)$"
27 expected[6]="_start[[:space:]]\(.*/bin/ping.*\)$"
28 ;; 26 ;;
29 *) 27 *)
30 eventattr='max-stack=3' 28 eventattr='max-stack=3'
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 3e87486c28fe..4cd2cf93f726 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -930,8 +930,11 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
930 * than leader in case leader 'leads' the sampling. 930 * than leader in case leader 'leads' the sampling.
931 */ 931 */
932 if ((leader != evsel) && leader->sample_read) { 932 if ((leader != evsel) && leader->sample_read) {
933 attr->sample_freq = 0; 933 attr->freq = 0;
934 attr->sample_period = 0; 934 attr->sample_freq = 0;
935 attr->sample_period = 0;
936 attr->write_backward = 0;
937 attr->sample_id_all = 0;
935 } 938 }
936 939
937 if (opts->no_samples) 940 if (opts->no_samples)
@@ -1922,7 +1925,8 @@ try_fallback:
1922 goto fallback_missing_features; 1925 goto fallback_missing_features;
1923 } else if (!perf_missing_features.group_read && 1926 } else if (!perf_missing_features.group_read &&
1924 evsel->attr.inherit && 1927 evsel->attr.inherit &&
1925 (evsel->attr.read_format & PERF_FORMAT_GROUP)) { 1928 (evsel->attr.read_format & PERF_FORMAT_GROUP) &&
1929 perf_evsel__is_group_leader(evsel)) {
1926 perf_missing_features.group_read = true; 1930 perf_missing_features.group_read = true;
1927 pr_debug2("switching off group read\n"); 1931 pr_debug2("switching off group read\n");
1928 goto fallback_missing_features; 1932 goto fallback_missing_features;
@@ -2754,8 +2758,14 @@ bool perf_evsel__fallback(struct perf_evsel *evsel, int err,
2754 (paranoid = perf_event_paranoid()) > 1) { 2758 (paranoid = perf_event_paranoid()) > 1) {
2755 const char *name = perf_evsel__name(evsel); 2759 const char *name = perf_evsel__name(evsel);
2756 char *new_name; 2760 char *new_name;
2761 const char *sep = ":";
2757 2762
2758 if (asprintf(&new_name, "%s%su", name, strchr(name, ':') ? "" : ":") < 0) 2763 /* Is there already the separator in the name. */
2764 if (strchr(name, '/') ||
2765 strchr(name, ':'))
2766 sep = "";
2767
2768 if (asprintf(&new_name, "%s%su", name, sep) < 0)
2759 return false; 2769 return false;
2760 2770
2761 if (evsel->name) 2771 if (evsel->name)
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index d3ee3af618ef..92ec009a292d 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -115,6 +115,7 @@ struct perf_evsel {
115 unsigned int sample_size; 115 unsigned int sample_size;
116 int id_pos; 116 int id_pos;
117 int is_pos; 117 int is_pos;
118 bool uniquified_name;
118 bool snapshot; 119 bool snapshot;
119 bool supported; 120 bool supported;
120 bool needs_swap; 121 bool needs_swap;
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 2eca8478e24f..32d50492505d 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1019,13 +1019,6 @@ int machine__load_vmlinux_path(struct machine *machine, enum map_type type)
1019 return ret; 1019 return ret;
1020} 1020}
1021 1021
1022static void map_groups__fixup_end(struct map_groups *mg)
1023{
1024 int i;
1025 for (i = 0; i < MAP__NR_TYPES; ++i)
1026 __map_groups__fixup_end(mg, i);
1027}
1028
1029static char *get_kernel_version(const char *root_dir) 1022static char *get_kernel_version(const char *root_dir)
1030{ 1023{
1031 char version[PATH_MAX]; 1024 char version[PATH_MAX];
@@ -1233,6 +1226,7 @@ int machine__create_kernel_maps(struct machine *machine)
1233{ 1226{
1234 struct dso *kernel = machine__get_kernel(machine); 1227 struct dso *kernel = machine__get_kernel(machine);
1235 const char *name = NULL; 1228 const char *name = NULL;
1229 struct map *map;
1236 u64 addr = 0; 1230 u64 addr = 0;
1237 int ret; 1231 int ret;
1238 1232
@@ -1259,13 +1253,25 @@ int machine__create_kernel_maps(struct machine *machine)
1259 machine__destroy_kernel_maps(machine); 1253 machine__destroy_kernel_maps(machine);
1260 return -1; 1254 return -1;
1261 } 1255 }
1262 machine__set_kernel_mmap(machine, addr, 0); 1256
1257 /* we have a real start address now, so re-order the kmaps */
1258 map = machine__kernel_map(machine);
1259
1260 map__get(map);
1261 map_groups__remove(&machine->kmaps, map);
1262
1263 /* assume it's the last in the kmaps */
1264 machine__set_kernel_mmap(machine, addr, ~0ULL);
1265
1266 map_groups__insert(&machine->kmaps, map);
1267 map__put(map);
1263 } 1268 }
1264 1269
1265 /* 1270 /* update end address of the kernel map using adjacent module address */
1266 * Now that we have all the maps created, just set the ->end of them: 1271 map = map__next(machine__kernel_map(machine));
1267 */ 1272 if (map)
1268 map_groups__fixup_end(&machine->kmaps); 1273 machine__set_kernel_mmap(machine, addr, map->start);
1274
1269 return 0; 1275 return 0;
1270} 1276}
1271 1277
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 61a5e5027338..d2fb597c9a8c 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -539,9 +539,10 @@ static bool pmu_is_uncore(const char *name)
539 539
540/* 540/*
541 * PMU CORE devices have different name other than cpu in sysfs on some 541 * PMU CORE devices have different name other than cpu in sysfs on some
542 * platforms. looking for possible sysfs files to identify as core device. 542 * platforms.
543 * Looking for possible sysfs files to identify the arm core device.
543 */ 544 */
544static int is_pmu_core(const char *name) 545static int is_arm_pmu_core(const char *name)
545{ 546{
546 struct stat st; 547 struct stat st;
547 char path[PATH_MAX]; 548 char path[PATH_MAX];
@@ -550,12 +551,6 @@ static int is_pmu_core(const char *name)
550 if (!sysfs) 551 if (!sysfs)
551 return 0; 552 return 0;
552 553
553 /* Look for cpu sysfs (x86 and others) */
554 scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
555 if ((stat(path, &st) == 0) &&
556 (strncmp(name, "cpu", strlen("cpu")) == 0))
557 return 1;
558
559 /* Look for cpu sysfs (specific to arm) */ 554 /* Look for cpu sysfs (specific to arm) */
560 scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus", 555 scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
561 sysfs, name); 556 sysfs, name);
@@ -586,7 +581,7 @@ char * __weak get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
586 * cpuid string generated on this platform. 581 * cpuid string generated on this platform.
587 * Otherwise return non-zero. 582 * Otherwise return non-zero.
588 */ 583 */
589int __weak strcmp_cpuid_str(const char *mapcpuid, const char *cpuid) 584int strcmp_cpuid_str(const char *mapcpuid, const char *cpuid)
590{ 585{
591 regex_t re; 586 regex_t re;
592 regmatch_t pmatch[1]; 587 regmatch_t pmatch[1];
@@ -668,6 +663,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
668 struct pmu_events_map *map; 663 struct pmu_events_map *map;
669 struct pmu_event *pe; 664 struct pmu_event *pe;
670 const char *name = pmu->name; 665 const char *name = pmu->name;
666 const char *pname;
671 667
672 map = perf_pmu__find_map(pmu); 668 map = perf_pmu__find_map(pmu);
673 if (!map) 669 if (!map)
@@ -686,11 +682,9 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
686 break; 682 break;
687 } 683 }
688 684
689 if (!is_pmu_core(name)) { 685 if (!is_arm_pmu_core(name)) {
690 /* check for uncore devices */ 686 pname = pe->pmu ? pe->pmu : "cpu";
691 if (pe->pmu == NULL) 687 if (strncmp(pname, name, strlen(pname)))
692 continue;
693 if (strncmp(pe->pmu, name, strlen(pe->pmu)))
694 continue; 688 continue;
695 } 689 }
696 690
diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config
index 2cccbba64418..f304be71c278 100644
--- a/tools/power/acpi/Makefile.config
+++ b/tools/power/acpi/Makefile.config
@@ -56,6 +56,7 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM}
56# to compile vs uClibc, that can be done here as well. 56# to compile vs uClibc, that can be done here as well.
57CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- 57CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
58CROSS_COMPILE ?= $(CROSS) 58CROSS_COMPILE ?= $(CROSS)
59LD = $(CC)
59HOSTCC = gcc 60HOSTCC = gcc
60 61
61# check if compiler option is supported 62# check if compiler option is supported
diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
index 9cf83f895d98..5e1ab2f0eb79 100644
--- a/tools/testing/selftests/bpf/.gitignore
+++ b/tools/testing/selftests/bpf/.gitignore
@@ -12,3 +12,6 @@ test_tcpbpf_user
12test_verifier_log 12test_verifier_log
13feature 13feature
14test_libbpf_open 14test_libbpf_open
15test_sock
16test_sock_addr
17urandom_read
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index faadbe233966..4123d0ab90ba 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -1108,7 +1108,7 @@ static void test_stacktrace_build_id(void)
1108 1108
1109 assert(system("dd if=/dev/urandom of=/dev/zero count=4 2> /dev/null") 1109 assert(system("dd if=/dev/urandom of=/dev/zero count=4 2> /dev/null")
1110 == 0); 1110 == 0);
1111 assert(system("./urandom_read if=/dev/urandom of=/dev/zero count=4 2> /dev/null") == 0); 1111 assert(system("./urandom_read") == 0);
1112 /* disable stack trace collection */ 1112 /* disable stack trace collection */
1113 key = 0; 1113 key = 0;
1114 val = 1; 1114 val = 1;
@@ -1158,7 +1158,7 @@ static void test_stacktrace_build_id(void)
1158 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0); 1158 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0);
1159 1159
1160 CHECK(build_id_matches < 1, "build id match", 1160 CHECK(build_id_matches < 1, "build id match",
1161 "Didn't find expected build ID from the map"); 1161 "Didn't find expected build ID from the map\n");
1162 1162
1163disable_pmu: 1163disable_pmu:
1164 ioctl(pmu_fd, PERF_EVENT_IOC_DISABLE); 1164 ioctl(pmu_fd, PERF_EVENT_IOC_DISABLE);
diff --git a/tools/testing/selftests/bpf/test_sock.c b/tools/testing/selftests/bpf/test_sock.c
index 73bb20cfb9b7..f4d99fabc56d 100644
--- a/tools/testing/selftests/bpf/test_sock.c
+++ b/tools/testing/selftests/bpf/test_sock.c
@@ -13,6 +13,7 @@
13#include <bpf/bpf.h> 13#include <bpf/bpf.h>
14 14
15#include "cgroup_helpers.h" 15#include "cgroup_helpers.h"
16#include "bpf_rlimit.h"
16 17
17#ifndef ARRAY_SIZE 18#ifndef ARRAY_SIZE
18# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 19# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
diff --git a/tools/testing/selftests/bpf/test_sock_addr.c b/tools/testing/selftests/bpf/test_sock_addr.c
index d488f20926e8..2950f80ba7fb 100644
--- a/tools/testing/selftests/bpf/test_sock_addr.c
+++ b/tools/testing/selftests/bpf/test_sock_addr.c
@@ -15,6 +15,7 @@
15#include <bpf/libbpf.h> 15#include <bpf/libbpf.h>
16 16
17#include "cgroup_helpers.h" 17#include "cgroup_helpers.h"
18#include "bpf_rlimit.h"
18 19
19#define CG_PATH "/foo" 20#define CG_PATH "/foo"
20#define CONNECT4_PROG_PATH "./connect4_prog.o" 21#define CONNECT4_PROG_PATH "./connect4_prog.o"
diff --git a/tools/testing/selftests/bpf/test_sock_addr.sh b/tools/testing/selftests/bpf/test_sock_addr.sh
index c6e1dcf992c4..9832a875a828 100755
--- a/tools/testing/selftests/bpf/test_sock_addr.sh
+++ b/tools/testing/selftests/bpf/test_sock_addr.sh
@@ -4,7 +4,7 @@ set -eu
4 4
5ping_once() 5ping_once()
6{ 6{
7 ping -q -c 1 -W 1 ${1%%/*} >/dev/null 2>&1 7 ping -${1} -q -c 1 -W 1 ${2%%/*} >/dev/null 2>&1
8} 8}
9 9
10wait_for_ip() 10wait_for_ip()
@@ -13,7 +13,7 @@ wait_for_ip()
13 echo -n "Wait for testing IPv4/IPv6 to become available " 13 echo -n "Wait for testing IPv4/IPv6 to become available "
14 for _i in $(seq ${MAX_PING_TRIES}); do 14 for _i in $(seq ${MAX_PING_TRIES}); do
15 echo -n "." 15 echo -n "."
16 if ping_once ${TEST_IPv4} && ping_once ${TEST_IPv6}; then 16 if ping_once 4 ${TEST_IPv4} && ping_once 6 ${TEST_IPv6}; then
17 echo " OK" 17 echo " OK"
18 return 18 return
19 fi 19 fi
diff --git a/tools/testing/selftests/firmware/Makefile b/tools/testing/selftests/firmware/Makefile
index 826f38d5dd19..261c81f08606 100644
--- a/tools/testing/selftests/firmware/Makefile
+++ b/tools/testing/selftests/firmware/Makefile
@@ -4,6 +4,7 @@
4all: 4all:
5 5
6TEST_PROGS := fw_run_tests.sh 6TEST_PROGS := fw_run_tests.sh
7TEST_FILES := fw_fallback.sh fw_filesystem.sh fw_lib.sh
7 8
8include ../lib.mk 9include ../lib.mk
9 10
diff --git a/tools/testing/selftests/firmware/fw_lib.sh b/tools/testing/selftests/firmware/fw_lib.sh
index 9ea31b57d71a..962d7f4ac627 100755
--- a/tools/testing/selftests/firmware/fw_lib.sh
+++ b/tools/testing/selftests/firmware/fw_lib.sh
@@ -154,11 +154,13 @@ test_finish()
154 if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then 154 if [ "$HAS_FW_LOADER_USER_HELPER" = "yes" ]; then
155 echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout 155 echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout
156 fi 156 fi
157 if [ "$OLD_FWPATH" = "" ]; then
158 OLD_FWPATH=" "
159 fi
160 if [ "$TEST_REQS_FW_SET_CUSTOM_PATH" = "yes" ]; then 157 if [ "$TEST_REQS_FW_SET_CUSTOM_PATH" = "yes" ]; then
161 echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path 158 if [ "$OLD_FWPATH" = "" ]; then
159 # A zero-length write won't work; write a null byte
160 printf '\000' >/sys/module/firmware_class/parameters/path
161 else
162 echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path
163 fi
162 fi 164 fi
163 if [ -f $FW ]; then 165 if [ -f $FW ]; then
164 rm -f "$FW" 166 rm -f "$FW"
diff --git a/tools/testing/selftests/firmware/fw_run_tests.sh b/tools/testing/selftests/firmware/fw_run_tests.sh
index 06d638e9dc62..cffdd4eb0a57 100755
--- a/tools/testing/selftests/firmware/fw_run_tests.sh
+++ b/tools/testing/selftests/firmware/fw_run_tests.sh
@@ -66,5 +66,5 @@ if [ -f $FW_FORCE_SYSFS_FALLBACK ]; then
66 run_test_config_0003 66 run_test_config_0003
67else 67else
68 echo "Running basic kernel configuration, working with your config" 68 echo "Running basic kernel configuration, working with your config"
69 run_test 69 run_tests
70fi 70fi
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc
index 786dce7e48be..2aabab363cfb 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-extended-error-support.tc
@@ -29,7 +29,7 @@ do_reset
29 29
30echo "Test extended error support" 30echo "Test extended error support"
31echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger 31echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger
32echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger &>/dev/null 32! echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger 2> /dev/null
33if ! grep -q "ERROR:" events/sched/sched_wakeup/hist; then 33if ! grep -q "ERROR:" events/sched/sched_wakeup/hist; then
34 fail "Failed to generate extended error in histogram" 34 fail "Failed to generate extended error in histogram"
35fi 35fi
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc
new file mode 100644
index 000000000000..c193dce611a2
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-multi-actions-accept.tc
@@ -0,0 +1,44 @@
1#!/bin/sh
2# description: event trigger - test multiple actions on hist trigger
3
4
5do_reset() {
6 reset_trigger
7 echo > set_event
8 clear_trace
9}
10
11fail() { #msg
12 do_reset
13 echo $1
14 exit_fail
15}
16
17if [ ! -f set_event ]; then
18 echo "event tracing is not supported"
19 exit_unsupported
20fi
21
22if [ ! -f synthetic_events ]; then
23 echo "synthetic event is not supported"
24 exit_unsupported
25fi
26
27clear_synthetic_events
28reset_tracer
29do_reset
30
31echo "Test multiple actions on hist trigger"
32echo 'wakeup_latency u64 lat; pid_t pid' >> synthetic_events
33TRIGGER1=events/sched/sched_wakeup/trigger
34TRIGGER2=events/sched/sched_switch/trigger
35
36echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' > $TRIGGER1
37echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0 if next_comm=="cyclictest"' >> $TRIGGER2
38echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,next_pid) if next_comm=="cyclictest"' >> $TRIGGER2
39echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,prev_pid) if next_comm=="cyclictest"' >> $TRIGGER2
40echo 'hist:keys=next_pid if next_comm=="cyclictest"' >> $TRIGGER2
41
42do_reset
43
44exit 0
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 195e9d4739a9..c1b1a4dc6a96 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -20,10 +20,10 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
20 20
21.ONESHELL: 21.ONESHELL:
22define RUN_TESTS 22define RUN_TESTS
23 @export KSFT_TAP_LEVEL=`echo 1`; 23 @export KSFT_TAP_LEVEL=`echo 1`; \
24 @test_num=`echo 0`; 24 test_num=`echo 0`; \
25 @echo "TAP version 13"; 25 echo "TAP version 13"; \
26 @for TEST in $(1); do \ 26 for TEST in $(1); do \
27 BASENAME_TEST=`basename $$TEST`; \ 27 BASENAME_TEST=`basename $$TEST`; \
28 test_num=`echo $$test_num+1 | bc`; \ 28 test_num=`echo $$test_num+1 | bc`; \
29 echo "selftests: $$BASENAME_TEST"; \ 29 echo "selftests: $$BASENAME_TEST"; \
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 8f1e13d2e547..3ff81a478dbe 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -5,7 +5,8 @@ CFLAGS = -Wall -Wl,--no-as-needed -O2 -g
5CFLAGS += -I../../../../usr/include/ 5CFLAGS += -I../../../../usr/include/
6 6
7TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh rtnetlink.sh 7TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh rtnetlink.sh
8TEST_PROGS += fib_tests.sh fib-onlink-tests.sh in_netns.sh pmtu.sh 8TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh
9TEST_PROGS_EXTENDED := in_netns.sh
9TEST_GEN_FILES = socket 10TEST_GEN_FILES = socket
10TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy 11TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy
11TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa 12TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json b/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json
index 5b012f4981d4..6f289a49e5ec 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json
@@ -66,7 +66,7 @@
66 "cmdUnderTest": "$TC action add action bpf object-file _b.o index 667", 66 "cmdUnderTest": "$TC action add action bpf object-file _b.o index 667",
67 "expExitCode": "0", 67 "expExitCode": "0",
68 "verifyCmd": "$TC action get action bpf index 667", 68 "verifyCmd": "$TC action get action bpf index 667",
69 "matchPattern": "action order [0-9]*: bpf _b.o:\\[action\\] id [0-9]* tag 3b185187f1855c4c default-action pipe.*index 667 ref", 69 "matchPattern": "action order [0-9]*: bpf _b.o:\\[action\\] id [0-9]* tag 3b185187f1855c4c( jited)? default-action pipe.*index 667 ref",
70 "matchCount": "1", 70 "matchCount": "1",
71 "teardown": [ 71 "teardown": [
72 "$TC action flush action bpf", 72 "$TC action flush action bpf",
@@ -92,10 +92,15 @@
92 "cmdUnderTest": "$TC action add action bpf object-file _c.o index 667", 92 "cmdUnderTest": "$TC action add action bpf object-file _c.o index 667",
93 "expExitCode": "255", 93 "expExitCode": "255",
94 "verifyCmd": "$TC action get action bpf index 667", 94 "verifyCmd": "$TC action get action bpf index 667",
95 "matchPattern": "action order [0-9]*: bpf _b.o:\\[action\\] id [0-9].*index 667 ref", 95 "matchPattern": "action order [0-9]*: bpf _c.o:\\[action\\] id [0-9].*index 667 ref",
96 "matchCount": "0", 96 "matchCount": "0",
97 "teardown": [ 97 "teardown": [
98 "$TC action flush action bpf", 98 [
99 "$TC action flush action bpf",
100 0,
101 1,
102 255
103 ],
99 "rm -f _c.o" 104 "rm -f _c.o"
100 ] 105 ]
101 }, 106 },
diff --git a/tools/testing/selftests/x86/test_syscall_vdso.c b/tools/testing/selftests/x86/test_syscall_vdso.c
index 40370354d4c1..c9c3281077bc 100644
--- a/tools/testing/selftests/x86/test_syscall_vdso.c
+++ b/tools/testing/selftests/x86/test_syscall_vdso.c
@@ -100,12 +100,19 @@ asm (
100 " shl $32, %r8\n" 100 " shl $32, %r8\n"
101 " orq $0x7f7f7f7f, %r8\n" 101 " orq $0x7f7f7f7f, %r8\n"
102 " movq %r8, %r9\n" 102 " movq %r8, %r9\n"
103 " movq %r8, %r10\n" 103 " incq %r9\n"
104 " movq %r8, %r11\n" 104 " movq %r9, %r10\n"
105 " movq %r8, %r12\n" 105 " incq %r10\n"
106 " movq %r8, %r13\n" 106 " movq %r10, %r11\n"
107 " movq %r8, %r14\n" 107 " incq %r11\n"
108 " movq %r8, %r15\n" 108 " movq %r11, %r12\n"
109 " incq %r12\n"
110 " movq %r12, %r13\n"
111 " incq %r13\n"
112 " movq %r13, %r14\n"
113 " incq %r14\n"
114 " movq %r14, %r15\n"
115 " incq %r15\n"
109 " ret\n" 116 " ret\n"
110 " .code32\n" 117 " .code32\n"
111 " .popsection\n" 118 " .popsection\n"
@@ -128,12 +135,13 @@ int check_regs64(void)
128 int err = 0; 135 int err = 0;
129 int num = 8; 136 int num = 8;
130 uint64_t *r64 = &regs64.r8; 137 uint64_t *r64 = &regs64.r8;
138 uint64_t expected = 0x7f7f7f7f7f7f7f7fULL;
131 139
132 if (!kernel_is_64bit) 140 if (!kernel_is_64bit)
133 return 0; 141 return 0;
134 142
135 do { 143 do {
136 if (*r64 == 0x7f7f7f7f7f7f7f7fULL) 144 if (*r64 == expected++)
137 continue; /* register did not change */ 145 continue; /* register did not change */
138 if (syscall_addr != (long)&int80) { 146 if (syscall_addr != (long)&int80) {
139 /* 147 /*
@@ -147,18 +155,17 @@ int check_regs64(void)
147 continue; 155 continue;
148 } 156 }
149 } else { 157 } else {
150 /* INT80 syscall entrypoint can be used by 158 /*
159 * INT80 syscall entrypoint can be used by
151 * 64-bit programs too, unlike SYSCALL/SYSENTER. 160 * 64-bit programs too, unlike SYSCALL/SYSENTER.
152 * Therefore it must preserve R12+ 161 * Therefore it must preserve R12+
153 * (they are callee-saved registers in 64-bit C ABI). 162 * (they are callee-saved registers in 64-bit C ABI).
154 * 163 *
155 * This was probably historically not intended, 164 * Starting in Linux 4.17 (and any kernel that
156 * but R8..11 are clobbered (cleared to 0). 165 * backports the change), R8..11 are preserved.
157 * IOW: they are the only registers which aren't 166 * Historically (and probably unintentionally), they
158 * preserved across INT80 syscall. 167 * were clobbered or zeroed.
159 */ 168 */
160 if (*r64 == 0 && num <= 11)
161 continue;
162 } 169 }
163 printf("[FAIL]\tR%d has changed:%016llx\n", num, *r64); 170 printf("[FAIL]\tR%d has changed:%016llx\n", num, *r64);
164 err++; 171 err++;