Re: [PATCH net-next] tuntap: Fallback to automq on TUNSETSTEERINGEBPF prog negative return

2019-09-22 Thread Jason Wang
On 2019/9/23 上午11:00, Matt Cover wrote: On Sun, Sep 22, 2019 at 7:32 PM Jason Wang wrote: On 2019/9/23 上午9:20, Matt Cover wrote: On Sun, Sep 22, 2019 at 5:46 PM Jason Wang wrote: On 2019/9/23 上午1:43, Matt Cover wrote: On Sun, Sep 22, 2019 at 5:37 AM Michael S. Tsirkin wrote: On Fri

Re: [PATCH net-next] tuntap: Fallback to automq on TUNSETSTEERINGEBPF prog negative return

2019-09-22 Thread Jason Wang
On 2019/9/23 上午9:15, Matt Cover wrote: On Sun, Sep 22, 2019 at 5:51 PM Jason Wang wrote: On 2019/9/23 上午6:30, Matt Cover wrote: On Sun, Sep 22, 2019 at 1:36 PM Michael S. Tsirkin wrote: On Sun, Sep 22, 2019 at 10:43:19AM -0700, Matt Cover wrote: On Sun, Sep 22, 2019 at 5:37 AM Michael S

Re: [PATCH net-next] tuntap: Fallback to automq on TUNSETSTEERINGEBPF prog negative return

2019-09-22 Thread Jason Wang
On 2019/9/23 上午9:20, Matt Cover wrote: On Sun, Sep 22, 2019 at 5:46 PM Jason Wang wrote: On 2019/9/23 上午1:43, Matt Cover wrote: On Sun, Sep 22, 2019 at 5:37 AM Michael S. Tsirkin wrote: On Fri, Sep 20, 2019 at 11:58:43AM -0700, Matthew Cover wrote: Treat a negative return from

Re: [PATCH net-next] tuntap: Fallback to automq on TUNSETSTEERINGEBPF prog negative return

2019-09-22 Thread Jason Wang
On 2019/9/23 上午6:30, Matt Cover wrote: On Sun, Sep 22, 2019 at 1:36 PM Michael S. Tsirkin wrote: On Sun, Sep 22, 2019 at 10:43:19AM -0700, Matt Cover wrote: On Sun, Sep 22, 2019 at 5:37 AM Michael S. Tsirkin wrote: On Fri, Sep 20, 2019 at 11:58:43AM -0700, Matthew Cover wrote: Treat a

Re: [PATCH net-next] tuntap: Fallback to automq on TUNSETSTEERINGEBPF prog negative return

2019-09-22 Thread Jason Wang
On 2019/9/23 上午1:43, Matt Cover wrote: On Sun, Sep 22, 2019 at 5:37 AM Michael S. Tsirkin wrote: On Fri, Sep 20, 2019 at 11:58:43AM -0700, Matthew Cover wrote: Treat a negative return from a TUNSETSTEERINGEBPF bpf prog as a signal to fallback to tun_automq_select_queue() for tx queue

[RFC PATCH V2 4/6] virtio: introudce a mdev based transport

2019-09-20 Thread Jason Wang
the device with mdev based config ops. This means, unlike the exist hardware transport, this is a software transport between mdev driver and mdev device. The transport was implemented through device specific ops which is a part of mdev_parent_ops now. Signed-off-by: Jason Wang --- drivers/vfio/mdev

Re: [RFC v4 0/3] vhost: introduce mdev based hardware backend

2019-09-19 Thread Jason Wang
On 2019/9/20 上午10:16, Tiwei Bie wrote: On Fri, Sep 20, 2019 at 09:30:58AM +0800, Jason Wang wrote: On 2019/9/19 下午11:45, Tiwei Bie wrote: On Thu, Sep 19, 2019 at 09:08:11PM +0800, Jason Wang wrote: On 2019/9/18 下午10:32, Michael S. Tsirkin wrote: So I have some questions: 1) Compared

Re: [RFC {net,iproute2}-next 0/2] Introduce an eBPF hookpoint for tx queue selection in the XPS (Transmit Packet Steering) code.

2019-09-19 Thread Jason Wang
On 2019/9/20 上午8:05, Matt Cover wrote: On Thu, Sep 19, 2019 at 3:45 PM Matthew Cover wrote: WORK IN PROGRESS: * bpf program loading works! * txq steering via bpf program return code works! * bpf program unloading not working. * bpf program attached query not working. This patch

Re: [RFC v4 0/3] vhost: introduce mdev based hardware backend

2019-09-19 Thread Jason Wang
On 2019/9/19 下午11:45, Tiwei Bie wrote: On Thu, Sep 19, 2019 at 09:08:11PM +0800, Jason Wang wrote: On 2019/9/18 下午10:32, Michael S. Tsirkin wrote: So I have some questions: 1) Compared to method 2, what's the advantage of creating a new vhost char device? I guess it's for keep the API

Re: [RFC v4 0/3] vhost: introduce mdev based hardware backend

