[PATCH 3/5] bitops: Introduce generic {clear,set}_bit_le()

2012-08-07 Thread Takuya Yoshikawa
From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Needed to replace test_and_set_bit_le() in virt/kvm/kvm_main.c which is being used for this missing function. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Acked-by: Arnd Bergmann a...@arndb.de --- include/asm-generic/bitops

[PATCH 4/5] powerpc: bitops: Introduce {clear,set}_bit_le()

2012-08-07 Thread Takuya Yoshikawa
From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Needed to replace test_and_set_bit_le() in virt/kvm/kvm_main.c which is being used for this missing function. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Acked-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- arch

[PATCH 5/5] KVM: Replace test_and_set_bit_le() in mark_page_dirty_in_slot() with set_bit_le()

2012-08-07 Thread Takuya Yoshikawa
From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Now that we have defined generic set_bit_le() we do not need to use test_and_set_bit_le() for atomically setting a bit. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Avi Kivity a...@redhat.com Cc: Marcelo Tosatti mtosa

[PATCH 4/5] powerpc: bitops: Introduce {clear,set}_bit_le()

2012-08-07 Thread Takuya Yoshikawa
From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Needed to replace test_and_set_bit_le() in virt/kvm/kvm_main.c which is being used for this missing function. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Acked-by: Benjamin Herrenschmidt b...@kernel.crashing.org --- arch

[PATCH 5/5] KVM: Replace test_and_set_bit_le() in mark_page_dirty_in_slot() with set_bit_le()

2012-08-07 Thread Takuya Yoshikawa
From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Now that we have defined generic set_bit_le() we do not need to use test_and_set_bit_le() for atomically setting a bit. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Avi Kivity a...@redhat.com Cc: Marcelo Tosatti mtosa

[PATCH 0/5 - RESEND] Introduce generic set_bit_le()

2012-08-07 Thread Takuya Yoshikawa
for big-endian case, than the generic __set_bit_le(), it should not be a problem to use the latter since both maintainers prefer it. Ben Hutchings (1): sfc: Use standard __{clear,set}_bit_le() functions Takuya Yoshikawa (4): drivers/net/ethernet/dec/tulip: Use standard __set_bit_le() function

[PATCH 1/5] sfc: Use standard __{clear,set}_bit_le() functions

2012-08-07 Thread Takuya Yoshikawa
From: Ben Hutchings bhutchi...@solarflare.com There are now standard functions for dealing with little-endian bit arrays, so use them instead of our own implementations. Signed-off-by: Ben Hutchings bhutchi...@solarflare.com Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp

[PATCH 2/5] drivers/net/ethernet/dec/tulip: Use standard __set_bit_le() function

2012-08-07 Thread Takuya Yoshikawa
From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp To introduce generic set_bit_le() later, we remove our own definition and use a proper non-atomic bitops function: __set_bit_le(). Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Acked-by: Grant Grundler grund...@parisc

[PATCH 3/5] bitops: Introduce generic {clear,set}_bit_le()

2012-08-07 Thread Takuya Yoshikawa
From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Needed to replace test_and_set_bit_le() in virt/kvm/kvm_main.c which is being used for this missing function. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Acked-by: Arnd Bergmann a...@arndb.de --- include/asm-generic/bitops

[PATCH 0/3] KVM: Integrate rmap and rmap_pde

2012-08-01 Thread Takuya Yoshikawa
? Takuya Yoshikawa (3): KVM: Stop checking rmap to see if slot is being created KVM: MMU: Use gfn_to_rmap() instead of directly reading rmap array KVM: Push rmap into kvm_arch_memory_slot arch/powerpc/include/asm/kvm_host.h |1 + arch/powerpc/kvm/book3s_64_mmu_hv.c |6 ++-- arch/powerpc

[PATCH 1/3] KVM: Stop checking rmap to see if slot is being created

2012-08-01 Thread Takuya Yoshikawa
Instead, check npages consistently. This helps to make rmap architecture specific in a later patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/x86.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm

[PATCH 2/3] KVM: MMU: Use gfn_to_rmap() instead of directly reading rmap array

2012-08-01 Thread Takuya Yoshikawa
This helps to make rmap architecture specific in a later patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c |3 ++- arch/x86/kvm/mmu_audit.c |4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch

[RFC PATCH 3/3] KVM: Push rmap into kvm_arch_memory_slot

