Re: [PATCH] x86: Add a Kconfig shortcut for a kvm-bootable kernel

2013-04-17 Thread Borislav Petkov
On Tue, Apr 16, 2013 at 08:38:56PM -0400, Sasha Levin wrote: select NET select NETDEVICES select PCI select BLOCK select BLK_DEV select NETWORK_FILESYSTEMS select INET select EXPERIMENTAL select TTY select SERIAL_8250 select

Re: [GIT PULL v2] KVM/ARM Minor fixes for 3.9

2013-04-17 Thread Marc Zyngier
On Tue, 16 Apr 2013 16:25:10 -0700, Christoffer Dall cd...@cs.columbia.edu wrote: The following changes since commit 31880c37c11e28cb81c70757e38392b42e695dc6: Linux 3.9-rc6 (2013-04-07 20:49:54 -0700) are available in the git repository at:

Re: [GIT PULL v2] KVM/ARM Minor fixes for 3.9

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 02:10:01AM -0700, Christoffer Dall wrote: On Wed, Apr 17, 2013 at 1:05 AM, Marc Zyngier marc.zyng...@arm.com wrote: On Tue, 16 Apr 2013 16:25:10 -0700, Christoffer Dall cd...@cs.columbia.edu wrote: The following changes since commit

Re: [RFC PATCH] Emulate MOVBE

2013-04-17 Thread Paolo Bonzini
Il 16/04/2013 19:28, Gleb Natapov ha scritto: This does highlight a weakness in CPU_GET_SUPPORTED_CPUID, but I think this is not a problem in practice. With a management layer such as oVirt it's not a problem. For example, oVirt has its own library of processors. It doesn't care if

Re: [GIT PULL v2] KVM/ARM Minor fixes for 3.9

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 12:28:15PM +0200, Alexander Graf wrote: On 17.04.2013, at 12:17, Christoffer Dall wrote: On Wed, Apr 17, 2013 at 2:20 AM, Gleb Natapov g...@redhat.com wrote: On Wed, Apr 17, 2013 at 02:10:01AM -0700, Christoffer Dall wrote: On Wed, Apr 17, 2013 at 1:05

Re: [PATCH -v2] kvm: Emulate MOVBE

2013-04-17 Thread Borislav Petkov
On Tue, Apr 16, 2013 at 08:42:36PM +0300, Gleb Natapov wrote: Right, and this is what we have, AFAICT. And if userspace does that what you exemplify above, you get exactly that - a feature bit not set in CPUID but KVM reporting it set means, it is emulated. There's no room for other

Re: [GIT PULL v2] KVM/ARM Minor fixes for 3.9

2013-04-17 Thread Christoffer Dall
On Wed, Apr 17, 2013 at 3:45 AM, Gleb Natapov g...@redhat.com wrote: Marcelo has sent pull request yesterday and Linus pulled it already. Sorry if I was not clear. Generally specking we should not wait so late into the release to send fixes to Linus, exceptions happen of course. I know, the

Re: [PATCH v5 2/2] tcm_vhost: Wait for pending requests in vhost_scsi_flush()

2013-04-17 Thread Michael S. Tsirkin
On Wed, Apr 17, 2013 at 09:29:53AM +0800, Asias He wrote: On Tue, Apr 16, 2013 at 08:58:27PM +0300, Michael S. Tsirkin wrote: On Tue, Apr 16, 2013 at 05:16:51PM +0800, Asias He wrote: This patch makes vhost_scsi_flush() wait for all the pending requests issued before the flush operation

Re: [GIT PULL v2] KVM/ARM Minor fixes for 3.9

2013-04-17 Thread Alexander Graf
On 17.04.2013, at 13:05, Christoffer Dall wrote: On Wed, Apr 17, 2013 at 3:45 AM, Gleb Natapov g...@redhat.com wrote: Marcelo has sent pull request yesterday and Linus pulled it already. Sorry if I was not clear. Generally specking we should not wait so late into the release to send fixes to

Re: [GIT PULL v2] KVM/ARM Minor fixes for 3.9

2013-04-17 Thread Christoffer Dall
On Wed, Apr 17, 2013 at 4:08 AM, Alexander Graf ag...@suse.de wrote: On 17.04.2013, at 13:05, Christoffer Dall wrote: On Wed, Apr 17, 2013 at 3:45 AM, Gleb Natapov g...@redhat.com wrote: Marcelo has sent pull request yesterday and Linus pulled it already. Sorry if I was not clear. Generally

Re: [GIT PULL v2] KVM/ARM Minor fixes for 3.9

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 04:05:31AM -0700, Christoffer Dall wrote: On Wed, Apr 17, 2013 at 3:45 AM, Gleb Natapov g...@redhat.com wrote: Marcelo has sent pull request yesterday and Linus pulled it already. Sorry if I was not clear. Generally specking we should not wait so late into the

Re: [PATCH] KVM: Allow userspace to specify memory to be used for private regions.

2013-04-17 Thread Paolo Bonzini
Il 16/04/2013 00:10, Andrew Honig ha scritto: The motivation for this patch is to fix a 20KB leak of memory in vmx.c when a VM is created and destroyed. On x86/vmx platforms KVM needs 5 pages of userspace memory per VM for architecture specific reasons. It currently allocates the pages

Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP

2013-04-17 Thread Paolo Bonzini
Il 16/04/2013 19:26, Alexander Graf ha scritto: Quite a bit of code in KVM has been conditionalized on availability of IOAPIC emulation. However, most of it is generically applicable to platforms that don't have an IOPIC, but a different type of irq chip. Introduce a new define to

[PATCH 0/10] KVM: nVMX: shadow VMCS support, v2

2013-04-17 Thread Abel Gordon
This series of patches implements shadow-vmcs capability for nested VMX. Shadow-vmcs - background and overview: In Intel VMX, vmread and vmwrite privileged instructions are used by the hypervisor to read and modify the guest and host specifications (VMCS). In a nested virtualization

Re: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c

2013-04-17 Thread Paolo Bonzini
Il 16/04/2013 19:26, Alexander Graf ha scritto: The current irq_comm.c file contains pieces of code that are generic across different irqchip implementations, as well as code that is fully IOAPIC specific. Split the generic bits out into irqchip.c. Signed-off-by: Alexander Graf

[PATCH 01/10] KVM: nVMX: Shadow-vmcs control fields/bits

2013-04-17 Thread Abel Gordon
Add definitions for all the vmcs control fields/bits required to enable vmcs-shadowing Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/include/asm/vmx.h|3 +++ arch/x86/include/uapi/asm/msr-index.h |2 ++ 2 files changed, 5 insertions(+) ---

Re: [PATCH 1/7] KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS

2013-04-17 Thread Paolo Bonzini
Il 16/04/2013 19:26, Alexander Graf ha scritto: The concept of routing interrupt lines to an irqchip is nothing that is IOAPIC specific. Every irqchip has a maximum number of pins that can be linked to irq lines. So let's add a new define that allows us to reuse generic code for non-IOAPIC

[PATCH 02/10] KVM: nVMX: Detect shadow-vmcs capability

2013-04-17 Thread Abel Gordon
Add logic required to detect if shadow-vmcs is supported by the processor. Introduce a new kernel module parameter to specify if L0 should use shadow vmcs (or not) to run L1. Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 25 - 1 file changed, 24

[PATCH 03/10] KVM: nVMX: Introduce vmread and vmwrite bitmaps

2013-04-17 Thread Abel Gordon
Prepare vmread and vmwrite bitmaps according to a pre-specified list of fields. These lists are intended to specifiy most frequent accessed fields so we can minimize the number of fields that are copied from/to the software controlled VMCS12 format to/from to processor-specific shadow vmcs. The

[PATCH 04/10] KVM: nVMX: Refactor handle_vmwrite

2013-04-17 Thread Abel Gordon
Refactor existent code so we re-use vmcs12_write_any to copy fields from the shadow vmcs specified by the link pointer (used by the processor, implementation-specific) to the VMCS12 software format used by L0 to hold the fields in L1 memory address space. Signed-off-by: Abel Gordon

Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP

2013-04-17 Thread Alexander Graf
On 17.04.2013, at 13:49, Paolo Bonzini wrote: Il 16/04/2013 19:26, Alexander Graf ha scritto: Quite a bit of code in KVM has been conditionalized on availability of IOAPIC emulation. However, most of it is generically applicable to platforms that don't have an IOPIC, but a different type of

[PATCH 05/10] KVM: nVMX: Allocate shadow vmcs

2013-04-17 Thread Abel Gordon
Allocate a shadow vmcs used by the processor to shadow part of the fields stored in the software defined VMCS12 (let L1 access fields without causing exits). Note we keep a shadow vmcs only for the current vmcs12. Once a vmcs12 becomes non-current, its shadow vmcs is released. Signed-off-by:

[PATCH 06/10] KVM: nVMX: Release shadow vmcs

2013-04-17 Thread Abel Gordon
Unmap vmcs12 and release the corresponding shadow vmcs Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) --- .before/arch/x86/kvm/vmx.c 2013-04-17 14:20:50.0 +0300 +++

Re: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c

2013-04-17 Thread Alexander Graf
On 17.04.2013, at 13:50, Paolo Bonzini wrote: Il 16/04/2013 19:26, Alexander Graf ha scritto: The current irq_comm.c file contains pieces of code that are generic across different irqchip implementations, as well as code that is fully IOAPIC specific. Split the generic bits out into

[PATCH 07/10] KVM: nVMX: Copy processor-specific shadow-vmcs to VMCS12

2013-04-17 Thread Abel Gordon
Introduce a function used to copy fields from the processor-specific shadow vmcs to the software controlled VMCS12 Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 35 +++ 1 file changed, 35 insertions(+) --- .before/arch/x86/kvm/vmx.c

[PATCH 08/10] KVM: nVMX: Copy VMCS12 to processor-specific shadow vmcs

2013-04-17 Thread Abel Gordon
Introduce a function used to copy fields from the software controlled VMCS12 to the processor-specific shadow vmcs Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 45 +++ 1 file changed, 45 insertions(+) ---

[PATCH 09/10] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs

2013-04-17 Thread Abel Gordon
Synchronize between the VMCS12 software controlled structure and the processor-specific shadow vmcs Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 24 1 file changed, 24 insertions(+) --- .before/arch/x86/kvm/vmx.c 2013-04-17 14:20:51.0

Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP

2013-04-17 Thread Paolo Bonzini
Il 17/04/2013 13:53, Alexander Graf ha scritto: arch/x86/include/uapi/asm/kvm.h |1 + include/linux/kvm_host.h|4 ++-- include/uapi/linux/kvm.h|2 +- virt/kvm/eventfd.c |6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) You need to

[PATCH 10/10] KVM: nVMX: Enable and disable shadow vmcs functionality

2013-04-17 Thread Abel Gordon
Once L1 loads VMCS12 we enable shadow-vmcs capability and copy all the VMCS12 shadowed fields to the shadow vmcs. When we release the VMCS12, we also disable shadow-vmcs capability. Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 11 +++ 1 file changed, 11

Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP

2013-04-17 Thread Alexander Graf
On 17.04.2013, at 13:54, Paolo Bonzini wrote: Il 17/04/2013 13:53, Alexander Graf ha scritto: arch/x86/include/uapi/asm/kvm.h |1 + include/linux/kvm_host.h|4 ++-- include/uapi/linux/kvm.h|2 +- virt/kvm/eventfd.c |6 +++--- 4 files changed, 7

Re: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c

2013-04-17 Thread Paolo Bonzini
Il 16/04/2013 19:26, Alexander Graf ha scritto: +#ifdef kvm_irqchip TP_printk(irqchip %s pin %u, __print_symbolic(__entry-irqchip, kvm_irqchips), __entry-pin) +#else + TP_printk(irqchip %d pin %u, __entry-irqchip, __entry-pin) +#endif Ah, spotted

Re: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c

2013-04-17 Thread Alexander Graf
On 17.04.2013, at 14:05, Paolo Bonzini wrote: Il 16/04/2013 19:26, Alexander Graf ha scritto: +#ifdef kvm_irqchip TP_printk(irqchip %s pin %u, __print_symbolic(__entry-irqchip, kvm_irqchips), __entry-pin) +#else +TP_printk(irqchip %d pin %u,

Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP

2013-04-17 Thread Paolo Bonzini
Il 17/04/2013 13:59, Alexander Graf ha scritto: Well, we just got a patch to make it at least compile, That was really just Yang (blindly?) fixing an issue I pointed out on ARM. There is no kvm user space support for IA64. The kernel side has been KConfig depending on BROKEN for a year

Re: [PATCH v5 2/2] tcm_vhost: Wait for pending requests in vhost_scsi_flush()

2013-04-17 Thread Asias He
On Wed, Apr 17, 2013 at 01:07:56PM +0300, Michael S. Tsirkin wrote: On Wed, Apr 17, 2013 at 09:29:53AM +0800, Asias He wrote: On Tue, Apr 16, 2013 at 08:58:27PM +0300, Michael S. Tsirkin wrote: On Tue, Apr 16, 2013 at 05:16:51PM +0800, Asias He wrote: This patch makes vhost_scsi_flush()

Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP

2013-04-17 Thread Alexander Graf
On 17.04.2013, at 14:06, Paolo Bonzini wrote: Il 17/04/2013 13:59, Alexander Graf ha scritto: Well, we just got a patch to make it at least compile, That was really just Yang (blindly?) fixing an issue I pointed out on ARM. There is no kvm user space support for IA64. The kernel side has

Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP

2013-04-17 Thread Paolo Bonzini
Il 17/04/2013 14:10, Alexander Graf ha scritto: Still, __KVM_HAVE_IRQCHIP is clearly a subset of __KVM_HAVE_IOAPIC; defining one without the other makes no sense and will cause compilation or link errors for trace_kvm_ack_irq. Either we drop it altogether, or we should not break compilation

Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP

2013-04-17 Thread Alexander Graf
On 17.04.2013, at 14:15, Paolo Bonzini wrote: Il 17/04/2013 14:10, Alexander Graf ha scritto: Still, __KVM_HAVE_IRQCHIP is clearly a subset of __KVM_HAVE_IOAPIC; defining one without the other makes no sense and will cause compilation or link errors for trace_kvm_ack_irq. Either we drop

Re: [PATCH] KVM: Allow userspace to specify memory to be used for private regions.

2013-04-17 Thread Gleb Natapov
On Mon, Apr 15, 2013 at 03:10:32PM -0700, Andrew Honig wrote: The motivation for this patch is to fix a 20KB leak of memory in vmx.c when a VM is created and destroyed. On x86/vmx platforms KVM needs 5 pages of userspace memory per VM for architecture specific reasons. It currently

Re: KVM: x86: fix maintenance of guest/host xcr0 state

2013-04-17 Thread Gleb Natapov
On Mon, Apr 15, 2013 at 11:30:13PM -0300, Marcelo Tosatti wrote: ** Untested **. Emulation of xcr0 writes zero guest_xcr0_loaded variable so that subsequent VM-entry reloads CPU's xcr0 with guests xcr0 value. However, this is incorrect because guest_xcr0_loaded variable is read to