2019-09-19 Thread Jason Wang
On 2019/9/19 下午11:45, Tiwei Bie wrote: On Thu, Sep 19, 2019 at 09:08:11PM +0800, Jason Wang wrote: On 2019/9/18 下午10:32, Michael S. Tsirkin wrote: So I have some questions: 1) Compared to method 2, what's the advantage of creating a new vhost char device? I guess it's for keep the API

Re: [RFC v4 0/3] vhost: introduce mdev based hardware backend

2019-09-19 Thread Jason Wang
On 2019/9/18 下午10:32, Michael S. Tsirkin wrote: So I have some questions: 1) Compared to method 2, what's the advantage of creating a new vhost char device? I guess it's for keep the API compatibility? One benefit is that we can avoid doing vhost ioctls on VFIO device fd. Yes, but any

Re: [RFC PATCH 2/4] mdev: introduce helper to set per device dma ops

2019-09-17 Thread Jason Wang
On 2019/9/18 上午3:00, Alex Williamson wrote: On Tue, 10 Sep 2019 16:19:33 +0800 Jason Wang wrote: This patch introduces mdev_set_dma_ops() which allows parent to set per device DMA ops. This help for the kernel driver to setup a correct DMA mappings. Signed-off-by: Jason Wang --- drivers

Re: [RFC v4 0/3] vhost: introduce mdev based hardware backend

2019-09-17 Thread Jason Wang
On 2019/9/17 下午6:58, Tiwei Bie wrote: On Tue, Sep 17, 2019 at 11:32:03AM +0800, Jason Wang wrote: On 2019/9/17 上午9:02, Tiwei Bie wrote: This RFC is to demonstrate below ideas, a) Build vhost-mdev on top of the same abstraction defined in the virtio-mdev series [1]; b) Introduce /dev

Re: [RFC v4 3/3] vhost: introduce mdev based hardware backend

2019-09-17 Thread Jason Wang
On 2019/9/17 上午9:02, Tiwei Bie wrote: More details about this patch can be found from the cover letter for now. Only compile test has been done for now. Signed-off-by: Tiwei Bie --- drivers/vhost/Kconfig| 9 + drivers/vhost/Makefile | 3 + drivers/vhost/mdev.c

Re: [RFC v4 0/3] vhost: introduce mdev based hardware backend

2019-09-16 Thread Jason Wang
On 2019/9/17 上午9:02, Tiwei Bie wrote: This RFC is to demonstrate below ideas, a) Build vhost-mdev on top of the same abstraction defined in the virtio-mdev series [1]; b) Introduce /dev/vhost-mdev to do vhost ioctls and support setting mdev device as backend; Now the userspace API

Re: [RFC v4 0/3] vhost: introduce mdev based hardware backend

2019-09-16 Thread Jason Wang
On 2019/9/17 上午9:02, Tiwei Bie wrote: This RFC is to demonstrate below ideas, a) Build vhost-mdev on top of the same abstraction defined in the virtio-mdev series [1]; b) Introduce /dev/vhost-mdev to do vhost ioctls and support setting mdev device as backend; Now the userspace API

[RFC PATCH 0/2] Mdev: support mutiple kinds of devices

2019-09-12 Thread Jason Wang
and move vfio callbacks there Sent for early reivew, compile test only! Thanks [1] https://lkml.org/lkml/2019/9/10/135 Jason Wang (2): mdev: device id support mdev: introduce device specific ops drivers/gpu/drm/i915/gvt/kvmgt.c | 16 --- drivers/s390/cio/vfio_ccw_ops.c | 16

Re: [RFC PATCH 3/4] virtio: introudce a mdev based transport

2019-09-11 Thread Jason Wang
On 2019/9/11 下午5:36, Michael S. Tsirkin wrote: On Wed, Sep 11, 2019 at 10:38:39AM +0800, Jason Wang wrote: On 2019/9/10 下午9:52, Michael S. Tsirkin wrote: On Tue, Sep 10, 2019 at 09:13:02PM +0800, Jason Wang wrote: On 2019/9/10 下午6:01, Michael S. Tsirkin wrote: +#ifndef _LINUX_VIRTIO_MDEV_H

Re: [RFC PATCH 3/4] virtio: introudce a mdev based transport

2019-09-10 Thread Jason Wang
On 2019/9/11 上午9:47, Tiwei Bie wrote: On Tue, Sep 10, 2019 at 04:19:34PM +0800, Jason Wang wrote: This path introduces a new mdev transport for virtio. This is used to use kernel virtio driver to drive the mediated device that is capable of populating virtqueue directly. A new virtio-mdev

Re: [RFC PATCH 3/4] virtio: introudce a mdev based transport

2019-09-10 Thread Jason Wang
On 2019/9/10 下午9:52, Michael S. Tsirkin wrote: On Tue, Sep 10, 2019 at 09:13:02PM +0800, Jason Wang wrote: On 2019/9/10 下午6:01, Michael S. Tsirkin wrote: +#ifndef _LINUX_VIRTIO_MDEV_H +#define _LINUX_VIRTIO_MDEV_H + +#include +#include +#include + +/* + * Ioctls + */ Pls add a bit more

