[PATCH net v2 1/2] virtio-net: fix for unable to handle page fault for address

2021-05-31 Thread Xuan Zhuo
In merge mode, when xdp is enabled, if the headroom of buf is smaller than virtnet_get_headroom(), xdp_linearize_page() will be called but the variable of "headroom" is still 0, which leads to wrong logic after entering page_to_skb(). [ 16.600944] BUG: unable to handle page fault for address: ff

[PATCH net v2 2/2] virtio_net: get build_skb() buf by data ptr

2021-05-31 Thread Xuan Zhuo
In the case of merge, the page passed into page_to_skb() may be a head page, not the page where the current data is located. So when trying to get the buf where the data is located, we should get buf based on headroom instead of offset. This patch solves this problem. But if you don't use this pat

[PATCH net v2 0/2] virtio-net: fix for build_skb()

2021-05-31 Thread Xuan Zhuo
#1 Fixed a serious error. #2 Fixed a logical error, but this error did not cause any serious consequences. The logic of this piece is really messy. Fortunately, my refactored patch can be completed with a small amount of testing. Thanks. Xuan Zhuo (2): virtio-net: fix for unable to handle page

Re: [PATCH net 2/2] virtio-net: get build_skb() buf by data ptr

2021-05-31 Thread Xuan Zhuo
On Tue, 1 Jun 2021 14:17:27 +0800, Jason Wang wrote: > > 在 2021/6/1 下午1:59, Xuan Zhuo 写道: > > On Tue, 1 Jun 2021 11:27:12 +0800, Jason Wang wrote: > >> 在 2021/6/1 上午11:08, Xuan Zhuo 写道: > >>> On Tue, 1 Jun 2021 11:03:37 +0800, Jason Wang wrote: > 在 2021/5/31 下午6:58, Xuan Zhuo 写道: > > On

Re: [PATCH net 2/2] virtio-net: get build_skb() buf by data ptr

2021-05-31 Thread Jason Wang
在 2021/6/1 下午1:59, Xuan Zhuo 写道: On Tue, 1 Jun 2021 11:27:12 +0800, Jason Wang wrote: 在 2021/6/1 上午11:08, Xuan Zhuo 写道: On Tue, 1 Jun 2021 11:03:37 +0800, Jason Wang wrote: 在 2021/5/31 下午6:58, Xuan Zhuo 写道: On Mon, 31 May 2021 14:10:55 +0800, Jason Wang wrote: 在 2021/5/14 下午11:16, Xuan Z

Re: [PATCH net 2/2] virtio-net: get build_skb() buf by data ptr

2021-05-31 Thread Xuan Zhuo
On Tue, 1 Jun 2021 11:27:12 +0800, Jason Wang wrote: > > 在 2021/6/1 上午11:08, Xuan Zhuo 写道: > > On Tue, 1 Jun 2021 11:03:37 +0800, Jason Wang wrote: > >> 在 2021/5/31 下午6:58, Xuan Zhuo 写道: > >>> On Mon, 31 May 2021 14:10:55 +0800, Jason Wang > >>> wrote: > 在 2021/5/14 下午11:16, Xuan Zhuo 写道:

Re: [PATCH 3/3] virtio/vdpa: Clear the available index during probe

2021-05-31 Thread Jason Wang
在 2021/6/1 上午10:20, Jason Wang 写道: 在 2021/6/1 上午12:05, Eli Cohen 写道: Clear the available index as part of the initialization process to clear and values that might be left from previous usage of the device. For example, if the device was previously used by vhost_vdpa and now probed by vhost_vd

Re: [PATCH 2/3] vdpa/mlx5: Only return vq ready if vq is initialized

2021-05-31 Thread Jason Wang
在 2021/6/1 下午12:13, Eli Cohen 写道: On Tue, Jun 01, 2021 at 10:18:04AM +0800, Jason Wang wrote: 在 2021/6/1 上午12:04, Eli Cohen 写道: Only return the value of the ready field if the VQ is initialized in which case the value of the field is valid. Failing to do so can result in virtio_vdpa failing t

Re: [PATCH v1] vdpa/mlx5: Add support for running with virtio_vdpa

2021-05-31 Thread Jason Wang
在 2021/6/1 上午11:40, Eli Cohen 写道: On Tue, Jun 01, 2021 at 10:09:45AM +0800, Jason Wang wrote: 在 2021/6/1 上午12:04, Eli Cohen 写道: In order to support running vdpa using vritio_vdpa driver, we need to create a different kind of MR, one that has 1:1 mapping, since the addresses referring to virtq

Re: [PATCH V2 RESEND 2/2] vDPA/ifcvf: implement doorbell mapping for ifcvf

2021-05-31 Thread Jason Wang
在 2021/6/1 上午11:27, Zhu, Lingshan 写道: On 5/31/2021 3:56 PM, Jason Wang wrote: 在 2021/5/31 下午3:33, Zhu Lingshan 写道: This commit implements doorbell mapping feature for ifcvf. This feature maps the notify page to userspace, to eliminate vmexit when kick a vq. Signed-off-by: Zhu Lingshan ---

