From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2 1/5] KVM: Add APIs for unlocked TLB flush Date: Thu, 17 May 2012 14:51:51 +0300 Message-ID: <4FB4E657.1000506@redhat.com> References: <1337250284-18607-1-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit To: Marcelo Tosatti , Xiao Guangrong , Takuya Yoshikawa , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:37575 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752692Ab2EQLwA (ORCPT ); Thu, 17 May 2012 07:52:00 -0400 In-Reply-To: <1337250284-18607-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/17/2012 01:24 PM, Avi Kivity wrote: > Currently we flush the TLB while holding mmu_lock. This > increases the lock hold time by the IPI round-trip time, increasing > contention, and makes dropping the lock (for latency reasons) harder. > > This patch changes TLB management to be usable locklessly, introducing > the following APIs: > > kvm_mark_tlb_dirty() - mark the TLB as containing stale entries > kvm_cond_flush_remote_tlbs() - flush the TLB if it was marked as > dirty > > These APIs can be used without holding mmu_lock (though if the TLB > became stale due to shadow page table modifications, typically it > will need to be called with the lock held to prevent other threads > from seeing the modified page tables with the TLB unmarked and unflushed)/ > Oops, forgot the cover letter and the changelog. I'm experimenting with posting directly from git send-email. The change is the new patch 2 which tries to ensure we never bypass a tlb flush. Perhaps a better way to do it is to move the kvm_cond_flush_remote_tlbs() _before_ the code that depends on them, instead of after the code that changes the spte. Please review carefully. -- error compiling committee.c: too many arguments to function