Re: [PATCH v7 01/12] iova: Export alloc_iova_fast()

2021-05-25 Thread Jason Wang
在 2021/5/17 下午5:55, Xie Yongji 写道: Export alloc_iova_fast() so that some modules can use it to improve iova allocation efficiency. Signed-off-by: Xie Yongji --- drivers/iommu/iova.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index

Re: [PATCH v7 05/12] virtio_scsi: Add validation for residual bytes from response

2021-05-25 Thread Jason Wang
在 2021/5/17 下午5:55, Xie Yongji 写道: This ensures that the residual bytes in response (might come from an untrusted device) will not exceed the data buffer length. Signed-off-by: Xie Yongji --- drivers/scsi/virtio_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH v7 00/12] Introduce VDUSE - vDPA Device in Userspace

2021-05-25 Thread Michael S. Tsirkin
On Tue, May 25, 2021 at 02:40:57PM +0800, Jason Wang wrote: > > 在 2021/5/20 下午5:06, Yongji Xie 写道: > > On Thu, May 20, 2021 at 2:06 PM Michael S. Tsirkin wrote: > > > On Mon, May 17, 2021 at 05:55:01PM +0800, Xie Yongji wrote: > > > > This series introduces a framework, which can be used to

Re: [PATCH] virtio_net: Remove BUG() to aviod machine dead

2021-05-25 Thread Jason Wang
在 2021/5/19 下午10:18, Xianting Tian 写道: thanks, I submit the patch as commented by Andrew https://lkml.org/lkml/2021/5/18/256 Actually, if xmit_skb() returns error, below code will give a warning with error code. /* Try to transmit */ err = xmit_skb(sq, skb); /* This should not

Re: [RFC] virtio_scsi: to poll and kick the virtqueue in timeout handler

2021-05-25 Thread Dongli Zhang
Hi Stefan and Hannes, On 5/24/21 6:24 AM, Stefan Hajnoczi wrote: > On Sun, May 23, 2021 at 09:39:51AM +0200, Hannes Reinecke wrote: >> On 5/23/21 8:38 AM, Dongli Zhang wrote: >>> This RFC is to trigger the discussion about to poll and kick the >>> virtqueue on purpose in virtio-scsi timeout

Re: [PATCH] virtio_net: Fix error handling in virtnet_restore()

2021-05-25 Thread Jason Wang
在 2021/5/17 下午4:45, Xie Yongji 写道: Do some cleanups in virtnet_restore() when virtnet_cpu_notif_add() failed. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/net/virtio_net.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c

Re: [PATCH] virtio_console: Assure used length from device is limited

2021-05-25 Thread Jason Wang
在 2021/5/25 下午12:53, Xie Yongji 写道: The buf->len might come from an untrusted device. This ensures the value would not exceed the size of the buffer to avoid data corruption or loss. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/char/virtio_console.c | 4 ++-- 1 file

Re: [PATCH v7 00/12] Introduce VDUSE - vDPA Device in Userspace

2021-05-25 Thread Jason Wang
在 2021/5/20 下午5:06, Yongji Xie 写道: On Thu, May 20, 2021 at 2:06 PM Michael S. Tsirkin wrote: On Mon, May 17, 2021 at 05:55:01PM +0800, Xie Yongji wrote: This series introduces a framework, which can be used to implement vDPA Devices in a userspace program. The work consist of two parts:

Re: [PATCH] virtio-blk: Fix memory leak among suspend/resume procedure

2021-05-25 Thread Jason Wang
在 2021/5/17 下午4:43, Xie Yongji 写道: The vblk->vqs should be freed before we call init_vqs() in virtblk_restore(). Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/block/virtio_blk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/block/virtio_blk.c

Re: [PATCH] virtio-net: Add validation for used length

2021-05-25 Thread Jason Wang
在 2021/5/25 下午12:58, Xie Yongji 写道: This adds validation for used length (might come from an untrusted device) to avoid data corruption or loss. Signed-off-by: Xie Yongji --- drivers/net/virtio_net.c | 22 ++ 1 file changed, 22 insertions(+) diff --git

Re: [PATCH v10 04/18] af_vsock: implement SEQPACKET receive loop

2021-05-25 Thread Stefano Garzarella
On Thu, May 20, 2021 at 10:16:08PM +0300, Arseny Krasnov wrote: Add receive loop for SEQPACKET. It looks like receive loop for STREAM, but there are differences: 1) It doesn't call notify callbacks. 2) It doesn't care about 'SO_SNDLOWAT' and 'SO_RCVLOWAT' values, because there is no sense for

Re: [PATCH 3/3] virtio_blk: implement blk_mq_ops->poll()

2021-05-25 Thread Stefan Hajnoczi
On Mon, May 24, 2021 at 04:59:28PM +0200, Christoph Hellwig wrote: > On Thu, May 20, 2021 at 03:13:05PM +0100, Stefan Hajnoczi wrote: > > Possible drawbacks of this approach: > > > > - Hardware virtio_blk implementations may find virtqueue_disable_cb() > > expensive since it requires DMA. If

Re: [PATCH 3/3] virtio_blk: implement blk_mq_ops->poll()

2021-05-25 Thread Stefan Hajnoczi
On Tue, May 25, 2021 at 03:38:42PM +0800, Ming Lei wrote: > On Tue, May 25, 2021 at 09:22:48AM +0200, Paolo Bonzini wrote: > > On 24/05/21 16:59, Christoph Hellwig wrote: > > > On Thu, May 20, 2021 at 03:13:05PM +0100, Stefan Hajnoczi wrote: > > > > Possible drawbacks of this approach: > > > > >

Re: [PATCH v10 06/18] af_vsock: rest of SEQPACKET support

2021-05-25 Thread Stefano Garzarella
On Thu, May 20, 2021 at 10:16:36PM +0300, Arseny Krasnov wrote: To make SEQPACKET socket functional, socket ops was added for SEQPACKET type and such type of socket was allowed to create. If you need to resend, I think is better to use the present in the commit message. Maybe you can

Re: [PATCH 3/3] virtio_blk: implement blk_mq_ops->poll()

2021-05-25 Thread Stefan Hajnoczi
On Tue, May 25, 2021 at 11:21:41AM +0800, Jason Wang wrote: > > 在 2021/5/20 下午10:13, Stefan Hajnoczi 写道: > > Request completion latency can be reduced by using polling instead of > > irqs. Even Posted Interrupts or similar hardware support doesn't beat > > polling. The reason is that disabling

Re: [PATCH v7 00/12] Introduce VDUSE - vDPA Device in Userspace

2021-05-25 Thread Jason Wang
On Tue, May 25, 2021 at 2:48 PM Michael S. Tsirkin wrote: > > On Tue, May 25, 2021 at 02:40:57PM +0800, Jason Wang wrote: > > > > 在 2021/5/20 下午5:06, Yongji Xie 写道: > > > On Thu, May 20, 2021 at 2:06 PM Michael S. Tsirkin > > > wrote: > > > > On Mon, May 17, 2021 at 05:55:01PM +0800, Xie Yongji

Re: [PATCH 1/3] virtio: add virtioqueue_more_used()

2021-05-25 Thread Stefan Hajnoczi
On Tue, May 25, 2021 at 10:23:39AM +0800, Jason Wang wrote: > > 在 2021/5/20 下午10:13, Stefan Hajnoczi 写道: > > Add an API to check whether there are pending used buffers. There is > > already a similar API called virtqueue_poll() but it only works together > > with virtqueue_enable_cb_prepare().

Re: [PATCH] virtio-net: Add validation for used length

2021-05-25 Thread kernel test robot
Hi Xie, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v5.13-rc3 next-20210525] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base

Re: [PATCH 3/3] virtio_blk: implement blk_mq_ops->poll()

2021-05-25 Thread Paolo Bonzini
On 24/05/21 16:59, Christoph Hellwig wrote: On Thu, May 20, 2021 at 03:13:05PM +0100, Stefan Hajnoczi wrote: Possible drawbacks of this approach: - Hardware virtio_blk implementations may find virtqueue_disable_cb() expensive since it requires DMA. If such devices become popular then the

Re: [PATCH 3/3] virtio_blk: implement blk_mq_ops->poll()

2021-05-25 Thread Paolo Bonzini
On 25/05/21 09:38, Ming Lei wrote: On Tue, May 25, 2021 at 09:22:48AM +0200, Paolo Bonzini wrote: On 24/05/21 16:59, Christoph Hellwig wrote: On Thu, May 20, 2021 at 03:13:05PM +0100, Stefan Hajnoczi wrote: Possible drawbacks of this approach: - Hardware virtio_blk implementations may find

Re: [PATCH] virtio_console: Assure used length from device is limited

2021-05-25 Thread kernel test robot
Hi Xie, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on v5.13-rc3 next-20210525] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use

