From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH] KVM: nVMX: do not pin the VMCS12 Date: Wed, 2 Aug 2017 22:36:52 +0200 Message-ID: <20170802203652.GD32403@flask> References: <1501163686-13648-1-git-send-email-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Paolo Bonzini , "linux-kernel@vger.kernel.org" , kvm list , Jim Mattson To: David Matlack Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 2017-07-27 10:20-0700, David Matlack: > On Thu, Jul 27, 2017 at 6:54 AM, Paolo Bonzini wrote: > > Since the current implementation of VMCS12 does a memcpy in and out > > of guest memory, we do not need current_vmcs12 and current_vmcs12_page > > anymore. current_vmptr is enough to read and write the VMCS12. > > This patch also fixes dirty tracking (memslot->dirty_bitmap) of the > VMCS12 page by using kvm_write_guest. nested_release_page() only marks > the struct page dirty. > > > > > Signed-off-by: Paolo Bonzini > > --- > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > > @@ -7623,14 +7614,13 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu) > > } > > > > nested_release_vmcs12(vmx); > > - vmx->nested.current_vmcs12 = new_vmcs12; > > - vmx->nested.current_vmcs12_page = page; > > /* > > * Load VMCS12 from guest memory since it is not already > > * cached. > > */ > > - memcpy(vmx->nested.cached_vmcs12, > > - vmx->nested.current_vmcs12, VMCS12_SIZE); > > + memcpy(vmx->nested.cached_vmcs12, new_vmcs12, VMCS12_SIZE); > > + kunmap(page); > > + nested_release_page_clean(page); Added this and your note about the dirty bit when applying, thanks.