[PATCH net-next 2/3] vhost: fine grain userspace memory accessors

2018-12-15 Thread Jason Wang
This is used to hide the metadata address from virtqueue helpers. This will allow to implement a vmap based fast accessing to metadata. Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 94 +++ 1 file changed, 77 insertions(+), 17 deletions(-) diff

Re: [virtio-dev] Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-12-15 Thread Auger Eric
Hi Robin On 12/13/18 1:37 PM, Robin Murphy wrote: > On 2018-12-12 3:27 pm, Auger Eric wrote: >> Hi, >> >> On 12/12/18 3:56 PM, Michael S. Tsirkin wrote: >>> On Fri, Dec 07, 2018 at 06:52:31PM +, Jean-Philippe Brucker wrote: Sorry for the delay, I wanted to do a little more performance

Re: [PATCH] Export mm_update_next_owner function for vhost-net

2018-12-15 Thread Jason Wang
On 2018/12/13 下午12:47, gchen.guo...@gmail.com wrote: From: guomin chen Under normal circumstances,When do_exit exits, mm->owner will be updated on exit_mm(). but when the kernel process calls unuse_mm() and then exits,mm->owner cannot be updated. And it will point to a task that has

Re: [PATCH v6 0/7] Add virtio-iommu driver

2018-12-15 Thread Jean-Philippe Brucker
Hi Joerg, On 12/12/2018 10:35, Joerg Roedel wrote: > Hi, > > to make progress on this, we should first agree on the protocol used > between guest and host. I have a few points to discuss on the protocol > first. > > On Tue, Dec 11, 2018 at 06:20:57PM +, Jean-Philippe Brucker wrote: >> [1]

Re: [PATCH] vhost: correct the related warning message