Re: [PATCH 3/3] virtio_blk: implement blk_mq_ops->poll()

2021-05-25 Thread Ming Lei
On Tue, May 25, 2021 at 09:22:48AM +0200, Paolo Bonzini wrote: > On 24/05/21 16:59, Christoph Hellwig wrote: > > On Thu, May 20, 2021 at 03:13:05PM +0100, Stefan Hajnoczi wrote: > > > Possible drawbacks of this approach: > > > > > > - Hardware virtio_blk implementations may find

Re: [PATCH] virtio_console: Assure used length from device is limited

2021-05-25 Thread kernel test robot
Hi Xie, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on char-misc/char-misc-testing] [also build test WARNING on v5.13-rc3 next-20210525] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use

Re: [RFC] virtio_scsi: to poll and kick the virtqueue in timeout handler

2021-05-25 Thread Stefan Hajnoczi
On Mon, May 24, 2021 at 11:33:33PM -0700, Dongli Zhang wrote: > On 5/24/21 6:24 AM, Stefan Hajnoczi wrote: > > On Sun, May 23, 2021 at 09:39:51AM +0200, Hannes Reinecke wrote: > >> On 5/23/21 8:38 AM, Dongli Zhang wrote: > >>> This RFC is to trigger the discussion about to poll and kick the > >>>

Re: [PATCH v10 00/18] virtio/vsock: introduce SOCK_SEQPACKET support

2021-05-25 Thread Stefano Garzarella
On Tue, May 25, 2021 at 11:22:09AM +0300, Arseny Krasnov wrote: On 23.05.2021 15:14, Arseny Krasnov wrote: On 21.05.2021 10:55, Stefano Garzarella wrote: Hi Arseny, On Thu, May 20, 2021 at 10:13:53PM +0300, Arseny Krasnov wrote: This patchset implements support of SOCK_SEQPACKET for

Re: [RFC] virtio_scsi: to poll and kick the virtqueue in timeout handler

2021-05-25 Thread Dongli Zhang
On 5/25/21 10:24 AM, Hannes Reinecke wrote: > On 5/25/21 6:47 PM, Stefan Hajnoczi wrote: >> On Mon, May 24, 2021 at 11:33:33PM -0700, Dongli Zhang wrote: >>> On 5/24/21 6:24 AM, Stefan Hajnoczi wrote: On Sun, May 23, 2021 at 09:39:51AM +0200, Hannes Reinecke wrote: > On 5/23/21 8:38

vhost: coding style and flush cleanups

2021-05-25 Thread Mike Christie
The following patches apply over linus's tree and mst's vhost branch. The patches are just some flush cleanups and a patch to reduce flush calls and some coding style fixups. My worker threading patches are built over these patches, but they seem like patches that would be ok even if the

[PATCH 2/5] vhost-scsi: remove extra flushes

2021-05-25 Thread Mike Christie
The vhost work flush function was flushing the entire work queue, so there is no need for the double vhost_work_dev_flush calls in vhost_scsi_flush. And we do not need to call vhost_poll_flush for each poller because that call also ends up flushing the same work queue thread the

[PATCH 3/5] vhost-scsi: reduce flushes during endpoint clearing

2021-05-25 Thread Mike Christie
vhost_scsi_flush will flush everything, so we can clear the backends then flush, then destroy. We don't need to flush before each vq destruction because after the flush we will have made sure there can be no new cmds started and there are no running cmds. Signed-off-by: Mike Christie ---

[PATCH 1/5] vhost: remove work arg from vhost_work_flush

2021-05-25 Thread Mike Christie
vhost_work_flush doesn't do anything with the work arg. This patch drops it and then renames vhost_work_flush to vhost_work_dev_flush to reflect that the function flushes all the works in the dev and not just a specific queue or work item. Signed-off-by: Mike Christie Acked-by: Jason Wang

[PATCH 4/5] vhost: fix poll coding style

2021-05-25 Thread Mike Christie
We use 3 coding styles in this struct. Switch to just tabs. Signed-off-by: Mike Christie Reviewed-by: Chaitanya Kulkarni Reviewed-by: Stefan Hajnoczi Acked-by: Jason Wang --- drivers/vhost/vhost.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git

[PATCH 5/5] vhost: fix up vhost_work coding style

2021-05-25 Thread Mike Christie
Switch from a mix of tabs and spaces to just tabs. Signed-off-by: Mike Christie --- drivers/vhost/vhost.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 575c8180caad..7d5306d1229d 100644 --- a/drivers/vhost/vhost.h

