Re: [PATCH] vhost: missing __user tags

2020-05-17 Thread Jason Wang
ct vhost_virtqueue *vq, - void *addr, unsigned int size, + void __user *addr, unsigned int size, int type) { void __user *uaddr = vhost_vq_meta_fetch(vq, Acked-by: Jason Wang

Re: [PATCH] vdpa_sim: do not reset IOTLB during device reset

2020-05-14 Thread Jason Wang
On 2020/5/14 下午5:35, Michael S. Tsirkin wrote: On Thu, May 14, 2020 at 03:25:49PM +0800, Jason Wang wrote: We reset IOTLB during device reset this breaks the assumption that the mapping needs to be controlled via vDPA DMA ops explicitly in a incremental way. So the networking will be broken

[PATCH] vdpa_sim: do not reset IOTLB during device reset

2020-05-14 Thread Jason Wang
We reset IOTLB during device reset this breaks the assumption that the mapping needs to be controlled via vDPA DMA ops explicitly in a incremental way. So the networking will be broken after e.g a guest reset. Fix this by not resetting the IOTLB during device reset. Signed-off-by: Jason Wang

Re: [PATCH V2] ifcvf: move IRQ request/free to status change handlers

2020-05-13 Thread Jason Wang
On 2020/5/13 下午12:42, Zhu, Lingshan wrote: On 5/13/2020 12:12 PM, Jason Wang wrote: On 2020/5/12 下午4:00, Zhu Lingshan wrote: This commit move IRQ request and free operations from probe() to VIRTIO status change handler to comply with VIRTIO spec. VIRTIO spec 1.1, section 2.1.2 Device

Re: [PATCH V2] ifcvf: move IRQ request/free to status change handlers

2020-05-12 Thread Jason Wang
On 2020/5/13 下午12:42, Zhu, Lingshan wrote: On 5/13/2020 12:12 PM, Jason Wang wrote: On 2020/5/12 下午4:00, Zhu Lingshan wrote: This commit move IRQ request and free operations from probe() to VIRTIO status change handler to comply with VIRTIO spec. VIRTIO spec 1.1, section 2.1.2 Device

Re: [PATCH V2] ifcvf: move IRQ request/free to status change handlers

2020-05-12 Thread Jason Wang
andler, we don't need to do this twice; handle status == 0 after DRIVER_OK -> !DRIVER_OK handler (Jason Wang) Patch looks good to me, but with this patch ping cannot work on my machine. (It works without this patch). Thanks drivers/vdpa/ifcvf/

Re: [PATCH RFC 00/15] Add VFIO mediated device support and IMS support for the idxd driver.

2020-05-12 Thread Jason Wang
On 2020/5/9 下午8:21, Jason Gunthorpe wrote: On Fri, May 08, 2020 at 05:09:09PM -0700, Raj, Ashok wrote: Hi Jason On Fri, May 08, 2020 at 08:16:10PM -0300, Jason Gunthorpe wrote: On Fri, May 08, 2020 at 01:47:10PM -0700, Raj, Ashok wrote: Even when uaccel was under development, one of the op

Re: [PATCH] ifcvf: move IRQ request/free to status change handlers

2020-05-11 Thread Jason Wang
On 2020/5/12 上午11:38, Jason Wang wrote:   static int ifcvf_start_datapath(void *private)   {   struct ifcvf_hw *vf = ifcvf_private_to_vf(private); @@ -118,9 +172,12 @@ static void ifcvf_vdpa_set_status(struct vdpa_device *vdpa_dev, u8 status)   {   struct ifcvf_adapter *adapter

Re: [PATCH] ifcvf: move IRQ request/free to status change handlers

2020-05-11 Thread Jason Wang
On 2020/5/11 下午6:18, Francesco Lavra wrote: On 5/11/20 11:26 AM, Jason Wang wrote: On 2020/5/11 下午3:19, Zhu Lingshan wrote: This commit move IRQ request and free operations from probe() to VIRTIO status change handler to comply with VIRTIO spec. VIRTIO spec 1.1, section 2.1.2 Device

Re: [PATCH] ifcvf: move IRQ request/free to status change handlers

2020-05-11 Thread Jason Wang
On 2020/5/11 下午6:11, Zhu, Lingshan wrote: On 5/11/2020 5:26 PM, Jason Wang wrote: On 2020/5/11 下午3:19, Zhu Lingshan wrote: This commit move IRQ request and free operations from probe() to VIRTIO status change handler to comply with VIRTIO spec. VIRTIO spec 1.1, section 2.1.2 Device

Re: [PATCH] ifcvf: move IRQ request/free to status change handlers

2020-05-11 Thread Jason Wang
On 2020/5/11 下午3:19, Zhu Lingshan wrote: This commit move IRQ request and free operations from probe() to VIRTIO status change handler to comply with VIRTIO spec. VIRTIO spec 1.1, section 2.1.2 Device Requirements: Device Status Field The device MUST NOT consume buffers or send any used buffer

Re: [PATCH -next] vdpasim: remove unused variable 'ret'

2020-05-07 Thread Jason Wang
seems too aggressive. So I prefer this patch. Acked-by: Jason Wang drivers/vdpa/vdpa_sim/vdpa_sim.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index 7957d2d41fc4..01c456f7c1f7 100644

Re: [PATCH v2 2/3] vfio-pci: Fault mmaps to enable vma tracking

2020-05-07 Thread Jason Wang
On 2020/5/8 上午10:16, Peter Xu wrote: On Thu, May 07, 2020 at 08:56:33PM -0300, Jason Gunthorpe wrote: On Thu, May 07, 2020 at 06:22:23PM -0400, Peter Xu wrote: On Thu, May 07, 2020 at 04:03:34PM -0600, Alex Williamson wrote: On Thu, 7 May 2020 17:47:44 -0400 Peter Xu wrote: Hi, Alex, On

Re: [PATCH net-next 1/2] virtio-net: don't reserve space for vnet header for XDP

2020-05-07 Thread Jason Wang
On 2020/5/6 下午5:46, Michael S. Tsirkin wrote: There are a lot of unanswered questions on how this will be implemented. Thus, I cannot layout how we are going to leverage this info yet, but your patch are killing this info, which IHMO is going in the wrong direction. I can copy vnet header ahea

Re: [PATCH net-next 1/2] virtio-net: don't reserve space for vnet header for XDP

2020-05-07 Thread Jason Wang
On 2020/5/6 下午5:54, Michael S. Tsirkin wrote: On Wed, May 06, 2020 at 04:19:40PM +0800, Jason Wang wrote: On 2020/5/6 下午3:53, Michael S. Tsirkin wrote: On Wed, May 06, 2020 at 02:16:32PM +0800, Jason Wang wrote: We tried to reserve space for vnet header before xdp.data_hard_start. But this

Re: [PATCH net-next 2/2] virtio-net: fix the XDP truesize calculation for mergeable buffers

2020-05-07 Thread Jason Wang
On 2020/5/6 下午8:08, Michael S. Tsirkin wrote: On Wed, May 06, 2020 at 04:21:15PM +0800, Jason Wang wrote: On 2020/5/6 下午3:37, Michael S. Tsirkin wrote: On Wed, May 06, 2020 at 02:16:33PM +0800, Jason Wang wrote: We should not exclude headroom and tailroom when XDP is set. So this patch

Re: performance bug in virtio net xdp

2020-05-06 Thread Jason Wang
On 2020/5/6 下午4:08, Michael S. Tsirkin wrote: So for mergeable bufs, we use ewma machinery to guess the correct buffer size. If we don't guess correctly, XDP has to do aggressive copies. Problem is, xdp paths do not update the ewma at all, except sometimes with XDP_PASS. So whatever we happen

Re: [PATCH net-next 1/2] virtio-net: don't reserve space for vnet header for XDP

2020-05-06 Thread Jason Wang
On 2020/5/6 下午4:21, Jesper Dangaard Brouer wrote: On Wed, 6 May 2020 14:16:32 +0800 Jason Wang wrote: We tried to reserve space for vnet header before xdp.data_hard_start. But this is useless since the packet could be modified by XDP which may invalidate the information stored in the

Re: [PATCH net-next 2/2] virtio-net: fix the XDP truesize calculation for mergeable buffers

2020-05-06 Thread Jason Wang
On 2020/5/6 下午3:37, Michael S. Tsirkin wrote: On Wed, May 06, 2020 at 02:16:33PM +0800, Jason Wang wrote: We should not exclude headroom and tailroom when XDP is set. So this patch fixes this by initializing the truesize from PAGE_SIZE when XDP is set. Cc: Jesper Dangaard Brouer Signed-off

Re: [PATCH net-next 1/2] virtio-net: don't reserve space for vnet header for XDP

2020-05-06 Thread Jason Wang
On 2020/5/6 下午3:53, Michael S. Tsirkin wrote: On Wed, May 06, 2020 at 02:16:32PM +0800, Jason Wang wrote: We tried to reserve space for vnet header before xdp.data_hard_start. But this is useless since the packet could be modified by XDP which may invalidate the information stored in the

[PATCH net-next 2/2] virtio-net: fix the XDP truesize calculation for mergeable buffers

2020-05-05 Thread Jason Wang
We should not exclude headroom and tailroom when XDP is set. So this patch fixes this by initializing the truesize from PAGE_SIZE when XDP is set. Cc: Jesper Dangaard Brouer Signed-off-by: Jason Wang --- drivers/net/virtio_net.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff

[PATCH net-next 1/2] virtio-net: don't reserve space for vnet header for XDP

2020-05-05 Thread Jason Wang
ot reserve space for vnet header in this case. Cc: Jesper Dangaard Brouer Signed-off-by: Jason Wang --- drivers/net/virtio_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 11f722460513..98dd75b665a5 100644 ---

Re: [PATCH] virtio_net: fix lockdep warning on 32 bit

2020-05-05 Thread Jason Wang
64_stats_update_end_irqrestore(&rq->stats.syncp); } return !oom; Acked-by: Jason Wang

Re: [RFC/PATCH 0/1] virtio_mmio: hypervisor specific interfaces for MMIO

2020-04-30 Thread Jason Wang
On 2020/4/30 下午6:07, Michael S. Tsirkin wrote: On Thu, Apr 30, 2020 at 03:32:55PM +0530, Srivatsa Vaddagiri wrote: The Type-1 hypervisor we are dealing with does not allow for MMIO transport. How about PCI then? Or maybe you can use virtio-vdpa. Thanks

Re: [PATCH net-next 0/3] vsock: support network namespace

2020-04-29 Thread Jason Wang
On 2020/4/29 上午12:00, Stefano Garzarella wrote: On Tue, Apr 28, 2020 at 04:13:22PM +0800, Jason Wang wrote: On 2020/4/27 下午10:25, Stefano Garzarella wrote: Hi David, Michael, Stefan, I'm restarting to work on this topic since Kata guys are interested to have that, especially on the

Re: [PATCH net-next 0/3] vsock: support network namespace

2020-04-28 Thread Jason Wang
On 2020/4/27 下午10:25, Stefano Garzarella wrote: Hi David, Michael, Stefan, I'm restarting to work on this topic since Kata guys are interested to have that, especially on the guest side. While working on the v2 I had few doubts, and I'd like to have your suggestions: 1. netns assigned to th

[PATCH V5 3/6] mdev: introduce device specific ops

2019-10-23 Thread Jason Wang
be used by vfio-mdev and virtio-mdev. Signed-off-by: Jason Wang --- .../driver-api/vfio-mediated-device.rst | 35 + MAINTAINERS | 1 + drivers/gpu/drm/i915/gvt/kvmgt.c | 18 --- drivers/s390/cio/vfio_ccw_ops.c

[PATCH V5 1/6] mdev: class id support

2019-10-23 Thread Jason Wang
ectly. So this patch adds id_table to mdev_driver and class_id for mdev device with the match method for mdev bus. Signed-off-by: Jason Wang --- .../driver-api/vfio-mediated-device.rst | 5 + drivers/gpu/drm/i915/gvt/kvmgt.c | 1 + drivers/s390/cio/vfio_ccw_

Re: [RFC 1/2] vhost: IFC VF hardware operation layer

2019-10-23 Thread Jason Wang
On 2019/10/23 下午6:13, Simon Horman wrote: On Tue, Oct 22, 2019 at 09:32:36AM +0800, Jason Wang wrote: On 2019/10/22 上午12:31, Simon Horman wrote: On Mon, Oct 21, 2019 at 05:55:33PM +0800, Zhu, Lingshan wrote: On 10/16/2019 5:53 PM, Simon Horman wrote: Hi Zhu, thanks for your patch. On Wed

Re: [PATCH v2] vhost: introduce mdev based hardware backend

2019-10-23 Thread Jason Wang
On 2019/10/23 下午6:11, Tiwei Bie wrote: On Wed, Oct 23, 2019 at 03:25:00PM +0800, Jason Wang wrote: On 2019/10/23 下午3:07, Tiwei Bie wrote: On Wed, Oct 23, 2019 at 01:46:23PM +0800, Jason Wang wrote: On 2019/10/23 上午11:02, Tiwei Bie wrote: On Tue, Oct 22, 2019 at 09:30:16PM +0800, Jason Wang

Re: [RFC 2/2] vhost: IFC VF vdpa layer

2019-10-23 Thread Jason Wang
On 2019/10/23 下午5:24, Zhu, Lingshan wrote: set_config/get_config is missing. It looks to me they are not hard, just implementing the access to dev_cfg. It's key to make kernel virtio driver to work. And in the new version of virito-mdev, features like _F_LOG_ALL should be advertised thro

Re: [PATCH v2] vhost: introduce mdev based hardware backend

2019-10-23 Thread Jason Wang
On 2019/10/23 下午3:07, Tiwei Bie wrote: On Wed, Oct 23, 2019 at 01:46:23PM +0800, Jason Wang wrote: On 2019/10/23 上午11:02, Tiwei Bie wrote: On Tue, Oct 22, 2019 at 09:30:16PM +0800, Jason Wang wrote: On 2019/10/22 下午5:52, Tiwei Bie wrote: This patch introduces a mdev based hardware vhost

Re: [RFC 2/2] vhost: IFC VF vdpa layer

2019-10-22 Thread Jason Wang
On 2019/10/23 下午2:19, Zhu, Lingshan wrote: On 10/22/2019 9:05 PM, Jason Wang wrote: On 2019/10/22 下午2:53, Zhu Lingshan wrote: On 10/21/2019 6:19 PM, Jason Wang wrote: On 2019/10/21 下午5:53, Zhu, Lingshan wrote: On 10/16/2019 6:19 PM, Jason Wang wrote: On 2019/10/16 上午9:30, Zhu

Re: [PATCH v2] vhost: introduce mdev based hardware backend

2019-10-22 Thread Jason Wang
On 2019/10/23 上午11:02, Tiwei Bie wrote: On Tue, Oct 22, 2019 at 09:30:16PM +0800, Jason Wang wrote: On 2019/10/22 下午5:52, Tiwei Bie wrote: This patch introduces a mdev based hardware vhost backend. This backend is built on top of the same abstraction used in virtio-mdev and provides a

Re: [PATCH v2] vhost: introduce mdev based hardware backend

2019-10-22 Thread Jason Wang
On 2019/10/22 下午5:52, Tiwei Bie wrote: This patch introduces a mdev based hardware vhost backend. This backend is built on top of the same abstraction used in virtio-mdev and provides a generic vhost interface for userspace to accelerate the virtio devices in guest. This backend is implemented

Re: [RFC 2/2] vhost: IFC VF vdpa layer

2019-10-22 Thread Jason Wang
On 2019/10/22 下午2:53, Zhu Lingshan wrote: On 10/21/2019 6:19 PM, Jason Wang wrote: On 2019/10/21 下午5:53, Zhu, Lingshan wrote: On 10/16/2019 6:19 PM, Jason Wang wrote: On 2019/10/16 上午9:30, Zhu Lingshan wrote: This commit introduced IFC VF operations for vdpa, which complys to

Re: [RFC 1/2] vhost: IFC VF hardware operation layer

2019-10-21 Thread Jason Wang
On 2019/10/22 上午12:31, Simon Horman wrote: On Mon, Oct 21, 2019 at 05:55:33PM +0800, Zhu, Lingshan wrote: On 10/16/2019 5:53 PM, Simon Horman wrote: Hi Zhu, thanks for your patch. On Wed, Oct 16, 2019 at 09:10:40AM +0800, Zhu Lingshan wrote: ... +static void ifcvf_read_dev_config(struct

Re: [RFC 1/2] vhost: IFC VF hardware operation layer

2019-10-21 Thread Jason Wang
On 2019/10/21 下午6:00, Zhu, Lingshan wrote: On 10/16/2019 4:40 PM, Jason Wang wrote: On 2019/10/16 上午9:30, Zhu Lingshan wrote: This commit introduced ifcvf_base layer, which handles IFC VF NIC hardware operations and configurations. It's better to describe the difference between i

Re: [RFC 1/2] vhost: IFC VF hardware operation layer

2019-10-21 Thread Jason Wang
On 2019/10/21 下午5:57, Zhu, Lingshan wrote: On 10/16/2019 4:45 PM, Jason Wang wrote: On 2019/10/16 上午9:30, Zhu Lingshan wrote: + */ +#define IFCVF_TRANSPORT_F_START 28 +#define IFCVF_TRANSPORT_F_END   34 + +#define IFC_SUPPORTED_FEATURES \ +    ((1ULL << VIRTIO_NET

Re: [RFC 2/2] vhost: IFC VF vdpa layer

2019-10-21 Thread Jason Wang
On 2019/10/21 下午5:53, Zhu, Lingshan wrote: On 10/16/2019 6:19 PM, Jason Wang wrote: On 2019/10/16 上午9:30, Zhu Lingshan wrote: This commit introduced IFC VF operations for vdpa, which complys to vhost_mdev interfaces, handles IFC VF initialization, configuration and removal. Signed-off-by

Re: [PATCH V4 5/6] virtio: introduce a mdev based transport

2019-10-20 Thread Jason Wang
On 2019/10/18 下午10:20, Cornelia Huck wrote: On Thu, 17 Oct 2019 18:48:35 +0800 Jason Wang wrote: This patch 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: [PATCH 2/2] virtio_ring: Use DMA API if memory is encrypted

2019-10-16 Thread Jason Wang
On 2019/10/15 下午3:35, Christoph Hellwig wrote: On Fri, Oct 11, 2019 at 06:25:19PM -0700, Ram Pai wrote: From: Thiago Jung Bauermann Normally, virtio enables DMA API with VIRTIO_F_IOMMU_PLATFORM, which must be set by both device and guest driver. However, as a hack, when DMA API returns physi

Re: [RFC 2/2] vhost: IFC VF vdpa layer

2019-10-16 Thread Jason Wang
On 2019/10/16 上午9:30, Zhu Lingshan wrote: This commit introduced IFC VF operations for vdpa, which complys to vhost_mdev interfaces, handles IFC VF initialization, configuration and removal. Signed-off-by: Zhu Lingshan --- drivers/vhost/ifcvf/ifcvf_main.c | 541 +

Re: [RFC 1/2] vhost: IFC VF hardware operation layer

2019-10-16 Thread Jason Wang
On 2019/10/16 上午9:30, Zhu Lingshan wrote: + */ +#define IFCVF_TRANSPORT_F_START 28 +#define IFCVF_TRANSPORT_F_END 34 + +#define IFC_SUPPORTED_FEATURES \ + ((1ULL << VIRTIO_NET_F_MAC) | \ +(1ULL << VIRTIO_F_ANY_LAYOUT)| \

Re: [RFC 1/2] vhost: IFC VF hardware operation layer

2019-10-16 Thread Jason Wang
On 2019/10/16 上午9:30, Zhu Lingshan wrote: This commit introduced ifcvf_base layer, which handles IFC VF NIC hardware operations and configurations. It's better to describe the difference between ifc vf and virtio in the commit log or is there a open doc for this? Signed-off-by: Zhu Lin

Re: [RFC 0/2] Intel IFC VF driver for vdpa

2019-10-16 Thread Jason Wang
On 2019/10/16 上午9:36, Zhu Lingshan wrote: failed to send to kvm list, resend, sorry for the inconvenience. THanks, BR Zhu Lingshan On 10/16/2019 9:30 AM, Zhu Lingshan wrote: Hi all:   This series intends to introduce Intel IFC VF NIC driver for Vhost Data Plane Acceleration.   Here comes two

Re: [PATCH RFC v1 1/2] vhost: option to fetch descriptors through an independent struct

2019-10-15 Thread Jason Wang
On 2019/10/16 上午4:20, Michael S. Tsirkin wrote: On Mon, Oct 14, 2019 at 09:43:25AM +0800, Jason Wang wrote: On 2019/10/13 上午4:27, Michael S. Tsirkin wrote: On Sat, Oct 12, 2019 at 03:28:49PM +0800, Jason Wang wrote: On 2019/10/11 下午9:45, Michael S. Tsirkin wrote: The idea is to support

Re: [PATCH RFC v4 0/5] vhost: ring format independence

2019-10-14 Thread Jason Wang
detect buffer overflow in case of bugs in response to comment by Jason Wang - minor code tweaks Changes from v2: - fixed indirect descriptor batching reported by Jason Wang Changes from v1: - typo fixes I've just done some quick ben

Re: [PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-10-14 Thread Jason Wang
On 2019/10/14 下午4:17, Stefan Hajnoczi wrote: SO_VM_SOCKETS_BUFFER_SIZE might have been useful for VMCI-specific applications, but we should use SO_RCVBUF and SO_SNDBUF for portable applications in the future. Those socket options also work with other address families. I guess these sockopts a

Re: [PATCH RFC v1 2/2] vhost: batching fetches

2019-10-13 Thread Jason Wang
On 2019/10/13 上午4:36, Michael S. Tsirkin wrote: On Sat, Oct 12, 2019 at 03:30:52PM +0800, Jason Wang wrote: On 2019/10/11 下午9:46, Michael S. Tsirkin wrote: With this patch applied, new and old code perform identically. Lots of extra optimizations are now possible, e.g. we can fetch multiple

Re: [PATCH RFC v1 1/2] vhost: option to fetch descriptors through an independent struct

2019-10-13 Thread Jason Wang
On 2019/10/13 上午4:27, Michael S. Tsirkin wrote: On Sat, Oct 12, 2019 at 03:28:49PM +0800, Jason Wang wrote: On 2019/10/11 下午9:45, Michael S. Tsirkin wrote: The idea is to support multiple ring formats by converting to a format-independent array of descriptors. This costs extra cycles, but

Re: [PATCH RFC net-next 2/2] drivers: net: virtio_net: Add tx_timeout function

2019-10-12 Thread Jason Wang
tx_timeout statistic and consider this event as an error (one error per queue), reporting it. Signed-off-by: Julio Faracco Signed-off-by: Daiane Mendes Cc: Jason Wang --- drivers/net/virtio_net.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/drivers/net

Re: [PATCH RFC net-next 2/2] drivers: net: virtio_net: Add tx_timeout function

2019-10-12 Thread Jason Wang
event in some specific queue of device. This function still counts tx_timeout statistic and consider this event as an error (one error per queue), reporting it. Signed-off-by: Julio Faracco Signed-off-by: Daiane Mendes Cc: Jason Wang --- drivers/net/virtio_net.c | 27

Re: [PATCH RFC v1 0/2] vhost: ring format independence

2019-10-12 Thread Jason Wang
On 2019/10/11 下午9:45, Michael S. Tsirkin wrote: So the idea is as follows: we convert descriptors to an independent format first, and process that converting to iov later. The point is that we have a tight loop that fetches descriptors, which is good for cache utilization. This will also allow

Re: [PATCH RFC v1 0/2] vhost: ring format independence

2019-10-12 Thread Jason Wang
On 2019/10/11 下午9:45, Michael S. Tsirkin wrote: So the idea is as follows: we convert descriptors to an independent format first, and process that converting to iov later. The point is that we have a tight loop that fetches descriptors, which is good for cache utilization. This will also allow

Re: [PATCH RFC v1 2/2] vhost: batching fetches

2019-10-12 Thread Jason Wang
On 2019/10/11 下午9:46, Michael S. Tsirkin wrote: With this patch applied, new and old code perform identically. Lots of extra optimizations are now possible, e.g. we can fetch multiple heads with copy_from/to_user now. We can get rid of maintaining the log array. Etc etc. Signed-off-by: Micha

Re: [PATCH RFC v1 1/2] vhost: option to fetch descriptors through an independent struct

2019-10-12 Thread Jason Wang
On 2019/10/11 下午9:45, Michael S. Tsirkin wrote: The idea is to support multiple ring formats by converting to a format-independent array of descriptors. This costs extra cycles, but we gain in ability to fetch a batch of descriptors in one go, which is good for code cache locality. To simplif

Re: [PATCH V2 6/8] mdev: introduce virtio device and its device ops

2019-10-10 Thread Jason Wang
On 2019/9/25 上午7:06, Alex Williamson wrote: On Tue, 24 Sep 2019 21:53:30 +0800 Jason Wang wrote: This patch implements basic support for mdev driver that supports virtio transport for kernel virtio driver. Signed-off-by: Jason Wang --- include/linux/mdev.h| 2 + include/linux

Re: [PATCH 07/11] vhost: convert vhost_umem_interval_tree to half closed intervals

2019-10-09 Thread Jason Wang
le name for the half closed interval and also reduces the chances of some caller being missed. Cc: Michael S. Tsirkin" Cc: Jason Wang Cc: virtualizat...@lists.linux-foundation.org Signed-off-by: Davidlohr Bueso --- drivers/vhost/vhost.c | 19 +-- drivers/vhost/vhost.h |

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-29 Thread Jason Wang
On 2019/9/27 下午9:23, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 09:17:56PM +0800, Jason Wang wrote: On 2019/9/27 下午8:46, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 08:17:47PM +0800, Jason Wang wrote: On 2019/9/27 下午5:41, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 11:27

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午8:46, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 08:17:47PM +0800, Jason Wang wrote: On 2019/9/27 下午5:41, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 11:27:12AM +0800, Jason Wang wrote: On 2019/9/26 下午9:14, Tiwei Bie wrote: On Thu, Sep 26, 2019 at 04:35:18AM

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午5:41, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 11:27:12AM +0800, Jason Wang wrote: On 2019/9/26 下午9:14, Tiwei Bie wrote: On Thu, Sep 26, 2019 at 04:35:18AM -0400, Michael S. Tsirkin wrote: On Thu, Sep 26, 2019 at 12:54:27PM +0800, Tiwei Bie wrote: [...] diff --git

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午5:38, Michael S. Tsirkin wrote: On Fri, Sep 27, 2019 at 04:47:43PM +0800, Jason Wang wrote: On 2019/9/27 下午12:54, Tiwei Bie wrote: On Fri, Sep 27, 2019 at 11:46:06AM +0800, Jason Wang wrote: On 2019/9/26 下午12:54, Tiwei Bie wrote: + +static long vhost_mdev_start(struct

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午12:54, Tiwei Bie wrote: On Fri, Sep 27, 2019 at 11:46:06AM +0800, Jason Wang wrote: On 2019/9/26 下午12:54, Tiwei Bie wrote: + +static long vhost_mdev_start(struct vhost_mdev *m) +{ + struct mdev_device *mdev = m->mdev; + const struct virtio_mdev_device_ops *

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午4:04, Tiwei Bie wrote: On Fri, Sep 27, 2019 at 03:14:42PM +0800, Jason Wang wrote: On 2019/9/27 下午12:54, Tiwei Bie wrote: + + /* +* In vhost-mdev, userspace should pass ring addresses +* in guest physical addresses when IOMMU is

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午12:54, Tiwei Bie wrote: The name could be confusing, get_queue_max() is to get the maximum number of entries for a virtqueue supported by this device. OK. It might be better to rename it to something like: get_vq_num_max() which is more consistent with the set_vq_num()

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-27 Thread Jason Wang
On 2019/9/27 下午12:54, Tiwei Bie wrote: + + /* +* In vhost-mdev, userspace should pass ring addresses +* in guest physical addresses when IOMMU is disabled or +* IOVAs when IOMMU is enabled. +*/ A question here, consi

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Jason Wang
On 2019/9/27 上午11:46, Jason Wang wrote: + +static struct mdev_class_id id_table[] = { +    { MDEV_ID_VHOST }, +    { 0 }, +}; + +static struct mdev_driver vhost_mdev_driver = { +    .name    = "vhost_mdev", +    .probe    = vhost_mdev_probe, +    .remove    = vhost_mdev_remove, +   

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Jason Wang
On 2019/9/26 下午12:54, Tiwei Bie wrote: This patch introduces a mdev based hardware vhost backend. This backend is built on top of the same abstraction used in virtio-mdev and provides a generic vhost interface for userspace to accelerate the virtio devices in guest. This backend is implemented

Re: [PATCH] vhost: introduce mdev based hardware backend

2019-09-26 Thread Jason Wang
On 2019/9/26 下午9:14, Tiwei Bie wrote: On Thu, Sep 26, 2019 at 04:35:18AM -0400, Michael S. Tsirkin wrote: On Thu, Sep 26, 2019 at 12:54:27PM +0800, Tiwei Bie wrote: [...] diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h index 40d028eed645..5afbc2f08fa3 100644 --- a/includ

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

2019-09-24 Thread Jason Wang
On 2019/9/24 上午12:31, Matt Cover wrote: I think it's better to safe to just drop the packet instead of trying to workaround it. This patch aside, dropping the packet here seems like the wrong choice. Loading a prog at this hookpoint "configures" steering. The action of configuring steering sh

Re: [PATCH] vhost: It's better to use size_t for the 3rd parameter of vhost_exceeds_weight()

2019-09-24 Thread Jason Wang
On 2019/9/23 下午5:12, wangxu (AE) wrote: Hi Michael Thanks for your fast reply. As the following code, the 2nd branch of iov_iter_advance() does not check if i->count < size, when this happens, i->count -= size may cause len exceed INT_MAX, and then total_len exceed INT_MAX.

Re: [PATCH] virtio_mmio: remove redundant dev_err message

2019-09-24 Thread Jason Wang
On 2019/9/24 下午3:21, Ding Xiang wrote: platform_get_irq already contains error message, Is this message contained in all possible error path? If not, it's probably better to keep it as is. Thanks so remove the redundant dev_err message Signed-off-by: Ding Xiang --- drivers/virtio/v

[PATCH V2 7/8] virtio: introduce a mdev based transport

2019-09-24 Thread Jason Wang
device with mdev based config ops. This means it is a software transport between mdev driver and mdev device. The transport was implemented through device specific opswhich is a part of mdev_parent_ops now. Signed-off-by: Jason Wang --- drivers/virtio/Kconfig | 7 + drivers/virtio

Re: [PATCH 1/6] mdev: class id support

2019-09-24 Thread Jason Wang
On 2019/9/24 上午5:02, Parav Pandit wrote: > Hi Jason, > > >> -Original Message- >> From: Jason Wang >> Sent: Monday, September 23, 2019 8:03 AM >> To: k...@vger.kernel.org; linux-s...@vger.kernel.org; linux- >> ker...@vger.kernel.org; dri-d

[PATCH 4/6] virtio: introduce a mdev based transport

2019-09-23 Thread Jason Wang
device with mdev based config ops. This means it is a software transport between mdev driver and mdev device. The transport was implemented through device specific opswhich is a part of mdev_parent_ops now. Signed-off-by: Jason Wang --- MAINTAINERS | 1 + drivers/vfio/mdev

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

2019-09-22 Thread Jason Wang
On 2019/9/23 上午11:18, Matt Cover wrote: On Sun, Sep 22, 2019 at 7:34 PM Jason Wang wrote: 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

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 a

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 neg

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 selecti

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

2019-09-20 Thread Jason Wang
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 to

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 s

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 ke

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 ke

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 benefi

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 lo

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 lo

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

2019-09-12 Thread Jason Wang
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

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