[PATCH 1/2] KVM: MMU: make kvm_mmu_zap_all preemptable

2013-03-31 Thread Xiao Guangrong
kvm_mmu_zap_all is a slow path, break the mmu-lock if needed to avoid potential soft lockup Signed-off-by: Xiao Guangrong --- arch/x86/kvm/mmu.c | 11 ++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 633e30c..1ebca53 1006

[PATCH 0/2] KVM: x86: avoid potential soft lockup and unneeded mmu reload

2013-03-31 Thread Xiao Guangrong
This patch makes kvm_mmu_zap_all be preemptable since it is a slow path, break the mmu-lock if needed to avoid potential soft lockup. Also it drops unnecessary kvm_reload_remote_mmus This is the preparing work about kvm_mmu_zap_all, the fast approach is being developed Xiao Guangrong (2): KVM:

[PATCH 2/2] KVM: MMU: drop unnecessary kvm_reload_remote_mmus

2013-03-31 Thread Xiao Guangrong
It is the responsibility of kvm_mmu_zap_all that keeps the consistent of mmu and tlbs. And it is also unnecessary after zap all mmio sptes since no mmio spte exists on root shadow page and it can not be cached into tlb Signed-off-by: Xiao Guangrong --- arch/x86/kvm/x86.c |5 + 1 files ch

[PATCH v7 7/7] KVM: VMX: Use posted interrupt to deliver virtual interrupt

2013-03-31 Thread Yang Zhang
From: Yang Zhang If posted interrupt is avaliable, then uses it to inject virtual interrupt to guest. Signed-off-by: Yang Zhang --- arch/x86/kvm/lapic.c | 29 ++--- arch/x86/kvm/vmx.c |2 +- arch/x86/kvm/x86.c |1 + 3 files changed, 20 insertions(+), 12 de

[PATCH v7 6/7] KVM: VMX: Add the algorithm of deliver posted interrupt

2013-03-31 Thread Yang Zhang
From: Yang Zhang Only deliver the posted interrupt when target vcpu is running and there is no previous interrupt pending in pir. Signed-off-by: Yang Zhang --- arch/x86/include/asm/kvm_host.h |2 + arch/x86/kvm/lapic.c| 13 arch/x86/kvm/lapic.h|1 + a

[PATCH v7 3/7] KVM: VMX: Check the posted interrupt capability

2013-03-31 Thread Yang Zhang
From: Yang Zhang Detect the posted interrupt feature. If it exists, then set it in vmcs_config. Signed-off-by: Yang Zhang --- arch/x86/include/asm/vmx.h |4 ++ arch/x86/kvm/vmx.c | 87 ++-- 2 files changed, 71 insertions(+), 20 deletions(-)

[PATCH v7 4/7] KVM: Call common update function when ioapic entry changed.

2013-03-31 Thread Yang Zhang
From: Yang Zhang Both TMR and EOI exit bitmap need to be updated when ioapic changed or vcpu's id/ldr/dfr changed. So use common function instead eoi exit bitmap specific function. Signed-off-by: Yang Zhang --- arch/ia64/kvm/lapic.h|6 -- arch/x86/kvm/lapic.c |2 +- arch/x8

[PATCH v7 5/7] KVM: Set TMR when programming ioapic entry

2013-03-31 Thread Yang Zhang
From: Yang Zhang We already know the trigger mode of a given interrupt when programming the ioapice entry. So it's not necessary to set it in each interrupt delivery. Signed-off-by: Yang Zhang --- arch/x86/kvm/lapic.c | 15 +-- arch/x86/kvm/lapic.h |1 + arch/x86/kvm/x86.c

[PATCH v7 1/7] KVM: VMX: Enable acknowledge interupt on vmexit

2013-03-31 Thread Yang Zhang
From: Yang Zhang The "acknowledge interrupt on exit" feature controls processor behavior for external interrupt acknowledgement. When this control is set, the processor acknowledges the interrupt controller to acquire the interrupt vector on VM exit. After enabling this feature, an interrupt whi

[PATCH v7 2/7] KVM: VMX: Register a new IPI for posted interrupt

2013-03-31 Thread Yang Zhang
From: Yang Zhang Posted Interrupt feature requires a special IPI to deliver posted interrupt to guest. And it should has a high priority so the interrupt will not be blocked by others. Normally, the posted interrupt will be consumed by vcpu if target vcpu is running and transparent to OS. But in

[PATCH v7 0/7] KVM: VMX: Add Posted Interrupt supporting

2013-03-31 Thread Yang Zhang
From: Yang Zhang The follwoing patches are adding the Posted Interrupt supporting to KVM: The first patch enables the feature 'acknowledge interrupt on vmexit'.Since it is required by Posted interrupt, we need to enable it firstly. And the subsequent patches are adding the posted interrupt suppo

