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: Tue, 08 May 2012 12:09:38 +0300 Message-ID: <4FA8E2D2.6000600@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> <4FA77464.4080300@linux.vnet.ibm.com> <4FA780C8.5050900@redhat.com> <20120508015515.GA26590@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]:23795 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751395Ab2EHJJo (ORCPT ); Tue, 8 May 2012 05:09:44 -0400 In-Reply-To: <20120508015515.GA26590@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 05/08/2012 04:55 AM, Marcelo Tosatti wrote: > > > Yes, so, we can change kvm_mark_tlb_dirty to: > > > > > > +static inline void kvm_mark_tlb_dirty(struct kvm *kvm) > > > +{ > > > + /* > > > + * Make any changes to the page tables visible to remote flushers. > > > + */ > > > + smb_mb(); > > > + kvm->tlb_state.dirtied_count++; > > > +} > > > > > > > Yes. We'll have to change it again if we ever dirty sptes outside the > > lock, but that's okay. > > Please don't. There are readers outside mmu_lock, so it should be > atomic. Why does it need to be atomic? All it needs is to be properly barriered (provided by spin_unlock(mmu_lock). -- error compiling committee.c: too many arguments to function