Re: [RFC PATCH 4/4] docs: Sample driver to demonstrate how to implement virtio-mdev framework

2019-09-10 Thread Jason Wang
On 2019/9/10 下午6:15, Michael S. Tsirkin wrote: On Tue, Sep 10, 2019 at 04:19:35PM +0800, Jason Wang wrote: This sample driver creates mdev device that simulate virtio net device over virtio mdev transport. The device is implemented through vringh and workqueue. Signed-off-by: Jason Wang

Re: [RFC PATCH 3/4] virtio: introudce a mdev based transport

2019-09-10 Thread Jason Wang
On 2019/9/10 下午6:01, Michael S. Tsirkin wrote: +#ifndef _LINUX_VIRTIO_MDEV_H +#define _LINUX_VIRTIO_MDEV_H + +#include +#include +#include + +/* + * Ioctls + */ Pls add a bit more content here. It's redundant to state these are ioctls. Much better to document what does each one do. Ok.

[RFC PATCH 4/4] docs: Sample driver to demonstrate how to implement virtio-mdev framework

2019-09-10 Thread Jason Wang
This sample driver creates mdev device that simulate virtio net device over virtio mdev transport. The device is implemented through vringh and workqueue. Signed-off-by: Jason Wang --- samples/Kconfig| 7 + samples/vfio-mdev/Makefile | 1 + samples/vfio-mdev/mvnet.c | 766

[RFC PATCH 3/4] virtio: introudce a mdev based transport

2019-09-10 Thread Jason Wang
ending mdev_parent_ops. - for a quick POC, I just drive the transport from MMIO, I'm pretty there's lot of optimization space for this. Signed-off-by: Jason Wang --- drivers/vfio/mdev/Kconfig| 7 + drivers/vfio/mdev/Makefile | 1 + drivers/vfio/mdev/virtio_mdev.c

[RFC PATCH 2/4] mdev: introduce helper to set per device dma ops

2019-09-10 Thread Jason Wang
This patch introduces mdev_set_dma_ops() which allows parent to set per device DMA ops. This help for the kernel driver to setup a correct DMA mappings. Signed-off-by: Jason Wang --- drivers/vfio/mdev/mdev_core.c | 7 +++ include/linux/mdev.h | 2 ++ 2 files changed, 9 insertions

[RFC PATCH 1/4] vringh: fix copy direction of vringh_iov_push_kern()

2019-09-10 Thread Jason Wang
We want to copy from iov to buf, so the direction was wrong. Signed-off-by: Jason Wang --- drivers/vhost/vringh.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index 08ad0d1f0476..a0a2d74967ef 100644 --- a/drivers

[RFC PATCH 0/4] mdev based hardware virtio offloading support

2019-09-10 Thread Jason Wang
and this could be addressed by inventing new parent_ops. - For quick POC, mdev transport was just derived from virtio-MMIO, I'm pretty sure it has lots of space to be optimized, please share your thought. Please review. [1] https://lkml.org/lkml/2019/8/28/35 Jason Wang (4): vringh: fix copy

Re: [RFC PATCH untested] vhost: block speculation of translated descriptors

2019-09-10 Thread Jason Wang
On 2019/9/10 下午2:48, Michael S. Tsirkin wrote: On Tue, Sep 10, 2019 at 09:52:10AM +0800, Jason Wang wrote: On 2019/9/9 下午10:45, Michael S. Tsirkin wrote: On Mon, Sep 09, 2019 at 03:19:55PM +0800, Jason Wang wrote: On 2019/9/8 下午7:05, Michael S. Tsirkin wrote: iovec addresses coming from

Re: [RFC PATCH untested] vhost: block speculation of translated descriptors

2019-09-09 Thread Jason Wang
On 2019/9/9 下午10:45, Michael S. Tsirkin wrote: On Mon, Sep 09, 2019 at 03:19:55PM +0800, Jason Wang wrote: On 2019/9/8 下午7:05, Michael S. Tsirkin wrote: iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range. Userspace

Re: [PATCH 2/2] vhost: re-introducing metadata acceleration through kernel virtual address

2019-09-09 Thread Jason Wang
On 2019/9/9 下午12:45, Michael S. Tsirkin wrote: Since idx can be speculated, I guess we need array_index_nospec here? So we have ACQUIRE(mmu_lock) get idx RELEASE(mmu_lock) ACQUIRE(mmu_lock) read array[idx] RELEASE(mmu_lock) Then I think idx can't be speculated consider we've passed

Re: [RFC PATCH untested] vhost: block speculation of translated descriptors

2019-09-09 Thread Jason Wang
On 2019/9/8 下午7:05, Michael S. Tsirkin wrote: iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range. Userspace address are later validated with array_index_nospec so we can be sure kernel info does not leak through these

Re: [PATCH 0/2] Revert and rework on the metadata accelreation

