diff options
| author | Ingo Molnar <mingo@kernel.org> | 2018-06-03 13:11:38 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2018-06-03 13:11:38 -0400 |
| commit | 4e9ae0d3d5bf4e2f1b466ba451bd18f2c5b69845 (patch) | |
| tree | 51a6a1b796039c00d71c30577dac42ec80936f52 /tools | |
| parent | 874cd339acdfe734b5418e36e3ad40fd4c573155 (diff) | |
| parent | 0b3a18387f3e5cdcfaaf884860a4688280d09c9d (diff) | |
Merge tag 'perf-urgent-for-mingo-4.17-20180602' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/urgent fixes from Carvalho de Melo:
- Update prctl and cpufeatures.h tools/ copies with the kernel sources
originals, which makes 'perf trace' know about the new prctl options
for speculation control and silences the build warnings (Arnaldo Carvalho de Melo)
- Update insn.h in Intel-PT instruction decoder with its original from from the
kernel sources, to silence build warnings, no effect on the actual tools this
time around (Arnaldo Carvalho de Melo)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/arch/x86/include/asm/cpufeatures.h | 20 | ||||
| -rw-r--r-- | tools/include/uapi/linux/prctl.h | 12 | ||||
| -rwxr-xr-x | tools/perf/trace/beauty/prctl_option.sh | 2 | ||||
| -rw-r--r-- | tools/perf/util/intel-pt-decoder/insn.h | 18 |
4 files changed, 45 insertions, 7 deletions
diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h index 578793e97431..fb00a2fca990 100644 --- a/tools/arch/x86/include/asm/cpufeatures.h +++ b/tools/arch/x86/include/asm/cpufeatures.h | |||
| @@ -198,7 +198,6 @@ | |||
| 198 | #define X86_FEATURE_CAT_L2 ( 7*32+ 5) /* Cache Allocation Technology L2 */ | 198 | #define X86_FEATURE_CAT_L2 ( 7*32+ 5) /* Cache Allocation Technology L2 */ |
| 199 | #define X86_FEATURE_CDP_L3 ( 7*32+ 6) /* Code and Data Prioritization L3 */ | 199 | #define X86_FEATURE_CDP_L3 ( 7*32+ 6) /* Code and Data Prioritization L3 */ |
| 200 | #define X86_FEATURE_INVPCID_SINGLE ( 7*32+ 7) /* Effectively INVPCID && CR4.PCIDE=1 */ | 200 | #define X86_FEATURE_INVPCID_SINGLE ( 7*32+ 7) /* Effectively INVPCID && CR4.PCIDE=1 */ |
| 201 | |||
| 202 | #define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */ | 201 | #define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */ |
| 203 | #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ | 202 | #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */ |
| 204 | #define X86_FEATURE_SME ( 7*32+10) /* AMD Secure Memory Encryption */ | 203 | #define X86_FEATURE_SME ( 7*32+10) /* AMD Secure Memory Encryption */ |
| @@ -207,13 +206,19 @@ | |||
| 207 | #define X86_FEATURE_RETPOLINE_AMD ( 7*32+13) /* "" AMD Retpoline mitigation for Spectre variant 2 */ | 206 | #define X86_FEATURE_RETPOLINE_AMD ( 7*32+13) /* "" AMD Retpoline mitigation for Spectre variant 2 */ |
| 208 | #define X86_FEATURE_INTEL_PPIN ( 7*32+14) /* Intel Processor Inventory Number */ | 207 | #define X86_FEATURE_INTEL_PPIN ( 7*32+14) /* Intel Processor Inventory Number */ |
| 209 | #define X86_FEATURE_CDP_L2 ( 7*32+15) /* Code and Data Prioritization L2 */ | 208 | #define X86_FEATURE_CDP_L2 ( 7*32+15) /* Code and Data Prioritization L2 */ |
| 210 | 209 | #define X86_FEATURE_MSR_SPEC_CTRL ( 7*32+16) /* "" MSR SPEC_CTRL is implemented */ | |
| 210 | #define X86_FEATURE_SSBD ( 7*32+17) /* Speculative Store Bypass Disable */ | ||
| 211 | #define X86_FEATURE_MBA ( 7*32+18) /* Memory Bandwidth Allocation */ | 211 | #define X86_FEATURE_MBA ( 7*32+18) /* Memory Bandwidth Allocation */ |
| 212 | #define X86_FEATURE_RSB_CTXSW ( 7*32+19) /* "" Fill RSB on context switches */ | 212 | #define X86_FEATURE_RSB_CTXSW ( 7*32+19) /* "" Fill RSB on context switches */ |
| 213 | #define X86_FEATURE_SEV ( 7*32+20) /* AMD Secure Encrypted Virtualization */ | 213 | #define X86_FEATURE_SEV ( 7*32+20) /* AMD Secure Encrypted Virtualization */ |
| 214 | |||
| 215 | #define X86_FEATURE_USE_IBPB ( 7*32+21) /* "" Indirect Branch Prediction Barrier enabled */ | 214 | #define X86_FEATURE_USE_IBPB ( 7*32+21) /* "" Indirect Branch Prediction Barrier enabled */ |
| 216 | #define X86_FEATURE_USE_IBRS_FW ( 7*32+22) /* "" Use IBRS during runtime firmware calls */ | 215 | #define X86_FEATURE_USE_IBRS_FW ( 7*32+22) /* "" Use IBRS during runtime firmware calls */ |
| 216 | #define X86_FEATURE_SPEC_STORE_BYPASS_DISABLE ( 7*32+23) /* "" Disable Speculative Store Bypass. */ | ||
| 217 | #define X86_FEATURE_LS_CFG_SSBD ( 7*32+24) /* "" AMD SSBD implementation via LS_CFG MSR */ | ||
| 218 | #define X86_FEATURE_IBRS ( 7*32+25) /* Indirect Branch Restricted Speculation */ | ||
| 219 | #define X86_FEATURE_IBPB ( 7*32+26) /* Indirect Branch Prediction Barrier */ | ||
| 220 | #define X86_FEATURE_STIBP ( 7*32+27) /* Single Thread Indirect Branch Predictors */ | ||
| 221 | #define X86_FEATURE_ZEN ( 7*32+28) /* "" CPU is AMD family 0x17 (Zen) */ | ||
| 217 | 222 | ||
| 218 | /* Virtualization flags: Linux defined, word 8 */ | 223 | /* Virtualization flags: Linux defined, word 8 */ |
| 219 | #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ | 224 | #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ |
| @@ -274,9 +279,10 @@ | |||
| 274 | #define X86_FEATURE_CLZERO (13*32+ 0) /* CLZERO instruction */ | 279 | #define X86_FEATURE_CLZERO (13*32+ 0) /* CLZERO instruction */ |
| 275 | #define X86_FEATURE_IRPERF (13*32+ 1) /* Instructions Retired Count */ | 280 | #define X86_FEATURE_IRPERF (13*32+ 1) /* Instructions Retired Count */ |
| 276 | #define X86_FEATURE_XSAVEERPTR (13*32+ 2) /* Always save/restore FP error pointers */ | 281 | #define X86_FEATURE_XSAVEERPTR (13*32+ 2) /* Always save/restore FP error pointers */ |
| 277 | #define X86_FEATURE_IBPB (13*32+12) /* Indirect Branch Prediction Barrier */ | 282 | #define X86_FEATURE_AMD_IBPB (13*32+12) /* "" Indirect Branch Prediction Barrier */ |
| 278 | #define X86_FEATURE_IBRS (13*32+14) /* Indirect Branch Restricted Speculation */ | 283 | #define X86_FEATURE_AMD_IBRS (13*32+14) /* "" Indirect Branch Restricted Speculation */ |
| 279 | #define X86_FEATURE_STIBP (13*32+15) /* Single Thread Indirect Branch Predictors */ | 284 | #define X86_FEATURE_AMD_STIBP (13*32+15) /* "" Single Thread Indirect Branch Predictors */ |
| 285 | #define X86_FEATURE_VIRT_SSBD (13*32+25) /* Virtualized Speculative Store Bypass Disable */ | ||
| 280 | 286 | ||
| 281 | /* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */ | 287 | /* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */ |
| 282 | #define X86_FEATURE_DTHERM (14*32+ 0) /* Digital Thermal Sensor */ | 288 | #define X86_FEATURE_DTHERM (14*32+ 0) /* Digital Thermal Sensor */ |
| @@ -334,6 +340,7 @@ | |||
| 334 | #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ | 340 | #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ |
| 335 | #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ | 341 | #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ |
| 336 | #define X86_FEATURE_ARCH_CAPABILITIES (18*32+29) /* IA32_ARCH_CAPABILITIES MSR (Intel) */ | 342 | #define X86_FEATURE_ARCH_CAPABILITIES (18*32+29) /* IA32_ARCH_CAPABILITIES MSR (Intel) */ |
| 343 | #define X86_FEATURE_SPEC_CTRL_SSBD (18*32+31) /* "" Speculative Store Bypass Disable */ | ||
| 337 | 344 | ||
| 338 | /* | 345 | /* |
| 339 | * BUG word(s) | 346 | * BUG word(s) |
| @@ -363,5 +370,6 @@ | |||
| 363 | #define X86_BUG_CPU_MELTDOWN X86_BUG(14) /* CPU is affected by meltdown attack and needs kernel page table isolation */ | 370 | #define X86_BUG_CPU_MELTDOWN X86_BUG(14) /* CPU is affected by meltdown attack and needs kernel page table isolation */ |
| 364 | #define X86_BUG_SPECTRE_V1 X86_BUG(15) /* CPU is affected by Spectre variant 1 attack with conditional branches */ | 371 | #define X86_BUG_SPECTRE_V1 X86_BUG(15) /* CPU is affected by Spectre variant 1 attack with conditional branches */ |
| 365 | #define X86_BUG_SPECTRE_V2 X86_BUG(16) /* CPU is affected by Spectre variant 2 attack with indirect branches */ | 372 | #define X86_BUG_SPECTRE_V2 X86_BUG(16) /* CPU is affected by Spectre variant 2 attack with indirect branches */ |
| 373 | #define X86_BUG_SPEC_STORE_BYPASS X86_BUG(17) /* CPU is affected by speculative store bypass attack */ | ||
| 366 | 374 | ||
| 367 | #endif /* _ASM_X86_CPUFEATURES_H */ | 375 | #endif /* _ASM_X86_CPUFEATURES_H */ |
diff --git a/tools/include/uapi/linux/prctl.h b/tools/include/uapi/linux/prctl.h index af5f8c2df87a..db9f15f5db04 100644 --- a/tools/include/uapi/linux/prctl.h +++ b/tools/include/uapi/linux/prctl.h | |||
| @@ -207,4 +207,16 @@ struct prctl_mm_map { | |||
| 207 | # define PR_SVE_VL_LEN_MASK 0xffff | 207 | # define PR_SVE_VL_LEN_MASK 0xffff |
| 208 | # define PR_SVE_VL_INHERIT (1 << 17) /* inherit across exec */ | 208 | # define PR_SVE_VL_INHERIT (1 << 17) /* inherit across exec */ |
| 209 | 209 | ||
| 210 | /* Per task speculation control */ | ||
| 211 | #define PR_GET_SPECULATION_CTRL 52 | ||
| 212 | #define PR_SET_SPECULATION_CTRL 53 | ||
| 213 | /* Speculation control variants */ | ||
| 214 | # define PR_SPEC_STORE_BYPASS 0 | ||
| 215 | /* Return and control values for PR_SET/GET_SPECULATION_CTRL */ | ||
| 216 | # define PR_SPEC_NOT_AFFECTED 0 | ||
| 217 | # define PR_SPEC_PRCTL (1UL << 0) | ||
| 218 | # define PR_SPEC_ENABLE (1UL << 1) | ||
| 219 | # define PR_SPEC_DISABLE (1UL << 2) | ||
| 220 | # define PR_SPEC_FORCE_DISABLE (1UL << 3) | ||
| 221 | |||
| 210 | #endif /* _LINUX_PRCTL_H */ | 222 | #endif /* _LINUX_PRCTL_H */ |
diff --git a/tools/perf/trace/beauty/prctl_option.sh b/tools/perf/trace/beauty/prctl_option.sh index 0be4138fbe71..f24722146ebe 100755 --- a/tools/perf/trace/beauty/prctl_option.sh +++ b/tools/perf/trace/beauty/prctl_option.sh | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | header_dir=$1 | 3 | [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/ |
| 4 | 4 | ||
| 5 | printf "static const char *prctl_options[] = {\n" | 5 | printf "static const char *prctl_options[] = {\n" |
| 6 | regex='^#define[[:space:]]+PR_([GS]ET\w+)[[:space:]]*([[:xdigit:]]+).*' | 6 | regex='^#define[[:space:]]+PR_([GS]ET\w+)[[:space:]]*([[:xdigit:]]+).*' |
diff --git a/tools/perf/util/intel-pt-decoder/insn.h b/tools/perf/util/intel-pt-decoder/insn.h index e23578c7b1be..2669c9f748e4 100644 --- a/tools/perf/util/intel-pt-decoder/insn.h +++ b/tools/perf/util/intel-pt-decoder/insn.h | |||
| @@ -208,4 +208,22 @@ static inline int insn_offset_immediate(struct insn *insn) | |||
| 208 | return insn_offset_displacement(insn) + insn->displacement.nbytes; | 208 | return insn_offset_displacement(insn) + insn->displacement.nbytes; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | #define POP_SS_OPCODE 0x1f | ||
| 212 | #define MOV_SREG_OPCODE 0x8e | ||
| 213 | |||
| 214 | /* | ||
| 215 | * Intel SDM Vol.3A 6.8.3 states; | ||
| 216 | * "Any single-step trap that would be delivered following the MOV to SS | ||
| 217 | * instruction or POP to SS instruction (because EFLAGS.TF is 1) is | ||
| 218 | * suppressed." | ||
| 219 | * This function returns true if @insn is MOV SS or POP SS. On these | ||
| 220 | * instructions, single stepping is suppressed. | ||
| 221 | */ | ||
| 222 | static inline int insn_masking_exception(struct insn *insn) | ||
| 223 | { | ||
| 224 | return insn->opcode.bytes[0] == POP_SS_OPCODE || | ||
| 225 | (insn->opcode.bytes[0] == MOV_SREG_OPCODE && | ||
| 226 | X86_MODRM_REG(insn->modrm.bytes[0]) == 2); | ||
| 227 | } | ||
| 228 | |||
| 211 | #endif /* _ASM_X86_INSN_H */ | 229 | #endif /* _ASM_X86_INSN_H */ |
