[PATCH v3 1/3] KVM: MMU: Clean up the error handling of walk_addr_generic()

2011-06-20 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Avoid two step jump to the error handling part. This eliminates the use of the variables present and rsvd_fault. We also use the const type qualifier to show that write/user/fetch_fault do not change in the function. Both of these were suggested by Ingo Molnar. Cc

[PATCH v3 2/3] KVM: MMU: Rename the walk label in walk_addr_generic()

2011-06-20 Thread Takuya Yoshikawa
From: Takuya Yoshikawa The current name does not explain the meaning well. So give it a better name "retry_walk" to show that we are trying the walk again. This was suggested by Ingo Molnar. Cc: Ingo Molnar Signed-off-by: Takuya Yoshikawa --- v2-v3: only changelog update ar

[PATCH v3 3/3] KVM: MMU: Introduce is_last_gpte() to clean up walk_addr_generic()

2011-06-20 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Suggested by Ingo and Avi. Cc: Ingo Molnar Signed-off-by: Takuya Yoshikawa --- v2-v3: dropped set_accessed_bit() arch/x86/kvm/paging_tmpl.h | 26 +++--- 1 files changed, 19 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b

[PATCH 0/3] KVM: MMU: Clean up walk_addr_generic() v4

2011-06-30 Thread Takuya Yoshikawa
This is the v4 of my walk_addr_generic() cleanup. Changelog v3-v4: fixed v3's reversed present mask. This time, I have tested the patch set with kvm-unit-tests/x86/access.flat. npt=0 --- enabling apic starting test run 1572866 tests, 0 failures --- npt=1 --- enabling apic starting test run

[PATCH 1/3] KVM: MMU: Clean up the error handling of walk_addr_generic()

2011-06-30 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Avoid two step jump to the error handling part. This eliminates the use of the variables present and rsvd_fault. We also use the const type qualifier to show that write/user/fetch_fault do not change in the function. Both of these were suggested by Ingo Molnar. Cc

[PATCH 2/3] KVM: MMU: Rename the walk label in walk_addr_generic()

2011-06-30 Thread Takuya Yoshikawa
From: Takuya Yoshikawa The current name does not explain the meaning well. So give it a better name "retry_walk" to show that we are trying the walk again. This was suggested by Ingo Molnar. Cc: Ingo Molnar Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/paging_tmpl.h |6

[PATCH 3/3] KVM: MMU: Introduce is_last_gpte() to clean up walk_addr_generic()

2011-06-30 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Suggested by Ingo and Avi. Cc: Ingo Molnar Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/paging_tmpl.h | 26 +++--- 1 files changed, 19 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index

[PATCH 0/4] KVM: x86 emulator: Clean up decoder a bit

2011-07-30 Thread Takuya Yoshikawa
Passed emulator.flat test: SUMMARY: 88 tests, 0 failures Takuya -- 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 http://vger.kernel.org/majordomo-info.html

[PATCH 1/4] KVM: x86 emulator: Use ctxt->_eip directly in do_insn_fetch_byte()

2011-07-30 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Instead of passing ctxt->_eip from insn_fetch() call sites, get it from ctxt in do_insn_fetch_byte(). This is done by replacing the argument _eip of insn_fetch() with _ctxt, which should be better than letting the macro use ctxt silently in its body. Though this chan

[PATCH 2/4] KVM: x86 emulator: Drop _size argument from insn_fetch()

2011-07-30 Thread Takuya Yoshikawa
From: Takuya Yoshikawa _type is enough to know the size. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 44 ++-- 1 files changed, 22 insertions(+), 22 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index

[PATCH 3/4] KVM: x86 emulator: Let compiler know insn_fetch() rarely fails

2011-07-30 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Fetching the instruction which was to be executed by the guest cannot fail normally. So compiler should always predict that it will succeed. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff

[PATCH 4/4] KVM: x86 emulator: Make x86_decode_insn() return proper macros

2011-07-30 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Return EMULATION_OK/FAILED consistently. Also treat instruction fetch errors, not restricted to X86EMUL_UNHANDLEABLE, as EMULATION_FAILED; although this cannot happen in practice, the current logic will continue the emulation even if the decoder fails to fetch the