Re: [RFC PATCH] Emulate MOVBE

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 12:42:30PM +0200, Paolo Bonzini wrote: Il 16/04/2013 19:28, Gleb Natapov ha scritto: This does highlight a weakness in CPU_GET_SUPPORTED_CPUID, but I think this is not a problem in practice. With a management layer such as oVirt it's not a problem. For

Re: [PATCH -v2] kvm: Emulate MOVBE

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 01:04:34PM +0200, Borislav Petkov wrote: On Tue, Apr 16, 2013 at 08:42:36PM +0300, Gleb Natapov wrote: Right, and this is what we have, AFAICT. And if userspace does that what you exemplify above, you get exactly that - a feature bit not set in CPUID but KVM

Re: [PATCH 02/10] KVM: nVMX: Detect shadow-vmcs capability

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 02:51:40PM +0300, Abel Gordon wrote: Add logic required to detect if shadow-vmcs is supported by the processor. Introduce a new kernel module parameter to specify if L0 should use shadow vmcs (or not) to run L1. Signed-off-by: Abel Gordon ab...@il.ibm.com ---

Re: [User Question] Repeated severe performance problems on guest

2013-04-17 Thread Stefan Hajnoczi
On Tue, Apr 16, 2013 at 09:49:20AM +0200, Martin Wawro wrote: On 04/16/2013 07:49 AM, Stefan Hajnoczi wrote: Besides the kvm_stat, general performance data from the host is useful when dealing with high load averages. Do you have vmstat or sar data for periods of time when the machine was

Re: [RFC] provide an API to userspace doing memory snapshot

2013-04-17 Thread Stefan Hajnoczi
On Tue, Apr 16, 2013 at 03:54:15PM +0800, Wenchao Xia wrote: 于 2013-4-16 13:51, Stefan Hajnoczi 写道: On Mon, Apr 15, 2013 at 09:03:36PM +0800, Wenchao Xia wrote: I'd like to add/export an function which allow userspace program to take snapshot for a region of memory. Since it is not

Re: [PATCH -v2] kvm: Emulate MOVBE

2013-04-17 Thread Borislav Petkov
On Wed, Apr 17, 2013 at 04:38:29PM +0300, Gleb Natapov wrote: Yes, but it is good emulation. You want to have it for performance even if host does not have x2apic. x2apic is emulated no matter if host cpu has it or not. movbe is different, you want to emulate it only if your guest requires it.

Re: Perf tuning help?

2013-04-17 Thread Stefan Hajnoczi
On Tue, Apr 16, 2013 at 04:30:17PM -0400, Mason Turner wrote: We have an in-house app, written in c, that is not performing as well as we'd hoped it would when moving to a VM. We've tried all the common tuning recommendations (virtio, tap interface, cpu pining), without any change in

Re: [PATCH] mm: mmu_notifier: re-fix freed page still mapped in secondary MMU

2013-04-17 Thread Robin Holt
On Wed, Apr 17, 2013 at 10:55:26AM +0800, Xiao Guangrong wrote: On 04/17/2013 02:08 AM, Robin Holt wrote: On Tue, Apr 16, 2013 at 09:07:20PM +0800, Xiao Guangrong wrote: On 04/16/2013 07:43 PM, Robin Holt wrote: Argh. Taking a step back helped clear my head. For the -stable releases, I

Re: [PATCH 05/10] KVM: nVMX: Allocate shadow vmcs

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 02:53:10PM +0300, Abel Gordon wrote: Allocate a shadow vmcs used by the processor to shadow part of the fields stored in the software defined VMCS12 (let L1 access fields without causing exits). Note we keep a shadow vmcs only for the current vmcs12. Once a vmcs12

Re: [PATCH v5 0/3] tcm_vhost hotplug

2013-04-17 Thread Michael S. Tsirkin
On Fri, Apr 12, 2013 at 04:10:50PM -0700, Nicholas A. Bellinger wrote: Hi MST, Ping on this series for use with vhost-scsi-pci code..? They will need to be heading into target-pending/for-next soon to make the v3.10 window opening in t-minus 9 days. ;) --nab On Tue, 2013-04-09 at

Re: [PATCH 02/10] KVM: nVMX: Detect shadow-vmcs capability

