[patch 3/3] vfio: return -EFAULT on failure

2012-06-27 Thread Dan Carpenter
This ioctl function is supposed to return a negative error code or zero on success. copy_to_user() returns zero or the number of bytes remaining to be copied. Signed-off-by: Dan Carpenter diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 457acf3..1aa373f 100644 --- a/drivers/vfio/vfi

[patch 2/3] vfio: make count unsigned to prevent integer underflow

2012-06-27 Thread Dan Carpenter
In vfio_pci_ioctl() there is a potential integer underflow where we might allocate less data than intended. We check that hdr.count is not too large, but we don't check whether it is negative: drivers/vfio/pci/vfio_pci.c 312 if (hdr.argsz - minsz < hdr.count * size || 313

Re: Request VFIO inclusion in linux-next

2012-06-27 Thread Dan Carpenter
On Wed, Jun 27, 2012 at 01:23:23PM -0600, Alex Williamson wrote: > On Wed, 2012-06-27 at 15:37 +0300, Dan Carpenter wrote: > > On Mon, Jun 25, 2012 at 10:55:52PM -0600, Alex Williamson wrote: > > > Hi, > > > > > > VFIO has been kicking around for well over a year now and has been > > > posted nume

[patch 1/3] vfio: signedness bug in vfio_config_do_rw()

2012-06-27 Thread Dan Carpenter
The "count" variable is unsigned here so the test for errors doesn't work. Signed-off-by: Dan Carpenter diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index a4f7321..10bc6a8 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_con

Re: [PATCH v2 4/6] kvm: Extend irqfd to support level interrupts

2012-06-27 Thread Gleb Natapov
On Thu, Jun 28, 2012 at 01:31:29AM +0300, Michael S. Tsirkin wrote: > On Wed, Jun 27, 2012 at 04:04:18PM -0600, Alex Williamson wrote: > > On Wed, 2012-06-27 at 18:26 +0300, Michael S. Tsirkin wrote: > > > On Tue, Jun 26, 2012 at 11:09:46PM -0600, Alex Williamson wrote: > > > > @@ -71,6 +130,14 @@

[PATCH 2/2] KVM: PPC: booke: Add watchdog emulation

2012-06-27 Thread Bharat Bhushan
This patch adds the watchdog emulation in KVM. The watchdog emulation is enabled by KVM_ENABLE_CAP(KVM_CAP_PPC_WDT) ioctl. The kernel timer are used for watchdog emulation and emulates h/w watchdog state machine. On watchdog timer expiry, it exit to QEMU if TCR.WRC is non ZERO. QEMU can reset/shutd

[RFC PATCH 16/18] KVM: add kvm_arch_vcpu_prevent_run to prevent VM ENTER when NMI is received

2012-06-27 Thread Tomoki Sekiyama
Since NMI can not be disabled around VM enter, there is a race between receiving NMI to kick a guest and entering the guests on slave CPUs.If the NMI is received just before entering VM, after the NMI handler is invoked, it continues entering the guest and the effect of the NMI will be lost. This

[RFC PATCH 14/18] KVM: Directly handle interrupts by guests without VM EXIT on slave CPUs

2012-06-27 Thread Tomoki Sekiyama
Make interrupts on slave CPUs handled by guests without VM EXIT. This reduces CPU usage by the host to transfer interrupts of assigned PCI devices from the host to guests. It also reduces cost of VM EXIT and quickens response of guests to the interrupts. When a slave CPU is dedicated to a vCPU, ex

[RFC PATCH 18/18] x86: request TLB flush to slave CPU using NMI

2012-06-27 Thread Tomoki Sekiyama
For slave CPUs, it is inapropriate to request TLB flush using IPI. because the IPI may be sent to a KVM guest when the slave CPU is running the guest with direct interrupt routing. Instead, it registers a TLB flush request in per-cpu bitmask and send a NMI to interrupt execution of the guest. Then

[RFC PATCH 17/18] KVM: route assigned devices' MSI/MSI-X directly to guests on slave CPUs

2012-06-27 Thread Tomoki Sekiyama
When a PCI device is assigned to a guest running on slave CPUs, this routes the device's MSI/MSI-X interrupts directly to the guest. Because the guest uses a different interrupt vector from the host, vector remapping is required. This is safe because slave CPUs only handles interrupts for the assi

[RFC PATCH 03/18] x86: Support hrtimer on slave CPUs

2012-06-27 Thread Tomoki Sekiyama
Adds a facility to use hrtimer on slave CPUs. To initialize hrtimer when slave CPUs are activated, and to shutdown hrtimer when slave CPUs are stopped, this patch adds the slave cpu notifier chain, which call registered callbacks when slave CPUs are up, dying, and died. The registered callbacks a

[RFC PATCH 07/18] KVM: handle page faults occured in slave CPUs on online CPUs

2012-06-27 Thread Tomoki Sekiyama
Page faults which occured by the guest running on slave CPUs cannot be handled on slave CPUs because it is running on idle process context. With this patch, the page fault happened in a slave CPU is notified to online CPU using struct kvm_access_fault, and is handled after the user-process for the

[RFC PATCH 10/18] KVM: proxy slab operations for slave CPUs on online CPUs

2012-06-27 Thread Tomoki Sekiyama
Add some fix-ups that proxy slab operations on online CPUs for the guest, in order to avoid touching slab on slave CPUs where some slab functions are not activated. Currently, slab may be touched on slave CPUs in following 3 cases. For each cases, the fix-ups below are introduced: * kvm_mmu_commi

[RFC PATCH 15/18] KVM: vmx: Add definitions PIN_BASED_PREEMPTION_TIMER

2012-06-27 Thread Tomoki Sekiyama
Add some definitions to use PIN_BASED_PREEMPTION_TIMER. When PIN_BASED_PREEMPTION_TIMER is enabled, the guest will exit with reason=EXIT_REASON_PREEMPTION_TIMER when the counter specified in VMX_PREEMPTION_TIMER_VALUE becomes 0. This patch also adds a dummy handler for EXIT_REASON_PREEMPTION_TIMER

[RFC PATCH 12/18] x86/apic: Enable external interrupt routing to slave CPUs

2012-06-27 Thread Tomoki Sekiyama
Enable APIC to handle interrupts on slave CPUs, and enables interrupt routing to slave CPUs by setting IRQ affinity. As slave CPUs which run a KVM guest handle external interrupts directly in the vCPUs, the guest's vector/IRQ mapping is different from the host's. That requires interrupts to be rou

[RFC PATCH 13/18] x86/apic: IRQ vector remapping on slave for slave CPUs

2012-06-27 Thread Tomoki Sekiyama
Add a facility to use IRQ vector different from online CPUs on slave CPUs. When alternative vector for IRQ is registered by remap_slave_vector_irq() and the IRQ affinity is set only to slave CPUs, the device is configured to use the alternative vector. Current patch only supports MSI and Intel CP

[RFC PATCH 11/18] KVM: no exiting from guest when slave CPU halted

2012-06-27 Thread Tomoki Sekiyama
Avoid exiting from a guest on slave CPU even if HLT instruction is executed. Since the slave CPU is dedicated to a vCPU, exit on HLT is not required, and avoiding VM exit will improve the guest's performance. This is a partial revert of 10166744b80a ("KVM: VMX: remove yield_on_hlt") Cc:

[RFC PATCH 04/18] KVM: Replace local_irq_disable/enable with local_irq_save/restore

2012-06-27 Thread Tomoki Sekiyama
Replace local_irq_disable/enable with local_irq_save/restore in the path where is executed on slave CPUs. This is required because irqs are disabled while the guest is running on the slave CPUs. Signed-off-by: Tomoki Sekiyama Cc: Avi Kivity Cc: Marcelo Tosatti Cc: Thomas Gleixner Cc: Ingo Moln

[RFC PATCH 09/18] KVM: Go back to online CPU on VM exit by external interrupt

2012-06-27 Thread Tomoki Sekiyama
If the slave CPU receives an interrupt in running a guest, current implementation must once go back to onilne CPUs to handle the interupt. This behavior will be replaced by later patch, which introduces direct interrupt handling mechanism by the guest. Signed-off-by: Tomoki Sekiyama Cc: Avi Kivi

[RFC PATCH 08/18] KVM: Add KVM_GET_SLAVE_CPU and KVM_SET_SLAVE_CPU to vCPU ioctl

2012-06-27 Thread Tomoki Sekiyama
Add an interface to set/get slave CPU dedicated to the vCPUs. By calling ioctl with KVM_GET_SLAVE_CPU, users can get the slave CPU id for the vCPU. -1 is returned if a slave CPU is not set. By calling ioctl with KVM_SET_SLAVE_CPU, users can dedicate the specified slave CPU to the vCPU. The CPU mu

[RFC PATCH 06/18] KVM: Add facility to run guests on slave CPUs

2012-06-27 Thread Tomoki Sekiyama
Add path to migrate execution of vcpu_enter_guest to a slave CPU when vcpu->arch.slave_cpu is set. After moving to the slave CPU, it goes back to the online CPU when the guest is exited by reasons that cannot be handled by the slave CPU only (e.g. handling async page faults). On migration, kvm_ar

[RFC PATCH 05/18] KVM: Enable/Disable virtualization on slave CPUs are activated/dying

2012-06-27 Thread Tomoki Sekiyama
Enable virtualization when slave CPUs are activated, and disable when the CPUs are dying using slave CPU notifier call chain. In x86, TSC kHz must also be initialized by tsc_khz_changed when the new slave CPUs are activated. Signed-off-by: Tomoki Sekiyama Cc: Avi Kivity Cc: Marcelo Tosatti Cc:

[RFC PATCH 02/18] x86: Add a facility to use offlined CPUs as slave CPUs

2012-06-27 Thread Tomoki Sekiyama
Add a facility of using offlined CPUs as slave CPUs. Slave CPUs are specialized to exclusively run functions specified by online CPUs, which do not run user processes. To use this feature, build the kernel with CONFIG_SLAVE_CPU=y. A slave CPU is launched by calling cpu_slave_up() when the CPU is

