2018-11-06 06:01:59

by Jingqi Liu

[permalink] [raw]
Subject: [PATCH v2 0/2] KVM: x86: expose direct stores instructions into VM.

Direct stores instructions MOVDIRI and MOVDIR64B will be available in
Tremont and other future x86 processors,
and need to be exposed to guest VM.

The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf

This series expose movdiri and movdir64b features to guest VM.

Changelog:
v2:
Separated from the series https://lkml.org/lkml/2018/7/10/160
since umonitor/umwait/tpause instructions patches are not ready yet.
v1:
Sent out with umonitor/umwait/tpause instructions patches.

Liu Jingqi (2):
KVM: x86: expose MOVDIRI CPU feature into VM.
KVM: x86: expose MOVDIR64B CPU feature into VM.

arch/x86/kvm/cpuid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--
2.7.4



2018-11-06 06:02:16

by Jingqi Liu

[permalink] [raw]
Subject: [PATCH v2 2/2] KVM: x86: expose MOVDIR64B CPU feature into VM.

MOVDIR64B 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.

Availability of the MOVDIR64B instruction is indicated by the presence
of the CPUID feature flag MOVDIR64B (CPUID.0x07.0x0:ECX[bit 28]).

This patch exposes the movdir64b feature to the guest.

The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf

Signed-off-by: Liu Jingqi <[email protected]>
Cc: Xu Tao <[email protected]>
---
arch/x86/kvm/cpuid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index cbfeaa7..721893a 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -406,7 +406,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ |
F(AVX512_VPOPCNTDQ) | F(UMIP) | F(AVX512_VBMI2) | F(GFNI) |
F(VAES) | F(VPCLMULQDQ) | F(AVX512_VNNI) | F(AVX512_BITALG) |
- F(CLDEMOTE) | F(MOVDIRI);
+ F(CLDEMOTE) | F(MOVDIRI) | F(MOVDIR64B);

/* cpuid 7.0.edx*/
const u32 kvm_cpuid_7_0_edx_x86_features =
--
2.7.4


2018-11-06 06:02:21

by Jingqi Liu

[permalink] [raw]
Subject: [PATCH v2 1/2] KVM: x86: expose MOVDIRI CPU feature into VM.

MOVDIRI 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.

Availability of the MOVDIRI instruction is indicated by the presence of
the CPUID feature flag MOVDIRI(CPUID.0x07.0x0:ECX[bit 27]).

This patch exposes the movdiri feature to the guest.

The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf

Signed-off-by: Liu Jingqi <[email protected]>
Cc: Xu Tao <[email protected]>
---
arch/x86/kvm/cpuid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 7bcfa61..cbfeaa7 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -406,7 +406,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ |
F(AVX512_VPOPCNTDQ) | F(UMIP) | F(AVX512_VBMI2) | F(GFNI) |
F(VAES) | F(VPCLMULQDQ) | F(AVX512_VNNI) | F(AVX512_BITALG) |
- F(CLDEMOTE);
+ F(CLDEMOTE) | F(MOVDIRI);

/* cpuid 7.0.edx*/
const u32 kvm_cpuid_7_0_edx_x86_features =
--
2.7.4


2018-11-29 10:15:58

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] KVM: x86: expose direct stores instructions into VM.

On 06.11.18 06:55, Liu Jingqi wrote:
> Direct stores instructions MOVDIRI and MOVDIR64B will be available in
> Tremont and other future x86 processors,
> and need to be exposed to guest VM.
>
> The release document ref below link:
> https://software.intel.com/sites/default/files/managed/c5/15/\
> architecture-instruction-set-extensions-programming-reference.pdf
>
> This series expose movdiri and movdir64b features to guest VM.
>
> Changelog:
> v2:
> Separated from the series https://lkml.org/lkml/2018/7/10/160
> since umonitor/umwait/tpause instructions patches are not ready yet.
> v1:
> Sent out with umonitor/umwait/tpause instructions patches.
>
> Liu Jingqi (2):
> KVM: x86: expose MOVDIRI CPU feature into VM.
> KVM: x86: expose MOVDIR64B CPU feature into VM.
>
> arch/x86/kvm/cpuid.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Does it make sense to squash both patches? (into a patch named just like
this cover letter? :) )

--

Thanks,

David / dhildenb

2018-11-30 20:42:57

by Eric Northup

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] KVM: x86: expose direct stores instructions into VM.

On Mon, Nov 5, 2018 at 10:01 PM Liu Jingqi <[email protected]> wrote:
>
> Direct stores instructions MOVDIRI and MOVDIR64B will be available in
> Tremont and other future x86 processors,
> and need to be exposed to guest VM.

It seems like KVM's emulator should be able to complete these
instructions to emulated MMIO before exposing CPUID to guests in any
default or supported configurations.

It'll be much simpler for usermode to implement that property if the
KVM-reported supported CPUID table doesn't get updated before the KVM
emulator does.

-Eric

2019-01-30 17:17:22

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] KVM: x86: expose direct stores instructions into VM.

On 30/11/18 21:41, Eric Northup wrote:
> On Mon, Nov 5, 2018 at 10:01 PM Liu Jingqi <[email protected]> wrote:
>>
>> Direct stores instructions MOVDIRI and MOVDIR64B will be available in
>> Tremont and other future x86 processors,
>> and need to be exposed to guest VM.
>
> It seems like KVM's emulator should be able to complete these
> instructions to emulated MMIO before exposing CPUID to guests in any
> default or supported configurations.
>
> It'll be much simpler for usermode to implement that property if the
> KVM-reported supported CPUID table doesn't get updated before the KVM
> emulator does.

We already do not support emulation for many CPUID bits we expose (AVX
and AVX512 above all), so that's not a huge problem.

I suppose these instructions are unlikely to be used on MMIO areas such
as legacy VGA VRAM.

Paolo

2019-01-30 17:19:15

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] KVM: x86: expose direct stores instructions into VM.

On 06/11/18 06:55, Liu Jingqi wrote:
> Direct stores instructions MOVDIRI and MOVDIR64B will be available in
> Tremont and other future x86 processors,
> and need to be exposed to guest VM.
>
> The release document ref below link:
> https://software.intel.com/sites/default/files/managed/c5/15/\
> architecture-instruction-set-extensions-programming-reference.pdf
>
> This series expose movdiri and movdir64b features to guest VM.
>
> Changelog:
> v2:
> Separated from the series https://lkml.org/lkml/2018/7/10/160
> since umonitor/umwait/tpause instructions patches are not ready yet.
> v1:
> Sent out with umonitor/umwait/tpause instructions patches.
>
> Liu Jingqi (2):
> KVM: x86: expose MOVDIRI CPU feature into VM.
> KVM: x86: expose MOVDIR64B CPU feature into VM.
>
> arch/x86/kvm/cpuid.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Queued, thanks.

Paolo