2012-08-01 Thread Takuya Yoshikawa
Two reasons: - x86 can integrate rmap and rmap_pde and remove heuristics in __gfn_to_rmap(). - Some architectures do not need rmap. Since rmap is one of the most memory consuming stuff in KVM, ppc'd better restrict the allocation to Book3S HV. Signed-off-by: Takuya Yoshikawa yoshikawa.tak

[PATCH 0/3] KVM: Integrate rmap and rmap_pde

2012-08-01 Thread Takuya Yoshikawa
? Takuya Yoshikawa (3): KVM: Stop checking rmap to see if slot is being created KVM: MMU: Use gfn_to_rmap() instead of directly reading rmap array KVM: Push rmap into kvm_arch_memory_slot arch/powerpc/include/asm/kvm_host.h |1 + arch/powerpc/kvm/book3s_64_mmu_hv.c |6 ++-- arch/powerpc

[PATCH 1/3] KVM: Stop checking rmap to see if slot is being created

2012-08-01 Thread Takuya Yoshikawa
Instead, check npages consistently. This helps to make rmap architecture specific in a later patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/x86.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm

[PATCH 2/3] KVM: MMU: Use gfn_to_rmap() instead of directly reading rmap array

2012-08-01 Thread Takuya Yoshikawa
This helps to make rmap architecture specific in a later patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c |3 ++- arch/x86/kvm/mmu_audit.c |4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch

Re: [PATCH v2 3/3] KVM: remove dummy pages

2012-07-26 Thread Takuya Yoshikawa
On Thu, 26 Jul 2012 17:35:13 +0800 Xiao Guangrong wrote: > > Is this patch really safe for all architectures? > > > > IS_ERR_VALUE() casts -MAX_ERRNO to unsigned long and then does comparison. > > Isn't it possible to conflict with valid pfns? > > > > See IS_ERR_VALUE(): > > #define

Re: [PATCH v2 3/3] KVM: remove dummy pages

2012-07-26 Thread Takuya Yoshikawa
On Thu, 26 Jul 2012 11:56:15 +0300 Avi Kivity wrote: > Since my comments are better done as a separate patch, I applied all > three patches. Thanks! Is this patch really safe for all architectures? IS_ERR_VALUE() casts -MAX_ERRNO to unsigned long and then does comparison. Isn't it possible to

Re: [PATCH v2 3/3] KVM: remove dummy pages

2012-07-26 Thread Takuya Yoshikawa
On Thu, 26 Jul 2012 11:56:15 +0300 Avi Kivity a...@redhat.com wrote: Since my comments are better done as a separate patch, I applied all three patches. Thanks! Is this patch really safe for all architectures? IS_ERR_VALUE() casts -MAX_ERRNO to unsigned long and then does comparison. Isn't

Re: [PATCH v2 3/3] KVM: remove dummy pages

2012-07-26 Thread Takuya Yoshikawa
On Thu, 26 Jul 2012 17:35:13 +0800 Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: Is this patch really safe for all architectures? IS_ERR_VALUE() casts -MAX_ERRNO to unsigned long and then does comparison. Isn't it possible to conflict with valid pfns? See IS_ERR_VALUE():

Re: [PATCH v2 3/3] KVM: remove dummy pages

2012-07-26 Thread Takuya Yoshikawa
On Thu, 26 Jul 2012 11:56:15 +0300 Avi Kivity a...@redhat.com wrote: Since my comments are better done as a separate patch, I applied all three patches. Thanks! Is this patch really safe for all architectures? IS_ERR_VALUE() casts -MAX_ERRNO to unsigned long and then does comparison. Isn't

Re: [PATCH v2 3/3] KVM: remove dummy pages

2012-07-26 Thread Takuya Yoshikawa
On Thu, 26 Jul 2012 17:35:13 +0800 Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: Is this patch really safe for all architectures? IS_ERR_VALUE() casts -MAX_ERRNO to unsigned long and then does comparison. Isn't it possible to conflict with valid pfns? See IS_ERR_VALUE():

Re: [PATCH] KVM: MMU: Fix mmu_shrink() so that it can free mmu pages as intended

2012-07-19 Thread Takuya Yoshikawa
On Wed, 18 Jul 2012 17:52:46 -0300 Marcelo Tosatti mtosa...@redhat.com wrote: Can't understand, can you please expand more clearly? I think mmu pages are not worth freeing under usual memory pressure, especially when we have EPT/NPT on. What's happening: shrink_slab() vainly calls

