From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752895AbdHBUg5 (ORCPT ); Wed, 2 Aug 2017 16:36:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54660 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752116AbdHBUg4 (ORCPT ); Wed, 2 Aug 2017 16:36:56 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E04DD5AFD9 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=rkrcmar@redhat.com Date: Wed, 2 Aug 2017 22:36:52 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: David Matlack Cc: Paolo Bonzini , "linux-kernel@vger.kernel.org" , kvm list , Jim Mattson Subject: Re: [PATCH] KVM: nVMX: do not pin the VMCS12 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 Content-Disposition: inline In-Reply-To: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 02 Aug 2017 20:36:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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.