Re: [PATCH 4/4] KVM: x86 emulator: Make x86_decode_insn() return proper macros

2011-07-31 Thread Takuya Yoshikawa
On Sun, 31 Jul 2011 11:48:40 +0300 Avi Kivity wrote: > On 07/30/2011 12:03 PM, Takuya Yoshikawa wrote: > > From: Takuya Yoshikawa > > > > Return EMULATION_OK/FAILED consistently. Also treat instruction fetch > > errors, not restricted to X86EMUL_UNHANDLEABLE, as EMU

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" 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). > Initial observa

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 wrote: > On Thu, 5 Jul 2012 14:50:00 +0300 > Gleb Natapov wrote: > > > > Note that "if (!nr_to_scan--)" check is removed since we do not try to > > > free mmu pages from more than one VM. > > >

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 kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

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 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 mmu_shrink() with the default

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 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 IS_ERR_VA

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

2012-08-01 Thread Takuya Yoshikawa
tions? 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/po

[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 --- 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/x86.c index b6379e5..701dbd4

[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 --- 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/x86/kvm/mmu.c index a9a2052

[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 Cc:

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

2012-08-07 Thread Takuya Yoshikawa
y 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() fun

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

2012-08-07 Thread Takuya Yoshikawa
From: Ben Hutchings 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 Signed-off-by: Takuya Yoshikawa --- drivers/net/ethernet/sfc/efx.c|4 ++-- drivers/net/ethernet/sfc

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

2012-08-07 Thread Takuya Yoshikawa
From: Takuya Yoshikawa 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 Acked-by: Grant Grundler --- drivers/net/ethernet/dec/tulip/de2104x.c|7 ++- drivers/net

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

2012-08-07 Thread Takuya Yoshikawa
From: Takuya Yoshikawa 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 Acked-by: Arnd Bergmann --- include/asm-generic/bitops/le.h | 10 ++ 1 files changed, 10 insertions(+), 0 deletions

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

2012-08-07 Thread Takuya Yoshikawa
From: Takuya Yoshikawa 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 Acked-by: Benjamin Herrenschmidt --- arch/powerpc/include/asm/bitops.h | 10 ++ 1 files changed, 10 insertions(+), 0

[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 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 Cc: Avi Kivity Cc: Marcelo Tosatti --- virt/kvm/kvm_main.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions

Re: [PATCH 5/8] KVM: Add hva_to_memslot

2012-08-09 Thread Takuya Yoshikawa
On Tue, 7 Aug 2012 12:57:13 +0200 Alexander Graf wrote: > +struct kvm_memory_slot *hva_to_memslot(struct kvm *kvm, hva_t hva) > +{ > + struct kvm_memslots *slots = kvm_memslots(kvm); > + struct kvm_memory_slot *memslot; > + > + kvm_for_each_memslot(memslot, slots) > + if

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-09 Thread Takuya Yoshikawa
On Thu, 9 Aug 2012 22:25:32 -0300 Marcelo Tosatti wrote: > I'll send a patch to flush per memslot in the next days, you can work > out the PPC details in the meantime. Are you going to implement that using slot_bitmap? Since I'm now converting kvm_mmu_slot_remove_write_access() to rmap based pr

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

2012-08-10 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 Cc: Gleb Natapov --- This patch just recovers the original behaviour and is not related to how to improve mmu_shrink() f

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

2012-08-13 Thread Takuya Yoshikawa
On Mon, 13 Aug 2012 19:15:23 -0300 Marcelo Tosatti wrote: > On Fri, Aug 10, 2012 at 05:16:12PM +0900, Takuya Yoshikawa wrote: > > The following commit changed mmu_shrink() so that it would skip VMs > > whose n_used_mmu_pages was not zero and try to free pages from others: &g

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

2012-08-14 Thread Takuya Yoshikawa
On Tue, 14 Aug 2012 12:17:12 -0300 Marcelo Tosatti wrote: > - if (kvm->arch.n_used_mmu_pages > 0) { > - if (!nr_to_scan--) > - break; -- (*1) > + if (!kvm->arch.n_used_mmu_pages) > continue;

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

2012-08-20 Thread Takuya Yoshikawa
ved in the future. Signed-off-by: Takuya Yoshikawa Cc: Gleb Natapov --- arch/x86/kvm/mmu.c | 13 + 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 9651c2c..5e4b255 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm

Re: [PATCH] kvm/book3s: fix build error caused by gfn_to_hva_memslot()

2012-08-23 Thread Takuya Yoshikawa
On Thu, 23 Aug 2012 15:42:49 +0800 Gavin Shan wrote: > The build error was caused by that builtin functions are calling > the functions implemented in modules. That was introduced by the > following commit. > > commit 4d8b81abc47b83a1939e59df2fdb0e98dfe0eedd > > The patches fix that to convert

Re: [PATCH] kvm/book3s: fix build error caused by gfn_to_hva_memslot()

2012-08-23 Thread Takuya Yoshikawa
Alex, what do you think about this? On Thu, 23 Aug 2012 16:35:15 +0800 Gavin Shan wrote: > On Thu, Aug 23, 2012 at 05:24:00PM +0900, Takuya Yoshikawa wrote: > >On Thu, 23 Aug 2012 15:42:49 +0800 > >Gavin Shan wrote: > > > >> The build error was caused by that

[PATCH] KVM: x86: lapic: Fix the misuse of likely() in find_highest_vector()

2012-08-24 Thread Takuya Yoshikawa
loop and then use __fls() if found. When nothing found, we are out of the loop, so we can just return -1. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/lapic.c | 18 ++ 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm

Re: [patch 3/3] KVM: move postcommit flush to x86, as mmio sptes are x86 specific

2012-08-27 Thread Takuya Yoshikawa
On Fri, 24 Aug 2012 15:54:59 -0300 Marcelo Tosatti wrote: > Other arches do not need this. > > Signed-off-by: Marcelo Tosatti > > Index: kvm/arch/x86/kvm/x86.c > === > --- kvm.orig/arch/x86/kvm/x86.c > +++ kvm/arch/x86/kvm/x86.c >

Re: [patch 3/3] KVM: move postcommit flush to x86, as mmio sptes are x86 specific

2012-08-27 Thread Takuya Yoshikawa
On Mon, 27 Aug 2012 16:06:01 -0300 Marcelo Tosatti wrote: > > Any explanation why (old.base_gfn != new.base_gfn) case can be > > omitted? > > (old.base_gfn != new.base_gfn) check covers the cases > > 1. old.base_gfn = 0, new.base_gfn = !0 (slot creation) > > and > > x != 0, y != 0, x != y. >

Re: [PATCH] KVM: x86: lapic: Fix the misuse of likely() in find_highest_vector()

2012-08-28 Thread Takuya Yoshikawa
On Mon, 27 Aug 2012 17:25:42 -0300 Marcelo Tosatti wrote: > On Fri, Aug 24, 2012 at 06:15:49PM +0900, Takuya Yoshikawa wrote: > > Although returning -1 should be likely according to the likely(), > > the ASSERT in apic_find_highest_irr() will be triggered in such a case. > &g

Re: [PATCH] KVM: x86: lapic: Fix the misuse of likely() in find_highest_vector()

2012-08-29 Thread Takuya Yoshikawa
On Thu, 30 Aug 2012 01:51:20 +0300 "Michael S. Tsirkin" wrote: > This text: > + if (likely(!word_offset && !word[0])) > + return -1; > is a left-over from the original implementation. > > There we did a ton of gratitious calls to interrupt > injection so it was important to s

Re: [PATCH] KVM: x86: lapic: Fix the misuse of likely() in find_highest_vector()

2012-08-30 Thread Takuya Yoshikawa
On Thu, 30 Aug 2012 09:37:02 +0300 "Michael S. Tsirkin" wrote: > After staring at your code for a while it does appear to > do the right thing, and looks cleaner than what > we have now. commit log could be clearer. > It should state something like: > > > Clean up code in find_highest_vector: >

Re: [PATCH] KVM: x86: lapic: Fix the misuse of likely() in find_highest_vector()

2012-08-30 Thread Takuya Yoshikawa
On Thu, 30 Aug 2012 13:10:33 +0300 "Michael S. Tsirkin" wrote: > > OK, I'll do these on top of this patch. > > Tweaking these 5 lines for readability across multiple > patches is just not worth it. > As long as we do random cleanups of this function it's probably easier > to just do them all in

[PATCH -v3] KVM: x86: lapic: Clean up find_highest_vector() and count_vectors()

2012-08-30 Thread Takuya Yoshikawa
, to iterate over the register array to make the code clearer. Note that we actually confirmed that the likely() did wrong predictions by inserting debug code. Signed-off-by: Takuya Yoshikawa Cc: Michael S. Tsirkin --- arch/x86/kvm/lapic.c | 35 +++ 1 files

Re: [PATCH -v3] KVM: x86: lapic: Clean up find_highest_vector() and count_vectors()

2012-08-30 Thread Takuya Yoshikawa
On Thu, 30 Aug 2012 16:21:31 +0300 "Michael S. Tsirkin" wrote: > > +static u32 apic_read_reg(int reg_off, void *bitmap) > > +{ > > + return *((u32 *)(bitmap + reg_off)); > > +} > > + > > Contrast with apic_set_reg which gets apic, > add fact that all callers invoke REG_POS and you will > see

CFQ I/O starvation problem triggered by RHEL6.0 KVM guests

2011-09-08 Thread Takuya Yoshikawa
68S / del_from_rr -- Takuya Yoshikawa -- 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 http://vger.kernel.org/majordomo-info.html

Re: CFQ I/O starvation problem triggered by RHEL6.0 KVM guests

2011-09-09 Thread Takuya Yoshikawa
Vivek Goyal wrote: > So you are using both RHEL 6.0 in both host and guest kernel? Can you > reproduce the same issue with upstream kernels? How easily/frequently > you can reproduce this with RHEL6.0 host. Guests were CentOS6.0. I have only RHEL6.0 and RHEL6.1 test results now. I want to try s

Re: [PATCH 03/14] KVM: x86 emulator: move memop, memopp into emulation context

2011-09-14 Thread Takuya Yoshikawa
On Tue, 13 Sep 2011 10:45:40 +0300 Avi Kivity wrote: > Simplifies further generalization of decode. > > Signed-off-by: Avi Kivity > --- > arch/x86/include/asm/kvm_emulate.h |2 ++ > arch/x86/kvm/emulate.c | 34 +- > 2 files changed, 19 insertio

Re: [PATCH 03/14] KVM: x86 emulator: move memop, memopp into emulation context

2011-09-14 Thread Takuya Yoshikawa
On Wed, 14 Sep 2011 14:37:21 +0300 Avi Kivity wrote: > > Once the emulator context gets stablized, some comments will be nice > > to know which ones are supposed to be accessed from outside of the > > emulator, and which ones are only for the emulator internal usage. > > > > Practically, knowing

[PATCH 0/4] KVM: Dirty logging optimization using rmap

2011-11-14 Thread Takuya Yoshikawa
This is a revised version of my previous work. I hope that the patches are more self explanatory than before. Thanks, Takuya -- 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 http://vger.kernel.o

[PATCH 1/4] KVM: MMU: Clean up BUG_ON() conditions in rmap_write_protect()

2011-11-14 Thread Takuya Yoshikawa
Remove redundant checks and use is_large_pte() macro. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index a9b3a32..973f254 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86

[PATCH 2/4] KVM: MMU: Split gfn_to_rmap() into two functions

2011-11-14 Thread Takuya Yoshikawa
. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c | 26 +- 1 files changed, 17 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 973f254..fa71085 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -958,23 +958,29

[PATCH 4/4] KVM: Optimize dirty logging by rmap_write_protect()

2011-11-14 Thread Takuya Yoshikawa
before when the ratio of dirty pages are low and was not worse even when the ratio was near the criterion. Note that the locking for this write protection becomes fine grained. The reason why this is safe is descripted in the comments. Signed-off-by: Takuya Yoshikawa --- arch/x86/include/asm

[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

Re: [PATCH 4/4] KVM: Optimize dirty logging by rmap_write_protect()

2011-11-14 Thread Takuya Yoshikawa
(2011/11/14 19:22), Avi Kivity wrote: + * + * Generally speaking, if there are not so many dirty pages compared to the + * number of shadow pages, we should use the latter. + * + * Note that letting others write into a page marked dirty in the old bitmap + * by using the remaining tlb entry is n

Re: [PATCH 0/4] KVM: Dirty logging optimization using rmap

2011-11-14 Thread Takuya Yoshikawa
(2011/11/14 19:25), Avi Kivity wrote: On 11/14/2011 11:20 AM, Takuya Yoshikawa wrote: This is a revised version of my previous work. I hope that the patches are more self explanatory than before. It looks good. I'll let Marcelo (or anyone else?) review it as well before applying. D

Re: Memory sync algorithm during migration

2011-11-15 Thread Takuya Yoshikawa
Adding qemu-devel ML to CC. Your question should have been sent to qemu-devel ML because the logic is implemented in QEMU, not KVM. (2011/11/11 1:35), Oliver Hookins wrote: Hi, I am performing some benchmarks on KVM migration on two different types of VM. One has 4GB RAM and the other 32GB. Mo

Re: [PATCH 0/4] KVM: Dirty logging optimization using rmap

2011-11-15 Thread Takuya Yoshikawa
(2011/11/14 21:39), Avi Kivity wrote: There was a patchset from Peter Zijlstra that converted mmu notifiers to be preemptible, with that, we can convert the mmu spinlock to a mutex, I'll see what happened to it. Interesting! There is a third method of doing write protection, and that is by wr

Re: [PATCH 0/4] KVM: Dirty logging optimization using rmap

2011-11-16 Thread Takuya Yoshikawa
Adding qemu-devel to Cc. (2011/11/14 21:39), Avi Kivity wrote: On 11/14/2011 12:56 PM, Takuya Yoshikawa wrote: (2011/11/14 19:25), Avi Kivity wrote: On 11/14/2011 11:20 AM, Takuya Yoshikawa wrote: This is a revised version of my previous work. I hope that the patches are more self

Re: [PATCH v2 3/6] KVM: introduce kvm_for_each_memslot macro

2011-11-20 Thread Takuya Yoshikawa
(2011/11/20 20:21), Avi Kivity wrote: On 11/18/2011 11:18 AM, Xiao Guangrong wrote: index bb8728e..10524c0 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -307,6 +307,10 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i) (vcpup = kvm_get_

Re: [PATCH v2 3/6] KVM: introduce kvm_for_each_memslot macro

2011-11-21 Thread Takuya Yoshikawa
(2011/11/21 17:34), Avi Kivity wrote: Do you have any preference for the arguments ordering? I think placing the target one, memslot in this case, first is conventional in the kernel code, except when we want to place "kvm" or something like that. But in kvm code, there seems to be some differe

[PATCH 0/7] KVM: x86 emulator: Use opcode::execute for some instructions

2011-11-21 Thread Takuya Yoshikawa
This patch set eats the remaining spaghetti in the emulator and cleans up the large plate. After this, only trivial cases will be there. Passed emulator.flat test: SUMMARY: 90 tests, 0 failures Thanks, Takuya -- To unsubscribe from this list: send the line "unsubscribe kvm" in th

[PATCH 1/7] KVM: x86 emulator: Use opcode::execute for IN/OUT

2011-11-21 Thread Takuya Yoshikawa
IN : E4, E5, EC, ED OUT: E6, E7, EE, EF Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 54 --- 1 files changed, 28 insertions(+), 26 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 8547958..8ba4ea8

[PATCH 2/7] KVM: x86 emulator: Use opcode::execute for BT family

2011-11-21 Thread Takuya Yoshikawa
BT : 0F A3 BTS: 0F AB BTR: 0F B3 BTC: 0F BB Group 8: 0F BA Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 77 +++ 1 files changed, 38 insertions(+), 39 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index

[PATCH 3/7] KVM: x86 emulator: Use opcode::execute for CALL

2011-11-21 Thread Takuya Yoshikawa
CALL: E8 Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 18 ++ 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 7a9ce6d..6b7a03b 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c

[PATCH 4/7] KVM: x86 emulator: Use opcode::execute for MOV to cr/dr

2011-11-21 Thread Takuya Yoshikawa
MOV: 0F 22 (move to control registers) MOV: 0F 23 (move to debug registers) Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 52 +++ 1 files changed, 30 insertions(+), 22 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm

[PATCH 5/7] KVM: x86 emulator: Use opcode::execute for WRMSR/RDMSR

2011-11-21 Thread Takuya Yoshikawa
WRMSR: 0F 30 RDMSR: 0F 32 Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 52 1 files changed, 26 insertions(+), 26 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 7fe5ed1..906c5eb 100644 --- a/arch

[PATCH 6/7] KVM: x86 emulator: Use opcode::execute for CMPXCHG

2011-11-21 Thread Takuya Yoshikawa
CMPXCHG: 0F B0, 0F B1 Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 37 +++-- 1 files changed, 19 insertions(+), 18 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 906c5eb..799000d 100644 --- a/arch/x86/kvm

[PATCH 7/7] KVM: x86 emulator: Use opcode::execute for BSF/BSR

2011-11-21 Thread Takuya Yoshikawa
BSF: 0F BC BSR: 0F BD Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 60 1 files changed, 35 insertions(+), 25 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 799000d..4cd3313 100644 --- a/arch/x86

[PATCH] KVM: x86 emulator: Use opcode::execute for INS/OUTS

2011-11-22 Thread Takuya Yoshikawa
From: Takuya Yoshikawa INSB : 6C INSW/INSD : 6D OUTSB : 6E OUTSW/OUTSD: 6F The I/O port address is read from the DX register when we decode the operand because we see the SrcDX/DstDX flag is set. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 14 ++ 1

Re: [PATCH v3 4/6] KVM: introduce id_to_memslot function

2011-11-24 Thread Takuya Yoshikawa
(2011/11/24 18:40), Xiao Guangrong wrote: ... --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3521,7 +3521,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, if (log->slot>= KVM_MEMORY_SLOTS) goto out; - memslot =&kvm->memslots->memslots[log->slot]; +

Re: [PATCH v3 4/6] KVM: introduce id_to_memslot function

2011-11-24 Thread Takuya Yoshikawa
(2011/11/24 19:15), Takuya Yoshikawa wrote: (2011/11/24 18:40), Xiao Guangrong wrote: You can eliminate this if you use old_slot and new_slot for the two memory slots. Or old_bitmap and new_bitmap. Anyway, calling id_to_memslot() for getting the same slot twice is not good, IMO

[PATCH 0/3] KVM: MMU: Trivial fix and cleanups

2011-11-28 Thread Takuya Yoshikawa
Made when I was reading mmu code. Takuya BTW, is threre any good way to test large page functionality? -- 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 http://vger.kernel.org/majordomo-info.html

[PATCH 1/3] KVM: MMU: Remove for_each_unsync_children() macro

2011-11-28 Thread Takuya Yoshikawa
There is only one user of it and for_each_set_bit() does the same. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c |7 +-- 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d737443..09da963 100644 --- a/arch/x86/kvm/mmu.c

[PATCH 2/3] KVM: MMU: Add missing large page accounting to drop_large_spte()

2011-11-28 Thread Takuya Yoshikawa
Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 09da963..5e761ff 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1803,6 +1803,7 @@ static void

[PATCH 3/3] KVM: MMU: Make drop_large_spte() more generic

2011-11-28 Thread Takuya Yoshikawa
on is_large_pte() check result. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/mmu.c | 35 +-- arch/x86/kvm/paging_tmpl.h |4 ++-- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index

[PATCH] KVM: x86: Remove useless regs_page pointer from kvm_lapic

2011-03-04 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Access to this page is mostly done through the regs member which holds the address to this page. The exceptions are in vmx_vcpu_reset() and kvm_free_lapic() and these both can easily be converted to using regs. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/lapic.c

[PATCH 3/3] KVM: x86 emulator: Remove unnecessary goto statements from x86_emulate_insn()

2011-03-09 Thread Takuya Yoshikawa
This patch is the last part of a work which tries to split x86_emulate_insn() into a few meaningful functions: removes unnecessary goto statements based on the former two patches. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 18 -- 1 files changed, 4 insertions

[PATCH 2/3] KVM: x86 emulator: Make two byte instruction emulation separate

2011-03-09 Thread Takuya Yoshikawa
This patch is the second part of a work which tries to split x86_emulate_insn() into a few meaningful functions: just encapsulates the switch statement for the two byte instruction emulation as emulate_twobyte_insn(). Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 286

[PATCH 1/3] KVM: x86 emulator: Make one byte instruction emulation separate

2011-03-09 Thread Takuya Yoshikawa
rc set to X86EMUL_UNHANDLEABLE will result in returning EMULATION_FAILED which is defined as -1. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 179 +++- 1 files changed, 100 insertions(+), 79 deletions(-) diff --git a/arch/x86/kvm

Re: [PATCH 1/3] KVM: x86 emulator: Make one byte instruction emulation separate

2011-03-10 Thread Takuya Yoshikawa
On Thu, 10 Mar 2011 11:05:38 +0200 Avi Kivity wrote: > On 03/10/2011 09:35 AM, Takuya Yoshikawa wrote: > > x86_emulate_insn() is too long and has many confusing goto statements. > > > > This patch is the first part of a work which tries to split it into > > a few

Re: [PATCH 1/3] KVM: x86 emulator: Make one byte instruction emulation separate

2011-03-10 Thread Takuya Yoshikawa
On Thu, 10 Mar 2011 11:27:30 +0200 Avi Kivity wrote: > On 03/10/2011 11:26 AM, Takuya Yoshikawa wrote: > I don't know if anyone is working on it, so feel free to send patches! Yes, I'm interested in it. So I will take a look and try! I was doing some live migration tests

[PATCH 0/5] KVM: x86 emulator: Use single stage decoding -- Part 1

2011-03-13 Thread Takuya Yoshikawa
This work will continue until we can remove the ugly switch statements. But I want to do this with enough care not to insert extra errors. -- For me, this is a good opportunity to read SDM well. So the whole work will be done in a step by step manner! Thanks, Takuya -- To unsubscribe from th

[PATCH 1/5] KVM: x86 emulator: Use single stage decoding for Group 1 instructions

2011-03-13 Thread Takuya Yoshikawa
From: Takuya Yoshikawa ADD, OR, ADC, SBB, AND, SUB, XOR, CMP are converted using a new macro I6ALU(_f, _e). CMPS, SCAS will be converted later. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 151 1 files changed, 88 insertions

[PATCH 2/5] KVM: x86 emulator: Use single stage decoding for PUSH/POP XS instructions

2011-03-13 Thread Takuya Yoshikawa
From: Takuya Yoshikawa PUSH ES/CS/SS/DS/FS/GS and POP ES/SS/DS/FS/GS are converted. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 111 +++- 1 files changed, 72 insertions(+), 39 deletions(-) diff --git a/arch/x86/kvm/emulate.c b

[PATCH 3/5] KVM: x86 emulator: Use single stage decoding for POP instructions

2011-03-13 Thread Takuya Yoshikawa
From: Takuya Yoshikawa POP is converted. RET will be converted later. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 16 ++-- 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index fcc49ef..8295c50

[PATCH 4/5] KVM: x86 emulator: Use single stage decoding for PUSHA and POPA instructions

2011-03-13 Thread Takuya Yoshikawa
From: Takuya Yoshikawa PUSHA and POPA are converted. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 19 --- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 8295c50..4e16a55 100644 --- a/arch

[PATCH 5/5] KVM: x86 emulator: Use single stage decoding for PUSHF and POPF instructions

2011-03-13 Thread Takuya Yoshikawa
From: Takuya Yoshikawa PUSHF and POPF are converted. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 32 +--- 1 files changed, 21 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 4e16a55..60182d3

Re: [PATCH 1/5] KVM: x86 emulator: Use single stage decoding for Group 1 instructions

2011-03-14 Thread Takuya Yoshikawa
emulate_2op_SrcV("cmp", c->src, c->dst, ctxt->eflags); > And here? What is the difference of CMPS and SCAS? > > > + break; > > case 0xc0 ... 0xc1: > > emulate_grp2(ctxt); > > break; > > -- > &g

Re: [PATCH 1/5] KVM: x86 emulator: Use single stage decoding for Group 1 instructions

2011-03-15 Thread Takuya Yoshikawa
On Tue, 15 Mar 2011 11:35:07 +0200 Gleb Natapov wrote: > > > Why not call em_cmp() here? > > > > I thought that I needed to check of > > c->dst.type = OP_NONE; /* Disable writeback. */ > > later. > > > I mean call em_cmp() after c->dst.type = OP_NONE line, not replacing it. I see the point

Re: [PATCH 1/5] KVM: x86 emulator: Use single stage decoding for Group 1 instructions

2011-03-22 Thread Takuya Yoshikawa
On Tue, 22 Mar 2011 14:53:21 +0200 Avi Kivity wrote: > > I prefer to have the patchset fully updated, even if it takes a while. > Good luck with the recovery! Things already got back as usual, thanks. I had expected much longer time. BTW, is it better to wait until rc1 is released when we se

Re: [PATCH 1/5] KVM: x86 emulator: Use single stage decoding for Group 1 instructions

2011-03-22 Thread Takuya Yoshikawa
On Tue, 22 Mar 2011 14:55:57 +0200 Avi Kivity wrote: > > @@ -2337,10 +2401,20 @@ static int em_mov(struct x86_emulate_ctxt *ctxt) > > #define D6ALU(_f) D2bv((_f) | DstMem | SrcReg | ModRM), > > \ > > D2bv(((_f) | DstReg | SrcMem | ModRM)& ~Lock), \ > >

Re: [PATCH 2/5] KVM: x86 emulator: Use single stage decoding for PUSH/POP XS instructions

2011-03-22 Thread Takuya Yoshikawa
On Tue, 22 Mar 2011 15:03:11 +0200 Avi Kivity wrote: > > +static int em_push_es(struct x86_emulate_ctxt *ctxt) > > +{ > > + emulate_push_sreg(ctxt, ctxt->ops, VCPU_SREG_ES); > > + return X86EMUL_CONTINUE; > > +} > > I thought of adding generic sreg decoding, so we can use > em_push()/em_pop

Re: [PATCH 3/5] KVM: x86 emulator: Use single stage decoding for POP instructions

2011-03-22 Thread Takuya Yoshikawa
On Tue, 22 Mar 2011 15:06:33 +0200 Avi Kivity wrote: > > POP is converted. RET will be converted later. > > There is also POP r/m (8F /0); could be done later. > OK, I'll recheck. I want to put related things into one patch if possible. Takuya -- To unsubscribe from this list: send the line

Re: [PATCH 4/5] KVM: x86 emulator: Use single stage decoding for PUSHA and POPA instructions

2011-03-22 Thread Takuya Yoshikawa
On Tue, 22 Mar 2011 15:07:20 +0200 Avi Kivity wrote: > > +static int em_pusha(struct x86_emulate_ctxt *ctxt) > > +{ > > + return emulate_pusha(ctxt, ctxt->ops); > > +} > > + > > You can simply rename/update emulate_pusha/emulate_popa, since they have > no other callers. > I intentionally le

[PATCH 1/2] KVM: x86 emulator: Disable writeback for CMP emulation

2011-03-28 Thread Takuya Yoshikawa
From: Takuya Yoshikawa This stops "CMP r/m, reg" to write back the data into memory. Pointed out by Avi. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emula

[RFC PATCH 2/2] KVM: x86 emulator: Cleanup emulate_push() writebacks

2011-03-28 Thread Takuya Yoshikawa
From: Takuya Yoshikawa Recently, emulate_push family functions started to call writeback() during their emulation. This clearly shows that the usual writeback() which is done at the end of x86_emulate_insn() cannot cover all cases. Furthermore, suppressing writeback by changing dst operand&#

Re: [RFC PATCH 2/2] KVM: x86 emulator: Cleanup emulate_push() writebacks

2011-03-30 Thread Takuya Yoshikawa
Takuya Yoshikawa wrote: > @@ -1265,22 +1263,19 @@ int emulate_int_real(struct x86_emulate_ctxt *ctxt, > > /* TODO: Add limit checks */ > c->src.val = ctxt->eflags; > - emulate_push(ctxt, ops); > - rc = writeback(ctxt, ops); > + rc = emulate_

Re: [RFC PATCH 2/2] KVM: x86 emulator: Cleanup emulate_push() writebacks

2011-04-03 Thread Takuya Yoshikawa
ce operand" terminology. But it seemed not worth it now. Takuya -- Takuya Yoshikawa -- 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 http://vger.kernel.org/majordomo-info.html

  1   2   3   4   5   6   7   8   9   10   >