Re: [PATCH v4 5/7] vhost-vdpa: clean iotlb map during reset for older userspace

2023-10-24 Thread Si-Wei Liu
On 10/23/2023 10:45 PM, Jason Wang wrote: On Sat, Oct 21, 2023 at 5:28 PM Si-Wei Liu wrote: Using .compat_reset op from the previous patch, the buggy .reset behaviour can be kept as-is on older userspace apps, which don't ack the IOTLB_PERSIST backend feature. As this compatibility qui

Re: [PATCH v4 5/7] vhost-vdpa: clean iotlb map during reset for older userspace

2023-10-24 Thread Si-Wei Liu
On 10/24/2023 9:21 AM, Si-Wei Liu wrote: On 10/23/2023 10:45 PM, Jason Wang wrote: On Sat, Oct 21, 2023 at 5:28 PM Si-Wei Liu wrote: Using .compat_reset op from the previous patch, the buggy .reset behaviour can be kept as-is on older userspace apps, which don't ack the IOTLB_PE

Re: [PATCH v4 0/7] vdpa: decouple reset of iotlb mapping from device reset

2023-10-24 Thread Si-Wei Liu
51 PM, Lei Yang wrote: QE tested this series v4 with regression testing on real nic, there is no new regression bug. Tested-by: Lei Yang On Tue, Oct 24, 2023 at 6:02 AM Si-Wei Liu wrote: On 10/22/2023 8:51 PM, Jason Wang wrote: Hi Si-Wei: On Sat, Oct 21, 2023 at 5:28 PM Si-Wei Liu wrote

[PATCH] vhost-vdpa: fix use-after-free in _compat_vdpa_reset

2023-10-25 Thread Si-Wei Liu
all/CAPpAL=yhdqn1aztecn3mps8o4m+bl_hvy02fdpihn7dwd91...@mail.gmail.com/ Signed-off-by: Si-Wei Liu --- drivers/vhost/vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 9a2343c45df0..30df5c58db73 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/

Re: [PATCH v4 0/7] vdpa: decouple reset of iotlb mapping from device reset

2023-10-25 Thread Si-Wei Liu
2:41 AM, Lei Yang wrote: On Wed, Oct 25, 2023 at 1:27 AM Si-Wei Liu wrote: Hello Si-Wei Thanks a lot for testing! Please be aware that there's a follow-up fix for a potential oops in this v4 series: The first, when I did not apply this patch [1], I will also hit this patch mentioned pr

Re: [PATCH] vhost-vdpa: fix use-after-free in _compat_vdpa_reset

2023-10-25 Thread Si-Wei Liu
On 10/25/2023 10:26 PM, Michael S. Tsirkin wrote: On Wed, Oct 25, 2023 at 04:13:14PM -0700, Si-Wei Liu wrote: When the vhost-vdpa device is being closed, vhost_vdpa_cleanup() doesn't clean up the vqs pointer after free. This could lead to use-after-tree when _compat_vdpa_reset() tri

[PATCH v5 0/7] vdpa: decouple reset of iotlb mapping from device reset

2023-10-26 Thread Si-Wei Liu
nd-email-si-wei@oracle.com/ --- Si-Wei Liu (7): vdpa: introduce .reset_map operation callback vhost-vdpa: reset vendor specific mapping to initial state in .release vhost-vdpa: introduce IOTLB_PERSIST backend feature bit vdpa: introduce .compat_reset operation callback vhost-vdpa: clean i

[PATCH v5 2/7] vhost-vdpa: reset vendor specific mapping to initial state in .release

2023-10-26 Thread Si-Wei Liu
evice reset should not cause mapping to go away on such IOTLB model, so persistent mapping is implied across reset. Before the userspace process using vhost-vdpa is gone, give it a chance to reset iotlb back to the initial state in vhost_vdpa_cleanup(). Signed-off-by: Si-Wei Liu Acked-by: Eugenio

[PATCH v5 4/7] vdpa: introduce .compat_reset operation callback

2023-10-26 Thread Si-Wei Liu
ot bother to implement such op, but only those drivers that are doing or used to do non-compliant map-cleaning reset will have to. Signed-off-by: Si-Wei Liu --- include/linux/vdpa.h | 13 + 1 file changed, 13 insertions(+) diff --git a/include/linux/vdpa.h b/include/linux/vdp

[PATCH v5 1/7] vdpa: introduce .reset_map operation callback

2023-10-26 Thread Si-Wei Liu
ot a MUST for every parent that implements the .dma_map or .set_map API, because device may work with DMA ops directly by implement their own to manipulate system memory mappings, so don't have to use .reset_map to achieve a simple IOMMU device model for 1:1 passthrough mapping. Signed-off-

[PATCH v5 6/7] vdpa/mlx5: implement .reset_map driver op

2023-10-26 Thread Si-Wei Liu
d clean up memory mappings by itself. Additionally, implement .compat_reset to cater for older userspace, which may wish to see mapping to be cleared during reset. Co-developed-by: Dragos Tatulea Signed-off-by: Dragos Tatulea Signed-off-by: Si-Wei Liu --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 1

[PATCH v5 3/7] vhost-vdpa: introduce IOTLB_PERSIST backend feature bit

2023-10-26 Thread Si-Wei Liu
it is safe to skip this unmap & map in the case of vhost stop & start cycle. In that sense, this feature flag is actually a signal for userspace to know that the driver bug has been solved. Not offering it indicates that userspace cannot trust the kernel will retain the maps. Signed-off-by:

[PATCH v5 5/7] vhost-vdpa: clean iotlb map during reset for older userspace

2023-10-26 Thread Si-Wei Liu
ompared to overloading the existing .reset with flags, .compat_reset won't cause any extra burden to the implementation of every compliant driver. Signed-off-by: Si-Wei Liu Tested-by: Dragos Tatulea Tested-by: Lei Yang --- drivers/vhost/vdpa.c | 20 drivers/virtio/vir

[PATCH v5 7/7] vdpa_sim: implement .reset_map support

