From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [patch 4/5] KVM: MMU: reload request from GET_DIRTY_LOG path Date: Thu, 19 Jun 2014 15:40:31 -0300 Message-ID: <20140619184031.GC32410@amt.cnet> References: <20140618231203.846608908@amt.cnet> <20140618231521.718959400@amt.cnet> <20140619081719.GD10948@minantech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, ak@linux.intel.com, pbonzini@redhat.com, xiaoguangrong@linux.vnet.ibm.com, avi@cloudius-systems.com To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:52959 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757463AbaFSTKb (ORCPT ); Thu, 19 Jun 2014 15:10:31 -0400 Content-Disposition: inline In-Reply-To: <20140619081719.GD10948@minantech.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Jun 19, 2014 at 11:17:19AM +0300, Gleb Natapov wrote: > On Wed, Jun 18, 2014 at 08:12:07PM -0300, mtosatti@redhat.com wrote: > > Reload remote vcpus MMU from GET_DIRTY_LOG codepath, before > > deleting a pinned spte. > > > > Signed-off-by: Marcelo Tosatti > > > > --- > > arch/x86/kvm/mmu.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > Index: kvm.pinned-sptes/arch/x86/kvm/mmu.c > > =================================================================== > > --- kvm.pinned-sptes.orig/arch/x86/kvm/mmu.c 2014-06-13 16:50:50.040140594 -0300 > > +++ kvm.pinned-sptes/arch/x86/kvm/mmu.c 2014-06-13 16:51:05.620104451 -0300 > > @@ -1247,6 +1247,9 @@ > > spte &= ~SPTE_MMU_WRITEABLE; > > spte = spte & ~PT_WRITABLE_MASK; > > > > + if (is_pinned_spte(spte)) > > + mmu_reload_pinned_vcpus(kvm); > > + > Why write protect it at all? mmu_reload_pinned_vcpus() will unprotected it anyway > on the next vmentry. Isn't it better to just report all pinned pages as dirty alway. That was the initial plan, however its awkward to stop vcpus, execute get_dirty_log twice, and have pages marked as dirty on the second execution. That is, it is in "incorrect" to report pages as dirty when they are clean. Moreover, if the number of pinned pages is larger than the dirty threshold to stop VM and migrate, you'll never migrate. If vcpus are in HLT and don't VM-enter immediately, the pages should not be refaulted right away. Do you think the optimization is worthwhile ?