From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/4] KVM: Add APIs for unlocked TLB flush Date: Mon, 21 May 2012 17:45:53 +0300 Message-ID: <4FBA5521.4090503@redhat.com> References: <1336044182-12023-1-git-send-email-avi@redhat.com> <1336044182-12023-2-git-send-email-avi@redhat.com> <4FA286BD.2020009@linux.vnet.ibm.com> <4FA291F5.4090408@redhat.com> <20120508022513.GA26114@amt.cnet> <4FA9140F.6080601@redhat.com> <20120509210314.GB26778@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Xiao Guangrong , kvm@vger.kernel.org, takuya.yoshikawa@gmail.com To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:6715 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753870Ab2EUOqB (ORCPT ); Mon, 21 May 2012 10:46:01 -0400 In-Reply-To: <20120509210314.GB26778@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 05/10/2012 12:03 AM, Marcelo Tosatti wrote: > > > > > It has the advantage that it requires code to explicitly document where > > > the TLB must be flushed and the sites which expect sptes to be in sync > > > with TLBs. > > > > I'm looking for an idea of how to make the flush in those cases not hold > > mmu_lock. > > You can't easily for rmap_write_protect, must check that the state is > unchanged (write protect operation is still relevant). We could simply call it in a loop: while rmap_write_protect() == SOME_SPTES_CHANGED: mark tlbs dirty drop lock flush remote tlbs take lock with some backoff to prevent livelock. It looks scary but usually the pte list is short, and the second loop is fast since everything has been brought into the cache. > Current patchset (with corrections to comments by Xiao) is good enough > already IMO. Please review the new version then. -- error compiling committee.c: too many arguments to function