x86/splitlock: CPUID and MSR details
PATCH 1/1 x86/splitlock: CPUID and MSR details
A splitlock is an atomic operation which crosses a cache line boundary. It serialises operations in the cache coherency fabric and comes with a multi-thousand cycle stall.
Intel Tremont CPUs introduce MSR_CORE_CAPS to enumerate various core-specific features, and MSR_TEST_CTRL to adjust the behaviour in the case of a splitlock.
Virtualising this for guests is distinctly tricky owing to the fact that MSR_TEST_CTRL has core rather than thread scope. In the meantime however, prevent the MSR values leaking into guests.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
--- tools/libxl/libxl_cpuid.c | 1 + tools/misc/xen-cpuid.c | 2 +- xen/arch/x86/msr.c | 4 ++++ xen/include/asm-x86/msr-index.h | 7 +++++++ xen/include/public/arch-x86/cpufeatureset.h | 1 + 5 files changed, 14 insertions(+), 1 deletion(-)
tools/libxl/libxl_cpuid.c +1 -0
@@ -217,6 +217,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str) {"stibp", 0x00000007, 0, CPUID_REG_EDX, 27, 1}, {"l1d-flush", 0x00000007, 0, CPUID_REG_EDX, 28, 1}, {"arch-caps", 0x00000007, 0, CPUID_REG_EDX, 29, 1}, + {"core-caps", 0x00000007, 0, CPUID_REG_EDX, 30, 1}, {"ssbd", 0x00000007, 0, CPUID_REG_EDX, 31, 1}, {"avx512-bf16", 0x00000007, 1, CPUID_REG_EAX, 5, 1},
tools/misc/xen-cpuid.c +1 -1
@@ -166,7 +166,7 @@ static const char *const str_7d0[32] = [26] = "ibrsb", [27] = "stibp", [28] = "l1d_flush", [29] = "arch_caps", - /* 30 */ [31] = "ssbd", + [30] = "core_caps", [31] = "ssbd", }; static const char *const str_7a1[32] =
xen/arch/x86/msr.c +4 -0
@@ -132,6 +132,8 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)case MSR_PRED_CMD :case MSR_FLUSH_CMD :/* Write-only */ +case MSR_TEST_CTRL : +case MSR_CORE_CAPABILITIES :case MSR_TSX_FORCE_ABORT :case MSR_TSX_CTRL :case MSR_AMD64_LWP_CFG :
@@ -283,10 +285,12 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)uint64_t rsvd;case MSR_IA32_PLATFORM_ID : +case MSR_CORE_CAPABILITIES :case MSR_INTEL_CORE_THREAD_COUNT :case MSR_INTEL_PLATFORM_INFO :case MSR_ARCH_CAPABILITIES :/* Read-only */ +case MSR_TEST_CTRL :case MSR_TSX_FORCE_ABORT :case MSR_TSX_CTRL :case MSR_AMD64_LWP_CFG :
xen/include/asm-x86/msr-index.h +7 -0
@@ -32,6 +32,10 @@#define EFER_KNOWN_MASK (EFER_SCE | EFER_LME | EFER_LMA | EFER_NX | \ EFER_SVME | EFER_FFXSE) +#define MSR_TEST_CTRL 0x00000033 +#define TEST_CTRL_SPLITLOCK_DETECT (_AC(1, ULL) << 29) +#define TEST_CTRL_SPLITLOCK_DISABLE (_AC(1, ULL) << 31) +#define MSR_INTEL_CORE_THREAD_COUNT 0x00000035#define MSR_CTC_THREAD_MASK 0x0000ffff#define MSR_CTC_CORE_MASK 0xffff0000
@@ -52,6 +56,9 @@#define PPIN_LOCKOUT (_AC(1, ULL) << 0)#define PPIN_ENABLE (_AC(1, ULL) << 1) +#define MSR_CORE_CAPABILITIES 0x000000cf +#define CORE_CAPS_SPLITLOCK_DETECT (_AC(1, ULL) << 5) +#define MSR_ARCH_CAPABILITIES 0x0000010a#define ARCH_CAPS_RDCL_NO (_AC(1, ULL) << 0)#define ARCH_CAPS_IBRS_ALL (_AC(1, ULL) << 1)
xen/include/public/arch-x86/cpufeatureset.h +1 -0
@@ -258,6 +258,7 @@ XEN_CPUFEATURE(IBRSB, 9*32+26) /*A IBRS and IBPB support (used by Intel XEN_CPUFEATURE(STIBP, 9*32+27) /*A STIBP */ XEN_CPUFEATURE(L1D_FLUSH, 9*32+28) /*S MSR_FLUSH_CMD and L1D flush. */ XEN_CPUFEATURE(ARCH_CAPS, 9*32+29) /* IA32_ARCH_CAPABILITIES MSR */ +XEN_CPUFEATURE(CORE_CAPS, 9*32+30) /* IA32_CORE_CAPABILITIES MSR */XEN_CPUFEATURE (SSBD ,9 *32 +31 )/*A MSR_SPEC_CTRL.SSBD available */ /* Intel-defined CPU features, CPUID level 0x00000007:1.eax, word 10 */
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Andrew Cooper
A splitlock is an atomic operation which crosses a cache line boundary. It serialises operations in the cache coherency fabric and comes with a multi-thousand cycle stall.
Intel Tremont CPUs introduce
MSR_CORE_CAPSto enumerate various core-specific features, andMSR_TEST_CTRLto adjust the behaviour in the case of a splitlock.
Quoted 5 lines
Virtualising this for guests is distinctly tricky owing to the fact that
MSR_TEST_CTRLhas core rather than thread scope. In the meantime however, prevent the MSR values leaking into guests.Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Andrew Cooper
A splitlock is an atomic operation which crosses a cache line boundary. It serialises operations in the cache coherency fabric and comes with a multi-thousand cycle stall.
Intel Tremont CPUs introduce
MSR_CORE_CAPSto enumerate various core-specific features, andMSR_TEST_CTRLto adjust the behaviour in the case of a splitlock.
Quoted 5 lines
Virtualising this for guests is distinctly tricky owing to the fact that
MSR_TEST_CTRLhas core rather than thread scope. In the meantime however, prevent the MSR values leaking into guests.Signed-off-by Andrew Cooper <[email protected]>
Feel free to throw in - with Wei's R-b you don't need my ack anymore, but I thought I'd reply anyway to avoid you having to wait a couple of days.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel