Re: [PATCH 6/6] vhost_net: remove the max pending check

2013-08-19 Thread Jason Wang
On 08/16/2013 06:02 PM, Michael S. Tsirkin wrote: > On Fri, Aug 16, 2013 at 01:16:30PM +0800, Jason Wang wrote: >> We used to limit the max pending DMAs to prevent guest from pinning too many >> pages. But this could be removed since: >> >> - We have the sk_wmem_alloc c

Re: [PATCH 2/6] vhost_net: use vhost_add_used_and_signal_n() in vhost_zerocopy_signal_used()

2013-08-23 Thread Jason Wang
On 08/20/2013 10:33 AM, Jason Wang wrote: > On 08/16/2013 05:54 PM, Michael S. Tsirkin wrote: >> On Fri, Aug 16, 2013 at 01:16:26PM +0800, Jason Wang wrote: >>>> Switch to use vhost_add_used_and_signal_n() to avoid multiple calls to >>>> vhost_add_used_and_signal(

Re: [PATCH 6/6] vhost_net: remove the max pending check

2013-08-23 Thread Jason Wang
On 08/20/2013 10:48 AM, Jason Wang wrote: > On 08/16/2013 06:02 PM, Michael S. Tsirkin wrote: >> > On Fri, Aug 16, 2013 at 01:16:30PM +0800, Jason Wang wrote: >>> >> We used to limit the max pending DMAs to prevent guest from pinning too >>> >> many >

Re: [PATCH 6/6] vhost_net: remove the max pending check

2013-08-26 Thread Jason Wang
On 08/25/2013 07:53 PM, Michael S. Tsirkin wrote: > On Fri, Aug 23, 2013 at 04:55:49PM +0800, Jason Wang wrote: >> On 08/20/2013 10:48 AM, Jason Wang wrote: >>> On 08/16/2013 06:02 PM, Michael S. Tsirkin wrote: >>>>> On Fri, Aug 16, 2013 at 01:16:30PM +0800, Jas

Re: [PATCH 6/6] vhost_net: remove the max pending check

2013-08-29 Thread Jason Wang
On 08/25/2013 07:53 PM, Michael S. Tsirkin wrote: > On Fri, Aug 23, 2013 at 04:55:49PM +0800, Jason Wang wrote: >> On 08/20/2013 10:48 AM, Jason Wang wrote: >>> On 08/16/2013 06:02 PM, Michael S. Tsirkin wrote: >>>>> On Fri, Aug 16, 2013 at 01:16:30PM +0800, Jas

[PATCH V2 0/6] vhost code cleanup and minor enhancement

2013-08-29 Thread Jason Wang
!= done_idx to (upend_idx + 1) % UIO_MAXIOV == done_idx. - Switch to use put_user() in __vhost_add_used_n() if there's only one used - Keep the max pending check based on Michael's suggestion. Jason Wang (6): vhost_net: make vhost_zerocopy_signal_used() returns void vhos

[PATCH V2 1/6] vhost_net: make vhost_zerocopy_signal_used() returns void

2013-08-29 Thread Jason Wang
None of its caller use its return value, so let it return void. Signed-off-by: Jason Wang --- drivers/vhost/net.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 969a859..280ee66 100644 --- a/drivers/vhost/net.c +++ b

[PATCH V2 2/6] vhost_net: use vhost_add_used_and_signal_n() in vhost_zerocopy_signal_used()

2013-08-29 Thread Jason Wang
much more less times of used index updating and memory barriers. Signed-off-by: Jason Wang --- drivers/vhost/net.c | 13 - 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 280ee66..8a6dd0d 100644 --- a/drivers/vhost/net.c

[PATCH V2 3/6] vhost: switch to use vhost_add_used_n()

2013-08-29 Thread Jason Wang
Let vhost_add_used() to use vhost_add_used_n() to reduce the code duplication. Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 54 ++-- 1 files changed, 12 insertions(+), 42 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost

[PATCH V2 6/6] vhost_net: correctly limit the max pending buffers

2013-08-29 Thread Jason Wang
into main loop. Tests shows about 5%-10% improvement on per cpu throughput for guest tx. But a 5% drop on per cpu transaction rate for a single session TCP_RR. Signed-off-by: Jason Wang --- drivers/vhost/net.c | 15 --- 1 files changed, 4 insertions(+), 11 deletions(-) diff --

[PATCH V2 4/6] vhost_net: determine whether or not to use zerocopy at one time

2013-08-29 Thread Jason Wang
Currently, even if the packet length is smaller than VHOST_GOODCOPY_LEN, if upend_idx != done_idx we still set zcopy_used to true and rollback this choice later. This could be avoided by determine zerocopy once by checking all conditions at one time before. Signed-off-by: Jason Wang --- drivers

[PATCH V2 5/6] vhost_net: poll vhost queue after marking DMA is done

2013-08-29 Thread Jason Wang
We used to poll vhost queue before making DMA is done, this is racy if vhost thread were waked up before marking DMA is done which can result the signal to be missed. Fix this by always poll the vhost thread before DMA is done. Signed-off-by: Jason Wang --- drivers/vhost/net.c |9

Re: [PATCH V2 5/6] vhost_net: poll vhost queue after marking DMA is done

2013-09-01 Thread Jason Wang
On 08/31/2013 12:44 AM, Ben Hutchings wrote: > On Fri, 2013-08-30 at 12:29 +0800, Jason Wang wrote: >> We used to poll vhost queue before making DMA is done, this is racy if vhost >> thread were waked up before marking DMA is done which can result the signal >> to >> be

Re: [PATCH V2 4/6] vhost_net: determine whether or not to use zerocopy at one time

2013-09-01 Thread Jason Wang
On 08/31/2013 02:35 AM, Sergei Shtylyov wrote: > Hello. > > On 08/30/2013 08:29 AM, Jason Wang wrote: > >> Currently, even if the packet length is smaller than >> VHOST_GOODCOPY_LEN, if >> upend_idx != done_idx we still set zcopy_used to true and rollback >>

Re: [PATCH V2 2/6] vhost_net: use vhost_add_used_and_signal_n() in vhost_zerocopy_signal_used()

2013-09-01 Thread Jason Wang
On 09/02/2013 01:50 PM, Michael S. Tsirkin wrote: > On Fri, Aug 30, 2013 at 12:29:18PM +0800, Jason Wang wrote: >> > We tend to batch the used adding and signaling in vhost_zerocopy_callback() >> > which may result more than 100 used buffers to be updated in >> > v

Re: [PATCH V2 1/6] vhost_net: make vhost_zerocopy_signal_used() returns void

2013-09-01 Thread Jason Wang
On 09/02/2013 01:51 PM, Michael S. Tsirkin wrote: > tweak subj s/returns/return/ > > On Fri, Aug 30, 2013 at 12:29:17PM +0800, Jason Wang wrote: >> > None of its caller use its return value, so let it return void. >> > >> > Signed-off-by: Jason W

Re: [PATCH V2 6/6] vhost_net: correctly limit the max pending buffers

2013-09-01 Thread Jason Wang
On 09/02/2013 01:56 PM, Michael S. Tsirkin wrote: > On Fri, Aug 30, 2013 at 12:29:22PM +0800, Jason Wang wrote: >> As Michael point out, We used to limit the max pending DMAs to get better >> cache >> utilization. But it was not done correctly since it was one done when

Re: [PATCH V2 6/6] vhost_net: correctly limit the max pending buffers

2013-09-02 Thread Jason Wang
On 09/02/2013 02:30 PM, Jason Wang wrote: > On 09/02/2013 01:56 PM, Michael S. Tsirkin wrote: >> > On Fri, Aug 30, 2013 at 12:29:22PM +0800, Jason Wang wrote: >>> >> As Michael point out, We used to limit the max pending DMAs to get >>> >> better cac

[PATCH V3 0/6] vhost code cleanup and minor enhancement

2013-09-02 Thread Jason Wang
check based on Michael's suggestion. Jason Wang (6): vhost_net: make vhost_zerocopy_signal_used() return void vhost_net: use vhost_add_used_and_signal_n() in vhost_zerocopy_signal_used() vhost: switch to use vhost_add_used_n() vhost_net: determine whether or not to use zerocopy a

[PATCH V3 1/6] vhost_net: make vhost_zerocopy_signal_used() return void

2013-09-02 Thread Jason Wang
None of its caller use its return value, so let it return void. Signed-off-by: Jason Wang --- drivers/vhost/net.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 969a859..280ee66 100644 --- a/drivers/vhost/net.c +++ b

[PATCH V3 2/6] vhost_net: use vhost_add_used_and_signal_n() in vhost_zerocopy_signal_used()

2013-09-02 Thread Jason Wang
much less times of used index updating and memory barriers. 2% performance improvement were seen on netperf TCP_RR test. Signed-off-by: Jason Wang --- drivers/vhost/net.c | 13 - 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c

[PATCH V3 3/6] vhost: switch to use vhost_add_used_n()

2013-09-02 Thread Jason Wang
Let vhost_add_used() to use vhost_add_used_n() to reduce the code duplication. To avoid the overhead brought by __copy_to_user(). We will use put_user() when one used need to be added. Signed-off-by: Jason Wang --- drivers/vhost/vhost.c | 54 ++-- 1

[PATCH V3 6/6] vhost_net: correctly limit the max pending buffers

2013-09-02 Thread Jason Wang
into main loop. Tests shows about 5%-10% improvement on per cpu throughput for guest tx. Signed-off-by: Jason Wang --- drivers/vhost/net.c | 18 +++--- 1 files changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 8e9dc55..831eb4f 1

[PATCH V3 4/6] vhost_net: determine whether or not to use zerocopy at one time

2013-09-02 Thread Jason Wang
Currently, even if the packet length is smaller than VHOST_GOODCOPY_LEN, if upend_idx != done_idx we still set zcopy_used to true and rollback this choice later. This could be avoided by determining zerocopy once by checking all conditions at one time before. Signed-off-by: Jason Wang

[PATCH V3 5/6] vhost_net: poll vhost queue after marking DMA is done

2013-09-02 Thread Jason Wang
We used to poll vhost queue before making DMA is done, this is racy if vhost thread were waked up before marking DMA is done which can result the signal to be missed. Fix this by always polling the vhost thread before DMA is done. Signed-off-by: Jason Wang --- - The patch is needed for stable

Re: [PATCH V3 4/6] vhost_net: determine whether or not to use zerocopy at one time

2013-09-04 Thread Jason Wang
On 09/04/2013 07:59 PM, Michael S. Tsirkin wrote: > On Mon, Sep 02, 2013 at 04:40:59PM +0800, Jason Wang wrote: >> Currently, even if the packet length is smaller than VHOST_GOODCOPY_LEN, if >> upend_idx != done_idx we still set zcopy_used to true and rollback this >> choice

Re: [PATCH v2] vduse: Fix race condition between resetting and irq injecting

2021-09-29 Thread Jason Wang
On Wed, Sep 29, 2021 at 4:32 PM Xie Yongji wrote: > > The interrupt might be triggered after a reset since there is > no synchronization between resetting and irq injecting. And it > might break something if the interrupt is delayed until a new > round of device initialization. > > Fixes: c8a6153b

Re: [PATCH net] virtio-net: fix for skb_over_panic inside big mode

2021-10-10 Thread Jason Wang
> We must take this into account when calculating tailroom. > > Cc: Greg KH > Fixes: fb32856b16ad ("virtio-net: page_to_skb() use build_skb when there's > sufficient tailroom") > Fixes: 126285651b7f ("Merge > ra.kernel.org:/pub/scm/linux/kernel/git/netdev

Re: [PATCH 1/5] iova: Move fast alloc size roundup into alloc_iova_fast()

2021-10-10 Thread Jason Wang
On Fri, Sep 24, 2021 at 6:07 PM John Garry wrote: > > It really is a property of the IOVA rcache code that we need to alloc a > power-of-2 size, so relocate the functionality to resize into > alloc_iova_fast(), rather than the callsites. > > Signed-off-by: John Garry Ac

Re: [PATCH v4 1/7] virtio-pci: introduce legacy device module

2021-10-10 Thread Jason Wang
在 2021/9/29 下午2:11, Wu Zongyong 写道: Split common codes from virtio-pci-legacy so vDPA driver can reuse it later. Signed-off-by: Wu Zongyong Acked-by: Jason Wang --- drivers/virtio/Kconfig | 10 ++ drivers/virtio/Makefile| 1 + drivers/virtio

Re: [PATCH v4 1/7] virtio-pci: introduce legacy device module

2021-10-10 Thread Jason Wang
在 2021/9/29 下午2:11, Wu Zongyong 写道: Split common codes from virtio-pci-legacy so vDPA driver can reuse it later. Signed-off-by: Wu Zongyong --- drivers/virtio/Kconfig | 10 ++ drivers/virtio/Makefile| 1 + drivers/virtio/virtio_pci_common.c | 10 +-

Re: [PATCH v4 2/7] vdpa: fix typo

2021-10-10 Thread Jason Wang
在 2021/9/29 下午2:11, Wu Zongyong 写道: Signed-off-by: Wu Zongyong Acked-by: Jason Wang --- include/linux/vdpa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index 3972ab765de1..a896ee021e5f 100644 --- a/include/linux

Re: [PATCH v4 4/7] vdpa: add new callback get_vq_num_min in vdpa_config_ops

2021-10-10 Thread Jason Wang
在 2021/9/29 下午2:11, Wu Zongyong 写道: This callback is optional. For vdpa devices that not support to change virtqueue size, get_vq_num_min and get_vq_num_max will return the same value, so that users can choose a correct value for that device. Suggested-by: Jason Wang Signed-off-by: Wu

Re: [PATCH v4 5/7] virtio_vdpa: setup correct vq size with callbacks get_vq_num_{max,min}

2021-10-10 Thread Jason Wang
在 2021/9/29 下午2:11, Wu Zongyong 写道: Signed-off-by: Wu Zongyong Commit log please. --- drivers/virtio/virtio_vdpa.c | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c index 72eaef2ca

Re: [PATCH v4 6/7] vdpa: add new attribute VDPA_ATTR_DEV_MIN_VQ_SIZE

2021-10-10 Thread Jason Wang
在 2021/9/29 下午2:11, Wu Zongyong 写道: This attribute advertises the min value of virtqueue size. The value is 0 by default. I think 0 is not a correct value. If I understand the spec correctly, it should be 1. Thanks Signed-off-by: Wu Zongyong --- drivers/vdpa/vdpa.c | 5 +

Re: [PATCH v4 7/7] eni_vdpa: add vDPA driver for Alibaba ENI

2021-10-10 Thread Jason Wang
在 2021/9/29 下午2:11, Wu Zongyong 写道: This patch adds a new vDPA driver for Alibaba ENI(Elastic Network Interface) which is build upon virtio 0.9.5 specification. And this driver doesn't support to run on BE host. If this is true, I think it's still better to exclude this driver via Kconfig.

Re: [PATCH] VDUSE: fix documentation underline warning

2021-10-10 Thread Jason Wang
Randy Dunlap > Cc: Xie Yongji > Cc: Jason Wang > Cc: Michael S. Tsirkin > Cc: virtualization@lists.linux-foundation.org > Cc: Jonathan Corbet > Cc: linux-...@vger.kernel.org > --- Acked-by: Jason Wang > Documentation/userspace-api/vduse.rst |2 +- > 1 file

Re: [PATCH 0/9] More virtio hardening

2021-10-11 Thread Jason Wang
On Tue, Oct 5, 2021 at 3:42 PM Michael S. Tsirkin wrote: > > On Mon, Sep 13, 2021 at 01:53:44PM +0800, Jason Wang wrote: > > Hi All: > > > > This series treis to do more hardening for virito. > > > > patch 1 validates the num_queues for virio-blk device. >

Re: [PATCH 0/9] More virtio hardening

2021-10-11 Thread Jason Wang
On Mon, Oct 11, 2021 at 8:36 PM Michael S. Tsirkin wrote: > > On Mon, Oct 11, 2021 at 03:36:51PM +0800, Jason Wang wrote: > > On Tue, Oct 5, 2021 at 3:42 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Sep 13, 2021 at 01:53:44PM +0800, Jason Wang wrote: > &

Re: [PATCH v2 1/3] vdpa: Skip protected ram IOMMU mappings

2021-10-11 Thread Jason Wang
On Tue, Oct 5, 2021 at 9:49 PM Eugenio Pérez wrote: > > Following the logic of commit 56918a126ae ("memory: Add RAM_PROTECTED > flag to skip IOMMU mappings") with VFIO, skip memory sections > inaccessible via normal mechanisms, including DMA. > > Signed-off-by: Eug

Re: [PATCH v2 2/3] vdpa: Add vhost_vdpa_section_end

2021-10-11 Thread Jason Wang
On Tue, Oct 5, 2021 at 9:49 PM Eugenio Pérez wrote: > > Abstract this operation, that will be reused when validating the region > against the iova range that the device supports. > > Signed-off-by: Eugenio Pérez Acked-by: Jason Wang > --- > hw/vir

Re: [PATCH v2 3/3] vdpa: Check for iova range at mappings changes

2021-10-11 Thread Jason Wang
On Tue, Oct 5, 2021 at 9:49 PM Eugenio Pérez wrote: > > Check vdpa device range before updating memory regions so we don't add > any outside of it, and report the invalid change if any. > > Signed-off-by: Eugenio Pérez > --- > include/hw/virtio/vhost-vdpa.h | 2 + > hw/virtio/vhost-vdpa.c

Re: [RFC PATCH v4 00/20] vDPA shadow virtqueue

2021-10-11 Thread Jason Wang
在 2021/10/1 下午3:05, Eugenio Pérez 写道: This series enable shadow virtqueue (SVQ) for vhost-vdpa devices. This is intended as a new method of tracking the memory the devices touch during a migration process: Instead of relay on vhost device's dirty logging capability, SVQ intercepts the VQ datapla

Re: [RFC PATCH v4 00/20] vDPA shadow virtqueue

2021-10-11 Thread Jason Wang
On Tue, Oct 12, 2021 at 11:59 AM Jason Wang wrote: > > > 在 2021/10/1 下午3:05, Eugenio Pérez 写道: > > This series enable shadow virtqueue (SVQ) for vhost-vdpa devices. This > > is intended as a new method of tracking the memory the devices touch > > during a migration p

Re: [PATCH 0/9] More virtio hardening

2021-10-11 Thread Jason Wang
On Tue, Oct 12, 2021 at 1:44 PM Michael S. Tsirkin wrote: > > On Tue, Oct 12, 2021 at 10:43:57AM +0800, Jason Wang wrote: > > On Mon, Oct 11, 2021 at 8:36 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Oct 11, 2021 at 03:36:51PM +0800, Jason Wang wrote: > >

Re: [PATCH 0/9] More virtio hardening

2021-10-11 Thread Jason Wang
On Tue, Oct 12, 2021 at 2:35 PM Michael S. Tsirkin wrote: > > On Tue, Oct 12, 2021 at 02:11:10PM +0800, Jason Wang wrote: > > On Tue, Oct 12, 2021 at 1:44 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Oct 12, 2021 at 10:43:57AM +0800, Jason Wang wrote: > >

Re: [PATCH v2 3/3] vdpa: Check for iova range at mappings changes

2021-10-11 Thread Jason Wang
On Tue, Oct 12, 2021 at 2:28 PM Eugenio Perez Martin wrote: > > On Tue, Oct 12, 2021 at 5:50 AM Jason Wang wrote: > > > > On Tue, Oct 5, 2021 at 9:49 PM Eugenio Pérez wrote: > > > > > > Check vdpa device range before updating memory regions so we don'

[PATCH V2 00/12] More virtio hardening

2021-10-11 Thread Jason Wang
ordering around the intx_soft_enabled when enabling and disabling INTX interrupt - for the driver that can validate the used length, virtio core won't even try to allocate auxilary arrays and validate the used length - tweak the commit log - fix typos Jason Wang (12): virtio-blk: val

[PATCH V2 01/12] virtio-blk: validate num_queues during probe

2021-10-11 Thread Jason Wang
num_queues is zero. Cc: Paolo Bonzini Cc: Stefan Hajnoczi Cc: Stefano Garzarella Reviewed-by: Stefan Hajnoczi Signed-off-by: Jason Wang --- drivers/block/virtio_blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index

[PATCH V2 02/12] virtio: add doc for validate() method

2021-10-11 Thread Jason Wang
This patch adds doc for validate() method. Signed-off-by: Jason Wang --- include/linux/virtio.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 41edbc01ffa4..0cd8685aeba4 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h

[PATCH V2 05/12] virtio_config: introduce a new ready method

2021-10-11 Thread Jason Wang
Signed-off-by: Jason Wang --- include/linux/virtio_config.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 8519b3ae5d52..f2891c6221a1 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h

[PATCH V2 03/12] virtio-console: switch to use .validate()

2021-10-11 Thread Jason Wang
This patch switches to use validate() to filter out the features that is not supported by the rproc. Cc: Amit Shah Signed-off-by: Jason Wang --- drivers/char/virtio_console.c | 41 ++- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/drivers/char

[PATCH V2 04/12] virtio_console: validate max_nr_ports before trying to use it

2021-10-11 Thread Jason Wang
MULTIPORT is it's greater than 0x8000 (which is guaranteed be safe). Cc: Amit Shah Signed-off-by: Jason Wang --- drivers/char/virtio_console.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index daeed31

[PATCH V2 06/12] virtio_pci: harden MSI-X interrupts

2021-10-11 Thread Jason Wang
) and after reset. Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Paul E. McKenney Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_common.c | 27 +-- drivers/virtio/virtio_pci_common.h | 6 -- drivers/virtio/virtio_pci_legacy.c | 5 +++-- drivers/v

[PATCH V2 11/12] virtio-blk: don't let virtio core to validate used length

2021-10-11 Thread Jason Wang
We never tries to use used length, so the patch prevents the virtio core from validating used length. Signed-off-by: Jason Wang --- drivers/block/virtio_blk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 9deff01a38cb

[PATCH V2 12/12] virtio-scsi: don't let virtio core to validate used buffer length

2021-10-11 Thread Jason Wang
We never tries to use used length, so the patch prevents the virtio core from validating used length. Signed-off-by: Jason Wang --- drivers/scsi/virtio_scsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index c25ce8f0e0af

[PATCH V2 07/12] virtio-pci: harden INTX interrupts

2021-10-11 Thread Jason Wang
ed variable and toggle it during in vp_disable/enable_vectors(). The INTX interrupt handler will check intx_soft_enabled before processing the actual interrupt. Cc: Boqun Feng Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Paul E. McKenney Signed-off-by: Jason Wang --- drivers/virtio/virtio_pc

[PATCH V2 08/12] virtio_ring: fix typos in vring_desc_extra

2021-10-11 Thread Jason Wang
We're actually tracking descriptor address and length instead of the buffer. Signed-off-by: Jason Wang --- drivers/virtio/virtio_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index dd95dfd

[PATCH V2 09/12] virtio_ring: validate used buffer length

2021-10-11 Thread Jason Wang
en by force_used_validation). To be more efficient, a dedicate array is used for storing the validate used length, this helps to eliminate the cache stress if validation is done by the driver. Signed-off-by: Jason Wang --- drivers/virtio/virtio_ring.c | 56 include/

[PATCH V2 10/12] virtio-net: don't let virtio core to validate used length

2021-10-11 Thread Jason Wang
For RX virtuqueue, the used length is validated in all the three paths (big, small and mergeable). For control vq, we never tries to use used length. So this patch forbids the core to validate the used length. Signed-off-by: Jason Wang --- drivers/net/virtio_net.c | 1 + 1 file changed, 1

Re: [PATCH 0/9] More virtio hardening

2021-10-12 Thread Jason Wang
On Tue, Oct 12, 2021 at 3:03 PM Michael S. Tsirkin wrote: > > On Tue, Oct 12, 2021 at 02:43:13PM +0800, Jason Wang wrote: > > On Tue, Oct 12, 2021 at 2:35 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Oct 12, 2021 at 02:11:10PM +0800, Jason Wang wrote: > >

Re: [RFC PATCH v4 08/20] vhost: Route guest->host notification through shadow virtqueue

2021-10-12 Thread Jason Wang
在 2021/10/1 下午3:05, Eugenio Pérez 写道: Shadow virtqueue notifications forwarding is disabled when vhost_dev stops, so code flow follows usual cleanup. Also, host notifiers must be disabled at SVQ start, Any reason for this? and they will not start if SVQ has been enabled when device is sto

Re: [RFC PATCH v4 09/20] vdpa: Save call_fd in vhost-vdpa

2021-10-12 Thread Jason Wang
在 2021/10/1 下午3:05, Eugenio Pérez 写道: We need to know it to switch to Shadow VirtQueue. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 2 ++ hw/virtio/vhost-vdpa.c | 5 + 2 files changed, 7 insertions(+) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/

Re: [RFC PATCH v4 10/20] vhost-vdpa: Take into account SVQ in vhost_vdpa_set_vring_call

2021-10-12 Thread Jason Wang
在 2021/10/1 下午3:05, Eugenio Pérez 写道: Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 57a857444a..bc34de2439 100644 --- a/hw/virtio/vhost-vdpa.

Re: [RFC PATCH v4 11/20] vhost: Route host->guest notification through shadow virtqueue

2021-10-12 Thread Jason Wang
在 2021/10/1 下午3:05, Eugenio Pérez 写道: This will make qemu aware of the device used buffers, allowing it to write the guest memory with its contents if needed. Since the use of vhost_virtqueue_start can unmasks and discard call events, vhost_virtqueue_start should be modified in one of these way

Re: [RFC PATCH v4 11/20] vhost: Route host->guest notification through shadow virtqueue

2021-10-12 Thread Jason Wang
在 2021/10/1 下午3:05, Eugenio Pérez 写道: This will make qemu aware of the device used buffers, allowing it to write the guest memory with its contents if needed. Since the use of vhost_virtqueue_start can unmasks and discard call events, vhost_virtqueue_start should be modified in one of these way

Re: [RFC PATCH v4 12/20] virtio: Add vhost_shadow_vq_get_vring_addr

2021-10-12 Thread Jason Wang
在 2021/10/1 下午3:05, Eugenio Pérez 写道: It reports the shadow virtqueue address from qemu virtual address space I think both the title and commit log needs to more tweaks. Looking at the codes, what id does is actually introduce vring into svq. Signed-off-by: Eugenio Pérez --- hw/virti

Re: [RFC PATCH v4 13/20] vdpa: Save host and guest features

2021-10-12 Thread Jason Wang
在 2021/10/1 下午3:05, Eugenio Pérez 写道: Those are needed for SVQ: Host ones are needed to check if SVQ knows how to talk with the device and for feature negotiation, and guest ones to know if SVQ can talk with it. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 2 ++ hw/vir

Re: [RFC PATCH v4 15/20] vhost: Shadow virtqueue buffers forwarding

2021-10-12 Thread Jason Wang
在 2021/10/1 下午3:05, Eugenio Pérez 写道: Initial version of shadow virtqueue that actually forward buffers. There are no iommu support at the moment, and that will be addressed in future patches of this series. Since all vhost-vdpa devices uses forced IOMMU, this means that SVQ is not usable at thi

Re: [RFC PATCH v4 16/20] vhost: Check for device VRING_USED_F_NO_NOTIFY at shadow virtqueue kick

2021-10-12 Thread Jason Wang
在 2021/10/1 下午3:05, Eugenio Pérez 写道: Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-virtqueue.c index df7e6fa3ec..775f8d36a0 1006

Re: [RFC PATCH v4 17/20] vhost: Use VRING_AVAIL_F_NO_INTERRUPT at device call on shadow virtqueue

2021-10-12 Thread Jason Wang
在 2021/10/1 下午3:06, Eugenio Pérez 写道: Signed-off-by: Eugenio Pérez Commit log please. Thanks --- hw/virtio/vhost-shadow-virtqueue.c | 24 +++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow

Re: [RFC PATCH v4 20/20] vdpa: Add custom IOTLB translations to SVQ

2021-10-12 Thread Jason Wang
在 2021/10/1 下午3:06, Eugenio Pérez 写道: Use translations added in VhostIOVATree in SVQ. Now every element needs to store the previous address also, so VirtQueue can consume the elements properly. This adds a little overhead per VQ element, having to allocate more memory to stash them. As a possib

Re: [PATCH V2 03/12] virtio-console: switch to use .validate()

2021-10-13 Thread Jason Wang
On Wed, Oct 13, 2021 at 5:51 PM Michael S. Tsirkin wrote: > > On Tue, Oct 12, 2021 at 02:52:18PM +0800, Jason Wang wrote: > > This patch switches to use validate() to filter out the features that > > is not supported by the rproc. > > are not supported > > > >

