Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Yishai Hadas via Virtualization
On 10/10/2023 23:42, Michael S. Tsirkin wrote: On Tue, Oct 10, 2023 at 07:09:08PM +0300, Yishai Hadas wrote: Assuming that we'll put each command inside virtio as the generic layer, we won't be able to call/use this API internally to get the PF as of cyclic dependencies between the modules, link

RE: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Parav Pandit via Virtualization
Hi Christoph, > From: Christoph Hellwig > Sent: Wednesday, October 11, 2023 12:29 PM > > On Wed, Oct 11, 2023 at 02:43:37AM -0400, Michael S. Tsirkin wrote: > > > Btw, what is that intel thing everyone is talking about? And why > > > would the virtio core support vendor specific behavior like t

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Michael S. Tsirkin
On Wed, Oct 11, 2023 at 10:44:49AM +0300, Yishai Hadas wrote: > On 10/10/2023 23:42, Michael S. Tsirkin wrote: > > On Tue, Oct 10, 2023 at 07:09:08PM +0300, Yishai Hadas wrote: > > > > > Assuming that we'll put each command inside virtio as the generic > > > > > layer, we > > > > > won't be able t

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Michael S. Tsirkin
On Wed, Oct 11, 2023 at 08:00:57AM +, Parav Pandit wrote: > Hi Christoph, > > > From: Christoph Hellwig > > Sent: Wednesday, October 11, 2023 12:29 PM > > > > On Wed, Oct 11, 2023 at 02:43:37AM -0400, Michael S. Tsirkin wrote: > > > > Btw, what is that intel thing everyone is talking about?

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Michael S. Tsirkin
On Tue, Oct 10, 2023 at 11:59:26PM -0700, Christoph Hellwig wrote: > On Wed, Oct 11, 2023 at 02:43:37AM -0400, Michael S. Tsirkin wrote: > > > Btw, what is that intel thing everyone is talking about? And why > > > would the virtio core support vendor specific behavior like that? > > > > It's not

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Yishai Hadas via Virtualization
On 11/10/2023 11:02, Michael S. Tsirkin wrote: On Wed, Oct 11, 2023 at 10:44:49AM +0300, Yishai Hadas wrote: On 10/10/2023 23:42, Michael S. Tsirkin wrote: On Tue, Oct 10, 2023 at 07:09:08PM +0300, Yishai Hadas wrote: Assuming that we'll put each command inside virtio as the generic layer, we

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Michael S. Tsirkin
On Wed, Oct 11, 2023 at 11:58:11AM +0300, Yishai Hadas wrote: > On 11/10/2023 11:02, Michael S. Tsirkin wrote: > > On Wed, Oct 11, 2023 at 10:44:49AM +0300, Yishai Hadas wrote: > > > On 10/10/2023 23:42, Michael S. Tsirkin wrote: > > > > On Tue, Oct 10, 2023 at 07:09:08PM +0300, Yishai Hadas wrote:

[PATCH vhost 00/22] virtio-net: support AF_XDP zero copy

2023-10-11 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

[PATCH vhost 01/22] virtio_ring: virtqueue_set_dma_premapped support disable

2023-10-11 Thread Xuan Zhuo
virtqueue_set_dma_premapped() adds a new parameter to disable the virtqueue premapped mode. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 2 +- drivers/virtio/virtio_ring.c | 11 --- include/linux/virtio.h | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) d

[PATCH vhost 02/22] virtio_ring: introduce virtqueue_dma_[un]map_page_attrs

2023-10-11 Thread Xuan Zhuo
Introduce virtqueue_dma_[un]map_page_attrs() to do dma/unmap for pages. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 52 include/linux/virtio.h | 7 + 2 files changed, 59 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/dri

[PATCH vhost 03/22] virtio_net: rename free_old_xmit_skbs to free_old_xmit

2023-10-11 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 --- drivers/net/virtio_net.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/vi

[PATCH vhost 04/22] virtio_net: unify the code for recycling the xmit ptr

2023-10-11 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 --- drivers/net/virtio_net.c | 76

[PATCH vhost 05/22] virtio_net: independent directory

2023-10-11 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 --- MAINTAINERS | 2 +- drivers/net/Kconfig

[PATCH vhost 07/22] virtio_net: add prefix virtnet to all struct/api inside virtio_net.h

2023-10-11 Thread Xuan Zhuo
We move some structures and APIs to the header file, but these structures and APIs do not prefixed with virtnet. This patch adds virtnet for these. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 122 drivers/net/virtio/virtio_net.h | 30

[PATCH vhost 06/22] virtio_net: move to virtio_net.h

2023-10-11 Thread Xuan Zhuo
Move some structure definitions and inline functions into the virtio_net.h file. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 252 +-- drivers/net/virtio/virtio_net.h | 256 2 files changed, 258 insertions(+), 250 del