2023-10-26 Thread Si-Wei Liu
tself. Additionally, implement .compat_reset to cater for older userspace, which may wish to see mapping to be cleared during reset. Signed-off-by: Si-Wei Liu Tested-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 52 ++-- 1 file changed, 43 insertions(

Re: [PATCH] vhost-vdpa: fix use-after-free in _compat_vdpa_reset

2023-10-26 Thread Si-Wei Liu
On 10/25/2023 11:55 PM, Si-Wei Liu wrote: On 10/25/2023 10:26 PM, Michael S. Tsirkin wrote: On Wed, Oct 25, 2023 at 04:13:14PM -0700, Si-Wei Liu wrote: When the vhost-vdpa device is being closed, vhost_vdpa_cleanup() doesn't clean up the vqs pointer after free. This could lead t

Re: [RFC] vdpa/mlx5: preserve CVQ vringh index

2023-10-26 Thread Si-Wei Liu
Steve, I think this is a loose end that I myself am not sure if worth fixing, copy Eugenio for his awareness. Reason is that when CVQ is in place it always has to cope with device state saving and restoration using shadowed virtqueue for a lot of cases not just migration, and that's the reas

Re: [PATCH] net/mlx5_vdpa: Offer VIRTIO_NET_F_MTU when setting MTU

2021-11-24 Thread Si-Wei Liu
On 11/24/2021 9:09 AM, Eli Cohen wrote: Make sure to offer VIRTIO_NET_F_MTU since we configure the MTU based on what was queried from the device. This allows the virtio driver to allocate large enough buffers based on the reported MTU. Signed-off-by: Eli Cohen Reviewed-by: Si-Wei Liu

Re: [PATCH] net/mlx5_vdpa: Increase the limit on the number of virtuques

2021-11-24 Thread Si-Wei Liu
On 11/24/2021 9:19 AM, Eli Cohen wrote: Increase the limit on the maximum number of supported virtqueues to 256 to match hardware capabilities. Signed-off-by: Eli Cohen Acked-by: Si-Wei Liu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

Re: [PATCH] net/mlx5_vdpa: Increase the limit on the number of virtuques

2021-11-29 Thread Si-Wei Liu
On 11/25/2021 8:22 AM, Michael S. Tsirkin wrote: On Thu, Nov 25, 2021 at 09:29:53AM +0200, Eli Cohen wrote: On Thu, Nov 25, 2021 at 02:21:43AM -0500, Michael S. Tsirkin wrote: On Wed, Nov 24, 2021 at 07:19:53PM +0200, Eli Cohen wrote: Increase the limit on the maximum number of supported vi

Re: [PATCH 1/2] vdpa: Allow to configure max data virtqueues

2021-11-30 Thread Si-Wei Liu
On 11/30/2021 1:48 AM, Eli Cohen wrote: Allow to configure the max virtqueues for a device. Signed-off-by: Eli Cohen --- drivers/vdpa/vdpa.c | 16 +++- include/linux/vdpa.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/vdpa.c b/drivers/v

Re: [PATCH 2/2] vdpa/mlx5: Support configuring max data virtqueues

2021-11-30 Thread Si-Wei Liu
On 11/30/2021 1:48 AM, Eli Cohen wrote: Check if the required number of data virtqueues was provided when a adding a new device and verify the new value does not exceed device capabilities. In addition, change the arrays holding virtqueue and callback contexts to be dynamically allocated. Si

Re: [PATCH 1/2] vdpa: Allow to configure max data virtqueues

2021-12-01 Thread Si-Wei Liu
On 12/1/2021 2:03 AM, Eli Cohen wrote: On Tue, Nov 30, 2021 at 05:24:03PM -0800, Si-Wei Liu wrote: On 11/30/2021 1:48 AM, Eli Cohen wrote: Allow to configure the max virtqueues for a device. Signed-off-by: Eli Cohen --- drivers/vdpa/vdpa.c | 16 +++- include/linux

Re: [PATCH 1/2] vdpa: Allow to configure max data virtqueues

2021-12-01 Thread Si-Wei Liu
On 12/1/2021 2:03 AM, Eli Cohen wrote: + if ((config.max_virtqueues - 1) & config.max_virtqueues) { + NL_SET_ERR_MSG_MOD(info->extack, + "Must provide power of two number of virtqueues"); Why there's such limitation

Re: [PATCH 1/7] vdpa: Allow to configure max data virtqueues

2021-12-02 Thread Si-Wei Liu
On 12/1/2021 11:57 AM, Eli Cohen wrote: Add netlink support to configure the max virtqueue pairs for a device. At least one pair is required. The maximum is dictated by the device. Signed-off-by: Eli Cohen --- drivers/vdpa/vdpa.c | 14 +- include/linux/vdpa.h | 1 + 2 files

Re: [PATCH 3/7] vdpa/mlx5: Support configuring max data virtqueue pairs

2021-12-02 Thread Si-Wei Liu
On 12/1/2021 11:57 AM, Eli Cohen wrote: Check whether the max number of data virtqueue pairs was provided when a adding a new device and verify the new value does not exceed device capabilities. In addition, change the arrays holding virtqueue and callback contexts to be dynamically allocated

Re: [PATCH 4/7] vdpa/mlx5: Report queried max supported virtqueues

2021-12-02 Thread Si-Wei Liu
On 12/1/2021 11:57 AM, Eli Cohen wrote: Report back in get_vq_num_max() the correct number of virtqueues queried from the device instead of using a constant value. Signed-off-by: Eli Cohen --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) dif

Re: [PATCH 3/7] vdpa/mlx5: Support configuring max data virtqueue pairs

2021-12-02 Thread Si-Wei Liu
On 12/2/2021 11:31 PM, Parav Pandit wrote: From: Si-Wei Liu Sent: Friday, December 3, 2021 12:58 PM On 12/1/2021 11:57 AM, Eli Cohen wrote: Check whether the max number of data virtqueue pairs was provided when a adding a new device and verify the new value does not exceed device

Re: [PATCH 3/7] vdpa/mlx5: Support configuring max data virtqueue pairs

2021-12-07 Thread Si-Wei Liu
On 12/7/2021 12:19 AM, Eli Cohen wrote: On Thu, Dec 02, 2021 at 11:28:12PM -0800, Si-Wei Liu wrote: On 12/1/2021 11:57 AM, Eli Cohen wrote: Check whether the max number of data virtqueue pairs was provided when a adding a new device and verify the new value does not exceed device

Re: [PATCH v1 1/7] vdpa: Provide interface to read driver features

2021-12-08 Thread Si-Wei Liu
On 12/8/2021 12:14 PM, Eli Cohen wrote: Provide an interface to read the negotiated features. This is needed when building the netlink message in vdpa_dev_net_config_fill(). Also fix the implementation of vdpa_dev_net_config_fill() to use the negotiated features instead of the device features

Re: [PATCH v1 2/7] vdpa/mlx5: Distribute RX virtqueues in RQT object

2021-12-08 Thread Si-Wei Liu
On 12/8/2021 12:14 PM, Eli Cohen wrote: Distribute the available rx virtqueues amongst the available RQT entries. RQTs require to have a power of two entries. When creating or modifying the RQT, use the lowest number of power of two entries that is not less than the number of rx virtqueues. D

Re: [PATCH v1 3/7] vdpa: Allow to configure max data virtqueues

2021-12-08 Thread Si-Wei Liu
On 12/8/2021 12:14 PM, Eli Cohen wrote: Add netlink support to configure the max virtqueue pairs for a device. At least one pair is required. The maximum is dictated by the device. Example: $ vdpa dev add name vdpa-a mgmtdev auxiliary/mlx5_core.sf.1 max_vqp 5 Not this patch, but I think ther

Re: [PATCH v1 6/7] vdpa: Add support for querying control virtqueue index

2021-12-08 Thread Si-Wei Liu
On 12/8/2021 12:14 PM, Eli Cohen wrote: Add netlink attribute and callback function to query the control VQ index of a device. Example: $ vdpa dev config show vdpa-a vdpa-a: mac 00:00:00:00:88:88 link up link_announce false max_vq_pairs 5 \ mtu 9000 ctrl_vq_idx 10 First, I am not sure i

Re: [PATCH v1 3/7] vdpa: Allow to configure max data virtqueues

2021-12-09 Thread Si-Wei Liu
On 12/8/2021 9:36 PM, Jason Wang wrote: On Thu, Dec 9, 2021 at 8:25 AM Si-Wei Liu wrote: On 12/8/2021 12:14 PM, Eli Cohen wrote: Add netlink support to configure the max virtqueue pairs for a device. At least one pair is required. The maximum is dictated by the device. Example: $ vdpa

Re: [PATCH v1 1/7] vdpa: Provide interface to read driver features

2021-12-09 Thread Si-Wei Liu
On 12/8/2021 10:47 PM, Eli Cohen wrote: On Wed, Dec 08, 2021 at 03:57:21PM -0800, Si-Wei Liu wrote: On 12/8/2021 12:14 PM, Eli Cohen wrote: Provide an interface to read the negotiated features. This is needed when building the netlink message in vdpa_dev_net_config_fill(). Also fix the

Re: [PATCH v1 7/7] vdpa/mlx5: Restore cur_num_vqs in case of failure in change_num_qps()

2021-12-10 Thread Si-Wei Liu
On 12/8/2021 12:14 PM, Eli Cohen wrote: Restore ndev->cur_num_vqs to the original value in case change_num_qps() fails. Fixes: 52893733f2c5 ("vdpa/mlx5: Add multiqueue support") Acked-by: Jason Wang Signed-off-by: Eli Cohen --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 ++ 1 file changed, 2

Re: [PATCH v1 2/7] vdpa/mlx5: Distribute RX virtqueues in RQT object

2021-12-10 Thread Si-Wei Liu
On 12/8/2021 10:55 PM, Eli Cohen wrote: On Wed, Dec 08, 2021 at 04:12:33PM -0800, Si-Wei Liu wrote: On 12/8/2021 12:14 PM, Eli Cohen wrote: Distribute the available rx virtqueues amongst the available RQT entries. RQTs require to have a power of two entries. When creating or modifying the

vdpa legacy guest support (was Re: [PATCH] vdpa/mlx5: set_features should allow reset to zero)

2021-12-10 Thread Si-Wei Liu
ready reached. Thanks, -Siwei On 3/2/2021 2:53 AM, Jason Wang wrote: On 2021/3/2 5:47 下午, Michael S. Tsirkin wrote: On Mon, Mar 01, 2021 at 11:56:50AM +0800, Jason Wang wrote: On 2021/3/1 5:34 上午, Michael S. Tsirkin wrote: On Wed, Feb 24, 2021 at 10:24:41AM -0800, Si-Wei Liu wrote: Detecting

Re: [PATCH v1 1/7] vdpa: Provide interface to read driver featuresy

2021-12-13 Thread Si-Wei Liu
On 12/12/2021 5:38 AM, Eli Cohen wrote: On Thu, Dec 09, 2021 at 02:29:17PM -0800, Si-Wei Liu wrote: On 12/8/2021 10:47 PM, Eli Cohen wrote: On Wed, Dec 08, 2021 at 03:57:21PM -0800, Si-Wei Liu wrote: On 12/8/2021 12:14 PM, Eli Cohen wrote: Provide an interface to read the negotiated

Re: [PATCH v2 07/10] vdpa: Add support for returning device configuration information

2021-12-13 Thread Si-Wei Liu
On 12/13/2021 6:42 AM, Eli Cohen wrote: Add netlink attribute to store flags indicating current state of the device. In addition, introduce a flag to indicate whether control virtqueue is used. This indication can be retrieved by: vdpa dev config show vdpa-a vdpa-a: mac 00:00:00:00:88:88 lin

Re: [PATCH v2 09/10] vdpa: Support reporting max device virtqueues

2021-12-13 Thread Si-Wei Liu
On 12/13/2021 6:42 AM, Eli Cohen wrote: Add max_supported_vqs field to struct vdpa_mgmt_dev. Upstream drivers need to feel this value according to the device capabilities. This value is reported back in a netlink message when showing a device. Example: $ vdpa dev show vdpa-a: type network m

Re: [PATCH v2 05/10] vdpa/mlx5: Fix config_attr_mask assignment

2021-12-13 Thread Si-Wei Liu
ot;) Acked-by: Jason Wang Reviewed-by: Si-Wei Liu Signed-off-by: Eli Cohen --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 98aed4b36c3f..4a2149f70f1e 10

Re: [PATCH v2 04/10] vdpa: Allow to configure max data virtqueues

2021-12-13 Thread Si-Wei Liu
On 12/13/2021 6:42 AM, Eli Cohen wrote: Add netlink support to configure the max virtqueue pairs for a device. At least one pair is required. The maximum is dictated by the device. Signed-off-by: Eli Cohen --- drivers/vdpa/vdpa.c | 14 +- include/linux/vdpa.h | 1 + 2 files

Re: [PATCH v1 3/7] vdpa: Allow to configure max data virtqueues

2021-12-13 Thread Si-Wei Liu
On 12/13/2021 5:07 AM, Eli Cohen wrote: On Mon, Dec 13, 2021 at 08:44:53AM +0200, Eli Cohen wrote: On Fri, Dec 10, 2021 at 10:29:43AM +0800, Jason Wang wrote: On Fri, Dec 10, 2021 at 5:51 AM Si-Wei Liu wrote: On 12/8/2021 9:36 PM, Jason Wang wrote: On Thu, Dec 9, 2021 at 8:25 AM Si-Wei

Re: [PATCH v2 09/10] vdpa: Support reporting max device virtqueues

2021-12-13 Thread Si-Wei Liu
On 12/13/2021 6:42 AM, Eli Cohen wrote: Add max_supported_vqs field to struct vdpa_mgmt_dev. Upstream drivers need to feel this value according to the device capabilities. This value is reported back in a netlink message when showing a device. Example: $ vdpa dev show vdpa-a: type network m