Re: [PATCH net 2/2] virtio-net: get build_skb() buf by data ptr

2021-05-31 Thread Jason Wang
在 2021/6/1 上午11:08, Xuan Zhuo 写道: On Tue, 1 Jun 2021 11:03:37 +0800, Jason Wang wrote: 在 2021/5/31 下午6:58, Xuan Zhuo 写道: On Mon, 31 May 2021 14:10:55 +0800, Jason Wang wrote: 在 2021/5/14 下午11:16, Xuan Zhuo 写道: In the case of merge, the page passed into page_to_skb() may be a head page, not

Re: [PATCH net 2/2] virtio-net: get build_skb() buf by data ptr

2021-05-31 Thread Xuan Zhuo
On Tue, 1 Jun 2021 11:03:37 +0800, Jason Wang wrote: > > 在 2021/5/31 下午6:58, Xuan Zhuo 写道: > > On Mon, 31 May 2021 14:10:55 +0800, Jason Wang wrote: > >> 在 2021/5/14 下午11:16, Xuan Zhuo 写道: > >>> In the case of merge, the page passed into page_to_skb() may be a head > >>> page, not the page where

Re: [PATCH net 2/2] virtio-net: get build_skb() buf by data ptr

2021-05-31 Thread Jason Wang
在 2021/5/31 下午6:58, Xuan Zhuo 写道: On Mon, 31 May 2021 14:10:55 +0800, Jason Wang wrote: 在 2021/5/14 下午11:16, Xuan Zhuo 写道: In the case of merge, the page passed into page_to_skb() may be a head page, not the page where the current data is located. I don't get how this can happen? Maybe you

Re: [PATCH v3 0/4] virtio net: spurious interrupt related fixes

2021-05-31 Thread Willem de Bruijn
On Wed, May 26, 2021 at 11:34 AM Willem de Bruijn wrote: > > On Wed, May 26, 2021 at 4:24 AM Michael S. Tsirkin wrote: > > > > > > With the implementation of napi-tx in virtio driver, we clean tx > > descriptors from rx napi handler, for the purpose of reducing tx > > complete interrupts. But thi

Re: [PATCH 3/3] virtio/vdpa: Clear the available index during probe

2021-05-31 Thread Jason Wang
在 2021/6/1 上午12:05, Eli Cohen 写道: Clear the available index as part of the initialization process to clear and values that might be left from previous usage of the device. For example, if the device was previously used by vhost_vdpa and now probed by vhost_vdpa, you want to start with indices.

Re: [PATCH 2/3] vdpa/mlx5: Only return vq ready if vq is initialized

2021-05-31 Thread Jason Wang
在 2021/6/1 上午12:04, Eli Cohen 写道: Only return the value of the ready field if the VQ is initialized in which case the value of the field is valid. Failing to do so can result in virtio_vdpa failing to load if the device was previously used by vhost_vdpa and the old values are ready. virtio_vdpa

Re: [PATCH v1] vdpa/mlx5: Add support for running with virtio_vdpa

2021-05-31 Thread Jason Wang
在 2021/6/1 上午12:04, Eli Cohen 写道: In order to support running vdpa using vritio_vdpa driver, we need to create a different kind of MR, one that has 1:1 mapping, since the addresses referring to virtqueues are dma addresses. We create the 1:1 MR in mlx5_vdpa_dev_add() only in case firmware supp

Re: [PATCH v1 1/2] vdpa/mlx5: Support creating resources with uid == 0

2021-05-31 Thread Jason Wang
在 2021/6/1 上午12:04, Eli Cohen 写道: Currently all resources must be created with uid != 0 which is essential when userspace processes are allocating virtquueue resources. Since this is a kernel implementation, it is perfectly legal to open resources with uid == 0. In case firmware supports, avoid

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

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

Re: [PATCH v1 1/2] vdpa/mlx5: Support creating resources with uid == 0

2021-05-31 Thread Michael S. Tsirkin
On Mon, May 31, 2021 at 07:04:04PM +0300, Eli Cohen wrote: > Currently all resources must be created with uid != 0 which is essential > when userspace processes are allocating virtquueue resources. Since this > is a kernel implementation, it is perfectly legal to open resources with > uid == 0. >

Re: [PATCH v1] vdpa/mlx5: Add support for running with virtio_vdpa

2021-05-31 Thread kernel test robot
Hi Eli, Thank you for the patch! Yet something to improve: [auto build test ERROR on v5.13-rc3] [cannot apply to linus/master v5.13-rc4 next-20210528] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in htt

[PATCH 5.12 121/296] {net, vdpa}/mlx5: Configure interface MAC into mpfs L2 table

2021-05-31 Thread Greg Kroah-Hartman
From: Eli Cohen commit 7c9f131f366ab414691907fa0407124ea2b2f3bc upstream. net/mlx5: Expose MPFS configuration API MPFS is the multi physical function switch that bridges traffic between the physical port and any physical functions associated with it. The driver is required to add or remove MAC