[RFC PATCH 01/18] x86: Split memory hotplug function from cpu_up() as cpu_memory_up()

2012-06-27 Thread Tomoki Sekiyama
Split memory hotplug function from cpu_up() as cpu_memory_up(), which will be used for assigning memory area to off-lined cpus at following patch in this series. Signed-off-by: Tomoki Sekiyama Cc: Avi Kivity Cc: Marcelo Tosatti Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" --- i

[RFC PATCH 00/18] KVM: x86: CPU isolation and direct interrupts handling by guests

2012-06-27 Thread Tomoki Sekiyama
Hello, This RFC patch series provides facility to dedicate CPUs to KVM guests and enable the guests to handle interrupts from passed-through PCI devices directly (without VM exit and relay by the host). With this feature, we can improve throughput and response time of the device and the host's CP

[PATCH 1/2] KVM: PPC: Critical interrupt emulation support

2012-06-27 Thread Bharat Bhushan
rfci instruction and CSRR0/1 registers are emulated. Signed-off-by: Scott Wood Signed-off-by: Stuart Yoder Signed-off-by: Bharat Bhushan --- arch/powerpc/kvm/booke_emulate.c | 25 + 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/kvm/booke

Re: [PATCH v2 5/6] kvm: KVM_EOIFD, an eventfd for EOIs

2012-06-27 Thread Alex Williamson
On Wed, 2012-06-27 at 17:51 +0300, Gleb Natapov wrote: > On Wed, Jun 27, 2012 at 08:29:04AM -0600, Alex Williamson wrote: > > On Wed, 2012-06-27 at 16:58 +0300, Gleb Natapov wrote: > > > On Tue, Jun 26, 2012 at 11:10:08PM -0600, Alex Williamson wrote: > > > > This new ioctl enables an eventfd to be

Re: [PATCH v2 4/6] kvm: Extend irqfd to support level interrupts

2012-06-27 Thread Alex Williamson
On Thu, 2012-06-28 at 01:28 +0300, Michael S. Tsirkin wrote: > On Wed, Jun 27, 2012 at 03:28:19PM -0600, Alex Williamson wrote: > > On Thu, 2012-06-28 at 00:14 +0300, Michael S. Tsirkin wrote: > > > On Wed, Jun 27, 2012 at 02:59:09PM -0600, Alex Williamson wrote: > > > > On Wed, 2012-06-27 at 12:51

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 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 manage more alloc-ed/f

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

2012-06-27 Thread Xiao Guangrong
On 06/28/2012 10:01 AM, Takuya Yoshikawa wrote: > 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 > --- > arch/x86/include/asm/kvm_host.h |

Re: [PATCH 2/4] KVM: Use __print_hex() for kvm_emulate_insn tracepoint

2012-06-27 Thread Steven Rostedt
On Thu, 2012-06-28 at 10:59 +0900, Namhyung Kim wrote: > Ok, thanks. But how about other ones? Did you add all of 4 into you > queue? Ah, no I didn't. I actually would like Arnaldo to do that. Arnaldo, Can you pull patches 1,3 & 4 into your repo, and add my: Acked-by: Steven Rostedt Thanks!

Re: [PATCH] kvm: handle last_boosted_vcpu = 0 case

2012-06-27 Thread Raghavendra K T
On 06/21/2012 12:13 PM, Gleb Natapov wrote: On Tue, Jun 19, 2012 at 04:51:04PM -0400, Rik van Riel wrote: On Wed, 20 Jun 2012 01:50:50 +0530 Raghavendra K T wrote: In ple handler code, last_boosted_vcpu (lbv) variable is serving as reference point to start when we enter. Also statistical

Re: [PATCH 2/4] KVM: Use __print_hex() for kvm_emulate_insn tracepoint