Re: [PATCH V2 06/12] virtio_pci: harden MSI-X interrupts

2021-10-13 Thread Jason Wang
On Wed, Oct 13, 2021 at 5:59 PM Michael S. Tsirkin wrote: > > On Tue, Oct 12, 2021 at 02:52:21PM +0800, Jason Wang wrote: > > We used to synchronize pending MSI-X irq handlers via > > synchronize_irq(), this may not work for the untrusted device which > > may keep sendin

Re: [PATCH V2 09/12] virtio_ring: validate used buffer length

2021-10-13 Thread Jason Wang
On Wed, Oct 13, 2021 at 6:02 PM Michael S. Tsirkin wrote: > > On Tue, Oct 12, 2021 at 02:52:24PM +0800, Jason Wang wrote: > > This patch validate the used buffer length provided by the device > > before trying to use it. This is done by record the in buffer length > > in a

Re: [PATCH V2 01/12] virtio-blk: validate num_queues during probe

2021-10-13 Thread Jason Wang
On Wed, Oct 13, 2021 at 6:04 PM Michael S. Tsirkin wrote: > > On Tue, Oct 12, 2021 at 02:52:16PM +0800, Jason Wang wrote: > > If an untrusted device neogitates BLK_F_MQ but advertises a zero > > num_queues, the driver may end up trying to allocating zero size > > buffer

Re: [PATCH V2 02/12] virtio: add doc for validate() method

2021-10-13 Thread Jason Wang
On Wed, Oct 13, 2021 at 6:09 PM Michael S. Tsirkin wrote: > > On Tue, Oct 12, 2021 at 02:52:17PM +0800, Jason Wang wrote: > > This patch adds doc for validate() method. > > > > Signed-off-by: Jason Wang > > And maybe document __virtio_clear_bit : it says > &qu

Re: [PATCH V2 07/12] virtio-pci: harden INTX interrupts

2021-10-13 Thread Jason Wang
On Wed, Oct 13, 2021 at 5:42 PM Michael S. Tsirkin wrote: > > On Tue, Oct 12, 2021 at 02:52:22PM +0800, Jason Wang wrote: > > This patch tries to make sure the virtio interrupt handler for INTX > > won't be called after a reset and before virtio_device_ready(). We >

Re: [PATCH] Revert "virtio-blk: Add validation for block size in config space"