[PATCH vhost 08/22] virtio_net: virtnet_poll_tx support rescheduled

2023-10-11 Thread Xuan Zhuo
virtnet_poll_tx() support to return budget when busy to be rescheduled. When retval < budget, napi_poll() in dev.c will exit directly. And virtqueue_napi_complete() will be called to close napi. When retval == budget, the napi_poll() in dev.c will re-add napi to the queue. The purpose of this pa

[PATCH vhost 10/22] virtio_net: separate virtnet_tx_resize()

2023-10-11 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 --- drivers/net/virtio/main.c | 35 +++-- drivers/net/virtio/

[PATCH vhost 12/22] virtio_net: xsk: bind/unbind xsk

2023-10-11 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 | 10 +- drivers/net/virtio/virtio_net.h | 18 drivers/net/virtio/xsk.c| 186

[PATCH vhost 09/22] virtio_net: separate virtnet_rx_resize()

2023-10-11 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 --- drivers/net/virtio/main.c | 29 + drivers/net/virtio/virtio

[PATCH vhost 13/22] virtio_net: xsk: prevent disable tx napi

2023-10-11 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 --- drivers/net/virtio/main.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/m

[PATCH vhost 11/22] virtio_net: sq support premapped mode

2023-10-11 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 | 98 - drivers/net/virtio/vi

[PATCH vhost 20/22] virtio_net: xsk: rx: virtnet_rq_free_unused_buf() check xsk buffer

2023-10-11 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 | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/net/vi

[PATCH vhost 21/22] virtio_net: update tx timeout record

2023-10-11 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 --- 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 7abd46bb0e3d..e605f860edb6 1

[PATCH vhost 22/22] virtio_net: xdp_features add NETDEV_XDP_ACT_XSK_ZEROCOPY

2023-10-11 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 60b5bd21fcc6..a9852e9ff598 1006

[PATCH vhost 14/22] virtio_net: xsk: tx: support tx

2023-10-11 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 vhost 19/22] virtio_net: xsk: rx: introduce receive_xsk() to recv xsk buffer

2023-10-11 Thread Xuan Zhuo
Implementing the logic of xsk rx. If this packet is not for XSK determined in XDP, then we need to copy once to generate a SKB. If it is for XSK, it is a zerocopy receive packet process. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 14 ++-- drivers/net/virtio/virtio_net.h |

[PATCH vhost 15/22] virtio_net: xsk: tx: support wakeup

2023-10-11 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 tx interrupt cpu. Consider the effect of cache. When interrupt triggers, it is generally fixed on a CPU. It is bet

[PATCH vhost 16/22] virtio_net: xsk: tx: virtnet_free_old_xmit() distinguishes xsk buffer

2023-10-11 Thread Xuan Zhuo
virtnet_free_old_xmit distinguishes three type ptr(skb, xdp frame, xsk buffer) by the last two types bits. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/virtio_net.h | 16 ++-- drivers/net/virtio/xsk.h| 5 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git

[PATCH vhost 17/22] virtio_net: xsk: tx: virtnet_sq_free_unused_buf() check xsk buffer

2023-10-11 Thread Xuan Zhuo
virtnet_sq_free_unused_buf() check xsk buffer. Signed-off-by: Xuan Zhuo --- 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 a0a735c7aa32..8c9d8c4e6960 100644 --- a/drivers/net/virtio/m

[PATCH vhost 18/22] virtio_net: xsk: rx: introduce add_recvbuf_xsk()

2023-10-11 Thread Xuan Zhuo
Implement the logic of filling vq with XSK buffer. Signed-off-by: Xuan Zhuo --- drivers/net/virtio/main.c | 13 +++ drivers/net/virtio/virtio_net.h | 5 +++ drivers/net/virtio/xsk.c| 66 - drivers/net/virtio/xsk.h| 2 + 4 files changed,

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Yishai Hadas via Virtualization
On 11/10/2023 12:03, Michael S. Tsirkin wrote: On Wed, Oct 11, 2023 at 11:58:11AM +0300, Yishai Hadas wrote: On 11/10/2023 11:02, Michael S. Tsirkin wrote: On Wed, Oct 11, 2023 at 10:44:49AM +0300, Yishai Hadas wrote: On 10/10/2023 23:42, Michael S. Tsirkin wrote: On Tue, Oct 10, 2023 at 07:0

Re: [PATCH net-next v4 02/12] vsock: read from socket's error queue

2023-10-11 Thread Stefano Garzarella
On Tue, Oct 10, 2023 at 10:15:14PM +0300, Arseniy Krasnov wrote: This adds handling of MSG_ERRQUEUE input flag in receive call. This flag is used to read socket's error queue instead of data queue. Possible scenario of error queue usage is receiving completions for transmission with MSG_ZEROCOPY

