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

2021-10-18 Thread Jason Wang
On Sat, Oct 16, 2021 at 1:27 AM Michael S. Tsirkin wrote: > > On Fri, Oct 15, 2021 at 05:09:38AM -0700, Dongli Zhang wrote: > > Hi Jason, > > > > On 10/11/21 11:52 PM, Jason Wang wrote: > > > We used to synchronize pending MSI-X irq handlers via > > > sy

[PATCH V3 00/10] More virtio hardening

2021-10-19 Thread Jason Wang
anges since V1: - fix and document the memory 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 l

[PATCH V3 01/10] virtio-blk: validate num_queues during probe

2021-10-19 Thread Jason Wang
. Cc: Paolo Bonzini Cc: Stefan Hajnoczi Cc: Stefano Garzarella Signed-off-by: Jason Wang --- drivers/block/virtio_blk.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 9b3bd083b411..10bc0879e618 100644 --- a/drivers/block

[PATCH V3 02/10] virtio_console: validate max_nr_ports before trying to use it

2021-10-19 Thread Jason Wang
. Cc: Amit Shah Signed-off-by: Jason Wang --- drivers/char/virtio_console.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 7eaf303a7a86..660c5c388c29 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char

[PATCH V3 03/10] virtio_config: introduce a new .enable_cbs method

2021-10-19 Thread Jason Wang
This patch introduces a new method to enable the callbacks for config and virtqueues. This will be used for making sure the virtqueue callbacks are only enabled after virtio_device_ready() if transport implements this method. Signed-off-by: Jason Wang --- include/linux/virtio_config.h | 6

[PATCH V3 04/10] virtio_pci: harden MSI-X interrupts

2021-10-19 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 V3 05/10] virtio-pci: harden INTX interrupts

2021-10-19 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 V3 06/10] virtio_ring: fix typos in vring_desc_extra

2021-10-19 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 V3 07/10] virtio_ring: validate used buffer length

2021-10-19 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 V3 08/10] virtio-net: don't let virtio core to validate used length

2021-10-19 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

[PATCH V3 09/10] virtio-blk: don't let virtio core to validate used length

2021-10-19 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 10bc0879e618

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

2021-10-19 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

Re: [RFC PATCH v4 18/20] vhost: Add VhostIOVATree

2021-10-19 Thread Jason Wang
在 2021/10/1 下午3:06, Eugenio Pérez 写道: This tree is able to look for a translated address from an IOVA address. At first glance is similar to util/iova-tree. However, SVQ working on devices with limited IOVA space need more capabilities, like allocating IOVA chunks or perform reverse translation

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

2021-10-19 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 06/12] virtio_pci: harden MSI-X interrupts

2021-10-19 Thread Jason Wang
On Wed, Oct 20, 2021 at 1:02 AM Dongli Zhang wrote: > > > > On 10/18/21 6:33 PM, Jason Wang wrote: > > On Sat, Oct 16, 2021 at 1:27 AM Michael S. Tsirkin wrote: > >> > >> On Fri, Oct 15, 2021 at 05:09:38AM -0700, Dongli Zhang wrote: > >>> Hi Jas

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

2021-10-19 Thread Jason Wang
On Tue, Oct 19, 2021 at 4:40 PM Eugenio Perez Martin wrote: > > On Fri, Oct 15, 2021 at 6:42 AM Jason Wang wrote: > > > > > > 在 2021/10/15 上午12:39, Eugenio Perez Martin 写道: > > > On Wed, Oct 13, 2021 at 5:47 AM Jason Wang wrote: > > >> > > &g

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

2021-10-19 Thread Jason Wang
On Tue, Oct 19, 2021 at 6:29 PM Eugenio Perez Martin wrote: > > On Tue, Oct 19, 2021 at 11:25 AM Jason Wang wrote: > > > > > > 在 2021/10/1 下午3:06, Eugenio Pérez 写道: > > > Use translations added in VhostIOVATree in SVQ. > > > > > > Now every e

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

2021-10-19 Thread Jason Wang
On Wed, Oct 20, 2021 at 10:02 AM Jason Wang wrote: > > On Tue, Oct 19, 2021 at 6:29 PM Eugenio Perez Martin > wrote: > > > > On Tue, Oct 19, 2021 at 11:25 AM Jason Wang wrote: > > > > > > > > > 在 2021/10/1 下午3:06, Eugenio Pérez 写道: > &

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

