2017-07-27 10:20-0700, David Matlack: > On Thu, Jul 27, 2017 at 6:54 AM, Paolo Bonzini <pbonzini@xxxxxxxxxx> 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 <pbonzini@xxxxxxxxxx> > > --- > > 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.