From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takuya Yoshikawa Subject: Re: [patch 3/3] KVM: move postcommit flush to x86, as mmio sptes are x86 specific Date: Mon, 27 Aug 2012 23:41:08 +0900 Message-ID: <20120827234108.6f4417e2922e42ef461135c6@gmail.com> References: <20120824185456.658814016@amt.cnet> <20120824185634.625676530@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Paul Mackerras , Avi Kivity , Xiao Guangrong , kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mail-pz0-f46.google.com ([209.85.210.46]:40037 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753010Ab2H0OlN (ORCPT ); Mon, 27 Aug 2012 10:41:13 -0400 Received: by dady13 with SMTP id y13so2587046dad.19 for ; Mon, 27 Aug 2012 07:41:12 -0700 (PDT) In-Reply-To: <20120824185634.625676530@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, 24 Aug 2012 15:54:59 -0300 Marcelo Tosatti wrote: > Other arches do not need this. > > Signed-off-by: Marcelo Tosatti > > Index: kvm/arch/x86/kvm/x86.c > =================================================================== > --- kvm.orig/arch/x86/kvm/x86.c > +++ kvm/arch/x86/kvm/x86.c > @@ -6455,6 +6455,14 @@ void kvm_arch_commit_memory_region(struc > kvm_mmu_change_mmu_pages(kvm, nr_mmu_pages); > kvm_mmu_slot_remove_write_access(kvm, mem->slot); > spin_unlock(&kvm->mmu_lock); > + /* > + * If the new memory slot is created, we need to clear all > + * mmio sptes. > + */ > + if (old.npages == 0 && npages) { > + kvm_mmu_zap_all(kvm); > + kvm_reload_remote_mmus(kvm); > + } > } Any explanation why (old.base_gfn != new.base_gfn) case can be omitted? Takuya > > void kvm_arch_flush_shadow_all(struct kvm *kvm) > Index: kvm/virt/kvm/kvm_main.c > =================================================================== > --- kvm.orig/virt/kvm/kvm_main.c > +++ kvm/virt/kvm/kvm_main.c > @@ -849,13 +849,6 @@ int __kvm_set_memory_region(struct kvm * > > kvm_arch_commit_memory_region(kvm, mem, old, user_alloc); > > - /* > - * If the new memory slot is created, we need to clear all > - * mmio sptes. > - */ > - if (npages && old.base_gfn != mem->guest_phys_addr >> PAGE_SHIFT) > - kvm_arch_flush_shadow_all(kvm); > - > kvm_free_physmem_slot(&old, &new); > kfree(old_memslots);