Re: [RFC v1 0/8] vhost-vdpa: add support for iommufd

2023-11-06 Thread Michael S. Tsirkin
On Sat, Nov 04, 2023 at 01:16:33AM +0800, Cindy Lu wrote: > > Hi All > This code provides the iommufd support for vdpa device > This code fixes the bugs from the last version and also add the asid support. > rebase on kernel > v6,6-rc3 > Test passed in the physical device (vp_vdpa), but there ar

[PATCH net-next v2 21/21] virtio_net: xdp_features add NETDEV_XDP_ACT_XSK_ZEROCOPY

2023-11-06 Thread Xuan Zhuo
Now, we supported AF_XDP(xsk). Add NETDEV_XDP_ACT_XSK_ZEROCOPY to xdp_features. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/main.c index 42c7dbf53e63..2c14f0c84e56 1006

[PATCH net-next v2 17/21] virtio_net: xsk: rx: skip dma unmap when rq is bind with AF_XDP

2023-11-06 Thread Xuan Zhuo
When rq is bound with AF_XDP, the buffer dma is managed by the AF_XDP APIs. So the buffer got from the virtio core should skip the dma unmap operation. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 8 +--- drivers/net/virtio/virtio_net.h | 3 +++ drivers/net/virtio/xsk.c

[PATCH net-next v2 20/21] virtio_net: update tx timeout record

2023-11-06 Thread Xuan Zhuo
If send queue sent some packets, we update the tx timeout record to prevent the tx timeout. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio/xsk.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/virtio/xsk.c b/drivers/net/virtio/xsk.c index 5c7eb1

[PATCH net-next v2 18/21] virtio_net: xsk: rx: introduce receive_xsk() to recv xsk buffer

2023-11-06 Thread Xuan Zhuo
The virtnet_xdp_handler() is re-used. But 1. We need to copy data to create skb for XDP_PASS. 2. We need to call xsk_buff_free() to release the buffer. 3. The handle for xdp_buff is difference. If we pushed this logic into existing receive handle(merge and small), we would have to maintain code s

[PATCH net-next v2 14/21] virtio_net: xsk: tx: virtnet_free_old_xmit() distinguishes xsk buffer

2023-11-06 Thread Xuan Zhuo
virtnet_free_old_xmit distinguishes three type ptr(skb, xdp frame, xsk buffer) by the last bits of the pointer. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/virtio_net.h | 18 -- drivers/net/virtio/xsk.h| 5 + 2 files changed, 21 insertions(+), 2 deletions(-) dif

[PATCH net-next v2 16/21] virtio_net: xsk: rx: introduce add_recvbuf_xsk()

2023-11-06 Thread Xuan Zhuo
Implement the logic of filling rq with XSK buffers. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 4 ++- drivers/net/virtio/virtio_net.h | 5 drivers/net/virtio/xsk.c| 49 - drivers/net/virtio/xsk.h| 2 ++ 4 files changed,

[PATCH net-next v2 19/21] virtio_net: xsk: rx: virtnet_rq_free_unused_buf() check xsk buffer

2023-11-06 Thread Xuan Zhuo
Since this will be called in other circumstances(freeze), we must check whether it is xsk's buffer in this function. It cannot be judged outside this function. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/net/virtio/ma

[PATCH net-next v2 15/21] virtio_net: xsk: tx: virtnet_sq_free_unused_buf() check xsk buffer

2023-11-06 Thread Xuan Zhuo
virtnet_sq_free_unused_buf() check xsk buffer. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio/main.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/main.c index 6a5e74c482f3..6210a6e37396 100644 ---

[PATCH net-next v2 13/21] virtio_net: xsk: tx: support wakeup

2023-11-06 Thread Xuan Zhuo
xsk wakeup is used to trigger the logic for xsk xmit by xsk framework or user. Virtio-net does not support to actively generate an interruption, so it tries to trigger tx NAPI on the local cpu. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 20 ++-- drivers/net/v

[PATCH net-next v2 09/21] virtio_net: xsk: bind/unbind xsk

2023-11-06 Thread Xuan Zhuo
This patch implement the logic of bind/unbind xsk pool to sq and rq. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/Makefile | 2 +- drivers/net/virtio/main.c | 11 +- drivers/net/virtio/virtio_net.h | 16 +++ drivers/net/virtio/xsk.c| 187

[PATCH net-next v2 12/21] virtio_net: xsk: tx: support tx

