From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 3/9] KVM: VMX: make PLE window per-vcpu Date: Wed, 20 Aug 2014 09:13:49 +0200 Message-ID: <53F44AAD.5020203@redhat.com> References: <1408480536-8240-1-git-send-email-rkrcmar@redhat.com> <1408480536-8240-4-git-send-email-rkrcmar@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, Gleb Natapov , Raghavendra KT , Vinod Chegu , Hui-Zhi To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , kvm@vger.kernel.org Return-path: In-Reply-To: <1408480536-8240-4-git-send-email-rkrcmar@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Il 19/08/2014 22:35, Radim Kr=C4=8Dm=C3=A1=C5=99 ha scritto: > Change PLE window into per-vcpu variable, seeded from module paramete= r, > to allow greater flexibility. >=20 > Brings in a small overhead on every vmentry. >=20 > Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 > --- > I've been thinking about a general hierarchical per-vcpu variable mo= del, > but it's hard to have current performance and sane code. >=20 > arch/x86/kvm/vmx.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 2b306f9..eaa5574 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -484,6 +484,9 @@ struct vcpu_vmx { > =20 > /* Support for a guest hypervisor (nested VMX) */ > struct nested_vmx nested; > + > + /* Dynamic PLE window. */ > + int ple_window; > }; > =20 > enum segment_cache_field { > @@ -4403,6 +4406,7 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx) > if (ple_gap) { > vmcs_write32(PLE_GAP, ple_gap); > vmcs_write32(PLE_WINDOW, ple_window); Is this necessary? > + vmx->ple_window =3D ple_window; > } > =20 > vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, 0); > @@ -7387,6 +7391,9 @@ static void __noclone vmx_vcpu_run(struct kvm_v= cpu *vcpu) > if (vmx->emulation_required) > return; > =20 > + if (ple_gap) > + vmcs_write32(PLE_WINDOW, vmx->ple_window); > + > if (vmx->nested.sync_shadow_vmcs) { > copy_vmcs12_to_shadow(vmx); > vmx->nested.sync_shadow_vmcs =3D false; >=20