2021-10-20 Thread Jason Wang
On Wed, Oct 20, 2021 at 2:52 PM Eugenio Perez Martin wrote: > > On Wed, Oct 20, 2021 at 4:07 AM Jason Wang wrote: > > > > On Wed, Oct 20, 2021 at 10:02 AM Jason Wang wrote: > > > > > > On Tue, Oct 19, 2021 at 6:29 PM Eugenio Perez Martin > > > wrot

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

2021-10-20 Thread Jason Wang
On Wed, Oct 20, 2021 at 7:57 PM Eugenio Perez Martin wrote: > > On Wed, Oct 20, 2021 at 11:03 AM Jason Wang wrote: > > > > On Wed, Oct 20, 2021 at 2:52 PM Eugenio Perez Martin > > wrote: > > > > > > On Wed, Oct 20, 2021 at 4:07 AM Jason Wang wrote: >

Re: [PATCH] vduse: Don't call interrupt callback without DRIVER_OK bit set

2021-10-21 Thread Jason Wang
ust check DRIVER_OK again in > vduse_vq_irq_inject() and make sure each time setting status is done > under the irq lock. Acked-by: Jason Wang I wonder if we can use RCU to synchronize them in the future. Thanks > > Signed-off-by: Xie Yongji > --- > drivers/vdpa/vdpa_user/vduse_dev

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

2021-10-24 Thread Jason Wang
On Fri, Oct 22, 2021 at 10:44 AM Wu Zongyong wrote: > > 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/Makef

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

2021-10-24 Thread Jason Wang
On Fri, Oct 22, 2021 at 10:44 AM Wu Zongyong wrote: > > 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. > > Sugges

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

2021-10-24 Thread Jason Wang
On Fri, Oct 22, 2021 at 10:44 AM Wu Zongyong wrote: > > 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 Acked-by: Jason Wang >

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

2021-10-24 Thread Jason Wang
On Fri, Oct 22, 2021 at 10:45 AM Wu Zongyong wrote: > > 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

Re: [PATCH v6 7/8] vdpa: add new attribute VDPA_ATTR_DEV_MIN_VQ_SIZE

2021-10-24 Thread Jason Wang
On Fri, Oct 22, 2021 at 10:45 AM Wu Zongyong wrote: > > This attribute advertises the min value of virtqueue size. The value is > 0 by default. As discussed previously, 0 seems an invalid value. We should use 1 at least. Thanks > > Signed-off-by: Wu Zongyong > --- > drivers/vdpa/vdpa.c

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

2021-10-24 Thread Jason Wang
On Fri, Oct 22, 2021 at 10:44 AM Wu Zongyong wrote: > > 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. > > Signed-off-by: Wu Zongyong > --- > drivers/vdpa/Kconfig

Re: [PATCH v7 2/2] virtio_ring: check desc == NULL when using indirect with packed

2021-10-24 Thread Jason Wang
On Mon, Oct 25, 2021 at 9:56 AM Xuan Zhuo wrote: > > When using indirect with packed, we don't check for allocation failures. > This patch checks that and fall back on direct. > > Fixes: 1ce9e6055fa0 ("virtio_ring: introduce packed ring support") > Signed-off-by:

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

2021-10-24 Thread Jason Wang
在 2021/10/25 上午11:21, Wu Zongyong 写道: On Mon, Oct 25, 2021 at 10:27:31AM +0800, Jason Wang wrote: On Fri, Oct 22, 2021 at 10:44 AM Wu Zongyong wrote: 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

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

2021-10-24 Thread Jason Wang
在 2021/10/25 上午10:44, Wu Zongyong 写道: On Mon, Oct 25, 2021 at 10:22:30AM +0800, Jason Wang wrote: On Fri, Oct 22, 2021 at 10:45 AM Wu Zongyong wrote: For the devices which implement the get_vq_num_min callback, the driver should not negotiate with virtqueue size with the backend vdpa device

Re: [PATCH linux-next v4 1/8] vdpa: Introduce and use vdpa device get, set config helpers

2021-10-24 Thread Jason Wang
f the configuration fields endianness. To avoid exposing synchronization primitives to callers, introduce helper for setting the configuration and use it. Signed-off-by: Parav Pandit Reviewed-by: Eli Cohen Acked-by: Jason Wang --- drivers/vdpa/vdpa.c | 36 dr

Re: [PATCH linux-next v4 2/8] vdpa: Introduce query of device config layout

2021-10-24 Thread Jason Wang
在 2021/10/22 上午12:35, Parav Pandit 写道: Introduce a command to query a device config layout. An example query of network vdpa device: $ vdpa dev add name bar mgmtdev vdpasim_net $ vdpa dev config show bar: mac 00:35:09:19:48:05 link up link_announce false mtu 1500 Nit: it looks to me this p

