[PATCH] msi/msix: added functions to API to set up message address, and data

2012-06-21 Thread Alexey Kardashevskiy
Ok, another try. Is it any better now? :) Normally QEMU expects the guest to initialize MSI/MSIX vectors. However on POWER the guest uses RTAS subsystem to configure MSI/MSIX and does not write these vectors to device's config space or MSIX BAR. On the other hand, msi_notify()/msix_notify()

Re: [PATCH] msi/msix: added functions to API to set up message address, and data

2012-06-21 Thread Jan Kiszka
On 2012-06-21 08:46, Alexey Kardashevskiy wrote: Ok, another try. Is it any better now? :) No - posted the old version accidentally? Jan Normally QEMU expects the guest to initialize MSI/MSIX vectors. However on POWER the guest uses RTAS subsystem to configure MSI/MSIX and does not

[PATCH] msi/msix: added public API to set/get MSI message address, and data

2012-06-21 Thread Alexey Kardashevskiy
agrhhh. sha1 of the patch changed after rebasing :) Added (msi|msix)_(set|get)_message() function for whoever might want to use them. Currently msi_notify()/msix_notify() write to these vectors to signal the guest about an interrupt so the correct values have to written there by the guest or

Re: [PATCH] msi/msix: added public API to set/get MSI message address, and data

2012-06-21 Thread Jan Kiszka
On 2012-06-21 09:18, Alexey Kardashevskiy wrote: agrhhh. sha1 of the patch changed after rebasing :) Added (msi|msix)_(set|get)_message() function for whoever might want to use them. Currently msi_notify()/msix_notify() write to these vectors to signal the guest about an interrupt

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

2012-06-21 Thread Avi Kivity
On 06/19/2012 04:46 PM, Takuya Yoshikawa wrote: 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

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

2012-06-21 Thread Takuya Yoshikawa
I added further optimization based on Avi's advice and my rmap_pde work. - patch [5-6] The new test result was impressively good, see below, and THP page invalidation was more than 5 times faster on my x86 machine. I also noticed that GUI's responsiveness on the host during swapping the guest's

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

[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
When guest's memory is backed by THP pages, MMU notifier needs to call kvm_unmap_hva(), which in turn leads to kvm_handle_hva(), in a loop to invalidate a range of pages which constitute one huge page: for each page for each memslot if page is in memslot unmap using rmap This

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

2012-06-21 Thread Takuya Yoshikawa
When we tested KVM under memory pressure, with THP enabled on the host, we noticed that MMU notifier took a long time to invalidate huge pages. Since the invalidation was done with mmu_lock held, it not only wasted the CPU but also made the host harder to respond. This patch mitigates this by

[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] msi/msix: added public API to set/get MSI message address, and data

2012-06-21 Thread Alexey Kardashevskiy
On 21/06/12 20:38, Jan Kiszka wrote: On 2012-06-21 12:28, Alexey Kardashevskiy wrote: On 21/06/12 17:39, Jan Kiszka wrote: On 2012-06-21 09:18, Alexey Kardashevskiy wrote: agrhhh. sha1 of the patch changed after rebasing :) Added (msi|msix)_(set|get)_message() function for whoever might

Re: [PATCH] msi/msix: added public API to set/get MSI message address, and data

2012-06-21 Thread Jan Kiszka
On 2012-06-21 12:50, Alexey Kardashevskiy wrote: On 21/06/12 20:38, Jan Kiszka wrote: On 2012-06-21 12:28, Alexey Kardashevskiy wrote: On 21/06/12 17:39, Jan Kiszka wrote: On 2012-06-21 09:18, Alexey Kardashevskiy wrote: agrhhh. sha1 of the patch changed after rebasing :) Added

[PATCH] msi/msix: added API to set MSI message address and data

2012-06-21 Thread Alexey Kardashevskiy
Added (msi|msix)_set_message() functions. Currently msi_notify()/msix_notify() write to these vectors to signal the guest about an interrupt so the correct values have to written there by the guest or QEMU. For example, POWER guest never initializes MSI/MSIX vectors, instead it uses RTAS

Re: [PATCH] msi/msix: added API to set MSI message address and data

2012-06-21 Thread Jan Kiszka
On 2012-06-21 13:39, Alexey Kardashevskiy wrote: Added (msi|msix)_set_message() functions. Currently msi_notify()/msix_notify() write to these vectors to signal the guest about an interrupt so the correct values have to written there by the guest or QEMU. For example, POWER guest never

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

2012-06-21 Thread Alexander Graf
On 21.06.2012, at 10:48, Takuya Yoshikawa wrote: I added further optimization based on Avi's advice and my rmap_pde work. - patch [5-6] The new test result was impressively good, see below, and THP page invalidation was more than 5 times faster on my x86 machine. I also noticed that

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] msi/msix: added public API to set/get MSI message address, and data

2012-06-21 Thread Alex Williamson
On Thu, 2012-06-21 at 12:56 +0200, Jan Kiszka wrote: On 2012-06-21 12:50, Alexey Kardashevskiy wrote: On 21/06/12 20:38, Jan Kiszka wrote: On 2012-06-21 12:28, Alexey Kardashevskiy wrote: On 21/06/12 17:39, Jan Kiszka wrote: On 2012-06-21 09:18, Alexey Kardashevskiy wrote: agrhhh.

Re: [PATCH] msi/msix: added API to set MSI message address and data

2012-06-21 Thread Alexey Kardashevskiy
On 21/06/12 21:49, Jan Kiszka wrote: On 2012-06-21 13:39, Alexey Kardashevskiy wrote: Added (msi|msix)_set_message() functions. Currently msi_notify()/msix_notify() write to these vectors to signal the guest about an interrupt so the correct values have to written there by the guest or QEMU.

[PATCH] msi/msix: added API to set MSI message address and data

2012-06-21 Thread Alexey Kardashevskiy
Added (msi|msix)_set_message() function for whoever might want to use them. Currently msi_notify()/msix_notify() write to these vectors to signal the guest about an interrupt so the correct values have to written there by the guest or QEMU. For example, POWER guest never initializes MSI/MSIX