Re: [PATCH 0/8] KVM: Optimize MMU notifier's THP page invalidation -v4

2012-07-17 Thread Takuya Yoshikawa
On Thu, 5 Jul 2012 10:08:07 -0300 Marcelo Tosatti wrote: > Neat. > > Andrea can you please ACK? > ping -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at

Re: [PATCH 0/8] KVM: Optimize MMU notifier's THP page invalidation -v4

2012-07-17 Thread Takuya Yoshikawa
On Thu, 5 Jul 2012 10:08:07 -0300 Marcelo Tosatti mtosa...@redhat.com wrote: Neat. Andrea can you please ACK? ping -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at

Re: [PATCH 0/8] KVM: Optimize MMU notifier's THP page invalidation -v4

2012-07-17 Thread Takuya Yoshikawa
On Thu, 5 Jul 2012 10:08:07 -0300 Marcelo Tosatti mtosa...@redhat.com wrote: Neat. Andrea can you please ACK? ping -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at

Re: [PATCH] KVM: MMU: Fix mmu_shrink() so that it can free mmu pages as intended

2012-07-12 Thread Takuya Yoshikawa
On Thu, 5 Jul 2012 23:05:46 +0900 Takuya Yoshikawa takuya.yoshik...@gmail.com wrote: On Thu, 5 Jul 2012 14:50:00 +0300 Gleb Natapov g...@redhat.com wrote: Note that if (!nr_to_scan--) check is removed since we do not try to free mmu pages from more than one VM. IIRC

Re: [Qemu-devel] KVM call agenda for Tuesday, June 19th

2012-07-11 Thread Takuya Yoshikawa
On Thu, 12 Jul 2012 02:02:24 +0100 Vinod, Chegu chegu_vi...@hp.com wrote: There have been some recent fixes (from Juan) that are supposed to honor the user requested downtime. I am in the middle of redoing some of my experiments...and will share when they are ready (in about 3-4 days).

[PATCH] KVM: MMU: Fix mmu_shrink() so that it can free mmu pages as intended

2012-07-05 Thread Takuya Yoshikawa
mmu pages as before. Note that if (!nr_to_scan--) check is removed since we do not try to free mmu pages from more than one VM. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Gleb Natapov g...@redhat.com --- arch/x86/kvm/mmu.c |5 + 1 files changed, 1 insertions(+), 4

Re: [PATCH] KVM: MMU: Fix mmu_shrink() so that it can free mmu pages as intended

2012-07-05 Thread Takuya Yoshikawa
On Thu, 5 Jul 2012 14:50:00 +0300 Gleb Natapov g...@redhat.com wrote: Note that if (!nr_to_scan--) check is removed since we do not try to free mmu pages from more than one VM. IIRC this was proposed in the past that we should iterate over vm list until freeing something eventually, but

[PATCH 0/8] KVM: Optimize MMU notifier's THP page invalidation -v4

2012-07-02 Thread Takuya Yoshikawa
v3-v4: Resolved trace_kvm_age_page() issue -- patch 6,7 v2-v3: Fixed intersection calculations. -- patch 3, 8 Takuya Takuya Yoshikawa (8): KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva() KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva() KVM: MMU: Make

[PATCH 1/8] KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva()

2012-07-02 Thread Takuya Yoshikawa
We can treat every level uniformly. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 3b53d9e..d3e7e6a 100644 --- a/arch/x86/kvm

[PATCH 2/8] KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva()

2012-07-02 Thread Takuya Yoshikawa
This restricts hva handling in mmu code and makes it easier to extend kvm_handle_hva() so that it can treat a range of addresses later in this patch series. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org

[PATCH 3/8] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-07-02 Thread Takuya Yoshikawa
is converted to a loop over rmap which is much more cache friendly than before. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 36 ++-- arch/x86/kvm

[PATCH 4/8] KVM: Introduce kvm_unmap_hva_range() for kvm_mmu_notifier_invalidate_range_start()

2012-07-02 Thread Takuya Yoshikawa
this by using kvm_handle_hva_range(). Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |2 ++ arch/powerpc/kvm/book3s_64_mmu_hv.c |7 +++ arch/x86/include/asm/kvm_host.h

[PATCH 5/8] KVM: Separate rmap_pde from kvm_lpage_info-write_count

2012-07-02 Thread Takuya Yoshikawa
This makes it possible to loop over rmap_pde arrays in the same way as we do over rmap so that we can optimize kvm_handle_hva_range() easily in the following patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/include/asm/kvm_host.h |2 +- arch/x86/kvm/mmu.c