Re: [PATCH linux-next v4 3/8] vdpa: Use kernel coding style for structure comments

2021-10-24 Thread Jason Wang
在 2021/10/22 上午12:35, Parav Pandit 写道: As subsequent patch adds new structure field with comment, move the structure comment to follow kernel coding style. Signed-off-by: Parav Pandit Reviewed-by: Eli Cohen Acked-by: Jason Wang --- include/linux/vdpa.h | 9 - 1 file changed

Re: [PATCH linux-next v4 4/8] vdpa: Enable user to set mac and mtu of vdpa device

2021-10-25 Thread Jason Wang
在 2021/10/22 上午12:35, Parav Pandit 写道: $ vdpa dev add name bar mgmtdev vdpasim_net mac 00:11:22:33:44:55 mtu 9000 $ vdpa dev config show bar: mac 00:11:22:33:44:55 link up link_announce false mtu 9000 $ vdpa dev config show -jp { "config": { "bar": { "mac": "00:11:22

Re: [PATCH linux-next v4 5/8] vdpa_sim_net: Enable user to set mac address and mtu

2021-10-25 Thread Jason Wang
在 2021/10/22 上午12:35, Parav Pandit 写道: Enable user to set the mac address and mtu so that each vdpa device can have its own user specified mac address and mtu. This is done by implementing the management device's configuration layout fields setting callback routine. Now that user is enabled to

Re: [PATCH linux-next v4 6/8] vdpa/mlx5: Fix clearing of VIRTIO_NET_F_MAC feature bit

2021-10-25 Thread Jason Wang
在 2021/10/22 上午12:35, Parav Pandit 写道: Cited patch in the fixes tag clears the features bit during reset. mlx5 vdpa device feature bits are static decided by device capabilities. This is not what I read at least from mlx5_vdpa_get_features: static u64 mlx5_vdpa_get_features(struct vdpa_devic

Re: [PATCH linux-next v4 7/8] vdpa/mlx5: Support configuration of MAC

2021-10-25 Thread Jason Wang
name vdpa0 mac 00:11:22:33:44:55 2. Show configured params: $ vdpa dev config show vdpa0: mac 00:11:22:33:44:55 link down link_announce false max_vq_pairs 8 mtu 1500 Signed-off-by: Eli Cohen Reviewed-by: Parav Pandit Acked-by: Jason Wang --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 12

Re: [PATCH][next] virtio_blk: Fix spelling mistake: "advertisted" -> "advertised"

2021-10-25 Thread Jason Wang
On Mon, Oct 25, 2021 at 6:22 PM Colin Ian King wrote: > > There is a spelling mistake in a dev_err error message. Fix it. > > Signed-off-by: Colin Ian King > --- Acked-by: Jason Wang > drivers/block/virtio_blk.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >

Re: [PATCH linux-next v4 4/8] vdpa: Enable user to set mac and mtu of vdpa device

2021-10-25 Thread Jason Wang
在 2021/10/25 下午3:06, Parav Pandit 写道: From: Jason Wang Sent: Monday, October 25, 2021 12:31 PM 在 2021/10/22 上午12:35, Parav Pandit 写道: $ vdpa dev add name bar mgmtdev vdpasim_net mac 00:11:22:33:44:55 mtu 9000 $ vdpa dev config show bar: mac 00:11:22:33:44:55 link up link_announce false

Re: [PATCH linux-next v4 6/8] vdpa/mlx5: Fix clearing of VIRTIO_NET_F_MAC feature bit

2021-10-25 Thread Jason Wang
在 2021/10/25 下午3:08, Parav Pandit 写道: From: Jason Wang Sent: Monday, October 25, 2021 12:35 PM 在 2021/10/22 上午12:35, Parav Pandit 写道: Cited patch in the fixes tag clears the features bit during reset. mlx5 vdpa device feature bits are static decided by device capabilities. This is not

Re: [PATCH linux-next v4 2/8] vdpa: Introduce query of device config layout

2021-10-25 Thread Jason Wang
在 2021/10/25 下午2:59, Parav Pandit 写道: From: Jason Wang Sent: Monday, October 25, 2021 11:36 AM 在 2021/10/22 上午12:35, Parav Pandit 写道: Introduce a command to query a device config layout. An example query of network vdpa device: $ vdpa dev add name bar mgmtdev vdpasim_net $ vdpa dev

Re: [PATCH linux-next v5 2/8] vdpa: Introduce query of device config layout

2021-10-25 Thread Jason Wang
e, > "mtu": 1500, > } > } > } > > Signed-off-by: Parav Pandit > Signed-off-by: Eli Cohen Acked-by: Jason Wang > --- > changelog: > v3->v4: > - removed config space fields reporting which are not used by mlx5 >and s

Re: [PATCH linux-next v5 4/8] vdpa: Enable user to set mac and mtu of vdpa device

2021-10-25 Thread Jason Wang
"config": { > "bar": { > "mac": "00:11:22:33:44:55", > "link ": "up", > "link_announce ": false, > "mtu": 9000, > } > } > } >

