diff options
author | Radim Krčmář <rkrcmar@redhat.com> | 2014-08-21 12:08:07 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-08-21 12:45:22 -0400 |
commit | a7653ecdf34c68a1af4fc085511afcf7ff011903 (patch) | |
tree | ad43fa8126a82ebb2ca6e37ddc240dccffa99262 | |
parent | ae97a3b818324b92b5b9cc885c63c3f4bd46ee9d (diff) |
KVM: VMX: make PLE window per-VCPU
Change PLE window into per-VCPU variable, seeded from module parameter,
to allow greater flexibility.
Brings in a small overhead on every vmentry.
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/kvm/vmx.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 7c26533e149c..70175990536b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -484,6 +484,10 @@ struct vcpu_vmx { | |||
484 | 484 | ||
485 | /* Support for a guest hypervisor (nested VMX) */ | 485 | /* Support for a guest hypervisor (nested VMX) */ |
486 | struct nested_vmx nested; | 486 | struct nested_vmx nested; |
487 | |||
488 | /* Dynamic PLE window. */ | ||
489 | int ple_window; | ||
490 | bool ple_window_dirty; | ||
487 | }; | 491 | }; |
488 | 492 | ||
489 | enum segment_cache_field { | 493 | enum segment_cache_field { |
@@ -4402,7 +4406,8 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx) | |||
4402 | 4406 | ||
4403 | if (ple_gap) { | 4407 | if (ple_gap) { |
4404 | vmcs_write32(PLE_GAP, ple_gap); | 4408 | vmcs_write32(PLE_GAP, ple_gap); |
4405 | vmcs_write32(PLE_WINDOW, ple_window); | 4409 | vmx->ple_window = ple_window; |
4410 | vmx->ple_window_dirty = true; | ||
4406 | } | 4411 | } |
4407 | 4412 | ||
4408 | vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, 0); | 4413 | vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, 0); |
@@ -7389,6 +7394,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) | |||
7389 | if (vmx->emulation_required) | 7394 | if (vmx->emulation_required) |
7390 | return; | 7395 | return; |
7391 | 7396 | ||
7397 | if (vmx->ple_window_dirty) { | ||
7398 | vmx->ple_window_dirty = false; | ||
7399 | vmcs_write32(PLE_WINDOW, vmx->ple_window); | ||
7400 | } | ||
7401 | |||
7392 | if (vmx->nested.sync_shadow_vmcs) { | 7402 | if (vmx->nested.sync_shadow_vmcs) { |
7393 | copy_vmcs12_to_shadow(vmx); | 7403 | copy_vmcs12_to_shadow(vmx); |
7394 | vmx->nested.sync_shadow_vmcs = false; | 7404 | vmx->nested.sync_shadow_vmcs = false; |