Re: vdpa legacy guest support (was Re: [PATCH] vdpa/mlx5: set_features should allow reset to zero)

2021-12-13 Thread Si-Wei Liu
On 12/12/2021 7:02 PM, Jason Wang wrote: On Sun, Dec 12, 2021 at 5:26 PM Michael S. Tsirkin wrote: On Fri, Dec 10, 2021 at 05:44:15PM -0800, Si-Wei Liu wrote: Sorry for reviving this ancient thread. I was kinda lost for the conclusion it ended up with. I have the following questions, 1

Re: vdpa legacy guest support (was Re: [PATCH] vdpa/mlx5: set_features should allow reset to zero)

2021-12-13 Thread Si-Wei Liu
On 12/12/2021 1:26 AM, Michael S. Tsirkin wrote: On Fri, Dec 10, 2021 at 05:44:15PM -0800, Si-Wei Liu wrote: Sorry for reviving this ancient thread. I was kinda lost for the conclusion it ended up with. I have the following questions, 1. legacy guest support: from the past conversations it

Re: vdpa legacy guest support (was Re: [PATCH] vdpa/mlx5: set_features should allow reset to zero)

2021-12-14 Thread Si-Wei Liu
On 12/13/2021 9:06 PM, Michael S. Tsirkin wrote: On Mon, Dec 13, 2021 at 05:59:45PM -0800, Si-Wei Liu wrote: On 12/12/2021 1:26 AM, Michael S. Tsirkin wrote: On Fri, Dec 10, 2021 at 05:44:15PM -0800, Si-Wei Liu wrote: Sorry for reviving this ancient thread. I was kinda lost for the

Re: vdpa legacy guest support (was Re: [PATCH] vdpa/mlx5: set_features should allow reset to zero)

2021-12-15 Thread Si-Wei Liu
On 12/14/2021 6:06 PM, Jason Wang wrote: On Wed, Dec 15, 2021 at 9:05 AM Si-Wei Liu wrote: On 12/13/2021 9:06 PM, Michael S. Tsirkin wrote: On Mon, Dec 13, 2021 at 05:59:45PM -0800, Si-Wei Liu wrote: On 12/12/2021 1:26 AM, Michael S. Tsirkin wrote: On Fri, Dec 10, 2021 at 05:44:15PM

Re: vdpa legacy guest support (was Re: [PATCH] vdpa/mlx5: set_features should allow reset to zero)

2021-12-15 Thread Si-Wei Liu
On 12/15/2021 1:33 PM, Michael S. Tsirkin wrote: On Wed, Dec 15, 2021 at 12:52:20PM -0800, Si-Wei Liu wrote: On 12/14/2021 6:06 PM, Jason Wang wrote: On Wed, Dec 15, 2021 at 9:05 AM Si-Wei Liu wrote: On 12/13/2021 9:06 PM, Michael S. Tsirkin wrote: On Mon, Dec 13, 2021 at 05:59:45PM

Re: [PATCH v2 09/10] vdpa: Support reporting max device virtqueues

2021-12-15 Thread Si-Wei Liu
On 12/14/2021 12:22 AM, Eli Cohen wrote: On Mon, Dec 13, 2021 at 05:00:18PM -0800, Si-Wei Liu wrote: On 12/13/2021 6:42 AM, Eli Cohen wrote: Add max_supported_vqs field to struct vdpa_mgmt_dev. Upstream drivers need to feel this value according to the device capabilities. This value is

Re: vdpa legacy guest support (was Re: [PATCH] vdpa/mlx5: set_features should allow reset to zero)

2021-12-16 Thread Si-Wei Liu
On 12/15/2021 6:53 PM, Jason Wang wrote: On Thu, Dec 16, 2021 at 10:02 AM Si-Wei Liu wrote: On 12/15/2021 1:33 PM, Michael S. Tsirkin wrote: On Wed, Dec 15, 2021 at 12:52:20PM -0800, Si-Wei Liu wrote: On 12/14/2021 6:06 PM, Jason Wang wrote: On Wed, Dec 15, 2021 at 9:05 AM Si-Wei Liu