[PATCH 5.10 100/252] {net, vdpa}/mlx5: Configure interface MAC into mpfs L2 table

2021-05-31 Thread Greg Kroah-Hartman
From: Eli Cohen commit 7c9f131f366ab414691907fa0407124ea2b2f3bc upstream. net/mlx5: Expose MPFS configuration API MPFS is the multi physical function switch that bridges traffic between the physical port and any physical functions associated with it. The driver is required to add or remove MAC

Re: [PATCH net 2/2] virtio-net: get build_skb() buf by data ptr

2021-05-31 Thread Xuan Zhuo
On Mon, 31 May 2021 14:10:55 +0800, Jason Wang wrote: > > 在 2021/5/14 下午11:16, Xuan Zhuo 写道: > > In the case of merge, the page passed into page_to_skb() may be a head > > page, not the page where the current data is located. > > > I don't get how this can happen? > > Maybe you can explain a littl

Re: [PATCH net 1/2] virtio-net: fix for unable to handle page fault for address

2021-05-31 Thread Xuan Zhuo
On Mon, 31 May 2021 11:50:00 +0800, Jason Wang wrote: > > 在 2021/5/14 下午11:16, Xuan Zhuo 写道: > > In merge mode, when xdp is enabled, if the headroom of buf is smaller > > than virtnet_get_headroom(), xdp_linearize_page() will be called but the > > variable of "headroom" is still 0, which leads to

Re: [PATCH RESEND 1/2] virtio: update virtio id table, add transitional ids

2021-05-31 Thread Michael S. Tsirkin
On Mon, May 31, 2021 at 05:57:47PM +0800, Zhu, Lingshan wrote: > > > On 5/31/2021 3:58 PM, Cornelia Huck wrote: > > On Mon, 31 May 2021 15:27:42 +0800 > > Zhu Lingshan wrote: > > > > > This commit updates virtio id table by adding transitional device > > > ids > > > virtio_pci_common.h > > > Si

Re: [RFC v3 21/29] vhost: Add VhostIOVATree

2021-05-31 Thread Jason Wang
在 2021/5/20 上午12:28, Eugenio Pérez 写道: This tree is able to look for a translated address from a 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 v3 15/29] vhost: Add enable_custom_iommu to VhostOps

2021-05-31 Thread Jason Wang
在 2021/5/20 上午12:28, Eugenio Pérez 写道: This operation enable the backend-specific IOTLB entries. If a backend support this, it start managing its own entries, and vhost can disable it through this operation and recover control. Every enable/disable operation must also clear all IOTLB device en

Re: [PATCH v1] vdpa/mlx5: Fix possible failure in umem size calculation

2021-05-31 Thread Jason Wang
在 2021/5/30 下午5:03, Eli Cohen 写道: umem size is a 32 bit unsigned value so assigning it to an int could cause false failures. Set the calculated value inside the function and modify function name to reflect the fact it updates the size. This bug was found during code review but never had real im

Re: [PATCH v2] vdpa/mlx5: Fix umem sizes assignments on VQ create

2021-05-31 Thread Jason Wang
在 2021/5/30 下午5:03, Eli Cohen 写道: Fix copy paste bug assigning umem1 size to umem2 and umem3. The issue was discovered when trying to use a 1:1 MR that covers the entire address space where firmware complained that provided sizes are not large enough. 1:1 MRs are required to support virtio_vdpa.

Re: [PATCH RESEND 1/2] virtio: update virtio id table, add transitional ids

2021-05-31 Thread Cornelia Huck
On Mon, 31 May 2021 15:27:42 +0800 Zhu Lingshan wrote: > This commit updates virtio id table by adding transitional device > ids > > Signed-off-by: Zhu Lingshan > --- > include/uapi/linux/virtio_ids.h | 12 > 1 file changed, 12 insertions(+) > > diff --git a/include/uapi/linux/vi

Re: [PATCH V2 RESEND 2/2] vDPA/ifcvf: implement doorbell mapping for ifcvf

2021-05-31 Thread Jason Wang
在 2021/5/31 下午3:33, Zhu Lingshan 写道: This commit implements doorbell mapping feature for ifcvf. This feature maps the notify page to userspace, to eliminate vmexit when kick a vq. Signed-off-by: Zhu Lingshan --- drivers/vdpa/ifcvf/ifcvf_main.c | 17 + 1 file changed, 17 inse

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

2021-05-31 Thread Jason Wang
在 2021/5/31 下午3:19, Yongji Xie 写道: On Mon, May 31, 2021 at 2:49 PM Jason Wang wrote: 在 2021/5/28 下午8:11, Xie Yongji 写道: This adds validation for used length (might come from an untrusted device) to avoid data corruption or loss. Signed-off-by: Xie Yongji --- drivers/net/virtio_net.c | 2