From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2] KVM: MMU: Don't use RCU for lockless shadow walking Date: Sun, 29 Apr 2012 12:35:15 +0300 Message-ID: <4F9D0B53.60605@redhat.com> References: <1335260845-16271-1-git-send-email-avi@redhat.com> <20120426220000.GA30343@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 To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:2504 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753150Ab2D2JfT (ORCPT ); Sun, 29 Apr 2012 05:35:19 -0400 In-Reply-To: <20120426220000.GA30343@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 04/27/2012 01:00 AM, Marcelo Tosatti wrote: > > > > static void walk_shadow_page_lockless_end(struct kvm_vcpu *vcpu) > > { > > - /* Decrease the counter after walking shadow page table finished */ > > - smp_mb__before_atomic_dec(); > > - atomic_dec(&vcpu->kvm->arch.reader_counter); > > - rcu_read_unlock(); > > + /* > > + * Make our reads and writes to shadow page tables globally visible > > + * before leaving READING_SHADOW_PAGE_TABLES mode. > > + */ > > This comment is misleading. Writes to shadow page tables must be > performed with locked instructions outside the mmu_lock. You are correct with respect to writes. I guess reads are immaterial because they will be either protected by a write, or discarded. -- error compiling committee.c: too many arguments to function