2013-04-17 Thread Abel Gordon
Gleb Natapov g...@redhat.com wrote on 17/04/2013 04:51:16 PM: +static inline bool cpu_has_vmx_shadow_vmcs(void) +{ + u64 vmx_msr; + rdmsrl(MSR_IA32_VMX_MISC, vmx_msr); + /* check if the cpu supports writing r/o exit information fields */ + if (!(vmx_msr (1u 29))) I think

Re: [PATCH 09/10] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 02:55:10PM +0300, Abel Gordon wrote: Synchronize between the VMCS12 software controlled structure and the processor-specific shadow vmcs Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 24 1 file changed, 24

Re: [PATCH 10/10] KVM: nVMX: Enable and disable shadow vmcs functionality

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 02:55:40PM +0300, Abel Gordon wrote: Once L1 loads VMCS12 we enable shadow-vmcs capability and copy all the VMCS12 shadowed fields to the shadow vmcs. When we release the VMCS12, we also disable shadow-vmcs capability. Signed-off-by: Abel Gordon ab...@il.ibm.com ---

Re: [PATCH 05/10] KVM: nVMX: Allocate shadow vmcs

2013-04-17 Thread Abel Gordon
Gleb Natapov g...@redhat.com wrote on 17/04/2013 05:10:28 PM: On Wed, Apr 17, 2013 at 02:53:10PM +0300, Abel Gordon wrote: Allocate a shadow vmcs used by the processor to shadow part of the fields stored in the software defined VMCS12 (let L1 access fields without causing exits). Note

Re: [PATCH 05/10] KVM: nVMX: Allocate shadow vmcs

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 05:41:19PM +0300, Abel Gordon wrote: Gleb Natapov g...@redhat.com wrote on 17/04/2013 05:10:28 PM: On Wed, Apr 17, 2013 at 02:53:10PM +0300, Abel Gordon wrote: Allocate a shadow vmcs used by the processor to shadow part of the fields stored in the software

Re: [PATCH 09/10] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs

2013-04-17 Thread Abel Gordon
Gleb Natapov g...@redhat.com wrote on 17/04/2013 05:34:49 PM: @@ -5716,6 +5725,10 @@ static void nested_vmx_failValid(struct X86_EFLAGS_SF | X86_EFLAGS_OF)) | X86_EFLAGS_ZF); get_vmcs12(vcpu)-vm_instruction_error = vm_instruction_error; + /* +* We

Re: [PATCH 10/10] KVM: nVMX: Enable and disable shadow vmcs functionality

2013-04-17 Thread Abel Gordon
Gleb Natapov g...@redhat.com wrote on 17/04/2013 05:41:07 PM: On Wed, Apr 17, 2013 at 02:55:40PM +0300, Abel Gordon wrote: Once L1 loads VMCS12 we enable shadow-vmcs capability and copy allthe VMCS12 shadowed fields to the shadow vmcs. When we release the VMCS12, we also disable

Re: [PATCH] KVM: Allow userspace to specify memory to be used for private regions.

2013-04-17 Thread Andrew Honig
Freeing the memory in kvm_arch_free_memslot is as good as anywhere else in KVM. The problem is that this memory is in the user space process mm. This codepath could be called after the mm is destroyed in the case of an process exit without closing the fd, which will result in a panic on

Re: [PATCH 10/10] KVM: nVMX: Enable and disable shadow vmcs functionality

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 06:18:27PM +0300, Abel Gordon wrote: Gleb Natapov g...@redhat.com wrote on 17/04/2013 05:41:07 PM: On Wed, Apr 17, 2013 at 02:55:40PM +0300, Abel Gordon wrote: Once L1 loads VMCS12 we enable shadow-vmcs capability and copy allthe VMCS12 shadowed fields to

Re: [PATCH] KVM: Allow userspace to specify memory to be used for private regions.

2013-04-17 Thread Andrew Honig
I'm happy to not add a new API and use __kvm_set_memory_region to unregister private memory regions, but I thought chaning the API was the approach you asked for when I sent a previous patch. See the end of: http://article.gmane.org/gmane.comp.emulators.kvm.devel/107753 Did I misunderstand your

Re: [PATCH] KVM: Allow userspace to specify memory to be used for private regions.

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 08:24:21AM -0700, Andrew Honig wrote: I'm happy to not add a new API and use __kvm_set_memory_region to unregister private memory regions, but I thought chaning the API was the approach you asked for when I sent a previous patch. See the end of:

Re: [PATCH] KVM: Allow userspace to specify memory to be used for private regions.

2013-04-17 Thread Andrew Honig
Alright, I'll send that soon. Sorry for the mixup. On Wed, Apr 17, 2013 at 8:30 AM, Gleb Natapov g...@redhat.com wrote: On Wed, Apr 17, 2013 at 08:24:21AM -0700, Andrew Honig wrote: I'm happy to not add a new API and use __kvm_set_memory_region to unregister private memory regions, but I

Re: [PATCH 09/10] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs

2013-04-17 Thread Gleb Natapov
On Wed, Apr 17, 2013 at 05:59:50PM +0300, Abel Gordon wrote: Gleb Natapov g...@redhat.com wrote on 17/04/2013 05:34:49 PM: @@ -5716,6 +5725,10 @@ static void nested_vmx_failValid(struct X86_EFLAGS_SF | X86_EFLAGS_OF)) | X86_EFLAGS_ZF);

Re: [PATCH 09/10] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs

2013-04-17 Thread Abel Gordon
Gleb Natapov g...@redhat.com wrote on 17/04/2013 06:39:01 PM: On Wed, Apr 17, 2013 at 05:59:50PM +0300, Abel Gordon wrote: Gleb Natapov g...@redhat.com wrote on 17/04/2013 05:34:49 PM: @@ -5716,6 +5725,10 @@ static void nested_vmx_failValid(struct X86_EFLAGS_SF |

[PATCH 0/10] KVM: nVMX: shadow VMCS support, v3

2013-04-17 Thread Abel Gordon
This series of patches implements shadow-vmcs capability for nested VMX. Shadow-vmcs - background and overview: In Intel VMX, vmread and vmwrite privileged instructions are used by the hypervisor to read and modify the guest and host specifications (VMCS). In a nested virtualization

[PATCH 01/10] KVM: nVMX: Shadow-vmcs control fields/bits

2013-04-17 Thread Abel Gordon
Add definitions for all the vmcs control fields/bits required to enable vmcs-shadowing Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/include/asm/vmx.h|3 +++ arch/x86/include/uapi/asm/msr-index.h |2 ++ 2 files changed, 5 insertions(+) ---

[PATCH 02/10] KVM: nVMX: Detect shadow-vmcs capability

2013-04-17 Thread Abel Gordon
Add logic required to detect if shadow-vmcs is supported by the processor. Introduce a new kernel module parameter to specify if L0 should use shadow vmcs (or not) to run L1. Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 25 - 1 file changed, 24

[PATCH 03/10] KVM: nVMX: Introduce vmread and vmwrite bitmaps

2013-04-17 Thread Abel Gordon
Prepare vmread and vmwrite bitmaps according to a pre-specified list of fields. These lists are intended to specifiy most frequent accessed fields so we can minimize the number of fields that are copied from/to the software controlled VMCS12 format to/from to processor-specific shadow vmcs. The

Re: [PATCH] KVM: Allow userspace to specify memory to be used for private regions.

2013-04-17 Thread Paolo Bonzini
Il 17/04/2013 17:19, Andrew Honig ha scritto: Freeing the memory in kvm_arch_free_memslot is as good as anywhere else in KVM. The problem is that this memory is in the user space process mm. This codepath could be called after the mm is destroyed in the case of an process exit without

[PATCH 04/10] KVM: nVMX: Refactor handle_vmwrite

2013-04-17 Thread Abel Gordon
Refactor existent code so we re-use vmcs12_write_any to copy fields from the shadow vmcs specified by the link pointer (used by the processor, implementation-specific) to the VMCS12 software format used by L0 to hold the fields in L1 memory address space. Signed-off-by: Abel Gordon

[PATCH 05/10] KVM: nVMX: Allocate shadow vmcs

2013-04-17 Thread Abel Gordon
Allocate a shadow vmcs used by the processor to shadow part of the fields stored in the software defined VMCS12 (let L1 access fields without causing exits). Note we keep a shadow vmcs only for the current vmcs12. Once a vmcs12 becomes non-current, its shadow vmcs is released. Signed-off-by:

[PATCH 06/10] KVM: nVMX: Release shadow vmcs

2013-04-17 Thread Abel Gordon
Unmap vmcs12 and release the corresponding shadow vmcs Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) --- .before/arch/x86/kvm/vmx.c 2013-04-17 19:58:32.0 +0300 +++

[PATCH 07/10] KVM: nVMX: Copy processor-specific shadow-vmcs to VMCS12

2013-04-17 Thread Abel Gordon
Introduce a function used to copy fields from the processor-specific shadow vmcs to the software controlled VMCS12 Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 35 +++ 1 file changed, 35 insertions(+) --- .before/arch/x86/kvm/vmx.c

[PATCH 08/10] KVM: nVMX: Copy VMCS12 to processor-specific shadow vmcs

2013-04-17 Thread Abel Gordon
Introduce a function used to copy fields from the software controlled VMCS12 to the processor-specific shadow vmcs Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 45 +++ 1 file changed, 45 insertions(+) ---

[PATCH 09/10] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs

2013-04-17 Thread Abel Gordon
Synchronize between the VMCS12 software controlled structure and the processor-specific shadow vmcs Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 32 1 file changed, 32 insertions(+) --- .before/arch/x86/kvm/vmx.c 2013-04-17

[PATCH 10/10] KVM: nVMX: Enable and disable shadow vmcs functionality

2013-04-17 Thread Abel Gordon
Once L1 loads VMCS12 we enable shadow-vmcs capability and copy all the VMCS12 shadowed fields to the shadow vmcs. When we release the VMCS12, we also disable shadow-vmcs capability. Signed-off-by: Abel Gordon ab...@il.ibm.com --- arch/x86/kvm/vmx.c | 11 +++ 1 file changed, 11

[PATCH] kvm:x86/svm: enable SVM lock if host supports it

2013-04-17 Thread prasadjoshi . linux
From: Prasad Joshi prasadjoshi.li...@gmail.com SVM lock features allows software from preventing update to EFER.SVME. Enable the SVM lock in guest if it is supported on host machine. Signed-off-by: Prasad Joshi prasadjoshi.li...@gmail.com --- arch/x86/kvm/svm.c |4 1 file changed, 4

[PATCHv2] KVM: x86: Fix memory leak in vmx.c

2013-04-17 Thread Andrew Honig
If userspace creates and destroys multiple VMs within the same process we leak 20k of memory in the userspace process context per VM. This patch frees the memory in kvm_arch_destroy_vm. If the process exits without closing the VM file descriptor or the file descriptor has been shared with

Re: linux-next: Tree for Apr 17 (kvm)

2013-04-17 Thread Randy Dunlap
On 04/17/13 00:04, Stephen Rothwell wrote: Hi all, Changes since 20130416: on i386, SMP is disabled, X86_UP_APIC is not enabled, but CONFIG_KVM_APIC_ARCHITECTURE=y: arch/x86/kvm/vmx.c: In function 'vmx_deliver_posted_interrupt': arch/x86/kvm/vmx.c:3950:3: error: 'apic' undeclared (first

Re: [PATCH] mm: mmu_notifier: re-fix freed page still mapped in secondary MMU

2013-04-17 Thread Xiao Guangrong
On 04/17/2013 10:10 PM, Robin Holt wrote: On Wed, Apr 17, 2013 at 10:55:26AM +0800, Xiao Guangrong wrote: On 04/17/2013 02:08 AM, Robin Holt wrote: On Tue, Apr 16, 2013 at 09:07:20PM +0800, Xiao Guangrong wrote: On 04/16/2013 07:43 PM, Robin Holt wrote: Argh. Taking a step back helped clear

Re: [PATCH] mm: mmu_notifier: re-fix freed page still mapped in secondary MMU

2013-04-17 Thread Robin Holt
On Thu, Apr 18, 2013 at 02:41:31AM +0800, Xiao Guangrong wrote: On 04/17/2013 10:10 PM, Robin Holt wrote: On Wed, Apr 17, 2013 at 10:55:26AM +0800, Xiao Guangrong wrote: On 04/17/2013 02:08 AM, Robin Holt wrote: On Tue, Apr 16, 2013 at 09:07:20PM +0800, Xiao Guangrong wrote: On 04/16/2013

Re: [PATCH] mm: mmu_notifier: re-fix freed page still mapped in secondary MMU

2013-04-17 Thread Xiao Guangrong
On 04/18/2013 02:45 AM, Robin Holt wrote: For the v3.10 release, we should work on making this more correct and completely documented. Better document is always welcomed. Double call -release is not bad, like i mentioned it in the changelog: it is really rare (e.g, can not happen on kvm

[PULL 0/5] ppc patch queue 2013-04-17

2013-04-17 Thread Alexander Graf
Hi Marcelo / Gleb, This is my current patch queue for ppc. Please pull for 3.10. Changes include: - KVM: PPC: Fix in-kernel MMIO loads - KVM: PPC: BookE: Fix 64-bit guest kernels with SMP Alex The following changes since commit 79558f112fc0352e057f7b5e158e3d88b8b62c60: Alexander Graf

[PATCH 2/3] KVM: PPC: emulate dcbst

2013-04-17 Thread Alexander Graf
From: Stuart Yoder stuart.yo...@freescale.com Signed-off-by: Stuart Yoder stuart.yo...@freescale.com Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/kvm/emulate.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/kvm/emulate.c

[PATCH 1/3] Added ONE_REG interface for debug instruction

2013-04-17 Thread Alexander Graf
From: Bharat Bhushan r65...@freescale.com This patch adds the one_reg interface to get the special instruction to be used for setting software breakpoint from userspace. Signed-off-by: Bharat Bhushan bharat.bhus...@freescale.com Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 3/3] kvm/ppc: don't call complete_mmio_load when it's a store

2013-04-17 Thread Alexander Graf
From: Scott Wood scottw...@freescale.com complete_mmio_load writes back the mmio result into the destination register. Doing this on a store results in register corruption. Signed-off-by: Scott Wood scottw...@freescale.com Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH] ARM: KVM: fix unbalanced get_cpu() in access_dcsw

2013-04-17 Thread Christoffer Dall
From: Marc Zyngier marc.zyng...@arm.com In the very unlikely event where a guest would be foolish enough to *read* from a write-only cache maintainance register, we end up with preemption disabled, due to a misplaced get_cpu(). Just move the is_write test outside of the critical section.

Re: [PATCH] kvm:x86/svm: enable SVM lock if host supports it

2013-04-17 Thread Joerg Roedel
On Wed, Apr 17, 2013 at 11:03:33PM +0530, prasadjoshi.li...@gmail.com wrote: From: Prasad Joshi prasadjoshi.li...@gmail.com SVM lock features allows software from preventing update to EFER.SVME. Enable the SVM lock in guest if it is supported on host machine. Signed-off-by: Prasad Joshi

Re: [User Question] Repeated severe performance problems on guest

2013-04-17 Thread Martin Wawro
Hi Stefan, The host is interesting too if you suspect KVM is involved in the performance issue (rather than it being purely an application issue inside the guest). For example, pidstat (from the sysstat package) on the host can tell you the guest mode CPU utilization percentage. That's

Re: [PATCHv2] KVM: x86: Fix memory leak in vmx.c

2013-04-17 Thread Eric Northup
On Wed, Apr 17, 2013 at 10:54 AM, Andrew Honig aho...@google.com wrote: If userspace creates and destroys multiple VMs within the same process we leak 20k of memory in the userspace process context per VM. This patch frees the memory in kvm_arch_destroy_vm. If the process exits without

Re: [PATCH v2 0/7] KVM: MMU: fast zap all shadow pages

2013-04-17 Thread Marcelo Tosatti
On Fri, Mar 22, 2013 at 09:15:24PM +0200, Gleb Natapov wrote: On Fri, Mar 22, 2013 at 08:37:33PM +0800, Xiao Guangrong wrote: On 03/22/2013 08:12 PM, Gleb Natapov wrote: On Fri, Mar 22, 2013 at 08:03:04PM +0800, Xiao Guangrong wrote: On 03/22/2013 07:47 PM, Gleb Natapov wrote: On Fri,

Re: [PATCHv2] KVM: x86: Fix memory leak in vmx.c

2013-04-17 Thread Paolo Bonzini
Il 17/04/2013 19:54, Andrew Honig ha scritto: If userspace creates and destroys multiple VMs within the same process we leak 20k of memory in the userspace process context per VM. This patch frees the memory in kvm_arch_destroy_vm. If the process exits without closing the VM file

Re: [PATCH 09/10] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs

2013-04-17 Thread Paolo Bonzini
Il 17/04/2013 18:03, Abel Gordon ha scritto: Right, not a big deal if this is the only case when it happens. When we discussed accessors vs sync_shadow_vmcs flag approach I said that flag will work only if no vmcs12 fields are changed not as part of vmexit or vmwrite emulations. This one

Re: linux-next: Tree for Apr 17 (kvm)

2013-04-17 Thread David Rientjes
On Wed, 17 Apr 2013, Randy Dunlap wrote: On 04/17/13 00:04, Stephen Rothwell wrote: Hi all, Changes since 20130416: on i386, SMP is disabled, X86_UP_APIC is not enabled, but CONFIG_KVM_APIC_ARCHITECTURE=y: arch/x86/kvm/vmx.c: In function 'vmx_deliver_posted_interrupt':

Re: [PATCHv2] KVM: x86: Fix memory leak in vmx.c

2013-04-17 Thread Andrew Honig
I don't have a significant objection to freeing the memory in kvm_arch_free_memslot, although I think it's a little harder to understand. I like the idea of being symmetric (memory is allocated by calling kvm_set_memory_region and freed using the same technique). That way if someone changes from

[patch] x86, kvm: fix build failure with CONFIG_SMP disabled

2013-04-17 Thread David Rientjes
The build fails when CONFIG_SMP is disabled: arch/x86/kvm/vmx.c: In function 'vmx_deliver_posted_interrupt': arch/x86/kvm/vmx.c:3950:3: error: 'apic' undeclared (first use in this function) Fix it by including the necessary header. Reported-by: Randy Dunlap

Re: [PATCH kvm-unittests v2 0/4] Add run_tests.sh script and update unittests.cfg

2013-04-17 Thread Marcelo Tosatti
On Fri, Apr 12, 2013 at 01:27:36PM +0200, Kevin Wolf wrote: This adds a small script that allows to conveniently run all test cases and that reports back one PASS or FAIL line for each test case; it also creates a test.log file with the full output. It parses the unittests.cfg file used by

Re: [PATCH kvm-unittest] x86/svm: run cr3 read intercept emulate only on SMP

2013-04-17 Thread Marcelo Tosatti
On Tue, Apr 16, 2013 at 06:15:21PM +0200, Paolo Bonzini wrote: Il 16/04/2013 07:08, prasadjoshi.li...@gmail.com ha scritto: From: Prasad Joshi prasadjoshi.li...@gmail.com The SVM test 'cr3 read intercept emulate' when ran on uniprocessor system does not finish and blocks all the tests

Re: [PATCH 1/2] KVM: nVMX: Validate EFER values for VM_ENTRY/EXIT_LOAD_IA32_EFER

2013-04-17 Thread Marcelo Tosatti
On Sun, Apr 14, 2013 at 12:44:09PM +0200, Jan Kiszka wrote: From: Jan Kiszka jan.kis...@siemens.com As we may emulate the loading of EFER on VM-entry and VM-exit, implement the checks that VMX performs on the guest and host values on vmlaunch/ vmresume. Factor out kvm_valid_efer for this

Re: [PATCH] x86: Add a Kconfig shortcut for a kvm-bootable kernel

2013-04-17 Thread Marcelo Tosatti
On Tue, Apr 16, 2013 at 06:18:52PM +0200, Borislav Petkov wrote: On Sun, Apr 14, 2013 at 01:03:20PM +0200, Borislav Petkov wrote: On Sun, Apr 14, 2013 at 12:31:12PM +0300, Pekka Enberg wrote: I obviously support having something like this in mainline. I wonder though if we could just call

Re: [PATCH v3 07/15] KVM: MMU: introduce invalid rmap handlers

2013-04-17 Thread Marcelo Tosatti
On Tue, Apr 16, 2013 at 02:32:45PM +0800, Xiao Guangrong wrote: Invalid rmaps is the rmap of the invalid memslot which is being deleted, especially, we can treat all rmaps are invalid when kvm is being destroyed since all memslot will be deleted soon. MMU should remove all sptes on these rmaps

  1   2   >