Re: [PATCH RFC 2/2] vhost: support urgent descriptors

2014-09-22 Thread Michael S. Tsirkin
On Mon, Sep 22, 2014 at 11:30:23AM +0800, Jason Wang wrote: On 09/20/2014 06:00 PM, Paolo Bonzini wrote: Il 19/09/2014 09:10, Jason Wang ha scritto: -if (!vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX)) { +if (vq-urgent || !vhost_has_feature(vq,

Re: [Qemu-devel] [RFC patch 5/6] s390: implement pci instruction

2014-09-22 Thread Frank Blaschka
On Fri, Sep 19, 2014 at 05:12:15PM +0200, Thomas Huth wrote: Hi Frank, On Fri, 19 Sep 2014 13:54:34 +0200 frank.blasc...@de.ibm.com wrote: From: Frank Blaschka frank.blasc...@de.ibm.com This patch implements the s390 pci instructions in qemu. This allows to attach qemu pci

Re: [[RFC] KVM-S390: Provide guest TOD Clock Get/Set Controls

2014-09-22 Thread Christian Borntraeger
On 09/19/2014 10:38 PM, Alexander Graf wrote: On 19.09.14 20:51, Christian Borntraeger wrote: On 09/19/2014 04:19 PM, Jason J. Herne wrote: From: Jason J. Herne jjhe...@us.ibm.com Enable KVM_SET_CLOCK and KVM_GET_CLOCK Ioctls on S390 for managing guest TOD clock value. Just some

Re: [PATCH] kvm: Make init_rmode_tss() return 0 on success.

2014-09-22 Thread Paolo Bonzini
Il 20/09/2014 01:44, Radim Krčmář ha scritto: This patch removes the redundant variable, by making init_rmode_tss() return 0 on success, -errno on failure. Which is going to propagate all the way to userpace through ioctl ... is this change of A[PB]I acceptable? Otherwise, -EFAULT seems

Re: [PATCH v7 6/9] kvm: Rename make_all_cpus_request() to kvm_make_all_cpus_request() and make it non-static.

2014-09-22 Thread Paolo Bonzini
Il 20/09/2014 12:47, Tang Chen ha scritto: Since different architectures need different handling, we will add some arch specific code later. The code may need to make cpu requests outside kvm_main.c, so make it non-static and rename it to kvm_make_all_cpus_request(). Signed-off-by: Tang

Re: [PATCH v7 9/9] kvm, mem-hotplug: Unpin and remove kvm_arch-apic_access_page.

2014-09-22 Thread Paolo Bonzini
Il 20/09/2014 12:47, Tang Chen ha scritto: @@ -4534,8 +4539,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu) } if (vm_need_virtualize_apic_accesses(vmx-vcpu.kvm)) - vmcs_write64(APIC_ACCESS_ADDR, -

Re: [PATCH v7 7/9] kvm, mem-hotplug: Reload L1's apic access page on migration when L2 is running.

2014-09-22 Thread Paolo Bonzini
Il 20/09/2014 12:47, Tang Chen ha scritto: We are handling L1 and L2 share one apic access page situation when migrating apic access page. We should do some handling when migration happens in the following situations: 1) when L0 is running: Update L1's vmcs in the next L0-L1 entry and

Re: [PATCH v7 8/9] kvm, mem-hotplug: Add arch specific mmu notifier to handle apic access migration.

2014-09-22 Thread Paolo Bonzini
Il 20/09/2014 12:47, Tang Chen ha scritto: We are handling L1 and L2 share one apic access page situation when migrating apic access page. We should do some handling when migration happens in the following situations: 1) when L0 is running: Update L1's vmcs in the next L0-L1 entry and

Re: [PATCH v7 5/9] kvm, mem-hotplug: Reload L1's apic access page in vcpu_enter_guest().

2014-09-22 Thread Paolo Bonzini
Il 20/09/2014 12:47, Tang Chen ha scritto: @@ -3624,6 +3624,11 @@ static bool svm_has_secondary_apic_access(struct kvm_vcpu *vcpu) return false; } +static void svm_set_apic_access_page_addr(struct kvm *kvm, hpa_t hpa) +{ + return; +} + static int svm_vm_has_apicv(struct

Re: [PATCH v7 5/9] kvm, mem-hotplug: Reload L1's apic access page in vcpu_enter_guest().

2014-09-22 Thread Paolo Bonzini
Il 22/09/2014 11:33, Paolo Bonzini ha scritto: Something's wrong in the way you're generating the patches, because you're adding these hunks twice. Nevermind, that was my mistake. Paolo -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to

Re: [PATCH v7 4/9] kvm: Add interface to check if secondary exec virtualzed apic accesses is enabled.

2014-09-22 Thread Paolo Bonzini
Il 20/09/2014 12:47, Tang Chen ha scritto: We wants to migrate apic access page pinned by guest (L1 and L2) to make memory hotplug available. There are two situations need to be handled for apic access page used by L2 vm: 1. L1 prepares a separate apic access page for L2. L2 pins a

Re: [PATCH RFC 2/2] vhost: support urgent descriptors

2014-09-22 Thread Jason Wang
On 09/22/2014 02:55 PM, Michael S. Tsirkin wrote: On Mon, Sep 22, 2014 at 11:30:23AM +0800, Jason Wang wrote: On 09/20/2014 06:00 PM, Paolo Bonzini wrote: Il 19/09/2014 09:10, Jason Wang ha scritto: -if (!vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX)) { +if (vq-urgent ||

Re: [PATCH] x86:kvm: fix two typos in comment

2014-09-22 Thread Paolo Bonzini
Il 22/09/2014 04:31, Tiejun Chen ha scritto: s/drity/dirty and s/vmsc01/vmcs01 Signed-off-by: Tiejun Chen tiejun.c...@intel.com --- arch/x86/kvm/mmu.c | 2 +- arch/x86/kvm/vmx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu.c

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Paolo Bonzini
Il 20/09/2014 01:03, David Matlack ha scritto: vcpu ioctls can hang the calling thread if issued while a vcpu is running. If we know ioctl is going to be rejected as invalid anyway, we can fail before trying to take the vcpu mutex. This patch does not change functionality, it just makes

Re: [BUG] Guest kernel divide error in kvm_unlock_kick

2014-09-22 Thread Paolo Bonzini
Il 11/09/2014 19:03, Chris Webb ha scritto: Paolo Bonzini pbonz...@redhat.com wrote: This is a hypercall that should have kicked VCPU 3 (see rcx). Can you please apply this patch and gather a trace of the host (using trace-cmd -e kvm qemu-kvm arguments)? Sure, no problem. I've built the

[PATCH] x86: kvm: use alternatives for VMCALL vs. VMMCALL if kernel text is read-only

2014-09-22 Thread Paolo Bonzini
On x86_64, kernel text mappings are mapped read-only with CONFIG_DEBUG_RODATA. In that case, KVM will fail to patch VMCALL instructions to VMMCALL as required on AMD processors. The failure mode is currently a divide-by-zero exception, which obviously is a KVM bug that has to be fixed. However,

Re: [PATCH RFC 2/2] vhost: support urgent descriptors

2014-09-22 Thread Michael S. Tsirkin
On Mon, Sep 22, 2014 at 05:55:23PM +0800, Jason Wang wrote: On 09/22/2014 02:55 PM, Michael S. Tsirkin wrote: On Mon, Sep 22, 2014 at 11:30:23AM +0800, Jason Wang wrote: On 09/20/2014 06:00 PM, Paolo Bonzini wrote: Il 19/09/2014 09:10, Jason Wang ha scritto: - if

[GIT PULL] Final KVM changes for 3.17

2014-09-22 Thread Paolo Bonzini
Linus, The following changes since commit 02a68d0503fa470abff8852e10b1890df5730a08: powerpc/kvm/cma: Fix panic introduces by signed shift operation (2014-09-03 10:34:07 +0200) are available in the git repository at: git://git.kernel.org/pub/scm/virt/kvm/kvm.git tags/for-linus for you to

Re: [Qemu-devel] [question] virtio-blk performancedegradationhappened with virito-serial

2014-09-22 Thread Zhang Haoyu
Hi, all I start a VM with virtio-serial (default ports number: 31), and found that virtio-blk performance degradation happened, about 25%, this problem can be reproduced 100%. without virtio-serial: 4k-read-random 1186 IOPS with virtio-serial: 4k-read-random 871 IOPS

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-22 Thread Christopher Covington
On 09/19/2014 05:46 PM, H. Peter Anvin wrote: On 09/19/2014 01:46 PM, Andy Lutomirski wrote: However, it sounds to me that at least for KVM, it is very easy just to emulate the RDRAND instruction. The hypervisor would report to the guest that RDRAND is supported in CPUID and the emulate the

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-22 Thread Christopher Covington
On 09/19/2014 02:42 PM, Andy Lutomirski wrote: On Fri, Sep 19, 2014 at 11:30 AM, Christopher Covington c...@codeaurora.org wrote: On 09/17/2014 10:50 PM, Andy Lutomirski wrote: Hi all- I would like to standardize on a very simple protocol by which a guest OS can obtain an RNG seed early in

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Christian Borntraeger
On 09/22/2014 12:50 PM, Paolo Bonzini wrote: Il 20/09/2014 01:03, David Matlack ha scritto: vcpu ioctls can hang the calling thread if issued while a vcpu is running. If we know ioctl is going to be rejected as invalid anyway, we can fail before trying to take the vcpu mutex. This patch does

[no subject]

2014-09-22 Thread Abu Rasheda
unsubscribe kvm -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] blk-mq: Avoid race condition with uninitialized requests

2014-09-22 Thread Christian Borntraeger
On 09/18/2014 11:04 AM, David Hildenbrand wrote: This patch should fix the bug reported in https://lkml.org/lkml/2014/9/11/249. We have to initialize at least the atomic_flags and the cmd_flags when allocating storage for the requests. Otherwise blk_mq_timeout_check() might dereference

Re: [PATCH] blk-mq: Avoid race condition with uninitialized requests

2014-09-22 Thread Jens Axboe
On 2014-09-22 08:15, Christian Borntraeger wrote: On 09/18/2014 11:04 AM, David Hildenbrand wrote: This patch should fix the bug reported in https://lkml.org/lkml/2014/9/11/249. We have to initialize at least the atomic_flags and the cmd_flags when allocating storage for the requests.

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-22 Thread H. Peter Anvin
On 09/22/2014 06:31 AM, Christopher Covington wrote: On 09/19/2014 05:46 PM, H. Peter Anvin wrote: On 09/19/2014 01:46 PM, Andy Lutomirski wrote: However, it sounds to me that at least for KVM, it is very easy just to emulate the RDRAND instruction. The hypervisor would report to the guest

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-22 Thread H. Peter Anvin
On 09/22/2014 07:17 AM, H. Peter Anvin wrote: It could, but how would you enumerate that? A new RDRAND-CPL-0 CPUID bit pretty much would be required. Note that there are two things that differ: the CPL 0-ness and the performance/exhaustibility attributes. -hpa -- To unsubscribe

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Paolo Bonzini
Il 22/09/2014 15:45, Christian Borntraeger ha scritto: We now have an extra condition check for every valid ioctl, to make an error case go faster. I know, the extra check is just a 1 or 2 cycles if branch prediction is right, but still. I applied the patch because the delay could be

Re: [PATCH v6] arm64: fix VTTBR_BADDR_MASK

2014-09-22 Thread Joel Schopp
-#define VTTBR_BADDR_SHIFT (VTTBR_X - 1) -#define VTTBR_BADDR_MASK (((1LLU (40 - VTTBR_X)) - 1) VTTBR_BADDR_SHIFT) Actually, after some more thinking, why don't we just make the upper limit of this mask 48-bit always or even 64-bit. That's a physical mask for checking whether the pgd

Re: [PATCH v6] arm64: fix VTTBR_BADDR_MASK

2014-09-22 Thread Catalin Marinas
On Mon, Sep 22, 2014 at 04:56:58PM +0100, Joel Schopp wrote: The TCR_EL2.PS setting should be done based on the ID_A64MMFR0_EL1 but you can do this in __do_hyp_init (it looks like this function handles VTCR_EL2.PS already, not sure why it does do it for TCR_EL2 as well). So IMO you

Re: [patch 4/4] KVM: MMU: pinned sps are not candidates for deletion.

2014-09-22 Thread Marcelo Tosatti
On Tue, Sep 09, 2014 at 12:41:27PM -0300, Marcelo Tosatti wrote: On Tue, Jul 22, 2014 at 05:59:42AM +0800, Xiao Guangrong wrote: On Jul 10, 2014, at 3:12 AM, mtosa...@redhat.com wrote: Skip pinned shadow pages when selecting pages to zap. It seems there is no way to prevent

Re: [patch 3/4] KVM: MMU: reload request from GET_DIRTY_LOG path

2014-09-22 Thread Marcelo Tosatti
On Tue, Sep 09, 2014 at 12:28:11PM -0300, Marcelo Tosatti wrote: On Mon, Jul 21, 2014 at 04:14:24PM +0300, Gleb Natapov wrote: On Wed, Jul 09, 2014 at 04:12:53PM -0300, mtosa...@redhat.com wrote: Reload remote vcpus MMU from GET_DIRTY_LOG codepath, before deleting a pinned spte.

[PATCH] kvm: Fix page ageing bugs

2014-09-22 Thread Andres Lagar-Cavilla
1. We were calling clear_flush_young_notify in unmap_one, but we are within an mmu notifier invalidate range scope. The spte exists no more (due to range_start) and the accessed bit info has already been propagated (due to kvm_pfn_set_accessed). Simply call clear_flush_young. 2. We

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread David Matlack
On 09/22, Paolo Bonzini wrote: Il 22/09/2014 15:45, Christian Borntraeger ha scritto: We now have an extra condition check for every valid ioctl, to make an error case go faster. I know, the extra check is just a 1 or 2 cycles if branch prediction is right, but still. I applied the

Re: KVM: nested VMX: disable perf cpuid reporting

2014-09-22 Thread Marcelo Tosatti
On Thu, Sep 18, 2014 at 06:24:57PM -0300, Marcelo Tosatti wrote: Initilization of L2 guest with -cpu host, on L1 guest with -cpu host triggers: (qemu) KVM: entry failed, hardware error 0x7 ... nested_vmx_run: VMCS MSR_{LOAD,STORE} unsupported Nested VMX MSR load/store support is not

Re: [BUG] Guest kernel divide error in kvm_unlock_kick

2014-09-22 Thread Chris Webb
Paolo Bonzini pbonz...@redhat.com wrote: Il 11/09/2014 19:03, Chris Webb ha scritto: Paolo Bonzini pbonz...@redhat.com wrote: This is a hypercall that should have kicked VCPU 3 (see rcx). Can you please apply this patch and gather a trace of the host (using trace-cmd -e kvm qemu-kvm

Re: [BUG] Guest kernel divide error in kvm_unlock_kick

2014-09-22 Thread Paolo Bonzini
Il 22/09/2014 21:08, Chris Webb ha scritto: Do you by chance have CONFIG_DEBUG_RODATA set? In that case, the fix is simply not to set it. Absolutely right: my host and guest kernels do have CONFIG_DEBUG_RODATA set! Your patch to use alternatives for VMCALL vs VMMCALL definitely fixed

Re: KVM: nested VMX: disable perf cpuid reporting

2014-09-22 Thread Paolo Bonzini
Il 22/09/2014 21:01, Marcelo Tosatti ha scritto: On Thu, Sep 18, 2014 at 06:24:57PM -0300, Marcelo Tosatti wrote: Initilization of L2 guest with -cpu host, on L1 guest with -cpu host triggers: (qemu) KVM: entry failed, hardware error 0x7 ... nested_vmx_run: VMCS MSR_{LOAD,STORE}

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Christian Borntraeger
On 09/22/2014 04:31 PM, Paolo Bonzini wrote: Il 22/09/2014 15:45, Christian Borntraeger ha scritto: We now have an extra condition check for every valid ioctl, to make an error case go faster. I know, the extra check is just a 1 or 2 cycles if branch prediction is right, but still. I

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Paolo Bonzini
Il 22/09/2014 21:20, Christian Borntraeger ha scritto: while using trinity to fuzz KVM, we noticed long stalls on invalid ioctls. Lets bail out early on invalid ioctls. or similar? Okay. David, can you explain how you found it so that I can make up my mind? Gleb and Marcelo, a fourth and

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread David Matlack
On 09/22, Christian Borntraeger wrote: On 09/22/2014 04:31 PM, Paolo Bonzini wrote: Il 22/09/2014 15:45, Christian Borntraeger ha scritto: We now have an extra condition check for every valid ioctl, to make an error case go faster. I know, the extra check is just a 1 or 2 cycles if

Re: [PATCH] x86: kvm: use alternatives for VMCALL vs. VMMCALL if kernel text is read-only

2014-09-22 Thread Borislav Petkov
On Mon, Sep 22, 2014 at 01:17:48PM +0200, Paolo Bonzini wrote: On x86_64, kernel text mappings are mapped read-only with CONFIG_DEBUG_RODATA. Hmm, that depends on DEBUG_KERNEL. I think you're actually talking about distro kernels which enable CONFIG_DEBUG_RODATA, right? -- Regards/Gruss,

[PATCH] kvm: Fix page ageing bugs

2014-09-22 Thread Andres Lagar-Cavilla
1. We were calling clear_flush_young_notify in unmap_one, but we are within an mmu notifier invalidate range scope. The spte exists no more (due to range_start) and the accessed bit info has already been propagated (due to kvm_pfn_set_accessed). Simply call clear_flush_young. 2. We

[PATCH v2] kvm: Fix page ageing bugs

2014-09-22 Thread Andres Lagar-Cavilla
1. We were calling clear_flush_young_notify in unmap_one, but we are within an mmu notifier invalidate range scope. The spte exists no more (due to range_start) and the accessed bit info has already been propagated (due to kvm_pfn_set_accessed). Simply call clear_flush_young. 2. We

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Marcelo Tosatti
On Fri, Sep 19, 2014 at 04:03:25PM -0700, David Matlack wrote: vcpu ioctls can hang the calling thread if issued while a vcpu is running. There is a mutex per-vcpu, so thats expected, OK... If we know ioctl is going to be rejected as invalid anyway, we can fail before trying to take the

Re: [PATCH] kvm: Fix page ageing bugs

2014-09-22 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/22/2014 03:57 PM, Andres Lagar-Cavilla wrote: 1. We were calling clear_flush_young_notify in unmap_one, but we are within an mmu notifier invalidate range scope. The spte exists no more (due to range_start) and the accessed bit info has

[PATCH v3] kvm: Fix page ageing bugs

2014-09-22 Thread Andres Lagar-Cavilla
1. We were calling clear_flush_young_notify in unmap_one, but we are within an mmu notifier invalidate range scope. The spte exists no more (due to range_start) and the accessed bit info has already been propagated (due to kvm_pfn_set_accessed). Simply call clear_flush_young. 2. We

Re: [RFC patch 0/6] vfio based pci pass-through for qemu/KVM on s390

2014-09-22 Thread Alex Williamson
On Fri, 2014-09-19 at 13:54 +0200, frank.blasc...@de.ibm.com wrote: This set of patches implements a vfio based solution for pci pass-through on the s390 platform. The kernel stuff is pretty much straight forward, but qemu needs more work. Most interesting patch is: vfio: make vfio run on

Re: [PATCH v2] kvm: Faults which trigger IO release the mmap_sem

2014-09-22 Thread Andres Lagar-Cavilla
On Thu, Sep 18, 2014 at 11:08 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 19/09/2014 05:58, Andres Lagar-Cavilla ha scritto: Paolo, should I recut including the recent Reviewed-by's? No, I'll add them myself. Paolo, is this patch waiting for something? Is Gleb's Reviewed-by enough?

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Paolo Bonzini
Il 22/09/2014 22:08, Marcelo Tosatti ha scritto: This patch does not change functionality, it just makes invalid ioctls fail faster. Should not be executing vcpu ioctls without interrupt KVM_RUN in the first place. This is not entirely true, there are a couple of asynchronous ioctls

[PATCH] KVM: EVENTFD: Only conditionally remove inclusion of irq.h

2014-09-22 Thread Christoffer Dall
Commit c77dcac KVM: Move more code under CONFIG_HAVE_KVM_IRQFD added functionality that depends on definitions in ioapic.h when __KVM_HAVE_IOAPIC is defined. At the same time, 0ba0951 KVM: EVENTFD: remove inclusion of irq.h removed the inclusion of irq.h unconditionally, which happened to include

Re: [PATCH v2] kvm: Faults which trigger IO release the mmap_sem

2014-09-22 Thread Paolo Bonzini
Il 22/09/2014 22:49, Andres Lagar-Cavilla ha scritto: Paolo, should I recut including the recent Reviewed-by's? No, I'll add them myself. Paolo, is this patch waiting for something? Is Gleb's Reviewed-by enough? It's waiting for an Acked-by on the mm/ changes. Paolo -- To unsubscribe

Re: [PATCH v2] kvm: Faults which trigger IO release the mmap_sem

2014-09-22 Thread Andrew Morton
On Mon, 22 Sep 2014 23:32:36 +0200 Paolo Bonzini pbonz...@redhat.com wrote: Il 22/09/2014 22:49, Andres Lagar-Cavilla ha scritto: Paolo, should I recut including the recent Reviewed-by's? No, I'll add them myself. Paolo, is this patch waiting for something? Is Gleb's Reviewed-by

Re: [PATCH v3] kvm: Fix page ageing bugs

2014-09-22 Thread Paolo Bonzini
Il 22/09/2014 22:26, Andres Lagar-Cavilla ha scritto: + __entry-gfn= gfn; + __entry-hva= ((gfn - slot-base_gfn) This must be . + PAGE_SHIFT) + slot-userspace_addr; + /* + * No

[PATCH v4] kvm: Fix page ageing bugs

2014-09-22 Thread Andres Lagar-Cavilla
1. We were calling clear_flush_young_notify in unmap_one, but we are within an mmu notifier invalidate range scope. The spte exists no more (due to range_start) and the accessed bit info has already been propagated (due to kvm_pfn_set_accessed). Simply call clear_flush_young. 2. We

Re: [PATCH v3] kvm: Fix page ageing bugs

2014-09-22 Thread Andres Lagar-Cavilla
On Mon, Sep 22, 2014 at 2:48 PM, Paolo Bonzini pbonz...@redhat.com wrote: Il 22/09/2014 22:26, Andres Lagar-Cavilla ha scritto: + __entry-gfn= gfn; + __entry-hva= ((gfn - slot-base_gfn) This must be . Correct, thanks. +

Re: [RFC patch 0/6] vfio based pci pass-through for qemu/KVM on s390

2014-09-22 Thread Alexander Graf
On 22.09.14 22:47, Alex Williamson wrote: On Fri, 2014-09-19 at 13:54 +0200, frank.blasc...@de.ibm.com wrote: This set of patches implements a vfio based solution for pci pass-through on the s390 platform. The kernel stuff is pretty much straight forward, but qemu needs more work. Most

Re: [RFC patch 0/6] vfio based pci pass-through for qemu/KVM on s390

2014-09-22 Thread Alex Williamson
On Tue, 2014-09-23 at 00:08 +0200, Alexander Graf wrote: On 22.09.14 22:47, Alex Williamson wrote: On Fri, 2014-09-19 at 13:54 +0200, frank.blasc...@de.ibm.com wrote: This set of patches implements a vfio based solution for pci pass-through on the s390 platform. The kernel stuff is pretty

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread David Matlack
On 09/22, Marcelo Tosatti wrote: On Fri, Sep 19, 2014 at 04:03:25PM -0700, David Matlack wrote: vcpu ioctls can hang the calling thread if issued while a vcpu is running. There is a mutex per-vcpu, so thats expected, OK... If we know ioctl is going to be rejected as invalid anyway,

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Marcelo Tosatti
On Mon, Sep 22, 2014 at 11:29:16PM +0200, Paolo Bonzini wrote: Il 22/09/2014 22:08, Marcelo Tosatti ha scritto: This patch does not change functionality, it just makes invalid ioctls fail faster. Should not be executing vcpu ioctls without interrupt KVM_RUN in the first place.

Re: Standardizing an MSR or other hypercall to get an RNG seed?

2014-09-22 Thread H. Peter Anvin
Not really, no. Sent from my tablet, pardon any formatting problems. On Sep 22, 2014, at 06:31, Christopher Covington c...@codeaurora.org wrote: On 09/19/2014 05:46 PM, H. Peter Anvin wrote: On 09/19/2014 01:46 PM, Andy Lutomirski wrote: However, it sounds to me that at least for KVM, it

Re: [PATCH] kvm: don't take vcpu mutex for obviously invalid vcpu ioctls

2014-09-22 Thread Marcelo Tosatti
On Mon, Sep 22, 2014 at 03:58:16PM -0700, David Matlack wrote: Should not be executing vcpu ioctls without interrupt KVM_RUN in the first place. This patch is trying to be nice to code that isn't aware it's probing kvm file descriptors. We saw long hangs with some generic process

[PATCH v11 0/6] arm: dirty page logging support for ARMv7

2014-09-22 Thread Mario Smarduch
This patch adds support for ARMv7 dirty page logging. Some functions of dirty page logging have been split to generic and arch specific implementations, details below. Dirty page logging is one of serveral features required for live migration, live migration has been tested for ARMv7. Testing: -

[PATCH v11 1/6] KVM: Add architecture-specific TLB flush implementations

2014-09-22 Thread Mario Smarduch
Add support to declare architecture specific TLB flush function, for now ARMv7. Signed-off-by: Mario Smarduch m.smard...@samsung.com --- include/linux/kvm_host.h |1 + virt/kvm/Kconfig |3 +++ virt/kvm/kvm_main.c |4 3 files changed, 8 insertions(+) diff --git

[PATCH v11 2/6] KVM: Add generic implementation of kvm_vm_ioctl_get_dirty_log

2014-09-22 Thread Mario Smarduch
Add support for generic implementation of dirty log read function. For now x86_64 and ARMv7 share generic dirty log read. Other architectures call their architecture specific functions. Signed-off-by: Mario Smarduch m.smard...@samsung.com --- arch/arm/kvm/Kconfig |1 +

[PATCH v11 3/6] arm: KVM: Add ARMv7 API to flush TLBs

2014-09-22 Thread Mario Smarduch
This patch adds ARMv7 architecture TLB Flush function. Signed-off-by: Mario Smarduch m.smard...@samsung.com --- arch/arm/include/asm/kvm_asm.h |1 + arch/arm/include/asm/kvm_host.h | 12 arch/arm/kvm/Kconfig|1 + arch/arm/kvm/interrupts.S | 12

[PATCH v11 4/6] arm: KVM: Add initial dirty page locking infrastructure

2014-09-22 Thread Mario Smarduch
Patch adds support for initial write protection of VM memlsot. This patch series assumes that huge PUDs will not be used in 2nd stage tables, which is awlays valid on ARMv7. Signed-off-by: Mario Smarduch m.smard...@samsung.com --- arch/arm/include/asm/kvm_host.h |2 +

[PATCH v11 5/6] arm: KVM: dirty log read write protect support

2014-09-22 Thread Mario Smarduch
This patch adds support to track VM dirty pages, between dirty log reads. Pages that have been dirtied since last log read are write protected again, in preparation of next dirty log read. In addition ARMv7 dirty log read function is pushed up to generic layer. Signed-off-by: Mario Smarduch

[PATCH v11 6/6] arm: KVM: ARMv7 dirty page logging 2nd stage page fault

2014-09-22 Thread Mario Smarduch
This patch adds support for handling 2nd stage page faults during migration, it disables faulting in huge pages, and dissolves huge pages to page tables. In case migration is canceled huge pages may be used again. Signed-off-by: Mario Smarduch m.smard...@samsung.com --- arch/arm/kvm/mmu.c |

Re: [Qemu-devel] [question] virtio-blk performancedegradationhappened with virito-serial

2014-09-22 Thread Fam Zheng
On Mon, 09/22 21:23, Zhang Haoyu wrote: Amit, It's related to the big number of ioeventfds used in virtio-serial-pci. With virtio-serial-pci's ioeventfd=off, the performance is not affected no matter if guest initializes it or not. In my test, there are 12 fds to poll in qemu_poll_ns

[PATCH] x86, kvm: use macros to compute bank MSRs

2014-09-22 Thread Chen Yucong
Avoid open coded calculations for bank MSRs by using well-defined macros that hide the index of higher bank MSRs. No semantic changes. Signed-off-by: Chen Yucong sla...@gmail.com --- arch/x86/kvm/x86.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH v2 00/13] powerpc/iommu/vfio: Enable Dynamic DMA windows

2014-09-22 Thread Alexey Kardashevskiy
This enables PAPR defined feature called Dynamic DMA windows (DDW). Each Partitionable Endpoint (IOMMU group) has a separate DMA window on a PCI bus where devices are allows to perform DMA. By default there is 1 or 2GB window allocated at the host boot time and these windows are used when an

[PATCH v2 04/13] powerpc/powernv: Convert/move set_bypass() callback to take_ownership()

2014-09-22 Thread Alexey Kardashevskiy
At the moment the iommu_table struct has a set_bypass() which enables/ disables DMA bypass on IODA2 PHB. This is exposed to POWERPC IOMMU code which calls this callback when external IOMMU users such as VFIO are about to get over a PHB. Since the set_bypass() is not really an iommu_table function

[PATCH v2 12/13] vfio: powerpc/spapr: Use it_page_size

2014-09-22 Thread Alexey Kardashevskiy
This makes use of the it_page_size from the iommu_table struct as page size can differ. This replaces missing IOMMU_PAGE_SHIFT macro in commented debug code as recently introduced IOMMU_PAGE_XXX macros do not include IOMMU_PAGE_SHIFT. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru ---

[PATCH v2 08/13] powerpc/powernv: Release replaced TCE

2014-09-22 Thread Alexey Kardashevskiy
At the moment writing new TCE value to the IOMMU table fails with EBUSY if there is a valid entry already. However PAPR specification allows the guest to write new TCE value without clearing it first. Another problem this patch is addressing is the use of pool locks for external IOMMU users such

[PATCH v2 11/13] vfio: powerpc/spapr: Move locked_vm accounting to helpers

2014-09-22 Thread Alexey Kardashevskiy
There moves locked pages accounting to helpers. Later they will be reused for Dynamic DMA windows (DDW). While we are here, update the comment explaining why RLIMIT_MEMLOCK might be required to be bigger than the guest RAM. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru ---

[PATCH v2 07/13] powerpc/powernv: Do not set read flag if direction==DMA_NONE

2014-09-22 Thread Alexey Kardashevskiy
Normally a bitmap from the iommu_table is used to track what TCE entry is in use. Since we are going to use iommu_table without its locks and do xchg() instead, it becomes essential not to put bits which are not implied in the direction flag. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru ---

[PATCH v2 09/13] powerpc/pseries/lpar: Enable VFIO

2014-09-22 Thread Alexey Kardashevskiy
The previous patch introduced iommu_table_ops::exchange() callback which effectively disabled VFIO on pseries. This implements exchange() for pseries/lpar so VFIO can work in nested guests. Since exchaange() callback returns an old TCE, it has to call H_GET_TCE for every TCE being put to the

[PATCH v2 10/13] powerpc/powernv: Implement Dynamic DMA windows (DDW) for IODA

2014-09-22 Thread Alexey Kardashevskiy
SPAPR defines an interface to create additional DMA windows dynamically. Dynamically means that the window is not allocated before the guest even started, the guest can request it later. In practice, existing linux guests check for the capability and if it is there, they create and map a DMA

[PATCH v2 06/13] powerpc/iommu: Move tce_xxx callbacks from ppc_md to iommu_table

2014-09-22 Thread Alexey Kardashevskiy
This adds a iommu_table_ops struct and puts pointer to it into the iommu_table struct. This moves tce_build/tce_free/tce_get/tce_flush callbacks from ppc_md to the new struct where they really belong to. This adds an extra @ops parameter to iommu_init_table() to make sure that we do not leave any

[PATCH v2 05/13] powerpc/iommu: Fix IOMMU ownership control functions

2014-09-22 Thread Alexey Kardashevskiy
This adds missing locks in iommu_take_ownership()/ iommu_release_ownership(). This marks all pages busy in iommu_table::it_map in order to catch errors if there is an attempt to use this table while ownership over it is taken. This only clears TCE content if there is no page marked busy in

[PATCH v2 13/13] vfio: powerpc/spapr: Enable Dynamic DMA windows

2014-09-22 Thread Alexey Kardashevskiy
This defines and implements VFIO IOMMU API which lets the userspace create and remove DMA windows. This updates VFIO_IOMMU_SPAPR_TCE_GET_INFO to return the number of available windows and page mask. This adds VFIO_IOMMU_SPAPR_TCE_CREATE and VFIO_IOMMU_SPAPR_TCE_REMOVE to allow the user space to

[PATCH v2 02/13] powerpc/powernv: Make invalidate() a callback

2014-09-22 Thread Alexey Kardashevskiy
At the moment pnv_pci_ioda_tce_invalidate() gets the PE pointer via container_of(tbl). Since we are going to have to add Dynamic DMA windows and that means having 2 IOMMU tables per PE, this is not going to work. This implements pnv_pci_ioda(1|2)_tce_invalidate as a pnv_ioda_pe callback. This

[PATCH v2 03/13] powerpc/spapr: vfio: Implement spapr_tce_iommu_ops

2014-09-22 Thread Alexey Kardashevskiy
Modern IBM POWERPC systems support multiple IOMMU tables per PE so we need a more reliable way (compared to container_of()) to get a PE pointer from the iommu_table struct pointer used in IOMMU functions. At the moment IOMMU group data points to an iommu_table struct. This introduces a

[PATCH v2 01/13] powerpc/iommu: Check that TCE page size is equal to it_page_size

2014-09-22 Thread Alexey Kardashevskiy
This checks that the TCE table page size is not bigger that the size of a page we just pinned and going to put its physical address to the table. Otherwise the hardware gets unwanted access to physical memory between the end of the actual page and the end of the aligned up TCE page.

Re: [patch 4/4] KVM: MMU: pinned sps are not candidates for deletion.

2014-09-22 Thread Xiao Guangrong
Hi Marcelo, Sorry for the delay. On Sep 9, 2014, at 11:41 PM, Marcelo Tosatti mtosa...@redhat.com wrote: On Tue, Jul 22, 2014 at 05:59:42AM +0800, Xiao Guangrong wrote: On Jul 10, 2014, at 3:12 AM, mtosa...@redhat.com wrote: Skip pinned shadow pages when selecting pages to zap. It