x86/cpu: Enable a few new cpu features
cover x86/cpu: Enable a few new cpu features
Enable a few new cpu features including UMONITOR, UMWAIT, TPAUSE, MOVDIRI and MOVDIR64B.
UMONITOR, UMWAIT, and TPAUSE are a set of user wait instructions. MOVDIRI moves doubleword or quadword from register to memory through direct store.
MOVDIR64B moves 64-bytes as direct-store with 64-bytes write atomicity.
The bits definition:
CPUID.(EAX=7,ECX=0):ECX[bit 05] WAITPKG
CPUID.(EAX=7,ECX=0):ECX[bit 27] MOVDIRI
CPUID.(EAX=7,ECX=0):ECX[bit 28] MOVDIR64B
The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf
Jingqi Liu (3):
x86/cpu: Enable UMONITOR/UMWAIT/TPAUSE cpu features x86/cpu: Enable MOVDIRI cpu feature x86/cpu: Enable MOVDIR64B cpu feature
target/i386/cpu.c | 6 +++--- target/i386/cpu.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/3 x86/cpu: Enable UMONITOR/UMWAIT/TPAUSE cpu features
UMONITOR, UMWAIT, and TPAUSE are a set of user wait instructions.
UMONITOR arms address monitoring hardware using an address. A store to an address within the specified address range triggers the monitoring hardware to wake up the processor waiting in umwait.
UMWAIT instructs the processor to enter an implementation-dependent optimized state while monitoring a range of addresses. The optimized state may be either a light-weight power/performance optimized state or an improved power/performance optimized state.
TPAUSE instructs the processor to enter an implementation-dependent optimized state c0.1 or c0.2 state and wake up when time-stamp counter reaches specified timeout.
The bit definition:
CPUID.(EAX=7,ECX=0):ECX[bit 05] WAITPKG
The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf
--- target/i386/cpu.c | 2 +- target/i386/cpu.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
target/i386/cpu.c +1 -1
@@ -978,7 +978,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { [FEAT_7_0_ECX] = { .feat_names = {NULL ,"avx512vbmi" ,"umip" ,"pku" , -NULL /* ospke */ ,NULL ,"avx512vbmi2" ,NULL , +NULL /* ospke */ ,"waitpkg" ,"avx512vbmi2" ,NULL ,"gfni" ,"vaes" ,"vpclmulqdq" ,"avx512vnni" ,"avx512bitalg" ,NULL ,"avx512-vpopcntdq" ,NULL , "la57", NULL, NULL, NULL,
target/i386/cpu.h +1 -0
@@ -674,6 +674,7 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];#define CPUID_7_0_ECX_UMIP (1U << 2)#define CPUID_7_0_ECX_PKU (1U << 3)#define CPUID_7_0_ECX_OSPKE (1U << 4) +#define CPUID_7_0_ECX_WAITPKG (1U << 5)/* UMONITOR/UMWAIT/TPAUSE Instructions */ #define CPUID_7_0_ECX_VBMI2 (1U << 6)/* Additional VBMI Instrs */ #define CPUID_7_0_ECX_GFNI (1U << 8)#define CPUID_7_0_ECX_VAES (1U << 9)
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 1/3] x86/cpu: Enable UMONITOR/UMWAIT/TPAUSE cpu features
Quoted 15 lines · Jingqi Liu
UMONITOR, UMWAIT, and TPAUSE are a set of user wait instructions.
UMONITOR arms address monitoring hardware using an address. A store to an address within the specified address range triggers the monitoring hardware to wake up the processor waiting in umwait.
UMWAIT instructs the processor to enter an implementation-dependent optimized state while monitoring a range of addresses. The optimized state may be either a light-weight power/performance optimized state or an improved power/performance optimized state.
TPAUSE instructs the processor to enter an implementation-dependent optimized state c0.1 or c0.2 state and wake up when time-stamp counter reaches specified timeout.
Quoted 8 lines
The bit definition:
CPUID.(EAX=7,ECX=0):ECX[bit 05] WAITPKGThe release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdfSigned-off-by Jingqi Liu <[email protected]>
Is it really OK to expose these features to the guest without "-overcommit cpu-pm=on"?
Don't we need code to migrate IA32_UMWAIT_CONTROL?
(I don't see code to handle writes to IA32_UMWAIT_CONTROL on the KVM patches, either.)
Signature · 1 line
Eduardo
Re: [Qemu-devel] [PATCH 1/3] x86/cpu: Enable UMONITOR/UMWAIT/TPAUSE cpu features
Quoted 38 lines
-----Original Message-----
From: Eduardo Habkost [mailto:[email protected]]
Sent: Tuesday, August 7, 2018 6:03 AM
To: Liu, Jingqi <[email protected]>
Cc: [email protected]; [email protected]; Wang, Wei W <[email protected]>; [email protected]; Michael S. Tsirkin <[email protected]>
Subject: Re: [Qemu-devel] [PATCH 1/3] x86/cpu: Enable UMONITOR/UMWAIT/TPAUSE cpu featuresQuoted 15 lines · Jingqi Liu
UMONITOR, UMWAIT, and TPAUSE are a set of user wait instructions.
UMONITOR arms address monitoring hardware using an address. A store to an address within the specified address range triggers the monitoring hardware to wake up the processor waiting in umwait.
UMWAIT instructs the processor to enter an implementation-dependent optimized state while monitoring a range of addresses. The optimized state may be either a light-weight power/performance optimized state or an improved power/performance optimized state.
TPAUSE instructs the processor to enter an implementation-dependent optimized state c0.1 or c0.2 state and wake up when time-stamp counter reaches specified timeout.
Quoted 8 lines
The bit definition:
CPUID.(EAX=7,ECX=0):ECX[bit 05] WAITPKGThe release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdfSigned-off-by Jingqi Liu <[email protected]>Is it really OK to expose these features to the guest without "-overcommit cpu- pm=on"?
Quoted 6 lines
Don't we need code to migrate
IA32_UMWAIT_CONTROL?(I don't see code to handle writes to
IA32_UMWAIT_CONTROLon the KVM patches, either.)--
Hi Eduardo,
Yes, I'll handle IA32_UMWAIT_CONTROL in the second version. Thanks for your review.
Quoted 1 line
Eduardo
PATCH 2/3 x86/cpu: Enable MOVDIRI cpu feature
In reply to Jingqi LiuMOVDIRI moves doubleword or quadword from register to memory through direct store which is implemented by using write combining (WC) for writing data directly into memory without caching the data.
The bit definition:
CPUID.(EAX=7,ECX=0):ECX[bit 27] MOVDIRI
The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf
--- target/i386/cpu.c | 2 +- target/i386/cpu.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
target/i386/cpu.c +1 -1
@@ -983,7 +983,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {"avx512bitalg" ,NULL ,"avx512-vpopcntdq" ,NULL ,"la57" ,NULL ,NULL ,NULL ,NULL ,NULL ,"rdpid" ,NULL , -NULL ,"cldemote" ,NULL ,NULL , +NULL ,"cldemote" ,NULL ,"movdiri" , NULL, NULL, NULL, NULL, }, .cpuid_eax = 7,
target/i386/cpu.h +1 -0
@@ -685,6 +685,7 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];#define CPUID_7_0_ECX_LA57 (1U << 16)#define CPUID_7_0_ECX_RDPID (1U << 22)#define CPUID_7_0_ECX_CLDEMOTE (1U << 25)/* CLDEMOTE Instruction */ +#define CPUID_7_0_ECX_MOVDIRI (1U << 27)/* MOVDIRI Instruction */ #define CPUID_7_0_EDX_AVX512_4VNNIW (1U << 2)/* AVX512 Neural Network Instructions */ #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3)/* AVX512 Multiply Accumulation Single Precision */
Signature · 1 line
1.8.3.1
PATCH 3/3 x86/cpu: Enable MOVDIR64B cpu feature
In reply to Jingqi LiuMOVDIR64B moves 64-bytes as direct-store with 64-bytes write atomicity. Direct store is implemented by using write combining (WC) for writing data directly into memory without caching the data.
The bit definition:
CPUID.(EAX=7,ECX=0):ECX[bit 28] MOVDIR64B
The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf
--- target/i386/cpu.c | 2 +- target/i386/cpu.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
target/i386/cpu.c +1 -1
@@ -984,7 +984,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {"la57" ,NULL ,NULL ,NULL ,NULL ,NULL ,"rdpid" ,NULL ,NULL ,"cldemote" ,NULL ,"movdiri" , - NULL, NULL, NULL, NULL, + "movdir64b", NULL, NULL, NULL, }, .cpuid_eax =7 , .cpuid_needs_ecx = true, .cpuid_ecx = 0,
target/i386/cpu.h +1 -0
@@ -686,6 +686,7 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];#define CPUID_7_0_ECX_RDPID (1U << 22)#define CPUID_7_0_ECX_CLDEMOTE (1U << 25)/* CLDEMOTE Instruction */ #define CPUID_7_0_ECX_MOVDIRI (1U << 27)/* MOVDIRI Instruction */ +#define CPUID_7_0_ECX_MOVDIR64B (1U << 28)/* MOVDIR64B Instruction */ #define CPUID_7_0_EDX_AVX512_4VNNIW (1U << 2)/* AVX512 Neural Network Instructions */ #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3)/* AVX512 Multiply Accumulation Single Precision */
Signature · 1 line
1.8.3.1
Quoted 7 lines · Jingqi Liu
Enable a few new cpu features including UMONITOR, UMWAIT, TPAUSE, MOVDIRI and MOVDIR64B.
UMONITOR, UMWAIT, and TPAUSE are a set of user wait instructions. MOVDIRI moves doubleword or quadword from register to memory through direct store.
MOVDIR64B moves 64-bytes as direct-store with 64-bytes write atomicity.
Do you have corresponding KVM changes?
Paolo
Quoted 18 lines
The bits definition:
CPUID.(EAX=7,ECX=0):ECX[bit 05] WAITPKG
CPUID.(EAX=7,ECX=0):ECX[bit 27] MOVDIRI
CPUID.(EAX=7,ECX=0):ECX[bit 28] MOVDIR64BThe release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdfJingqi Liu (3):
x86/cpu: Enable UMONITOR/UMWAIT/TPAUSE cpu features x86/cpu: Enable MOVDIRI cpu feature x86/cpu: Enable MOVDIR64B cpu featuretarget/i386/cpu.c | 6 +++--- target/i386/cpu.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-)
Quoted 9 lines · Paolo Bonzini
Quoted 7 lines · Jingqi Liu
Enable a few new cpu features including UMONITOR, UMWAIT, TPAUSE, MOVDIRI and MOVDIR64B.
UMONITOR, UMWAIT, and TPAUSE are a set of user wait instructions. MOVDIRI moves doubleword or quadword from register to memory through direct store.
MOVDIR64B moves 64-bytes as direct-store with 64-bytes write atomicity.Do you have corresponding KVM changes?
Yes, the corresponding links are listed as below.
https://www.spinics.net/lists/kvm/msg171563.html
https://www.spinics.net/lists/kernel/msg2850965.html
The patches had been sent for your review also.
Thanks
Jingqi Liu
Quoted 21 lines
Paolo
Quoted 18 lines
The bits definition:
CPUID.(EAX=7,ECX=0):ECX[bit 05] WAITPKG
CPUID.(EAX=7,ECX=0):ECX[bit 27] MOVDIRI
CPUID.(EAX=7,ECX=0):ECX[bit 28] MOVDIR64BThe release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdfJingqi Liu (3):
x86/cpu: Enable UMONITOR/UMWAIT/TPAUSE cpu features x86/cpu: Enable MOVDIRI cpu feature x86/cpu: Enable MOVDIR64B cpu featuretarget/i386/cpu.c | 6 +++--- target/i386/cpu.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-)
Hi Paolo & Eduardo,
Do you have any comments for the series ?
Thanks
Quoted 30 lines · Paolo Bonzini
Quoted 7 lines · Jingqi Liu
Enable a few new cpu features including UMONITOR, UMWAIT, TPAUSE, MOVDIRI and MOVDIR64B.
UMONITOR, UMWAIT, and TPAUSE are a set of user wait instructions. MOVDIRI moves doubleword or quadword from register to memory through direct store.
MOVDIR64B moves 64-bytes as direct-store with 64-bytes write atomicity.Do you have corresponding KVM changes?
Paolo
Quoted 18 lines
The bits definition:
CPUID.(EAX=7,ECX=0):ECX[bit 05] WAITPKG
CPUID.(EAX=7,ECX=0):ECX[bit 27] MOVDIRI
CPUID.(EAX=7,ECX=0):ECX[bit 28] MOVDIR64BThe release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdfJingqi Liu (3):
x86/cpu: Enable UMONITOR/UMWAIT/TPAUSE cpu features x86/cpu: Enable MOVDIRI cpu feature x86/cpu: Enable MOVDIR64B cpu featuretarget/i386/cpu.c | 6 +++--- target/i386/cpu.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-)
Quoted 5 lines · Jingqi
Hi Paolo & Eduardo,
Do you have any comments for the series ?
Thanks
Hi,
QEMU is currently in feature freeze. We will look at the series soon after QEMU 3.0 is released.
Paolo