From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH v3 07/15] KVM: MMU: introduce nulls desc Date: Tue, 26 Nov 2013 11:02:34 +0800 Message-ID: <52940F4A.4040701@linux.vnet.ibm.com> References: <1382534973-13197-1-git-send-email-xiaoguangrong@linux.vnet.ibm.com> <1382534973-13197-8-git-send-email-xiaoguangrong@linux.vnet.ibm.com> <20131122191429.GA13308@amt.cnet> <65EE805B-B5DB-4BD0-A057-E5FF78D96D67@linux.vnet.ibm.com> <20131125140803.GA1489@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Gleb Natapov , avi.kivity@gmail.com, "pbonzini@redhat.com Bonzini" , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Eric Dumazet , Peter Zijlstra To: Marcelo Tosatti Return-path: Received: from e23smtp06.au.ibm.com ([202.81.31.148]:38733 "EHLO e23smtp06.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752720Ab3KZDCt (ORCPT ); Mon, 25 Nov 2013 22:02:49 -0500 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 26 Nov 2013 13:02:47 +1000 In-Reply-To: <20131125140803.GA1489@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 11/25/2013 10:08 PM, Marcelo Tosatti wrote: > On Mon, Nov 25, 2013 at 02:11:31PM +0800, Xiao Guangrong wrote: >> >> On Nov 23, 2013, at 3:14 AM, Marcelo Tosatti w= rote: >> >>> On Wed, Oct 23, 2013 at 09:29:25PM +0800, Xiao Guangrong wrote: >>>> It likes nulls list and we use the pte-list as the nulls which can= help us to >>>> detect whether the "desc" is moved to anther rmap then we can re-w= alk the rmap >>>> if that happened >>>> >>>> kvm->slots_lock is held when we do lockless walking that prevents = rmap >>>> is reused (free rmap need to hold that lock) so that we can not se= e the same >>>> nulls used on different rmaps >>>> >>>> Signed-off-by: Xiao Guangrong >>> >>> How about simplified lockless walk on the slot while rmapp entry >>> contains a single spte? (which should be the case with two-dimensio= nal >>> paging). >>> >>> That is, grab the lock when finding a rmap with more than one spte = in >>> it (and then keep it locked until the end). >> >> Hmm=E2=80=A6 that isn't straightforward and more complex than the ap= proach >> in this patchset. Also it can drop the improvement for shadow mmu th= at >> gets great improvement by this patchset. >=20 > It is not more complex, since it would remove list lockless walk. Onl= y > the spte pointer at rmap[spte] is accessed without a lock. Its much m= uch > simpler. >=20 >>> For example, nothing prevents lockless walker to move into some >>> parent_ptes chain, right? >> >> No. >> >> The nulls can help us to detect this case, for parent_ptes, the null= s points >> to "shadow page" but for rmaps, the nulls points to slot.arch.rmap. = There >> is no chance that the =E2=80=9Crmap" is used as shadow page when slo= t-lock is held. >=20 > The SLAB cache is the same, so entries can be reused. What prevents > a desc entry living in slot.arch.rmap to be freed and reused by a > parent_ptes desc? >=20 We will check is_last_spte(), all the sptes on parent_ptes should be fa= iled. And Gleb suggested to use a separate slab for rmap, that should be exce= llent.