[PATCH] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-29 Thread Eric Auger
Current vfio_pgsize_bitmap code hides the supported IOMMU page sizes smaller than PAGE_SIZE. As a result, in case the IOMMU does not support PAGE_SIZE page, the alignment check on map/unmap is done with larger page sizes, if any. This can fail although mapping could be done with pages smaller than

Re: [Qemu-devel] [PATCH v5 28/33] nvdimm acpi: support Get Namespace Label Size function

2015-10-29 Thread Stefan Hajnoczi
On Thu, Oct 29, 2015 at 10:16:14AM +0800, Xiao Guangrong wrote: > > > On 10/29/2015 12:41 AM, Stefan Hajnoczi wrote: > >On Wed, Oct 28, 2015 at 10:26:26PM +, Xiao Guangrong wrote: > >>+struct nvdimm_func_in_get_label_data { > >>+uint32_t offset; /* the offset in the namespace label data

Re: [RFC Patch 00/12] IXGBE: Add live migration support for SRIOV NIC

2015-10-29 Thread Alexander Duyck
On 10/29/2015 01:33 AM, Lan Tianyu wrote: On 2015年10月29日 14:58, Alexander Duyck wrote: Your code was having to do a bunch of shuffling in order to get things set up so that you could bring the interface back up. I would argue that it may actually be faster at least on the bring-up to just drop

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-29 Thread David Woodhouse
On Thu, 2015-10-29 at 11:01 +0200, Michael S. Tsirkin wrote: > > Example: you have a mix of assigned devices and virtio devices. You > don't trust your assigned device vendor not to corrupt your memory so > you want to limit the damage your assigned device can do to your > guest, > so you use an

Re: [GIT PULL 3/3] KVM: s390: use simple switch statement as multiplexer

2015-10-29 Thread Alexander Graf
> Am 29.10.2015 um 16:08 schrieb Christian Borntraeger : > > We currently do some magic shifting (by exploiting that exit codes > are always a multiple of 4) and a table lookup to jump into the > exit handlers. This causes some calculations and checks, just to > do an

Re: [PATCH v4 28/33] nvdimm acpi: support DSM_FUN_IMPLEMENTED function

2015-10-29 Thread Igor Mammedov
On Wed, 21 Oct 2015 21:32:38 +0800 Xiao Guangrong wrote: > > > On 10/21/2015 06:49 PM, Stefan Hajnoczi wrote: > > On Wed, Oct 21, 2015 at 12:26:35AM +0800, Xiao Guangrong wrote: > >> > >> > >> On 10/20/2015 11:51 PM, Stefan Hajnoczi wrote: > >>> On Mon, Oct 19,

[GIT PULL 0/3] KVM: s390: Bugfix and cleanups for kvm/next (4.4)

2015-10-29 Thread Christian Borntraeger
The following changes since commit 60417fcc2b0235dfe3dcd589c56dbe3ea1a64c54: KVM: s390: factor out reading of the guest TOD clock (2015-10-13 15:50:35 +0200) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git

[GIT PULL 3/3] KVM: s390: use simple switch statement as multiplexer

2015-10-29 Thread Christian Borntraeger
We currently do some magic shifting (by exploiting that exit codes are always a multiple of 4) and a table lookup to jump into the exit handlers. This causes some calculations and checks, just to do an potentially expensive function call. Changing that to a switch statement gives the compiler the

[GIT PULL 2/3] KVM: s390: drop useless newline in debugging data

2015-10-29 Thread Christian Borntraeger
the s390 debug feature does not need newlines. In fact it will result in empty lines. Get rid of 4 leftovers. Signed-off-by: Christian Borntraeger Acked-by: Cornelia Huck --- arch/s390/kvm/kvm-s390.c | 8 1 file changed, 4

[GIT PULL 1/3] KVM: s390: SCA must not cross page boundaries

2015-10-29 Thread Christian Borntraeger
From: David Hildenbrand We seemed to have missed a few corner cases in commit f6c137ff00a4 ("KVM: s390: randomize sca address"). The SCA has a maximum size of 2112 bytes. By setting the sca_offset to some unlucky numbers, we exceed the page. 0x7c0 (1984) -> Fits

[PATCH] vfio/platform: store mapped memory in region, instead of an on-stack copy

2015-10-29 Thread James Morse
vfio_platform_{read,write}_mmio() call ioremap_nocache() to map a region of io memory, which they store in struct vfio_platform_region to be eventually re-used, or unmapped by vfio_platform_regions_cleanup(). These functions receive a copy of their struct vfio_platform_region argument on the

[PATCH v2] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-29 Thread Eric Auger
Current vfio_pgsize_bitmap code hides the supported IOMMU page sizes smaller than PAGE_SIZE. As a result, in case the IOMMU does not support PAGE_SIZE page, the alignment check on map/unmap is done with larger page sizes, if any. This can fail although mapping could be done with pages smaller than

Re: [RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass

2015-10-29 Thread Will Deacon
On Tue, Oct 27, 2015 at 10:00:11AM -0600, Alex Williamson wrote: > On Tue, 2015-10-27 at 15:40 +, Will Deacon wrote: > > On Fri, Oct 16, 2015 at 09:51:22AM -0600, Alex Williamson wrote: > > > Would it be possible to add iommu_domain_geometry support to arm-smmu.c? > > > In addition to this

Re: [RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass

2015-10-29 Thread Robin Murphy
On 29/10/15 18:28, Will Deacon wrote: On Tue, Oct 27, 2015 at 10:00:11AM -0600, Alex Williamson wrote: On Tue, 2015-10-27 at 15:40 +, Will Deacon wrote: On Fri, Oct 16, 2015 at 09:51:22AM -0600, Alex Williamson wrote: Would it be possible to add iommu_domain_geometry support to

Re: [PATCH v1 2/2] dma-mapping-common: add DMA attribute - DMA_ATTR_IOMMU_BYPASS

2015-10-29 Thread Andy Lutomirski
On Oct 28, 2015 6:11 PM, "Benjamin Herrenschmidt" wrote: > > On Thu, 2015-10-29 at 09:42 +0900, David Woodhouse wrote: > > On Thu, 2015-10-29 at 09:32 +0900, Benjamin Herrenschmidt wrote: > > > > > On Power, I generally have 2 IOMMU windows for a device, one at the > > >

Re: [RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass

2015-10-29 Thread Will Deacon
On Thu, Oct 29, 2015 at 06:42:10PM +, Robin Murphy wrote: > On 29/10/15 18:28, Will Deacon wrote: > >On Tue, Oct 27, 2015 at 10:00:11AM -0600, Alex Williamson wrote: > >>On Tue, 2015-10-27 at 15:40 +, Will Deacon wrote: > >>>On Fri, Oct 16, 2015 at 09:51:22AM -0600, Alex Williamson wrote:

Re: [PATCH v1 2/2] dma-mapping-common: add DMA attribute - DMA_ATTR_IOMMU_BYPASS

2015-10-29 Thread David Woodhouse
On Thu, 2015-10-29 at 11:31 -0700, Andy Lutomirski wrote: > On Oct 28, 2015 6:11 PM, "Benjamin Herrenschmidt" > wrote: > > > > On Thu, 2015-10-29 at 09:42 +0900, David Woodhouse wrote: > > > On Thu, 2015-10-29 at 09:32 +0900, Benjamin Herrenschmidt wrote: > > > > > > >

Re: [PATCH/RFC 0/4] dma ops and virtio

2015-10-29 Thread Andy Lutomirski
On Wed, Oct 28, 2015 at 5:04 PM, Christian Borntraeger wrote: > Am 29.10.2015 um 07:22 schrieb Andy Lutomirski: >> On Tue, Oct 27, 2015 at 3:48 PM, Christian Borntraeger >> wrote: >>> This is an RFC to check if I am on the right track. There >>>

Re: [PATCH] vfio/type1: handle case where IOMMU does not support PAGE_SIZE size

2015-10-29 Thread Will Deacon
On Thu, Oct 29, 2015 at 01:59:45PM +, Eric Auger wrote: > Current vfio_pgsize_bitmap code hides the supported IOMMU page > sizes smaller than PAGE_SIZE. As a result, in case the IOMMU > does not support PAGE_SIZE page, the alignment check on map/unmap > is done with larger page sizes, if any.

[PATCH v4 5/6] virtio_mmio: Use the DMA API

2015-10-29 Thread Andy Lutomirski
This switches to vring_create_virtqueue, simplifying the driver and adding DMA API support. Signed-off-by: Andy Lutomirski --- drivers/virtio/virtio_mmio.c | 67 ++-- 1 file changed, 15 insertions(+), 52 deletions(-) diff --git

[PATCH v4 6/6] virtio_pci: Use the DMA API

2015-10-29 Thread Andy Lutomirski
This switches to vring_create_virtqueue, simplifying the driver and adding DMA API support. Signed-off-by: Andy Lutomirski --- drivers/virtio/virtio_pci_common.h | 7 - drivers/virtio/virtio_pci_legacy.c | 39 +++- drivers/virtio/virtio_pci_modern.c |

[PATCH v4 1/6] virtio-net: Stop doing DMA from the stack

2015-10-29 Thread Andy Lutomirski
From: "Michael S. Tsirkin" Once virtio starts using the DMA API, we won't be able to safely DMA from the stack. virtio-net does a couple of config DMA requests from small stack buffers -- switch to using dynamically-allocated memory. This should have no effect on any

[PATCH v4 3/6] virtio_pci: Use the DMA API

2015-10-29 Thread Andy Lutomirski
This fixes virtio-pci on platforms and busses that have IOMMUs. This will break the experimental QEMU Q35 IOMMU support until QEMU is fixed. In exchange, it fixes physical virtio hardware as well as virtio-pci running under Xen. We should clean up the virtqueue API to do its own allocation and

[PATCH v4 4/6] virtio: Add improved queue allocation API

2015-10-29 Thread Andy Lutomirski
This leaves vring_new_virtqueue alone for compatbility, but it adds two new improved APIs: vring_create_virtqueue: Creates a virtqueue backed by automatically allocated coherent memory. (Some day it this could be extended to support non-coherent memory, too, if there ends up being a platform on

[PATCH v4 0/6] virtio core DMA API conversion

2015-10-29 Thread Andy Lutomirski
This switches virtio to use the DMA API unconditionally. I'm sure it breaks things, but it seems to work on x86 using virtio-pci, with and without Xen, and using both the modern 1.0 variant and the legacy variant. This appears to work on native and Xen x86_64 using both modern and legacy

[PATCH v4 2/6] virtio_ring: Support DMA APIs

2015-10-29 Thread Andy Lutomirski
virtio_ring currently sends the device (usually a hypervisor) physical addresses of its I/O buffers. This is okay when DMA addresses and physical addresses are the same thing, but this isn't always the case. For example, this never works on Xen guests, and it is likely to fail if a physical

Re: [PATCH v2 1/3] virtio_net: Stop doing DMA from the stack

2015-10-29 Thread Andy Lutomirski
On Wed, Oct 28, 2015 at 12:07 AM, Michael S. Tsirkin wrote: > How about this instead? Less code, more robust. > > Warning: untested. If you do like this approach, Tested-by would be > appreciated. I like it. Tested-by: Andy Lutomirski --Andy -- To

[PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU

2015-10-29 Thread Suresh Warrier
This patch adds support to real-mode KVM to search for a core running in the host partition and send it an IPI message with VCPU to be woken. This avoids having to switch to the host partition to complete an H_IPI hypercall when the VCPU which is the target of the the H_IPI is not loaded (is not

[PATCH 1/6] KVM: PPC: Book3S HV: Host-side RM data structures

2015-10-29 Thread Suresh Warrier
This patch defines the data structures to support the setting up of host side operations while running in real mode in the guest, and also the functions to allocate and free it. The operations are for now limited to virtual XICS operations. Currently, we have only defined one operation in the

[PATCH 4/6] KVM: PPC: Book3S HV: Host side kick VCPU when poked by real-mode KVM

2015-10-29 Thread Suresh Warrier
This patch adds the support for the kick VCPU operation for kvmppc_host_rm_ops. The kvmppc_xics_ipi_action() function provides the function to be invoked for a host side operation when poked by the real mode KVM. This is initiated by KVM by sending an IPI to any free host core. KVM real mode must

[PATCH 2/6] KVM: PPC: Book3S HV: Manage core host state

2015-10-29 Thread Suresh Warrier
Update the core host state in kvmppc_host_rm_ops whenever the primary thread of the core enters the guest or returns back. Signed-off-by: Suresh Warrier --- arch/powerpc/kvm/book3s_hv.c | 44 1 file changed, 44

[PATCH 3/6] KVM: PPC: Book3S HV: kvmppc_host_rm_ops - handle offlining CPUs

2015-10-29 Thread Suresh Warrier
The kvmppc_host_rm_ops structure keeps track of which cores are are in the host by maintaining a bitmask of active/runnable online CPUs that have not entered the guest. This patch adds support to manage the bitmask when a CPU is offlined or onlined in the host. Signed-off-by: Suresh Warrier

[PATCH 0/6] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI

2015-10-29 Thread Suresh Warrier
When the VCPU target of an H_IPI hypercall is not running in the guest, we need to do a kick VCPU (wake the VCPU thread) to make it runnable. The real-mode version of the H_IPI hypercall cannot do this because it involves waking a sleeping thread. Thus the hcall returns H_TOO_HARD which forces a

[PATCH 6/6] KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection

2015-10-29 Thread Suresh Warrier
Redirecting the wakeup of a VCPU from the H_IPI hypercall to a core running in the host is usually a good idea, most workloads seemed to benefit. However, in one heavily interrupt-driven SMT1 workload, some regression was observed. This patch adds a kvm_hv module parameter called h_ipi_redirect to

Re: [RFC Patch 00/12] IXGBE: Add live migration support for SRIOV NIC

2015-10-29 Thread Lan Tianyu
On 2015年10月26日 23:03, Alexander Duyck wrote: > No. I think you are missing the fact that there are 256 descriptors per > page. As such if you dirty just 1 you will be pulling in 255 more, of > which you may or may not have pulled in the receive buffer for. > > So for example if you have the

[PATCH] target-i386: enable cflushopt/clwb/pcommit instructions

2015-10-29 Thread Xiao Guangrong
These instructions are used by NVDIMM drivers and the specification locates at: https://software.intel.com/sites/default/files/managed/0d/53/319433-022.pdf There instructions are available on Skylake Server Signed-off-by: Xiao Guangrong --- target-i386/cpu.c | 8

Re: [RFC Patch 00/12] IXGBE: Add live migration support for SRIOV NIC

2015-10-29 Thread Alexander Duyck
On 10/28/2015 11:12 PM, Lan Tianyu wrote: On 2015年10月26日 23:03, Alexander Duyck wrote: No. I think you are missing the fact that there are 256 descriptors per page. As such if you dirty just 1 you will be pulling in 255 more, of which you may or may not have pulled in the receive buffer for.

Re: [PATCH v1 2/2] dma-mapping-common: add DMA attribute - DMA_ATTR_IOMMU_BYPASS

2015-10-29 Thread Shamir Rabinovitch
On Thu, Oct 29, 2015 at 09:42:12AM +0900, David Woodhouse wrote: > Aside from the lack of security, the other disadvantage of that is that > you have to pin *all* pages of a guest in case DMA happens; you don't > get to pin *only* those pages which are referenced by that guest's > IOMMU page

Re: [RFC Patch 00/12] IXGBE: Add live migration support for SRIOV NIC

2015-10-29 Thread Lan Tianyu
On 2015年10月29日 14:58, Alexander Duyck wrote: > > Your code was having to do a bunch of shuffling in order to get things > set up so that you could bring the interface back up. I would argue > that it may actually be faster at least on the bring-up to just drop the > old rings and start over

[PATCH net-next rfc V2 2/2] vhost_net: basic polling support

2015-10-29 Thread Jason Wang
This patch tries to poll for new added tx buffer for a while at the end of tx processing. The maximum time spent on polling were limited through a module parameter. To avoid block rx, the loop will end it there's new other works queued on vhost so in fact socket receive queue is also be polled.

[PATCH net-next rfc V2 0/2] basic busy polling support for vhost_net

2015-10-29 Thread Jason Wang
Hi all: This series tries to add basic busy polling for vhost net. The idea is simple: at the end of tx processing, busy polling for new tx added descriptor and rx receive socket for a while. The maximum number of time (in us) could be spent on busy polling was specified through module parameter.

[PATCH net-next rfc V2 1/2] vhost: introduce vhost_has_work()

2015-10-29 Thread Jason Wang
This path introduces a helper which can give a hint for whether or not there's a work queued in the work list. Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 7 +++ drivers/vhost/vhost.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/vhost/vhost.c

Re: [PATCH v3 0/3] virtio DMA API core stuff

2015-10-29 Thread Michael S. Tsirkin
On Wed, Oct 28, 2015 at 03:51:58PM -0700, Andy Lutomirski wrote: > On Wed, Oct 28, 2015 at 9:12 AM, Michael S. Tsirkin wrote: > > On Wed, Oct 28, 2015 at 11:32:34PM +0900, David Woodhouse wrote: > >> > I don't have a problem with extending DMA API to address > >> > more usecases.

Re: [RFC PATCH] VFIO: Add a parameter to force nonthread IRQ

2015-10-29 Thread Paolo Bonzini
On 29/10/2015 04:11, Alex Williamson wrote: > > The irqfd is already able to schedule a work item, because it runs with > > interrupts disabled, so I think we can always return IRQ_HANDLED. > > I'm confused by this. The problem with adding IRQF_NO_THREAD to our > current handler is that it hits

Re: [PATCH v3 8/9] kvm/x86: Hyper-V synthetic interrupt controller

2015-10-29 Thread Roman Kagan
On Wed, Oct 28, 2015 at 06:41:45PM +0100, Paolo Bonzini wrote: > Hi Andrey, > > just one question. Is kvm_arch_set_irq actually needed? I think > everything should work fine without it. Can you check? If so, I can > remove it myself and revert the patch that introduced the hook. While Andrey

Re: [PATCH v3 8/9] kvm/x86: Hyper-V synthetic interrupt controller

2015-10-29 Thread Andrey Smetanin
On 10/28/2015 08:41 PM, Paolo Bonzini wrote: Hi Andrey, just one question. Is kvm_arch_set_irq actually needed? I think everything should work fine without it. Can you check? If so, I can remove it myself and revert the patch that introduced the hook. Hi Paolo, I have checked that

Re: [PATCH v3 8/9] kvm/x86: Hyper-V synthetic interrupt controller

2015-10-29 Thread Paolo Bonzini
On 29/10/2015 09:45, Roman Kagan wrote: > While Andrey is testing it, I'd like to ask similar question re. MSI: > why is there a "shortcut" for KVM_IRQ_ROUTING_MSI case (which we > basically modelled after) when it would probably get handled through > ->set handler in irqfd_inject() too?

Re: Steal time accounting in KVM. Benchmark.

2015-10-29 Thread Wanpeng Li
Hi Paolo, On 10/24/15 10:03 AM, Alexey Makhalov wrote: What I figured out. It happens in intersection of 3 features: *irq time accounting *stolen time accounting *linux guest with tickless idle only (not fully tickless) Looks like timer interrupts storm is happening during this benchmark

Re: [RFC Patch 00/12] IXGBE: Add live migration support for SRIOV NIC

2015-10-29 Thread Lan Tianyu
On 2015年10月30日 00:17, Alexander Duyck wrote: > On 10/29/2015 01:33 AM, Lan Tianyu wrote: >> On 2015年10月29日 14:58, Alexander Duyck wrote: >>> Your code was having to do a bunch of shuffling in order to get things >>> set up so that you could bring the interface back up. I would argue >>> that it

Re: [PATCH 5/6] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU

2015-10-29 Thread kbuild test robot
Hi Suresh, [auto build test ERROR on kvm/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base] url: https://github.com/0day-ci/linux/commits/Suresh-Warrier/KVM-PPC-Book3S-HV-Optimize-wakeup-VCPU-from-H_IPI/20151030-081329 config:

Re: [PATCH v4 0/6] virtio core DMA API conversion

2015-10-29 Thread Andy Lutomirski
On Thu, Oct 29, 2015 at 6:09 PM, Andy Lutomirski wrote: > This switches virtio to use the DMA API unconditionally. I'm sure > it breaks things, but it seems to work on x86 using virtio-pci, with > and without Xen, and using both the modern 1.0 variant and the > legacy variant.

Re: [PATCH v1 2/2] dma-mapping-common: add DMA attribute - DMA_ATTR_IOMMU_BYPASS

2015-10-29 Thread Benjamin Herrenschmidt
On Thu, 2015-10-29 at 11:31 -0700, Andy Lutomirski wrote: > On Oct 28, 2015 6:11 PM, "Benjamin Herrenschmidt" > wrote: > > > > On Thu, 2015-10-29 at 09:42 +0900, David Woodhouse wrote: > > > On Thu, 2015-10-29 at 09:32 +0900, Benjamin Herrenschmidt wrote: > > > > > > >