From: Takuya Yoshikawa Subject: Re: [PATCH 2/4] KVM: Avoid checking huge page mappings in get_dirty_log() Date: Wed, 14 Mar 2012 14:34:32 +0900 Message-ID: <20120314143432.c982e893.yoshikawa.takuya@oss.ntt.co.jp> References: <20120301193007.04b2db8e.yoshikawa.takuya@oss.ntt.co.jp> <20120301193216.b14538bb.yoshikawa.takuya@oss.ntt.co.jp> <20120313230412.GA12153@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: avi@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from serv2.oss.ntt.co.jp ([222.151.198.100]:44801 "EHLO serv2.oss.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755328Ab2CNF2H (ORCPT ); Wed, 14 Mar 2012 01:28:07 -0400 In-Reply-To: <20120313230412.GA12153@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: Marcelo Tosatti wrote: > guest fault enable dirty logging > > tdp_page_fault (all _page_fault functions) kvm_set_memory_region > > > level = mapping_level(vcpu, gfn) > (finds level == 2 or 3) > > > rcu_assign_pointer(slot > with > ->dirty_bitmap) > synchronize_srcu_expedited() Isn't here still in the SRCU read-side critical section? > schedule() > kvm_arch_commit_memory_region() > spin_lock(mmu_lock) > kvm_mmu_slot_remove_write_access() > removes large sptes > spin_unlock(mmu_lock) > spin_lock(mmu_lock) > create large spte accordingly > to level above > spin_unlock(mmu_lock) > If so, we cannot start kvm_arch_commit_memory_region() until the completion of the SRCU critical section and this race will not happen. Takuya