From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC] need to improve slot creation/destruction? -- Re: [RFC][PATCH] srcu: Implement call_srcu() Date: Tue, 14 Feb 2012 11:52:20 +0200 Message-ID: <4F3A2ED4.3000104@redhat.com> References: <1328016724.2446.229.camel@twins> <4F27F0E6.1040309@redhat.com> <1328017807.2446.230.camel@twins> <20120131222447.GH2391@linux.vnet.ibm.com> <1328091749.2760.34.camel@laptop> <4F29178A.1090306@redhat.com> <4F2918D5.4050104@redhat.com> <20120201135020.GB18998@amt.cnet> <20120209004320.5772daa0472aef4700dab1b6@gmail.com> <4F33D6C9.2070403@redhat.com> <20120210222513.7a8919f2f73604ca25c58bbd@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: mtosatti@redhat.com, kvm@vger.kernel.org To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50824 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759690Ab2BNJwX (ORCPT ); Tue, 14 Feb 2012 04:52:23 -0500 In-Reply-To: <20120210222513.7a8919f2f73604ca25c58bbd@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 02/10/2012 03:25 PM, Takuya Yoshikawa wrote: > Avi Kivity wrote: > > > > 2. When we create(and shift?) a memory slot, we call kvm_arch_flush_shadow() > > > to clear all mmio sptes, again not restricted to that slot. > > > > > > /* > > > * 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(kvm); > > > > This is pretty rare outside the previous scenario (memory/pci hotplug). > > Is this condition correct? > > When npages != 0 and old.npages == 0, the slot is being newly created, do we > really need to flush shadow pages? > > This should be > if (npages && old.npages && (old.base_gfn != base_gfn)) > Your condition is more correct, but in practice there's no difference. If old.npages == 0, then old.base_gfn will be 0, and the condition will fail, except for the first slot created (when the shadow cache is empty anyway). -- error compiling committee.c: too many arguments to function