2021-10-13 Thread Jason Wang
eaner logic in the next release. > > Cc: sta...@vger.kernel.org > Fixes: 82e89ea077b9 ("virtio-blk: Add validation for block size in config > space") > Cc: Xie Yongji > Signed-off-by: Michael S. Tsirkin Acked-by: jason Wang > --- > drivers/block/virtio_blk.c | 37 +

Re: [PATCH v3 3/3] vdpa: Check for iova range at mappings changes

2021-10-13 Thread Jason Wang
On Tue, Oct 12, 2021 at 10:07 PM Eugenio Pérez wrote: > > Check vdpa device range before updating memory regions so we don't add > any outside of it, and report the invalid change if any. > > Signed-off-by: Eugenio Pérez > --- > include/hw/virtio/vhost-vdpa.h | 2 ++ > hw/virtio/vhost-vdpa.c

Re: [PATCH V2 07/12] virtio-pci: harden INTX interrupts

2021-10-13 Thread Jason Wang
On Thu, Oct 14, 2021 at 1:50 PM Michael S. Tsirkin wrote: > > On Thu, Oct 14, 2021 at 10:35:48AM +0800, Jason Wang wrote: > > On Wed, Oct 13, 2021 at 5:42 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Oct 12, 2021 at 02:52:22PM +0800, Jason Wang wrote: > &g

Re: [PATCH V2 01/12] virtio-blk: validate num_queues during probe

2021-10-13 Thread Jason Wang
On Thu, Oct 14, 2021 at 1:45 PM Michael S. Tsirkin wrote: > > On Thu, Oct 14, 2021 at 10:32:32AM +0800, Jason Wang wrote: > > On Wed, Oct 13, 2021 at 6:04 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Oct 12, 2021 at 02:52:16PM +0800, Jason Wang wrote:

Re: [PATCH V2 07/12] virtio-pci: harden INTX interrupts

2021-10-13 Thread Jason Wang
On Thu, Oct 14, 2021 at 2:26 PM Michael S. Tsirkin wrote: > > On Thu, Oct 14, 2021 at 02:20:17PM +0800, Jason Wang wrote: > > On Thu, Oct 14, 2021 at 1:50 PM Michael S. Tsirkin wrote: > > > > > > On Thu, Oct 14, 2021 at 10:35:48AM +0800, Jason Wang wrote: > >

Re: [PATCH v3 3/3] vdpa: Check for iova range at mappings changes

2021-10-14 Thread Jason Wang
On Thu, Oct 14, 2021 at 1:57 PM Eugenio Perez Martin wrote: > > On Thu, Oct 14, 2021 at 5:30 AM Jason Wang wrote: > > > > On Tue, Oct 12, 2021 at 10:07 PM Eugenio Pérez wrote: > > > > > > Check vdpa device range before updating memory regions so we don'

Re: [PATCH V2 07/12] virtio-pci: harden INTX interrupts

2021-10-14 Thread Jason Wang
On Thu, Oct 14, 2021 at 3:04 PM Michael S. Tsirkin wrote: > > On Thu, Oct 14, 2021 at 02:32:19PM +0800, Jason Wang wrote: > > On Thu, Oct 14, 2021 at 2:26 PM Michael S. Tsirkin wrote: > > > > > > On Thu, Oct 14, 2021 at 02:20:17PM +0800, Jason Wang wrote: > >

Re: [PATCH V2 07/12] virtio-pci: harden INTX interrupts

2021-10-14 Thread Jason Wang
On Thu, Oct 14, 2021 at 5:25 PM Michael S. Tsirkin wrote: > > On Thu, Oct 14, 2021 at 03:12:54PM +0800, Jason Wang wrote: > > On Thu, Oct 14, 2021 at 3:04 PM Michael S. Tsirkin wrote: > > > > > > On Thu, Oct 14, 2021 at 02:32:19PM +0800, Jason Wang wrote: > >

Re: [PATCH v3 3/3] vdpa: Check for iova range at mappings changes

2021-10-14 Thread Jason Wang
On Thu, Oct 14, 2021 at 4:08 PM Eugenio Perez Martin wrote: > > On Thu, Oct 14, 2021 at 9:02 AM Jason Wang wrote: > > > > On Thu, Oct 14, 2021 at 1:57 PM Eugenio Perez Martin > > wrote: > > > > > > On Thu, Oct 14, 2021 at 5:30 AM Jason Wang wrote: >

Re: [RFC PATCH v4 08/20] vhost: Route guest->host notification through shadow virtqueue

2021-10-14 Thread Jason Wang
在 2021/10/14 下午8:00, Eugenio Perez Martin 写道: On Wed, Oct 13, 2021 at 5:27 AM Jason Wang wrote: 在 2021/10/1 下午3:05, Eugenio Pérez 写道: Shadow virtqueue notifications forwarding is disabled when vhost_dev stops, so code flow follows usual cleanup. Also, host notifiers must be disabled at SVQ

Re: [RFC PATCH v4 15/20] vhost: Shadow virtqueue buffers forwarding

2021-10-14 Thread Jason Wang
在 2021/10/15 上午1:56, Eugenio Perez Martin 写道: On Wed, Oct 13, 2021 at 6:31 AM Jason Wang wrote: 在 2021/10/1 下午3:05, Eugenio Pérez 写道: Initial version of shadow virtqueue that actually forward buffers. There are no iommu support at the moment, and that will be addressed in future patches of