2019-09-09 Thread Jason Wang
On 2019/9/6 下午9:15, David Miller wrote: From: Jason Wang Date: Fri, 6 Sep 2019 18:02:35 +0800 On 2019/9/5 下午9:59, Jason Gunthorpe wrote: I think you should apply the revert this cycle and rebase the other patch for next.. Jason Yes, the plan is to revert in this release cycle. Then you

Re: [PATCH 1/2] Revert "vhost: access vq metadata through kernel virtual address"

2019-09-09 Thread Jason Wang
On 2019/9/6 下午9:46, Michael S. Tsirkin wrote: On Thu, Sep 05, 2019 at 08:27:35PM +0800, Jason Wang wrote: It was reported that metadata acceleration introduces several issues, so this patch reverts commit ff466032dc9e5a61217f22ea34b2df932786bbfc, 73f628ec9e6bcc45b77c53fe6d0c0ec55eaf82af

Re: [PATCH 2/2] vhost: re-introducing metadata acceleration through kernel virtual address

2019-09-08 Thread Jason Wang
On 2019/9/9 上午10:18, Jason Wang wrote: On a elder CPU Sandy Bridge without SMAP support. TX PPS doesn't see any difference. Why is not Kaby Lake with SMAP off the same as Sandy Bridge? I don't know, I guess it was because the atomic is l Sorry, I meant atomic costs less for Kaby Lake

Re: [PATCH 0/2] Revert and rework on the metadata accelreation

2019-09-08 Thread Jason Wang
On 2019/9/7 下午11:03, Jason Gunthorpe wrote: On Fri, Sep 06, 2019 at 06:02:35PM +0800, Jason Wang wrote: On 2019/9/5 下午9:59, Jason Gunthorpe wrote: On Thu, Sep 05, 2019 at 08:27:34PM +0800, Jason Wang wrote: Hi: Per request from Michael and Jason, the metadata accelreation is reverted

Re: [PATCH 2/2] vhost: re-introducing metadata acceleration through kernel virtual address

2019-09-08 Thread Jason Wang
On 2019/9/8 下午7:05, Michael S. Tsirkin wrote: On Thu, Sep 05, 2019 at 08:27:36PM +0800, Jason Wang wrote: This is a rework on the commit 7f466032dc9e ("vhost: access vq metadata through kernel virtual address"). It was noticed that the copy_to/from_user() friends that was used

Re: [PATCH 2/2] vhost: re-introducing metadata acceleration through kernel virtual address

2019-09-06 Thread Jason Wang
On 2019/9/6 上午11:21, Hillf Danton wrote: On Thu, 5 Sep 2019 20:27:36 +0800 From: Jason Wang +static void vhost_set_map_dirty(struct vhost_virtqueue *vq, + struct vhost_map *map, int index) +{ + struct vhost_uaddr *uaddr = >uaddrs[index]; + in

Re: [PATCH 0/2] Revert and rework on the metadata accelreation

2019-09-06 Thread Jason Wang
On 2019/9/5 下午9:59, Jason Gunthorpe wrote: On Thu, Sep 05, 2019 at 08:27:34PM +0800, Jason Wang wrote: Hi: Per request from Michael and Jason, the metadata accelreation is reverted in this version and rework in next version. Please review. Thanks Jason Wang (2): Revert "vhost: a

[PATCH 2/2] vhost: re-introducing metadata acceleration through kernel virtual address

2019-09-05 Thread Jason Wang
ernel.org Signed-off-by: Jason Wang Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.c | 551 +- drivers/vhost/vhost.h | 41 2 files changed, 589 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.

[PATCH 1/2] Revert "vhost: access vq metadata through kernel virtual address"

2019-09-05 Thread Jason Wang
-off-by: Jason Wang --- drivers/vhost/vhost.c | 515 +- drivers/vhost/vhost.h | 41 2 files changed, 3 insertions(+), 553 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 0536f8526359..791562e03fe0 100644 --- a/drivers/vhost

[PATCH 0/2] Revert and rework on the metadata accelreation

2019-09-05 Thread Jason Wang
Hi: Per request from Michael and Jason, the metadata accelreation is reverted in this version and rework in next version. Please review. Thanks Jason Wang (2): Revert "vhost: access vq metadata through kernel virtual address" vhost: re-introducing metadata acceleration thro

Re: [RFC v3] vhost: introduce mdev based hardware vhost backend

2019-09-03 Thread Jason Wang
On 2019/9/4 上午10:48, Tiwei Bie wrote: On Tue, Sep 03, 2019 at 07:26:03AM -0400, Michael S. Tsirkin wrote: On Wed, Aug 28, 2019 at 01:37:12PM +0800, Tiwei Bie wrote: Details about this can be found here: https://lwn.net/Articles/750770/ What's new in this version ==

Re: [RFC v3] vhost: introduce mdev based hardware vhost backend

2019-09-02 Thread Jason Wang
On 2019/9/3 上午9:56, Tiwei Bie wrote: On Mon, Sep 02, 2019 at 12:15:05PM +0800, Jason Wang wrote: On 2019/8/28 下午1:37, Tiwei Bie wrote: Details about this can be found here: https://lwn.net/Articles/750770/ What's new in this version == There are three choices based

Re: [RFC v3] vhost: introduce mdev based hardware vhost backend

2019-09-01 Thread Jason Wang
On 2019/8/28 下午1:37, Tiwei Bie wrote: Details about this can be found here: https://lwn.net/Articles/750770/ What's new in this version == There are three choices based on the discussion [1] in RFC v2: #1. We expose a VFIO device, so we can reuse the VFIO

Re: [PATCH] virtio: Change typecasts in vring_init()

2019-08-29 Thread Jason Wang
On 2019/8/27 下午11:20, Matej Genci wrote: > Compilers such as g++ 7.3 complain about assigning void* variable to > a non-void* variable (like struct pointers) and pointer arithmetics > on void*. > > Signed-off-by: Matej Genci > --- > include/uapi/linux/virtio_ring.h | 9 + > 1 file

Re: [PATCH 2/2] vhost/test: fix build for vhost test

2019-08-29 Thread Jason Wang
VHOST_TEST_VQ] = >vqs[VHOST_TEST_VQ]; > n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick; > - vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV); > + vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV, > +VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT); > > f->private_data = n; > Acked-by: Jason Wang