Re: [PATCH V2 2/2] tcm_vhost: Use vq->private_data to indicate if the endpoint is setup

2013-03-31 Thread Asias He
On Sun, Mar 31, 2013 at 11:23:12AM +0300, Michael S. Tsirkin wrote: > On Fri, Mar 29, 2013 at 02:27:50PM +0800, Asias He wrote: > > On Thu, Mar 28, 2013 at 11:06:15AM +0200, Michael S. Tsirkin wrote: > > > On Thu, Mar 28, 2013 at 04:47:15PM +0800, Asias He wrote: > > > > On Thu, Mar 28, 2013 at 10:

Re: [PATCH V2 2/2] tcm_vhost: Use vq->private_data to indicate if the endpoint is setup

2013-03-31 Thread Asias He
On Sun, Mar 31, 2013 at 11:20:24AM +0300, Michael S. Tsirkin wrote: > On Fri, Mar 29, 2013 at 02:22:52PM +0800, Asias He wrote: > > On Thu, Mar 28, 2013 at 11:18:22AM +0200, Michael S. Tsirkin wrote: > > > On Thu, Mar 28, 2013 at 04:10:02PM +0800, Asias He wrote: > > > > On Thu, Mar 28, 2013 at 08:

[PATCH v7 7/7] KVM: Use eoi to track RTC interrupt delivery status

2013-03-31 Thread Yang Zhang
From: Yang Zhang Current interrupt coalescing logci which only used by RTC has conflict with Posted Interrupt. This patch introduces a new mechinism to use eoi to track interrupt: When delivering an interrupt to vcpu, the pending_eoi set to number of vcpu that received the interrupt. And decrease

[PATCH v7 6/7] KVM: Let ioapic know the irq line status

2013-03-31 Thread Yang Zhang
From: Yang Zhang Userspace may deliver RTC interrupt without query the status. So we want to track RTC EOI for this case. Signed-off-by: Yang Zhang --- arch/x86/kvm/i8254.c |4 ++-- arch/x86/kvm/x86.c |6 -- include/linux/kvm_host.h | 11 +++ virt/kvm/assigned-d

[PATCH v7 4/7] KVM: Add reset/restore rtc_status support

2013-03-31 Thread Yang Zhang
From: Yang Zhang Signed-off-by: Yang Zhang --- arch/x86/kvm/lapic.c |9 + arch/x86/kvm/lapic.h |2 ++ virt/kvm/ioapic.c| 43 +++ virt/kvm/ioapic.h|1 + 4 files changed, 55 insertions(+), 0 deletions(-) diff --git a/arch/x86/

[PATCH v7 1/7] KVM: Add vcpu info to ioapic_update_eoi()

2013-03-31 Thread Yang Zhang
From: Yang Zhang Add vcpu info to ioapic_update_eoi, so we can know which vcpu issued this EOI. Signed-off-by: Yang Zhang --- arch/x86/kvm/lapic.c |2 +- virt/kvm/ioapic.c| 12 ++-- virt/kvm/ioapic.h|3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git

[PATCH v7 5/7] KVM : Force vmexit with virtual interrupt delivery

2013-03-31 Thread Yang Zhang
From: Yang Zhang Need the EOI to track interrupt deliver status, so force vmexit on EOI for rtc interrupt when enabling virtual interrupt delivery. Signed-off-by: Yang Zhang --- virt/kvm/ioapic.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/virt/kvm/ioapic.c b/virt

[PATCH v7 3/7] KVM : Return destination vcpu on interrupt injection

2013-03-31 Thread Yang Zhang
From: Yang Zhang Add a new parameter to know vcpus who received the interrupt. Signed-off-by: Yang Zhang --- arch/x86/kvm/lapic.c | 25 - arch/x86/kvm/lapic.h |5 +++-- virt/kvm/ioapic.c|2 +- virt/kvm/ioapic.h|2 +- virt/kvm/irq_comm.c | 12 +++

[PATCH v7 2/7] KVM: Introduce struct rtc_status

2013-03-31 Thread Yang Zhang
From: Yang Zhang rtc_status is used to track RTC interrupt delivery status. The pending_eoi will be increased by vcpu who received RTC interrupt and will be decreased when EOI to this interrupt. Also, we use dest_map to record the destination vcpu to avoid the case that vcpu who didn't get the RT

[PATCH v7 0/7] Use eoi to track RTC interrupt delivery status

2013-03-31 Thread Yang Zhang
From: Yang Zhang Current interrupt coalescing logci which only used by RTC has conflict with Posted Interrupt. This patch introduces a new mechinism to use eoi to track interrupt: When delivering an interrupt to vcpu, the pending_eoi set to number of vcpu that received the interrupt. And decreas