Re: [RFC PATCH v4 11/20] vhost: Route host->guest notification through shadow virtqueue

2021-10-14 Thread Jason Wang
在 2021/10/14 下午11:58, Eugenio Perez Martin 写道: On Wed, Oct 13, 2021 at 5:49 AM Jason Wang wrote: 在 2021/10/1 下午3:05, Eugenio Pérez 写道: This will make qemu aware of the device used buffers, allowing it to write the guest memory with its contents if needed. Since the use of

Re: [RFC PATCH v4 11/20] vhost: Route host->guest notification through shadow virtqueue

2021-10-14 Thread Jason Wang
在 2021/10/15 上午12:39, Eugenio Perez Martin 写道: On Wed, Oct 13, 2021 at 5:47 AM Jason Wang wrote: 在 2021/10/1 下午3:05, Eugenio Pérez 写道: This will make qemu aware of the device used buffers, allowing it to write the guest memory with its contents if needed. Since the use of

Re: [RFC PATCH v4 20/20] vdpa: Add custom IOTLB translations to SVQ

2021-10-15 Thread Jason Wang
On Fri, Oct 15, 2021 at 3:28 PM Eugenio Perez Martin wrote: > > On Wed, Oct 13, 2021 at 7:34 AM Jason Wang wrote: > > > > > > 在 2021/10/1 下午3:06, Eugenio Pérez 写道: > > > Use translations added in VhostIOVATree in SVQ. > > > > > > Now every e

Re: [PATCH v4 3/3] vdpa: Check for iova range at mappings changes

2021-10-15 Thread Jason Wang
在 2021/10/14 下午10:12, Eugenio Pérez 写道: Check vdpa device range before updating memory regions so we don't add any outside of it, and report the invalid change if any. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio/vhost-vdpa.h | 2 ++ hw/virtio/

Re: [PATCH v5 8/8] eni_vdpa: add vDPA driver for Alibaba ENI

2021-10-15 Thread Jason Wang
在 2021/10/15 下午3:15, Wu Zongyong 写道: + +static u64 eni_vdpa_get_features(struct vdpa_device *vdpa) +{ + struct virtio_pci_legacy_device *ldev = vdpa_to_ldev(vdpa); + u64 features = vp_legacy_get_features(ldev); + + features |= BIT_ULL(VIRTIO_F_ACCESS_PLATFORM); + features

Re: [PATCH v5 1/8] virtio-pci: introduce legacy device module

2021-10-15 Thread Jason Wang
在 2021/10/15 下午3:14, Wu Zongyong 写道: +void vp_legacy_set_queue_enable(struct virtio_pci_legacy_device *ldev, + u16 idx, bool enable); Similar to previous one, this function is not implemented in this patch. Thanks ___

Re: [PATCH v5 4/8] vdpa: add new callback get_vq_num_min in vdpa_config_ops

2021-10-15 Thread Jason Wang
在 2021/10/15 下午3:14, Wu Zongyong 写道: This callback is optional. For vdpa devices that not support to change virtqueue size, get_vq_num_min and get_vq_num_max will return the same value, so that users can choose a correct value for that device. Suggested-by: Jason Wang Signed-off-by: Wu

Re: [PATCH v5 5/8] vdpa: min vq num of vdpa device cannot be greater than max vq num

2021-10-15 Thread Jason Wang
在 2021/10/15 下午3:14, Wu Zongyong 写道: Just failed to probe the vdpa device if the min virtqueue num returned by get_vq_num_min is greater than the max virtqueue num returned by get_vq_num_max. Signed-off-by: Wu Zongyong --- drivers/vdpa/vdpa.c | 8 1 file changed, 8 insertions(+) d

Re: [PATCH v5 6/8] virtio_vdpa: setup correct vq size with callbacks get_vq_num_{max,min}

2021-10-15 Thread Jason Wang
在 2021/10/15 下午3:14, Wu Zongyong 写道: For the devices which implement the get_vq_num_min callback, the driver should not negotiate with virtqueue size with the backend vdpa device if the value returned by get_vq_num_min equals to the value returned by get_vq_num_max. This is useful for vdpa devic

Re: [RFC PATCH v4 20/20] vdpa: Add custom IOTLB translations to SVQ

2021-10-15 Thread Jason Wang
On Fri, Oct 15, 2021 at 4:21 PM Eugenio Perez Martin wrote: > > On Fri, Oct 15, 2021 at 9:37 AM Jason Wang wrote: > > > > On Fri, Oct 15, 2021 at 3:28 PM Eugenio Perez Martin > > wrote: > > > > > > On Wed, Oct 13, 2021 at 7:34 AM Jason Wang wrote:

Re: [PATCH 0/5] iommu/virtio: Add identity domains

2021-10-18 Thread Jason Wang
On Mon, Oct 18, 2021 at 11:35 PM Michael S. Tsirkin wrote: > > On Mon, Oct 18, 2021 at 04:23:41PM +0100, Jean-Philippe Brucker wrote: > > On Thu, Oct 14, 2021 at 03:00:38AM +, Tian, Kevin wrote: > > > > From: Jean-Philippe Brucker > > > > Sent: Wednesday, October 13, 2021 8:11 PM > > > > > >

<    1   2   3   4   5   6   7   8   9   10   >