diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-30 08:08:26 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-30 08:08:26 -0400 |
commit | cd4846c5a68da77705164924f47001af3b499dec (patch) | |
tree | 226295e35148ee7a9d303c6a218790b7a8107976 /tools | |
parent | 9ee84466b7130360d07241baf4c95a553fc0a997 (diff) | |
parent | 6da6c0db5316275015e8cc2959f12a17584aeb64 (diff) |
Merge 4.17-rc3 into driver-core-next
We want the fixes in here as well for testing.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
83 files changed, 1959 insertions, 651 deletions
diff --git a/tools/arch/arm/include/uapi/asm/kvm.h b/tools/arch/arm/include/uapi/asm/kvm.h index 6edd177bb1c7..2ba95d6fe852 100644 --- a/tools/arch/arm/include/uapi/asm/kvm.h +++ b/tools/arch/arm/include/uapi/asm/kvm.h | |||
@@ -135,6 +135,15 @@ struct kvm_arch_memory_slot { | |||
135 | #define KVM_REG_ARM_CRM_SHIFT 7 | 135 | #define KVM_REG_ARM_CRM_SHIFT 7 |
136 | #define KVM_REG_ARM_32_CRN_MASK 0x0000000000007800 | 136 | #define KVM_REG_ARM_32_CRN_MASK 0x0000000000007800 |
137 | #define KVM_REG_ARM_32_CRN_SHIFT 11 | 137 | #define KVM_REG_ARM_32_CRN_SHIFT 11 |
138 | /* | ||
139 | * For KVM currently all guest registers are nonsecure, but we reserve a bit | ||
140 | * in the encoding to distinguish secure from nonsecure for AArch32 system | ||
141 | * registers that are banked by security. This is 1 for the secure banked | ||
142 | * register, and 0 for the nonsecure banked register or if the register is | ||
143 | * not banked by security. | ||
144 | */ | ||
145 | #define KVM_REG_ARM_SECURE_MASK 0x0000000010000000 | ||
146 | #define KVM_REG_ARM_SECURE_SHIFT 28 | ||
138 | 147 | ||
139 | #define ARM_CP15_REG_SHIFT_MASK(x,n) \ | 148 | #define ARM_CP15_REG_SHIFT_MASK(x,n) \ |
140 | (((x) << KVM_REG_ARM_ ## n ## _SHIFT) & KVM_REG_ARM_ ## n ## _MASK) | 149 | (((x) << KVM_REG_ARM_ ## n ## _SHIFT) & KVM_REG_ARM_ ## n ## _MASK) |
diff --git a/tools/arch/x86/include/asm/required-features.h b/tools/arch/x86/include/asm/required-features.h index fb3a6de7440b..6847d85400a8 100644 --- a/tools/arch/x86/include/asm/required-features.h +++ b/tools/arch/x86/include/asm/required-features.h | |||
@@ -53,12 +53,6 @@ | |||
53 | # define NEED_MOVBE 0 | 53 | # define NEED_MOVBE 0 |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | #ifdef CONFIG_X86_5LEVEL | ||
57 | # define NEED_LA57 (1<<(X86_FEATURE_LA57 & 31)) | ||
58 | #else | ||
59 | # define NEED_LA57 0 | ||
60 | #endif | ||
61 | |||
62 | #ifdef CONFIG_X86_64 | 56 | #ifdef CONFIG_X86_64 |
63 | #ifdef CONFIG_PARAVIRT | 57 | #ifdef CONFIG_PARAVIRT |
64 | /* Paravirtualized systems may not have PSE or PGE available */ | 58 | /* Paravirtualized systems may not have PSE or PGE available */ |
@@ -104,7 +98,7 @@ | |||
104 | #define REQUIRED_MASK13 0 | 98 | #define REQUIRED_MASK13 0 |
105 | #define REQUIRED_MASK14 0 | 99 | #define REQUIRED_MASK14 0 |
106 | #define REQUIRED_MASK15 0 | 100 | #define REQUIRED_MASK15 0 |
107 | #define REQUIRED_MASK16 (NEED_LA57) | 101 | #define REQUIRED_MASK16 0 |
108 | #define REQUIRED_MASK17 0 | 102 | #define REQUIRED_MASK17 0 |
109 | #define REQUIRED_MASK18 0 | 103 | #define REQUIRED_MASK18 0 |
110 | #define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19) | 104 | #define REQUIRED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19) |
diff --git a/tools/arch/x86/include/uapi/asm/kvm.h b/tools/arch/x86/include/uapi/asm/kvm.h index f3a960488eae..c535c2fdea13 100644 --- a/tools/arch/x86/include/uapi/asm/kvm.h +++ b/tools/arch/x86/include/uapi/asm/kvm.h | |||
@@ -354,8 +354,25 @@ struct kvm_xcrs { | |||
354 | __u64 padding[16]; | 354 | __u64 padding[16]; |
355 | }; | 355 | }; |
356 | 356 | ||
357 | /* definition of registers in kvm_run */ | 357 | #define KVM_SYNC_X86_REGS (1UL << 0) |
358 | #define KVM_SYNC_X86_SREGS (1UL << 1) | ||
359 | #define KVM_SYNC_X86_EVENTS (1UL << 2) | ||
360 | |||
361 | #define KVM_SYNC_X86_VALID_FIELDS \ | ||
362 | (KVM_SYNC_X86_REGS| \ | ||
363 | KVM_SYNC_X86_SREGS| \ | ||
364 | KVM_SYNC_X86_EVENTS) | ||
365 | |||
366 | /* kvm_sync_regs struct included by kvm_run struct */ | ||
358 | struct kvm_sync_regs { | 367 | struct kvm_sync_regs { |
368 | /* Members of this structure are potentially malicious. | ||
369 | * Care must be taken by code reading, esp. interpreting, | ||
370 | * data fields from them inside KVM to prevent TOCTOU and | ||
371 | * double-fetch types of vulnerabilities. | ||
372 | */ | ||
373 | struct kvm_regs regs; | ||
374 | struct kvm_sregs sregs; | ||
375 | struct kvm_vcpu_events events; | ||
359 | }; | 376 | }; |
360 | 377 | ||
361 | #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) | 378 | #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) |
diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h index 04e32f965ad7..1827c2f973f9 100644 --- a/tools/include/linux/compiler.h +++ b/tools/include/linux/compiler.h | |||
@@ -151,11 +151,21 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s | |||
151 | * required ordering. | 151 | * required ordering. |
152 | */ | 152 | */ |
153 | 153 | ||
154 | #define READ_ONCE(x) \ | 154 | #define READ_ONCE(x) \ |
155 | ({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) | 155 | ({ \ |
156 | 156 | union { typeof(x) __val; char __c[1]; } __u = \ | |
157 | #define WRITE_ONCE(x, val) \ | 157 | { .__c = { 0 } }; \ |
158 | ({ union { typeof(x) __val; char __c[1]; } __u = { .__val = (val) }; __write_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) | 158 | __read_once_size(&(x), __u.__c, sizeof(x)); \ |
159 | __u.__val; \ | ||
160 | }) | ||
161 | |||
162 | #define WRITE_ONCE(x, val) \ | ||
163 | ({ \ | ||
164 | union { typeof(x) __val; char __c[1]; } __u = \ | ||
165 | { .__val = (val) }; \ | ||
166 | __write_once_size(&(x), __u.__c, sizeof(x)); \ | ||
167 | __u.__val; \ | ||
168 | }) | ||
159 | 169 | ||
160 | 170 | ||
161 | #ifndef __fallthrough | 171 | #ifndef __fallthrough |
diff --git a/tools/include/linux/coresight-pmu.h b/tools/include/linux/coresight-pmu.h index edfeaba95429..a1a959ba24ff 100644 --- a/tools/include/linux/coresight-pmu.h +++ b/tools/include/linux/coresight-pmu.h | |||
@@ -1,18 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright(C) 2015 Linaro Limited. All rights reserved. | 3 | * Copyright(C) 2015 Linaro Limited. All rights reserved. |
3 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> | 4 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> |
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 5 | */ |
17 | 6 | ||
18 | #ifndef _LINUX_CORESIGHT_PMU_H | 7 | #ifndef _LINUX_CORESIGHT_PMU_H |
diff --git a/tools/include/uapi/asm-generic/mman-common.h b/tools/include/uapi/asm-generic/mman-common.h index f8b134f5608f..e7ee32861d51 100644 --- a/tools/include/uapi/asm-generic/mman-common.h +++ b/tools/include/uapi/asm-generic/mman-common.h | |||
@@ -27,6 +27,9 @@ | |||
27 | # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */ | 27 | # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */ |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | /* 0x0100 - 0x80000 flags are defined in asm-generic/mman.h */ | ||
31 | #define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap underlying mapping */ | ||
32 | |||
30 | /* | 33 | /* |
31 | * Flags for mlock | 34 | * Flags for mlock |
32 | */ | 35 | */ |
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 9d07465023a2..c5ec89732a8d 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h | |||
@@ -864,6 +864,7 @@ enum bpf_func_id { | |||
864 | /* BPF_FUNC_skb_set_tunnel_key flags. */ | 864 | /* BPF_FUNC_skb_set_tunnel_key flags. */ |
865 | #define BPF_F_ZERO_CSUM_TX (1ULL << 1) | 865 | #define BPF_F_ZERO_CSUM_TX (1ULL << 1) |
866 | #define BPF_F_DONT_FRAGMENT (1ULL << 2) | 866 | #define BPF_F_DONT_FRAGMENT (1ULL << 2) |
867 | #define BPF_F_SEQ_NUMBER (1ULL << 3) | ||
867 | 868 | ||
868 | /* BPF_FUNC_perf_event_output, BPF_FUNC_perf_event_read and | 869 | /* BPF_FUNC_perf_event_output, BPF_FUNC_perf_event_read and |
869 | * BPF_FUNC_perf_event_read_value flags. | 870 | * BPF_FUNC_perf_event_read_value flags. |
diff --git a/tools/include/uapi/linux/if_link.h b/tools/include/uapi/linux/if_link.h index 6d9447700e18..68699f654118 100644 --- a/tools/include/uapi/linux/if_link.h +++ b/tools/include/uapi/linux/if_link.h | |||
@@ -941,4 +941,43 @@ enum { | |||
941 | IFLA_EVENT_BONDING_OPTIONS, /* change in bonding options */ | 941 | IFLA_EVENT_BONDING_OPTIONS, /* change in bonding options */ |
942 | }; | 942 | }; |
943 | 943 | ||
944 | /* tun section */ | ||
945 | |||
946 | enum { | ||
947 | IFLA_TUN_UNSPEC, | ||
948 | IFLA_TUN_OWNER, | ||
949 | IFLA_TUN_GROUP, | ||
950 | IFLA_TUN_TYPE, | ||
951 | IFLA_TUN_PI, | ||
952 | IFLA_TUN_VNET_HDR, | ||
953 | IFLA_TUN_PERSIST, | ||
954 | IFLA_TUN_MULTI_QUEUE, | ||
955 | IFLA_TUN_NUM_QUEUES, | ||
956 | IFLA_TUN_NUM_DISABLED_QUEUES, | ||
957 | __IFLA_TUN_MAX, | ||
958 | }; | ||
959 | |||
960 | #define IFLA_TUN_MAX (__IFLA_TUN_MAX - 1) | ||
961 | |||
962 | /* rmnet section */ | ||
963 | |||
964 | #define RMNET_FLAGS_INGRESS_DEAGGREGATION (1U << 0) | ||
965 | #define RMNET_FLAGS_INGRESS_MAP_COMMANDS (1U << 1) | ||
966 | #define RMNET_FLAGS_INGRESS_MAP_CKSUMV4 (1U << 2) | ||
967 | #define RMNET_FLAGS_EGRESS_MAP_CKSUMV4 (1U << 3) | ||
968 | |||
969 | enum { | ||
970 | IFLA_RMNET_UNSPEC, | ||
971 | IFLA_RMNET_MUX_ID, | ||
972 | IFLA_RMNET_FLAGS, | ||
973 | __IFLA_RMNET_MAX, | ||
974 | }; | ||
975 | |||
976 | #define IFLA_RMNET_MAX (__IFLA_RMNET_MAX - 1) | ||
977 | |||
978 | struct ifla_rmnet_flags { | ||
979 | __u32 flags; | ||
980 | __u32 mask; | ||
981 | }; | ||
982 | |||
944 | #endif /* _UAPI_LINUX_IF_LINK_H */ | 983 | #endif /* _UAPI_LINUX_IF_LINK_H */ |
diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h index 6b89f87db200..1065006c9bf5 100644 --- a/tools/include/uapi/linux/kvm.h +++ b/tools/include/uapi/linux/kvm.h | |||
@@ -396,6 +396,10 @@ struct kvm_run { | |||
396 | char padding[256]; | 396 | char padding[256]; |
397 | }; | 397 | }; |
398 | 398 | ||
399 | /* 2048 is the size of the char array used to bound/pad the size | ||
400 | * of the union that holds sync regs. | ||
401 | */ | ||
402 | #define SYNC_REGS_SIZE_BYTES 2048 | ||
399 | /* | 403 | /* |
400 | * shared registers between kvm and userspace. | 404 | * shared registers between kvm and userspace. |
401 | * kvm_valid_regs specifies the register classes set by the host | 405 | * kvm_valid_regs specifies the register classes set by the host |
@@ -407,7 +411,7 @@ struct kvm_run { | |||
407 | __u64 kvm_dirty_regs; | 411 | __u64 kvm_dirty_regs; |
408 | union { | 412 | union { |
409 | struct kvm_sync_regs regs; | 413 | struct kvm_sync_regs regs; |
410 | char padding[2048]; | 414 | char padding[SYNC_REGS_SIZE_BYTES]; |
411 | } s; | 415 | } s; |
412 | }; | 416 | }; |
413 | 417 | ||
@@ -936,6 +940,7 @@ struct kvm_ppc_resize_hpt { | |||
936 | #define KVM_CAP_PPC_GET_CPU_CHAR 151 | 940 | #define KVM_CAP_PPC_GET_CPU_CHAR 151 |
937 | #define KVM_CAP_S390_BPB 152 | 941 | #define KVM_CAP_S390_BPB 152 |
938 | #define KVM_CAP_GET_MSR_FEATURES 153 | 942 | #define KVM_CAP_GET_MSR_FEATURES 153 |
943 | #define KVM_CAP_HYPERV_EVENTFD 154 | ||
939 | 944 | ||
940 | #ifdef KVM_CAP_IRQ_ROUTING | 945 | #ifdef KVM_CAP_IRQ_ROUTING |
941 | 946 | ||
@@ -1375,6 +1380,10 @@ struct kvm_enc_region { | |||
1375 | #define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region) | 1380 | #define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region) |
1376 | #define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region) | 1381 | #define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region) |
1377 | 1382 | ||
1383 | /* Available with KVM_CAP_HYPERV_EVENTFD */ | ||
1384 | #define KVM_HYPERV_EVENTFD _IOW(KVMIO, 0xbd, struct kvm_hyperv_eventfd) | ||
1385 | |||
1386 | |||
1378 | /* Secure Encrypted Virtualization command */ | 1387 | /* Secure Encrypted Virtualization command */ |
1379 | enum sev_cmd_id { | 1388 | enum sev_cmd_id { |
1380 | /* Guest initialization commands */ | 1389 | /* Guest initialization commands */ |
@@ -1515,4 +1524,14 @@ struct kvm_assigned_msix_entry { | |||
1515 | #define KVM_ARM_DEV_EL1_PTIMER (1 << 1) | 1524 | #define KVM_ARM_DEV_EL1_PTIMER (1 << 1) |
1516 | #define KVM_ARM_DEV_PMU (1 << 2) | 1525 | #define KVM_ARM_DEV_PMU (1 << 2) |
1517 | 1526 | ||
1527 | struct kvm_hyperv_eventfd { | ||
1528 | __u32 conn_id; | ||
1529 | __s32 fd; | ||
1530 | __u32 flags; | ||
1531 | __u32 padding[3]; | ||
1532 | }; | ||
1533 | |||
1534 | #define KVM_HYPERV_CONN_ID_MASK 0x00ffffff | ||
1535 | #define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0) | ||
1536 | |||
1518 | #endif /* __LINUX_KVM_H */ | 1537 | #endif /* __LINUX_KVM_H */ |
diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h index 912b85b52344..b8e288a1f740 100644 --- a/tools/include/uapi/linux/perf_event.h +++ b/tools/include/uapi/linux/perf_event.h | |||
@@ -650,11 +650,23 @@ struct perf_event_mmap_page { | |||
650 | #define PERF_RECORD_MISC_COMM_EXEC (1 << 13) | 650 | #define PERF_RECORD_MISC_COMM_EXEC (1 << 13) |
651 | #define PERF_RECORD_MISC_SWITCH_OUT (1 << 13) | 651 | #define PERF_RECORD_MISC_SWITCH_OUT (1 << 13) |
652 | /* | 652 | /* |
653 | * Indicates that the content of PERF_SAMPLE_IP points to | 653 | * These PERF_RECORD_MISC_* flags below are safely reused |
654 | * the actual instruction that triggered the event. See also | 654 | * for the following events: |
655 | * perf_event_attr::precise_ip. | 655 | * |
656 | * PERF_RECORD_MISC_EXACT_IP - PERF_RECORD_SAMPLE of precise events | ||
657 | * PERF_RECORD_MISC_SWITCH_OUT_PREEMPT - PERF_RECORD_SWITCH* events | ||
658 | * | ||
659 | * | ||
660 | * PERF_RECORD_MISC_EXACT_IP: | ||
661 | * Indicates that the content of PERF_SAMPLE_IP points to | ||
662 | * the actual instruction that triggered the event. See also | ||
663 | * perf_event_attr::precise_ip. | ||
664 | * | ||
665 | * PERF_RECORD_MISC_SWITCH_OUT_PREEMPT: | ||
666 | * Indicates that thread was preempted in TASK_RUNNING state. | ||
656 | */ | 667 | */ |
657 | #define PERF_RECORD_MISC_EXACT_IP (1 << 14) | 668 | #define PERF_RECORD_MISC_EXACT_IP (1 << 14) |
669 | #define PERF_RECORD_MISC_SWITCH_OUT_PREEMPT (1 << 14) | ||
658 | /* | 670 | /* |
659 | * Reserve the last bit to indicate some extended misc field | 671 | * Reserve the last bit to indicate some extended misc field |
660 | */ | 672 | */ |
diff --git a/tools/include/uapi/sound/asound.h b/tools/include/uapi/sound/asound.h index 07d61583fd02..ed0a120d4f08 100644 --- a/tools/include/uapi/sound/asound.h +++ b/tools/include/uapi/sound/asound.h | |||
@@ -242,6 +242,7 @@ typedef int __bitwise snd_pcm_format_t; | |||
242 | #define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ | 242 | #define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ |
243 | #define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ | 243 | #define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ |
244 | #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE | 244 | #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE |
245 | #define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8 | ||
245 | 246 | ||
246 | #ifdef SNDRV_LITTLE_ENDIAN | 247 | #ifdef SNDRV_LITTLE_ENDIAN |
247 | #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE | 248 | #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE |
diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c index f6a1babcbac4..cb7154eccbdc 100644 --- a/tools/lib/subcmd/parse-options.c +++ b/tools/lib/subcmd/parse-options.c | |||
@@ -433,7 +433,7 @@ match: | |||
433 | 433 | ||
434 | if (ambiguous_option) { | 434 | if (ambiguous_option) { |
435 | fprintf(stderr, | 435 | fprintf(stderr, |
436 | " Error: Ambiguous option: %s (could be --%s%s or --%s%s)", | 436 | " Error: Ambiguous option: %s (could be --%s%s or --%s%s)\n", |
437 | arg, | 437 | arg, |
438 | (ambiguous_flags & OPT_UNSET) ? "no-" : "", | 438 | (ambiguous_flags & OPT_UNSET) ? "no-" : "", |
439 | ambiguous_option->long_name, | 439 | ambiguous_option->long_name, |
@@ -458,7 +458,7 @@ static void check_typos(const char *arg, const struct option *options) | |||
458 | return; | 458 | return; |
459 | 459 | ||
460 | if (strstarts(arg, "no-")) { | 460 | if (strstarts(arg, "no-")) { |
461 | fprintf(stderr, " Error: did you mean `--%s` (with two dashes ?)", arg); | 461 | fprintf(stderr, " Error: did you mean `--%s` (with two dashes ?)\n", arg); |
462 | exit(129); | 462 | exit(129); |
463 | } | 463 | } |
464 | 464 | ||
@@ -466,7 +466,7 @@ static void check_typos(const char *arg, const struct option *options) | |||
466 | if (!options->long_name) | 466 | if (!options->long_name) |
467 | continue; | 467 | continue; |
468 | if (strstarts(options->long_name, arg)) { | 468 | if (strstarts(options->long_name, arg)) { |
469 | fprintf(stderr, " Error: did you mean `--%s` (with two dashes ?)", arg); | 469 | fprintf(stderr, " Error: did you mean `--%s` (with two dashes ?)\n", arg); |
470 | exit(129); | 470 | exit(129); |
471 | } | 471 | } |
472 | } | 472 | } |
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index 8ae824dbfca3..f76d9914686a 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile | |||
@@ -31,8 +31,8 @@ INCLUDES := -I$(srctree)/tools/include \ | |||
31 | -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ | 31 | -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ |
32 | -I$(srctree)/tools/objtool/arch/$(ARCH)/include | 32 | -I$(srctree)/tools/objtool/arch/$(ARCH)/include |
33 | WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed | 33 | WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed |
34 | CFLAGS += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES) | 34 | CFLAGS += -Werror $(WARNINGS) $(HOSTCFLAGS) -g $(INCLUDES) |
35 | LDFLAGS += -lelf $(LIBSUBCMD) | 35 | LDFLAGS += -lelf $(LIBSUBCMD) $(HOSTLDFLAGS) |
36 | 36 | ||
37 | # Allow old libelf to be used: | 37 | # Allow old libelf to be used: |
38 | elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) | 38 | elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) |
diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt index 5b4fff3adc4b..32f4a898e3f2 100644 --- a/tools/perf/Documentation/perf-config.txt +++ b/tools/perf/Documentation/perf-config.txt | |||
@@ -334,6 +334,11 @@ annotate.*:: | |||
334 | 334 | ||
335 | 99.93 │ mov %eax,%eax | 335 | 99.93 │ mov %eax,%eax |
336 | 336 | ||
337 | annotate.offset_level:: | ||
338 | Default is '1', meaning just jump targets will have offsets show right beside | ||
339 | the instruction. When set to '2' 'call' instructions will also have its offsets | ||
340 | shown, 3 or higher will show offsets for all instructions. | ||
341 | |||
337 | hist.*:: | 342 | hist.*:: |
338 | hist.percentage:: | 343 | hist.percentage:: |
339 | This option control the way to calculate overhead of filtered entries - | 344 | This option control the way to calculate overhead of filtered entries - |
diff --git a/tools/perf/Documentation/perf-mem.txt b/tools/perf/Documentation/perf-mem.txt index b0211410969b..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 | |||
66 | RECORD 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,15 @@ 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:: |
81 | --verbose:: | ||
82 | Be more verbose (show counter open errors, etc) | ||
83 | |||
84 | --ldlat <n>:: | ||
64 | Specify desired latency for loads event. | 85 | Specify desired latency for loads event. |
65 | 86 | ||
66 | -p:: | 87 | In addition, for report all perf report options are valid, and for record |
67 | --phys-data:: | 88 | all perf record options. |
68 | Record/Report sample physical addresses | ||
69 | 89 | ||
70 | SEE ALSO | 90 | SEE ALSO |
71 | -------- | 91 | -------- |
diff --git a/tools/perf/Documentation/perf-sched.txt b/tools/perf/Documentation/perf-sched.txt index bb33601a823b..63f938b887dd 100644 --- a/tools/perf/Documentation/perf-sched.txt +++ b/tools/perf/Documentation/perf-sched.txt | |||
@@ -104,8 +104,8 @@ OPTIONS for 'perf sched timehist' | |||
104 | kallsyms pathname | 104 | kallsyms pathname |
105 | 105 | ||
106 | -g:: | 106 | -g:: |
107 | --no-call-graph:: | 107 | --call-graph:: |
108 | Do not display call chains if present. | 108 | Display call chains if present (default on). |
109 | 109 | ||
110 | --max-stack:: | 110 | --max-stack:: |
111 | Maximum number of functions to display in backtrace, default 5. | 111 | Maximum number of functions to display in backtrace, default 5. |
diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt index 36ec0257f8d3..afdafe2110a1 100644 --- a/tools/perf/Documentation/perf-script.txt +++ b/tools/perf/Documentation/perf-script.txt | |||
@@ -228,14 +228,15 @@ OPTIONS | |||
228 | For sample events it's possible to display misc field with -F +misc option, | 228 | For sample events it's possible to display misc field with -F +misc option, |
229 | following letters are displayed for each bit: | 229 | following letters are displayed for each bit: |
230 | 230 | ||
231 | PERF_RECORD_MISC_KERNEL K | 231 | PERF_RECORD_MISC_KERNEL K |
232 | PERF_RECORD_MISC_USER U | 232 | PERF_RECORD_MISC_USER U |
233 | PERF_RECORD_MISC_HYPERVISOR H | 233 | PERF_RECORD_MISC_HYPERVISOR H |
234 | PERF_RECORD_MISC_GUEST_KERNEL G | 234 | PERF_RECORD_MISC_GUEST_KERNEL G |
235 | PERF_RECORD_MISC_GUEST_USER g | 235 | PERF_RECORD_MISC_GUEST_USER g |
236 | PERF_RECORD_MISC_MMAP_DATA* M | 236 | PERF_RECORD_MISC_MMAP_DATA* M |
237 | PERF_RECORD_MISC_COMM_EXEC E | 237 | PERF_RECORD_MISC_COMM_EXEC E |
238 | PERF_RECORD_MISC_SWITCH_OUT S | 238 | PERF_RECORD_MISC_SWITCH_OUT S |
239 | PERF_RECORD_MISC_SWITCH_OUT_PREEMPT Sp | ||
239 | 240 | ||
240 | $ perf script -F +misc ... | 241 | $ perf script -F +misc ... |
241 | sched-messaging 1414 K 28690.636582: 4590 cycles ... | 242 | sched-messaging 1414 K 28690.636582: 4590 cycles ... |
diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt index f15b306be183..e6c3b4e555c2 100644 --- a/tools/perf/Documentation/perf-stat.txt +++ b/tools/perf/Documentation/perf-stat.txt | |||
@@ -153,7 +153,7 @@ perf stat --repeat 10 --null --sync --pre 'make -s O=defconfig-build/clean' -- m | |||
153 | 153 | ||
154 | -I msecs:: | 154 | -I msecs:: |
155 | --interval-print msecs:: | 155 | --interval-print msecs:: |
156 | Print count deltas every N milliseconds (minimum: 10ms) | 156 | Print count deltas every N milliseconds (minimum: 1ms) |
157 | The overhead percentage could be high in some cases, for instance with small, sub 100ms intervals. Use with caution. | 157 | The overhead percentage could be high in some cases, for instance with small, sub 100ms intervals. Use with caution. |
158 | example: 'perf stat -I 1000 -e cycles -a sleep 5' | 158 | example: 'perf stat -I 1000 -e cycles -a sleep 5' |
159 | 159 | ||
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index c7abd83a8e19..ae7dc46e8f8a 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
@@ -68,7 +68,7 @@ ifeq ($(NO_PERF_REGS),0) | |||
68 | endif | 68 | endif |
69 | 69 | ||
70 | ifneq ($(NO_SYSCALL_TABLE),1) | 70 | ifneq ($(NO_SYSCALL_TABLE),1) |
71 | CFLAGS += -DHAVE_SYSCALL_TABLE | 71 | CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT |
72 | endif | 72 | endif |
73 | 73 | ||
74 | # So far there's only x86 and arm libdw unwind support merged in perf. | 74 | # So far there's only x86 and arm libdw unwind support merged in perf. |
@@ -847,7 +847,7 @@ ifndef NO_JVMTI | |||
847 | ifeq ($(feature-jvmti), 1) | 847 | ifeq ($(feature-jvmti), 1) |
848 | $(call detected_var,JDIR) | 848 | $(call detected_var,JDIR) |
849 | else | 849 | else |
850 | $(warning No openjdk development package found, please install JDK package) | 850 | $(warning No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel) |
851 | NO_JVMTI := 1 | 851 | NO_JVMTI := 1 |
852 | endif | 852 | endif |
853 | endif | 853 | endif |
diff --git a/tools/perf/arch/arm/include/arch-tests.h b/tools/perf/arch/arm/include/arch-tests.h new file mode 100644 index 000000000000..90ec4c8cb880 --- /dev/null +++ b/tools/perf/arch/arm/include/arch-tests.h | |||
@@ -0,0 +1,12 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef ARCH_TESTS_H | ||
3 | #define ARCH_TESTS_H | ||
4 | |||
5 | #ifdef HAVE_DWARF_UNWIND_SUPPORT | ||
6 | struct thread; | ||
7 | struct perf_sample; | ||
8 | #endif | ||
9 | |||
10 | extern struct test arch_tests[]; | ||
11 | |||
12 | #endif | ||
diff --git a/tools/perf/arch/arm/tests/Build b/tools/perf/arch/arm/tests/Build index b30eff9bcc83..883c57ff0c08 100644 --- a/tools/perf/arch/arm/tests/Build +++ b/tools/perf/arch/arm/tests/Build | |||
@@ -1,2 +1,4 @@ | |||
1 | libperf-y += regs_load.o | 1 | libperf-y += regs_load.o |
2 | libperf-y += dwarf-unwind.o | 2 | libperf-y += dwarf-unwind.o |
3 | |||
4 | libperf-y += arch-tests.o | ||
diff --git a/tools/perf/arch/arm/tests/arch-tests.c b/tools/perf/arch/arm/tests/arch-tests.c new file mode 100644 index 000000000000..5b1543c98022 --- /dev/null +++ b/tools/perf/arch/arm/tests/arch-tests.c | |||
@@ -0,0 +1,16 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | #include <string.h> | ||
3 | #include "tests/tests.h" | ||
4 | #include "arch-tests.h" | ||
5 | |||
6 | struct test arch_tests[] = { | ||
7 | #ifdef HAVE_DWARF_UNWIND_SUPPORT | ||
8 | { | ||
9 | .desc = "DWARF unwind", | ||
10 | .func = test__dwarf_unwind, | ||
11 | }, | ||
12 | #endif | ||
13 | { | ||
14 | .func = NULL, | ||
15 | }, | ||
16 | }; | ||
diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c index fa639e3e52ac..1ce6bdbda561 100644 --- a/tools/perf/arch/arm/util/auxtrace.c +++ b/tools/perf/arch/arm/util/auxtrace.c | |||
@@ -1,18 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright(C) 2015 Linaro Limited. All rights reserved. | 3 | * Copyright(C) 2015 Linaro Limited. All rights reserved. |
3 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> | 4 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> |
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 5 | */ |
17 | 6 | ||
18 | #include <stdbool.h> | 7 | #include <stdbool.h> |
diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index 5c655ad4621e..2f595cd73da6 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c | |||
@@ -1,18 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright(C) 2015 Linaro Limited. All rights reserved. | 3 | * Copyright(C) 2015 Linaro Limited. All rights reserved. |
3 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> | 4 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> |
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 5 | */ |
17 | 6 | ||
18 | #include <api/fs/fs.h> | 7 | #include <api/fs/fs.h> |
diff --git a/tools/perf/arch/arm/util/cs-etm.h b/tools/perf/arch/arm/util/cs-etm.h index 5256741be549..1a12e64f5127 100644 --- a/tools/perf/arch/arm/util/cs-etm.h +++ b/tools/perf/arch/arm/util/cs-etm.h | |||
@@ -1,18 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright(C) 2015 Linaro Limited. All rights reserved. | 3 | * Copyright(C) 2015 Linaro Limited. All rights reserved. |
3 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> | 4 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> |
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 5 | */ |
17 | 6 | ||
18 | #ifndef INCLUDE__PERF_CS_ETM_H__ | 7 | #ifndef INCLUDE__PERF_CS_ETM_H__ |
diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c index ac4dffc807b8..e047571e6080 100644 --- a/tools/perf/arch/arm/util/pmu.c +++ b/tools/perf/arch/arm/util/pmu.c | |||
@@ -1,18 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright(C) 2015 Linaro Limited. All rights reserved. | 3 | * Copyright(C) 2015 Linaro Limited. All rights reserved. |
3 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> | 4 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> |
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 5 | */ |
17 | 6 | ||
18 | #include <string.h> | 7 | #include <string.h> |
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 | */ | ||
159 | int 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/arch/x86/Makefile b/tools/perf/arch/x86/Makefile index d74eaa7aa927..1a38e78117ce 100644 --- a/tools/perf/arch/x86/Makefile +++ b/tools/perf/arch/x86/Makefile | |||
@@ -21,7 +21,7 @@ _dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') | |||
21 | $(header): $(sys)/syscall_64.tbl $(systbl) | 21 | $(header): $(sys)/syscall_64.tbl $(systbl) |
22 | @(test -d ../../kernel -a -d ../../tools -a -d ../perf && ( \ | 22 | @(test -d ../../kernel -a -d ../../tools -a -d ../perf && ( \ |
23 | (diff -B arch/x86/entry/syscalls/syscall_64.tbl ../../arch/x86/entry/syscalls/syscall_64.tbl >/dev/null) \ | 23 | (diff -B arch/x86/entry/syscalls/syscall_64.tbl ../../arch/x86/entry/syscalls/syscall_64.tbl >/dev/null) \ |
24 | || echo "Warning: Kernel ABI header at 'tools/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'" >&2 )) || true | 24 | || echo "Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'" >&2 )) || true |
25 | $(Q)$(SHELL) '$(systbl)' $(sys)/syscall_64.tbl 'x86_64' > $@ | 25 | $(Q)$(SHELL) '$(systbl)' $(sys)/syscall_64.tbl 'x86_64' > $@ |
26 | 26 | ||
27 | clean:: | 27 | clean:: |
diff --git a/tools/perf/arch/x86/annotate/instructions.c b/tools/perf/arch/x86/annotate/instructions.c index 5bd1ba8c0282..44f5aba78210 100644 --- a/tools/perf/arch/x86/annotate/instructions.c +++ b/tools/perf/arch/x86/annotate/instructions.c | |||
@@ -1,21 +1,43 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | static struct ins x86__instructions[] = { | 2 | static struct ins x86__instructions[] = { |
3 | { .name = "adc", .ops = &mov_ops, }, | ||
4 | { .name = "adcb", .ops = &mov_ops, }, | ||
5 | { .name = "adcl", .ops = &mov_ops, }, | ||
3 | { .name = "add", .ops = &mov_ops, }, | 6 | { .name = "add", .ops = &mov_ops, }, |
4 | { .name = "addl", .ops = &mov_ops, }, | 7 | { .name = "addl", .ops = &mov_ops, }, |
5 | { .name = "addq", .ops = &mov_ops, }, | 8 | { .name = "addq", .ops = &mov_ops, }, |
9 | { .name = "addsd", .ops = &mov_ops, }, | ||
6 | { .name = "addw", .ops = &mov_ops, }, | 10 | { .name = "addw", .ops = &mov_ops, }, |
7 | { .name = "and", .ops = &mov_ops, }, | 11 | { .name = "and", .ops = &mov_ops, }, |
12 | { .name = "andb", .ops = &mov_ops, }, | ||
13 | { .name = "andl", .ops = &mov_ops, }, | ||
14 | { .name = "andpd", .ops = &mov_ops, }, | ||
15 | { .name = "andps", .ops = &mov_ops, }, | ||
16 | { .name = "andq", .ops = &mov_ops, }, | ||
17 | { .name = "andw", .ops = &mov_ops, }, | ||
18 | { .name = "bsr", .ops = &mov_ops, }, | ||
19 | { .name = "bt", .ops = &mov_ops, }, | ||
20 | { .name = "btr", .ops = &mov_ops, }, | ||
8 | { .name = "bts", .ops = &mov_ops, }, | 21 | { .name = "bts", .ops = &mov_ops, }, |
22 | { .name = "btsq", .ops = &mov_ops, }, | ||
9 | { .name = "call", .ops = &call_ops, }, | 23 | { .name = "call", .ops = &call_ops, }, |
10 | { .name = "callq", .ops = &call_ops, }, | 24 | { .name = "callq", .ops = &call_ops, }, |
25 | { .name = "cmovbe", .ops = &mov_ops, }, | ||
26 | { .name = "cmove", .ops = &mov_ops, }, | ||
27 | { .name = "cmovae", .ops = &mov_ops, }, | ||
11 | { .name = "cmp", .ops = &mov_ops, }, | 28 | { .name = "cmp", .ops = &mov_ops, }, |
12 | { .name = "cmpb", .ops = &mov_ops, }, | 29 | { .name = "cmpb", .ops = &mov_ops, }, |
13 | { .name = "cmpl", .ops = &mov_ops, }, | 30 | { .name = "cmpl", .ops = &mov_ops, }, |
14 | { .name = "cmpq", .ops = &mov_ops, }, | 31 | { .name = "cmpq", .ops = &mov_ops, }, |
15 | { .name = "cmpw", .ops = &mov_ops, }, | 32 | { .name = "cmpw", .ops = &mov_ops, }, |
16 | { .name = "cmpxch", .ops = &mov_ops, }, | 33 | { .name = "cmpxch", .ops = &mov_ops, }, |
34 | { .name = "cmpxchg", .ops = &mov_ops, }, | ||
35 | { .name = "cs", .ops = &mov_ops, }, | ||
17 | { .name = "dec", .ops = &dec_ops, }, | 36 | { .name = "dec", .ops = &dec_ops, }, |
18 | { .name = "decl", .ops = &dec_ops, }, | 37 | { .name = "decl", .ops = &dec_ops, }, |
38 | { .name = "divsd", .ops = &mov_ops, }, | ||
39 | { .name = "divss", .ops = &mov_ops, }, | ||
40 | { .name = "gs", .ops = &mov_ops, }, | ||
19 | { .name = "imul", .ops = &mov_ops, }, | 41 | { .name = "imul", .ops = &mov_ops, }, |
20 | { .name = "inc", .ops = &dec_ops, }, | 42 | { .name = "inc", .ops = &dec_ops, }, |
21 | { .name = "incl", .ops = &dec_ops, }, | 43 | { .name = "incl", .ops = &dec_ops, }, |
@@ -57,25 +79,68 @@ static struct ins x86__instructions[] = { | |||
57 | { .name = "lea", .ops = &mov_ops, }, | 79 | { .name = "lea", .ops = &mov_ops, }, |
58 | { .name = "lock", .ops = &lock_ops, }, | 80 | { .name = "lock", .ops = &lock_ops, }, |
59 | { .name = "mov", .ops = &mov_ops, }, | 81 | { .name = "mov", .ops = &mov_ops, }, |
82 | { .name = "movapd", .ops = &mov_ops, }, | ||
83 | { .name = "movaps", .ops = &mov_ops, }, | ||
60 | { .name = "movb", .ops = &mov_ops, }, | 84 | { .name = "movb", .ops = &mov_ops, }, |
61 | { .name = "movdqa", .ops = &mov_ops, }, | 85 | { .name = "movdqa", .ops = &mov_ops, }, |
86 | { .name = "movdqu", .ops = &mov_ops, }, | ||
62 | { .name = "movl", .ops = &mov_ops, }, | 87 | { .name = "movl", .ops = &mov_ops, }, |
63 | { .name = "movq", .ops = &mov_ops, }, | 88 | { .name = "movq", .ops = &mov_ops, }, |
89 | { .name = "movsd", .ops = &mov_ops, }, | ||
64 | { .name = "movslq", .ops = &mov_ops, }, | 90 | { .name = "movslq", .ops = &mov_ops, }, |
91 | { .name = "movss", .ops = &mov_ops, }, | ||
92 | { .name = "movupd", .ops = &mov_ops, }, | ||
93 | { .name = "movups", .ops = &mov_ops, }, | ||
94 | { .name = "movw", .ops = &mov_ops, }, | ||
65 | { .name = "movzbl", .ops = &mov_ops, }, | 95 | { .name = "movzbl", .ops = &mov_ops, }, |
66 | { .name = "movzwl", .ops = &mov_ops, }, | 96 | { .name = "movzwl", .ops = &mov_ops, }, |
97 | { .name = "mulsd", .ops = &mov_ops, }, | ||
98 | { .name = "mulss", .ops = &mov_ops, }, | ||
67 | { .name = "nop", .ops = &nop_ops, }, | 99 | { .name = "nop", .ops = &nop_ops, }, |
68 | { .name = "nopl", .ops = &nop_ops, }, | 100 | { .name = "nopl", .ops = &nop_ops, }, |
69 | { .name = "nopw", .ops = &nop_ops, }, | 101 | { .name = "nopw", .ops = &nop_ops, }, |
70 | { .name = "or", .ops = &mov_ops, }, | 102 | { .name = "or", .ops = &mov_ops, }, |
103 | { .name = "orb", .ops = &mov_ops, }, | ||
71 | { .name = "orl", .ops = &mov_ops, }, | 104 | { .name = "orl", .ops = &mov_ops, }, |
105 | { .name = "orps", .ops = &mov_ops, }, | ||
106 | { .name = "orq", .ops = &mov_ops, }, | ||
107 | { .name = "pand", .ops = &mov_ops, }, | ||
108 | { .name = "paddq", .ops = &mov_ops, }, | ||
109 | { .name = "pcmpeqb", .ops = &mov_ops, }, | ||
110 | { .name = "por", .ops = &mov_ops, }, | ||
111 | { .name = "rclb", .ops = &mov_ops, }, | ||
112 | { .name = "rcll", .ops = &mov_ops, }, | ||
113 | { .name = "retq", .ops = &ret_ops, }, | ||
114 | { .name = "sbb", .ops = &mov_ops, }, | ||
115 | { .name = "sbbl", .ops = &mov_ops, }, | ||
116 | { .name = "sete", .ops = &mov_ops, }, | ||
117 | { .name = "sub", .ops = &mov_ops, }, | ||
118 | { .name = "subl", .ops = &mov_ops, }, | ||
119 | { .name = "subq", .ops = &mov_ops, }, | ||
120 | { .name = "subsd", .ops = &mov_ops, }, | ||
121 | { .name = "subw", .ops = &mov_ops, }, | ||
72 | { .name = "test", .ops = &mov_ops, }, | 122 | { .name = "test", .ops = &mov_ops, }, |
73 | { .name = "testb", .ops = &mov_ops, }, | 123 | { .name = "testb", .ops = &mov_ops, }, |
74 | { .name = "testl", .ops = &mov_ops, }, | 124 | { .name = "testl", .ops = &mov_ops, }, |
125 | { .name = "ucomisd", .ops = &mov_ops, }, | ||
126 | { .name = "ucomiss", .ops = &mov_ops, }, | ||
127 | { .name = "vaddsd", .ops = &mov_ops, }, | ||
128 | { .name = "vandpd", .ops = &mov_ops, }, | ||
129 | { .name = "vmovdqa", .ops = &mov_ops, }, | ||
130 | { .name = "vmovq", .ops = &mov_ops, }, | ||
131 | { .name = "vmovsd", .ops = &mov_ops, }, | ||
132 | { .name = "vmulsd", .ops = &mov_ops, }, | ||
133 | { .name = "vorpd", .ops = &mov_ops, }, | ||
134 | { .name = "vsubsd", .ops = &mov_ops, }, | ||
135 | { .name = "vucomisd", .ops = &mov_ops, }, | ||
75 | { .name = "xadd", .ops = &mov_ops, }, | 136 | { .name = "xadd", .ops = &mov_ops, }, |
76 | { .name = "xbeginl", .ops = &jump_ops, }, | 137 | { .name = "xbeginl", .ops = &jump_ops, }, |
77 | { .name = "xbeginq", .ops = &jump_ops, }, | 138 | { .name = "xbeginq", .ops = &jump_ops, }, |
78 | { .name = "retq", .ops = &ret_ops, }, | 139 | { .name = "xchg", .ops = &mov_ops, }, |
140 | { .name = "xor", .ops = &mov_ops, }, | ||
141 | { .name = "xorb", .ops = &mov_ops, }, | ||
142 | { .name = "xorpd", .ops = &mov_ops, }, | ||
143 | { .name = "xorps", .ops = &mov_ops, }, | ||
79 | }; | 144 | }; |
80 | 145 | ||
81 | static bool x86__ins_is_fused(struct arch *arch, const char *ins1, | 146 | static bool x86__ins_is_fused(struct arch *arch, const char *ins1, |
diff --git a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl index 5aef183e2f85..4dfe42666d0c 100644 --- a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +++ b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | |||
@@ -4,379 +4,383 @@ | |||
4 | # The format is: | 4 | # The format is: |
5 | # <number> <abi> <name> <entry point> | 5 | # <number> <abi> <name> <entry point> |
6 | # | 6 | # |
7 | # The __x64_sys_*() stubs are created on-the-fly for sys_*() system calls | ||
8 | # | ||
7 | # The abi is "common", "64" or "x32" for this file. | 9 | # The abi is "common", "64" or "x32" for this file. |
8 | # | 10 | # |
9 | 0 common read sys_read | 11 | 0 common read __x64_sys_read |
10 | 1 common write sys_write | 12 | 1 common write __x64_sys_write |
11 | 2 common open sys_open | 13 | 2 common open __x64_sys_open |
12 | 3 common close sys_close | 14 | 3 common close __x64_sys_close |
13 | 4 common stat sys_newstat | 15 | 4 common stat __x64_sys_newstat |
14 | 5 common fstat sys_newfstat | 16 | 5 common fstat __x64_sys_newfstat |
15 | 6 common lstat sys_newlstat | 17 | 6 common lstat __x64_sys_newlstat |
16 | 7 common poll sys_poll | 18 | 7 common poll __x64_sys_poll |
17 | 8 common lseek sys_lseek | 19 | 8 common lseek __x64_sys_lseek |
18 | 9 common mmap sys_mmap | 20 | 9 common mmap __x64_sys_mmap |
19 | 10 common mprotect sys_mprotect | 21 | 10 common mprotect __x64_sys_mprotect |
20 | 11 common munmap sys_munmap | 22 | 11 common munmap __x64_sys_munmap |
21 | 12 common brk sys_brk | 23 | 12 common brk __x64_sys_brk |
22 | 13 64 rt_sigaction sys_rt_sigaction | 24 | 13 64 rt_sigaction __x64_sys_rt_sigaction |
23 | 14 common rt_sigprocmask sys_rt_sigprocmask | 25 | 14 common rt_sigprocmask __x64_sys_rt_sigprocmask |
24 | 15 64 rt_sigreturn sys_rt_sigreturn/ptregs | 26 | 15 64 rt_sigreturn __x64_sys_rt_sigreturn/ptregs |
25 | 16 64 ioctl sys_ioctl | 27 | 16 64 ioctl __x64_sys_ioctl |
26 | 17 common pread64 sys_pread64 | 28 | 17 common pread64 __x64_sys_pread64 |
27 | 18 common pwrite64 sys_pwrite64 | 29 | 18 common pwrite64 __x64_sys_pwrite64 |
28 | 19 64 readv sys_readv | 30 | 19 64 readv __x64_sys_readv |
29 | 20 64 writev sys_writev | 31 | 20 64 writev __x64_sys_writev |
30 | 21 common access sys_access | 32 | 21 common access __x64_sys_access |
31 | 22 common pipe sys_pipe | 33 | 22 common pipe __x64_sys_pipe |
32 | 23 common select sys_select | 34 | 23 common select __x64_sys_select |
33 | 24 common sched_yield sys_sched_yield | 35 | 24 common sched_yield __x64_sys_sched_yield |
34 | 25 common mremap sys_mremap | 36 | 25 common mremap __x64_sys_mremap |
35 | 26 common msync sys_msync | 37 | 26 common msync __x64_sys_msync |
36 | 27 common mincore sys_mincore | 38 | 27 common mincore __x64_sys_mincore |
37 | 28 common madvise sys_madvise | 39 | 28 common madvise __x64_sys_madvise |
38 | 29 common shmget sys_shmget | 40 | 29 common shmget __x64_sys_shmget |
39 | 30 common shmat sys_shmat | 41 | 30 common shmat __x64_sys_shmat |
40 | 31 common shmctl sys_shmctl | 42 | 31 common shmctl __x64_sys_shmctl |
41 | 32 common dup sys_dup | 43 | 32 common dup __x64_sys_dup |
42 | 33 common dup2 sys_dup2 | 44 | 33 common dup2 __x64_sys_dup2 |
43 | 34 common pause sys_pause | 45 | 34 common pause __x64_sys_pause |
44 | 35 common nanosleep sys_nanosleep | 46 | 35 common nanosleep __x64_sys_nanosleep |
45 | 36 common getitimer sys_getitimer | 47 | 36 common getitimer __x64_sys_getitimer |
46 | 37 common alarm sys_alarm | 48 | 37 common alarm __x64_sys_alarm |
47 | 38 common setitimer sys_setitimer | 49 | 38 common setitimer __x64_sys_setitimer |
48 | 39 common getpid sys_getpid | 50 | 39 common getpid __x64_sys_getpid |
49 | 40 common sendfile sys_sendfile64 | 51 | 40 common sendfile __x64_sys_sendfile64 |
50 | 41 common socket sys_socket | 52 | 41 common socket __x64_sys_socket |
51 | 42 common connect sys_connect | 53 | 42 common connect __x64_sys_connect |
52 | 43 common accept sys_accept | 54 | 43 common accept __x64_sys_accept |
53 | 44 common sendto sys_sendto | 55 | 44 common sendto __x64_sys_sendto |
54 | 45 64 recvfrom sys_recvfrom | 56 | 45 64 recvfrom __x64_sys_recvfrom |
55 | 46 64 sendmsg sys_sendmsg | 57 | 46 64 sendmsg __x64_sys_sendmsg |
56 | 47 64 recvmsg sys_recvmsg | 58 | 47 64 recvmsg __x64_sys_recvmsg |
57 | 48 common shutdown sys_shutdown | 59 | 48 common shutdown __x64_sys_shutdown |
58 | 49 common bind sys_bind | 60 | 49 common bind __x64_sys_bind |
59 | 50 common listen sys_listen | 61 | 50 common listen __x64_sys_listen |
60 | 51 common getsockname sys_getsockname | 62 | 51 common getsockname __x64_sys_getsockname |
61 | 52 common getpeername sys_getpeername | 63 | 52 common getpeername __x64_sys_getpeername |
62 | 53 common socketpair sys_socketpair | 64 | 53 common socketpair __x64_sys_socketpair |
63 | 54 64 setsockopt sys_setsockopt | 65 | 54 64 setsockopt __x64_sys_setsockopt |
64 | 55 64 getsockopt sys_getsockopt | 66 | 55 64 getsockopt __x64_sys_getsockopt |
65 | 56 common clone sys_clone/ptregs | 67 | 56 common clone __x64_sys_clone/ptregs |
66 | 57 common fork sys_fork/ptregs | 68 | 57 common fork __x64_sys_fork/ptregs |
67 | 58 common vfork sys_vfork/ptregs | 69 | 58 common vfork __x64_sys_vfork/ptregs |
68 | 59 64 execve sys_execve/ptregs | 70 | 59 64 execve __x64_sys_execve/ptregs |
69 | 60 common exit sys_exit | 71 | 60 common exit __x64_sys_exit |
70 | 61 common wait4 sys_wait4 | 72 | 61 common wait4 __x64_sys_wait4 |
71 | 62 common kill sys_kill | 73 | 62 common kill __x64_sys_kill |
72 | 63 common uname sys_newuname | 74 | 63 common uname __x64_sys_newuname |
73 | 64 common semget sys_semget | 75 | 64 common semget __x64_sys_semget |
74 | 65 common semop sys_semop | 76 | 65 common semop __x64_sys_semop |
75 | 66 common semctl sys_semctl | 77 | 66 common semctl __x64_sys_semctl |
76 | 67 common shmdt sys_shmdt | 78 | 67 common shmdt __x64_sys_shmdt |
77 | 68 common msgget sys_msgget | 79 | 68 common msgget __x64_sys_msgget |
78 | 69 common msgsnd sys_msgsnd | 80 | 69 common msgsnd __x64_sys_msgsnd |
79 | 70 common msgrcv sys_msgrcv | 81 | 70 common msgrcv __x64_sys_msgrcv |
80 | 71 common msgctl sys_msgctl | 82 | 71 common msgctl __x64_sys_msgctl |
81 | 72 common fcntl sys_fcntl | 83 | 72 common fcntl __x64_sys_fcntl |
82 | 73 common flock sys_flock | 84 | 73 common flock __x64_sys_flock |
83 | 74 common fsync sys_fsync | 85 | 74 common fsync __x64_sys_fsync |
84 | 75 common fdatasync sys_fdatasync | 86 | 75 common fdatasync __x64_sys_fdatasync |
85 | 76 common truncate sys_truncate | 87 | 76 common truncate __x64_sys_truncate |
86 | 77 common ftruncate sys_ftruncate | 88 | 77 common ftruncate __x64_sys_ftruncate |
87 | 78 common getdents sys_getdents | 89 | 78 common getdents __x64_sys_getdents |
88 | 79 common getcwd sys_getcwd | 90 | 79 common getcwd __x64_sys_getcwd |
89 | 80 common chdir sys_chdir | 91 | 80 common chdir __x64_sys_chdir |
90 | 81 common fchdir sys_fchdir | 92 | 81 common fchdir __x64_sys_fchdir |
91 | 82 common rename sys_rename | 93 | 82 common rename __x64_sys_rename |
92 | 83 common mkdir sys_mkdir | 94 | 83 common mkdir __x64_sys_mkdir |
93 | 84 common rmdir sys_rmdir | 95 | 84 common rmdir __x64_sys_rmdir |
94 | 85 common creat sys_creat | 96 | 85 common creat __x64_sys_creat |
95 | 86 common link sys_link | 97 | 86 common link __x64_sys_link |
96 | 87 common unlink sys_unlink | 98 | 87 common unlink __x64_sys_unlink |
97 | 88 common symlink sys_symlink | 99 | 88 common symlink __x64_sys_symlink |
98 | 89 common readlink sys_readlink | 100 | 89 common readlink __x64_sys_readlink |
99 | 90 common chmod sys_chmod | 101 | 90 common chmod __x64_sys_chmod |
100 | 91 common fchmod sys_fchmod | 102 | 91 common fchmod __x64_sys_fchmod |
101 | 92 common chown sys_chown | 103 | 92 common chown __x64_sys_chown |
102 | 93 common fchown sys_fchown | 104 | 93 common fchown __x64_sys_fchown |
103 | 94 common lchown sys_lchown | 105 | 94 common lchown __x64_sys_lchown |
104 | 95 common umask sys_umask | 106 | 95 common umask __x64_sys_umask |
105 | 96 common gettimeofday sys_gettimeofday | 107 | 96 common gettimeofday __x64_sys_gettimeofday |
106 | 97 common getrlimit sys_getrlimit | 108 | 97 common getrlimit __x64_sys_getrlimit |
107 | 98 common getrusage sys_getrusage | 109 | 98 common getrusage __x64_sys_getrusage |
108 | 99 common sysinfo sys_sysinfo | 110 | 99 common sysinfo __x64_sys_sysinfo |
109 | 100 common times sys_times | 111 | 100 common times __x64_sys_times |
110 | 101 64 ptrace sys_ptrace | 112 | 101 64 ptrace __x64_sys_ptrace |
111 | 102 common getuid sys_getuid | 113 | 102 common getuid __x64_sys_getuid |
112 | 103 common syslog sys_syslog | 114 | 103 common syslog __x64_sys_syslog |
113 | 104 common getgid sys_getgid | 115 | 104 common getgid __x64_sys_getgid |
114 | 105 common setuid sys_setuid | 116 | 105 common setuid __x64_sys_setuid |
115 | 106 common setgid sys_setgid | 117 | 106 common setgid __x64_sys_setgid |
116 | 107 common geteuid sys_geteuid | 118 | 107 common geteuid __x64_sys_geteuid |
117 | 108 common getegid sys_getegid | 119 | 108 common getegid __x64_sys_getegid |
118 | 109 common setpgid sys_setpgid | 120 | 109 common setpgid __x64_sys_setpgid |
119 | 110 common getppid sys_getppid | 121 | 110 common getppid __x64_sys_getppid |
120 | 111 common getpgrp sys_getpgrp | 122 | 111 common getpgrp __x64_sys_getpgrp |
121 | 112 common setsid sys_setsid | 123 | 112 common setsid __x64_sys_setsid |
122 | 113 common setreuid sys_setreuid | 124 | 113 common setreuid __x64_sys_setreuid |
123 | 114 common setregid sys_setregid | 125 | 114 common setregid __x64_sys_setregid |
124 | 115 common getgroups sys_getgroups | 126 | 115 common getgroups __x64_sys_getgroups |
125 | 116 common setgroups sys_setgroups | 127 | 116 common setgroups __x64_sys_setgroups |
126 | 117 common setresuid sys_setresuid | 128 | 117 common setresuid __x64_sys_setresuid |
127 | 118 common getresuid sys_getresuid | 129 | 118 common getresuid __x64_sys_getresuid |
128 | 119 common setresgid sys_setresgid | 130 | 119 common setresgid __x64_sys_setresgid |
129 | 120 common getresgid sys_getresgid | 131 | 120 common getresgid __x64_sys_getresgid |
130 | 121 common getpgid sys_getpgid | 132 | 121 common getpgid __x64_sys_getpgid |
131 | 122 common setfsuid sys_setfsuid | 133 | 122 common setfsuid __x64_sys_setfsuid |
132 | 123 common setfsgid sys_setfsgid | 134 | 123 common setfsgid __x64_sys_setfsgid |
133 | 124 common getsid sys_getsid | 135 | 124 common getsid __x64_sys_getsid |
134 | 125 common capget sys_capget | 136 | 125 common capget __x64_sys_capget |
135 | 126 common capset sys_capset | 137 | 126 common capset __x64_sys_capset |
136 | 127 64 rt_sigpending sys_rt_sigpending | 138 | 127 64 rt_sigpending __x64_sys_rt_sigpending |
137 | 128 64 rt_sigtimedwait sys_rt_sigtimedwait | 139 | 128 64 rt_sigtimedwait __x64_sys_rt_sigtimedwait |
138 | 129 64 rt_sigqueueinfo sys_rt_sigqueueinfo | 140 | 129 64 rt_sigqueueinfo __x64_sys_rt_sigqueueinfo |
139 | 130 common rt_sigsuspend sys_rt_sigsuspend | 141 | 130 common rt_sigsuspend __x64_sys_rt_sigsuspend |
140 | 131 64 sigaltstack sys_sigaltstack | 142 | 131 64 sigaltstack __x64_sys_sigaltstack |
141 | 132 common utime sys_utime | 143 | 132 common utime __x64_sys_utime |
142 | 133 common mknod sys_mknod | 144 | 133 common mknod __x64_sys_mknod |
143 | 134 64 uselib | 145 | 134 64 uselib |
144 | 135 common personality sys_personality | 146 | 135 common personality __x64_sys_personality |
145 | 136 common ustat sys_ustat | 147 | 136 common ustat __x64_sys_ustat |
146 | 137 common statfs sys_statfs | 148 | 137 common statfs __x64_sys_statfs |
147 | 138 common fstatfs sys_fstatfs | 149 | 138 common fstatfs __x64_sys_fstatfs |
148 | 139 common sysfs sys_sysfs | 150 | 139 common sysfs __x64_sys_sysfs |
149 | 140 common getpriority sys_getpriority | 151 | 140 common getpriority __x64_sys_getpriority |
150 | 141 common setpriority sys_setpriority | 152 | 141 common setpriority __x64_sys_setpriority |
151 | 142 common sched_setparam sys_sched_setparam | 153 | 142 common sched_setparam __x64_sys_sched_setparam |
152 | 143 common sched_getparam sys_sched_getparam | 154 | 143 common sched_getparam __x64_sys_sched_getparam |
153 | 144 common sched_setscheduler sys_sched_setscheduler | 155 | 144 common sched_setscheduler __x64_sys_sched_setscheduler |
154 | 145 common sched_getscheduler sys_sched_getscheduler | 156 | 145 common sched_getscheduler __x64_sys_sched_getscheduler |
155 | 146 common sched_get_priority_max sys_sched_get_priority_max | 157 | 146 common sched_get_priority_max __x64_sys_sched_get_priority_max |
156 | 147 common sched_get_priority_min sys_sched_get_priority_min | 158 | 147 common sched_get_priority_min __x64_sys_sched_get_priority_min |
157 | 148 common sched_rr_get_interval sys_sched_rr_get_interval | 159 | 148 common sched_rr_get_interval __x64_sys_sched_rr_get_interval |
158 | 149 common mlock sys_mlock | 160 | 149 common mlock __x64_sys_mlock |
159 | 150 common munlock sys_munlock | 161 | 150 common munlock __x64_sys_munlock |
160 | 151 common mlockall sys_mlockall | 162 | 151 common mlockall __x64_sys_mlockall |
161 | 152 common munlockall sys_munlockall | 163 | 152 common munlockall __x64_sys_munlockall |
162 | 153 common vhangup sys_vhangup | 164 | 153 common vhangup __x64_sys_vhangup |
163 | 154 common modify_ldt sys_modify_ldt | 165 | 154 common modify_ldt __x64_sys_modify_ldt |
164 | 155 common pivot_root sys_pivot_root | 166 | 155 common pivot_root __x64_sys_pivot_root |
165 | 156 64 _sysctl sys_sysctl | 167 | 156 64 _sysctl __x64_sys_sysctl |
166 | 157 common prctl sys_prctl | 168 | 157 common prctl __x64_sys_prctl |
167 | 158 common arch_prctl sys_arch_prctl | 169 | 158 common arch_prctl __x64_sys_arch_prctl |
168 | 159 common adjtimex sys_adjtimex | 170 | 159 common adjtimex __x64_sys_adjtimex |
169 | 160 common setrlimit sys_setrlimit | 171 | 160 common setrlimit __x64_sys_setrlimit |
170 | 161 common chroot sys_chroot | 172 | 161 common chroot __x64_sys_chroot |
171 | 162 common sync sys_sync | 173 | 162 common sync __x64_sys_sync |
172 | 163 common acct sys_acct | 174 | 163 common acct __x64_sys_acct |
173 | 164 common settimeofday sys_settimeofday | 175 | 164 common settimeofday __x64_sys_settimeofday |
174 | 165 common mount sys_mount | 176 | 165 common mount __x64_sys_mount |
175 | 166 common umount2 sys_umount | 177 | 166 common umount2 __x64_sys_umount |
176 | 167 common swapon sys_swapon | 178 | 167 common swapon __x64_sys_swapon |
177 | 168 common swapoff sys_swapoff | 179 | 168 common swapoff __x64_sys_swapoff |
178 | 169 common reboot sys_reboot | 180 | 169 common reboot __x64_sys_reboot |
179 | 170 common sethostname sys_sethostname | 181 | 170 common sethostname __x64_sys_sethostname |
180 | 171 common setdomainname sys_setdomainname | 182 | 171 common setdomainname __x64_sys_setdomainname |
181 | 172 common iopl sys_iopl/ptregs | 183 | 172 common iopl __x64_sys_iopl/ptregs |
182 | 173 common ioperm sys_ioperm | 184 | 173 common ioperm __x64_sys_ioperm |
183 | 174 64 create_module | 185 | 174 64 create_module |
184 | 175 common init_module sys_init_module | 186 | 175 common init_module __x64_sys_init_module |
185 | 176 common delete_module sys_delete_module | 187 | 176 common delete_module __x64_sys_delete_module |
186 | 177 64 get_kernel_syms | 188 | 177 64 get_kernel_syms |
187 | 178 64 query_module | 189 | 178 64 query_module |
188 | 179 common quotactl sys_quotactl | 190 | 179 common quotactl __x64_sys_quotactl |
189 | 180 64 nfsservctl | 191 | 180 64 nfsservctl |
190 | 181 common getpmsg | 192 | 181 common getpmsg |
191 | 182 common putpmsg | 193 | 182 common putpmsg |
192 | 183 common afs_syscall | 194 | 183 common afs_syscall |
193 | 184 common tuxcall | 195 | 184 common tuxcall |
194 | 185 common security | 196 | 185 common security |
195 | 186 common gettid sys_gettid | 197 | 186 common gettid __x64_sys_gettid |
196 | 187 common readahead sys_readahead | 198 | 187 common readahead __x64_sys_readahead |
197 | 188 common setxattr sys_setxattr | 199 | 188 common setxattr __x64_sys_setxattr |
198 | 189 common lsetxattr sys_lsetxattr | 200 | 189 common lsetxattr __x64_sys_lsetxattr |
199 | 190 common fsetxattr sys_fsetxattr | 201 | 190 common fsetxattr __x64_sys_fsetxattr |
200 | 191 common getxattr sys_getxattr | 202 | 191 common getxattr __x64_sys_getxattr |
201 | 192 common lgetxattr sys_lgetxattr | 203 | 192 common lgetxattr __x64_sys_lgetxattr |
202 | 193 common fgetxattr sys_fgetxattr | 204 | 193 common fgetxattr __x64_sys_fgetxattr |
203 | 194 common listxattr sys_listxattr | 205 | 194 common listxattr __x64_sys_listxattr |
204 | 195 common llistxattr sys_llistxattr | 206 | 195 common llistxattr __x64_sys_llistxattr |
205 | 196 common flistxattr sys_flistxattr | 207 | 196 common flistxattr __x64_sys_flistxattr |
206 | 197 common removexattr sys_removexattr | 208 | 197 common removexattr __x64_sys_removexattr |
207 | 198 common lremovexattr sys_lremovexattr | 209 | 198 common lremovexattr __x64_sys_lremovexattr |
208 | 199 common fremovexattr sys_fremovexattr | 210 | 199 common fremovexattr __x64_sys_fremovexattr |
209 | 200 common tkill sys_tkill | 211 | 200 common tkill __x64_sys_tkill |
210 | 201 common time sys_time | 212 | 201 common time __x64_sys_time |
211 | 202 common futex sys_futex | 213 | 202 common futex __x64_sys_futex |
212 | 203 common sched_setaffinity sys_sched_setaffinity | 214 | 203 common sched_setaffinity __x64_sys_sched_setaffinity |
213 | 204 common sched_getaffinity sys_sched_getaffinity | 215 | 204 common sched_getaffinity __x64_sys_sched_getaffinity |
214 | 205 64 set_thread_area | 216 | 205 64 set_thread_area |
215 | 206 64 io_setup sys_io_setup | 217 | 206 64 io_setup __x64_sys_io_setup |
216 | 207 common io_destroy sys_io_destroy | 218 | 207 common io_destroy __x64_sys_io_destroy |
217 | 208 common io_getevents sys_io_getevents | 219 | 208 common io_getevents __x64_sys_io_getevents |
218 | 209 64 io_submit sys_io_submit | 220 | 209 64 io_submit __x64_sys_io_submit |
219 | 210 common io_cancel sys_io_cancel | 221 | 210 common io_cancel __x64_sys_io_cancel |
220 | 211 64 get_thread_area | 222 | 211 64 get_thread_area |
221 | 212 common lookup_dcookie sys_lookup_dcookie | 223 | 212 common lookup_dcookie __x64_sys_lookup_dcookie |
222 | 213 common epoll_create sys_epoll_create | 224 | 213 common epoll_create __x64_sys_epoll_create |
223 | 214 64 epoll_ctl_old | 225 | 214 64 epoll_ctl_old |
224 | 215 64 epoll_wait_old | 226 | 215 64 epoll_wait_old |
225 | 216 common remap_file_pages sys_remap_file_pages | 227 | 216 common remap_file_pages __x64_sys_remap_file_pages |
226 | 217 common getdents64 sys_getdents64 | 228 | 217 common getdents64 __x64_sys_getdents64 |
227 | 218 common set_tid_address sys_set_tid_address | 229 | 218 common set_tid_address __x64_sys_set_tid_address |
228 | 219 common restart_syscall sys_restart_syscall | 230 | 219 common restart_syscall __x64_sys_restart_syscall |
229 | 220 common semtimedop sys_semtimedop | 231 | 220 common semtimedop __x64_sys_semtimedop |
230 | 221 common fadvise64 sys_fadvise64 | 232 | 221 common fadvise64 __x64_sys_fadvise64 |
231 | 222 64 timer_create sys_timer_create | 233 | 222 64 timer_create __x64_sys_timer_create |
232 | 223 common timer_settime sys_timer_settime | 234 | 223 common timer_settime __x64_sys_timer_settime |
233 | 224 common timer_gettime sys_timer_gettime | 235 | 224 common timer_gettime __x64_sys_timer_gettime |
234 | 225 common timer_getoverrun sys_timer_getoverrun | 236 | 225 common timer_getoverrun __x64_sys_timer_getoverrun |
235 | 226 common timer_delete sys_timer_delete | 237 | 226 common timer_delete __x64_sys_timer_delete |
236 | 227 common clock_settime sys_clock_settime | 238 | 227 common clock_settime __x64_sys_clock_settime |
237 | 228 common clock_gettime sys_clock_gettime | 239 | 228 common clock_gettime __x64_sys_clock_gettime |
238 | 229 common clock_getres sys_clock_getres | 240 | 229 common clock_getres __x64_sys_clock_getres |
239 | 230 common clock_nanosleep sys_clock_nanosleep | 241 | 230 common clock_nanosleep __x64_sys_clock_nanosleep |
240 | 231 common exit_group sys_exit_group | 242 | 231 common exit_group __x64_sys_exit_group |
241 | 232 common epoll_wait sys_epoll_wait | 243 | 232 common epoll_wait __x64_sys_epoll_wait |
242 | 233 common epoll_ctl sys_epoll_ctl | 244 | 233 common epoll_ctl __x64_sys_epoll_ctl |
243 | 234 common tgkill sys_tgkill | 245 | 234 common tgkill __x64_sys_tgkill |
244 | 235 common utimes sys_utimes | 246 | 235 common utimes __x64_sys_utimes |
245 | 236 64 vserver | 247 | 236 64 vserver |
246 | 237 common mbind sys_mbind | 248 | 237 common mbind __x64_sys_mbind |
247 | 238 common set_mempolicy sys_set_mempolicy | 249 | 238 common set_mempolicy __x64_sys_set_mempolicy |
248 | 239 common get_mempolicy sys_get_mempolicy | 250 | 239 common get_mempolicy __x64_sys_get_mempolicy |
249 | 240 common mq_open sys_mq_open | 251 | 240 common mq_open __x64_sys_mq_open |
250 | 241 common mq_unlink sys_mq_unlink | 252 | 241 common mq_unlink __x64_sys_mq_unlink |
251 | 242 common mq_timedsend sys_mq_timedsend | 253 | 242 common mq_timedsend __x64_sys_mq_timedsend |
252 | 243 common mq_timedreceive sys_mq_timedreceive | 254 | 243 common mq_timedreceive __x64_sys_mq_timedreceive |
253 | 244 64 mq_notify sys_mq_notify | 255 | 244 64 mq_notify __x64_sys_mq_notify |
254 | 245 common mq_getsetattr sys_mq_getsetattr | 256 | 245 common mq_getsetattr __x64_sys_mq_getsetattr |
255 | 246 64 kexec_load sys_kexec_load | 257 | 246 64 kexec_load __x64_sys_kexec_load |
256 | 247 64 waitid sys_waitid | 258 | 247 64 waitid __x64_sys_waitid |
257 | 248 common add_key sys_add_key | 259 | 248 common add_key __x64_sys_add_key |
258 | 249 common request_key sys_request_key | 260 | 249 common request_key __x64_sys_request_key |
259 | 250 common keyctl sys_keyctl | 261 | 250 common keyctl __x64_sys_keyctl |
260 | 251 common ioprio_set sys_ioprio_set | 262 | 251 common ioprio_set __x64_sys_ioprio_set |
261 | 252 common ioprio_get sys_ioprio_get | 263 | 252 common ioprio_get __x64_sys_ioprio_get |
262 | 253 common inotify_init sys_inotify_init | 264 | 253 common inotify_init __x64_sys_inotify_init |
263 | 254 common inotify_add_watch sys_inotify_add_watch | 265 | 254 common inotify_add_watch __x64_sys_inotify_add_watch |
264 | 255 common inotify_rm_watch sys_inotify_rm_watch | 266 | 255 common inotify_rm_watch __x64_sys_inotify_rm_watch |
265 | 256 common migrate_pages sys_migrate_pages | 267 | 256 common migrate_pages __x64_sys_migrate_pages |
266 | 257 common openat sys_openat | 268 | 257 common openat __x64_sys_openat |
267 | 258 common mkdirat sys_mkdirat | 269 | 258 common mkdirat __x64_sys_mkdirat |
268 | 259 common mknodat sys_mknodat | 270 | 259 common mknodat __x64_sys_mknodat |
269 | 260 common fchownat sys_fchownat | 271 | 260 common fchownat __x64_sys_fchownat |
270 | 261 common futimesat sys_futimesat | 272 | 261 common futimesat __x64_sys_futimesat |
271 | 262 common newfstatat sys_newfstatat | 273 | 262 common newfstatat __x64_sys_newfstatat |
272 | 263 common unlinkat sys_unlinkat | 274 | 263 common unlinkat __x64_sys_unlinkat |
273 | 264 common renameat sys_renameat | 275 | 264 common renameat __x64_sys_renameat |
274 | 265 common linkat sys_linkat | 276 | 265 common linkat __x64_sys_linkat |
275 | 266 common symlinkat sys_symlinkat | 277 | 266 common symlinkat __x64_sys_symlinkat |
276 | 267 common readlinkat sys_readlinkat | 278 | 267 common readlinkat __x64_sys_readlinkat |
277 | 268 common fchmodat sys_fchmodat | 279 | 268 common fchmodat __x64_sys_fchmodat |
278 | 269 common faccessat sys_faccessat | 280 | 269 common faccessat __x64_sys_faccessat |
279 | 270 common pselect6 sys_pselect6 | 281 | 270 common pselect6 __x64_sys_pselect6 |
280 | 271 common ppoll sys_ppoll | 282 | 271 common ppoll __x64_sys_ppoll |
281 | 272 common unshare sys_unshare | 283 | 272 common unshare __x64_sys_unshare |
282 | 273 64 set_robust_list sys_set_robust_list | 284 | 273 64 set_robust_list __x64_sys_set_robust_list |
283 | 274 64 get_robust_list sys_get_robust_list | 285 | 274 64 get_robust_list __x64_sys_get_robust_list |
284 | 275 common splice sys_splice | 286 | 275 common splice __x64_sys_splice |
285 | 276 common tee sys_tee | 287 | 276 common tee __x64_sys_tee |
286 | 277 common sync_file_range sys_sync_file_range | 288 | 277 common sync_file_range __x64_sys_sync_file_range |
287 | 278 64 vmsplice sys_vmsplice | 289 | 278 64 vmsplice __x64_sys_vmsplice |
288 | 279 64 move_pages sys_move_pages | 290 | 279 64 move_pages __x64_sys_move_pages |
289 | 280 common utimensat sys_utimensat | 291 | 280 common utimensat __x64_sys_utimensat |
290 | 281 common epoll_pwait sys_epoll_pwait | 292 | 281 common epoll_pwait __x64_sys_epoll_pwait |
291 | 282 common signalfd sys_signalfd | 293 | 282 common signalfd __x64_sys_signalfd |
292 | 283 common timerfd_create sys_timerfd_create | 294 | 283 common timerfd_create __x64_sys_timerfd_create |
293 | 284 common eventfd sys_eventfd | 295 | 284 common eventfd __x64_sys_eventfd |
294 | 285 common fallocate sys_fallocate | 296 | 285 common fallocate __x64_sys_fallocate |
295 | 286 common timerfd_settime sys_timerfd_settime | 297 | 286 common timerfd_settime __x64_sys_timerfd_settime |
296 | 287 common timerfd_gettime sys_timerfd_gettime | 298 | 287 common timerfd_gettime __x64_sys_timerfd_gettime |
297 | 288 common accept4 sys_accept4 | 299 | 288 common accept4 __x64_sys_accept4 |
298 | 289 common signalfd4 sys_signalfd4 | 300 | 289 common signalfd4 __x64_sys_signalfd4 |
299 | 290 common eventfd2 sys_eventfd2 | 301 | 290 common eventfd2 __x64_sys_eventfd2 |
300 | 291 common epoll_create1 sys_epoll_create1 | 302 | 291 common epoll_create1 __x64_sys_epoll_create1 |
301 | 292 common dup3 sys_dup3 | 303 | 292 common dup3 __x64_sys_dup3 |
302 | 293 common pipe2 sys_pipe2 | 304 | 293 common pipe2 __x64_sys_pipe2 |
303 | 294 common inotify_init1 sys_inotify_init1 | 305 | 294 common inotify_init1 __x64_sys_inotify_init1 |
304 | 295 64 preadv sys_preadv | 306 | 295 64 preadv __x64_sys_preadv |
305 | 296 64 pwritev sys_pwritev | 307 | 296 64 pwritev __x64_sys_pwritev |
306 | 297 64 rt_tgsigqueueinfo sys_rt_tgsigqueueinfo | 308 | 297 64 rt_tgsigqueueinfo __x64_sys_rt_tgsigqueueinfo |
307 | 298 common perf_event_open sys_perf_event_open | 309 | 298 common perf_event_open __x64_sys_perf_event_open |
308 | 299 64 recvmmsg sys_recvmmsg | 310 | 299 64 recvmmsg __x64_sys_recvmmsg |
309 | 300 common fanotify_init sys_fanotify_init | 311 | 300 common fanotify_init __x64_sys_fanotify_init |
310 | 301 common fanotify_mark sys_fanotify_mark | 312 | 301 common fanotify_mark __x64_sys_fanotify_mark |
311 | 302 common prlimit64 sys_prlimit64 | 313 | 302 common prlimit64 __x64_sys_prlimit64 |
312 | 303 common name_to_handle_at sys_name_to_handle_at | 314 | 303 common name_to_handle_at __x64_sys_name_to_handle_at |
313 | 304 common open_by_handle_at sys_open_by_handle_at | 315 | 304 common open_by_handle_at __x64_sys_open_by_handle_at |
314 | 305 common clock_adjtime sys_clock_adjtime | 316 | 305 common clock_adjtime __x64_sys_clock_adjtime |
315 | 306 common syncfs sys_syncfs | 317 | 306 common syncfs __x64_sys_syncfs |
316 | 307 64 sendmmsg sys_sendmmsg | 318 | 307 64 sendmmsg __x64_sys_sendmmsg |
317 | 308 common setns sys_setns | 319 | 308 common setns __x64_sys_setns |
318 | 309 common getcpu sys_getcpu | 320 | 309 common getcpu __x64_sys_getcpu |
319 | 310 64 process_vm_readv sys_process_vm_readv | 321 | 310 64 process_vm_readv __x64_sys_process_vm_readv |
320 | 311 64 process_vm_writev sys_process_vm_writev | 322 | 311 64 process_vm_writev __x64_sys_process_vm_writev |
321 | 312 common kcmp sys_kcmp | 323 | 312 common kcmp __x64_sys_kcmp |
322 | 313 common finit_module sys_finit_module | 324 | 313 common finit_module __x64_sys_finit_module |
323 | 314 common sched_setattr sys_sched_setattr | 325 | 314 common sched_setattr __x64_sys_sched_setattr |
324 | 315 common sched_getattr sys_sched_getattr | 326 | 315 common sched_getattr __x64_sys_sched_getattr |
325 | 316 common renameat2 sys_renameat2 | 327 | 316 common renameat2 __x64_sys_renameat2 |
326 | 317 common seccomp sys_seccomp | 328 | 317 common seccomp __x64_sys_seccomp |
327 | 318 common getrandom sys_getrandom | 329 | 318 common getrandom __x64_sys_getrandom |
328 | 319 common memfd_create sys_memfd_create | 330 | 319 common memfd_create __x64_sys_memfd_create |
329 | 320 common kexec_file_load sys_kexec_file_load | 331 | 320 common kexec_file_load __x64_sys_kexec_file_load |
330 | 321 common bpf sys_bpf | 332 | 321 common bpf __x64_sys_bpf |
331 | 322 64 execveat sys_execveat/ptregs | 333 | 322 64 execveat __x64_sys_execveat/ptregs |
332 | 323 common userfaultfd sys_userfaultfd | 334 | 323 common userfaultfd __x64_sys_userfaultfd |
333 | 324 common membarrier sys_membarrier | 335 | 324 common membarrier __x64_sys_membarrier |
334 | 325 common mlock2 sys_mlock2 | 336 | 325 common mlock2 __x64_sys_mlock2 |
335 | 326 common copy_file_range sys_copy_file_range | 337 | 326 common copy_file_range __x64_sys_copy_file_range |
336 | 327 64 preadv2 sys_preadv2 | 338 | 327 64 preadv2 __x64_sys_preadv2 |
337 | 328 64 pwritev2 sys_pwritev2 | 339 | 328 64 pwritev2 __x64_sys_pwritev2 |
338 | 329 common pkey_mprotect sys_pkey_mprotect | 340 | 329 common pkey_mprotect __x64_sys_pkey_mprotect |
339 | 330 common pkey_alloc sys_pkey_alloc | 341 | 330 common pkey_alloc __x64_sys_pkey_alloc |
340 | 331 common pkey_free sys_pkey_free | 342 | 331 common pkey_free __x64_sys_pkey_free |
341 | 332 common statx sys_statx | 343 | 332 common statx __x64_sys_statx |
342 | 344 | ||
343 | # | 345 | # |
344 | # x32-specific system call numbers start at 512 to avoid cache impact | 346 | # x32-specific system call numbers start at 512 to avoid cache impact |
345 | # for native 64-bit operation. | 347 | # for native 64-bit operation. The __x32_compat_sys stubs are created |
348 | # on-the-fly for compat_sys_*() compatibility system calls if X86_X32 | ||
349 | # is defined. | ||
346 | # | 350 | # |
347 | 512 x32 rt_sigaction compat_sys_rt_sigaction | 351 | 512 x32 rt_sigaction __x32_compat_sys_rt_sigaction |
348 | 513 x32 rt_sigreturn sys32_x32_rt_sigreturn | 352 | 513 x32 rt_sigreturn sys32_x32_rt_sigreturn |
349 | 514 x32 ioctl compat_sys_ioctl | 353 | 514 x32 ioctl __x32_compat_sys_ioctl |
350 | 515 x32 readv compat_sys_readv | 354 | 515 x32 readv __x32_compat_sys_readv |
351 | 516 x32 writev compat_sys_writev | 355 | 516 x32 writev __x32_compat_sys_writev |
352 | 517 x32 recvfrom compat_sys_recvfrom | 356 | 517 x32 recvfrom __x32_compat_sys_recvfrom |
353 | 518 x32 sendmsg compat_sys_sendmsg | 357 | 518 x32 sendmsg __x32_compat_sys_sendmsg |
354 | 519 x32 recvmsg compat_sys_recvmsg | 358 | 519 x32 recvmsg __x32_compat_sys_recvmsg |
355 | 520 x32 execve compat_sys_execve/ptregs | 359 | 520 x32 execve __x32_compat_sys_execve/ptregs |
356 | 521 x32 ptrace compat_sys_ptrace | 360 | 521 x32 ptrace __x32_compat_sys_ptrace |
357 | 522 x32 rt_sigpending compat_sys_rt_sigpending | 361 | 522 x32 rt_sigpending __x32_compat_sys_rt_sigpending |
358 | 523 x32 rt_sigtimedwait compat_sys_rt_sigtimedwait | 362 | 523 x32 rt_sigtimedwait __x32_compat_sys_rt_sigtimedwait |
359 | 524 x32 rt_sigqueueinfo compat_sys_rt_sigqueueinfo | 363 | 524 x32 rt_sigqueueinfo __x32_compat_sys_rt_sigqueueinfo |
360 | 525 x32 sigaltstack compat_sys_sigaltstack | 364 | 525 x32 sigaltstack __x32_compat_sys_sigaltstack |
361 | 526 x32 timer_create compat_sys_timer_create | 365 | 526 x32 timer_create __x32_compat_sys_timer_create |
362 | 527 x32 mq_notify compat_sys_mq_notify | 366 | 527 x32 mq_notify __x32_compat_sys_mq_notify |
363 | 528 x32 kexec_load compat_sys_kexec_load | 367 | 528 x32 kexec_load __x32_compat_sys_kexec_load |
364 | 529 x32 waitid compat_sys_waitid | 368 | 529 x32 waitid __x32_compat_sys_waitid |
365 | 530 x32 set_robust_list compat_sys_set_robust_list | 369 | 530 x32 set_robust_list __x32_compat_sys_set_robust_list |
366 | 531 x32 get_robust_list compat_sys_get_robust_list | 370 | 531 x32 get_robust_list __x32_compat_sys_get_robust_list |
367 | 532 x32 vmsplice compat_sys_vmsplice | 371 | 532 x32 vmsplice __x32_compat_sys_vmsplice |
368 | 533 x32 move_pages compat_sys_move_pages | 372 | 533 x32 move_pages __x32_compat_sys_move_pages |
369 | 534 x32 preadv compat_sys_preadv64 | 373 | 534 x32 preadv __x32_compat_sys_preadv64 |
370 | 535 x32 pwritev compat_sys_pwritev64 | 374 | 535 x32 pwritev __x32_compat_sys_pwritev64 |
371 | 536 x32 rt_tgsigqueueinfo compat_sys_rt_tgsigqueueinfo | 375 | 536 x32 rt_tgsigqueueinfo __x32_compat_sys_rt_tgsigqueueinfo |
372 | 537 x32 recvmmsg compat_sys_recvmmsg | 376 | 537 x32 recvmmsg __x32_compat_sys_recvmmsg |
373 | 538 x32 sendmmsg compat_sys_sendmmsg | 377 | 538 x32 sendmmsg __x32_compat_sys_sendmmsg |
374 | 539 x32 process_vm_readv compat_sys_process_vm_readv | 378 | 539 x32 process_vm_readv __x32_compat_sys_process_vm_readv |
375 | 540 x32 process_vm_writev compat_sys_process_vm_writev | 379 | 540 x32 process_vm_writev __x32_compat_sys_process_vm_writev |
376 | 541 x32 setsockopt compat_sys_setsockopt | 380 | 541 x32 setsockopt __x32_compat_sys_setsockopt |
377 | 542 x32 getsockopt compat_sys_getsockopt | 381 | 542 x32 getsockopt __x32_compat_sys_getsockopt |
378 | 543 x32 io_setup compat_sys_io_setup | 382 | 543 x32 io_setup __x32_compat_sys_io_setup |
379 | 544 x32 io_submit compat_sys_io_submit | 383 | 544 x32 io_submit __x32_compat_sys_io_submit |
380 | 545 x32 execveat compat_sys_execveat/ptregs | 384 | 545 x32 execveat __x32_compat_sys_execveat/ptregs |
381 | 546 x32 preadv2 compat_sys_preadv64v2 | 385 | 546 x32 preadv2 __x32_compat_sys_preadv64v2 |
382 | 547 x32 pwritev2 compat_sys_pwritev64v2 | 386 | 547 x32 pwritev2 __x32_compat_sys_pwritev64v2 |
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c index 4aca13f23b9d..1c41b4eaf73c 100644 --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c | |||
@@ -439,7 +439,7 @@ int cmd_help(int argc, const char **argv) | |||
439 | #ifdef HAVE_LIBELF_SUPPORT | 439 | #ifdef HAVE_LIBELF_SUPPORT |
440 | "probe", | 440 | "probe", |
441 | #endif | 441 | #endif |
442 | #if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE) | 442 | #if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT) |
443 | "trace", | 443 | "trace", |
444 | #endif | 444 | #endif |
445 | NULL }; | 445 | NULL }; |
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index 506564651cda..57393e94d156 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c | |||
@@ -83,7 +83,7 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem) | |||
83 | }; | 83 | }; |
84 | 84 | ||
85 | argc = parse_options(argc, argv, options, record_mem_usage, | 85 | argc = parse_options(argc, argv, options, record_mem_usage, |
86 | PARSE_OPT_STOP_AT_NON_OPTION); | 86 | PARSE_OPT_KEEP_UNKNOWN); |
87 | 87 | ||
88 | rec_argc = argc + 9; /* max number of arguments */ | 88 | rec_argc = argc + 9; /* max number of arguments */ |
89 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); | 89 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); |
@@ -436,7 +436,7 @@ int cmd_mem(int argc, const char **argv) | |||
436 | } | 436 | } |
437 | 437 | ||
438 | argc = parse_options_subcommand(argc, argv, mem_options, mem_subcommands, | 438 | argc = parse_options_subcommand(argc, argv, mem_options, mem_subcommands, |
439 | mem_usage, PARSE_OPT_STOP_AT_NON_OPTION); | 439 | mem_usage, PARSE_OPT_KEEP_UNKNOWN); |
440 | 440 | ||
441 | if (!argc || !(strncmp(argv[0], "rec", 3) || mem.operation)) | 441 | if (!argc || !(strncmp(argv[0], "rec", 3) || mem.operation)) |
442 | usage_with_options(mem_usage, mem_options); | 442 | usage_with_options(mem_usage, mem_options); |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 313c42423393..e0a9845b6cbc 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -657,8 +657,11 @@ static int perf_sample__fprintf_start(struct perf_sample *sample, | |||
657 | break; | 657 | break; |
658 | case PERF_RECORD_SWITCH: | 658 | case PERF_RECORD_SWITCH: |
659 | case PERF_RECORD_SWITCH_CPU_WIDE: | 659 | case PERF_RECORD_SWITCH_CPU_WIDE: |
660 | if (has(SWITCH_OUT)) | 660 | if (has(SWITCH_OUT)) { |
661 | ret += fprintf(fp, "S"); | 661 | ret += fprintf(fp, "S"); |
662 | if (sample->misc & PERF_RECORD_MISC_SWITCH_OUT_PREEMPT) | ||
663 | ret += fprintf(fp, "p"); | ||
664 | } | ||
662 | default: | 665 | default: |
663 | break; | 666 | break; |
664 | } | 667 | } |
@@ -2801,11 +2804,11 @@ int find_scripts(char **scripts_array, char **scripts_path_array) | |||
2801 | for_each_lang(scripts_path, scripts_dir, lang_dirent) { | 2804 | for_each_lang(scripts_path, scripts_dir, lang_dirent) { |
2802 | scnprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path, | 2805 | scnprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path, |
2803 | lang_dirent->d_name); | 2806 | lang_dirent->d_name); |
2804 | #ifdef NO_LIBPERL | 2807 | #ifndef HAVE_LIBPERL_SUPPORT |
2805 | if (strstr(lang_path, "perl")) | 2808 | if (strstr(lang_path, "perl")) |
2806 | continue; | 2809 | continue; |
2807 | #endif | 2810 | #endif |
2808 | #ifdef NO_LIBPYTHON | 2811 | #ifndef HAVE_LIBPYTHON_SUPPORT |
2809 | if (strstr(lang_path, "python")) | 2812 | if (strstr(lang_path, "python")) |
2810 | continue; | 2813 | continue; |
2811 | #endif | 2814 | #endif |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index f5c454855908..f17dc601b0f3 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -172,6 +172,7 @@ static bool interval_count; | |||
172 | static const char *output_name; | 172 | static const char *output_name; |
173 | static int output_fd; | 173 | static int output_fd; |
174 | static int print_free_counters_hint; | 174 | static int print_free_counters_hint; |
175 | static int print_mixed_hw_group_error; | ||
175 | 176 | ||
176 | struct perf_stat { | 177 | struct 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 | ||
1130 | static 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 | |||
1129 | static void printout(int id, int nr, struct perf_evsel *counter, double uval, | 1154 | static 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 | ||
1279 | static void collect_all_aliases(struct perf_evsel *counter, | 1310 | static 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 | ||
1762 | static void print_counters(struct timespec *ts, int argc, const char **argv) | 1798 | static void print_counters(struct timespec *ts, int argc, const char **argv) |
@@ -1943,7 +1979,8 @@ static const struct option stat_options[] = { | |||
1943 | OPT_STRING(0, "post", &post_cmd, "command", | 1979 | OPT_STRING(0, "post", &post_cmd, "command", |
1944 | "command to run after to the measured command"), | 1980 | "command to run after to the measured command"), |
1945 | OPT_UINTEGER('I', "interval-print", &stat_config.interval, | 1981 | OPT_UINTEGER('I', "interval-print", &stat_config.interval, |
1946 | "print counts at regular interval in ms (>= 10)"), | 1982 | "print counts at regular interval in ms " |
1983 | "(overhead is possible for values <= 100ms)"), | ||
1947 | OPT_INTEGER(0, "interval-count", &stat_config.times, | 1984 | OPT_INTEGER(0, "interval-count", &stat_config.times, |
1948 | "print counts for fixed number of times"), | 1985 | "print counts for fixed number of times"), |
1949 | OPT_UINTEGER(0, "timeout", &stat_config.timeout, | 1986 | OPT_UINTEGER(0, "timeout", &stat_config.timeout, |
@@ -2923,17 +2960,6 @@ int cmd_stat(int argc, const char **argv) | |||
2923 | } | 2960 | } |
2924 | } | 2961 | } |
2925 | 2962 | ||
2926 | if (interval && interval < 100) { | ||
2927 | if (interval < 10) { | ||
2928 | pr_err("print interval must be >= 10ms\n"); | ||
2929 | parse_options_usage(stat_usage, stat_options, "I", 1); | ||
2930 | goto out; | ||
2931 | } else | ||
2932 | pr_warning("print interval < 100ms. " | ||
2933 | "The overhead percentage could be high in some cases. " | ||
2934 | "Please proceed with caution.\n"); | ||
2935 | } | ||
2936 | |||
2937 | if (stat_config.times && interval) | 2963 | if (stat_config.times && interval) |
2938 | interval_count = true; | 2964 | interval_count = true; |
2939 | else if (stat_config.times && !interval) { | 2965 | else if (stat_config.times && !interval) { |
diff --git a/tools/perf/builtin-version.c b/tools/perf/builtin-version.c index 2abe3910d6b6..50df168be326 100644 --- a/tools/perf/builtin-version.c +++ b/tools/perf/builtin-version.c | |||
@@ -60,7 +60,10 @@ static void library_status(void) | |||
60 | STATUS(HAVE_DWARF_GETLOCATIONS_SUPPORT, dwarf_getlocations); | 60 | STATUS(HAVE_DWARF_GETLOCATIONS_SUPPORT, dwarf_getlocations); |
61 | STATUS(HAVE_GLIBC_SUPPORT, glibc); | 61 | STATUS(HAVE_GLIBC_SUPPORT, glibc); |
62 | STATUS(HAVE_GTK2_SUPPORT, gtk2); | 62 | STATUS(HAVE_GTK2_SUPPORT, gtk2); |
63 | #ifndef HAVE_SYSCALL_TABLE_SUPPORT | ||
63 | STATUS(HAVE_LIBAUDIT_SUPPORT, libaudit); | 64 | STATUS(HAVE_LIBAUDIT_SUPPORT, libaudit); |
65 | #endif | ||
66 | STATUS(HAVE_SYSCALL_TABLE_SUPPORT, syscall_table); | ||
64 | STATUS(HAVE_LIBBFD_SUPPORT, libbfd); | 67 | STATUS(HAVE_LIBBFD_SUPPORT, libbfd); |
65 | STATUS(HAVE_LIBELF_SUPPORT, libelf); | 68 | STATUS(HAVE_LIBELF_SUPPORT, libelf); |
66 | STATUS(HAVE_LIBNUMA_SUPPORT, libnuma); | 69 | STATUS(HAVE_LIBNUMA_SUPPORT, libnuma); |
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 1659029d03fc..20a08cb32332 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -73,7 +73,7 @@ static struct cmd_struct commands[] = { | |||
73 | { "lock", cmd_lock, 0 }, | 73 | { "lock", cmd_lock, 0 }, |
74 | { "kvm", cmd_kvm, 0 }, | 74 | { "kvm", cmd_kvm, 0 }, |
75 | { "test", cmd_test, 0 }, | 75 | { "test", cmd_test, 0 }, |
76 | #if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE) | 76 | #if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT) |
77 | { "trace", cmd_trace, 0 }, | 77 | { "trace", cmd_trace, 0 }, |
78 | #endif | 78 | #endif |
79 | { "inject", cmd_inject, 0 }, | 79 | { "inject", cmd_inject, 0 }, |
@@ -491,7 +491,7 @@ int main(int argc, const char **argv) | |||
491 | argv[0] = cmd; | 491 | argv[0] = cmd; |
492 | } | 492 | } |
493 | if (strstarts(cmd, "trace")) { | 493 | if (strstarts(cmd, "trace")) { |
494 | #if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE) | 494 | #if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT) |
495 | setup_path(); | 495 | setup_path(); |
496 | argv[0] = "trace"; | 496 | argv[0] = "trace"; |
497 | return cmd_trace(argc, argv); | 497 | return cmd_trace(argc, 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 @@ | |||
1 | Family-model,Version,Filename,EventType | 1 | Family-model,Version,Filename,EventType |
2 | 209[78],1,cf_z10,core | 2 | ^IBM.209[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z10,core |
3 | 281[78],1,cf_z196,core | 3 | ^IBM.281[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z196,core |
4 | 282[78],1,cf_zec12,core | 4 | ^IBM.282[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_zec12,core |
5 | 296[45],1,cf_z13,core | 5 | ^IBM.296[45].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z13,core |
6 | 3906,3,cf_z14,core | 6 | ^IBM.390[67].*[13]\.[1-5].[[:xdigit:]]+$,3,cf_z14,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 |
36 | sample_freq=0 | 36 | sample_freq=0 |
37 | sample_period=0 | 37 | sample_period=0 |
38 | freq=0 | ||
39 | write_backward=0 | ||
40 | sample_id_all=0 | ||
diff --git a/tools/perf/tests/bpf-script-example.c b/tools/perf/tests/bpf-script-example.c index e4123c1b0e88..1ca5106df5f1 100644 --- a/tools/perf/tests/bpf-script-example.c +++ b/tools/perf/tests/bpf-script-example.c | |||
@@ -31,7 +31,7 @@ struct bpf_map_def SEC("maps") flip_table = { | |||
31 | .max_entries = 1, | 31 | .max_entries = 1, |
32 | }; | 32 | }; |
33 | 33 | ||
34 | SEC("func=SyS_epoll_pwait") | 34 | SEC("func=do_epoll_wait") |
35 | int bpf_func__SyS_epoll_pwait(void *ctx) | 35 | int bpf_func__SyS_epoll_pwait(void *ctx) |
36 | { | 36 | { |
37 | int ind =0; | 37 | int ind =0; |
diff --git a/tools/perf/tests/bpf-script-test-kbuild.c b/tools/perf/tests/bpf-script-test-kbuild.c index 3626924740d8..ff3ec8337f0a 100644 --- a/tools/perf/tests/bpf-script-test-kbuild.c +++ b/tools/perf/tests/bpf-script-test-kbuild.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #define SEC(NAME) __attribute__((section(NAME), used)) | 9 | #define SEC(NAME) __attribute__((section(NAME), used)) |
10 | 10 | ||
11 | #include <uapi/linux/fs.h> | 11 | #include <uapi/linux/fs.h> |
12 | #include <uapi/asm/ptrace.h> | ||
13 | 12 | ||
14 | SEC("func=vfs_llseek") | 13 | SEC("func=vfs_llseek") |
15 | int bpf_func__vfs_llseek(void *ctx) | 14 | int bpf_func__vfs_llseek(void *ctx) |
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 625f5a6772af..cac8f8889bc3 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c | |||
@@ -118,6 +118,7 @@ static struct test generic_tests[] = { | |||
118 | { | 118 | { |
119 | .desc = "Breakpoint accounting", | 119 | .desc = "Breakpoint accounting", |
120 | .func = test__bp_accounting, | 120 | .func = test__bp_accounting, |
121 | .is_supported = test__bp_signal_is_supported, | ||
121 | }, | 122 | }, |
122 | { | 123 | { |
123 | .desc = "Number of exit events of a simple workload", | 124 | .desc = "Number of exit events of a simple workload", |
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index bb8e6bcb0d96..0919b0793e5b 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c | |||
@@ -75,7 +75,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse | |||
75 | snprintf(name, sizeof(name), "sys_enter_%s", syscall_names[i]); | 75 | snprintf(name, sizeof(name), "sys_enter_%s", syscall_names[i]); |
76 | evsels[i] = perf_evsel__newtp("syscalls", name); | 76 | evsels[i] = perf_evsel__newtp("syscalls", name); |
77 | if (IS_ERR(evsels[i])) { | 77 | if (IS_ERR(evsels[i])) { |
78 | pr_debug("perf_evsel__new\n"); | 78 | pr_debug("perf_evsel__new(%s)\n", name); |
79 | goto out_delete_evlist; | 79 | goto out_delete_evlist; |
80 | } | 80 | } |
81 | 81 | ||
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/trace/beauty/mmap.c b/tools/perf/trace/beauty/mmap.c index 417e3ecfe9d7..9f68077b241b 100644 --- a/tools/perf/trace/beauty/mmap.c +++ b/tools/perf/trace/beauty/mmap.c | |||
@@ -54,6 +54,9 @@ static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size, | |||
54 | P_MMAP_FLAG(EXECUTABLE); | 54 | P_MMAP_FLAG(EXECUTABLE); |
55 | P_MMAP_FLAG(FILE); | 55 | P_MMAP_FLAG(FILE); |
56 | P_MMAP_FLAG(FIXED); | 56 | P_MMAP_FLAG(FIXED); |
57 | #ifdef MAP_FIXED_NOREPLACE | ||
58 | P_MMAP_FLAG(FIXED_NOREPLACE); | ||
59 | #endif | ||
57 | P_MMAP_FLAG(GROWSDOWN); | 60 | P_MMAP_FLAG(GROWSDOWN); |
58 | P_MMAP_FLAG(HUGETLB); | 61 | P_MMAP_FLAG(HUGETLB); |
59 | P_MMAP_FLAG(LOCKED); | 62 | P_MMAP_FLAG(LOCKED); |
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 12c099a87f8b..3781d74088a7 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c | |||
@@ -692,6 +692,7 @@ static int annotate_browser__run(struct annotate_browser *browser, | |||
692 | "J Toggle showing number of jump sources on targets\n" | 692 | "J Toggle showing number of jump sources on targets\n" |
693 | "n Search next string\n" | 693 | "n Search next string\n" |
694 | "o Toggle disassembler output/simplified view\n" | 694 | "o Toggle disassembler output/simplified view\n" |
695 | "O Bump offset level (jump targets -> +call -> all -> cycle thru)\n" | ||
695 | "s Toggle source code view\n" | 696 | "s Toggle source code view\n" |
696 | "t Circulate percent, total period, samples view\n" | 697 | "t Circulate percent, total period, samples view\n" |
697 | "/ Search string\n" | 698 | "/ Search string\n" |
@@ -719,6 +720,10 @@ static int annotate_browser__run(struct annotate_browser *browser, | |||
719 | notes->options->use_offset = !notes->options->use_offset; | 720 | notes->options->use_offset = !notes->options->use_offset; |
720 | annotation__update_column_widths(notes); | 721 | annotation__update_column_widths(notes); |
721 | continue; | 722 | continue; |
723 | case 'O': | ||
724 | if (++notes->options->offset_level > ANNOTATION__MAX_OFFSET_LEVEL) | ||
725 | notes->options->offset_level = ANNOTATION__MIN_OFFSET_LEVEL; | ||
726 | continue; | ||
722 | case 'j': | 727 | case 'j': |
723 | notes->options->jump_arrows = !notes->options->jump_arrows; | 728 | notes->options->jump_arrows = !notes->options->jump_arrows; |
724 | continue; | 729 | continue; |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 0eec06c105c6..e5f247247daa 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -2714,7 +2714,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
2714 | "h/?/F1 Show this window\n" \ | 2714 | "h/?/F1 Show this window\n" \ |
2715 | "UP/DOWN/PGUP\n" \ | 2715 | "UP/DOWN/PGUP\n" \ |
2716 | "PGDN/SPACE Navigate\n" \ | 2716 | "PGDN/SPACE Navigate\n" \ |
2717 | "q/ESC/CTRL+C Exit browser\n\n" \ | 2717 | "q/ESC/CTRL+C Exit browser or go back to previous screen\n\n" \ |
2718 | "For multiple event sessions:\n\n" \ | 2718 | "For multiple event sessions:\n\n" \ |
2719 | "TAB/UNTAB Switch events\n\n" \ | 2719 | "TAB/UNTAB Switch events\n\n" \ |
2720 | "For symbolic views (--sort has sym):\n\n" \ | 2720 | "For symbolic views (--sort has sym):\n\n" \ |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index fbad8dfbb186..536ee148bff8 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -46,6 +46,7 @@ | |||
46 | struct annotation_options annotation__default_options = { | 46 | struct annotation_options annotation__default_options = { |
47 | .use_offset = true, | 47 | .use_offset = true, |
48 | .jump_arrows = true, | 48 | .jump_arrows = true, |
49 | .offset_level = ANNOTATION__OFFSET_JUMP_TARGETS, | ||
49 | }; | 50 | }; |
50 | 51 | ||
51 | const char *disassembler_style; | 52 | const char *disassembler_style; |
@@ -2512,7 +2513,8 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati | |||
2512 | if (!notes->options->use_offset) { | 2513 | if (!notes->options->use_offset) { |
2513 | printed = scnprintf(bf, sizeof(bf), "%" PRIx64 ": ", addr); | 2514 | printed = scnprintf(bf, sizeof(bf), "%" PRIx64 ": ", addr); |
2514 | } else { | 2515 | } else { |
2515 | if (al->jump_sources) { | 2516 | if (al->jump_sources && |
2517 | notes->options->offset_level >= ANNOTATION__OFFSET_JUMP_TARGETS) { | ||
2516 | if (notes->options->show_nr_jumps) { | 2518 | if (notes->options->show_nr_jumps) { |
2517 | int prev; | 2519 | int prev; |
2518 | printed = scnprintf(bf, sizeof(bf), "%*d ", | 2520 | printed = scnprintf(bf, sizeof(bf), "%*d ", |
@@ -2523,9 +2525,14 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati | |||
2523 | obj__printf(obj, bf); | 2525 | obj__printf(obj, bf); |
2524 | obj__set_color(obj, prev); | 2526 | obj__set_color(obj, prev); |
2525 | } | 2527 | } |
2526 | 2528 | print_addr: | |
2527 | printed = scnprintf(bf, sizeof(bf), "%*" PRIx64 ": ", | 2529 | printed = scnprintf(bf, sizeof(bf), "%*" PRIx64 ": ", |
2528 | notes->widths.target, addr); | 2530 | notes->widths.target, addr); |
2531 | } else if (ins__is_call(&disasm_line(al)->ins) && | ||
2532 | notes->options->offset_level >= ANNOTATION__OFFSET_CALL) { | ||
2533 | goto print_addr; | ||
2534 | } else if (notes->options->offset_level == ANNOTATION__MAX_OFFSET_LEVEL) { | ||
2535 | goto print_addr; | ||
2529 | } else { | 2536 | } else { |
2530 | printed = scnprintf(bf, sizeof(bf), "%-*s ", | 2537 | printed = scnprintf(bf, sizeof(bf), "%-*s ", |
2531 | notes->widths.addr, " "); | 2538 | notes->widths.addr, " "); |
@@ -2642,10 +2649,11 @@ int __annotation__scnprintf_samples_period(struct annotation *notes, | |||
2642 | */ | 2649 | */ |
2643 | static struct annotation_config { | 2650 | static struct annotation_config { |
2644 | const char *name; | 2651 | const char *name; |
2645 | bool *value; | 2652 | void *value; |
2646 | } annotation__configs[] = { | 2653 | } annotation__configs[] = { |
2647 | ANNOTATION__CFG(hide_src_code), | 2654 | ANNOTATION__CFG(hide_src_code), |
2648 | ANNOTATION__CFG(jump_arrows), | 2655 | ANNOTATION__CFG(jump_arrows), |
2656 | ANNOTATION__CFG(offset_level), | ||
2649 | ANNOTATION__CFG(show_linenr), | 2657 | ANNOTATION__CFG(show_linenr), |
2650 | ANNOTATION__CFG(show_nr_jumps), | 2658 | ANNOTATION__CFG(show_nr_jumps), |
2651 | ANNOTATION__CFG(show_nr_samples), | 2659 | ANNOTATION__CFG(show_nr_samples), |
@@ -2677,8 +2685,16 @@ static int annotation__config(const char *var, const char *value, | |||
2677 | 2685 | ||
2678 | if (cfg == NULL) | 2686 | if (cfg == NULL) |
2679 | pr_debug("%s variable unknown, ignoring...", var); | 2687 | pr_debug("%s variable unknown, ignoring...", var); |
2680 | else | 2688 | else if (strcmp(var, "annotate.offset_level") == 0) { |
2681 | *cfg->value = perf_config_bool(name, value); | 2689 | perf_config_int(cfg->value, name, value); |
2690 | |||
2691 | if (*(int *)cfg->value > ANNOTATION__MAX_OFFSET_LEVEL) | ||
2692 | *(int *)cfg->value = ANNOTATION__MAX_OFFSET_LEVEL; | ||
2693 | else if (*(int *)cfg->value < ANNOTATION__MIN_OFFSET_LEVEL) | ||
2694 | *(int *)cfg->value = ANNOTATION__MIN_OFFSET_LEVEL; | ||
2695 | } else { | ||
2696 | *(bool *)cfg->value = perf_config_bool(name, value); | ||
2697 | } | ||
2682 | return 0; | 2698 | return 0; |
2683 | } | 2699 | } |
2684 | 2700 | ||
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index db8d09bea07e..f28a9e43421d 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -70,8 +70,17 @@ struct annotation_options { | |||
70 | show_nr_jumps, | 70 | show_nr_jumps, |
71 | show_nr_samples, | 71 | show_nr_samples, |
72 | show_total_period; | 72 | show_total_period; |
73 | u8 offset_level; | ||
73 | }; | 74 | }; |
74 | 75 | ||
76 | enum { | ||
77 | ANNOTATION__OFFSET_JUMP_TARGETS = 1, | ||
78 | ANNOTATION__OFFSET_CALL, | ||
79 | ANNOTATION__MAX_OFFSET_LEVEL, | ||
80 | }; | ||
81 | |||
82 | #define ANNOTATION__MIN_OFFSET_LEVEL ANNOTATION__OFFSET_JUMP_TARGETS | ||
83 | |||
75 | extern struct annotation_options annotation__default_options; | 84 | extern struct annotation_options annotation__default_options; |
76 | 85 | ||
77 | struct annotation; | 86 | struct annotation; |
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index 640af88331b4..c8b98fa22997 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | |||
@@ -1,6 +1,5 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * SPDX-License-Identifier: GPL-2.0 | ||
3 | * | ||
4 | * Copyright(C) 2015-2018 Linaro Limited. | 3 | * Copyright(C) 2015-2018 Linaro Limited. |
5 | * | 4 | * |
6 | * Author: Tor Jeremiassen <tor@ti.com> | 5 | * Author: Tor Jeremiassen <tor@ti.com> |
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 1b0d422373be..40020b1ca54f 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c | |||
@@ -1,6 +1,5 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * SPDX-License-Identifier: GPL-2.0 | ||
3 | * | ||
4 | * Copyright(C) 2015-2018 Linaro Limited. | 3 | * Copyright(C) 2015-2018 Linaro Limited. |
5 | * | 4 | * |
6 | * Author: Tor Jeremiassen <tor@ti.com> | 5 | * Author: Tor Jeremiassen <tor@ti.com> |
diff --git a/tools/perf/util/cs-etm.h b/tools/perf/util/cs-etm.h index 5864d5dca616..37f8d48179ca 100644 --- a/tools/perf/util/cs-etm.h +++ b/tools/perf/util/cs-etm.h | |||
@@ -1,18 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Copyright(C) 2015 Linaro Limited. All rights reserved. | 3 | * Copyright(C) 2015 Linaro Limited. All rights reserved. |
3 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> | 4 | * Author: Mathieu Poirier <mathieu.poirier@linaro.org> |
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 5 | */ |
17 | 6 | ||
18 | #ifndef INCLUDE__UTIL_PERF_CS_ETM_H__ | 7 | #ifndef INCLUDE__UTIL_PERF_CS_ETM_H__ |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index f0a6cbd033cc..98ff3a6a3d50 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -1421,7 +1421,9 @@ size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp) | |||
1421 | size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp) | 1421 | size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp) |
1422 | { | 1422 | { |
1423 | bool out = event->header.misc & PERF_RECORD_MISC_SWITCH_OUT; | 1423 | bool out = event->header.misc & PERF_RECORD_MISC_SWITCH_OUT; |
1424 | const char *in_out = out ? "OUT" : "IN "; | 1424 | const char *in_out = !out ? "IN " : |
1425 | !(event->header.misc & PERF_RECORD_MISC_SWITCH_OUT_PREEMPT) ? | ||
1426 | "OUT " : "OUT preempt"; | ||
1425 | 1427 | ||
1426 | if (event->header.type == PERF_RECORD_SWITCH) | 1428 | if (event->header.type == PERF_RECORD_SWITCH) |
1427 | return fprintf(fp, " %s\n", in_out); | 1429 | return fprintf(fp, " %s\n", in_out); |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 1ac8d9236efd..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) |
@@ -2870,8 +2880,7 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target, | |||
2870 | #if defined(__i386__) || defined(__x86_64__) | 2880 | #if defined(__i386__) || defined(__x86_64__) |
2871 | if (evsel->attr.type == PERF_TYPE_HARDWARE) | 2881 | if (evsel->attr.type == PERF_TYPE_HARDWARE) |
2872 | return scnprintf(msg, size, "%s", | 2882 | return scnprintf(msg, size, "%s", |
2873 | "No hardware sampling interrupt available.\n" | 2883 | "No hardware sampling interrupt available.\n"); |
2874 | "No APIC? If so then you can boot the kernel with the \"lapic\" boot parameter to force-enable it."); | ||
2875 | #endif | 2884 | #endif |
2876 | break; | 2885 | break; |
2877 | case EBUSY: | 2886 | case EBUSY: |
@@ -2894,8 +2903,7 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target, | |||
2894 | 2903 | ||
2895 | return scnprintf(msg, size, | 2904 | return scnprintf(msg, size, |
2896 | "The sys_perf_event_open() syscall returned with %d (%s) for event (%s).\n" | 2905 | "The sys_perf_event_open() syscall returned with %d (%s) for event (%s).\n" |
2897 | "/bin/dmesg may provide additional information.\n" | 2906 | "/bin/dmesg | grep -i perf may provide additional information.\n", |
2898 | "No CONFIG_PERF_EVENTS=y kernel support configured?", | ||
2899 | err, str_error_r(err, sbuf, sizeof(sbuf)), | 2907 | err, str_error_r(err, sbuf, sizeof(sbuf)), |
2900 | perf_evsel__name(evsel)); | 2908 | perf_evsel__name(evsel)); |
2901 | } | 2909 | } |
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/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh index ff17920a5ebc..c3cef36d4176 100755 --- a/tools/perf/util/generate-cmdlist.sh +++ b/tools/perf/util/generate-cmdlist.sh | |||
@@ -38,7 +38,7 @@ do | |||
38 | done | 38 | done |
39 | echo "#endif /* HAVE_LIBELF_SUPPORT */" | 39 | echo "#endif /* HAVE_LIBELF_SUPPORT */" |
40 | 40 | ||
41 | echo "#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE)" | 41 | echo "#if defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT)" |
42 | sed -n -e 's/^perf-\([^ ]*\)[ ].* audit*/\1/p' command-list.txt | | 42 | sed -n -e 's/^perf-\([^ ]*\)[ ].* audit*/\1/p' command-list.txt | |
43 | sort | | 43 | sort | |
44 | while read cmd | 44 | while read cmd |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 121df1683c36..a8bff2178fbc 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -1320,7 +1320,8 @@ static int build_mem_topology(struct memory_node *nodes, u64 size, u64 *cntp) | |||
1320 | 1320 | ||
1321 | dir = opendir(path); | 1321 | dir = opendir(path); |
1322 | if (!dir) { | 1322 | if (!dir) { |
1323 | pr_warning("failed: can't open node sysfs data\n"); | 1323 | pr_debug2("%s: could't read %s, does this arch have topology information?\n", |
1324 | __func__, path); | ||
1324 | return -1; | 1325 | return -1; |
1325 | } | 1326 | } |
1326 | 1327 | ||
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 | ||
1022 | static 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 | |||
1029 | static char *get_kernel_version(const char *root_dir) | 1022 | static 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/parse-events.y b/tools/perf/util/parse-events.y index 7afeb80cc39e..d14464c42714 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y | |||
@@ -224,15 +224,15 @@ event_def: event_pmu | | |||
224 | event_bpf_file | 224 | event_bpf_file |
225 | 225 | ||
226 | event_pmu: | 226 | event_pmu: |
227 | PE_NAME opt_event_config | 227 | PE_NAME '/' event_config '/' |
228 | { | 228 | { |
229 | struct list_head *list, *orig_terms, *terms; | 229 | struct list_head *list, *orig_terms, *terms; |
230 | 230 | ||
231 | if (parse_events_copy_term_list($2, &orig_terms)) | 231 | if (parse_events_copy_term_list($3, &orig_terms)) |
232 | YYABORT; | 232 | YYABORT; |
233 | 233 | ||
234 | ALLOC_LIST(list); | 234 | ALLOC_LIST(list); |
235 | if (parse_events_add_pmu(_parse_state, list, $1, $2, false)) { | 235 | if (parse_events_add_pmu(_parse_state, list, $1, $3, false)) { |
236 | struct perf_pmu *pmu = NULL; | 236 | struct perf_pmu *pmu = NULL; |
237 | int ok = 0; | 237 | int ok = 0; |
238 | char *pattern; | 238 | char *pattern; |
@@ -262,7 +262,7 @@ PE_NAME opt_event_config | |||
262 | if (!ok) | 262 | if (!ok) |
263 | YYABORT; | 263 | YYABORT; |
264 | } | 264 | } |
265 | parse_events_terms__delete($2); | 265 | parse_events_terms__delete($3); |
266 | parse_events_terms__delete(orig_terms); | 266 | parse_events_terms__delete(orig_terms); |
267 | $$ = list; | 267 | $$ = list; |
268 | } | 268 | } |
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 064bdcb7bd78..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 | */ |
544 | static int is_pmu_core(const char *name) | 545 | static 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,18 +551,18 @@ 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); |
562 | if (stat(path, &st) == 0) | 557 | if (stat(path, &st) == 0) |
563 | return 1; | 558 | return 1; |
564 | 559 | ||
560 | /* Look for cpu sysfs (specific to s390) */ | ||
561 | scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s", | ||
562 | sysfs, name); | ||
563 | if (stat(path, &st) == 0 && !strncmp(name, "cpum_", 5)) | ||
564 | return 1; | ||
565 | |||
565 | return 0; | 566 | return 0; |
566 | } | 567 | } |
567 | 568 | ||
@@ -580,7 +581,7 @@ char * __weak get_cpuid_str(struct perf_pmu *pmu __maybe_unused) | |||
580 | * cpuid string generated on this platform. | 581 | * cpuid string generated on this platform. |
581 | * Otherwise return non-zero. | 582 | * Otherwise return non-zero. |
582 | */ | 583 | */ |
583 | int __weak strcmp_cpuid_str(const char *mapcpuid, const char *cpuid) | 584 | int strcmp_cpuid_str(const char *mapcpuid, const char *cpuid) |
584 | { | 585 | { |
585 | regex_t re; | 586 | regex_t re; |
586 | regmatch_t pmatch[1]; | 587 | regmatch_t pmatch[1]; |
@@ -662,6 +663,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) | |||
662 | struct pmu_events_map *map; | 663 | struct pmu_events_map *map; |
663 | struct pmu_event *pe; | 664 | struct pmu_event *pe; |
664 | const char *name = pmu->name; | 665 | const char *name = pmu->name; |
666 | const char *pname; | ||
665 | 667 | ||
666 | map = perf_pmu__find_map(pmu); | 668 | map = perf_pmu__find_map(pmu); |
667 | if (!map) | 669 | if (!map) |
@@ -680,11 +682,9 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) | |||
680 | break; | 682 | break; |
681 | } | 683 | } |
682 | 684 | ||
683 | if (!is_pmu_core(name)) { | 685 | if (!is_arm_pmu_core(name)) { |
684 | /* check for uncore devices */ | 686 | pname = pe->pmu ? pe->pmu : "cpu"; |
685 | if (pe->pmu == NULL) | 687 | if (strncmp(pname, name, strlen(pname))) |
686 | continue; | ||
687 | if (strncmp(pe->pmu, name, strlen(pe->pmu))) | ||
688 | continue; | 688 | continue; |
689 | } | 689 | } |
690 | 690 | ||
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 62b2dd2253eb..1466814ebada 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -2091,16 +2091,14 @@ static bool symbol__read_kptr_restrict(void) | |||
2091 | 2091 | ||
2092 | int symbol__annotation_init(void) | 2092 | int symbol__annotation_init(void) |
2093 | { | 2093 | { |
2094 | if (symbol_conf.init_annotation) | ||
2095 | return 0; | ||
2096 | |||
2094 | if (symbol_conf.initialized) { | 2097 | if (symbol_conf.initialized) { |
2095 | pr_err("Annotation needs to be init before symbol__init()\n"); | 2098 | pr_err("Annotation needs to be init before symbol__init()\n"); |
2096 | return -1; | 2099 | return -1; |
2097 | } | 2100 | } |
2098 | 2101 | ||
2099 | if (symbol_conf.init_annotation) { | ||
2100 | pr_warning("Annotation being initialized multiple times\n"); | ||
2101 | return 0; | ||
2102 | } | ||
2103 | |||
2104 | symbol_conf.priv_size += sizeof(struct annotation); | 2102 | symbol_conf.priv_size += sizeof(struct annotation); |
2105 | symbol_conf.init_annotation = true; | 2103 | symbol_conf.init_annotation = true; |
2106 | return 0; | 2104 | return 0; |
diff --git a/tools/perf/util/syscalltbl.c b/tools/perf/util/syscalltbl.c index 895122d638dd..0ee7f568d60c 100644 --- a/tools/perf/util/syscalltbl.c +++ b/tools/perf/util/syscalltbl.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <stdlib.h> | 17 | #include <stdlib.h> |
18 | #include <linux/compiler.h> | 18 | #include <linux/compiler.h> |
19 | 19 | ||
20 | #ifdef HAVE_SYSCALL_TABLE | 20 | #ifdef HAVE_SYSCALL_TABLE_SUPPORT |
21 | #include <string.h> | 21 | #include <string.h> |
22 | #include "string2.h" | 22 | #include "string2.h" |
23 | #include "util.h" | 23 | #include "util.h" |
@@ -139,7 +139,7 @@ int syscalltbl__strglobmatch_first(struct syscalltbl *tbl, const char *syscall_g | |||
139 | return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx); | 139 | return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx); |
140 | } | 140 | } |
141 | 141 | ||
142 | #else /* HAVE_SYSCALL_TABLE */ | 142 | #else /* HAVE_SYSCALL_TABLE_SUPPORT */ |
143 | 143 | ||
144 | #include <libaudit.h> | 144 | #include <libaudit.h> |
145 | 145 | ||
@@ -176,4 +176,4 @@ int syscalltbl__strglobmatch_first(struct syscalltbl *tbl, const char *syscall_g | |||
176 | { | 176 | { |
177 | return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx); | 177 | return syscalltbl__strglobmatch_next(tbl, syscall_glob, idx); |
178 | } | 178 | } |
179 | #endif /* HAVE_SYSCALL_TABLE */ | 179 | #endif /* HAVE_SYSCALL_TABLE_SUPPORT */ |
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c index 0ac9077f62a2..b1e5c3a2b8e3 100644 --- a/tools/perf/util/trace-event-scripting.c +++ b/tools/perf/util/trace-event-scripting.c | |||
@@ -98,7 +98,7 @@ static void register_python_scripting(struct scripting_ops *scripting_ops) | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | #ifdef NO_LIBPYTHON | 101 | #ifndef HAVE_LIBPYTHON_SUPPORT |
102 | void setup_python_scripting(void) | 102 | void setup_python_scripting(void) |
103 | { | 103 | { |
104 | register_python_scripting(&python_scripting_unsupported_ops); | 104 | register_python_scripting(&python_scripting_unsupported_ops); |
@@ -161,7 +161,7 @@ static void register_perl_scripting(struct scripting_ops *scripting_ops) | |||
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | #ifdef NO_LIBPERL | 164 | #ifndef HAVE_LIBPERL_SUPPORT |
165 | void setup_perl_scripting(void) | 165 | void setup_perl_scripting(void) |
166 | { | 166 | { |
167 | register_perl_scripting(&perl_scripting_unsupported_ops); | 167 | register_perl_scripting(&perl_scripting_unsupported_ops); |
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index cb166be4918d..4ea385be528f 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c | |||
@@ -138,6 +138,7 @@ static u32 handle[] = { | |||
138 | }; | 138 | }; |
139 | 139 | ||
140 | static unsigned long dimm_fail_cmd_flags[NUM_DCR]; | 140 | static unsigned long dimm_fail_cmd_flags[NUM_DCR]; |
141 | static int dimm_fail_cmd_code[NUM_DCR]; | ||
141 | 142 | ||
142 | struct nfit_test_fw { | 143 | struct nfit_test_fw { |
143 | enum intel_fw_update_state state; | 144 | enum intel_fw_update_state state; |
@@ -892,8 +893,11 @@ static int get_dimm(struct nfit_mem *nfit_mem, unsigned int func) | |||
892 | if (i >= ARRAY_SIZE(handle)) | 893 | if (i >= ARRAY_SIZE(handle)) |
893 | return -ENXIO; | 894 | return -ENXIO; |
894 | 895 | ||
895 | if ((1 << func) & dimm_fail_cmd_flags[i]) | 896 | if ((1 << func) & dimm_fail_cmd_flags[i]) { |
897 | if (dimm_fail_cmd_code[i]) | ||
898 | return dimm_fail_cmd_code[i]; | ||
896 | return -EIO; | 899 | return -EIO; |
900 | } | ||
897 | 901 | ||
898 | return i; | 902 | return i; |
899 | } | 903 | } |
@@ -1162,12 +1166,12 @@ static int ars_state_init(struct device *dev, struct ars_state *ars_state) | |||
1162 | 1166 | ||
1163 | static void put_dimms(void *data) | 1167 | static void put_dimms(void *data) |
1164 | { | 1168 | { |
1165 | struct device **dimm_dev = data; | 1169 | struct nfit_test *t = data; |
1166 | int i; | 1170 | int i; |
1167 | 1171 | ||
1168 | for (i = 0; i < NUM_DCR; i++) | 1172 | for (i = 0; i < t->num_dcr; i++) |
1169 | if (dimm_dev[i]) | 1173 | if (t->dimm_dev[i]) |
1170 | device_unregister(dimm_dev[i]); | 1174 | device_unregister(t->dimm_dev[i]); |
1171 | } | 1175 | } |
1172 | 1176 | ||
1173 | static struct class *nfit_test_dimm; | 1177 | static struct class *nfit_test_dimm; |
@@ -1176,13 +1180,11 @@ static int dimm_name_to_id(struct device *dev) | |||
1176 | { | 1180 | { |
1177 | int dimm; | 1181 | int dimm; |
1178 | 1182 | ||
1179 | if (sscanf(dev_name(dev), "test_dimm%d", &dimm) != 1 | 1183 | if (sscanf(dev_name(dev), "test_dimm%d", &dimm) != 1) |
1180 | || dimm >= NUM_DCR || dimm < 0) | ||
1181 | return -ENXIO; | 1184 | return -ENXIO; |
1182 | return dimm; | 1185 | return dimm; |
1183 | } | 1186 | } |
1184 | 1187 | ||
1185 | |||
1186 | static ssize_t handle_show(struct device *dev, struct device_attribute *attr, | 1188 | static ssize_t handle_show(struct device *dev, struct device_attribute *attr, |
1187 | char *buf) | 1189 | char *buf) |
1188 | { | 1190 | { |
@@ -1191,7 +1193,7 @@ static ssize_t handle_show(struct device *dev, struct device_attribute *attr, | |||
1191 | if (dimm < 0) | 1193 | if (dimm < 0) |
1192 | return dimm; | 1194 | return dimm; |
1193 | 1195 | ||
1194 | return sprintf(buf, "%#x", handle[dimm]); | 1196 | return sprintf(buf, "%#x\n", handle[dimm]); |
1195 | } | 1197 | } |
1196 | DEVICE_ATTR_RO(handle); | 1198 | DEVICE_ATTR_RO(handle); |
1197 | 1199 | ||
@@ -1225,8 +1227,39 @@ static ssize_t fail_cmd_store(struct device *dev, struct device_attribute *attr, | |||
1225 | } | 1227 | } |
1226 | static DEVICE_ATTR_RW(fail_cmd); | 1228 | static DEVICE_ATTR_RW(fail_cmd); |
1227 | 1229 | ||
1230 | static ssize_t fail_cmd_code_show(struct device *dev, struct device_attribute *attr, | ||
1231 | char *buf) | ||
1232 | { | ||
1233 | int dimm = dimm_name_to_id(dev); | ||
1234 | |||
1235 | if (dimm < 0) | ||
1236 | return dimm; | ||
1237 | |||
1238 | return sprintf(buf, "%d\n", dimm_fail_cmd_code[dimm]); | ||
1239 | } | ||
1240 | |||
1241 | static ssize_t fail_cmd_code_store(struct device *dev, struct device_attribute *attr, | ||
1242 | const char *buf, size_t size) | ||
1243 | { | ||
1244 | int dimm = dimm_name_to_id(dev); | ||
1245 | unsigned long val; | ||
1246 | ssize_t rc; | ||
1247 | |||
1248 | if (dimm < 0) | ||
1249 | return dimm; | ||
1250 | |||
1251 | rc = kstrtol(buf, 0, &val); | ||
1252 | if (rc) | ||
1253 | return rc; | ||
1254 | |||
1255 | dimm_fail_cmd_code[dimm] = val; | ||
1256 | return size; | ||
1257 | } | ||
1258 | static DEVICE_ATTR_RW(fail_cmd_code); | ||
1259 | |||
1228 | static struct attribute *nfit_test_dimm_attributes[] = { | 1260 | static struct attribute *nfit_test_dimm_attributes[] = { |
1229 | &dev_attr_fail_cmd.attr, | 1261 | &dev_attr_fail_cmd.attr, |
1262 | &dev_attr_fail_cmd_code.attr, | ||
1230 | &dev_attr_handle.attr, | 1263 | &dev_attr_handle.attr, |
1231 | NULL, | 1264 | NULL, |
1232 | }; | 1265 | }; |
@@ -1240,6 +1273,23 @@ static const struct attribute_group *nfit_test_dimm_attribute_groups[] = { | |||
1240 | NULL, | 1273 | NULL, |
1241 | }; | 1274 | }; |
1242 | 1275 | ||
1276 | static int nfit_test_dimm_init(struct nfit_test *t) | ||
1277 | { | ||
1278 | int i; | ||
1279 | |||
1280 | if (devm_add_action_or_reset(&t->pdev.dev, put_dimms, t)) | ||
1281 | return -ENOMEM; | ||
1282 | for (i = 0; i < t->num_dcr; i++) { | ||
1283 | t->dimm_dev[i] = device_create_with_groups(nfit_test_dimm, | ||
1284 | &t->pdev.dev, 0, NULL, | ||
1285 | nfit_test_dimm_attribute_groups, | ||
1286 | "test_dimm%d", i + t->dcr_idx); | ||
1287 | if (!t->dimm_dev[i]) | ||
1288 | return -ENOMEM; | ||
1289 | } | ||
1290 | return 0; | ||
1291 | } | ||
1292 | |||
1243 | static void smart_init(struct nfit_test *t) | 1293 | static void smart_init(struct nfit_test *t) |
1244 | { | 1294 | { |
1245 | int i; | 1295 | int i; |
@@ -1335,17 +1385,8 @@ static int nfit_test0_alloc(struct nfit_test *t) | |||
1335 | if (!t->_fit) | 1385 | if (!t->_fit) |
1336 | return -ENOMEM; | 1386 | return -ENOMEM; |
1337 | 1387 | ||
1338 | if (devm_add_action_or_reset(&t->pdev.dev, put_dimms, t->dimm_dev)) | 1388 | if (nfit_test_dimm_init(t)) |
1339 | return -ENOMEM; | 1389 | return -ENOMEM; |
1340 | for (i = 0; i < NUM_DCR; i++) { | ||
1341 | t->dimm_dev[i] = device_create_with_groups(nfit_test_dimm, | ||
1342 | &t->pdev.dev, 0, NULL, | ||
1343 | nfit_test_dimm_attribute_groups, | ||
1344 | "test_dimm%d", i); | ||
1345 | if (!t->dimm_dev[i]) | ||
1346 | return -ENOMEM; | ||
1347 | } | ||
1348 | |||
1349 | smart_init(t); | 1390 | smart_init(t); |
1350 | return ars_state_init(&t->pdev.dev, &t->ars_state); | 1391 | return ars_state_init(&t->pdev.dev, &t->ars_state); |
1351 | } | 1392 | } |
@@ -1377,6 +1418,8 @@ static int nfit_test1_alloc(struct nfit_test *t) | |||
1377 | if (!t->spa_set[1]) | 1418 | if (!t->spa_set[1]) |
1378 | return -ENOMEM; | 1419 | return -ENOMEM; |
1379 | 1420 | ||
1421 | if (nfit_test_dimm_init(t)) | ||
1422 | return -ENOMEM; | ||
1380 | smart_init(t); | 1423 | smart_init(t); |
1381 | return ars_state_init(&t->pdev.dev, &t->ars_state); | 1424 | return ars_state_init(&t->pdev.dev, &t->ars_state); |
1382 | } | 1425 | } |
@@ -2222,6 +2265,9 @@ static void nfit_test1_setup(struct nfit_test *t) | |||
2222 | set_bit(ND_CMD_ARS_STATUS, &acpi_desc->bus_cmd_force_en); | 2265 | set_bit(ND_CMD_ARS_STATUS, &acpi_desc->bus_cmd_force_en); |
2223 | set_bit(ND_CMD_CLEAR_ERROR, &acpi_desc->bus_cmd_force_en); | 2266 | set_bit(ND_CMD_CLEAR_ERROR, &acpi_desc->bus_cmd_force_en); |
2224 | set_bit(ND_INTEL_ENABLE_LSS_STATUS, &acpi_desc->dimm_cmd_force_en); | 2267 | set_bit(ND_INTEL_ENABLE_LSS_STATUS, &acpi_desc->dimm_cmd_force_en); |
2268 | set_bit(ND_CMD_GET_CONFIG_SIZE, &acpi_desc->dimm_cmd_force_en); | ||
2269 | set_bit(ND_CMD_GET_CONFIG_DATA, &acpi_desc->dimm_cmd_force_en); | ||
2270 | set_bit(ND_CMD_SET_CONFIG_DATA, &acpi_desc->dimm_cmd_force_en); | ||
2225 | } | 2271 | } |
2226 | 2272 | ||
2227 | static int nfit_test_blk_do_io(struct nd_blk_region *ndbr, resource_size_t dpa, | 2273 | static int nfit_test_blk_do_io(struct nd_blk_region *ndbr, resource_size_t dpa, |
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 | |||
12 | test_verifier_log | 12 | test_verifier_log |
13 | feature | 13 | feature |
14 | test_libbpf_open | 14 | test_libbpf_open |
15 | test_sock | ||
16 | test_sock_addr | ||
17 | urandom_read | ||
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 | ||
5 | ping_once() | 5 | ping_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 | ||
10 | wait_for_ip() | 10 | wait_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/filesystems/Makefile b/tools/testing/selftests/filesystems/Makefile index 4e6d09fb166f..5c7d7001ad37 100644 --- a/tools/testing/selftests/filesystems/Makefile +++ b/tools/testing/selftests/filesystems/Makefile | |||
@@ -1,8 +1,6 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
2 | TEST_PROGS := dnotify_test devpts_pts | ||
3 | all: $(TEST_PROGS) | ||
4 | 2 | ||
5 | include ../lib.mk | 3 | TEST_GEN_PROGS := devpts_pts |
4 | TEST_GEN_PROGS_EXTENDED := dnotify_test | ||
6 | 5 | ||
7 | clean: | 6 | include ../lib.mk |
8 | rm -fr $(TEST_PROGS) | ||
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 @@ | |||
4 | all: | 4 | all: |
5 | 5 | ||
6 | TEST_PROGS := fw_run_tests.sh | 6 | TEST_PROGS := fw_run_tests.sh |
7 | TEST_FILES := fw_fallback.sh fw_filesystem.sh fw_lib.sh | ||
7 | 8 | ||
8 | include ../lib.mk | 9 | include ../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 |
67 | else | 67 | else |
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 |
70 | fi | 70 | fi |
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 | ||
30 | echo "Test extended error support" | 30 | echo "Test extended error support" |
31 | echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger | 31 | echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger |
32 | echo '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 |
33 | if ! grep -q "ERROR:" events/sched/sched_wakeup/hist; then | 33 | if ! 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" |
35 | fi | 35 | fi |
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 | |||
5 | do_reset() { | ||
6 | reset_trigger | ||
7 | echo > set_event | ||
8 | clear_trace | ||
9 | } | ||
10 | |||
11 | fail() { #msg | ||
12 | do_reset | ||
13 | echo $1 | ||
14 | exit_fail | ||
15 | } | ||
16 | |||
17 | if [ ! -f set_event ]; then | ||
18 | echo "event tracing is not supported" | ||
19 | exit_unsupported | ||
20 | fi | ||
21 | |||
22 | if [ ! -f synthetic_events ]; then | ||
23 | echo "synthetic event is not supported" | ||
24 | exit_unsupported | ||
25 | fi | ||
26 | |||
27 | clear_synthetic_events | ||
28 | reset_tracer | ||
29 | do_reset | ||
30 | |||
31 | echo "Test multiple actions on hist trigger" | ||
32 | echo 'wakeup_latency u64 lat; pid_t pid' >> synthetic_events | ||
33 | TRIGGER1=events/sched/sched_wakeup/trigger | ||
34 | TRIGGER2=events/sched/sched_switch/trigger | ||
35 | |||
36 | echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' > $TRIGGER1 | ||
37 | echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0 if next_comm=="cyclictest"' >> $TRIGGER2 | ||
38 | echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,next_pid) if next_comm=="cyclictest"' >> $TRIGGER2 | ||
39 | echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,prev_pid) if next_comm=="cyclictest"' >> $TRIGGER2 | ||
40 | echo 'hist:keys=next_pid if next_comm=="cyclictest"' >> $TRIGGER2 | ||
41 | |||
42 | do_reset | ||
43 | |||
44 | exit 0 | ||
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index dc44de904797..2ddcc96ae456 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile | |||
@@ -4,17 +4,18 @@ top_srcdir = ../../../../ | |||
4 | UNAME_M := $(shell uname -m) | 4 | UNAME_M := $(shell uname -m) |
5 | 5 | ||
6 | LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c | 6 | LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c |
7 | LIBKVM_x86_64 = lib/x86.c | 7 | LIBKVM_x86_64 = lib/x86.c lib/vmx.c |
8 | 8 | ||
9 | TEST_GEN_PROGS_x86_64 = set_sregs_test | 9 | TEST_GEN_PROGS_x86_64 = set_sregs_test |
10 | TEST_GEN_PROGS_x86_64 += sync_regs_test | 10 | TEST_GEN_PROGS_x86_64 += sync_regs_test |
11 | TEST_GEN_PROGS_x86_64 += vmx_tsc_adjust_test | ||
11 | 12 | ||
12 | TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) | 13 | TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) |
13 | LIBKVM += $(LIBKVM_$(UNAME_M)) | 14 | LIBKVM += $(LIBKVM_$(UNAME_M)) |
14 | 15 | ||
15 | INSTALL_HDR_PATH = $(top_srcdir)/usr | 16 | INSTALL_HDR_PATH = $(top_srcdir)/usr |
16 | LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ | 17 | LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ |
17 | CFLAGS += -O2 -g -I$(LINUX_HDR_PATH) -Iinclude -I$(<D) | 18 | CFLAGS += -O2 -g -std=gnu99 -I$(LINUX_HDR_PATH) -Iinclude -I$(<D) |
18 | 19 | ||
19 | # After inclusion, $(OUTPUT) is defined and | 20 | # After inclusion, $(OUTPUT) is defined and |
20 | # $(TEST_GEN_PROGS) starts with $(OUTPUT)/ | 21 | # $(TEST_GEN_PROGS) starts with $(OUTPUT)/ |
diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h index 57974ad46373..637b7017b6ee 100644 --- a/tools/testing/selftests/kvm/include/kvm_util.h +++ b/tools/testing/selftests/kvm/include/kvm_util.h | |||
@@ -112,24 +112,27 @@ void virt_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr, | |||
112 | vm_paddr_t vm_phy_page_alloc(struct kvm_vm *vm, | 112 | vm_paddr_t vm_phy_page_alloc(struct kvm_vm *vm, |
113 | vm_paddr_t paddr_min, uint32_t memslot); | 113 | vm_paddr_t paddr_min, uint32_t memslot); |
114 | 114 | ||
115 | void kvm_get_supported_cpuid(struct kvm_cpuid2 *cpuid); | 115 | struct kvm_cpuid2 *kvm_get_supported_cpuid(void); |
116 | void vcpu_set_cpuid( | 116 | void vcpu_set_cpuid( |
117 | struct kvm_vm *vm, uint32_t vcpuid, struct kvm_cpuid2 *cpuid); | 117 | struct kvm_vm *vm, uint32_t vcpuid, struct kvm_cpuid2 *cpuid); |
118 | 118 | ||
119 | struct kvm_cpuid2 *allocate_kvm_cpuid2(void); | ||
120 | struct kvm_cpuid_entry2 * | 119 | struct kvm_cpuid_entry2 * |
121 | find_cpuid_index_entry(struct kvm_cpuid2 *cpuid, uint32_t function, | 120 | kvm_get_supported_cpuid_index(uint32_t function, uint32_t index); |
122 | uint32_t index); | ||
123 | 121 | ||
124 | static inline struct kvm_cpuid_entry2 * | 122 | static inline struct kvm_cpuid_entry2 * |
125 | find_cpuid_entry(struct kvm_cpuid2 *cpuid, uint32_t function) | 123 | kvm_get_supported_cpuid_entry(uint32_t function) |
126 | { | 124 | { |
127 | return find_cpuid_index_entry(cpuid, function, 0); | 125 | return kvm_get_supported_cpuid_index(function, 0); |
128 | } | 126 | } |
129 | 127 | ||
130 | struct kvm_vm *vm_create_default(uint32_t vcpuid, void *guest_code); | 128 | struct kvm_vm *vm_create_default(uint32_t vcpuid, void *guest_code); |
131 | void vm_vcpu_add_default(struct kvm_vm *vm, uint32_t vcpuid, void *guest_code); | 129 | void vm_vcpu_add_default(struct kvm_vm *vm, uint32_t vcpuid, void *guest_code); |
132 | 130 | ||
131 | typedef void (*vmx_guest_code_t)(vm_vaddr_t vmxon_vaddr, | ||
132 | vm_paddr_t vmxon_paddr, | ||
133 | vm_vaddr_t vmcs_vaddr, | ||
134 | vm_paddr_t vmcs_paddr); | ||
135 | |||
133 | struct kvm_userspace_memory_region * | 136 | struct kvm_userspace_memory_region * |
134 | kvm_userspace_memory_region_find(struct kvm_vm *vm, uint64_t start, | 137 | kvm_userspace_memory_region_find(struct kvm_vm *vm, uint64_t start, |
135 | uint64_t end); | 138 | uint64_t end); |
diff --git a/tools/testing/selftests/kvm/include/vmx.h b/tools/testing/selftests/kvm/include/vmx.h new file mode 100644 index 000000000000..6ed8499807fd --- /dev/null +++ b/tools/testing/selftests/kvm/include/vmx.h | |||
@@ -0,0 +1,494 @@ | |||
1 | /* | ||
2 | * tools/testing/selftests/kvm/include/vmx.h | ||
3 | * | ||
4 | * Copyright (C) 2018, Google LLC. | ||
5 | * | ||
6 | * This work is licensed under the terms of the GNU GPL, version 2. | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef SELFTEST_KVM_VMX_H | ||
11 | #define SELFTEST_KVM_VMX_H | ||
12 | |||
13 | #include <stdint.h> | ||
14 | #include "x86.h" | ||
15 | |||
16 | #define CPUID_VMX_BIT 5 | ||
17 | |||
18 | #define CPUID_VMX (1 << 5) | ||
19 | |||
20 | /* | ||
21 | * Definitions of Primary Processor-Based VM-Execution Controls. | ||
22 | */ | ||
23 | #define CPU_BASED_VIRTUAL_INTR_PENDING 0x00000004 | ||
24 | #define CPU_BASED_USE_TSC_OFFSETING 0x00000008 | ||
25 | #define CPU_BASED_HLT_EXITING 0x00000080 | ||
26 | #define CPU_BASED_INVLPG_EXITING 0x00000200 | ||
27 | #define CPU_BASED_MWAIT_EXITING 0x00000400 | ||
28 | #define CPU_BASED_RDPMC_EXITING 0x00000800 | ||
29 | #define CPU_BASED_RDTSC_EXITING 0x00001000 | ||
30 | #define CPU_BASED_CR3_LOAD_EXITING 0x00008000 | ||
31 | #define CPU_BASED_CR3_STORE_EXITING 0x00010000 | ||
32 | #define CPU_BASED_CR8_LOAD_EXITING 0x00080000 | ||
33 | #define CPU_BASED_CR8_STORE_EXITING 0x00100000 | ||
34 | #define CPU_BASED_TPR_SHADOW 0x00200000 | ||
35 | #define CPU_BASED_VIRTUAL_NMI_PENDING 0x00400000 | ||
36 | #define CPU_BASED_MOV_DR_EXITING 0x00800000 | ||
37 | #define CPU_BASED_UNCOND_IO_EXITING 0x01000000 | ||
38 | #define CPU_BASED_USE_IO_BITMAPS 0x02000000 | ||
39 | #define CPU_BASED_MONITOR_TRAP 0x08000000 | ||
40 | #define CPU_BASED_USE_MSR_BITMAPS 0x10000000 | ||
41 | #define CPU_BASED_MONITOR_EXITING 0x20000000 | ||
42 | #define CPU_BASED_PAUSE_EXITING 0x40000000 | ||
43 | #define CPU_BASED_ACTIVATE_SECONDARY_CONTROLS 0x80000000 | ||
44 | |||
45 | #define CPU_BASED_ALWAYSON_WITHOUT_TRUE_MSR 0x0401e172 | ||
46 | |||
47 | /* | ||
48 | * Definitions of Secondary Processor-Based VM-Execution Controls. | ||
49 | */ | ||
50 | #define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001 | ||
51 | #define SECONDARY_EXEC_ENABLE_EPT 0x00000002 | ||
52 | #define SECONDARY_EXEC_DESC 0x00000004 | ||
53 | #define SECONDARY_EXEC_RDTSCP 0x00000008 | ||
54 | #define SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE 0x00000010 | ||
55 | #define SECONDARY_EXEC_ENABLE_VPID 0x00000020 | ||
56 | #define SECONDARY_EXEC_WBINVD_EXITING 0x00000040 | ||
57 | #define SECONDARY_EXEC_UNRESTRICTED_GUEST 0x00000080 | ||
58 | #define SECONDARY_EXEC_APIC_REGISTER_VIRT 0x00000100 | ||
59 | #define SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY 0x00000200 | ||
60 | #define SECONDARY_EXEC_PAUSE_LOOP_EXITING 0x00000400 | ||
61 | #define SECONDARY_EXEC_RDRAND_EXITING 0x00000800 | ||
62 | #define SECONDARY_EXEC_ENABLE_INVPCID 0x00001000 | ||
63 | #define SECONDARY_EXEC_ENABLE_VMFUNC 0x00002000 | ||
64 | #define SECONDARY_EXEC_SHADOW_VMCS 0x00004000 | ||
65 | #define SECONDARY_EXEC_RDSEED_EXITING 0x00010000 | ||
66 | #define SECONDARY_EXEC_ENABLE_PML 0x00020000 | ||
67 | #define SECONDARY_EPT_VE 0x00040000 | ||
68 | #define SECONDARY_ENABLE_XSAV_RESTORE 0x00100000 | ||
69 | #define SECONDARY_EXEC_TSC_SCALING 0x02000000 | ||
70 | |||
71 | #define PIN_BASED_EXT_INTR_MASK 0x00000001 | ||
72 | #define PIN_BASED_NMI_EXITING 0x00000008 | ||
73 | #define PIN_BASED_VIRTUAL_NMIS 0x00000020 | ||
74 | #define PIN_BASED_VMX_PREEMPTION_TIMER 0x00000040 | ||
75 | #define PIN_BASED_POSTED_INTR 0x00000080 | ||
76 | |||
77 | #define PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR 0x00000016 | ||
78 | |||
79 | #define VM_EXIT_SAVE_DEBUG_CONTROLS 0x00000004 | ||
80 | #define VM_EXIT_HOST_ADDR_SPACE_SIZE 0x00000200 | ||
81 | #define VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL 0x00001000 | ||
82 | #define VM_EXIT_ACK_INTR_ON_EXIT 0x00008000 | ||
83 | #define VM_EXIT_SAVE_IA32_PAT 0x00040000 | ||
84 | #define VM_EXIT_LOAD_IA32_PAT 0x00080000 | ||
85 | #define VM_EXIT_SAVE_IA32_EFER 0x00100000 | ||
86 | #define VM_EXIT_LOAD_IA32_EFER 0x00200000 | ||
87 | #define VM_EXIT_SAVE_VMX_PREEMPTION_TIMER 0x00400000 | ||
88 | |||
89 | #define VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR 0x00036dff | ||
90 | |||
91 | #define VM_ENTRY_LOAD_DEBUG_CONTROLS 0x00000004 | ||
92 | #define VM_ENTRY_IA32E_MODE 0x00000200 | ||
93 | #define VM_ENTRY_SMM 0x00000400 | ||
94 | #define VM_ENTRY_DEACT_DUAL_MONITOR 0x00000800 | ||
95 | #define VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL 0x00002000 | ||
96 | #define VM_ENTRY_LOAD_IA32_PAT 0x00004000 | ||
97 | #define VM_ENTRY_LOAD_IA32_EFER 0x00008000 | ||
98 | |||
99 | #define VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR 0x000011ff | ||
100 | |||
101 | #define VMX_MISC_PREEMPTION_TIMER_RATE_MASK 0x0000001f | ||
102 | #define VMX_MISC_SAVE_EFER_LMA 0x00000020 | ||
103 | |||
104 | #define EXIT_REASON_FAILED_VMENTRY 0x80000000 | ||
105 | #define EXIT_REASON_EXCEPTION_NMI 0 | ||
106 | #define EXIT_REASON_EXTERNAL_INTERRUPT 1 | ||
107 | #define EXIT_REASON_TRIPLE_FAULT 2 | ||
108 | #define EXIT_REASON_PENDING_INTERRUPT 7 | ||
109 | #define EXIT_REASON_NMI_WINDOW 8 | ||
110 | #define EXIT_REASON_TASK_SWITCH 9 | ||
111 | #define EXIT_REASON_CPUID 10 | ||
112 | #define EXIT_REASON_HLT 12 | ||
113 | #define EXIT_REASON_INVD 13 | ||
114 | #define EXIT_REASON_INVLPG 14 | ||
115 | #define EXIT_REASON_RDPMC 15 | ||
116 | #define EXIT_REASON_RDTSC 16 | ||
117 | #define EXIT_REASON_VMCALL 18 | ||
118 | #define EXIT_REASON_VMCLEAR 19 | ||
119 | #define EXIT_REASON_VMLAUNCH 20 | ||
120 | #define EXIT_REASON_VMPTRLD 21 | ||
121 | #define EXIT_REASON_VMPTRST 22 | ||
122 | #define EXIT_REASON_VMREAD 23 | ||
123 | #define EXIT_REASON_VMRESUME 24 | ||
124 | #define EXIT_REASON_VMWRITE 25 | ||
125 | #define EXIT_REASON_VMOFF 26 | ||
126 | #define EXIT_REASON_VMON 27 | ||
127 | #define EXIT_REASON_CR_ACCESS 28 | ||
128 | #define EXIT_REASON_DR_ACCESS 29 | ||
129 | #define EXIT_REASON_IO_INSTRUCTION 30 | ||
130 | #define EXIT_REASON_MSR_READ 31 | ||
131 | #define EXIT_REASON_MSR_WRITE 32 | ||
132 | #define EXIT_REASON_INVALID_STATE 33 | ||
133 | #define EXIT_REASON_MWAIT_INSTRUCTION 36 | ||
134 | #define EXIT_REASON_MONITOR_INSTRUCTION 39 | ||
135 | #define EXIT_REASON_PAUSE_INSTRUCTION 40 | ||
136 | #define EXIT_REASON_MCE_DURING_VMENTRY 41 | ||
137 | #define EXIT_REASON_TPR_BELOW_THRESHOLD 43 | ||
138 | #define EXIT_REASON_APIC_ACCESS 44 | ||
139 | #define EXIT_REASON_EOI_INDUCED 45 | ||
140 | #define EXIT_REASON_EPT_VIOLATION 48 | ||
141 | #define EXIT_REASON_EPT_MISCONFIG 49 | ||
142 | #define EXIT_REASON_INVEPT 50 | ||
143 | #define EXIT_REASON_RDTSCP 51 | ||
144 | #define EXIT_REASON_PREEMPTION_TIMER 52 | ||
145 | #define EXIT_REASON_INVVPID 53 | ||
146 | #define EXIT_REASON_WBINVD 54 | ||
147 | #define EXIT_REASON_XSETBV 55 | ||
148 | #define EXIT_REASON_APIC_WRITE 56 | ||
149 | #define EXIT_REASON_INVPCID 58 | ||
150 | #define EXIT_REASON_PML_FULL 62 | ||
151 | #define EXIT_REASON_XSAVES 63 | ||
152 | #define EXIT_REASON_XRSTORS 64 | ||
153 | #define LAST_EXIT_REASON 64 | ||
154 | |||
155 | enum vmcs_field { | ||
156 | VIRTUAL_PROCESSOR_ID = 0x00000000, | ||
157 | POSTED_INTR_NV = 0x00000002, | ||
158 | GUEST_ES_SELECTOR = 0x00000800, | ||
159 | GUEST_CS_SELECTOR = 0x00000802, | ||
160 | GUEST_SS_SELECTOR = 0x00000804, | ||
161 | GUEST_DS_SELECTOR = 0x00000806, | ||
162 | GUEST_FS_SELECTOR = 0x00000808, | ||
163 | GUEST_GS_SELECTOR = 0x0000080a, | ||
164 | GUEST_LDTR_SELECTOR = 0x0000080c, | ||
165 | GUEST_TR_SELECTOR = 0x0000080e, | ||
166 | GUEST_INTR_STATUS = 0x00000810, | ||
167 | GUEST_PML_INDEX = 0x00000812, | ||
168 | HOST_ES_SELECTOR = 0x00000c00, | ||
169 | HOST_CS_SELECTOR = 0x00000c02, | ||
170 | HOST_SS_SELECTOR = 0x00000c04, | ||
171 | HOST_DS_SELECTOR = 0x00000c06, | ||
172 | HOST_FS_SELECTOR = 0x00000c08, | ||
173 | HOST_GS_SELECTOR = 0x00000c0a, | ||
174 | HOST_TR_SELECTOR = 0x00000c0c, | ||
175 | IO_BITMAP_A = 0x00002000, | ||
176 | IO_BITMAP_A_HIGH = 0x00002001, | ||
177 | IO_BITMAP_B = 0x00002002, | ||
178 | IO_BITMAP_B_HIGH = 0x00002003, | ||
179 | MSR_BITMAP = 0x00002004, | ||
180 | MSR_BITMAP_HIGH = 0x00002005, | ||
181 | VM_EXIT_MSR_STORE_ADDR = 0x00002006, | ||
182 | VM_EXIT_MSR_STORE_ADDR_HIGH = 0x00002007, | ||
183 | VM_EXIT_MSR_LOAD_ADDR = 0x00002008, | ||
184 | VM_EXIT_MSR_LOAD_ADDR_HIGH = 0x00002009, | ||
185 | VM_ENTRY_MSR_LOAD_ADDR = 0x0000200a, | ||
186 | VM_ENTRY_MSR_LOAD_ADDR_HIGH = 0x0000200b, | ||
187 | PML_ADDRESS = 0x0000200e, | ||
188 | PML_ADDRESS_HIGH = 0x0000200f, | ||
189 | TSC_OFFSET = 0x00002010, | ||
190 | TSC_OFFSET_HIGH = 0x00002011, | ||
191 | VIRTUAL_APIC_PAGE_ADDR = 0x00002012, | ||
192 | VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013, | ||
193 | APIC_ACCESS_ADDR = 0x00002014, | ||
194 | APIC_ACCESS_ADDR_HIGH = 0x00002015, | ||
195 | POSTED_INTR_DESC_ADDR = 0x00002016, | ||
196 | POSTED_INTR_DESC_ADDR_HIGH = 0x00002017, | ||
197 | EPT_POINTER = 0x0000201a, | ||
198 | EPT_POINTER_HIGH = 0x0000201b, | ||
199 | EOI_EXIT_BITMAP0 = 0x0000201c, | ||
200 | EOI_EXIT_BITMAP0_HIGH = 0x0000201d, | ||
201 | EOI_EXIT_BITMAP1 = 0x0000201e, | ||
202 | EOI_EXIT_BITMAP1_HIGH = 0x0000201f, | ||
203 | EOI_EXIT_BITMAP2 = 0x00002020, | ||
204 | EOI_EXIT_BITMAP2_HIGH = 0x00002021, | ||
205 | EOI_EXIT_BITMAP3 = 0x00002022, | ||
206 | EOI_EXIT_BITMAP3_HIGH = 0x00002023, | ||
207 | VMREAD_BITMAP = 0x00002026, | ||
208 | VMREAD_BITMAP_HIGH = 0x00002027, | ||
209 | VMWRITE_BITMAP = 0x00002028, | ||
210 | VMWRITE_BITMAP_HIGH = 0x00002029, | ||
211 | XSS_EXIT_BITMAP = 0x0000202C, | ||
212 | XSS_EXIT_BITMAP_HIGH = 0x0000202D, | ||
213 | TSC_MULTIPLIER = 0x00002032, | ||
214 | TSC_MULTIPLIER_HIGH = 0x00002033, | ||
215 | GUEST_PHYSICAL_ADDRESS = 0x00002400, | ||
216 | GUEST_PHYSICAL_ADDRESS_HIGH = 0x00002401, | ||
217 | VMCS_LINK_POINTER = 0x00002800, | ||
218 | VMCS_LINK_POINTER_HIGH = 0x00002801, | ||
219 | GUEST_IA32_DEBUGCTL = 0x00002802, | ||
220 | GUEST_IA32_DEBUGCTL_HIGH = 0x00002803, | ||
221 | GUEST_IA32_PAT = 0x00002804, | ||
222 | GUEST_IA32_PAT_HIGH = 0x00002805, | ||
223 | GUEST_IA32_EFER = 0x00002806, | ||
224 | GUEST_IA32_EFER_HIGH = 0x00002807, | ||
225 | GUEST_IA32_PERF_GLOBAL_CTRL = 0x00002808, | ||
226 | GUEST_IA32_PERF_GLOBAL_CTRL_HIGH= 0x00002809, | ||
227 | GUEST_PDPTR0 = 0x0000280a, | ||
228 | GUEST_PDPTR0_HIGH = 0x0000280b, | ||
229 | GUEST_PDPTR1 = 0x0000280c, | ||
230 | GUEST_PDPTR1_HIGH = 0x0000280d, | ||
231 | GUEST_PDPTR2 = 0x0000280e, | ||
232 | GUEST_PDPTR2_HIGH = 0x0000280f, | ||
233 | GUEST_PDPTR3 = 0x00002810, | ||
234 | GUEST_PDPTR3_HIGH = 0x00002811, | ||
235 | GUEST_BNDCFGS = 0x00002812, | ||
236 | GUEST_BNDCFGS_HIGH = 0x00002813, | ||
237 | HOST_IA32_PAT = 0x00002c00, | ||
238 | HOST_IA32_PAT_HIGH = 0x00002c01, | ||
239 | HOST_IA32_EFER = 0x00002c02, | ||
240 | HOST_IA32_EFER_HIGH = 0x00002c03, | ||
241 | HOST_IA32_PERF_GLOBAL_CTRL = 0x00002c04, | ||
242 | HOST_IA32_PERF_GLOBAL_CTRL_HIGH = 0x00002c05, | ||
243 | PIN_BASED_VM_EXEC_CONTROL = 0x00004000, | ||
244 | CPU_BASED_VM_EXEC_CONTROL = 0x00004002, | ||
245 | EXCEPTION_BITMAP = 0x00004004, | ||
246 | PAGE_FAULT_ERROR_CODE_MASK = 0x00004006, | ||
247 | PAGE_FAULT_ERROR_CODE_MATCH = 0x00004008, | ||
248 | CR3_TARGET_COUNT = 0x0000400a, | ||
249 | VM_EXIT_CONTROLS = 0x0000400c, | ||
250 | VM_EXIT_MSR_STORE_COUNT = 0x0000400e, | ||
251 | VM_EXIT_MSR_LOAD_COUNT = 0x00004010, | ||
252 | VM_ENTRY_CONTROLS = 0x00004012, | ||
253 | VM_ENTRY_MSR_LOAD_COUNT = 0x00004014, | ||
254 | VM_ENTRY_INTR_INFO_FIELD = 0x00004016, | ||
255 | VM_ENTRY_EXCEPTION_ERROR_CODE = 0x00004018, | ||
256 | VM_ENTRY_INSTRUCTION_LEN = 0x0000401a, | ||
257 | TPR_THRESHOLD = 0x0000401c, | ||
258 | SECONDARY_VM_EXEC_CONTROL = 0x0000401e, | ||
259 | PLE_GAP = 0x00004020, | ||
260 | PLE_WINDOW = 0x00004022, | ||
261 | VM_INSTRUCTION_ERROR = 0x00004400, | ||
262 | VM_EXIT_REASON = 0x00004402, | ||
263 | VM_EXIT_INTR_INFO = 0x00004404, | ||
264 | VM_EXIT_INTR_ERROR_CODE = 0x00004406, | ||
265 | IDT_VECTORING_INFO_FIELD = 0x00004408, | ||
266 | IDT_VECTORING_ERROR_CODE = 0x0000440a, | ||
267 | VM_EXIT_INSTRUCTION_LEN = 0x0000440c, | ||
268 | VMX_INSTRUCTION_INFO = 0x0000440e, | ||
269 | GUEST_ES_LIMIT = 0x00004800, | ||
270 | GUEST_CS_LIMIT = 0x00004802, | ||
271 | GUEST_SS_LIMIT = 0x00004804, | ||
272 | GUEST_DS_LIMIT = 0x00004806, | ||
273 | GUEST_FS_LIMIT = 0x00004808, | ||
274 | GUEST_GS_LIMIT = 0x0000480a, | ||
275 | GUEST_LDTR_LIMIT = 0x0000480c, | ||
276 | GUEST_TR_LIMIT = 0x0000480e, | ||
277 | GUEST_GDTR_LIMIT = 0x00004810, | ||
278 | GUEST_IDTR_LIMIT = 0x00004812, | ||
279 | GUEST_ES_AR_BYTES = 0x00004814, | ||
280 | GUEST_CS_AR_BYTES = 0x00004816, | ||
281 | GUEST_SS_AR_BYTES = 0x00004818, | ||
282 | GUEST_DS_AR_BYTES = 0x0000481a, | ||
283 | GUEST_FS_AR_BYTES = 0x0000481c, | ||
284 | GUEST_GS_AR_BYTES = 0x0000481e, | ||
285 | GUEST_LDTR_AR_BYTES = 0x00004820, | ||
286 | GUEST_TR_AR_BYTES = 0x00004822, | ||
287 | GUEST_INTERRUPTIBILITY_INFO = 0x00004824, | ||
288 | GUEST_ACTIVITY_STATE = 0X00004826, | ||
289 | GUEST_SYSENTER_CS = 0x0000482A, | ||
290 | VMX_PREEMPTION_TIMER_VALUE = 0x0000482E, | ||
291 | HOST_IA32_SYSENTER_CS = 0x00004c00, | ||
292 | CR0_GUEST_HOST_MASK = 0x00006000, | ||
293 | CR4_GUEST_HOST_MASK = 0x00006002, | ||
294 | CR0_READ_SHADOW = 0x00006004, | ||
295 | CR4_READ_SHADOW = 0x00006006, | ||
296 | CR3_TARGET_VALUE0 = 0x00006008, | ||
297 | CR3_TARGET_VALUE1 = 0x0000600a, | ||
298 | CR3_TARGET_VALUE2 = 0x0000600c, | ||
299 | CR3_TARGET_VALUE3 = 0x0000600e, | ||
300 | EXIT_QUALIFICATION = 0x00006400, | ||
301 | GUEST_LINEAR_ADDRESS = 0x0000640a, | ||
302 | GUEST_CR0 = 0x00006800, | ||
303 | GUEST_CR3 = 0x00006802, | ||
304 | GUEST_CR4 = 0x00006804, | ||
305 | GUEST_ES_BASE = 0x00006806, | ||
306 | GUEST_CS_BASE = 0x00006808, | ||
307 | GUEST_SS_BASE = 0x0000680a, | ||
308 | GUEST_DS_BASE = 0x0000680c, | ||
309 | GUEST_FS_BASE = 0x0000680e, | ||
310 | GUEST_GS_BASE = 0x00006810, | ||
311 | GUEST_LDTR_BASE = 0x00006812, | ||
312 | GUEST_TR_BASE = 0x00006814, | ||
313 | GUEST_GDTR_BASE = 0x00006816, | ||
314 | GUEST_IDTR_BASE = 0x00006818, | ||
315 | GUEST_DR7 = 0x0000681a, | ||
316 | GUEST_RSP = 0x0000681c, | ||
317 | GUEST_RIP = 0x0000681e, | ||
318 | GUEST_RFLAGS = 0x00006820, | ||
319 | GUEST_PENDING_DBG_EXCEPTIONS = 0x00006822, | ||
320 | GUEST_SYSENTER_ESP = 0x00006824, | ||
321 | GUEST_SYSENTER_EIP = 0x00006826, | ||
322 | HOST_CR0 = 0x00006c00, | ||
323 | HOST_CR3 = 0x00006c02, | ||
324 | HOST_CR4 = 0x00006c04, | ||
325 | HOST_FS_BASE = 0x00006c06, | ||
326 | HOST_GS_BASE = 0x00006c08, | ||
327 | HOST_TR_BASE = 0x00006c0a, | ||
328 | HOST_GDTR_BASE = 0x00006c0c, | ||
329 | HOST_IDTR_BASE = 0x00006c0e, | ||
330 | HOST_IA32_SYSENTER_ESP = 0x00006c10, | ||
331 | HOST_IA32_SYSENTER_EIP = 0x00006c12, | ||
332 | HOST_RSP = 0x00006c14, | ||
333 | HOST_RIP = 0x00006c16, | ||
334 | }; | ||
335 | |||
336 | struct vmx_msr_entry { | ||
337 | uint32_t index; | ||
338 | uint32_t reserved; | ||
339 | uint64_t value; | ||
340 | } __attribute__ ((aligned(16))); | ||
341 | |||
342 | static inline int vmxon(uint64_t phys) | ||
343 | { | ||
344 | uint8_t ret; | ||
345 | |||
346 | __asm__ __volatile__ ("vmxon %[pa]; setna %[ret]" | ||
347 | : [ret]"=rm"(ret) | ||
348 | : [pa]"m"(phys) | ||
349 | : "cc", "memory"); | ||
350 | |||
351 | return ret; | ||
352 | } | ||
353 | |||
354 | static inline void vmxoff(void) | ||
355 | { | ||
356 | __asm__ __volatile__("vmxoff"); | ||
357 | } | ||
358 | |||
359 | static inline int vmclear(uint64_t vmcs_pa) | ||
360 | { | ||
361 | uint8_t ret; | ||
362 | |||
363 | __asm__ __volatile__ ("vmclear %[pa]; setna %[ret]" | ||
364 | : [ret]"=rm"(ret) | ||
365 | : [pa]"m"(vmcs_pa) | ||
366 | : "cc", "memory"); | ||
367 | |||
368 | return ret; | ||
369 | } | ||
370 | |||
371 | static inline int vmptrld(uint64_t vmcs_pa) | ||
372 | { | ||
373 | uint8_t ret; | ||
374 | |||
375 | __asm__ __volatile__ ("vmptrld %[pa]; setna %[ret]" | ||
376 | : [ret]"=rm"(ret) | ||
377 | : [pa]"m"(vmcs_pa) | ||
378 | : "cc", "memory"); | ||
379 | |||
380 | return ret; | ||
381 | } | ||
382 | |||
383 | /* | ||
384 | * No guest state (e.g. GPRs) is established by this vmlaunch. | ||
385 | */ | ||
386 | static inline int vmlaunch(void) | ||
387 | { | ||
388 | int ret; | ||
389 | |||
390 | __asm__ __volatile__("push %%rbp;" | ||
391 | "push %%rcx;" | ||
392 | "push %%rdx;" | ||
393 | "push %%rsi;" | ||
394 | "push %%rdi;" | ||
395 | "push $0;" | ||
396 | "vmwrite %%rsp, %[host_rsp];" | ||
397 | "lea 1f(%%rip), %%rax;" | ||
398 | "vmwrite %%rax, %[host_rip];" | ||
399 | "vmlaunch;" | ||
400 | "incq (%%rsp);" | ||
401 | "1: pop %%rax;" | ||
402 | "pop %%rdi;" | ||
403 | "pop %%rsi;" | ||
404 | "pop %%rdx;" | ||
405 | "pop %%rcx;" | ||
406 | "pop %%rbp;" | ||
407 | : [ret]"=&a"(ret) | ||
408 | : [host_rsp]"r"((uint64_t)HOST_RSP), | ||
409 | [host_rip]"r"((uint64_t)HOST_RIP) | ||
410 | : "memory", "cc", "rbx", "r8", "r9", "r10", | ||
411 | "r11", "r12", "r13", "r14", "r15"); | ||
412 | return ret; | ||
413 | } | ||
414 | |||
415 | /* | ||
416 | * No guest state (e.g. GPRs) is established by this vmresume. | ||
417 | */ | ||
418 | static inline int vmresume(void) | ||
419 | { | ||
420 | int ret; | ||
421 | |||
422 | __asm__ __volatile__("push %%rbp;" | ||
423 | "push %%rcx;" | ||
424 | "push %%rdx;" | ||
425 | "push %%rsi;" | ||
426 | "push %%rdi;" | ||
427 | "push $0;" | ||
428 | "vmwrite %%rsp, %[host_rsp];" | ||
429 | "lea 1f(%%rip), %%rax;" | ||
430 | "vmwrite %%rax, %[host_rip];" | ||
431 | "vmresume;" | ||
432 | "incq (%%rsp);" | ||
433 | "1: pop %%rax;" | ||
434 | "pop %%rdi;" | ||
435 | "pop %%rsi;" | ||
436 | "pop %%rdx;" | ||
437 | "pop %%rcx;" | ||
438 | "pop %%rbp;" | ||
439 | : [ret]"=&a"(ret) | ||
440 | : [host_rsp]"r"((uint64_t)HOST_RSP), | ||
441 | [host_rip]"r"((uint64_t)HOST_RIP) | ||
442 | : "memory", "cc", "rbx", "r8", "r9", "r10", | ||
443 | "r11", "r12", "r13", "r14", "r15"); | ||
444 | return ret; | ||
445 | } | ||
446 | |||
447 | static inline int vmread(uint64_t encoding, uint64_t *value) | ||
448 | { | ||
449 | uint64_t tmp; | ||
450 | uint8_t ret; | ||
451 | |||
452 | __asm__ __volatile__("vmread %[encoding], %[value]; setna %[ret]" | ||
453 | : [value]"=rm"(tmp), [ret]"=rm"(ret) | ||
454 | : [encoding]"r"(encoding) | ||
455 | : "cc", "memory"); | ||
456 | |||
457 | *value = tmp; | ||
458 | return ret; | ||
459 | } | ||
460 | |||
461 | /* | ||
462 | * A wrapper around vmread that ignores errors and returns zero if the | ||
463 | * vmread instruction fails. | ||
464 | */ | ||
465 | static inline uint64_t vmreadz(uint64_t encoding) | ||
466 | { | ||
467 | uint64_t value = 0; | ||
468 | vmread(encoding, &value); | ||
469 | return value; | ||
470 | } | ||
471 | |||
472 | static inline int vmwrite(uint64_t encoding, uint64_t value) | ||
473 | { | ||
474 | uint8_t ret; | ||
475 | |||
476 | __asm__ __volatile__ ("vmwrite %[value], %[encoding]; setna %[ret]" | ||
477 | : [ret]"=rm"(ret) | ||
478 | : [value]"rm"(value), [encoding]"r"(encoding) | ||
479 | : "cc", "memory"); | ||
480 | |||
481 | return ret; | ||
482 | } | ||
483 | |||
484 | static inline uint32_t vmcs_revision(void) | ||
485 | { | ||
486 | return rdmsr(MSR_IA32_VMX_BASIC); | ||
487 | } | ||
488 | |||
489 | void prepare_for_vmx_operation(void); | ||
490 | void prepare_vmcs(void *guest_rip, void *guest_rsp); | ||
491 | struct kvm_vm *vm_create_default_vmx(uint32_t vcpuid, | ||
492 | vmx_guest_code_t guest_code); | ||
493 | |||
494 | #endif /* !SELFTEST_KVM_VMX_H */ | ||
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 7ca1bb40c498..2cedfda181d4 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c | |||
@@ -378,7 +378,7 @@ int kvm_memcmp_hva_gva(void *hva, | |||
378 | * complicated. This function uses a reasonable default length for | 378 | * complicated. This function uses a reasonable default length for |
379 | * the array and performs the appropriate allocation. | 379 | * the array and performs the appropriate allocation. |
380 | */ | 380 | */ |
381 | struct kvm_cpuid2 *allocate_kvm_cpuid2(void) | 381 | static struct kvm_cpuid2 *allocate_kvm_cpuid2(void) |
382 | { | 382 | { |
383 | struct kvm_cpuid2 *cpuid; | 383 | struct kvm_cpuid2 *cpuid; |
384 | int nent = 100; | 384 | int nent = 100; |
@@ -402,17 +402,21 @@ struct kvm_cpuid2 *allocate_kvm_cpuid2(void) | |||
402 | * Input Args: None | 402 | * Input Args: None |
403 | * | 403 | * |
404 | * Output Args: | 404 | * Output Args: |
405 | * cpuid - The supported KVM CPUID | ||
406 | * | 405 | * |
407 | * Return: void | 406 | * Return: The supported KVM CPUID |
408 | * | 407 | * |
409 | * Get the guest CPUID supported by KVM. | 408 | * Get the guest CPUID supported by KVM. |
410 | */ | 409 | */ |
411 | void kvm_get_supported_cpuid(struct kvm_cpuid2 *cpuid) | 410 | struct kvm_cpuid2 *kvm_get_supported_cpuid(void) |
412 | { | 411 | { |
412 | static struct kvm_cpuid2 *cpuid; | ||
413 | int ret; | 413 | int ret; |
414 | int kvm_fd; | 414 | int kvm_fd; |
415 | 415 | ||
416 | if (cpuid) | ||
417 | return cpuid; | ||
418 | |||
419 | cpuid = allocate_kvm_cpuid2(); | ||
416 | kvm_fd = open(KVM_DEV_PATH, O_RDONLY); | 420 | kvm_fd = open(KVM_DEV_PATH, O_RDONLY); |
417 | TEST_ASSERT(kvm_fd >= 0, "open %s failed, rc: %i errno: %i", | 421 | TEST_ASSERT(kvm_fd >= 0, "open %s failed, rc: %i errno: %i", |
418 | KVM_DEV_PATH, kvm_fd, errno); | 422 | KVM_DEV_PATH, kvm_fd, errno); |
@@ -422,6 +426,7 @@ void kvm_get_supported_cpuid(struct kvm_cpuid2 *cpuid) | |||
422 | ret, errno); | 426 | ret, errno); |
423 | 427 | ||
424 | close(kvm_fd); | 428 | close(kvm_fd); |
429 | return cpuid; | ||
425 | } | 430 | } |
426 | 431 | ||
427 | /* Locate a cpuid entry. | 432 | /* Locate a cpuid entry. |
@@ -435,12 +440,13 @@ void kvm_get_supported_cpuid(struct kvm_cpuid2 *cpuid) | |||
435 | * Return: A pointer to the cpuid entry. Never returns NULL. | 440 | * Return: A pointer to the cpuid entry. Never returns NULL. |
436 | */ | 441 | */ |
437 | struct kvm_cpuid_entry2 * | 442 | struct kvm_cpuid_entry2 * |
438 | find_cpuid_index_entry(struct kvm_cpuid2 *cpuid, uint32_t function, | 443 | kvm_get_supported_cpuid_index(uint32_t function, uint32_t index) |
439 | uint32_t index) | ||
440 | { | 444 | { |
445 | struct kvm_cpuid2 *cpuid; | ||
441 | struct kvm_cpuid_entry2 *entry = NULL; | 446 | struct kvm_cpuid_entry2 *entry = NULL; |
442 | int i; | 447 | int i; |
443 | 448 | ||
449 | cpuid = kvm_get_supported_cpuid(); | ||
444 | for (i = 0; i < cpuid->nent; i++) { | 450 | for (i = 0; i < cpuid->nent; i++) { |
445 | if (cpuid->entries[i].function == function && | 451 | if (cpuid->entries[i].function == function && |
446 | cpuid->entries[i].index == index) { | 452 | cpuid->entries[i].index == index) { |
@@ -1435,7 +1441,7 @@ vm_paddr_t vm_phy_page_alloc(struct kvm_vm *vm, | |||
1435 | sparsebit_idx_t pg; | 1441 | sparsebit_idx_t pg; |
1436 | 1442 | ||
1437 | TEST_ASSERT((paddr_min % vm->page_size) == 0, "Min physical address " | 1443 | TEST_ASSERT((paddr_min % vm->page_size) == 0, "Min physical address " |
1438 | "not divisable by page size.\n" | 1444 | "not divisible by page size.\n" |
1439 | " paddr_min: 0x%lx page_size: 0x%x", | 1445 | " paddr_min: 0x%lx page_size: 0x%x", |
1440 | paddr_min, vm->page_size); | 1446 | paddr_min, vm->page_size); |
1441 | 1447 | ||
diff --git a/tools/testing/selftests/kvm/lib/sparsebit.c b/tools/testing/selftests/kvm/lib/sparsebit.c index 0c5cf3e0cb6f..b132bc95d183 100644 --- a/tools/testing/selftests/kvm/lib/sparsebit.c +++ b/tools/testing/selftests/kvm/lib/sparsebit.c | |||
@@ -121,7 +121,7 @@ | |||
121 | * avoided by moving the setting of the nodes mask bits into | 121 | * avoided by moving the setting of the nodes mask bits into |
122 | * the previous nodes num_after setting. | 122 | * the previous nodes num_after setting. |
123 | * | 123 | * |
124 | * + Node starting index is evenly divisable by the number of bits | 124 | * + Node starting index is evenly divisible by the number of bits |
125 | * within a nodes mask member. | 125 | * within a nodes mask member. |
126 | * | 126 | * |
127 | * + Nodes never represent a range of bits that wrap around the | 127 | * + Nodes never represent a range of bits that wrap around the |
@@ -1741,7 +1741,7 @@ void sparsebit_validate_internal(struct sparsebit *s) | |||
1741 | 1741 | ||
1742 | /* Validate node index is divisible by the mask size */ | 1742 | /* Validate node index is divisible by the mask size */ |
1743 | if (nodep->idx % MASK_BITS) { | 1743 | if (nodep->idx % MASK_BITS) { |
1744 | fprintf(stderr, "Node index not divisable by " | 1744 | fprintf(stderr, "Node index not divisible by " |
1745 | "mask size,\n" | 1745 | "mask size,\n" |
1746 | " nodep: %p nodep->idx: 0x%lx " | 1746 | " nodep: %p nodep->idx: 0x%lx " |
1747 | "MASK_BITS: %lu\n", | 1747 | "MASK_BITS: %lu\n", |
diff --git a/tools/testing/selftests/kvm/lib/vmx.c b/tools/testing/selftests/kvm/lib/vmx.c new file mode 100644 index 000000000000..0231bc0aae7b --- /dev/null +++ b/tools/testing/selftests/kvm/lib/vmx.c | |||
@@ -0,0 +1,243 @@ | |||
1 | /* | ||
2 | * tools/testing/selftests/kvm/lib/x86.c | ||
3 | * | ||
4 | * Copyright (C) 2018, Google LLC. | ||
5 | * | ||
6 | * This work is licensed under the terms of the GNU GPL, version 2. | ||
7 | */ | ||
8 | |||
9 | #define _GNU_SOURCE /* for program_invocation_name */ | ||
10 | |||
11 | #include "test_util.h" | ||
12 | #include "kvm_util.h" | ||
13 | #include "x86.h" | ||
14 | #include "vmx.h" | ||
15 | |||
16 | /* Create a default VM for VMX tests. | ||
17 | * | ||
18 | * Input Args: | ||
19 | * vcpuid - The id of the single VCPU to add to the VM. | ||
20 | * guest_code - The vCPU's entry point | ||
21 | * | ||
22 | * Output Args: None | ||
23 | * | ||
24 | * Return: | ||
25 | * Pointer to opaque structure that describes the created VM. | ||
26 | */ | ||
27 | struct kvm_vm * | ||
28 | vm_create_default_vmx(uint32_t vcpuid, vmx_guest_code_t guest_code) | ||
29 | { | ||
30 | struct kvm_cpuid2 *cpuid; | ||
31 | struct kvm_vm *vm; | ||
32 | vm_vaddr_t vmxon_vaddr; | ||
33 | vm_paddr_t vmxon_paddr; | ||
34 | vm_vaddr_t vmcs_vaddr; | ||
35 | vm_paddr_t vmcs_paddr; | ||
36 | |||
37 | vm = vm_create_default(vcpuid, (void *) guest_code); | ||
38 | |||
39 | /* Enable nesting in CPUID */ | ||
40 | vcpu_set_cpuid(vm, vcpuid, kvm_get_supported_cpuid()); | ||
41 | |||
42 | /* Setup of a region of guest memory for the vmxon region. */ | ||
43 | vmxon_vaddr = vm_vaddr_alloc(vm, getpagesize(), 0, 0, 0); | ||
44 | vmxon_paddr = addr_gva2gpa(vm, vmxon_vaddr); | ||
45 | |||
46 | /* Setup of a region of guest memory for a vmcs. */ | ||
47 | vmcs_vaddr = vm_vaddr_alloc(vm, getpagesize(), 0, 0, 0); | ||
48 | vmcs_paddr = addr_gva2gpa(vm, vmcs_vaddr); | ||
49 | |||
50 | vcpu_args_set(vm, vcpuid, 4, vmxon_vaddr, vmxon_paddr, vmcs_vaddr, | ||
51 | vmcs_paddr); | ||
52 | |||
53 | return vm; | ||
54 | } | ||
55 | |||
56 | void prepare_for_vmx_operation(void) | ||
57 | { | ||
58 | uint64_t feature_control; | ||
59 | uint64_t required; | ||
60 | unsigned long cr0; | ||
61 | unsigned long cr4; | ||
62 | |||
63 | /* | ||
64 | * Ensure bits in CR0 and CR4 are valid in VMX operation: | ||
65 | * - Bit X is 1 in _FIXED0: bit X is fixed to 1 in CRx. | ||
66 | * - Bit X is 0 in _FIXED1: bit X is fixed to 0 in CRx. | ||
67 | */ | ||
68 | __asm__ __volatile__("mov %%cr0, %0" : "=r"(cr0) : : "memory"); | ||
69 | cr0 &= rdmsr(MSR_IA32_VMX_CR0_FIXED1); | ||
70 | cr0 |= rdmsr(MSR_IA32_VMX_CR0_FIXED0); | ||
71 | __asm__ __volatile__("mov %0, %%cr0" : : "r"(cr0) : "memory"); | ||
72 | |||
73 | __asm__ __volatile__("mov %%cr4, %0" : "=r"(cr4) : : "memory"); | ||
74 | cr4 &= rdmsr(MSR_IA32_VMX_CR4_FIXED1); | ||
75 | cr4 |= rdmsr(MSR_IA32_VMX_CR4_FIXED0); | ||
76 | /* Enable VMX operation */ | ||
77 | cr4 |= X86_CR4_VMXE; | ||
78 | __asm__ __volatile__("mov %0, %%cr4" : : "r"(cr4) : "memory"); | ||
79 | |||
80 | /* | ||
81 | * Configure IA32_FEATURE_CONTROL MSR to allow VMXON: | ||
82 | * Bit 0: Lock bit. If clear, VMXON causes a #GP. | ||
83 | * Bit 2: Enables VMXON outside of SMX operation. If clear, VMXON | ||
84 | * outside of SMX causes a #GP. | ||
85 | */ | ||
86 | required = FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX; | ||
87 | required |= FEATURE_CONTROL_LOCKED; | ||
88 | feature_control = rdmsr(MSR_IA32_FEATURE_CONTROL); | ||
89 | if ((feature_control & required) != required) | ||
90 | wrmsr(MSR_IA32_FEATURE_CONTROL, feature_control | required); | ||
91 | } | ||
92 | |||
93 | /* | ||
94 | * Initialize the control fields to the most basic settings possible. | ||
95 | */ | ||
96 | static inline void init_vmcs_control_fields(void) | ||
97 | { | ||
98 | vmwrite(VIRTUAL_PROCESSOR_ID, 0); | ||
99 | vmwrite(POSTED_INTR_NV, 0); | ||
100 | |||
101 | vmwrite(PIN_BASED_VM_EXEC_CONTROL, rdmsr(MSR_IA32_VMX_PINBASED_CTLS)); | ||
102 | vmwrite(CPU_BASED_VM_EXEC_CONTROL, rdmsr(MSR_IA32_VMX_PROCBASED_CTLS)); | ||
103 | vmwrite(EXCEPTION_BITMAP, 0); | ||
104 | vmwrite(PAGE_FAULT_ERROR_CODE_MASK, 0); | ||
105 | vmwrite(PAGE_FAULT_ERROR_CODE_MATCH, -1); /* Never match */ | ||
106 | vmwrite(CR3_TARGET_COUNT, 0); | ||
107 | vmwrite(VM_EXIT_CONTROLS, rdmsr(MSR_IA32_VMX_EXIT_CTLS) | | ||
108 | VM_EXIT_HOST_ADDR_SPACE_SIZE); /* 64-bit host */ | ||
109 | vmwrite(VM_EXIT_MSR_STORE_COUNT, 0); | ||
110 | vmwrite(VM_EXIT_MSR_LOAD_COUNT, 0); | ||
111 | vmwrite(VM_ENTRY_CONTROLS, rdmsr(MSR_IA32_VMX_ENTRY_CTLS) | | ||
112 | VM_ENTRY_IA32E_MODE); /* 64-bit guest */ | ||
113 | vmwrite(VM_ENTRY_MSR_LOAD_COUNT, 0); | ||
114 | vmwrite(VM_ENTRY_INTR_INFO_FIELD, 0); | ||
115 | vmwrite(TPR_THRESHOLD, 0); | ||
116 | vmwrite(SECONDARY_VM_EXEC_CONTROL, 0); | ||
117 | |||
118 | vmwrite(CR0_GUEST_HOST_MASK, 0); | ||
119 | vmwrite(CR4_GUEST_HOST_MASK, 0); | ||
120 | vmwrite(CR0_READ_SHADOW, get_cr0()); | ||
121 | vmwrite(CR4_READ_SHADOW, get_cr4()); | ||
122 | } | ||
123 | |||
124 | /* | ||
125 | * Initialize the host state fields based on the current host state, with | ||
126 | * the exception of HOST_RSP and HOST_RIP, which should be set by vmlaunch | ||
127 | * or vmresume. | ||
128 | */ | ||
129 | static inline void init_vmcs_host_state(void) | ||
130 | { | ||
131 | uint32_t exit_controls = vmreadz(VM_EXIT_CONTROLS); | ||
132 | |||
133 | vmwrite(HOST_ES_SELECTOR, get_es()); | ||
134 | vmwrite(HOST_CS_SELECTOR, get_cs()); | ||
135 | vmwrite(HOST_SS_SELECTOR, get_ss()); | ||
136 | vmwrite(HOST_DS_SELECTOR, get_ds()); | ||
137 | vmwrite(HOST_FS_SELECTOR, get_fs()); | ||
138 | vmwrite(HOST_GS_SELECTOR, get_gs()); | ||
139 | vmwrite(HOST_TR_SELECTOR, get_tr()); | ||
140 | |||
141 | if (exit_controls & VM_EXIT_LOAD_IA32_PAT) | ||
142 | vmwrite(HOST_IA32_PAT, rdmsr(MSR_IA32_CR_PAT)); | ||
143 | if (exit_controls & VM_EXIT_LOAD_IA32_EFER) | ||
144 | vmwrite(HOST_IA32_EFER, rdmsr(MSR_EFER)); | ||
145 | if (exit_controls & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) | ||
146 | vmwrite(HOST_IA32_PERF_GLOBAL_CTRL, | ||
147 | rdmsr(MSR_CORE_PERF_GLOBAL_CTRL)); | ||
148 | |||
149 | vmwrite(HOST_IA32_SYSENTER_CS, rdmsr(MSR_IA32_SYSENTER_CS)); | ||
150 | |||
151 | vmwrite(HOST_CR0, get_cr0()); | ||
152 | vmwrite(HOST_CR3, get_cr3()); | ||
153 | vmwrite(HOST_CR4, get_cr4()); | ||
154 | vmwrite(HOST_FS_BASE, rdmsr(MSR_FS_BASE)); | ||
155 | vmwrite(HOST_GS_BASE, rdmsr(MSR_GS_BASE)); | ||
156 | vmwrite(HOST_TR_BASE, | ||
157 | get_desc64_base((struct desc64 *)(get_gdt_base() + get_tr()))); | ||
158 | vmwrite(HOST_GDTR_BASE, get_gdt_base()); | ||
159 | vmwrite(HOST_IDTR_BASE, get_idt_base()); | ||
160 | vmwrite(HOST_IA32_SYSENTER_ESP, rdmsr(MSR_IA32_SYSENTER_ESP)); | ||
161 | vmwrite(HOST_IA32_SYSENTER_EIP, rdmsr(MSR_IA32_SYSENTER_EIP)); | ||
162 | } | ||
163 | |||
164 | /* | ||
165 | * Initialize the guest state fields essentially as a clone of | ||
166 | * the host state fields. Some host state fields have fixed | ||
167 | * values, and we set the corresponding guest state fields accordingly. | ||
168 | */ | ||
169 | static inline void init_vmcs_guest_state(void *rip, void *rsp) | ||
170 | { | ||
171 | vmwrite(GUEST_ES_SELECTOR, vmreadz(HOST_ES_SELECTOR)); | ||
172 | vmwrite(GUEST_CS_SELECTOR, vmreadz(HOST_CS_SELECTOR)); | ||
173 | vmwrite(GUEST_SS_SELECTOR, vmreadz(HOST_SS_SELECTOR)); | ||
174 | vmwrite(GUEST_DS_SELECTOR, vmreadz(HOST_DS_SELECTOR)); | ||
175 | vmwrite(GUEST_FS_SELECTOR, vmreadz(HOST_FS_SELECTOR)); | ||
176 | vmwrite(GUEST_GS_SELECTOR, vmreadz(HOST_GS_SELECTOR)); | ||
177 | vmwrite(GUEST_LDTR_SELECTOR, 0); | ||
178 | vmwrite(GUEST_TR_SELECTOR, vmreadz(HOST_TR_SELECTOR)); | ||
179 | vmwrite(GUEST_INTR_STATUS, 0); | ||
180 | vmwrite(GUEST_PML_INDEX, 0); | ||
181 | |||
182 | vmwrite(VMCS_LINK_POINTER, -1ll); | ||
183 | vmwrite(GUEST_IA32_DEBUGCTL, 0); | ||
184 | vmwrite(GUEST_IA32_PAT, vmreadz(HOST_IA32_PAT)); | ||
185 | vmwrite(GUEST_IA32_EFER, vmreadz(HOST_IA32_EFER)); | ||
186 | vmwrite(GUEST_IA32_PERF_GLOBAL_CTRL, | ||
187 | vmreadz(HOST_IA32_PERF_GLOBAL_CTRL)); | ||
188 | |||
189 | vmwrite(GUEST_ES_LIMIT, -1); | ||
190 | vmwrite(GUEST_CS_LIMIT, -1); | ||
191 | vmwrite(GUEST_SS_LIMIT, -1); | ||
192 | vmwrite(GUEST_DS_LIMIT, -1); | ||
193 | vmwrite(GUEST_FS_LIMIT, -1); | ||
194 | vmwrite(GUEST_GS_LIMIT, -1); | ||
195 | vmwrite(GUEST_LDTR_LIMIT, -1); | ||
196 | vmwrite(GUEST_TR_LIMIT, 0x67); | ||
197 | vmwrite(GUEST_GDTR_LIMIT, 0xffff); | ||
198 | vmwrite(GUEST_IDTR_LIMIT, 0xffff); | ||
199 | vmwrite(GUEST_ES_AR_BYTES, | ||
200 | vmreadz(GUEST_ES_SELECTOR) == 0 ? 0x10000 : 0xc093); | ||
201 | vmwrite(GUEST_CS_AR_BYTES, 0xa09b); | ||
202 | vmwrite(GUEST_SS_AR_BYTES, 0xc093); | ||
203 | vmwrite(GUEST_DS_AR_BYTES, | ||
204 | vmreadz(GUEST_DS_SELECTOR) == 0 ? 0x10000 : 0xc093); | ||
205 | vmwrite(GUEST_FS_AR_BYTES, | ||
206 | vmreadz(GUEST_FS_SELECTOR) == 0 ? 0x10000 : 0xc093); | ||
207 | vmwrite(GUEST_GS_AR_BYTES, | ||
208 | vmreadz(GUEST_GS_SELECTOR) == 0 ? 0x10000 : 0xc093); | ||
209 | vmwrite(GUEST_LDTR_AR_BYTES, 0x10000); | ||
210 | vmwrite(GUEST_TR_AR_BYTES, 0x8b); | ||
211 | vmwrite(GUEST_INTERRUPTIBILITY_INFO, 0); | ||
212 | vmwrite(GUEST_ACTIVITY_STATE, 0); | ||
213 | vmwrite(GUEST_SYSENTER_CS, vmreadz(HOST_IA32_SYSENTER_CS)); | ||
214 | vmwrite(VMX_PREEMPTION_TIMER_VALUE, 0); | ||
215 | |||
216 | vmwrite(GUEST_CR0, vmreadz(HOST_CR0)); | ||
217 | vmwrite(GUEST_CR3, vmreadz(HOST_CR3)); | ||
218 | vmwrite(GUEST_CR4, vmreadz(HOST_CR4)); | ||
219 | vmwrite(GUEST_ES_BASE, 0); | ||
220 | vmwrite(GUEST_CS_BASE, 0); | ||
221 | vmwrite(GUEST_SS_BASE, 0); | ||
222 | vmwrite(GUEST_DS_BASE, 0); | ||
223 | vmwrite(GUEST_FS_BASE, vmreadz(HOST_FS_BASE)); | ||
224 | vmwrite(GUEST_GS_BASE, vmreadz(HOST_GS_BASE)); | ||
225 | vmwrite(GUEST_LDTR_BASE, 0); | ||
226 | vmwrite(GUEST_TR_BASE, vmreadz(HOST_TR_BASE)); | ||
227 | vmwrite(GUEST_GDTR_BASE, vmreadz(HOST_GDTR_BASE)); | ||
228 | vmwrite(GUEST_IDTR_BASE, vmreadz(HOST_IDTR_BASE)); | ||
229 | vmwrite(GUEST_DR7, 0x400); | ||
230 | vmwrite(GUEST_RSP, (uint64_t)rsp); | ||
231 | vmwrite(GUEST_RIP, (uint64_t)rip); | ||
232 | vmwrite(GUEST_RFLAGS, 2); | ||
233 | vmwrite(GUEST_PENDING_DBG_EXCEPTIONS, 0); | ||
234 | vmwrite(GUEST_SYSENTER_ESP, vmreadz(HOST_IA32_SYSENTER_ESP)); | ||
235 | vmwrite(GUEST_SYSENTER_EIP, vmreadz(HOST_IA32_SYSENTER_EIP)); | ||
236 | } | ||
237 | |||
238 | void prepare_vmcs(void *guest_rip, void *guest_rsp) | ||
239 | { | ||
240 | init_vmcs_control_fields(); | ||
241 | init_vmcs_host_state(); | ||
242 | init_vmcs_guest_state(guest_rip, guest_rsp); | ||
243 | } | ||
diff --git a/tools/testing/selftests/kvm/vmx_tsc_adjust_test.c b/tools/testing/selftests/kvm/vmx_tsc_adjust_test.c new file mode 100644 index 000000000000..8f7f62093add --- /dev/null +++ b/tools/testing/selftests/kvm/vmx_tsc_adjust_test.c | |||
@@ -0,0 +1,231 @@ | |||
1 | /* | ||
2 | * gtests/tests/vmx_tsc_adjust_test.c | ||
3 | * | ||
4 | * Copyright (C) 2018, Google LLC. | ||
5 | * | ||
6 | * This work is licensed under the terms of the GNU GPL, version 2. | ||
7 | * | ||
8 | * | ||
9 | * IA32_TSC_ADJUST test | ||
10 | * | ||
11 | * According to the SDM, "if an execution of WRMSR to the | ||
12 | * IA32_TIME_STAMP_COUNTER MSR adds (or subtracts) value X from the TSC, | ||
13 | * the logical processor also adds (or subtracts) value X from the | ||
14 | * IA32_TSC_ADJUST MSR. | ||
15 | * | ||
16 | * Note that when L1 doesn't intercept writes to IA32_TSC, a | ||
17 | * WRMSR(IA32_TSC) from L2 sets L1's TSC value, not L2's perceived TSC | ||
18 | * value. | ||
19 | * | ||
20 | * This test verifies that this unusual case is handled correctly. | ||
21 | */ | ||
22 | |||
23 | #include "test_util.h" | ||
24 | #include "kvm_util.h" | ||
25 | #include "x86.h" | ||
26 | #include "vmx.h" | ||
27 | |||
28 | #include <string.h> | ||
29 | #include <sys/ioctl.h> | ||
30 | |||
31 | #ifndef MSR_IA32_TSC_ADJUST | ||
32 | #define MSR_IA32_TSC_ADJUST 0x3b | ||
33 | #endif | ||
34 | |||
35 | #define PAGE_SIZE 4096 | ||
36 | #define VCPU_ID 5 | ||
37 | |||
38 | #define TSC_ADJUST_VALUE (1ll << 32) | ||
39 | #define TSC_OFFSET_VALUE -(1ll << 48) | ||
40 | |||
41 | enum { | ||
42 | PORT_ABORT = 0x1000, | ||
43 | PORT_REPORT, | ||
44 | PORT_DONE, | ||
45 | }; | ||
46 | |||
47 | struct vmx_page { | ||
48 | vm_vaddr_t virt; | ||
49 | vm_paddr_t phys; | ||
50 | }; | ||
51 | |||
52 | enum { | ||
53 | VMXON_PAGE = 0, | ||
54 | VMCS_PAGE, | ||
55 | MSR_BITMAP_PAGE, | ||
56 | |||
57 | NUM_VMX_PAGES, | ||
58 | }; | ||
59 | |||
60 | struct kvm_single_msr { | ||
61 | struct kvm_msrs header; | ||
62 | struct kvm_msr_entry entry; | ||
63 | } __attribute__((packed)); | ||
64 | |||
65 | /* The virtual machine object. */ | ||
66 | static struct kvm_vm *vm; | ||
67 | |||
68 | /* Array of vmx_page descriptors that is shared with the guest. */ | ||
69 | struct vmx_page *vmx_pages; | ||
70 | |||
71 | #define exit_to_l0(_port, _arg) do_exit_to_l0(_port, (unsigned long) (_arg)) | ||
72 | static void do_exit_to_l0(uint16_t port, unsigned long arg) | ||
73 | { | ||
74 | __asm__ __volatile__("in %[port], %%al" | ||
75 | : | ||
76 | : [port]"d"(port), "D"(arg) | ||
77 | : "rax"); | ||
78 | } | ||
79 | |||
80 | |||
81 | #define GUEST_ASSERT(_condition) do { \ | ||
82 | if (!(_condition)) \ | ||
83 | exit_to_l0(PORT_ABORT, "Failed guest assert: " #_condition); \ | ||
84 | } while (0) | ||
85 | |||
86 | static void check_ia32_tsc_adjust(int64_t max) | ||
87 | { | ||
88 | int64_t adjust; | ||
89 | |||
90 | adjust = rdmsr(MSR_IA32_TSC_ADJUST); | ||
91 | exit_to_l0(PORT_REPORT, adjust); | ||
92 | GUEST_ASSERT(adjust <= max); | ||
93 | } | ||
94 | |||
95 | static void l2_guest_code(void) | ||
96 | { | ||
97 | uint64_t l1_tsc = rdtsc() - TSC_OFFSET_VALUE; | ||
98 | |||
99 | wrmsr(MSR_IA32_TSC, l1_tsc - TSC_ADJUST_VALUE); | ||
100 | check_ia32_tsc_adjust(-2 * TSC_ADJUST_VALUE); | ||
101 | |||
102 | /* Exit to L1 */ | ||
103 | __asm__ __volatile__("vmcall"); | ||
104 | } | ||
105 | |||
106 | static void l1_guest_code(struct vmx_page *vmx_pages) | ||
107 | { | ||
108 | #define L2_GUEST_STACK_SIZE 64 | ||
109 | unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE]; | ||
110 | uint32_t control; | ||
111 | uintptr_t save_cr3; | ||
112 | |||
113 | GUEST_ASSERT(rdtsc() < TSC_ADJUST_VALUE); | ||
114 | wrmsr(MSR_IA32_TSC, rdtsc() - TSC_ADJUST_VALUE); | ||
115 | check_ia32_tsc_adjust(-1 * TSC_ADJUST_VALUE); | ||
116 | |||
117 | prepare_for_vmx_operation(); | ||
118 | |||
119 | /* Enter VMX root operation. */ | ||
120 | *(uint32_t *)vmx_pages[VMXON_PAGE].virt = vmcs_revision(); | ||
121 | GUEST_ASSERT(!vmxon(vmx_pages[VMXON_PAGE].phys)); | ||
122 | |||
123 | /* Load a VMCS. */ | ||
124 | *(uint32_t *)vmx_pages[VMCS_PAGE].virt = vmcs_revision(); | ||
125 | GUEST_ASSERT(!vmclear(vmx_pages[VMCS_PAGE].phys)); | ||
126 | GUEST_ASSERT(!vmptrld(vmx_pages[VMCS_PAGE].phys)); | ||
127 | |||
128 | /* Prepare the VMCS for L2 execution. */ | ||
129 | prepare_vmcs(l2_guest_code, &l2_guest_stack[L2_GUEST_STACK_SIZE]); | ||
130 | control = vmreadz(CPU_BASED_VM_EXEC_CONTROL); | ||
131 | control |= CPU_BASED_USE_MSR_BITMAPS | CPU_BASED_USE_TSC_OFFSETING; | ||
132 | vmwrite(CPU_BASED_VM_EXEC_CONTROL, control); | ||
133 | vmwrite(MSR_BITMAP, vmx_pages[MSR_BITMAP_PAGE].phys); | ||
134 | vmwrite(TSC_OFFSET, TSC_OFFSET_VALUE); | ||
135 | |||
136 | /* Jump into L2. First, test failure to load guest CR3. */ | ||
137 | save_cr3 = vmreadz(GUEST_CR3); | ||
138 | vmwrite(GUEST_CR3, -1ull); | ||
139 | GUEST_ASSERT(!vmlaunch()); | ||
140 | GUEST_ASSERT(vmreadz(VM_EXIT_REASON) == | ||
141 | (EXIT_REASON_FAILED_VMENTRY | EXIT_REASON_INVALID_STATE)); | ||
142 | check_ia32_tsc_adjust(-1 * TSC_ADJUST_VALUE); | ||
143 | vmwrite(GUEST_CR3, save_cr3); | ||
144 | |||
145 | GUEST_ASSERT(!vmlaunch()); | ||
146 | GUEST_ASSERT(vmreadz(VM_EXIT_REASON) == EXIT_REASON_VMCALL); | ||
147 | |||
148 | check_ia32_tsc_adjust(-2 * TSC_ADJUST_VALUE); | ||
149 | |||
150 | exit_to_l0(PORT_DONE, 0); | ||
151 | } | ||
152 | |||
153 | static void allocate_vmx_page(struct vmx_page *page) | ||
154 | { | ||
155 | vm_vaddr_t virt; | ||
156 | |||
157 | virt = vm_vaddr_alloc(vm, PAGE_SIZE, 0, 0, 0); | ||
158 | memset(addr_gva2hva(vm, virt), 0, PAGE_SIZE); | ||
159 | |||
160 | page->virt = virt; | ||
161 | page->phys = addr_gva2gpa(vm, virt); | ||
162 | } | ||
163 | |||
164 | static vm_vaddr_t allocate_vmx_pages(void) | ||
165 | { | ||
166 | vm_vaddr_t vmx_pages_vaddr; | ||
167 | int i; | ||
168 | |||
169 | vmx_pages_vaddr = vm_vaddr_alloc( | ||
170 | vm, sizeof(struct vmx_page) * NUM_VMX_PAGES, 0, 0, 0); | ||
171 | |||
172 | vmx_pages = (void *) addr_gva2hva(vm, vmx_pages_vaddr); | ||
173 | |||
174 | for (i = 0; i < NUM_VMX_PAGES; i++) | ||
175 | allocate_vmx_page(&vmx_pages[i]); | ||
176 | |||
177 | return vmx_pages_vaddr; | ||
178 | } | ||
179 | |||
180 | void report(int64_t val) | ||
181 | { | ||
182 | printf("IA32_TSC_ADJUST is %ld (%lld * TSC_ADJUST_VALUE + %lld).\n", | ||
183 | val, val / TSC_ADJUST_VALUE, val % TSC_ADJUST_VALUE); | ||
184 | } | ||
185 | |||
186 | int main(int argc, char *argv[]) | ||
187 | { | ||
188 | vm_vaddr_t vmx_pages_vaddr; | ||
189 | struct kvm_cpuid_entry2 *entry = kvm_get_supported_cpuid_entry(1); | ||
190 | |||
191 | if (!(entry->ecx & CPUID_VMX)) { | ||
192 | printf("nested VMX not enabled, skipping test"); | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | vm = vm_create_default_vmx(VCPU_ID, (void *) l1_guest_code); | ||
197 | |||
198 | /* Allocate VMX pages and shared descriptors (vmx_pages). */ | ||
199 | vmx_pages_vaddr = allocate_vmx_pages(); | ||
200 | vcpu_args_set(vm, VCPU_ID, 1, vmx_pages_vaddr); | ||
201 | |||
202 | for (;;) { | ||
203 | volatile struct kvm_run *run = vcpu_state(vm, VCPU_ID); | ||
204 | struct kvm_regs regs; | ||
205 | |||
206 | vcpu_run(vm, VCPU_ID); | ||
207 | TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, | ||
208 | "Got exit_reason other than KVM_EXIT_IO: %u (%s),\n", | ||
209 | run->exit_reason, | ||
210 | exit_reason_str(run->exit_reason)); | ||
211 | |||
212 | vcpu_regs_get(vm, VCPU_ID, ®s); | ||
213 | |||
214 | switch (run->io.port) { | ||
215 | case PORT_ABORT: | ||
216 | TEST_ASSERT(false, "%s", (const char *) regs.rdi); | ||
217 | /* NOT REACHED */ | ||
218 | case PORT_REPORT: | ||
219 | report(regs.rdi); | ||
220 | break; | ||
221 | case PORT_DONE: | ||
222 | goto done; | ||
223 | default: | ||
224 | TEST_ASSERT(false, "Unknown port 0x%x.", run->io.port); | ||
225 | } | ||
226 | } | ||
227 | |||
228 | kvm_vm_free(vm); | ||
229 | done: | ||
230 | return 0; | ||
231 | } | ||
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 785fc18a16b4..8f1e13d2e547 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile | |||
@@ -5,7 +5,7 @@ CFLAGS = -Wall -Wl,--no-as-needed -O2 -g | |||
5 | CFLAGS += -I../../../../usr/include/ | 5 | CFLAGS += -I../../../../usr/include/ |
6 | 6 | ||
7 | TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh rtnetlink.sh | 7 | TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh rtnetlink.sh |
8 | TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh | 8 | TEST_PROGS += fib_tests.sh fib-onlink-tests.sh in_netns.sh pmtu.sh |
9 | TEST_GEN_FILES = socket | 9 | TEST_GEN_FILES = socket |
10 | TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy | 10 | TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy |
11 | TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa | 11 | TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa |
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 = ®s64.r8; | 137 | uint64_t *r64 = ®s64.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++; |