Re: [PATCH 1/2] vhost/test: fix build for vhost test

2019-08-29 Thread Jason Wang
pen(struct inode *inode, struct > file *f) > dev = >dev; > vqs[VHOST_TEST_VQ] = >vqs[VHOST_TEST_VQ]; > n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick; > - vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX); > + vhost_dev_init(dev, vqs, VHOST_TES

Re: [PATCH V5 0/9] Fixes for vhost metadata acceleration

2019-08-19 Thread Jason Wang
On 2019/8/20 上午5:08, Michael S. Tsirkin wrote: On Tue, Aug 13, 2019 at 04:12:49PM +0800, Jason Wang wrote: On 2019/8/12 下午5:49, Michael S. Tsirkin wrote: On Mon, Aug 12, 2019 at 10:44:51AM +0800, Jason Wang wrote: On 2019/8/11 上午1:52, Michael S. Tsirkin wrote: On Fri, Aug 09, 2019 at 01:48

Re: [PATCH v2] virtio-net: lower min ring num_free for efficiency

2019-08-15 Thread Jason Wang
_delayed_work(>refill, 0); } Acked-by: Jason Wang

Re: [PATCH] virtio-net: lower min ring num_free for efficiency

2019-08-15 Thread Jason Wang
On 2019/8/15 下午4:36, 冉 jiang wrote: On 2019/8/15 11:17, Jason Wang wrote: On 2019/8/15 上午11:11, 冉 jiang wrote: On 2019/8/15 11:01, Jason Wang wrote: On 2019/8/14 上午10:06, ? jiang wrote: This change lowers ring buffer reclaim threshold from 1/2*queue to budget for better performance

Re: [PATCH] virtio-net: lower min ring num_free for efficiency

2019-08-15 Thread Jason Wang
On 2019/8/15 下午4:36, 冉 jiang wrote: On 2019/8/15 11:17, Jason Wang wrote: On 2019/8/15 上午11:11, 冉 jiang wrote: On 2019/8/15 11:01, Jason Wang wrote: On 2019/8/14 上午10:06, ? jiang wrote: This change lowers ring buffer reclaim threshold from 1/2*queue to budget for better performance

Re: [PATCH V5 0/9] Fixes for vhost metadata acceleration

2019-08-14 Thread Jason Wang
On 2019/8/14 上午12:41, Christoph Hellwig wrote: On Tue, Aug 13, 2019 at 08:57:07AM -0300, Jason Gunthorpe wrote: On Tue, Aug 13, 2019 at 04:31:07PM +0800, Jason Wang wrote: What kind of issues do you see? Spinlock is to synchronize GUP with MMU notifier in this series. A GUP that can't

Re: [PATCH V5 0/9] Fixes for vhost metadata acceleration

2019-08-14 Thread Jason Wang
On 2019/8/13 下午7:57, Jason Gunthorpe wrote: On Tue, Aug 13, 2019 at 04:31:07PM +0800, Jason Wang wrote: What kind of issues do you see? Spinlock is to synchronize GUP with MMU notifier in this series. A GUP that can't sleep can't pagefault which makes it a really weird pattern My

Re: [PATCH] virtio-net: lower min ring num_free for efficiency

2019-08-14 Thread Jason Wang
On 2019/8/15 上午11:11, 冉 jiang wrote: On 2019/8/15 11:01, Jason Wang wrote: On 2019/8/14 上午10:06, ? jiang wrote: This change lowers ring buffer reclaim threshold from 1/2*queue to budget for better performance. According to our test with qemu + dpdk, packet dropping happens when the guest

Re: [PATCH] virtio-net: lower min ring num_free for efficiency