Re: [PATCH linux-next v6 5/8] vdpa_sim_net: Enable user to set mac address and mtu

2021-10-25 Thread Jason Wang
p link_announce false mtu 9000 > > Signed-off-by: Parav Pandit > Reviewed-by: Eli Cohen Acked-by: Jason Wang > --- > changelog: > v4->v5: > - updated commit log example for add command > --- > drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 35 +++-

Re: [PATCH linux-next v6 6/8] vdpa/mlx5: Fix clearing of VIRTIO_NET_F_MAC feature bit

2021-10-25 Thread Jason Wang
vdpa_config_ops") > Signed-off-by: Parav Pandit > Reviewed-by: Eli Cohen Acked-by: Jason Wang > --- > changelog: > v5->v6: > - expanded commit log description to indicate that feature bits are >initialized during device addition > > --- > drivers/vd

Re: [PATCH linux-next v6 8/8] vdpa/mlx5: Forward only packets with allowed MAC address

2021-10-25 Thread Jason Wang
to its > configured MAC. > > Signed-off-by: Eli Cohen > Reviewed-by: Parav Pandit Acked-by: Jason Wang > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 76 +++ > 1 file changed, 58 insertions(+), 18 deletions(-) > > diff --git a/drivers/vd

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

2021-10-25 Thread Jason Wang
On Wed, Oct 20, 2021 at 7:57 PM Eugenio Perez Martin wrote: > > On Wed, Oct 20, 2021 at 11:03 AM Jason Wang wrote: > > > > On Wed, Oct 20, 2021 at 2:52 PM Eugenio Perez Martin > > wrote: > > > > > > On Wed, Oct 20, 2021 at 4:07 AM Jason Wang wrote: >

Re: [PATCH] virtio_blk: corrent types for status handling

2021-10-25 Thread Jason Wang
> > Pass the status in blk_status_t in a consistent way. > > Reported-by: kernel test robot > Fixes: b2c5221fd074 ("virtio-blk: avoid preallocating big SGL for data") > Cc: Max Gurtovoy > Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang > --- > drivers

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

2021-10-25 Thread Jason Wang
On Mon, Oct 25, 2021 at 2:25 PM Wu Zongyong wrote: > > On Mon, Oct 25, 2021 at 12:45:44PM +0800, Jason Wang wrote: > > > > 在 2021/10/25 上午10:44, Wu Zongyong 写道: > > > On Mon, Oct 25, 2021 at 10:22:30AM +0800, Jason Wang wrote: > > > > On Fri, Oct 22, 2021

Re: [PATCH V3 11/11] vhost: allow userspace to create workers

2021-10-25 Thread Jason Wang
在 2021/10/22 下午1:19, Mike Christie 写道: This patch allows userspace to create workers and bind them to vqs. You can have N workers per dev and also share N workers with M vqs. Signed-off-by: Mike Christie A question, who is the best one to determine the binding? Is it the VMM (Qemu etc) or

[PATCH V4 0/4] Validate used buffer length

2021-10-26 Thread Jason Wang
: - Initialize the buflen to zero when the validation is done by the driver. Jason Wang (4): virtio_ring: validate used buffer length virtio-net: don't let virtio core to validate used length virtio-blk: don't let virtio core to validate used length virtio-scsi: don't let virtio core t

[PATCH V4 1/4] virtio_ring: validate used buffer length

2021-10-26 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 | 60 include/

[PATCH V4 2/4] virtio-net: don't let virtio core to validate used length

2021-10-26 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

[PATCH V4 3/4] virtio-blk: don't let virtio core to validate used length

2021-10-26 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 c7d05ff24084

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

2021-10-26 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 07d0250f17c3

Re: [PATCH V4 1/4] virtio_ring: validate used buffer length

