kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Takuya Yoshikawa <takuya.yoshikawa@gmail.com>,
	Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging
Date: Tue, 27 Dec 2011 16:03:16 +0200	[thread overview]
Message-ID: <4EF9D024.8050908@redhat.com> (raw)
In-Reply-To: <20111227135017.GB23270@amt.cnet>

On 12/27/2011 03:50 PM, Marcelo Tosatti wrote:
> On Sat, Dec 24, 2011 at 11:52:51AM +0900, Takuya Yoshikawa wrote:
> > On Fri, 23 Dec 2011 09:14:51 -0200
> > Marcelo Tosatti <mtosatti@redhat.com> wrote:
> > 
> > > > >btw mark_page_dirty() itself seems to assume mmu_lock protection that
> > > > >doesn't exist.  Marcelo?
> > > > >
> > > 
> > > Not mmu_lock protection, kvm->srcu protection.
> > 
> > But it just protects slot readers against updates and two, or more, threads
> > can call mark_page_dirty() concurrently?
>
> Yes, two or more threads can call mark_page_dirty() concurrently.
>
> > What I am worring about here is the atomicity of bitmap updates.
> > 
> > 	commit c8240bd6f0b4b1b21ffd36dd44114d05c7afe0c0
> > 	Author: Alexander Graf <agraf@suse.de>
> > 	Date:   Fri Oct 30 05:47:26 2009 +0000
> > 
> > 		Use Little Endian for Dirty Bitmap
> > 
> > has changed set_bit() to the non-atomic version and nothing protects
> > dirty bits if mmu_lock is not held.
> > 
> > 	The changelog has no explanation why using non-atomic version is safe.
> > 	Some comment in the code may be worthwhile if it is really safe.
>
> 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?

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2011-12-27 14:03 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-14  9:20 [PATCH 0/4] KVM: Dirty logging optimization using rmap Takuya Yoshikawa
2011-11-14  9:21 ` [PATCH 1/4] KVM: MMU: Clean up BUG_ON() conditions in rmap_write_protect() Takuya Yoshikawa
2011-11-14  9:22 ` [PATCH 2/4] KVM: MMU: Split gfn_to_rmap() into two functions Takuya Yoshikawa
2011-11-14  9:23 ` [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging Takuya Yoshikawa
2011-11-14 10:07   ` Avi Kivity
2011-11-14 10:24     ` Avi Kivity
2011-12-20  4:29     ` Takuya Yoshikawa
2011-12-23 11:14       ` Marcelo Tosatti
2011-12-24  2:52         ` Takuya Yoshikawa
2011-12-27 13:50           ` Marcelo Tosatti
2011-12-27 14:03             ` Avi Kivity [this message]
2011-12-27 15:03               ` Takuya Yoshikawa
2011-12-27 15:06                 ` Avi Kivity
2011-12-27 15:15                   ` Takuya Yoshikawa
2011-12-27 15:18                     ` Avi Kivity
2011-11-14  9:24 ` [PATCH 4/4] KVM: Optimize dirty logging by rmap_write_protect() Takuya Yoshikawa
2011-11-14 10:22   ` Avi Kivity
2011-11-14 10:29     ` Takuya Yoshikawa
2011-11-14 10:25 ` [PATCH 0/4] KVM: Dirty logging optimization using rmap Avi Kivity
2011-11-14 10:56   ` Takuya Yoshikawa
2011-11-14 12:39     ` Avi Kivity
2011-11-16  4:28       ` Takuya Yoshikawa
2011-11-16  9:06         ` Avi Kivity
2011-11-29 10:01           ` Xiao Guangrong
2011-11-29 10:09             ` Xiao Guangrong
2011-11-29 10:35               ` Takuya Yoshikawa
2011-11-29 11:20                 ` Avi Kivity
2011-11-29 11:56                   ` Xiao Guangrong
2011-11-29 12:01                     ` Avi Kivity
2011-11-29 14:03                       ` Avi Kivity
2011-11-30  5:02                         ` Takuya Yoshikawa
2011-11-30  5:15                           ` Takuya Yoshikawa
2011-12-01 15:18                             ` Avi Kivity
2011-12-03  4:37                               ` Takuya Yoshikawa
2011-12-04 10:20                                 ` Avi Kivity
2011-11-30  7:10                         ` Xiao Guangrong
2011-11-30  7:03                       ` Xiao Guangrong
2011-12-01 15:11                         ` Avi Kivity
2011-11-16  8:17       ` Takuya Yoshikawa
2011-11-17  9:28 ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EF9D024.8050908@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=takuya.yoshikawa@gmail.com \
    --cc=yoshikawa.takuya@oss.ntt.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).