RE: [PATCH] KVM: Call kvm_apic_match_dest() to check destination vcpu

2013-03-31 Thread Zhang, Yang Z
Zhang, Yang Z wrote on 2013-03-21: > From: Yang Zhang > > For a given vcpu, kvm_apic_match_dest() will tell you whether > the vcpu in the destination list quickly. Drop kvm_calculate_eoi_exitmap() > and use kvm_apic_match_dest() instead. > > Signed-off-by: Yang Zhang > --- > arch/x86/kvm/lapic

Re: Another question

2013-03-31 Thread Gleb Natapov
On Tue, Mar 26, 2013 at 09:57:00AM -0700, Christoffer Dall wrote: > Hi guys, > > I have an x86 question that I really hope you can help with: > > Running the kvm-unit-tests on x86, I see a quite large difference > between I/O from the kernel, and I/O user (around 6,000 cycles) on two > separate p

Re: [PULL 0/7] ppc patch queue 2013-03-22

2013-03-31 Thread Alexander Graf
On 31.03.2013, at 12:49, Gleb Natapov wrote: > On Tue, Mar 26, 2013 at 11:37:42AM -0500, Scott Wood wrote: >> On 03/25/2013 08:33:12 PM, Gleb Natapov wrote: >>> On Tue, Mar 26, 2013 at 12:35:09AM +0100, Alexander Graf wrote: On 26.03.2013, at 00:16, Scott Wood wrote: > On 03/

Re: [PULL 0/7] ppc patch queue 2013-03-22

2013-03-31 Thread Gleb Natapov
On Tue, Mar 26, 2013 at 11:37:42AM -0500, Scott Wood wrote: > On 03/25/2013 08:33:12 PM, Gleb Natapov wrote: > >On Tue, Mar 26, 2013 at 12:35:09AM +0100, Alexander Graf wrote: > >> > >> On 26.03.2013, at 00:16, Scott Wood wrote: > >> > >> > On 03/25/2013 05:59:39 PM, Alexander Graf wrote: > >> >> O

Re: [PATCH V2 2/2] tcm_vhost: Use vq->private_data to indicate if the endpoint is setup

2013-03-31 Thread Michael S. Tsirkin
On Fri, Mar 29, 2013 at 02:27:50PM +0800, Asias He wrote: > On Thu, Mar 28, 2013 at 11:06:15AM +0200, Michael S. Tsirkin wrote: > > On Thu, Mar 28, 2013 at 04:47:15PM +0800, Asias He wrote: > > > On Thu, Mar 28, 2013 at 10:33:30AM +0200, Michael S. Tsirkin wrote: > > > > On Thu, Mar 28, 2013 at 04:

Re: [PATCH V2 2/2] tcm_vhost: Use vq->private_data to indicate if the endpoint is setup

2013-03-31 Thread Michael S. Tsirkin
On Fri, Mar 29, 2013 at 02:22:52PM +0800, Asias He wrote: > On Thu, Mar 28, 2013 at 11:18:22AM +0200, Michael S. Tsirkin wrote: > > On Thu, Mar 28, 2013 at 04:10:02PM +0800, Asias He wrote: > > > On Thu, Mar 28, 2013 at 08:16:59AM +0200, Michael S. Tsirkin wrote: > > > > On Thu, Mar 28, 2013 at 10:

Re: [PATCH 0/3] virtio/vhost: Add checks for uninitialized VQs

2013-03-31 Thread Michael S. Tsirkin
On Fri, Mar 29, 2013 at 04:33:09AM +, Nicholas A. Bellinger wrote: > From: Nicholas Bellinger > > Hi folks, > > This series adds a virtio_queue_valid() for use by virtio-pci code in > order to prevent opreations upon uninitialized VQs, that is currently > expected to occur during seabios set

Re: [PATCH 3/3] vhost: Check+skip uninitialized VQs in vhost_verify_ring_mappings

2013-03-31 Thread Michael S. Tsirkin
On Fri, Mar 29, 2013 at 04:33:12AM +, Nicholas A. Bellinger wrote: > From: Nicholas Bellinger > > With the virtio_queue_valid() checks in place to skip uninitialized VQs > within virtio-pci code, go ahead and skip the same uninitialized VQs > during vhost_verify_ring_mappings(). > > Note thi

Re: [PATCH 2/3] virtio-pci: Add virtio_queue_valid checks ahead of virtio_queue_get_num

2013-03-31 Thread Michael S. Tsirkin
On Fri, Mar 29, 2013 at 04:33:11AM +, Nicholas A. Bellinger wrote: > From: Nicholas Bellinger > > This patch adds a number of virtio_queue_valid() checks to virtio-pci > ahead of virtio_queue_get_num() usage in order to skip operation upon > the detection of an uninitialized VQ. > > There is