Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-12-27 Thread Avi Kivity
On 12/27/2011 05:15 PM, Takuya Yoshikawa wrote: > On Tue, 27 Dec 2011 17:06:47 +0200 > Avi Kivity wrote: > > > > 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 writ

Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-12-27 Thread Takuya Yoshikawa
On Tue, 27 Dec 2011 17:06:47 +0200 Avi Kivity wrote: > > 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 fo

Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-12-27 Thread Avi Kivity
On 12/27/2011 05:03 PM, Takuya Yoshikawa wrote: > 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:

Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-12-27 Thread Takuya Yoshikawa
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. > > -

Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-12-27 Thread Avi Kivity
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 wrote: > > > > > > >btw mark_page_dirty() itself seems to assume mmu_lock protection that > > > > >doesn't exist. Marcelo?

Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-12-27 Thread Marcelo Tosatti
On Sat, Dec 24, 2011 at 11:52:51AM +0900, Takuya Yoshikawa wrote: > On Fri, 23 Dec 2011 09:14:51 -0200 > Marcelo Tosatti wrote: > > > > >btw mark_page_dirty() itself seems to assume mmu_lock protection that > > > >doesn't exist. Marcelo? > > > > > > > > Not mmu_lock protection, kvm->srcu protec

Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-12-23 Thread Takuya Yoshikawa
On Fri, 23 Dec 2011 09:14:51 -0200 Marcelo Tosatti 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

Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-12-23 Thread Marcelo Tosatti
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_g

Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-12-19 Thread Takuya Yoshikawa
(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, memsl

Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-11-14 Thread Avi Kivity
On 11/14/2011 12:07 PM, Avi Kivity wrote: > On 11/14/2011 11:23 AM, Takuya Yoshikawa wrote: > > Needed for the next patch which uses this number to decide how to write > > protect a slot. > > > > /* If nothing is dirty, don't bother messing with page tables. */ > > - if (is_dirty) { > > + i

Re: [PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-11-14 Thread Avi Kivity
On 11/14/2011 11:23 AM, Takuya Yoshikawa wrote: > Needed for the next patch which uses this number to decide how to write > protect a slot. > > /* If nothing is dirty, don't bother messing with page tables. */ > - if (is_dirty) { > + if (memslot->nr_dirty_pages) { > stru

[PATCH 3/4] KVM: Count the number of dirty pages for dirty logging

2011-11-14 Thread Takuya Yoshikawa
Needed for the next patch which uses this number to decide how to write protect a slot. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/x86.c |9 +++-- include/linux/kvm_host.h |1 + virt/kvm/kvm_main.c |4 +++- 3 files changed, 7 insertions(+), 7 deletions(-) diff -