Re: vdpa legacy guest support (was Re: [PATCH] vdpa/mlx5: set_features should allow reset to zero)

2021-12-16 Thread Si-Wei Liu
On 12/15/2021 7:43 PM, Jason Wang wrote: On Thu, Dec 16, 2021 at 4:52 AM Si-Wei Liu wrote: On 12/14/2021 6:06 PM, Jason Wang wrote: On Wed, Dec 15, 2021 at 9:05 AM Si-Wei Liu wrote: On 12/13/2021 9:06 PM, Michael S. Tsirkin wrote: On Mon, Dec 13, 2021 at 05:59:45PM -0800, Si-Wei Liu

Re: [PATCH v2 09/10] vdpa: Support reporting max device virtqueues

2021-12-21 Thread Si-Wei Liu
On 12/19/2021 4:08 AM, Eli Cohen wrote: On Wed, Dec 15, 2021 at 06:56:40PM -0800, Si-Wei Liu wrote: On 12/14/2021 12:22 AM, Eli Cohen wrote: On Mon, Dec 13, 2021 at 05:00:18PM -0800, Si-Wei Liu wrote: On 12/13/2021 6:42 AM, Eli Cohen wrote: Add max_supported_vqs field to struct

Re: [PATCH v5 04/13] vdpa: Read device configuration only if FEATURES_OK

2021-12-21 Thread Si-Wei Liu
On 12/21/2021 9:19 AM, Eli Cohen wrote: Avoid reading device configuration during feature negotiation. Read device status and verify that VIRTIO_CONFIG_S_FEATURES_OK is set. Otherwise, return -EAGAIN. Signed-off-by: Eli Cohen --- drivers/vdpa/vdpa.c | 10 ++ 1 file changed, 10 in

Re: [PATCH v5 10/13] vdpa: Support reporting max device virtqueues

2021-12-21 Thread Si-Wei Liu
On 12/21/2021 9:20 AM, Eli Cohen wrote: Add max_supported_vqs field to struct vdpa_mgmt_dev. Upstream drivers need to feel this value according to the device capabilities. This value is reported back in a netlink message when showing management devices. Example: $ vdpa dev show s/dev/mgmtd

Re: [PATCH v5 09/13] vdpa/mlx5: Restore cur_num_vqs in case of failure in change_num_qps()

2021-12-21 Thread Si-Wei Liu
On 12/21/2021 9:20 AM, Eli Cohen wrote: Restore ndev->cur_num_vqs to the original value in case change_num_qps() fails. Fixes: 52893733f2c5 ("vdpa/mlx5: Add multiqueue support") Acked-by: Jason Wang Signed-off-by: Eli Cohen Reviewed-by: Si-Wei Liu --- drivers/

Re: [PATCH v5 08/13] vdpa: Add support for returning device configuration information

2021-12-21 Thread Si-Wei Liu
On 12/21/2021 9:20 AM, Eli Cohen wrote: Add netlink attribute to store the negotiated features. This can be used by userspace to get the current state of the vdpa instance. Example: $ vdpa dev config show vdpa-a vdpa-a: mac 00:00:00:00:88:88 link up link_announce false max_vq_pairs 4 \ mt

Re: [PATCH v5 07/13] vdpa/mlx5: Support configuring max data virtqueue pairs

2021-12-21 Thread Si-Wei Liu
allocated. Acked-by: Jason Wang Signed-off-by: Eli Cohen Reviewed-by: Si-Wei Liu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 43 +-- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index

Re: [PATCH v5 11/13] vdpa/mlx5: Configure max supported virtqueues

2021-12-21 Thread Si-Wei Liu
On 12/21/2021 9:20 AM, Eli Cohen wrote: Configure max supported virtqueues on the management device. This info can be retrieved using: $ vdpa mgmtdev show auxiliary/mlx5_core.sf.1: supported_classes net max_supported_vqs 257 Signed-off-by: Eli Cohen Reviewed-by: Si-Wei Liu

Re: [PATCH v5 13/13] vdpa: Use BIT_ULL for bit operations

2021-12-21 Thread Si-Wei Liu
On 12/21/2021 9:20 AM, Eli Cohen wrote: All masks in this file are 64 bits. Change BIT to BIT_ULL. Other occurences use (1 << val) which yields a 32 bit value. Change them to use BIT_ULL too. Signed-off-by: Eli Cohen Reviewed-by: Si-Wei Liu --- drivers/vdpa/vdpa.

Re: [PATCH v5 10/13] vdpa: Support reporting max device virtqueues

2021-12-21 Thread Si-Wei Liu
On 12/21/2021 9:06 PM, Parav Pandit wrote: From: Si-Wei Liu Sent: Wednesday, December 22, 2021 7:31 AM On 12/21/2021 9:20 AM, Eli Cohen wrote: Add max_supported_vqs field to struct vdpa_mgmt_dev. Upstream drivers need to feel this value according to the device capabilities. This value

Re: [PATCH v5 04/13] vdpa: Read device configuration only if FEATURES_OK

2021-12-21 Thread Si-Wei Liu
On 12/21/2021 9:55 PM, Eli Cohen wrote: On Tue, Dec 21, 2021 at 05:55:56PM -0800, Si-Wei Liu wrote: On 12/21/2021 9:19 AM, Eli Cohen wrote: Avoid reading device configuration during feature negotiation. Read device status and verify that VIRTIO_CONFIG_S_FEATURES_OK is set. Otherwise

Re: [PATCH v5 10/13] vdpa: Support reporting max device virtqueues

2021-12-21 Thread Si-Wei Liu
On 12/21/2021 11:10 PM, Eli Cohen wrote: On Wed, Dec 22, 2021 at 09:03:37AM +0200, Parav Pandit wrote: From: Eli Cohen Sent: Wednesday, December 22, 2021 12:17 PM --- a/drivers/vdpa/vdpa.c +++ b/drivers/vdpa/vdpa.c @@ -507,6 +507,9 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_

Re: [PATCH v5 10/13] vdpa: Support reporting max device virtqueues