2021-10-26 Thread Jason Wang
On Tue, Oct 26, 2021 at 5:44 PM Michael S. Tsirkin wrote: > > On Tue, Oct 26, 2021 at 03:19:57PM +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

[PATCH V5 0/4] Validate used buffer length

2021-10-26 Thread Jason Wang
out of date description in the commit log Changes since V3: - Initialize the buflen to zero when the validation is done by the driver. Jason Wang (4): virtio_ring: validate used buffer length virtio-net: don't let virtio core to validate used length virtio-blk: don't let virt

[PATCH V5 2/4] virtio-net: don't let virtio core to validate used length

2021-10-26 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

[PATCH V5 1/4] virtio_ring: validate used buffer length

2021-10-26 Thread Jason Wang
ld be overridden by force_used_validation module parameter). 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

[PATCH V5 3/4] virtio-blk: don't let virtio core to validate used length

2021-10-26 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 c7d05ff24084

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

2021-10-26 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 07d0250f17c3

Re: [PATCH] virtio-ring: fix DMA metadata flags

2021-10-26 Thread Jason Wang
queue") > Signed-off-by: Vincent Whitchurch Acked-by: Jason Wang Thanks > --- > drivers/virtio/virtio_ring.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index dd95dfd85e98..3035bb6

Re: [PATCH -next] virtio-pci: fix error return code in vp_legacy_probe()

2021-10-26 Thread Jason Wang
On Tue, Oct 26, 2021 at 9:39 PM Yang Yingliang wrote: > > Return error code if pci_iomap() fails in vp_legacy_probe() > > Reported-by: Hulk Robot > Fixes: c3ca8a3eeb54 ("virtio-pci: introduce legacy device module") > Signed-off-by: Yang Yingliang > --- Acked-by:

Re: [PATCH net-next] net: virtio: use eth_hw_addr_set()

2021-10-26 Thread Jason Wang
On Wed, Oct 27, 2021 at 1:56 AM Jakub Kicinski wrote: > > Commit 406f42fa0d3c ("net-next: When a bond have a massive amount > of VLANs...") introduced a rbtree for faster Ethernet address look > up. To maintain netdev->dev_addr in this tree we need to make all > the writes to it go through appropr

Re: [PATCH V3 11/11] vhost: allow userspace to create workers

2021-10-26 Thread Jason Wang
On Tue, Oct 26, 2021 at 11:45 PM Stefan Hajnoczi wrote: > > On Tue, Oct 26, 2021 at 01:37:14PM +0800, Jason Wang wrote: > > > > 在 2021/10/22 下午1:19, Mike Christie 写道: > > > This patch allows userspace to create workers and bind them to vqs. You > > > can hav

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

2021-10-26 Thread Jason Wang
On Wed, Oct 27, 2021 at 10:47 AM Wu Zongyong wrote: > > On Mon, Oct 25, 2021 at 12:40:41PM +0800, Jason Wang wrote: > > > > 在 2021/10/25 上午11:21, Wu Zongyong 写道: > > > On Mon, Oct 25, 2021 at 10:27:31AM +0800, Jason Wang wrote: > > > > On Fri, Oct 22, 2021

Re: [PATCH V3 11/11] vhost: allow userspace to create workers

2021-10-26 Thread Jason Wang
On Wed, Oct 27, 2021 at 12:49 AM wrote: > > On 10/26/21 12:37 AM, Jason Wang wrote: > > > > 在 2021/10/22 下午1:19, Mike Christie 写道: > >> This patch allows userspace to create workers and bind them to vqs. You > >> can have N workers per dev and also share N work

Re: [PATCH linux-next v7 6/8] vdpa/mlx5: Fix clearing of VIRTIO_NET_F_MAC feature bit

2021-10-26 Thread Jason Wang
vdpa_config_ops") > Signed-off-by: Parav Pandit > Reviewed-by: Eli Cohen Acked-by: Jason Wang > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c > b/drivers/vdpa/mlx5/net/mlx5_vnet.c &

Re: [PATCH linux-next v7 8/8] vdpa/mlx5: Forward only packets with allowed MAC address

2021-10-26 Thread Jason Wang
to its > configured MAC. > > Signed-off-by: Eli Cohen > Reviewed-by: Parav Pandit Acked-by: Jason Wang > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 76 +++ > 1 file changed, 58 insertions(+), 18 deletions(-) > > diff --git a/drivers/vd

Re: [PATCH net-next] net: virtio: use eth_hw_addr_set()

