Re: [PATCH net, stable v1 3/3] virtio_net: add checking sq is full inside xdp xmit

2023-03-07 Thread Xuan Zhuo
On Wed, 8 Mar 2023 14:59:36 +0800, Yunsheng Lin wrote: > On 2023/3/8 10:49, Xuan Zhuo wrote: > > If the queue of xdp xmit is not an independent queue, then when the xdp > > xmit used all the desc, the xmit from the __dev_queue_xmit() may encounter > > the following error. > > > > net ens4: Unexpec

Re: [PATCH 3/3] virtio_ring: Use const to annotate read-only pointer params

2023-03-07 Thread Michael S. Tsirkin
On Tue, Mar 07, 2023 at 05:57:05AM +0200, Feng Liu wrote: > @@ -2827,8 +2827,7 @@ bool virtqueue_is_broken(struct virtqueue *_vq) > } > EXPORT_SYMBOL_GPL(virtqueue_is_broken); > > -/* > - * This should prevent the device from being used, allowing drivers to > +/ This should prevent the device f

Re: [PATCH 1/3] virtio_pci_modern: Remove unnecessary num zero check

2023-03-07 Thread Michael S. Tsirkin
On Wed, Mar 08, 2023 at 01:52:43PM +0800, Jason Wang wrote: > On Tue, Mar 7, 2023 at 11:57 AM Feng Liu wrote: > > > > is_power_of_2() already performs the zero check. Hence avoid duplicate > > check. While at it, move the query of size check also adjacent to where > > its used for the disabled vq.

Re: [PATCH net, stable v1 1/3] virtio_net: reorder some funcs

2023-03-07 Thread Michael S. Tsirkin
On Wed, Mar 08, 2023 at 10:49:33AM +0800, Xuan Zhuo wrote: > The purpose of this is to facilitate the subsequent addition of new > functions without introducing a separate declaration. > > Signed-off-by: Xuan Zhuo Acked-by: Michael S. Tsirkin this one isn't for stable naturally, stable can use

[PATCH vhost v2 11/12] virtio_ring: separate the logic of reset/enable from virtqueue_resize

2023-03-07 Thread Xuan Zhuo
The subsequent reset function will reuse these logic. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 58 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index a705485fea4

[PATCH vhost v2 08/12] virtio_ring: update document for virtqueue_add_*

2023-03-07 Thread Xuan Zhuo
Update the document of virtqueue_add_* series API, allowing the callers to use sg->dma_address to pass the dma address to Virtio Core. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/dr

[PATCH vhost v2 06/12] virtio_ring: split-indirect: support premapped

2023-03-07 Thread Xuan Zhuo
virtio core only supports virtual addresses, dma is completed in virtio core. In some scenarios (such as the AF_XDP), the memory is allocated and DMA is completed in advance, so it is necessary for us to support passing the DMA address to virtio core. Drives can use sg->dma_address to pass the ma

[PATCH vhost v2 09/12] virtio_ring: introduce virtqueue_dma_dev()

2023-03-07 Thread Xuan Zhuo
Added virtqueue_dma_dev() to get DMA device for virtio. Then the caller can do dma operation in advance. The purpose is to keep memory mapped across multiple add/get buf operations. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio.c | 6 ++ drivers/virtio/virtio

[PATCH vhost v2 10/12] virtio_ring: correct the expression of the description of virtqueue_resize()

2023-03-07 Thread Xuan Zhuo
Modify the "useless" to a more accurate "unused". Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- 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 f63637c288a0..a705485fea47 10064

[PATCH vhost v2 04/12] virtio_ring: split: support premapped

2023-03-07 Thread Xuan Zhuo
virtio core only supports virtual addresses, dma is completed in virtio core. In some scenarios (such as the AF_XDP), the memory is allocated and DMA is completed in advance, so it is necessary for us to support passing the DMA address to virtio core. Drives can use sg->dma_address to pass the ma

[PATCH vhost v2 07/12] virtio_ring: packed-indirect: support premapped

2023-03-07 Thread Xuan Zhuo
virtio core only supports virtual addresses, dma is completed in virtio core. In some scenarios (such as the AF_XDP), the memory is allocated and DMA is completed in advance, so it is necessary for us to support passing the DMA address to virtio core. Drives can use sg->dma_address to pass the ma

[PATCH vhost v2 12/12] virtio_ring: introduce virtqueue_reset()

2023-03-07 Thread Xuan Zhuo
Introduce virtqueue_reset() to release all buffer inside vq. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 33 + include/linux/virtio.h | 2 ++ 2 files changed, 35 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virti

[PATCH vhost v2 01/12] virtio_ring: split: separate dma codes

2023-03-07 Thread Xuan Zhuo
DMA-related logic is separated from the virtqueue_add_split() to one new function. DMA address will be saved as sg->dma_address, then virtqueue_add_split() will use it directly. Unmap operation will be simpler. The purpose of this is to facilitate subsequent support to receive dma address mapped b

[PATCH vhost v2 05/12] virtio_ring: packed: support premapped

2023-03-07 Thread Xuan Zhuo
virtio core only supports virtual addresses, dma is completed in virtio core. In some scenarios (such as the AF_XDP), the memory is allocated and DMA is completed in advance, so it is necessary for us to support passing the DMA address to virtio core. Drives can use sg->dma_address to pass the ma

[PATCH vhost v2 02/12] virtio_ring: packed: separate dma codes

2023-03-07 Thread Xuan Zhuo
DMA-related logic is separated from the virtqueue_add_packed(). DMA address will be saved as sg->dma_address, then virtqueue_add_packed() will use it directly. Unmap operation will be simpler. The purpose of this is to facilitate subsequent support to receive dma address mapped by drivers. Signed

[PATCH vhost v2 03/12] virtio_ring: packed-indirect: separate dma codes

2023-03-07 Thread Xuan Zhuo
DMA-related logic is separated from the virtqueue_add_indirect_packed(). DMA address will be saved as sg->dma_address, then virtqueue_add_indirect_packed() will use it directly. Unmap operation will be simpler. The purpose of this is to facilitate subsequent support to receive dma address mapped

[PATCH vhost v2 00/12] virtio core prepares for AF_XDP

2023-03-07 Thread Xuan Zhuo
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. ENV: Qemu with vhost. vhost cpu | Guest APP CPU |Guest Softirq CPU | PPS ---

Re: [PATCH 3/3] virtio_ring: Use const to annotate read-only pointer params

2023-03-07 Thread Jason Wang
On Tue, Mar 7, 2023 at 11:57 AM Feng Liu wrote: > > Add const to make the read-only pointer parameters clear, similar to > many existing functions. > > Signed-off-by: Feng Liu > Reviewed-by: Jiri Pirko > Reviewed-by: Parav Pandit > Reviewed-by: Gavin Li > Reviewed-by: Bodong Wang > --- > dri

Re: [PATCH 2/3] virtio_ring: Avoid using inline for small functions

2023-03-07 Thread Jason Wang
On Tue, Mar 7, 2023 at 11:57 AM Feng Liu wrote: > > According to kernel coding style [1], defining inline functions is not > necessary and beneficial for simple functions. Hence clean up the code > by removing the inline keyword. > > It is verified with GCC 12.2.0, the generated code with/without

Re: [PATCH 1/3] virtio_pci_modern: Remove unnecessary num zero check

2023-03-07 Thread Jason Wang
On Tue, Mar 7, 2023 at 11:57 AM Feng Liu wrote: > > is_power_of_2() already performs the zero check. Hence avoid duplicate > check. While at it, move the query of size check also adjacent to where > its used for the disabled vq. > > Signed-off-by: Feng Liu > Reviewed-by: Jiri Pirko > Reviewed-by

Re: [PATCH net, stable v1 3/3] virtio_net: add checking sq is full inside xdp xmit

2023-03-07 Thread Jason Wang
On Wed, Mar 8, 2023 at 10:49 AM Xuan Zhuo wrote: > > If the queue of xdp xmit is not an independent queue, then when the xdp > xmit used all the desc, the xmit from the __dev_queue_xmit() may encounter > the following error. > > net ens4: Unexpected TXQ (0) queue failure: -28 > > This patch adds a

Re: [PATCH net, stable v1 2/3] virtio_net: separate the logic of checking whether sq is full

2023-03-07 Thread Jason Wang
On Wed, Mar 8, 2023 at 10:49 AM Xuan Zhuo wrote: > > Separate the logic of checking whether sq is full. The subsequent patch > will reuse this func. > > Signed-off-by: Xuan Zhuo > Reviewed-by: Alexander Duyck > Acked-by: Michael S. Tsirkin Acked-by: Jason Wang Thanks > --- > drivers/net/vi

Re: [PATCH net, stable v1 1/3] virtio_net: reorder some funcs

2023-03-07 Thread Jason Wang
On Wed, Mar 8, 2023 at 10:49 AM Xuan Zhuo wrote: > > The purpose of this is to facilitate the subsequent addition of new > functions without introducing a separate declaration. > > Signed-off-by: Xuan Zhuo Not sure such reordering is suitable for -stable. Thanks > --- > drivers/net/virtio_net

Re: [PATCH] rust: virtio: add virtio support

2023-03-07 Thread Miguel Ojeda
On Wed, Mar 8, 2023 at 1:34 AM FUJITA Tomonori wrote: > > C versions of virtio-console, virtio-rng, and virtio-net exists. Both > C and Rust versions in mainline? > > Are there guidelines on pushing a Rust driver in mainline? Although the website is not finished yet, please see https://rust-for-l

[PATCH net, stable v1 1/3] virtio_net: reorder some funcs

2023-03-07 Thread Xuan Zhuo
The purpose of this is to facilitate the subsequent addition of new functions without introducing a separate declaration. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 92 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/drivers/n

[PATCH net, stable v1 3/3] virtio_net: add checking sq is full inside xdp xmit

2023-03-07 Thread Xuan Zhuo
If the queue of xdp xmit is not an independent queue, then when the xdp xmit used all the desc, the xmit from the __dev_queue_xmit() may encounter the following error. net ens4: Unexpected TXQ (0) queue failure: -28 This patch adds a check whether sq is full in xdp xmit. Fixes: 56434a01b12e ("vi

[PATCH net, stable v1 0/3] add checking sq is full inside xdp xmit

2023-03-07 Thread Xuan Zhuo
If the queue of xdp xmit is not an independent queue, then when the xdp xmit used all the desc, the xmit from the __dev_queue_xmit() may encounter the following error. net ens4: Unexpected TXQ (0) queue failure: -28 This patch adds a check whether sq is full in XDP Xmit. Thanks. v1: 1. rena

[PATCH net, stable v1 2/3] virtio_net: separate the logic of checking whether sq is full

2023-03-07 Thread Xuan Zhuo
Separate the logic of checking whether sq is full. The subsequent patch will reuse this func. Signed-off-by: Xuan Zhuo Reviewed-by: Alexander Duyck Acked-by: Michael S. Tsirkin --- drivers/net/virtio_net.c | 60 1 file changed, 36 insertions(+), 24 dele

Re: virtio-fs: adding support for multi-queue

2023-03-07 Thread Vivek Goyal
On Tue, Mar 07, 2023 at 08:43:33PM +0100, Peter-Jan Gootzen wrote: > On 22-02-2023 15:32, Stefan Hajnoczi wrote: > > On Wed, Feb 08, 2023 at 05:29:25PM +0100, Peter-Jan Gootzen wrote: > > > On 08/02/2023 11:43, Stefan Hajnoczi wrote: > > > > On Wed, Feb 08, 2023 at 09:33:33AM +0100, Peter-Jan Gootz

Re: [PATCH 3/3] virtio_ring: Use const to annotate read-only pointer params

2023-03-07 Thread Feng Liu via Virtualization
On 2023-03-07 04:14, David Edmondson wrote: > External email: Use caution opening links or attachments > > > Feng Liu via Virtualization > writes: > >> Add const to make the read-only pointer parameters clear, similar to >> many existing functions. > > In many of the modified functions the loc

Re: virtio-fs: adding support for multi-queue

2023-03-07 Thread Peter-Jan Gootzen via Virtualization
On 22-02-2023 15:32, Stefan Hajnoczi wrote: On Wed, Feb 08, 2023 at 05:29:25PM +0100, Peter-Jan Gootzen wrote: On 08/02/2023 11:43, Stefan Hajnoczi wrote: On Wed, Feb 08, 2023 at 09:33:33AM +0100, Peter-Jan Gootzen wrote: On 07/02/2023 22:57, Vivek Goyal wrote: On Tue, Feb 07, 2023 at 04:32

Re: [PATCH] rust: virtio: add virtio support

2023-03-07 Thread Miguel Ojeda
On Tue, Mar 7, 2023 at 2:04 PM Daniel Almeida wrote: > > Feel free to point me to the best practices around Rust patch > submission, as the C stuff like checkpatch etc probably does not apply > yet. I did take care to run clippy though. Yeah, some nits below as if you had run a script like that :

Re: [PATCH net 0/2] add checking sq is full inside xdp xmit

2023-03-07 Thread Michael S. Tsirkin
On Tue, Mar 07, 2023 at 10:53:41AM +0100, Paolo Abeni wrote: > Hi, > On Tue, 2023-03-07 at 09:49 +0800, Xuan Zhuo wrote: > > On Mon, 6 Mar 2023 12:58:22 -0500, "Michael S. Tsirkin" > > wrote: > > > On Mon, Mar 06, 2023 at 12:15:33PM +0800, Xuan Zhuo wrote: > > > > If the queue of xdp xmit is not

[PATCH] rust: virtio: add virtio support

2023-03-07 Thread Daniel Almeida via Virtualization
This patch adds virtIO support to the rust crate. This includes the capability to create a virtIO driver (through the module_virtio_driver macro and the respective Driver trait) as well as initial virtqueue support. A sample virtIO module is included for conveninence. Signed-off-by: Daniel Almeid

Re: [PATCH net 0/2] add checking sq is full inside xdp xmit

2023-03-07 Thread Xuan Zhuo
On Tue, 07 Mar 2023 10:53:41 +0100, Paolo Abeni wrote: > Hi, > On Tue, 2023-03-07 at 09:49 +0800, Xuan Zhuo wrote: > > On Mon, 6 Mar 2023 12:58:22 -0500, "Michael S. Tsirkin" > > wrote: > > > On Mon, Mar 06, 2023 at 12:15:33PM +0800, Xuan Zhuo wrote: > > > > If the queue of xdp xmit is not an in

Re: [PATCH v12 09/11] drm/gem: Export drm_gem_pin/unpin()

2023-03-07 Thread Thomas Zimmermann
Hi Am 05.03.23 um 23:10 schrieb Dmitry Osipenko: Export drm_gem_un/pin() functions. They will be used by VirtIO-GPU driver for pinning of an active framebuffer, preventing it from swapping out by memory shrinker. Please see my reply to [10/11] on why this patch should not be used. Best regard

Re: [PATCH v12 10/11] drm/virtio: Support memory shrinking

2023-03-07 Thread Thomas Zimmermann
Hi Am 05.03.23 um 23:10 schrieb Dmitry Osipenko: [...] *bo_ptr = bo; diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 4c09e313bebc..3f21512ff153 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane

Re: [PATCH net 0/2] add checking sq is full inside xdp xmit

2023-03-07 Thread Paolo Abeni
Hi, On Tue, 2023-03-07 at 09:49 +0800, Xuan Zhuo wrote: > On Mon, 6 Mar 2023 12:58:22 -0500, "Michael S. Tsirkin" > wrote: > > On Mon, Mar 06, 2023 at 12:15:33PM +0800, Xuan Zhuo wrote: > > > If the queue of xdp xmit is not an independent queue, then when the xdp > > > xmit used all the desc, the

Re: [PATCH v2 4/8] vringh: support VA with iotlb

2023-03-07 Thread Stefano Garzarella
On Fri, Mar 03, 2023 at 03:38:57PM +0100, Eugenio Perez Martin wrote: On Thu, Mar 2, 2023 at 12:35 PM Stefano Garzarella wrote: vDPA supports the possibility to use user VA in the iotlb messages. So, let's add support for user VA in vringh to use it in the vDPA simulators. Signed-off-by: Stef

Re: [PATCH 3/3] virtio_ring: Use const to annotate read-only pointer params

2023-03-07 Thread David Edmondson
Feng Liu via Virtualization writes: > Add const to make the read-only pointer parameters clear, similar to > many existing functions. In many of the modified functions the local variable that is a cast of the argument could also be const. Is there a reason not to do both at the same time? > Sig

Re: [PATCH 2/3] virtio_ring: Avoid using inline for small functions

2023-03-07 Thread David Edmondson
Feng Liu via Virtualization writes: > According to kernel coding style [1], defining inline functions is not > necessary and beneficial for simple functions. Hence clean up the code > by removing the inline keyword. > > It is verified with GCC 12.2.0, the generated code with/without inline > is s

Re: [PATCH 1/3] virtio_pci_modern: Remove unnecessary num zero check

2023-03-07 Thread David Edmondson
Feng Liu via Virtualization writes: > is_power_of_2() already performs the zero check. Hence avoid duplicate > check. While at it, move the query of size check also adjacent to where > its used for the disabled vq. > > Signed-off-by: Feng Liu > Reviewed-by: Jiri Pirko > Reviewed-by: Parav Pandi

Re: [PATCH net 1/2] virtio_net: separate the logic of checking whether sq is full

2023-03-07 Thread Jason Wang
On Mon, Mar 6, 2023 at 12:15 PM Xuan Zhuo wrote: > > Separate the logic of checking whether sq is full. The subsequent patch > will reuse this func. > > Signed-off-by: Xuan Zhuo > --- > drivers/net/virtio_net.c | 59 > 1 file changed, 35 insertions(+), 24