[PATCH 6/8] KVM: MMU: Add memslot parameter to hva handlers

2012-07-02 Thread Takuya Yoshikawa
This is needed to push trace_kvm_age_page() into kvm_age_rmapp() in the following patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 16 +--- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm

[PATCH 7/8] KVM: MMU: Push trace_kvm_age_page() into kvm_age_rmapp()

2012-07-02 Thread Takuya Yoshikawa
This restricts the tracing to page aging and makes it possible to optimize kvm_handle_hva_range() further in the following patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 23 ++- 1 files changed, 10 insertions(+), 13 deletions

[PATCH 8/8] KVM: MMU: Avoid handling same rmap_pde in kvm_handle_hva_range()

2012-07-02 Thread Takuya Yoshikawa
for each rmap in the range unmap using rmap With the preceding patches in the patch series, this made THP page invalidation more than 5 times faster on our x86 host: the host became more responsive during swapping the guest's memory as a result. Signed-off-by: Takuya Yoshikawa yoshikawa.tak

Re: [PATCH v2 3/5] KVM: Flush TLB in mmu notifier without holding mmu_lock

2012-07-02 Thread Takuya Yoshikawa
On Mon, 02 Jul 2012 15:41:30 +0300 Avi Kivity a...@redhat.com wrote: kvm_mmu_slot_remove_write_access: same. It's hard to continue the loop after a lockbreak though. We can switch it to be rmap based instead. Switching to rmap based protection was on my queue before, but I wanted to do that

[PATCH 0/8] KVM: Optimize MMU notifier's THP page invalidation -v4

2012-07-02 Thread Takuya Yoshikawa
v3-v4: Resolved trace_kvm_age_page() issue -- patch 6,7 v2-v3: Fixed intersection calculations. -- patch 3, 8 Takuya Takuya Yoshikawa (8): KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva() KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva() KVM: MMU: Make

[PATCH 1/8] KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva()

2012-07-02 Thread Takuya Yoshikawa
We can treat every level uniformly. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 3b53d9e..d3e7e6a 100644 --- a/arch/x86/kvm

[PATCH 2/8] KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva()

2012-07-02 Thread Takuya Yoshikawa
This restricts hva handling in mmu code and makes it easier to extend kvm_handle_hva() so that it can treat a range of addresses later in this patch series. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org

[PATCH 3/8] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-07-02 Thread Takuya Yoshikawa
is converted to a loop over rmap which is much more cache friendly than before. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 36 ++-- arch/x86/kvm

[PATCH 4/8] KVM: Introduce kvm_unmap_hva_range() for kvm_mmu_notifier_invalidate_range_start()

2012-07-02 Thread Takuya Yoshikawa
this by using kvm_handle_hva_range(). Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |2 ++ arch/powerpc/kvm/book3s_64_mmu_hv.c |7 +++ arch/x86/include/asm/kvm_host.h

[PATCH 5/8] KVM: Separate rmap_pde from kvm_lpage_info-write_count

2012-07-02 Thread Takuya Yoshikawa
This makes it possible to loop over rmap_pde arrays in the same way as we do over rmap so that we can optimize kvm_handle_hva_range() easily in the following patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/include/asm/kvm_host.h |2 +- arch/x86/kvm/mmu.c

[PATCH 6/8] KVM: MMU: Add memslot parameter to hva handlers

2012-07-02 Thread Takuya Yoshikawa
This is needed to push trace_kvm_age_page() into kvm_age_rmapp() in the following patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 16 +--- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm

Re: [PATCH 6/6] KVM: MMU: Avoid handling same rmap_pde in kvm_handle_hva_range()

2012-07-01 Thread Takuya Yoshikawa
On Sun, 01 Jul 2012 10:41:05 +0300 Avi Kivity a...@redhat.com wrote: Note: in the new code we could not use trace_kvm_age_page(), so we just dropped the point from kvm_handle_hva_range(). Can't it be pushed to handler()? Yes, but it will be changed to print rmap, not hva and

Re: [PATCH 6/6] KVM: MMU: Avoid handling same rmap_pde in kvm_handle_hva_range()

2012-07-01 Thread Takuya Yoshikawa
On Sun, 01 Jul 2012 10:41:05 +0300 Avi Kivity a...@redhat.com wrote: Note: in the new code we could not use trace_kvm_age_page(), so we just dropped the point from kvm_handle_hva_range(). Can't it be pushed to handler()? Yes, but it will be changed to print rmap, not hva and