2012-06-27 Thread Namhyung Kim
On Wed, 27 Jun 2012 21:52:44 -0400, Steven Rostedt wrote: > On Thu, 2012-06-28 at 10:16 +0900, Namhyung Kim wrote: >> [CC'ing David] >> >> Hi, Steve >> >> On Wed, 27 Jun 2012 09:20:24 -0400, Steven Rostedt wrote: >> > On Wed, 2012-06-27 at 15:54 +0300, Avi Kivity wrote: >> > >> >> Acked-by: Avi K

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

2012-06-27 Thread Takuya Yoshikawa
When we invalidate a THP page, we call the handler with the same rmap_pde argument 512 times in the following loop: for each guest page in the range for each level unmap using rmap This patch avoids these extra handler calls by changing the loop order like this: for each level

[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 --- arch/x86/include/asm/kvm_host.h |2 +- arch/x86/kvm/mmu.c |6 +++--- arch/

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

2012-06-27 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 usi

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

2012-06-27 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 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 Cc: Alexander Graf Cc: Paul Mackerras --- arch/powerpc/kvm/book3s_64_mmu_hv.c |6 +++--- arch/x86/kvm

[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 --- 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/mmu.c +++ b/arch/x86/kvm/mmu.c @

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

Re: [PATCH 2/4] KVM: Use __print_hex() for kvm_emulate_insn tracepoint

2012-06-27 Thread Steven Rostedt
On Thu, 2012-06-28 at 10:16 +0900, Namhyung Kim wrote: > [CC'ing David] > > Hi, Steve > > On Wed, 27 Jun 2012 09:20:24 -0400, Steven Rostedt wrote: > > On Wed, 2012-06-27 at 15:54 +0300, Avi Kivity wrote: > > > >> Acked-by: Avi Kivity > > > > Thanks Avi! > > > > Can you give me your ack's too (

Re: [PATCH next] kvm: Use pr_

2012-06-27 Thread Joe Perches
On Wed, 2012-06-27 at 21:44 -0300, Marcelo Tosatti wrote: > The advantage is the added prefix? All messages are automatically prefixed. For instance: > > - printk(KERN_WARNING "Fail to find correlated MSI-X entry!\n"); > > + pr_warn("Fail to find correlated MSI-X entry!\n");

Re: [PATCH] kvm: First step to push iothread lock out of inner run loop

2012-06-27 Thread Marcelo Tosatti
On Sat, Jun 23, 2012 at 11:22:07AM +0200, Jan Kiszka wrote: > On 2012-06-23 02:22, Marcelo Tosatti wrote: > > On Sat, Jun 23, 2012 at 12:55:49AM +0200, Jan Kiszka wrote: > >> Should have declared this [RFC] in the subject and CC'ed kvm... > >> > >> On 2012-06-23 00:45, Jan Kiszka wrote: > >>> This

Re: [PATCH next] kvm: Use pr_

2012-06-27 Thread Marcelo Tosatti
The advantage is the added prefix? $ grep limit Documentation/CodingStyle The limit on the length of lines is 80 columns and this is a strongly preferred limit. On Wed, Jun 13, 2012 at 08:20:21PM -0700, Joe Perches wrote: > Use a more current logging style. > > Convert printks to pr_. > Add pr

Re: [PATCH 2/2] [TRIVIAL]KVM: fix a typo in comment

2012-06-27 Thread Marcelo Tosatti
On Fri, Jun 15, 2012 at 11:34:31AM +0800, Guo Chao wrote: > > Signed-off-by: Guo Chao > --- > arch/x86/kvm/vmx.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index f48cef3..7593693 100644 > --- a/arch/x86/kvm/vmx.c > +++

Re: [PATCH 2/4] KVM: Use __print_hex() for kvm_emulate_insn tracepoint

2012-06-27 Thread Namhyung Kim
[CC'ing David] Hi, Steve On Wed, 27 Jun 2012 09:20:24 -0400, Steven Rostedt wrote: > On Wed, 2012-06-27 at 15:54 +0300, Avi Kivity wrote: > >> Acked-by: Avi Kivity > > Thanks Avi! > Can you give me your ack's too (for this and other ones in the series)? And if you ok, I can route this and futur

Re: [PATCH 5/6 v5] deal with guest panicked event accoring to -onpanic parameter

2012-06-27 Thread Wen Congyang
At 06/27/2012 10:39 PM, Jan Kiszka Wrote: > On 2012-06-27 09:02, Wen Congyang wrote: >> When the guest is panicked, it will write 0x1 to the port KVM_PV_PORT. >> So if qemu reads 0x1 from this port, we can do the folloing three >> things according to the parameter -onpanic: >> 1. emit QEVENT_GUEST_

Re: [PATCH v2 4/6] kvm: Extend irqfd to support level interrupts

2012-06-27 Thread Michael S. Tsirkin
On Wed, Jun 27, 2012 at 04:04:18PM -0600, Alex Williamson wrote: > On Wed, 2012-06-27 at 18:26 +0300, Michael S. Tsirkin wrote: > > On Tue, Jun 26, 2012 at 11:09:46PM -0600, Alex Williamson wrote: > > > @@ -71,6 +130,14 @@ irqfd_inject(struct work_struct *work) > > > kvm_set_irq(kvm, KVM_USERSPAC

Re: [PATCH v2 4/6] kvm: Extend irqfd to support level interrupts

2012-06-27 Thread Michael S. Tsirkin
On Wed, Jun 27, 2012 at 03:28:19PM -0600, Alex Williamson wrote: > On Thu, 2012-06-28 at 00:14 +0300, Michael S. Tsirkin wrote: > > On Wed, Jun 27, 2012 at 02:59:09PM -0600, Alex Williamson wrote: > > > On Wed, 2012-06-27 at 12:51 +0300, Michael S. Tsirkin wrote: > > > > On Tue, Jun 26, 2012 at 11:

Re: [PATCH v2 4/6] kvm: Extend irqfd to support level interrupts

2012-06-27 Thread Michael S. Tsirkin
On Wed, Jun 27, 2012 at 02:59:09PM -0600, Alex Williamson wrote: > On Wed, 2012-06-27 at 12:51 +0300, Michael S. Tsirkin wrote: > > On Tue, Jun 26, 2012 at 11:09:46PM -0600, Alex Williamson wrote: > > > In order to inject an interrupt from an external source using an > > > irqfd, we need to allocat

Re: [PATCH v2 4/6] kvm: Extend irqfd to support level interrupts

2012-06-27 Thread Alex Williamson
On Wed, 2012-06-27 at 18:26 +0300, Michael S. Tsirkin wrote: > On Tue, Jun 26, 2012 at 11:09:46PM -0600, Alex Williamson wrote: > > @@ -71,6 +130,14 @@ irqfd_inject(struct work_struct *work) > > kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, 0); > > } > > > > +static void > > +irq

Re: [PATCH] pseries: Add support for new KVM hash table control call

2012-06-27 Thread Alexander Graf
On 27.06.2012, at 23:30, Benjamin Herrenschmidt wrote: > On Wed, 2012-06-27 at 14:30 +0200, Alexander Graf wrote: >> Thanks, applied to ppc-next. Next time, please base on top of a newer >> git base - I had to manually fix the patch to apply. > > It was based on top of qemu master from yesterday

Re: [PATCH] pseries: Add support for new KVM hash table control call

2012-06-27 Thread Benjamin Herrenschmidt
On Wed, 2012-06-27 at 14:30 +0200, Alexander Graf wrote: > Thanks, applied to ppc-next. Next time, please base on top of a newer > git base - I had to manually fix the patch to apply. It was based on top of qemu master from yesterday. As you know that's what I work on top of. Did you make sure you

Re: [PATCH v2 4/6] kvm: Extend irqfd to support level interrupts

2012-06-27 Thread Alex Williamson
On Thu, 2012-06-28 at 00:14 +0300, Michael S. Tsirkin wrote: > On Wed, Jun 27, 2012 at 02:59:09PM -0600, Alex Williamson wrote: > > On Wed, 2012-06-27 at 12:51 +0300, Michael S. Tsirkin wrote: > > > On Tue, Jun 26, 2012 at 11:09:46PM -0600, Alex Williamson wrote: > > > > In order to inject an inter

Re: [PATCH v2 4/6] kvm: Extend irqfd to support level interrupts

2012-06-27 Thread Alex Williamson
On Wed, 2012-06-27 at 12:34 +0300, Michael S. Tsirkin wrote: > On Tue, Jun 26, 2012 at 11:09:46PM -0600, Alex Williamson wrote: > > In order to inject an interrupt from an external source using an > > irqfd, we need to allocate a new irq_source_id. This allows us to > > assert and (later) de-asser

Re: [PATCH v2 4/6] kvm: Extend irqfd to support level interrupts

2012-06-27 Thread Alex Williamson
On Wed, 2012-06-27 at 12:51 +0300, Michael S. Tsirkin wrote: > On Tue, Jun 26, 2012 at 11:09:46PM -0600, Alex Williamson wrote: > > In order to inject an interrupt from an external source using an > > irqfd, we need to allocate a new irq_source_id. This allows us to > > assert and (later) de-asser

Re: [KVM][Kemari]: Build error fix

2012-06-27 Thread Sterling Windmill
Is Kemari still in active development? On Sun, Dec 4, 2011 at 9:45 PM, OHMURA Kei wrote: > On 2011/12/02 21:51, Pradeep Kumar wrote: >> It fixes build failure. >> >> I hit this error, after succsfull migration and sync. >> >> (qemu) qemu-system-x86_64: fill buffer failed, Interrupted system call

Re: [PATCH] kvm: handle last_boosted_vcpu = 0 case with benchmark detail attachment

2012-06-27 Thread Raghavendra K T
On 06/28/2012 01:57 AM, Raghavendra K T wrote: On 06/24/2012 12:04 AM, Raghavendra K T wrote: On 06/23/2012 02:30 AM, Raghavendra K T wrote: On 06/22/2012 08:41 PM, Andrew Jones wrote: [...] (benchmark values will be attached in reply to this mail) pv_benchmark_summary.bz2 Description: app

Re: [PATCH] kvm: handle last_boosted_vcpu = 0 case

2012-06-27 Thread Raghavendra K T
On 06/24/2012 12:04 AM, Raghavendra K T wrote: On 06/23/2012 02:30 AM, Raghavendra K T wrote: On 06/22/2012 08:41 PM, Andrew Jones wrote: [...] My run for other benchmarks did not have Rik's patches, so re-spinning everything with that now. Here is the detailed info on env and benchmark I am

Re: [PATCH v2 3/6] kvm: Sanitize KVM_IRQFD flags

2012-06-27 Thread Michael S. Tsirkin
On Wed, Jun 27, 2012 at 02:12:18PM -0600, Alex Williamson wrote: > On Wed, 2012-06-27 at 12:21 +0300, Michael S. Tsirkin wrote: > > On Tue, Jun 26, 2012 at 11:09:32PM -0600, Alex Williamson wrote: > > > We only know of one so far. > > > > > > Signed-off-by: Alex Williamson > > > > Ugh. So we hav

Re: [PATCH v2 3/6] kvm: Sanitize KVM_IRQFD flags

2012-06-27 Thread Alex Williamson
On Wed, 2012-06-27 at 12:21 +0300, Michael S. Tsirkin wrote: > On Tue, Jun 26, 2012 at 11:09:32PM -0600, Alex Williamson wrote: > > We only know of one so far. > > > > Signed-off-by: Alex Williamson > > Ugh. So we have a bug: we should have sanitized the fields. > If there's buggy userspace that

Re: Request VFIO inclusion in linux-next

2012-06-27 Thread Alex Williamson
On Wed, 2012-06-27 at 15:37 +0300, Dan Carpenter wrote: > On Mon, Jun 25, 2012 at 10:55:52PM -0600, Alex Williamson wrote: > > Hi, > > > > VFIO has been kicking around for well over a year now and has been > > posted numerous times for review. The pre-requirements are finally > > available in lin

Re: [PATCH v3 4/5] Sysfs: Export VMCSINFO via sysfs

2012-06-27 Thread Greg KH
On Wed, Jun 27, 2012 at 04:54:54PM +0800, Yanfei Zhang wrote: > This patch export offsets of fields via /sys/devices/cpu/vmcs/. > Individual offsets are contained in subfiles named by the filed's > encoding, e.g.: /sys/devices/cpu/vmcs/0800 > > Signed-off-by: zhangyanfei > --- > drivers/base/cor

Re: linux-next: Tree for Jun 27 (vfio)

2012-06-27 Thread Alex Williamson
On Wed, 2012-06-27 at 09:09 -0700, Randy Dunlap wrote: > On 06/26/2012 08:22 PM, Stephen Rothwell wrote: > > > Hi all, > > > > This tree was not built between each merge, but only after merging all > > the trees. > > > > Changes since 20120626: > > > > New tree: vfio > > > on x86_64: > > C

Re: race between kvm-kmod-3.0 and kvm-kmod-3.3 // was: race condition in qemu-kvm-1.0.1

2012-06-27 Thread Jan Kiszka
On 2012-06-27 17:39, Peter Lieven wrote: > Hi all, > > i debugged this further and found out that kvm-kmod-3.0 is working with > qemu-kvm-1.0.1 while kvm-kmod-3.3 and kvm-kmod-3.4 are not. What is > working as well is kvm-kmod-3.4 with an old userspace (qemu-kvm-0.13.0). > Has anyone a clue which

[PATCH v2 7/7] kvm: Stop flushing coalesced MMIO on vmexit

2012-06-27 Thread Jan Kiszka
The memory subsystem will now take care of flushing whenever affected regions are accessed or the memory mapping changes. Signed-off-by: Jan Kiszka --- kvm-all.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index f8e4328..a1d32f6 100644 --- a/kv

[PATCH v2 4/7] memory: Fold memory_region_update_topology into memory_region_transaction_commit

2012-06-27 Thread Jan Kiszka
Simplify the code as we are using now only a subset of the original features of memory_region_update_topology. Signed-off-by: Jan Kiszka --- memory.c | 39 +++ 1 files changed, 11 insertions(+), 28 deletions(-) diff --git a/memory.c b/memory.c index 8b1218e

[PATCH v2 1/7] i82378: Remove bogus MMIO coalescing

2012-06-27 Thread Jan Kiszka
This MMIO area is an entry gate to legacy PC ISA devices, addressed via PIO over there. Quite a few of the PIO ports have side effects on access like starting/stopping timers that must be executed properly ordered /wrt the CPU. So we have to remove the coalescing mark. Acked-by: Hervé Poussineau

[PATCH v2 3/7] memory: Use transaction_begin/commit also for single-step operations

2012-06-27 Thread Jan Kiszka
Wrap also simple operations consisting only of a single step with memory_region_transaction_begin/commit. This allows to perform additional steps like coalesced MMIO flushing from a single place. This requires dropping some micro-optimizations: The skipping of topology updates after updating disab

[PATCH v2 5/7] memory: Flush coalesced MMIO on mapping and state changes

2012-06-27 Thread Jan Kiszka
Flush pending coalesced MMIO before performing mapping or state changes that could affect the event orderings or route the buffered requests to a wrong region. Signed-off-by: Jan Kiszka --- memory.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/memory.c b/memory.c inde

[PATCH v2 6/7] VGA: Flush coalesced MMIO on related MMIO/PIO accesses

2012-06-27 Thread Jan Kiszka
In preparation of stopping to flush coalesced MMIO unconditionally on vmexits, mark VGA MMIO and PIO regions as synchronous /wrt coalesced MMIO and flush the buffer explicitly on PIO accesses that do not use generic memory regions yet. Signed-off-by: Jan Kiszka --- hw/cirrus_vga.c |7 +++

[PATCH v2 2/7] memory: Flush coalesced MMIO on selected region access

2012-06-27 Thread Jan Kiszka
Instead of flushing pending coalesced MMIO requests on every vmexit, this provides a mechanism to selectively flush when memory regions related to the coalesced one are accessed. This first of all includes the coalesced region itself but can also applied to other regions, e.g. of the same device, b

[PATCH v2 0/7] kvm: Get coalesced MMIO flushing out of the hot-path

2012-06-27 Thread Jan Kiszka
Changes in v2: - added memory_region_clear_flush_coalesced - call memory_region_clear_flush_coalesced from memory_region_clear_coalescing - wrap all region manipulations via memory_region_transaction_begin/ commit internally - flush coalesced MMIO only on memory_region_transaction_begin

Re: [PATCH] Add a page cache-backed balloon device driver.

2012-06-27 Thread Frank Swiderski
On Wed, Jun 27, 2012 at 9:06 AM, Michael S. Tsirkin wrote: > On Wed, Jun 27, 2012 at 08:48:55AM -0700, Frank Swiderski wrote: >> On Tue, Jun 26, 2012 at 7:56 PM, Rusty Russell wrote: >> > On Wed, 27 Jun 2012 00:41:06 +0300, "Michael S. Tsirkin" >> > wrote: >> >> On Tue, Jun 26, 2012 at 01:32:58

Re: [PATCH] Add a page cache-backed balloon device driver.

2012-06-27 Thread Michael S. Tsirkin
On Wed, Jun 27, 2012 at 08:48:55AM -0700, Frank Swiderski wrote: > On Tue, Jun 26, 2012 at 7:56 PM, Rusty Russell wrote: > > On Wed, 27 Jun 2012 00:41:06 +0300, "Michael S. Tsirkin" > > wrote: > >> On Tue, Jun 26, 2012 at 01:32:58PM -0700, Frank Swiderski wrote: > >> > This implementation of a v

Re: [PATCH] Add a page cache-backed balloon device driver.

2012-06-27 Thread Frank Swiderski
On Tue, Jun 26, 2012 at 7:56 PM, Rusty Russell wrote: > On Wed, 27 Jun 2012 00:41:06 +0300, "Michael S. Tsirkin" > wrote: >> On Tue, Jun 26, 2012 at 01:32:58PM -0700, Frank Swiderski wrote: >> > This implementation of a virtio balloon driver uses the page cache to >> > "store" pages that have be

race between kvm-kmod-3.0 and kvm-kmod-3.3 // was: race condition in qemu-kvm-1.0.1

2012-06-27 Thread Peter Lieven
Hi all, i debugged this further and found out that kvm-kmod-3.0 is working with qemu-kvm-1.0.1 while kvm-kmod-3.3 and kvm-kmod-3.4 are not. What is working as well is kvm-kmod-3.4 with an old userspace (qemu-kvm-0.13.0). Has anyone a clue which new KVM feature could cause this if a vcpu is in

[PATCH v3 03/26] KVM: x86 emulator: change ->get_cpuid() accessor to use the x86 semantics

2012-06-27 Thread Avi Kivity
Instead of getting an exact leaf, follow the spec and fall back to the last main leaf instead. This lets us easily emulate the cpuid instruction in the emulator. Signed-off-by: Avi Kivity --- arch/x86/include/asm/kvm_emulate.h | 4 +-- arch/x86/kvm/emulate.c | 53 ++

[PATCH v3 06/26] KVM: x86 emulator: fix LIDT/LGDT in long mode

2012-06-27 Thread Avi Kivity
The operand size for these instructions is 8 bytes in long mode, even without a REX prefix. Set it explicitly. Triggered while booting Linux with emulate_invalid_guest_state=1. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/x86

[PATCH v3 11/26] KVM: Fix SS default ESP/EBP based addressing

2012-06-27 Thread Avi Kivity
We correctly default to SS when BP is used as a base in 16-bit address mode, but we don't do that for 32-bit mode. Fix by adjusting the default to SS when either ESP or EBP is used as the base register. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 17 ++--- 1 file changed,

[PATCH v3 05/26] KVM: x86 emulator: allow loading null SS in long mode

2012-06-27 Thread Avi Kivity
Null SS is valid in long mode; allow loading it. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index db95a55..fe4340f 100644 --- a/arch/x86/kvm/emulate.c +++ b/

[PATCH v3 10/26] KVM: x86 emulator: initialize memop

2012-06-27 Thread Avi Kivity
memop is not initialized; this can lead to a two-byte operation following a 4-byte operation to see garbage values. Usually truncation fixes things fot us later on, but at least in one case (call abs) it doesn't. Fix by moving memop to the auto-initialized field area. Signed-off-by: Avi Kivity

Re: [PATCH v2 4/6] kvm: Extend irqfd to support level interrupts

2012-06-27 Thread Michael S. Tsirkin
On Tue, Jun 26, 2012 at 11:09:46PM -0600, Alex Williamson wrote: > @@ -71,6 +130,14 @@ irqfd_inject(struct work_struct *work) > kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, 0); > } > > +static void > +irqfd_inject_level(struct work_struct *work) > +{ > + struct _irqfd *irq

[PATCH v3 26/26] KVM: VMX: Emulate invalid guest state by default

2012-06-27 Thread Avi Kivity
Our emulation should be complete enough that we can emulate guests while they are in big real mode, or in a mode transition that is not virtualizable without unrestricted guest support. Signed-off-by: Avi Kivity --- arch/x86/kvm/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -

[PATCH v3 20/26] KVM: VMX: Improve error reporting during invalid guest state emulation

2012-06-27 Thread Avi Kivity
If instruction emulation fails, report it properly to userspace. Signed-off-by: Avi Kivity --- arch/x86/kvm/vmx.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 661df185..591dcea 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x8

[PATCH v3 17/26] KVM: x86 emulator: split push logic from push opcode emulation

2012-06-27 Thread Avi Kivity
This allows us to reuse the code without populating ctxt->src and overriding ctxt->op_bytes. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 30f4912..acc647d

[PATCH v3 13/26] KVM: VMX: Fix interrupt exit condition during emulation

2012-06-27 Thread Avi Kivity
Checking EFLAGS.IF is incorrect as we might be in interrupt shadow. If that is the case, the main loop will notice that and not inject the interrupt, causing an endless loop. Fix by using vmx_interrupt_allowed() to check if we can inject an interrupt instead. Signed-off-by: Avi Kivity --- arch

[PATCH v3 14/26] KVM: VMX: Continue emulating after batch exhausted

2012-06-27 Thread Avi Kivity
If we return early from an invalid guest state emulation loop, make sure we return to it later if the guest state is still invalid. Signed-off-by: Avi Kivity --- arch/x86/kvm/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index d

[PATCH v3 24/26] KVM: x86 emulator: make loading TR set the busy bit

2012-06-27 Thread Avi Kivity
Guest software doesn't actually depend on it, but vmx will refuse us entry if we don't. Set the bit in both the cached segment and memory, just to be nice. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/kv

[PATCH v3 25/26] KVM: x86 emulator: implement LTR

2012-06-27 Thread Avi Kivity
Opcode 0F 00 /3. Encountered during Windows XP secondary processor bringup. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 92a1add..97d9a99 100644 --- a/ar

[PATCH v3 22/26] KVM: x86 emulator: emulate LLDT

2012-06-27 Thread Avi Kivity
Opcode 0F 00 /2. Used by isolinux durign the protected mode transition. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index cfa5cc3..7b575ad 100644 --- a/arch/x8

[PATCH v3 23/26] KVM: x86 emulator: make read_segment_descriptor() return the address

2012-06-27 Thread Avi Kivity
Some operations want to modify the descriptor later on, so save the address for future use. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 7b575ad..99e3df

[PATCH v3 21/26] KVM: x86 emulator: emulate BSWAP

2012-06-27 Thread Avi Kivity
Opcodes 0F C8 - 0F CF. Used by the SeaBIOS cdrom code (though not in big real mode). Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index b4b326e..cfa5

[PATCH v3 19/26] KVM: VMX: Stop invalid guest state emulation on pending event

2012-06-27 Thread Avi Kivity
Process the event, possibly injecting an interrupt, before continuing. Signed-off-by: Avi Kivity --- arch/x86/kvm/vmx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 26e6bdf..661df185 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c

[PATCH v3 18/26] KVM: x86 emulator: implement ENTER

2012-06-27 Thread Avi Kivity
Opcode C8. Only ENTER with lexical nesting depth 0 is implemented, since others are very rare. We'll fail emulation if nonzero lexical depth is used so data is not corrupted. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 28 +++- 1 file changed, 27 insertions(+

[PATCH v3 16/26] KVM: x86 emulator: fix byte-sized MOVZX/MOVSX

2012-06-27 Thread Avi Kivity
Commit 2adb5ad9fe1 removed ByteOp from MOVZX/MOVSX, replacing them by SrcMem8, but neglected to fix the dependency in the emulation code on ByteOp. This caused the instruction not to have any effect in some circumstances. Fix by replacing the check for ByteOp with the equivalent src.op_bytes == 1

[PATCH v3 15/26] KVM: x86 emulator: emulate LAHF

2012-06-27 Thread Avi Kivity
Opcode 9F. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 5053e9e..90b549e 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3227,6 +3227,13

[PATCH v3 12/26] KVM: x86 emulator: emulate SGDT/SIDT

2012-06-27 Thread Avi Kivity
Opcodes 0F 01 /0 and 0F 01 /1 Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 33 +++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 7552c0a..5053e9e 100644 --- a/arch/x86/kvm/emulate.c +++

[PATCH v3 09/26] KVM: x86 emulator: emulate LEAVE

2012-06-27 Thread Avi Kivity
Opcode c9; used by some variants of Windows during boot, in big real mode. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 24c8425..33ccd75 100

[PATCH v3 08/26] KVM: VMX: Limit iterations with emulator_invalid_guest_state

2012-06-27 Thread Avi Kivity
Otherwise, if the guest ends up looping, we never exit the srcu critical section, which causes synchronize_srcu() to hang. Signed-off-by: Avi Kivity --- arch/x86/kvm/vmx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index a9c0e40.

  1   2   3   >