2023-11-06 Thread Xuan Zhuo
The driver's tx napi is very important for XSK. It is responsible for obtaining data from the XSK queue and sending it out. At the beginning, we need to trigger tx napi. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 12 +++- drivers/net/virtio/virtio_net.h | 3 +- drivers/ne

[PATCH net-next v2 10/21] virtio_net: xsk: prevent disable tx napi

2023-11-06 Thread Xuan Zhuo
Since xsk's TX queue is consumed by TX NAPI, if sq is bound to xsk, then we must stop tx napi from being disabled. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio/main.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/main.c

[PATCH net-next v2 07/21] virtio_net: separate virtnet_tx_resize()

2023-11-06 Thread Xuan Zhuo
This patch separates two sub-functions from virtnet_tx_resize(): * virtnet_tx_pause * virtnet_tx_resume Then the subsequent virtnet_tx_reset() can share these two functions. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio/main.c | 35 +++-

[PATCH net-next v2 05/21] virtio_net: add prefix virtnet to all struct inside virtio_net.h

2023-11-06 Thread Xuan Zhuo
We move some structures to the header file, but these structures do not prefixed with virtnet. This patch adds virtnet for these. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 100 drivers/net/virtio/virtio_net.h | 12 ++-- 2 files changed, 56 i

[PATCH net-next v2 01/21] virtio_net: rename free_old_xmit_skbs to free_old_xmit

2023-11-06 Thread Xuan Zhuo
Since free_old_xmit_skbs not only deals with skb, but also xdp frame and subsequent added xsk, so change the name of this function to free_old_xmit. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff

[PATCH net-next v2 02/21] virtio_net: unify the code for recycling the xmit ptr

2023-11-06 Thread Xuan Zhuo
There are two completely similar and independent implementations. This is inconvenient for the subsequent addition of new types. So extract a function from this piece of code and call this function uniformly to recover old xmit ptr. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/

[PATCH net-next v2 11/21] virtio_net: move some api to header

2023-11-06 Thread Xuan Zhuo
__free_old_xmit is_xdp_raw_buffer_queue These two APIs are needed by the xsk part. So this commit move theses to the header. And add prefix "virtnet_". Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 94 +++-- drivers/net/virtio/virtio_net.h | 80 +

[PATCH net-next v2 04/21] virtio_net: move core structures to virtio_net.h

2023-11-06 Thread Xuan Zhuo
Move some core structures (send_queue, receive_queue, virtnet_info) definitions and the relative structures definitions into the virtio_net.h file. That will be used by the other c code files. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 189 +-- dr

[PATCH net-next v2 08/21] virtio_net: sq support premapped mode

2023-11-06 Thread Xuan Zhuo
If the xsk is enabling, the xsk tx will share the send queue. But the xsk requires that the send queue use the premapped mode. So the send queue must support premapped mode. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 163 drivers/net/virtio/vi

[PATCH net-next v2 03/21] virtio_net: independent directory

2023-11-06 Thread Xuan Zhuo
Create a separate directory for virtio-net. AF_XDP support will be added later, then a separate xsk.c file will be added, so we should create a directory for virtio-net. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- MAINTAINERS | 2 +- drivers/net/Kconfig

[PATCH net-next v2 06/21] virtio_net: separate virtnet_rx_resize()

2023-11-06 Thread Xuan Zhuo
This patch separates two sub-functions from virtnet_rx_resize(): * virtnet_rx_pause * virtnet_rx_resume Then the subsequent reset rx for xsk can share these two functions. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio/main.c | 29 + dri

[PATCH net-next v2 00/21] virtio-net: support AF_XDP zero copy

2023-11-06 Thread Xuan Zhuo
## AF_XDP XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero copy feature of xsk (XDP socket) needs to be supported by the driver. The performance of zero copy is very good. mlx5 and intel ixgbe already support this feature, This patch set allows virtio-net to support xsk

Re: [RFC PATCH 2/5] iommu/vt-d: Add generic IO page table support

2023-11-06 Thread Jason Gunthorpe
On Mon, Nov 06, 2023 at 02:12:23AM -0500, Tina Zhang wrote: > Add basic hook up code to implement generic IO page table framework. > > Signed-off-by: Tina Zhang > --- > drivers/iommu/intel/Kconfig | 1 + > drivers/iommu/intel/iommu.c | 94 + > drivers/iommu/i

Re: [PATCH RFC 10/17] acpi: Do not use dev->iommu within acpi_iommu_configure()