Re: [PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info-write_count

2012-06-28 Thread Takuya Yoshikawa
On Thu, 28 Jun 2012 20:39:55 +0300 Avi Kivity a...@redhat.com wrote: Note: write_count: 4 bytes, rmap_pde: 8 bytes. So we are wasting extra paddings by packing them into lpage_info. The wastage is quite low since it's just 4 bytes per 2MB. Yes. Why not just introduce a function to get

Re: [PATCH 6/6] KVM: MMU: Avoid handling same rmap_pde in kvm_handle_hva_range()

2012-06-28 Thread Takuya Yoshikawa
On Thu, 28 Jun 2012 20:53:47 +0300 Avi Kivity a...@redhat.com wrote: Note: in the new code we could not use trace_kvm_age_page(), so we just dropped the point from kvm_handle_hva_range(). Can't it be pushed to handler()? Yes, but it will be changed to print rmap, not hva and gfn. I

Re: [PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info-write_count

2012-06-28 Thread Takuya Yoshikawa
On Thu, 28 Jun 2012 20:39:55 +0300 Avi Kivity a...@redhat.com wrote: Note: write_count: 4 bytes, rmap_pde: 8 bytes. So we are wasting extra paddings by packing them into lpage_info. The wastage is quite low since it's just 4 bytes per 2MB. Yes. Why not just introduce a function to get

Re: [PATCH 6/6] KVM: MMU: Avoid handling same rmap_pde in kvm_handle_hva_range()

2012-06-28 Thread Takuya Yoshikawa
On Thu, 28 Jun 2012 20:53:47 +0300 Avi Kivity a...@redhat.com wrote: Note: in the new code we could not use trace_kvm_age_page(), so we just dropped the point from kvm_handle_hva_range(). Can't it be pushed to handler()? Yes, but it will be changed to print rmap, not hva and gfn. I

[PATCH 0/6] KVM: Optimize MMU notifier's THP page invalidation -v3

2012-06-27 Thread Takuya Yoshikawa
Updated patch 3 and 6 so that unmap handler be called with exactly same rmap arguments as before, even if kvm_handle_hva_range() is called with unaligned [start, end). Please see the comments I added there. Takuya Takuya Yoshikawa (6): KVM: MMU: Use __gfn_to_rmap() to clean up

[PATCH 1/6] KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva()

2012-06-27 Thread Takuya Yoshikawa
We can treat every level uniformly. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 3b53d9e..d3e7e6a 100644 --- a/arch/x86/kvm

[PATCH 2/6] KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva()

2012-06-27 Thread Takuya Yoshikawa
This restricts hva handling in mmu code and makes it easier to extend kvm_handle_hva() so that it can treat a range of addresses later in this patch series. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org

[PATCH 3/6] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-06-27 Thread Takuya Yoshikawa
is converted to a loop over rmap which is much more cache friendly than before. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 36 ++-- arch/x86/kvm

[PATCH 4/6] KVM: Introduce kvm_unmap_hva_range() for kvm_mmu_notifier_invalidate_range_start()

2012-06-27 Thread Takuya Yoshikawa
this by using kvm_handle_hva_range(). Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |2 ++ arch/powerpc/kvm/book3s_64_mmu_hv.c |7 +++ arch/x86/include/asm/kvm_host.h

[PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info-write_count

2012-06-27 Thread Takuya Yoshikawa
This makes it possible to loop over rmap_pde arrays in the same way as we do over rmap so that we can optimize kvm_handle_hva_range() easily in the following patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/include/asm/kvm_host.h |2 +- arch/x86/kvm/mmu.c

[PATCH 6/6] KVM: MMU: Avoid handling same rmap_pde in kvm_handle_hva_range()

2012-06-27 Thread Takuya Yoshikawa
trace_kvm_age_page(), so we just dropped the point from kvm_handle_hva_range(). Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 37 +++-- 1 files changed, 19 insertions(+), 18 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch

Re: [PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info-write_count

2012-06-27 Thread Takuya Yoshikawa
On Thu, 28 Jun 2012 11:12:51 +0800 Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: struct kvm_arch_memory_slot { + unsigned long *rmap_pde[KVM_NR_PAGE_SIZES - 1]; struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; }; It looks little complex than before - need

[PATCH 0/6] KVM: Optimize MMU notifier's THP page invalidation -v3

2012-06-27 Thread Takuya Yoshikawa
Updated patch 3 and 6 so that unmap handler be called with exactly same rmap arguments as before, even if kvm_handle_hva_range() is called with unaligned [start, end). Please see the comments I added there. Takuya Takuya Yoshikawa (6): KVM: MMU: Use __gfn_to_rmap() to clean up

[PATCH 1/6] KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva()

2012-06-27 Thread Takuya Yoshikawa
We can treat every level uniformly. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 3b53d9e..d3e7e6a 100644 --- a/arch/x86/kvm

[PATCH 2/6] KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva()

2012-06-27 Thread Takuya Yoshikawa
This restricts hva handling in mmu code and makes it easier to extend kvm_handle_hva() so that it can treat a range of addresses later in this patch series. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org

[PATCH 3/6] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-06-27 Thread Takuya Yoshikawa
is converted to a loop over rmap which is much more cache friendly than before. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 36 ++-- arch/x86/kvm

[PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info-write_count

2012-06-27 Thread Takuya Yoshikawa
This makes it possible to loop over rmap_pde arrays in the same way as we do over rmap so that we can optimize kvm_handle_hva_range() easily in the following patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/include/asm/kvm_host.h |2 +- arch/x86/kvm/mmu.c

[PATCH 6/6] KVM: MMU: Avoid handling same rmap_pde in kvm_handle_hva_range()

2012-06-27 Thread Takuya Yoshikawa
trace_kvm_age_page(), so we just dropped the point from kvm_handle_hva_range(). Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 37 +++-- 1 files changed, 19 insertions(+), 18 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch

Re: [PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info-write_count

2012-06-27 Thread Takuya Yoshikawa
On Thu, 28 Jun 2012 11:12:51 +0800 Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: struct kvm_arch_memory_slot { + unsigned long *rmap_pde[KVM_NR_PAGE_SIZES - 1]; struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; }; It looks little complex than before - need

Re: [PATCH 6/6] KVM: MMU: Avoid handling same rmap_pde in kvm_handle_hva_range()

2012-06-22 Thread Takuya Yoshikawa
On Thu, 21 Jun 2012 17:52:38 +0900 Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp wrote: ... + /* Handle the first one even if idx == idx_end. */ + do { + ret |= handler(kvm, rmapp++, data); + } while

[PATCH 0/6] KVM: Optimize MMU notifier's THP page invalidation -v2

2012-06-21 Thread Takuya Yoshikawa
(); ... Takuya Yoshikawa (6): KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva() KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva() KVM: MMU: Make kvm_handle_hva() handle range of addresses KVM: Introduce kvm_unmap_hva_range() for kvm_mmu_notifier_invalidate_range_start() KVM

[PATCH 1/6] KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva()

2012-06-21 Thread Takuya Yoshikawa
We can treat every level uniformly. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 3b53d9e..d3e7e6a 100644 --- a/arch/x86/kvm

[PATCH 2/6] KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva()

2012-06-21 Thread Takuya Yoshikawa
This restricts hva handling in mmu code and makes it easier to extend kvm_handle_hva() so that it can treat a range of addresses later in this patch series. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org

[PATCH 3/6] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-06-21 Thread Takuya Yoshikawa
is converted to a loop over rmap which is much more cache friendly than before. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 31 +--- arch/x86/kvm

[PATCH 4/6] KVM: Introduce kvm_unmap_hva_range() for kvm_mmu_notifier_invalidate_range_start()

2012-06-21 Thread Takuya Yoshikawa
this by using kvm_handle_hva_range(). Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |2 ++ arch/powerpc/kvm/book3s_64_mmu_hv.c |7 +++ arch/x86/include/asm/kvm_host.h

[PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info-write_count

2012-06-21 Thread Takuya Yoshikawa
This makes it possible to loop over rmap_pde arrays in the same way as we do over rmap so that we can optimize kvm_handle_hva_range() easily in the following patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/include/asm/kvm_host.h |2 +- arch/x86/kvm/mmu.c

[PATCH 6/6] KVM: MMU: Avoid handling same rmap_pde in kvm_handle_hva_range()

2012-06-21 Thread Takuya Yoshikawa
trace_kvm_age_page(), so we just dropped the point from kvm_handle_hva_range(). Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 39 --- 1 files changed, 20 insertions(+), 19 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch

Re: [PATCH 3/4] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-06-21 Thread Takuya Yoshikawa
I should have read this before sending v2... On Thu, 21 Jun 2012 11:24:59 +0300 Avi Kivity a...@redhat.com wrote: 1. Separate rmap_pde from lpage_info-write_count and make this a simple array. (I once tried this.) This has the potential to increase cache misses, but I don't think

[PATCH 0/6] KVM: Optimize MMU notifier's THP page invalidation -v2

2012-06-21 Thread Takuya Yoshikawa
(); ... Takuya Yoshikawa (6): KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva() KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva() KVM: MMU: Make kvm_handle_hva() handle range of addresses KVM: Introduce kvm_unmap_hva_range() for kvm_mmu_notifier_invalidate_range_start() KVM

[PATCH 1/6] KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva()

2012-06-21 Thread Takuya Yoshikawa
We can treat every level uniformly. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 3b53d9e..d3e7e6a 100644 --- a/arch/x86/kvm

[PATCH 2/6] KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva()

2012-06-21 Thread Takuya Yoshikawa
This restricts hva handling in mmu code and makes it easier to extend kvm_handle_hva() so that it can treat a range of addresses later in this patch series. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org

[PATCH 3/6] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-06-21 Thread Takuya Yoshikawa
is converted to a loop over rmap which is much more cache friendly than before. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 31 +--- arch/x86/kvm

[PATCH 4/6] KVM: Introduce kvm_unmap_hva_range() for kvm_mmu_notifier_invalidate_range_start()

2012-06-21 Thread Takuya Yoshikawa
this by using kvm_handle_hva_range(). Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org --- arch/powerpc/include/asm/kvm_host.h |2 ++ arch/powerpc/kvm/book3s_64_mmu_hv.c |7 +++ arch/x86/include/asm/kvm_host.h

[PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info-write_count

2012-06-21 Thread Takuya Yoshikawa
This makes it possible to loop over rmap_pde arrays in the same way as we do over rmap so that we can optimize kvm_handle_hva_range() easily in the following patch. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/include/asm/kvm_host.h |2 +- arch/x86/kvm/mmu.c

Re: [PATCH 3/4] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-06-21 Thread Takuya Yoshikawa
I should have read this before sending v2... On Thu, 21 Jun 2012 11:24:59 +0300 Avi Kivity a...@redhat.com wrote: 1. Separate rmap_pde from lpage_info-write_count and make this a simple array. (I once tried this.) This has the potential to increase cache misses, but I don't think

Re: [PATCH v7 02/10] KVM: MMU: abstract spte write-protect

2012-06-20 Thread Takuya Yoshikawa
On Wed, 20 Jun 2012 15:57:15 +0800 Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: Introduce a common function to abstract spte write-protect to cleanup the code Signed-off-by: Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com ... +/* Return true if the spte is dropped. */ +static

Re: [PATCH v7 02/10] KVM: MMU: abstract spte write-protect

2012-06-20 Thread Takuya Yoshikawa
On Wed, 20 Jun 2012 17:11:06 +0800 Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: Strange! Why do you think it is wrong? It is just debug code. kvm_mmu_slot_remove_write_access() does not use rmap but the debug code says: rmap_printk(rmap_write_protect: spte %p %llx\n, sptep,

Re: [PATCH v7 02/10] KVM: MMU: abstract spte write-protect

2012-06-20 Thread Takuya Yoshikawa
On Wed, 20 Jun 2012 21:21:07 +0800 Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: Again, rmap does not break the logic, the spte we handle in this function must be in rmap. I'm not saying whether this breaks some logic or not. rmap_printk(rmap_write_protect: spte %p %llx\n, sptep,

Re: [PATCH v7 02/10] KVM: MMU: abstract spte write-protect

2012-06-20 Thread Takuya Yoshikawa
On Thu, 21 Jun 2012 09:48:05 +0800 Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: We can change the debug message later if needed. Actually, i am going to use tracepoint instead of these debug code. That's very nice! Then, please change the trace log to correspond to the new

[FIX PATCH] KVM: Use kvm_kvfree() to free memory allocated by kvm_kvzalloc()

2012-06-19 Thread Takuya Yoshikawa
From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp The following commit did not care about the error handling path: commit c1a7b32a14138f908df52d7c53b5ce3415ec6b50 KVM: Avoid wasting pages for small lpage_info arrays If memory allocation fails, vfree() will be called with the address

Re: [PATCH 3/4] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-06-19 Thread Takuya Yoshikawa
On Mon, 18 Jun 2012 15:11:42 +0300 Avi Kivity a...@redhat.com wrote: Potential for improvement: don't do 512 iterations on same large page. Something like if ((gfn ^ prev_gfn) mask(level)) ret |= handler(...) with clever selection of the first prev_gfn so it always matches

Re: [Qemu-devel] KVM call agenda for Tuesday, June 19th

2012-06-19 Thread Takuya Yoshikawa
On Tue, 19 Jun 2012 09:01:36 -0500 Anthony Liguori anth...@codemonkey.ws wrote: I'm not at all convinced that postcopy is a good idea. There needs a clear expression of what the value proposition is that's backed by benchmarks. Those benchmarks need to include latency measurements of

Re: [PATCH 3/4] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-06-19 Thread Takuya Yoshikawa
On Mon, 18 Jun 2012 15:11:42 +0300 Avi Kivity a...@redhat.com wrote: Potential for improvement: don't do 512 iterations on same large page. Something like if ((gfn ^ prev_gfn) mask(level)) ret |= handler(...) with clever selection of the first prev_gfn so it always matches

Re: [Qemu-devel] KVM call agenda for Tuesday, June 19th

2012-06-19 Thread Takuya Yoshikawa
On Tue, 19 Jun 2012 09:01:36 -0500 Anthony Liguori anth...@codemonkey.ws wrote: I'm not at all convinced that postcopy is a good idea. There needs a clear expression of what the value proposition is that's backed by benchmarks. Those benchmarks need to include latency measurements of

Re: [PATCH 3/4] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-06-18 Thread Takuya Yoshikawa
On Mon, 18 Jun 2012 15:11:42 +0300 Avi Kivity a...@redhat.com wrote: kvm_for_each_memslot(memslot, slots) { - gfn_t gfn = hva_to_gfn(hva, memslot); + gfn_t gfn = hva_to_gfn(start_hva, memslot); + gfn_t end_gfn = hva_to_gfn(end_hva, memslot); These

Re: [PATCH v6 6/9] KVM: MMU: fast path of handling guest page fault

2012-06-18 Thread Takuya Yoshikawa
On Mon, 18 Jun 2012 16:21:20 -0300 Marcelo Tosatti mtosa...@redhat.com wrote: [not about this patch] EPT accessed/dirty bits will be used for more things in the future. Are there any rules for using these bits? Same as other bits? Do you mean hardware rules or KVM rules? KVM

Re: [PATCH 3/4] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-06-18 Thread Takuya Yoshikawa
On Mon, 18 Jun 2012 15:11:42 +0300 Avi Kivity a...@redhat.com wrote: kvm_for_each_memslot(memslot, slots) { - gfn_t gfn = hva_to_gfn(hva, memslot); + gfn_t gfn = hva_to_gfn(start_hva, memslot); + gfn_t end_gfn = hva_to_gfn(end_hva, memslot); These

[RFC PATCH 0/4] KVM: Optimize MMU notifier's THP page invalidation

2012-06-15 Thread Takuya Yoshikawa
Takuya Yoshikawa (4): KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva() KVM: Introduce hva_to_gfn() for kvm_handle_hva() KVM: MMU: Make kvm_handle_hva() handle range of addresses KVM: Introduce kvm_unmap_hva_range() for kvm_mmu_notifier_invalidate_range_start() arch/powerpc

[PATCH 1/4] KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva()

2012-06-15 Thread Takuya Yoshikawa
We can treat every level uniformly. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp --- arch/x86/kvm/mmu.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 24dd43d..a2f3969 100644 --- a/arch/x86/kvm

[PATCH 2/4] KVM: Introduce hva_to_gfn() for kvm_handle_hva()

2012-06-15 Thread Takuya Yoshikawa
This restricts hva handling in mmu code and makes it easier to extend kvm_handle_hva() so that it can treat a range of addresses later in this patch series. Signed-off-by: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Cc: Alexander Graf ag...@suse.de Cc: Paul Mackerras pau...@samba.org

[PATCH 3/4] KVM: MMU: Make kvm_handle_hva() handle range of addresses

2012-06-15 Thread Takuya Yoshikawa
kvm_handle_hva_range() which makes the loop look like this: for each memslot for each guest page in memslot unmap using rmap In this new processing, the actual work is converted to the loop over rmap array which is much more cache friendly than before. Signed-off-by: Takuya Yoshikawa

<    1   2   3   4   5   6   7   8   9   10   >