Re: [PATCH v2 1/3] KVM: x86: add support for user wait instructions

2019-05-28 Thread Tao Xu
On 5/29/2019 10:38 AM, Paolo Bonzini wrote: On 29/05/19 04:05, Tao Xu wrote: Thank you Paolo, but I have another question. I was wondering if it is appropriate to enable X86_FEATURE_WAITPKG when QEMU uses "-overcommit cpu-pm=on"? "-overcommit" only establishes the

Re: [PATCH v2 3/3] KVM: vmx: handle vm-exit for UMWAIT and TPAUSE

2019-05-28 Thread Tao Xu
On 29/05/2019 09:28, Paolo Bonzini wrote: On 24/05/19 09:56, Tao Xu wrote: As the latest Intel 64 and IA-32 Architectures Software Developer's Manual, UMWAIT and TPAUSE instructions cause a VM exit if the “RDTSC exiting” and “enable user wait and pause” VM-execution controls are both 1.

Re: [PATCH v2 1/3] KVM: x86: add support for user wait instructions

2019-05-28 Thread Tao Xu
On 29/05/2019 09:24, Paolo Bonzini wrote: On 24/05/19 09:56, Tao Xu wrote: +7.19 KVM_CAP_ENABLE_USR_WAIT_PAUSE + +Architectures: x86 +Parameters: args[0] whether feature should be enabled or not + +With this capability enabled, a VM can use UMONITOR, UMWAIT and TPAUSE +instructions. If the

Re: [PATCH v2 2/3] KVM: vmx: Emulate MSR IA32_UMWAIT_CONTROL

2019-05-28 Thread Tao Xu
On 29/05/2019 09:29, Paolo Bonzini wrote: On 24/05/19 09:56, Tao Xu wrote: + + if (rdmsrl_safe(MSR_IA32_UMWAIT_CONTROL, &host_umwait_control)) + return; + Does the host value ever change? If not, this can perhaps be read once when kvm_intel is loaded. And if it cha

Re: [PATCH v2 1/3] KVM: x86: add support for user wait instructions

2019-05-28 Thread Tao Xu
On 28/05/2019 14:11, Wanpeng Li wrote: On Tue, 28 May 2019 at 13:16, Tao Xu wrote: On 27/05/2019 18:30, Peter Zijlstra wrote: On Fri, May 24, 2019 at 03:56:35PM +0800, Tao Xu wrote: This patch adds support for UMONITOR, UMWAIT and TPAUSE instructions in kvm, and by default dont't e

Re: [PATCH v2 1/3] KVM: x86: add support for user wait instructions

2019-05-27 Thread Tao Xu
On 27/05/2019 18:30, Peter Zijlstra wrote: On Fri, May 24, 2019 at 03:56:35PM +0800, Tao Xu wrote: This patch adds support for UMONITOR, UMWAIT and TPAUSE instructions in kvm, and by default dont't expose it to kvm and provide a capability to enable it. I'm thinking this

[PATCH v2 1/3] KVM: x86: add support for user wait instructions

2019-05-24 Thread Tao Xu
This patch adds support for UMONITOR, UMWAIT and TPAUSE instructions in kvm, and by default dont't expose it to kvm and provide a capability to enable it. Co-developed-by: Jingqi Liu Signed-off-by: Jingqi Liu Signed-off-by: Tao Xu --- Documentation/virtual/kvm/api.txt | 12

[PATCH v2 3/3] KVM: vmx: handle vm-exit for UMWAIT and TPAUSE

2019-05-24 Thread Tao Xu
. Co-developed-by: Jingqi Liu Signed-off-by: Jingqi Liu Signed-off-by: Tao Xu --- arch/x86/include/uapi/asm/vmx.h | 6 +- arch/x86/kvm/vmx/vmx.c | 16 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/uapi/asm/vmx.h b/arch/x86/include/uap

[PATCH v2 0/3] KVM: x86: Enable user wait instructions

2019-05-24 Thread Tao Xu
NITOR, UMWAIT and TPAUSE v1: Sent out with MOVDIRI/MOVDIR64B instructions patches Tao Xu (3): KVM: x86: add support for user wait instructions KVM: vmx: Emulate MSR IA32_UMWAIT_CONTROL KVM: vmx: handle vm-exit for UMWAIT and TPAUSE Documentation/virtual/kvm/api.txt | 12 ++ arc

[PATCH v2 2/3] KVM: vmx: Emulate MSR IA32_UMWAIT_CONTROL

2019-05-24 Thread Tao Xu
-by: Jingqi Liu Signed-off-by: Jingqi Liu Signed-off-by: Tao Xu --- arch/x86/kvm/vmx/vmx.c | 42 ++ arch/x86/kvm/vmx/vmx.h | 1 + arch/x86/kvm/x86.c | 1 + 3 files changed, 44 insertions(+) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx