From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging Date: Fri, 23 Dec 2011 09:14:51 -0200 Message-ID: <20111223111451.GD24308@amt.cnet> References: <20111114182041.43570cdf.yoshikawa.takuya@oss.ntt.co.jp> <20111114182334.f57fbeae.yoshikawa.takuya@oss.ntt.co.jp> <4EC0E85F.80004@redhat.com> <4EF00F2F.6080305@oss.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm@vger.kernel.org, takuya.yoshikawa@gmail.com To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:31876 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756672Ab1LWLin (ORCPT ); Fri, 23 Dec 2011 06:38:43 -0500 Content-Disposition: inline In-Reply-To: <4EF00F2F.6080305@oss.ntt.co.jp> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Dec 20, 2011 at 01:29:35PM +0900, Takuya Yoshikawa wrote: > (2011/11/14 19:07), Avi Kivity wrote: > >>@@ -1491,7 +1492,8 @@ void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot, > >> if (memslot&& memslot->dirty_bitmap) { > >> unsigned long rel_gfn = gfn - memslot->base_gfn; > >> > >>- __set_bit_le(rel_gfn, memslot->dirty_bitmap); > >>+ if (!__test_and_set_bit_le(rel_gfn, memslot->dirty_bitmap)) > >>+ memslot->nr_dirty_pages++; > >> } > >> } > >> > > [snip] > > >btw mark_page_dirty() itself seems to assume mmu_lock protection that > >doesn't exist. Marcelo? > > Not mmu_lock protection, kvm->srcu protection. > I want to hear the answer for this question. > > Though I myself is reading the code, I cannot understand it thoroughly yet. > I wish if there were mmu_lock entry in locking.txt ... Agreed.