vhost: multiple worker support

2021-05-25 Thread Mike Christie
The following patches apply over linus's tree or mst's vhost branch and my cleanup patchset: https://lists.linuxfoundation.org/pipermail/virtualization/2021-May/054354.html These patches allow us to support multiple vhost workers per device. I ended up just doing Stefan's original idea where

[PATCH 3/9] vhost: modify internal functions to take a vhost_worker

2021-05-25 Thread Mike Christie
The final patches will allow us to have multiple vhost_workers per device and be able to share them across devices. To prepare for that, this patch allow us our internal work queueing, flush and cgroup attach functions to take a vhost_worker as an arg. The poll code required a change to the

[PATCH 1/9] vhost: move worker thread fields to new struct

2021-05-25 Thread Mike Christie
This is just a prep patch. It moves the worker related fields to a new vhost_worker struct and moves the code around to create some helpers that will be used in the next patches. Signed-off-by: Mike Christie --- drivers/vhost/vhost.c | 94 +--

[PATCH 7/9] vhost: allow userspace to create workers

2021-05-25 Thread Mike Christie
This patch allows userspace to create workers and bind them to vqs, so you can have N workers per dev and also share N workers with M vqs. The next patch will allow sharing across devices. Signed-off-by: Mike Christie --- drivers/vhost/vhost.c| 94 +++-

[PATCH 4/9] vhost: allow vhost_polls to use different vhost_workers

2021-05-25 Thread Mike Christie
This allows vhost_polls to use the worker the vq the poll is associated with. This also exports a helper vhost_vq_work_queue which is used here internally, and will be used in the vhost-scsi patches. Signed-off-by: Mike Christie --- drivers/vhost/net.c | 6 -- drivers/vhost/vhost.c | 19

[PATCH 2/9] vhost: move vhost worker creation to kick setup

2021-05-25 Thread Mike Christie
The next patch will add new ioctls that allows userspace to create workers and bind them to devs and vqs after VHOST_SET_OWNER. To support older tools, newer tools that want to go wild with worker threads, and newer tools that want the old/default behavior this patch moves the default worker setup

[PATCH 8/9] vhost: add vhost_dev pointer to vhost_work

2021-05-25 Thread Mike Christie
The next patch allows a vhost_worker to handle different devices. To prepare for that, this patch adds a pointer to the device on the work so we can get to the different mms in the vhost_worker thread. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 7 --- drivers/vhost/vhost.c |

[PATCH 9/9] vhost: support sharing workers across devs

2021-05-25 Thread Mike Christie
This allows a worker to handle multiple device's vqs. TODO: - The worker is attached to the cgroup of the device that created it. In this patch you can share workers with devices with different owners which could be in different cgroups. Do we want to restict sharing workers with devices that

[PATCH 6/9] vhost-scsi: make SCSI cmd completion per vq

2021-05-25 Thread Mike Christie
This patch separates the scsi cmd completion code paths so we can complete cmds based on their vq instead of having all cmds complete on the same worker/CPU. This will be useful with the next patch that allows us to create mulitple worker threads and bind them to different vqs, so we can have

Re: [RFC v3 06/29] virtio-net: Honor VIRTIO_CONFIG_S_DEVICE_STOPPED

2021-05-25 Thread Jason Wang
在 2021/5/20 上午12:28, Eugenio Pérez 写道: So the guest can stop and start net device. It implements the RFC https://lists.oasis-open.org/archives/virtio-comment/202012/msg00027.html To stop (as "pause") the device is required to migrate status and vring addresses between device and SVQ. This is

Re: [RFC v3 06/29] virtio-net: Honor VIRTIO_CONFIG_S_DEVICE_STOPPED

2021-05-25 Thread Jason Wang
在 2021/5/26 上午9:06, Jason Wang 写道: 在 2021/5/20 上午12:28, Eugenio Pérez 写道: So the guest can stop and start net device. It implements the RFC https://lists.oasis-open.org/archives/virtio-comment/202012/msg00027.html To stop (as "pause") the device is required to migrate status and vring

Re: [RFC v3 13/29] vhost: Add vhost_get_iova_range operation

2021-05-25 Thread Jason Wang
在 2021/5/20 上午12:28, Eugenio Pérez 写道: For simplicity, If a device does not support this operation it means that it can handle full (uint64_t)-1 iova address. Note that, we probably need a separated patch for this. And we need to this during vhost-vdpa initialization. If GPA is out of the