2023-11-06 Thread Rafael J. Wysocki
On Fri, Nov 3, 2023 at 5:45 PM Jason Gunthorpe wrote: > > This call chain is using dev->iommu->fwspec to pass around the fwspec > between the three parts (acpi_iommu_configure(), acpi_iommu_fwspec_init(), > iommu_probe_device()). > > However there is no locking around the accesses to dev->iommu, s

Re: [PATCH RFC 04/17] acpi: Do not return struct iommu_ops from acpi_iommu_configure_id()

2023-11-06 Thread Rafael J. Wysocki
On Fri, Nov 3, 2023 at 5:45 PM Jason Gunthorpe wrote: > > Nothing needs this pointer. Return a normal error code with the usual > IOMMU semantic that ENODEV means 'there is no IOMMU driver'. > > Signed-off-by: Jason Gunthorpe Acked-by: Rafael J. Wysocki > --- > drivers/acpi/scan.c | 24 ++

Re: [PATCH] crypto: virtio-crypto: call finalize with bh disabled

2023-11-06 Thread Herbert Xu
On Thu, Nov 02, 2023 at 01:01:09PM +, Gonglei (Arei) wrote: > > > So I think the core of this question is: Can we call > > crypto_finalize_request() in > > the upper half of the interrupt? The finalize path originates from the network stack. So the conditions are the same as that of the netw

Re: [PATCH net 0/4] vsock: fix server prevents clients from reconnecting

2023-11-06 Thread Stefano Garzarella
On Fri, Nov 03, 2023 at 06:55:47PM +0100, f.storniol...@gmail.com wrote: From: Filippo Storniolo This patch series introduce fix and tests for the following vsock bug: If the same remote peer, using the same port, tries to connect to a server on a listening port more than once, the server will

Re: [PATCH net 4/4] test/vsock: add dobule bind connect test

2023-11-06 Thread Stefano Garzarella
On Fri, Nov 03, 2023 at 06:55:51PM +0100, f.storniol...@gmail.com wrote: From: Filippo Storniolo This add bind connect test which creates a listening server socket and tries to connect a client with a bound local port to it twice. Co-developed-by: Luigi Leonardi Signed-off-by: Luigi Leonardi

Re: [PATCH net 3/4] test/vsock: refactor vsock_accept

2023-11-06 Thread Stefano Garzarella
On Fri, Nov 03, 2023 at 06:55:50PM +0100, f.storniol...@gmail.com wrote: From: Filippo Storniolo This is a preliminary patch to introduce SOCK_STREAM bind connect test. vsock_accept() is split into vsock_listen() and vsock_accept(). Co-developed-by: Luigi Leonardi Signed-off-by: Luigi Leonard

Re: [PATCH net 2/4] test/vsock fix: add missing check on socket creation

2023-11-06 Thread Stefano Garzarella
On Fri, Nov 03, 2023 at 06:55:49PM +0100, f.storniol...@gmail.com wrote: From: Filippo Storniolo Add check on socket() return value in vsock_listen() and vsock_connect() Co-developed-by: Luigi Leonardi Signed-off-by: Luigi Leonardi Signed-off-by: Filippo Storniolo --- tools/testing/vsock/ut

Re: [PATCH net 1/4] vsock/virtio: remove socket from connected/bound list on shutdown

2023-11-06 Thread Stefano Garzarella
On Fri, Nov 03, 2023 at 06:55:48PM +0100, f.storniol...@gmail.com wrote: From: Filippo Storniolo If the same remote peer, using the same port, tries to connect to a server on a listening port more than once, the server will reject the connection, causing a "connection reset by peer" error on th

Re: [PATCH net v2] virtio/vsock: Fix uninit-value in virtio_transport_recv_pkt()

2023-11-06 Thread Stefano Garzarella
On Sun, Nov 05, 2023 at 12:05:31AM +0900, Shigeru Yoshida wrote: KMSAN reported the following uninit-value access issue: = BUG: KMSAN: uninit-value in virtio_transport_recv_pkt+0x1dfb/0x26a0 net/vmw_vsock/virtio_transport_common.c:1421 virtio_

[PATCH net] virtio_net: fix missing dma unmap for resize

2023-11-06 Thread Xuan Zhuo
For rq, we have three cases getting buffers from virtio core: 1. virtqueue_get_buf{,_ctx} 2. virtqueue_detach_unused_buf 3. callback for virtqueue_resize But in commit 295525e29a5b("virtio_net: merge dma operations when filling mergeable buffers"), I missed the dma unmap for the #3 case. That wi