From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takuya Yoshikawa Subject: Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging Date: Wed, 28 Dec 2011 00:03:22 +0900 Message-ID: <20111228000322.33585bc7450433775326292e@gmail.com> 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> <20111223111451.GD24308@amt.cnet> <20111224115251.2aaa9549cb0a98de79f7d918@gmail.com> <20111227135017.GB23270@amt.cnet> <4EF9D024.8050908@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , Takuya Yoshikawa , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mail-iy0-f174.google.com ([209.85.210.174]:50667 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754445Ab1L0PD1 (ORCPT ); Tue, 27 Dec 2011 10:03:27 -0500 Received: by iaeh11 with SMTP id h11so20505462iae.19 for ; Tue, 27 Dec 2011 07:03:26 -0800 (PST) In-Reply-To: <4EF9D024.8050908@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > > It should not be necessary, atomicity of updates to > > memslot->dirty_bitmap, because of RCU updates to the memslot pointer > > (note memslot = gfn_to_memslot(kvm, gfn); in mark_page_dirty). > > > > The order is: > > > > - update page data. > > - grab memslot pointer. > > - set page bit in memslot. > > > > What if both grab the same memslot pointer, but set different bits? (Sorry for my bad wording, that is what I wanted to explain.) There seems to be possible concurrent __set_bit()'s to the same word which will result in bit loss. I was thinking to change the kvm-unit-tests' dirty log test to write to two consecutive pages concurrently. Is this good for debugging this? Takuya