2021-10-27 Thread Jason Wang
On Wed, Oct 27, 2021 at 10:45 AM Jason Wang wrote: > > On Wed, Oct 27, 2021 at 1:56 AM Jakub Kicinski wrote: > > > > Commit 406f42fa0d3c ("net-next: When a bond have a massive amount > > of VLANs...") introduced a rbtree for faster Ethernet address look >

Re: [PATCH 1/3] virtio: cache indirect desc for split

2021-10-27 Thread Jason Wang
On Thu, Oct 28, 2021 at 1:07 AM Michael S. Tsirkin wrote: > > On Wed, Oct 27, 2021 at 02:19:11PM +0800, Xuan Zhuo wrote: > > In the case of using indirect, indirect desc must be allocated and > > released each time, which increases a lot of cpu overhead. > > > > Here, a cache is added for indirect

Re: vDPA bus driver selection

2021-10-27 Thread Jason Wang
On Thu, Oct 28, 2021 at 4:16 AM Michael S. Tsirkin wrote: > > On Wed, Oct 27, 2021 at 03:21:15PM +, Parav Pandit wrote: > > Hi Stefano, > > > > > From: Stefano Garzarella > > > Sent: Wednesday, October 27, 2021 8:04 PM > > > > > > Hi folks, > > > I was trying to understand if we have a way to

Re: [PATCH 3/3] virtio-net: enable virtio indirect cache

2021-10-27 Thread Jason Wang
On Thu, Oct 28, 2021 at 9:59 AM Xuan Zhuo wrote: > > On Wed, 27 Oct 2021 08:55:28 -0700, Jakub Kicinski wrote: > > On Wed, 27 Oct 2021 14:19:13 +0800 Xuan Zhuo wrote: > > > +static bool virtio_desc_cache = true; > > > module_param(csum, bool, 0444); > > > module_param(gso, bool, 0444); > > > m

Re: [PATCH net-next v2] net: virtio: use eth_hw_addr_set()

2021-10-27 Thread Jason Wang
t; > always allocated by alloc_etherdev_mq() and there are at least two > > places which assume Ethernet address: > > - the line below calling eth_hw_addr_random() > > - virtnet_set_mac_address() -> eth_commit_mac_addr_change() > > > > Signed-off-by: Jakub Kic

Re: [PATCH v2 1/3] virtio: cache indirect desc for split

2021-10-28 Thread Jason Wang
On Thu, Oct 28, 2021 at 6:49 PM Xuan Zhuo wrote: > > In the case of using indirect, indirect desc must be allocated and > released each time, which increases a lot of cpu overhead. > > Here, a cache is added for indirect. If the number of indirect desc to be > applied for is less than VIRT_QUEUE_C

Re: vDPA bus driver selection

2021-10-28 Thread Jason Wang
On Thu, Oct 28, 2021 at 5:47 PM Stefano Garzarella wrote: > > On Thu, Oct 28, 2021 at 10:24:47AM +0800, Jason Wang wrote: > >On Thu, Oct 28, 2021 at 4:16 AM Michael S. Tsirkin wrote: > >> > >> On Wed, Oct 27, 2021 at 03:21:15PM +, Parav Pandit wrote: > >

Re: vDPA bus driver selection

2021-10-28 Thread Jason Wang
On Thu, Oct 28, 2021 at 5:48 PM Parav Pandit wrote: > > > > > From: Stefano Garzarella > > Sent: Thursday, October 28, 2021 3:08 PM > > > >> >$ vdpa/vdpa dev add mgmtdev vdpasim_net name vdpa0 mac > > >> >00:11:22:33:44:55 $ echo 0 > /sys/bus/vdpa/drivers_autoprobe > > >> > > > >> >And after vdpa

Re: [PATCH v7 0/9] vDPA driver for Alibaba ENI

2021-10-31 Thread Jason Wang
s use litter endian > > Changes since V2: > - add new attribute VDPA_ATTR_DEV_MIN_VQ_SIZE instead > VDPA_ATTR_DEV_F_VERSION_1 to guide users to choose correct virtqueue > size as suggested by Jason Wang > - present ACCESS_PLATFORM in get_features callback as suggested by Jason >

Re: [PATCH v7 0/9] vDPA driver for Alibaba ENI