2021-12-22 Thread Si-Wei Liu
On 12/21/2021 11:54 PM, Eli Cohen wrote: On Tue, Dec 21, 2021 at 11:29:36PM -0800, Si-Wei Liu wrote: On 12/21/2021 11:10 PM, Eli Cohen wrote: On Wed, Dec 22, 2021 at 09:03:37AM +0200, Parav Pandit wrote: From: Eli Cohen Sent: Wednesday, December 22, 2021 12:17 PM --- a/drivers/vdpa

Re: [PATCH v6 03/13] vdpa: Sync calls set/get config/status with cf_mutex

2021-12-22 Thread Si-Wei Liu
On 12/22/2021 6:20 AM, Eli Cohen wrote: Add wrappers to get/set status and protect these operations with cf_mutex to serialize these operations with respect to get/set config operations. Need to protect vdpa_reset() which is essentially vdpa_set_status(0) -Siwei Signed-off-by: Eli Cohen -

Re: [PATCH v6 10/13] vdpa: Support reporting max device virtqueues

2021-12-22 Thread Si-Wei Liu
On 12/22/2021 6:20 AM, Eli Cohen wrote: Add max_supported_vqs field to struct vdpa_mgmt_dev. Upstream drivers need to feel this value according to the device capabilities. This value is reported back in a netlink message when showing management devices. Examples: $ vdpa mgmtdev show auxilia

Re: [PATCH v5 10/13] vdpa: Support reporting max device virtqueues

2021-12-22 Thread Si-Wei Liu
On 12/22/2021 6:27 PM, Jason Wang wrote: On Thu, Dec 23, 2021 at 3:25 AM Si-Wei Liu wrote: On 12/21/2021 11:54 PM, Eli Cohen wrote: On Tue, Dec 21, 2021 at 11:29:36PM -0800, Si-Wei Liu wrote: On 12/21/2021 11:10 PM, Eli Cohen wrote: On Wed, Dec 22, 2021 at 09:03:37AM +0200, Parav

Re: [PATCH v5 10/13] vdpa: Support reporting max device virtqueues

2021-12-23 Thread Si-Wei Liu
On 12/22/2021 9:39 PM, Eli Cohen wrote: On Wed, Dec 22, 2021 at 06:43:38PM -0800, Si-Wei Liu wrote: On 12/22/2021 6:27 PM, Jason Wang wrote: On Thu, Dec 23, 2021 at 3:25 AM Si-Wei Liu wrote: On 12/21/2021 11:54 PM, Eli Cohen wrote: On Tue, Dec 21, 2021 at 11:29:36PM -0800, Si-Wei Liu

Re: [PATCH v6 03/13] vdpa: Sync calls set/get config/status with cf_mutex

2021-12-23 Thread Si-Wei Liu
On 12/22/2021 9:46 PM, Eli Cohen wrote: On Wed, Dec 22, 2021 at 02:58:18PM -0800, Si-Wei Liu wrote: On 12/22/2021 6:20 AM, Eli Cohen wrote: Add wrappers to get/set status and protect these operations with cf_mutex to serialize these operations with respect to get/set config operations

Re: [PATCH v6 03/13] vdpa: Sync calls set/get config/status with cf_mutex

2022-01-04 Thread Si-Wei Liu
On 12/28/2021 7:36 AM, Eli Cohen wrote: On Thu, Dec 23, 2021 at 01:58:50PM -0800, Si-Wei Liu wrote: On 12/22/2021 9:46 PM, Eli Cohen wrote: On Wed, Dec 22, 2021 at 02:58:18PM -0800, Si-Wei Liu wrote: On 12/22/2021 6:20 AM, Eli Cohen wrote: Add wrappers to get/set status and protect these

Re: [PATCH] vdpa/mlx5: Fix wrong configuration of virtio_version_1_0

2022-01-04 Thread Si-Wei Liu
On 12/30/2021 6:20 AM, Eli Cohen wrote: Remove overriding of virtio_version_1_0 which forced the virtqueue object to version 1. Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") Signed-off-by: Eli Cohen Reviewed-by: Si-Wei Liu -Siwei --- drivers

Re: [PATCH v7 03/14] vdpa: Sync calls set/get config/status with cf_mutex

2022-01-06 Thread Si-Wei Liu
On 1/5/2022 3:46 AM, Eli Cohen wrote: Add wrappers to get/set status and protect these operations with cf_mutex to serialize these operations with respect to get/set config operations. Signed-off-by: Eli Cohen --- drivers/vdpa/vdpa.c | 19 +++ drivers/vhost/vdpa.c

Re: [PATCH v7 05/14] vdpa: Allow to configure max data virtqueues

2022-01-06 Thread Si-Wei Liu
On 1/5/2022 3:46 AM, Eli Cohen wrote: Add netlink support to configure the max virtqueue pairs for a device. At least one pair is required. The maximum is dictated by the device. Example: $ vdpa dev add name vdpa-a mgmtdev auxiliary/mlx5_core.sf.1 max_vqp 4 Signed-off-by: Eli Cohen --- v6->

Re: [PATCH v7 07/14] vdpa/mlx5: Support configuring max data virtqueue