2019-08-14 Thread Jason Wang
On 2019/8/14 上午10:06, ? jiang wrote: This change lowers ring buffer reclaim threshold from 1/2*queue to budget for better performance. According to our test with qemu + dpdk, packet dropping happens when the guest is not able to provide free buffer in avail ring timely with default 1/2*queue.

Re: [PATCH V5 0/9] Fixes for vhost metadata acceleration

2019-08-13 Thread Jason Wang
On 2019/8/12 下午9:02, Jason Gunthorpe wrote: On Mon, Aug 12, 2019 at 05:49:08AM -0400, Michael S. Tsirkin wrote: On Mon, Aug 12, 2019 at 10:44:51AM +0800, Jason Wang wrote: On 2019/8/11 上午1:52, Michael S. Tsirkin wrote: On Fri, Aug 09, 2019 at 01:48:42AM -0400, Jason Wang wrote: Hi all

Re: [PATCH V5 0/9] Fixes for vhost metadata acceleration

2019-08-13 Thread Jason Wang
On 2019/8/12 下午5:49, Michael S. Tsirkin wrote: On Mon, Aug 12, 2019 at 10:44:51AM +0800, Jason Wang wrote: On 2019/8/11 上午1:52, Michael S. Tsirkin wrote: On Fri, Aug 09, 2019 at 01:48:42AM -0400, Jason Wang wrote: Hi all: This series try to fix several issues introduced by meta data

Re: [PATCH v3 2/2] virtio: decrement avail idx with buffer detach for packed ring

2019-08-11 Thread Jason Wang
return buf; } Acked-by: Jason Wang

Re: [PATCH V5 0/9] Fixes for vhost metadata acceleration

2019-08-11 Thread Jason Wang
On 2019/8/11 上午1:52, Michael S. Tsirkin wrote: On Fri, Aug 09, 2019 at 01:48:42AM -0400, Jason Wang wrote: Hi all: This series try to fix several issues introduced by meta data accelreation series. Please review. Changes from V4: - switch to use spinlock synchronize MMU notifier

[PATCH V5 4/9] vhost: reset invalidate_count in vhost_set_vring_num_addr()

2019-08-08 Thread Jason Wang
accessor path. Fixing by reset the count to zero. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/vhost

[PATCH V5 3/9] vhost: fix vhost map leak

2019-08-08 Thread Jason Wang
We don't free map during vhost_map_unprefetch(). This means it could be leaked. Fixing by free the map. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 4 +--- 1 fi

[PATCH V5 6/9] vhost: don't do synchronize_rcu() in vhost_uninit_vq_maps()

2019-08-08 Thread Jason Wang
: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c12cdadb0855..cfc11f9ed9c9 100644 ---