2018-12-15 Thread Sergei Shtylyov
On 13.12.2018 4:10, wangyan wrote: Fixes: 'commit d588cf8f618d ("target: Fix se_tpg_tfo->tf_subsys regression + remove tf_subsystem")' 'commit cbbd26b8b1a6 ("[iov_iter] new primitives - copy_from_iter_full() and friends")' Fixes: d588cf8f618d ("target: Fix se_tpg_tfo->tf_subsys

[PATCH net-next 0/3] vhost: accelerate metadata access through vmap()

2018-12-15 Thread Jason Wang
Hi: This series tries to access virtqueue metadata through kernel virtual address instead of copy_user() friends since they had too much overheads like checks, spec barriers or even hardware feature toggling. Test shows about 24% improvement on TX PPS. It should benefit other cases as well.

[PATCH] drm/virtio: switch to generic fbdev emulation

2018-12-15 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 14 --- drivers/gpu/drm/virtio/virtgpu_display.c | 1 - drivers/gpu/drm/virtio/virtgpu_drv.c | 9 +- drivers/gpu/drm/virtio/virtgpu_fb.c | 191 ---

[PATCH net-next 1/3] vhost: generalize adding used elem

2018-12-15 Thread Jason Wang
Use one generic vhost_copy_to_user() instead of two dedicated accessor. This will simplify the conversion to fine grain accessors. Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/vhost/vhost.c

Re: [PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host

2018-12-15 Thread jiangyiwen
On 2018/12/13 13:59, David Miller wrote: > From: jiangyiwen > Date: Thu, 13 Dec 2018 11:11:48 +0800 > >> I hope Host can fill fewer bytes into rx virtqueue, so >> I keep structure virtio_vsock_mrg_rxbuf_hdr one byte >> alignment. > > The question is if this actully matters. > > Do you know? >

[PATCH v2] x86, kbuild: revert macrofying inline assembly code

2018-12-15 Thread Masahiro Yamada
Revert the following 9 commits: [1] 5bdcd510c2ac ("x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs") This was partially reverted because it made good cleanups irrespective of the inlining issue; the error message is still unneeded, and the

Re: [virtio-dev] Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-12-15 Thread Robin Murphy
On 2018-12-12 3:27 pm, Auger Eric wrote: Hi, On 12/12/18 3:56 PM, Michael S. Tsirkin wrote: On Fri, Dec 07, 2018 at 06:52:31PM +, Jean-Philippe Brucker wrote: Sorry for the delay, I wanted to do a little more performance analysis before continuing. On 27/11/2018 18:10, Michael S. Tsirkin

[PATCH] kbuild, x86: revert macros in extended asm workarounds

2018-12-15 Thread Masahiro Yamada
Revert the following commits: - 5bdcd510c2ac9efaf55c4cbd8d46421d8e2320cd ("x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs") - d5a581d84ae6b8a4a740464b80d8d9cf1e7947b2 ("x86/cpufeature: Macrofy inline assembly code to work around GCC inlining bugs") -

[PATCH net-next 3/3] vhost: access vq metadata through kernel virtual address

2018-12-15 Thread Jason Wang
It was noticed that the copy_user() friends that was used to access virtqueue metdata tends to be very expensive for dataplane implementation like vhost since it involves lots of software check, speculation barrier, hardware feature toggling (e.g SMAP). The extra cost will be more obvious when

Re: [PATCH net V2 0/4] Fix various issue of vhost

2018-12-15 Thread David Miller
From: Jason Wang Date: Wed, 12 Dec 2018 18:08:15 +0800 > This series tries to fix various issues of vhost: > > - Patch 1 adds a missing write barrier between used idx updating and > logging. > - Patch 2-3 brings back the protection of device IOTLB through vq > mutex, this fixes possible use

Re: [PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host

2018-12-15 Thread David Miller
From: jiangyiwen Date: Wed, 12 Dec 2018 17:29:31 +0800 > diff --git a/include/uapi/linux/virtio_vsock.h > b/include/uapi/linux/virtio_vsock.h > index 1d57ed3..2292f30 100644 > --- a/include/uapi/linux/virtio_vsock.h > +++ b/include/uapi/linux/virtio_vsock.h > @@ -63,6 +63,11 @@ struct

Re: [PATCH v2 0/5] VSOCK: support mergeable rx buffer in vhost-vsock

2018-12-15 Thread jiangyiwen
On 2018/12/12 23:09, Michael S. Tsirkin wrote: > On Wed, Dec 12, 2018 at 05:25:50PM +0800, jiangyiwen wrote: >> Now vsock only support send/receive small packet, it can't achieve >> high performance. As previous discussed with Jason Wang, I revisit the >> idea of vhost-net about mergeable rx

Re: [PATCH v2 3/5] VSOCK: support receive mergeable rx buffer in guest

2018-12-15 Thread jiangyiwen
Hi Michael, On 2018/12/12 23:31, Michael S. Tsirkin wrote: > On Wed, Dec 12, 2018 at 05:31:39PM +0800, jiangyiwen wrote: >> Guest receive mergeable rx buffer, it can merge >> scatter rx buffer into a big buffer and then copy >> to user space. >> >> In addition, it also use iovec to replace buf in

Re: [PATCH net V2 4/4] vhost: log dirty page correctly

2018-12-15 Thread Jason Wang
On 2018/12/12 下午10:32, Michael S. Tsirkin wrote: On Wed, Dec 12, 2018 at 06:08:19PM +0800, Jason Wang wrote: Vhost dirty page logging API is designed to sync through GPA. But we try to log GIOVA when device IOTLB is enabled. This is wrong and may lead to missing data after migration. To solve

Re: [PATCH v2 1/5] VSOCK: support fill mergeable rx buffer in guest

2018-12-15 Thread jiangyiwen
On 2018/12/13 3:08, David Miller wrote: > From: jiangyiwen > Date: Wed, 12 Dec 2018 17:28:16 +0800 > >> +static int fill_mergeable_rx_buff(struct virtio_vsock *vsock, >> +struct virtqueue *vq) >> +{ >> +struct page_frag *alloc_frag = >alloc_frag; >> +struct scatterlist sg; >>

[PATCH net V3 1/3] vhost: make sure used idx is seen before log in vhost_add_used_n()

2018-12-15 Thread Jason Wang
We miss a write barrier that guarantees used idx is updated and seen before log. This will let userspace sync and copy used ring before used idx is update. Fix this by adding a barrier before log_write(). Fixes: 8dd014adfea6f ("vhost-net: mergeable buffers support") Acked-by: Michael S. Tsirkin

Re: [PATCH net V2 3/4] Revert "net: vhost: lock the vqs one by one"

2018-12-15 Thread Jason Wang
On 2018/12/12 下午10:24, Michael S. Tsirkin wrote: On Wed, Dec 12, 2018 at 06:08:18PM +0800, Jason Wang wrote: This reverts commit 78139c94dc8c96a478e67dab3bee84dc6eccb5fd. We don't protect device IOTLB with vq mutex, which will lead e.g use after free for device IOTLB entries. And since we've

[PATCH net V3 0/3] Fix various issue of vhost

2018-12-15 Thread Jason Wang
Hi: This series tries to fix various issues of vhost: - Patch 1 adds a missing write barrier between used idx updating and logging. - Patch 2-3 brings back the protection of device IOTLB through vq mutex, this fixes possible use after free in device IOTLB entries. Please consider them for

Re: [PATCH] vhost: correct the related warning message

2018-12-15 Thread Michael S. Tsirkin
On Thu, Dec 13, 2018 at 09:10:14AM +0800, wangyan wrote: > Fixes: 'commit d588cf8f618d ("target: Fix se_tpg_tfo->tf_subsys regression + > remove tf_subsystem")' >'commit cbbd26b8b1a6 ("[iov_iter] new primitives - > copy_from_iter_full() and friends")' > > Signed-off-by: Yan Wang >

Re: [PATCH net V2 0/4] Fix various issue of vhost

2018-12-15 Thread Jason Wang
On 2018/12/13 上午7:31, David Miller wrote: From: Jason Wang Date: Wed, 12 Dec 2018 18:08:15 +0800 This series tries to fix various issues of vhost: - Patch 1 adds a missing write barrier between used idx updating and logging. - Patch 2-3 brings back the protection of device IOTLB through

[PATCH net V3 2/3] vhost_net: switch to use mutex_trylock() in vhost_net_busy_poll()

2018-12-15 Thread Jason Wang
We used to hold the mutex of paired virtqueue in vhost_net_busy_poll(). But this will results an inconsistent lock order which may cause deadlock if we try to bring back the protection of device IOTLB with vq mutex that requires to hold mutex of all virtqueues at the same time. Fix this simply by

[PATCH net V3 3/3] Revert "net: vhost: lock the vqs one by one"

2018-12-15 Thread Jason Wang
This reverts commit 78139c94dc8c96a478e67dab3bee84dc6eccb5fd. We don't protect device IOTLB with vq mutex, which will lead e.g use after free for device IOTLB entries. And since we've switched to use mutex_trylock() in previous patch, it's safe to revert it without having deadlock. Fixes: commit

Re: [PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host

2018-12-15 Thread jiangyiwen
On 2018/12/12 23:37, Michael S. Tsirkin wrote: > On Wed, Dec 12, 2018 at 05:29:31PM +0800, jiangyiwen wrote: >> When vhost support VIRTIO_VSOCK_F_MRG_RXBUF feature, >> it will merge big packet into rx vq. >> >> Signed-off-by: Yiwen Jiang > > I feel this approach jumps into making interface

Re: [PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host

2018-12-15 Thread jiangyiwen
On 2018/12/13 3:09, David Miller wrote: > From: jiangyiwen > Date: Wed, 12 Dec 2018 17:29:31 +0800 > >> diff --git a/include/uapi/linux/virtio_vsock.h >> b/include/uapi/linux/virtio_vsock.h >> index 1d57ed3..2292f30 100644 >> --- a/include/uapi/linux/virtio_vsock.h >> +++

Re: [PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host

2018-12-15 Thread David Miller
From: jiangyiwen Date: Thu, 13 Dec 2018 11:11:48 +0800 > I hope Host can fill fewer bytes into rx virtqueue, so > I keep structure virtio_vsock_mrg_rxbuf_hdr one byte > alignment. The question is if this actully matters. Do you know? If the obejct this is embeeded inside of is at least 2 byte