2022-01-06 Thread Si-Wei Liu
for (i = 0, j = 0; i < max_rqt; i++, j += 2) - list[i] = cpu_to_be32(ndev->vqs[j % ndev->mvdev.max_vqs].virtq_id); + list[i] = cpu_to_be32(ndev->vqs[j % (2 * num)].virtq_id); Good catch. LGTM. Reviewed-by: Si-Wei Liu MLX5_SET(rqtc, rqtc, rqt_actual_size, max

Re: [PATCH v7 07/14] vdpa/mlx5: Support configuring max data virtqueue

2022-01-06 Thread Si-Wei Liu
On 1/6/2022 5:27 PM, Si-Wei Liu wrote: On 1/5/2022 3:46 AM, Eli Cohen wrote: Check whether the max number of data virtqueue pairs was provided when a adding a new device and verify the new value does not exceed device capabilities. In addition, change the arrays holding virtqueue and

Re: [PATCH v7 10/14] vdpa: Support reporting max device capabilities

2022-01-06 Thread Si-Wei Liu
: $ auxiliary/mlx5_core.sf.1: Missing the exact 'vdpa mgmtdev show ...' command, otherwise: Reviewed-by: Si-Wei Liu supported_classes net max_supported_vqs 257 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ \ CTRL_MAC_ADDR VERSION_1 ACCES

Re: [PATCH v7 11/14] vdpa/mlx5: Report max device capabilities

2022-01-06 Thread Si-Wei Liu
HOST_TSO6 STATUS CTRL_VQ MQ \ CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM Signed-off-by: Eli Cohen Reviewed-by: Si-Wei Liu --- v6 -> v7: 1. Add supported features drivers/vdpa/mlx5/net/mlx5_vnet.c | 35 --- 1 file changed, 23 insertions(+), 12 deleti

Re: [PATCH v7 03/14] vdpa: Sync calls set/get config/status with cf_mutex

2022-01-07 Thread Si-Wei Liu
On 1/6/2022 9:08 PM, Jason Wang wrote: 在 2022/1/7 上午8:33, Si-Wei Liu 写道: On 1/5/2022 3:46 AM, Eli Cohen wrote: Add wrappers to get/set status and protect these operations with cf_mutex to serialize these operations with respect to get/set config operations. Signed-off-by: Eli Cohen

Re: [PATCH v7 07/14] vdpa/mlx5: Support configuring max data virtqueue

2022-01-07 Thread Si-Wei Liu
On 1/6/2022 9:43 PM, Jason Wang wrote: 在 2022/1/7 上午9:50, Si-Wei Liu 写道: On 1/6/2022 5:27 PM, Si-Wei Liu wrote: On 1/5/2022 3:46 AM, Eli Cohen wrote: Check whether the max number of data virtqueue pairs was provided when a adding a new device and verify the new value does not exceed

Re: [PATCH v7 07/14] vdpa/mlx5: Support configuring max data virtqueue

2022-01-07 Thread Si-Wei Liu
It's unfortunate. Don't know why this series got pulled into linux-next prematurely. The code review is still on going and there were outstanding comments that hadn't been addressed yet. On 1/7/2022 10:01 AM, Nathan Chancellor wrote: Apologies if this reply is somewhat mangled. This patch did

Re: [PATCH] vdpa/mlx5: fix error handling in mlx5_vdpa_dev_add()

2022-01-07 Thread Si-Wei Liu
set after trying to allocate ndev->vqs,event_cbs. So move the allocation to after mvdev is set but before the arrays are used in init_mvqs() Fixes: 7620d51af29a ("vdpa/mlx5: Support configuring max data virtqueue") Signed-off-by: Tom Rix Reviewed-by: Si-Wei Liu --- drivers/vdpa/mlx5/

Re: [PATCH v7 07/14] vdpa/mlx5: Support configuring max data virtqueue

2022-01-10 Thread Si-Wei Liu
On 1/9/2022 6:10 AM, Eli Cohen wrote: On Thu, Jan 06, 2022 at 05:50:24PM -0800, Si-Wei Liu wrote: On 1/6/2022 5:27 PM, Si-Wei Liu wrote: On 1/5/2022 3:46 AM, Eli Cohen wrote: Check whether the max number of data virtqueue pairs was provided when a adding a new device and verify the new

Re: [PATCH v7 03/14] vdpa: Sync calls set/get config/status with cf_mutex

2022-01-10 Thread Si-Wei Liu
On 1/9/2022 6:09 AM, Eli Cohen wrote: On Thu, Jan 06, 2022 at 04:33:49PM -0800, Si-Wei Liu wrote: On 1/5/2022 3:46 AM, Eli Cohen wrote: Add wrappers to get/set status and protect these operations with cf_mutex to serialize these operations with respect to get/set config operations. Signed

Re: [PATCH v7 03/14] vdpa: Sync calls set/get config/status with cf_mutex

2022-01-10 Thread Si-Wei Liu
On 1/9/2022 10:05 PM, Jason Wang wrote: 在 2022/1/8 上午9:23, Si-Wei Liu 写道: On 1/6/2022 9:08 PM, Jason Wang wrote: 在 2022/1/7 上午8:33, Si-Wei Liu 写道: On 1/5/2022 3:46 AM, Eli Cohen wrote: Add wrappers to get/set status and protect these operations with cf_mutex to serialize these

Re: [PATCH v7 00/14] Allow for configuring max number of virtqueue pairs

2022-01-10 Thread Si-Wei Liu
On 1/9/2022 11:04 PM, Michael S. Tsirkin wrote: On Wed, Jan 05, 2022 at 01:46:32PM +0200, Eli Cohen wrote: Allow the user to configure the max number of virtqueue pairs for a vdpa instance. The user can then control the actual number of virtqueue pairs using ethtool. So I put a version of thi

Re: [PATCH v7 00/14] Allow for configuring max number of virtqueue pairs

2022-01-10 Thread Si-Wei Liu
On 1/9/2022 11:49 PM, Eli Cohen wrote: On Mon, Jan 10, 2022 at 02:04:32AM -0500, Michael S. Tsirkin wrote: On Wed, Jan 05, 2022 at 01:46:32PM +0200, Eli Cohen wrote: Allow the user to configure the max number of virtqueue pairs for a vdpa instance. The user can then control the actual number

Re: [PATCH v7 07/14] vdpa/mlx5: Support configuring max data virtqueue

2022-01-11 Thread Si-Wei Liu
On 1/10/2022 11:34 PM, Eli Cohen wrote: On Mon, Jan 10, 2022 at 05:00:34PM -0800, Si-Wei Liu wrote: On 1/9/2022 6:10 AM, Eli Cohen wrote: On Thu, Jan 06, 2022 at 05:50:24PM -0800, Si-Wei Liu wrote: On 1/6/2022 5:27 PM, Si-Wei Liu wrote: On 1/5/2022 3:46 AM, Eli Cohen wrote: Check whether

Re: [PATCH v7 03/14] vdpa: Sync calls set/get config/status with cf_mutex

2022-01-11 Thread Si-Wei Liu
On 1/10/2022 10:26 PM, Parav Pandit wrote: From: Jason Wang Sent: Tuesday, January 11, 2022 10:17 AM I guess in this situation it would be better defer to the future patch to add such locking or wrapper, although right now there are just two additional calls taking the lock needlessly when

Re: [PATCH v7 03/14] vdpa: Sync calls set/get config/status with cf_mutex

2022-01-11 Thread Si-Wei Liu
On 1/10/2022 8:46 PM, Jason Wang wrote: On Tue, Jan 11, 2022 at 9:30 AM Si-Wei Liu wrote: On 1/9/2022 10:05 PM, Jason Wang wrote: 在 2022/1/8 上午9:23, Si-Wei Liu 写道: On 1/6/2022 9:08 PM, Jason Wang wrote: 在 2022/1/7 上午8:33, Si-Wei Liu 写道: On 1/5/2022 3:46 AM, Eli Cohen wrote: Add

Re: [PATCH 1/4] vdpa: Protect vdpa reset with cf_mutex

2022-01-11 Thread Si-Wei Liu
r in a same series. Reviewed-by: Si-Wei Liu u8 status, status_old; int ret, nvqs = v->nvqs; u16 i; @@ -177,7 +176,7 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp) vhost_vdpa_unsetup_vq_irq(v, i); if (st

Re: [PATCH 2/4] vdpa/mlx5: Fix is_index_valid() to refer to features

2022-01-11 Thread Si-Wei Liu
On 1/10/2022 11:22 PM, Eli Cohen wrote: Make sure the decision whether an index received trough a callback is valid or not consults the negotiated features. Signed-off-by: Eli Cohen Reviewed-by: Si-Wei Liu Is there more for this series? Subject says there're 4 patches in

Re: [PATCH 1/4] vdpa: Avoid taking cf_mutex lock on get status

2022-01-11 Thread Si-Wei Liu
Reviewed-by: Si-Wei Liu --- drivers/vdpa/vdpa.c | 11 --- drivers/vhost/vdpa.c | 5 +++-- include/linux/vdpa.h | 1 - 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index 4380367d00b5..9846c9de4bfa 100644 --- a/drivers/v

Re: [PATCH 2/4] vdpa: Protect vdpa reset with cf_mutex

2022-01-11 Thread Si-Wei Liu
cf_mutex, a netlink thread calling vdpa_dev_config_fill could get passed the VIRTIO_CONFIG_S_FEATURES_OK check in vdpa_dev_config_fill() and end up reporting wrong features. Fixes: 5f6e85953d8f ("vdpa: Read device configuration only if FEATURES_OK") Signed-off-by: Eli Cohen Reviewed-

Re: [PATCH 3/4] vdpa/mlx5: Fix is_index_valid() to refer to features

2022-01-11 Thread Si-Wei Liu
already clear, I got get_vq_state() call which caused out array bounds access since is_index_valid() reported the index value. So this is more of not hit a bug since the call shouldn't have been made first place. Signed-off-by: Eli Cohen Reviewed-by: Si-Wei Liu --- drivers/vdpa/mlx

Re: [PATCH 4/4] vdpa/mlx5: Fix tracking of current number of VQs

2022-01-11 Thread Si-Wei Liu
his patch, but there should've been validation done in the upper layer to guarantee set_featuers() for VIRTIO_NET_F_MQ always comes with VIRTIO_NET_F_CTRL_VQ. Maybe checking both: BIT_ULL(VIRTIO_NET_F_MQ) |  BIT_ULL(VIRTIO_NET_F_CTRL_VQ)? otherwise it looks good to me. Revie

Re: [PATCH v7 07/14] vdpa/mlx5: Support configuring max data virtqueue

2022-01-11 Thread Si-Wei Liu
On 1/11/2022 7:21 AM, Eli Cohen wrote: On Tue, Jan 11, 2022 at 12:52:29AM -0800, Si-Wei Liu wrote: On 1/10/2022 11:34 PM, Eli Cohen wrote: On Mon, Jan 10, 2022 at 05:00:34PM -0800, Si-Wei Liu wrote: On 1/9/2022 6:10 AM, Eli Cohen wrote: On Thu, Jan 06, 2022 at 05:50:24PM -0800, Si-Wei Liu

Re: [PATCH 4/4] vdpa/mlx5: Fix tracking of current number of VQs

2022-01-11 Thread Si-Wei Liu
On 1/11/2022 6:29 PM, Jason Wang wrote: On Wed, Jan 12, 2022 at 6:15 AM Si-Wei Liu wrote: On 1/11/2022 10:34 AM, Eli Cohen wrote: Modify the code such that ndev->cur_num_vqs better reflects the actual number of data virtqueues. The value can be accurately realized after features h

Re: [PATCH 4/4] vdpa/mlx5: Fix tracking of current number of VQs

2022-01-11 Thread Si-Wei Liu
On 1/11/2022 10:37 PM, Eli Cohen wrote: On Tue, Jan 11, 2022 at 02:14:47PM -0800, Si-Wei Liu wrote: On 1/11/2022 10:34 AM, Eli Cohen wrote: Modify the code such that ndev->cur_num_vqs better reflects the actual number of data virtqueues. The value can be accurately realized after featu

[PATCH 0/3] fixes for mlx5_vdpa multiqueue support

2022-01-12 Thread Si-Wei Liu
This patchset contains the fixes for a few issues uncovered during the review for the "Allow for configuring max number of virtqueue pairs" series. It is based on Eli's fixes: 2e4cda633a22 ("vdpa/mlx5: Fix tracking of current number of VQs") in the vhost tree. Si-Wei Li

[PATCH 3/3] vdpa/mlx5: validate the queue pair value from driver

2022-01-12 Thread Si-Wei Liu
Fixes: 52893733f2c5 ("vdpa/mlx5: Add multiqueue support") Signed-off-by: Si-Wei Liu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 46d4deb..491127f 10

<    1   2   3   4   5   >