[PATCH V5 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-08 Thread Jason Wang
. This means we are not as fast as what 7f466032dc9e did because the spinlock overhead in the datapath. This needs to be addressed in the future. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --

[PATCH V5 2/9] vhost: validate MMU notifier registration

2019-08-08 Thread Jason Wang
. Reported-and-tested-by: syzbot+e58112d71f77113dd...@syzkaller.appspotmail.com Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 19 +++ drivers/vhost/vhost.h | 1 + 2 files changed, 16

[PATCH V5 1/9] vhost: don't set uaddr for invalid address

2019-08-08 Thread Jason Wang
We should not setup uaddr for the invalid address, otherwise we may try to pin or prefetch mapping of wrong pages. Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 3 ++- 1 file changed, 2 insert

[PATCH V5 9/9] vhost: do not return -EAGAIN for non blocking invalidation too early

2019-08-08 Thread Jason Wang
Instead of returning -EAGAIN unconditionally, we'd better do that only we're sure the range is overlapped with the metadata area. Reported-by: Jason Gunthorpe Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vho

[PATCH V5 5/9] vhost: mark dirty pages during map uninit

2019-08-08 Thread Jason Wang
We don't mark dirty pages if the map was teared down outside MMU notifier. This will lead untracked dirty pages. Fixing by marking dirty pages during map uninit. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off

[PATCH V5 8/9] vhost: correctly set dirty pages in MMU notifiers callback

2019-08-08 Thread Jason Wang
We need make sure there's no reference on the map before trying to mark set dirty pages. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 5 ++--- 1 file changed, 2

[PATCH V5 0/9] Fixes for vhost metadata acceleration

2019-08-08 Thread Jason Wang
notifier with vhost worker Changes from V1: - try not use RCU to syncrhonize MMU notifier with vhost worker - set dirty pages after no readers - return -EAGAIN only when we find the range is overlapped with metadata Jason Wang (9): vhost: don't set uaddr for invalid address vhost: validate MMU

Re: [PATCH V4 0/9] Fixes for metadata accelreation

2019-08-08 Thread Jason Wang
On 2019/8/9 下午1:15, David Miller wrote: From: Jason Wang Date: Wed, 7 Aug 2019 03:06:08 -0400 This series try to fix several issues introduced by meta data accelreation series. Please review. ... My impression is that patch #7 will be changed to use spinlocks so there will be a v5

Re: [PATCH V4 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-08 Thread Jason Wang
- Original Message - > > On 2019/8/7 下午10:02, Jason Wang wrote: > > > > On 2019/8/7 下午8:07, Jason Gunthorpe wrote: > >> On Wed, Aug 07, 2019 at 03:06:15AM -0400, Jason Wang wrote: > >>> We used to use RCU to synchronize MMU notifier with worker. T

Re: [PATCH V4 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-08 Thread Jason Wang
On 2019/8/7 下午10:02, Jason Wang wrote: > > On 2019/8/7 下午8:07, Jason Gunthorpe wrote: >> On Wed, Aug 07, 2019 at 03:06:15AM -0400, Jason Wang wrote: >>> We used to use RCU to synchronize MMU notifier with worker. This leads >>> calling synchronize_rcu() in invalidat

Re: [PATCH V4 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-07 Thread Jason Wang
On 2019/8/7 下午8:07, Jason Gunthorpe wrote: On Wed, Aug 07, 2019 at 03:06:15AM -0400, Jason Wang wrote: We used to use RCU to synchronize MMU notifier with worker. This leads calling synchronize_rcu() in invalidate_range_start(). But on a busy system, there would be many factors that may slow

[PATCH V4 9/9] vhost: do not return -EAGAIN for non blocking invalidation too early

2019-08-07 Thread Jason Wang
Instead of returning -EAGAIN unconditionally, we'd better do that only we're sure the range is overlapped with the metadata area. Reported-by: Jason Gunthorpe Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vho

[PATCH V4 3/9] vhost: fix vhost map leak

2019-08-07 Thread Jason Wang
We don't free map during vhost_map_unprefetch(). This means it could be leaked. Fixing by free the map. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 4 +--- 1 fi

[PATCH V4 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-07 Thread Jason Wang
again then we are synchronized. Consider the read critical section is pretty small the synchronization should be done very fast. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vho

[PATCH V4 4/9] vhost: reset invalidate_count in vhost_set_vring_num_addr()

2019-08-07 Thread Jason Wang
accessor path. Fixing by reset the count to zero. Reported-by: Michael S. Tsirkin Reported-by: Jason Gunthorpe Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 4 1 file changed, 4 insertions(+)

[PATCH V4 1/9] vhost: don't set uaddr for invalid address

2019-08-07 Thread Jason Wang
We should not setup uaddr for the invalid address, otherwise we may try to pin or prefetch mapping of wrong pages. Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 3 ++- 1 file changed, 2 insert

[PATCH V4 0/9] Fixes for metadata accelreation

2019-08-07 Thread Jason Wang
notifier with vhost worker - set dirty pages after no readers - return -EAGAIN only when we find the range is overlapped with metadata Jason Wang (9): vhost: don't set uaddr for invalid address vhost: validate MMU notifier registration vhost: fix vhost map leak vhost: reset invalidate_count

[PATCH V4 6/9] vhost: don't do synchronize_rcu() in vhost_uninit_vq_maps()

2019-08-07 Thread Jason Wang
: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c12cdadb0855..cfc11f9ed9c9 100644 ---

[PATCH V4 5/9] vhost: mark dirty pages during map uninit

2019-08-07 Thread Jason Wang
We don't mark dirty pages if the map was teared down outside MMU notifier. This will lead untracked dirty pages. Fixing by marking dirty pages during map uninit. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off

[PATCH V4 2/9] vhost: validate MMU notifier registration

2019-08-07 Thread Jason Wang
. Reported-and-tested-by: syzbot+e58112d71f77113dd...@syzkaller.appspotmail.com Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 19 +++ drivers/vhost/vhost.h | 1 + 2 files changed, 16

[PATCH V4 8/9] vhost: correctly set dirty pages in MMU notifiers callback

2019-08-07 Thread Jason Wang
We need make sure there's no reference on the map before trying to mark set dirty pages. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 5 ++--- 1 file changed, 2

Re: [PATCH V3 01/10] vhost: disable metadata prefetch optimization

2019-08-07 Thread Jason Wang
On 2019/8/7 下午2:54, Jason Wang wrote: From: "Michael S. Tsirkin" This seems to cause guest and host memory corruption. Disable for now until we get a better handle on that. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.h | 2 +- 1 file changed, 1 insertion(+),

[PATCH V3 08/10] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-07 Thread Jason Wang
again then we are synchronized. Consider the read critical section is pretty small the synchronization should be done very fast. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vho

[PATCH V3 09/10] vhost: correctly set dirty pages in MMU notifiers callback

2019-08-07 Thread Jason Wang
We need make sure there's no reference on the map before trying to mark set dirty pages. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 5 ++--- 1 file changed, 2

[PATCH V3 07/10] vhost: don't do synchronize_rcu() in vhost_uninit_vq_maps()

2019-08-07 Thread Jason Wang
: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c12cdadb0855..cfc11f9ed9c9 100644 ---

[PATCH V3 06/10] vhost: mark dirty pages during map uninit

2019-08-07 Thread Jason Wang
We don't mark dirty pages if the map was teared down outside MMU notifier. This will lead untracked dirty pages. Fixing by marking dirty pages during map uninit. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off

[PATCH V3 04/10] vhost: fix vhost map leak

2019-08-07 Thread Jason Wang
We don't free map during vhost_map_unprefetch(). This means it could be leaked. Fixing by free the map. Reported-by: Michael S. Tsirkin Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 4 +--- 1 fi

[PATCH V3 10/10] vhost: do not return -EAGAIN for non blocking invalidation too early

2019-08-07 Thread Jason Wang
Instead of returning -EAGAIN unconditionally, we'd better do that only we're sure the range is overlapped with the metadata area. Reported-by: Jason Gunthorpe Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vho

[PATCH V3 05/10] vhost: reset invalidate_count in vhost_set_vring_num_addr()

2019-08-07 Thread Jason Wang
accessor path. Fixing by reset the count to zero. Reported-by: Michael S. Tsirkin Reported-by: Jason Gunthorpe Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 4 1 file changed, 4 insertions(+)

[PATCH V3 01/10] vhost: disable metadata prefetch optimization

2019-08-07 Thread Jason Wang
From: "Michael S. Tsirkin" This seems to cause guest and host memory corruption. Disable for now until we get a better handle on that. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/vhost.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/vhost.h

[PATCH V3 03/10] vhost: validate MMU notifier registration

2019-08-07 Thread Jason Wang
. Reported-and-tested-by: syzbot+e58112d71f77113dd...@syzkaller.appspotmail.com Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 19 +++ drivers/vhost/vhost.h | 1 + 2 files changed, 16

[PATCH V3 02/10] vhost: don't set uaddr for invalid address

2019-08-07 Thread Jason Wang
We should not setup uaddr for the invalid address, otherwise we may try to pin or prefetch mapping of wrong pages. Fixes: 7f466032dc9e ("vhost: access vq metadata through kernel virtual address") Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 3 ++- 1 file changed, 2 insert

[PATCH V3 00/10] Fixes for metadata accelreation

2019-08-07 Thread Jason Wang
no readers - return -EAGAIN only when we find the range is overlapped with metadata Jason Wang (9): vhost: don't set uaddr for invalid address vhost: validate MMU notifier registration vhost: fix vhost map leak vhost: reset invalidate_count in vhost_set_vring_num_addr() vhost: mark

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-07 Thread Jason Wang
On 2019/8/6 下午8:04, Jason Gunthorpe wrote: On Mon, Aug 05, 2019 at 12:20:45PM +0800, Jason Wang wrote: On 2019/8/2 下午8:46, Jason Gunthorpe wrote: On Fri, Aug 02, 2019 at 05:40:07PM +0800, Jason Wang wrote: This must be a proper barrier, like a spinlock, mutex, or synchronize_rcu. I start

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-05 Thread Jason Wang
On 2019/8/5 下午2:40, Michael S. Tsirkin wrote: On Mon, Aug 05, 2019 at 12:41:45PM +0800, Jason Wang wrote: On 2019/8/5 下午12:36, Jason Wang wrote: On 2019/8/2 下午10:27, Michael S. Tsirkin wrote: On Fri, Aug 02, 2019 at 09:46:13AM -0300, Jason Gunthorpe wrote: On Fri, Aug 02, 2019 at 05:40

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-05 Thread Jason Wang
On 2019/8/5 下午2:30, Michael S. Tsirkin wrote: On Mon, Aug 05, 2019 at 12:36:40PM +0800, Jason Wang wrote: On 2019/8/2 下午10:27, Michael S. Tsirkin wrote: On Fri, Aug 02, 2019 at 09:46:13AM -0300, Jason Gunthorpe wrote: On Fri, Aug 02, 2019 at 05:40:07PM +0800, Jason Wang wrote: This must

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-05 Thread Jason Wang
On 2019/8/5 下午2:28, Michael S. Tsirkin wrote: On Mon, Aug 05, 2019 at 12:33:45PM +0800, Jason Wang wrote: On 2019/8/2 下午10:03, Michael S. Tsirkin wrote: On Fri, Aug 02, 2019 at 05:40:07PM +0800, Jason Wang wrote: Btw, I come up another idea, that is to disable preemption when vhost thread

Re: [PATCH V2 7/9] vhost: do not use RCU to synchronize MMU notifier with worker

2019-08-05 Thread Jason Wang
On 2019/8/4 上午5:54, Michael S. Tsirkin wrote: On Thu, Aug 01, 2019 at 04:06:13AM -0400, Jason Wang wrote: On 2019/8/1 上午2:29, Michael S. Tsirkin wrote: On Wed, Jul 31, 2019 at 04:46:53AM -0400, Jason Wang wrote: We used to use RCU to synchronize MMU notifier with worker. This leads calling

<    5   6   7   8   9   10   11   12   13   14   >