Re: [PATCH net-next v4 10/12] test/vsock: MSG_ZEROCOPY flag tests

2023-10-11 Thread Stefano Garzarella
On Tue, Oct 10, 2023 at 10:15:22PM +0300, Arseniy Krasnov wrote: This adds three tests for MSG_ZEROCOPY feature: 1) SOCK_STREAM tx with different buffers. 2) SOCK_SEQPACKET tx with different buffers. 3) SOCK_STREAM test to read empty error queue of the socket. Patch also works as preparation for

Re: [PATCH net-next v4 12/12] test/vsock: io_uring rx/tx tests

2023-10-11 Thread Stefano Garzarella
On Tue, Oct 10, 2023 at 10:15:24PM +0300, Arseniy Krasnov wrote: This adds set of tests which use io_uring for rx/tx. This test suite is implemented as separated util like 'vsock_test' and has the same set of input arguments as 'vsock_test'. These tests only cover cases of data transmission (no c

Re: [PATCH net-next v4 00/12] vsock/virtio: continue MSG_ZEROCOPY support

2023-10-11 Thread Stefano Garzarella
On Tue, Oct 10, 2023 at 10:15:12PM +0300, Arseniy Krasnov wrote: Hello, this patchset contains second and third parts of another big patchset for MSG_ZEROCOPY flag support: https://lore.kernel.org/netdev/20230701063947.3422088-1-avkras...@sberdevices.ru/ During review of this series, Stefano Ga

Re: [PATCH vhost 01/22] virtio_ring: virtqueue_set_dma_premapped support disable

2023-10-11 Thread kernel test robot
Hi Xuan, kernel test robot noticed the following build warnings: [auto build test WARNING on linus/master] [also build test WARNING on v6.6-rc5 next-20231011] [cannot apply to mst-vhost/linux-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Christoph Hellwig
On Wed, Oct 11, 2023 at 10:57:09AM -0300, Jason Gunthorpe wrote: > > Independent of my above points on the doubts on VF-controlled live > > migration for PCe device I absolutely agree with your that the Linux > > abstraction and user interface should be VF based. Which further > > reinforeces my p

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Michael S. Tsirkin
On Wed, Oct 11, 2023 at 11:58:10AM -0300, Jason Gunthorpe wrote: > Trying to put VFIO-only code in virtio is what causes all the > issues. If you mis-design the API boundary everything will be painful, > no matter where you put the code. Are you implying the whole idea of adding these legacy virti

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Michael S. Tsirkin
On Wed, Oct 11, 2023 at 09:18:49AM -0300, Jason Gunthorpe wrote: > The simple way to be sure is to never touch the PCI function that has > DMA assigned to a VM from the hypervisor, except through config space. What makes config space different that it's safe though? Isn't this more of a "we can't

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Michael S. Tsirkin
On Wed, Oct 11, 2023 at 09:18:49AM -0300, Jason Gunthorpe wrote: > With VDPA doing the same stuff as vfio I'm not sure who is auditing it > for security. Check the signed off tags and who sends the pull requests if you want to know. -- MST ___ Virtual

Re: [PATCH vfio 10/11] vfio/virtio: Expose admin commands over virtio device

2023-10-11 Thread Michael S. Tsirkin
On Wed, Oct 11, 2023 at 02:19:44PM -0300, Jason Gunthorpe wrote: > On Wed, Oct 11, 2023 at 12:59:30PM -0400, Michael S. Tsirkin wrote: > > On Wed, Oct 11, 2023 at 11:58:10AM -0300, Jason Gunthorpe wrote: > > > Trying to put VFIO-only code in virtio is what causes all the > > > issues. If you mis-de

Re: [PATCH vhost 05/22] virtio_net: independent directory

2023-10-11 Thread kernel test robot
Hi Xuan, kernel test robot noticed the following build warnings: [auto build test WARNING on linus/master] [also build test WARNING on v6.6-rc5 next-20231011] [cannot apply to mst-vhost/linux-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch

Re: [PATCH vhost 00/22] virtio-net: support AF_XDP zero copy

2023-10-11 Thread Xuan Zhuo
On Wed, 11 Oct 2023 10:00:57 -0700, Jakub Kicinski wrote: > On Wed, 11 Oct 2023 17:27:06 +0800 Xuan Zhuo wrote: > > ## 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 > > perfo

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

2023-10-11 Thread Si-Wei Liu
On 10/11/2023 4:21 AM, Eugenio Perez Martin wrote: On Tue, Oct 10, 2023 at 11:05 AM Si-Wei Liu wrote: Devices with on-chip IOMMU or vendor specific IOTLB implementation may need to restore iotlb mapping to the initial or default state using the .reset_map op, as it's desirable for some parent