2021-11-01 Thread Jason Wang
On Mon, Nov 1, 2021 at 2:23 PM Wu Zongyong wrote: > > On Mon, Nov 01, 2021 at 11:31:15AM +0800, Jason Wang wrote: > > On Fri, Oct 29, 2021 at 5:15 PM Wu Zongyong > > wrote: > > > > > > This series implements the vDPA driver for Alibaba ENI (Elastic Network &

Re: [PATCH V9 7/9] vhost: introduce vDPA-based backend

2021-11-01 Thread Jason Wang
On Mon, Nov 1, 2021 at 10:11 PM Jason Gunthorpe wrote: > > On Thu, Mar 26, 2020 at 10:01:23PM +0800, Jason Wang wrote: > > From: Tiwei Bie > > > > This patch introduces a vDPA-based vhost backend. This backend is > > built on top of the same interface defined in

Re: [PATCH V5 1/4] virtio_ring: validate used buffer length

2021-11-01 Thread Jason Wang
On Tue, Nov 2, 2021 at 11:22 AM Xuan Zhuo wrote: > > On Wed, 27 Oct 2021 10:21:04 +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 new field

Re: [RFC PATCH v5 00/26] vDPA shadow virtqueue

2021-11-01 Thread Jason Wang
在 2021/10/30 上午2:34, 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 datapl

Re: [RFC PATCH v5 03/26] virtio: Add VIRTIO_F_QUEUE_STATE

2021-11-01 Thread Jason Wang
On Sat, Oct 30, 2021 at 2:36 AM Eugenio Pérez wrote: > > Implementation of RFC of device state capability: > https://lists.oasis-open.org/archives/virtio-comment/202012/msg5.html Considering this still requires time to be done, we need to think of a way to go without this. Thanks > > With

Re: [RFC PATCH v5 21/26] vhost: Add vhost_svq_valid_guest_features to shadow vq

2021-11-01 Thread Jason Wang
On Sat, Oct 30, 2021 at 2:44 AM Eugenio Pérez wrote: > > This allows it to test if the guest has aknowledge an invalid transport > feature for SVQ. This will include packed vq layout or event_idx, > where VirtIO device needs help from SVQ. > > There is not needed at this moment, but since SVQ will

Re: [RFC PATCH v5 12/26] vhost: Route guest->host notification through shadow virtqueue

2021-11-01 Thread Jason Wang
在 2021/10/30 上午2:35, Eugenio Pérez 写道: +/** + * Enable or disable shadow virtqueue in a vhost vdpa device. + * + * This function is idempotent, to call it many times with the same value for + * enable_svq will simply return success. + * + * @v Vhost vdpa device + * @enable True to set SVQ

Re: [RFC PATCH v5 23/26] util: Add iova_tree_alloc

2021-11-01 Thread Jason Wang
在 2021/10/30 上午2:35, Eugenio Pérez 写道: This iova tree function allows it to look for a hole in allocated regions and return a totally new translation for a given translated address. It's usage is mainly to allow devices to access qemu address space, remapping guest's one into a new iova space w

Re: [RFC PATCH v5 11/26] vhost: Handle host notifiers in SVQ

2021-11-02 Thread Jason Wang
在 2021/10/30 上午2:35, Eugenio Pérez 写道: If device supports host notifiers, this makes one jump less (kernel) to deliver SVQ notifications to it. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 2 ++ hw/virtio/vhost-shadow-virtqueue.c | 23 ++- 2 fi

Re: [RFC PATCH v5 22/26] vhost: Shadow virtqueue buffers forwarding

2021-11-02 Thread Jason Wang
在 2021/10/30 上午2:35, 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 th

Re: [RFC PATCH v5 23/26] util: Add iova_tree_alloc

2021-11-02 Thread Jason Wang
On Tue, Nov 2, 2021 at 4:29 PM Eugenio Perez Martin wrote: > > On Tue, Nov 2, 2021 at 7:35 AM Jason Wang wrote: > > > > > > 在 2021/10/30 上午2:35, Eugenio Pérez 写道: > > > This iova tree function allows it to look for a hole in allocated > > > regions

Re: [RFC PATCH v5 21/26] vhost: Add vhost_svq_valid_guest_features to shadow vq

2021-11-02 Thread Jason Wang
On Tue, Nov 2, 2021 at 4:10 PM Eugenio Perez Martin wrote: > > On Tue, Nov 2, 2021 at 6:26 AM Jason Wang wrote: > > > > On Sat, Oct 30, 2021 at 2:44 AM Eugenio Pérez wrote: > > > > > > This allows it to test if the guest has aknowledge an invalid transp

Re: [PATCH V9 7/9] vhost: introduce vDPA-based backend

2021-11-03 Thread Jason Wang
On Tue, Nov 2, 2021 at 11:56 PM Jason Gunthorpe wrote: > > On Tue, Nov 02, 2021 at 11:52:20AM +0800, Jason Wang wrote: > > On Mon, Nov 1, 2021 at 10:11 PM Jason Gunthorpe wrote: > > > > > > On Thu, Mar 26, 2020 at 10:01:23PM +0800, Jason Wang wrote: > > >

Re: [RFC PATCH v5 11/26] vhost: Handle host notifiers in SVQ

2021-11-03 Thread Jason Wang
On Wed, Nov 3, 2021 at 3:40 PM Eugenio Perez Martin wrote: > > On Wed, Nov 3, 2021 at 3:56 AM Jason Wang wrote: > > > > On Tue, Nov 2, 2021 at 4:47 PM Eugenio Perez Martin > > wrote: > > > > > > On Tue, Nov 2, 2021 at 8:55 AM Jason Wang wrote: &

Re: [RFC PATCH v5 21/26] vhost: Add vhost_svq_valid_guest_features to shadow vq

2021-11-03 Thread Jason Wang
On Wed, Nov 3, 2021 at 3:44 PM Eugenio Perez Martin wrote: > > On Wed, Nov 3, 2021 at 4:18 AM Jason Wang wrote: > > > > On Tue, Nov 2, 2021 at 4:10 PM Eugenio Perez Martin > > wrote: > > > > > > On Tue, Nov 2, 2021 at 6:26 AM Jason Wang wrote: >

Re: [PATCH] vdpa: Mark vdpa_config_ops.get_vq_notification as optional

2021-11-04 Thread Jason Wang
On Fri, Nov 5, 2021 at 3:53 AM Eugenio Pérez wrote: > > Since vhost_vdpa_mmap checks for its existence before calling it. > > Signed-off-by: Eugenio Pérez Acked-by: Jason Wang > --- > include/linux/vdpa.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >

Re: [PATCH] vdpa: Avoid duplicate call to vp_vdpa get_status

2021-11-04 Thread Jason Wang
On Fri, Nov 5, 2021 at 3:58 AM Eugenio Pérez wrote: > > It has no sense to call get_status twice, since we already have a > variable for that. > > Signed-off-by: Eugenio Pérez Acked-by: Jason Wang > --- > drivers/vhost/vdpa.c | 2 +- > 1 file changed, 1 insertion(+)

Re: [PATCH] vdpa: add driver_override support

2021-11-04 Thread Jason Wang
> $ driverctl -b vdpa list-devices > dev1 virtio_vdpa > > $ driverctl -b vdpa set-override dev1 vhost_vdpa > > $ driverctl -b vdpa list-devices > dev1 vhost_vdpa [*] > > Note: driverctl(8) integrates with udev so the binding is > preserved. > > S

Re: [PATCH] vdpa: add driver_override support

2021-11-05 Thread Jason Wang
On Fri, Nov 5, 2021 at 4:05 PM Stefano Garzarella wrote: > > On Fri, Nov 05, 2021 at 11:01:30AM +0800, Jason Wang wrote: > >On Fri, Nov 5, 2021 at 12:17 AM Stefano Garzarella > >wrote: > >> > >> `driver_override` allows to control which of the vDPA bus

Re: [PATCH 1/2] eni_vdpa: Fix an error handling path in 'eni_vdpa_probe()'

2021-11-07 Thread Jason Wang
On Mon, Nov 8, 2021 at 12:15 AM Christophe JAILLET wrote: > > In the error handling path, a successful 'vp_legacy_probe()' should be > balanced by a corresponding 'vp_legacy_remove()' call, as already done in > the remove function. > > Add the missing call and update gotos accordingly. > > Fixes:

[PATCH] virtio_ring: aovid reading flag from the descriptor ring

2021-11-08 Thread Jason Wang
ing during buffer detach. This patch fixes by always store the descriptor flag no matter whether DMA API is used and then we can avoid reading descriptor flag from the descriptor ring. This eliminates the possibly of unexpected next descriptor caused by the wrong flag (e.g the next flag). Signed-off

Re: [PATCH 1/2] eni_vdpa: Fix an error handling path in 'eni_vdpa_probe()'

2021-11-08 Thread Jason Wang
On Tue, Nov 9, 2021 at 3:32 AM Christophe JAILLET wrote: > > Le 08/11/2021 à 06:55, Jason Wang a écrit : > > On Mon, Nov 8, 2021 at 12:15 AM Christophe JAILLET > > wrote: > >> > >> In the error handling path, a successful 'vp_legacy_probe()&#x

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