Re: [PATCH] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-01 Thread Paolo Bonzini
Il 01/08/2014 02:57, Zhang, Yang Z ha scritto: TPR_THRESHOLD will be likely written as zero, but the processor will never use it anyway. It's just a small optimization because nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW) will almost always be true. Theoretically, you are right. But we

RE: [PATCH] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-01 Thread Zhang, Yang Z
Paolo Bonzini wrote on 2014-08-01: Il 01/08/2014 02:57, Zhang, Yang Z ha scritto: TPR_THRESHOLD will be likely written as zero, but the processor will never use it anyway. It's just a small optimization because nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW) will almost always be true.

Re: [PATCH] KVM: nVMX: nested TPR shadow/threshold emulation

2014-07-31 Thread Wanpeng Li
Hi Paolo, On Wed, Jul 30, 2014 at 05:20:58PM +0200, Paolo Bonzini wrote: Il 30/07/2014 14:04, Wanpeng Li ha scritto: @@ -7962,14 +7965,14 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) if (!vmx-rdtscp_enabled) exec_control =

Re: [PATCH] KVM: nVMX: nested TPR shadow/threshold emulation

2014-07-31 Thread Paolo Bonzini
Il 31/07/2014 10:03, Wanpeng Li ha scritto: One thing: + if (nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW)) + vmcs_write32(TPR_THRESHOLD, vmcs12-tpr_threshold); I think you can just do this write unconditionally, since most hypervisors will enable this. Also, you probably can

RE: [PATCH] KVM: nVMX: nested TPR shadow/threshold emulation

2014-07-31 Thread Zhang, Yang Z
Paolo Bonzini wrote on 2014-07-31: Il 31/07/2014 10:03, Wanpeng Li ha scritto: One thing: + if (nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW)) + vmcs_write32(TPR_THRESHOLD, vmcs12-tpr_threshold); I think you can just do this write unconditionally, since most hypervisors will

[PATCH] KVM: nVMX: nested TPR shadow/threshold emulation

2014-07-30 Thread Wanpeng Li
This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=61411 TPR shadow/threshold feature is important to speed up the Windows guest. Besides, it is a must feature for certain VMM. We map virtual APIC page address and TPR threshold from L1 VMCS. If TPR_BELOW_THRESHOLD VM exit is

Re: [PATCH] KVM: nVMX: nested TPR shadow/threshold emulation

2014-07-30 Thread Paolo Bonzini
Il 30/07/2014 14:04, Wanpeng Li ha scritto: @@ -7962,14 +7965,14 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) if (!vmx-rdtscp_enabled) exec_control = ~SECONDARY_EXEC_RDTSCP; /* Take the following fields only