Re: [PATCH vhost v6 03/10] virtio_ring: packed: structure the indirect desc table

2024-03-27 Thread Jason Wang
On Wed, Mar 27, 2024 at 7:14 PM Xuan Zhuo wrote: > > This commit structure the indirect desc table. > Then we can get the desc num directly when doing unmap. > > And save the dma info to the struct, then the indirect > will not use the dma fields of the desc_extra. The subsequent > commits will ma

Re: [PATCH vhost v6 02/10] virtio_ring: packed: remove double check of the unmap ops

2024-03-27 Thread Jason Wang
On Wed, Mar 27, 2024 at 7:14 PM Xuan Zhuo wrote: > > In the functions vring_unmap_extra_packed and vring_unmap_desc_packed, > multiple checks are made whether unmap is performed and whether it is > INDIRECT. > > These two functions are usually called in a loop, and we should put the > check outsid

RE: [PATCH net-next v2 4/6] virtio_net: Do DIM update for specified queue only

2024-03-27 Thread Dan Jurgens
> From: Heng Qi > Sent: Wednesday, March 27, 2024 11:57 PM > To: Dan Jurgens ; netdev@vger.kernel.org > Cc: m...@redhat.com; jasow...@redhat.com; xuanz...@linux.alibaba.com; > virtualizat...@lists.linux.dev; da...@davemloft.net; > eduma...@google.com; k...@kernel.org; pab...@redhat.com; Jiri Pirko

Re: [PATCH net-next v2 4/6] virtio_net: Do DIM update for specified queue only

2024-03-27 Thread Heng Qi
在 2024/3/28 下午12:47, Daniel Jurgens 写道: Since we no longer have to hold the RTNL lock here just do updates for the specified queue. Signed-off-by: Daniel Jurgens --- drivers/net/virtio_net.c | 38 ++ 1 file changed, 14 insertions(+), 24 deletions(-) di

[PATCH net-next v2 6/6] virtio_net: Remove rtnl lock protection of command buffers

2024-03-27 Thread Daniel Jurgens
The rtnl lock is no longer needed to protect the control buffer and command VQ. Signed-off-by: Daniel Jurgens Reviewed-by: Jiri Pirko --- drivers/net/virtio_net.c | 27 +-- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/

[PATCH net-next v2 4/6] virtio_net: Do DIM update for specified queue only

2024-03-27 Thread Daniel Jurgens
Since we no longer have to hold the RTNL lock here just do updates for the specified queue. Signed-off-by: Daniel Jurgens --- drivers/net/virtio_net.c | 38 ++ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/n

[PATCH net-next v2 2/6] virtio_net: Remove command data from control_buf

2024-03-27 Thread Daniel Jurgens
Allocate memory for the data when it's used. Ideally the could be on the stack, but we can't DMA stack memory. With this change only the header and status memory are shared between commands, which will allow using a tighter lock than RTNL. Signed-off-by: Daniel Jurgens Reviewed-by: Jiri Pirko --

[PATCH net-next v2 5/6] virtio_net: Add a lock for per queue RX coalesce

2024-03-27 Thread Daniel Jurgens
Once the RTNL locking around the control buffer is removed there can be contention on the per queue RX interrupt coalescing data. Use a spin lock per queue. Signed-off-by: Daniel Jurgens --- drivers/net/virtio_net.c | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(

[PATCH net-next v2 0/6] Remove RTNL lock protection of CVQ

2024-03-27 Thread Daniel Jurgens
Currently the buffer used for control VQ commands is protected by the RTNL lock. Previously this wasn't a major concern because the control VQ was only used during device setup and user interaction. With the recent addition of dynamic interrupt moderation the control VQ may be used frequently durin

[PATCH net-next v2 3/6] virtio_net: Add a lock for the command VQ.

2024-03-27 Thread Daniel Jurgens
The command VQ will no longer be protected by the RTNL lock. Use a spinlock to protect the control buffer header and the VQ. Signed-off-by: Daniel Jurgens Reviewed-by: Jiri Pirko --- drivers/net/virtio_net.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/vi

[PATCH net-next v2 1/6] virtio_net: Store RSS setting in virtnet_info

2024-03-27 Thread Daniel Jurgens
Stop storing RSS setting in the control buffer. This is prep work for removing RTNL lock protection of the control buffer. Signed-off-by: Daniel Jurgens Reviewed-by: Jiri Pirko --- drivers/net/virtio_net.c | 40 1 file changed, 20 insertions(+), 20 delet

Re: [PATCH net-next 4/4] virtio_net: Remove rtnl lock protection of command buffers

2024-03-27 Thread Heng Qi
在 2024/3/27 上午10:10, Heng Qi 写道: 在 2024/3/26 下午11:18, Dan Jurgens 写道: From: Heng Qi Sent: Tuesday, March 26, 2024 3:55 AM To: Dan Jurgens ; netdev@vger.kernel.org Cc: m...@redhat.com; jasow...@redhat.com; xuanz...@linux.alibaba.com; virtualizat...@lists.linux.dev; da...@davemloft.net; edum

[PATCH vhost v6 07/10] virtio: find_vqs: add new parameter premapped

2024-03-27 Thread Xuan Zhuo
If the premapped mode is enabled, the dma array(struct vring_desc_dma) of virtio core will not be allocated. That is judged when find_vqs() is called. To avoid allocating dma array in find_vqs() and releasing it immediately by virtqueue_set_dma_premapped(). This patch introduces a new parameter to

[PATCH vhost v6 10/10] virtio_ring: virtqueue_set_dma_premapped support disable

2024-03-27 Thread Xuan Zhuo
Now, the API virtqueue_set_dma_premapped just support to enable premapped mode. If we allow enabling the premapped dynamically, we should make this API to support disable the premapped mode. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 39 +++- inc

[PATCH vhost v6 09/10] virtio_net: set premapped mode by find_vqs()

2024-03-27 Thread Xuan Zhuo
Now, the virtio core can set the premapped mode by find_vqs(). If the premapped can be enabled, the dma array will not be allocated. So virtio-net use the api of find_vqs to enable the premapped. Judge the premapped mode by the vq->premapped instead of saving local variable. Signed-off-by: Xuan Z

[PATCH vhost v6 08/10] virtio_ring: export premapped to driver by struct virtqueue

2024-03-27 Thread Xuan Zhuo
Export the premapped to drivers, then drivers can check the vq premapped mode after the find_vqs(). Because the find_vqs() just try to enable the vq premapped mode, the driver must check that after find_vqs(). Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 13 + include/

[PATCH vhost v6 06/10] virtio_ring: no store dma info when unmap is not needed

2024-03-27 Thread Xuan Zhuo
As discussed: http://lore.kernel.org/all/CACGkMEug-=C+VQhkMYSgUKMC==04m7-uem_yc21bggkkzh8...@mail.gmail.com When the vq is premapped mode, the driver manages the dma info is a good way. So this commit make the virtio core not to store the dma info and release the memory which is used to store the

[PATCH vhost v6 05/10] virtio_ring: split: structure the indirect desc table

2024-03-27 Thread Xuan Zhuo
This commit structure the indirect desc table. Then we can get the desc num directly when doing unmap. And save the dma info to the struct, then the indirect will not use the dma fields of the desc_extra. The subsequent commits will make the dma fields are optional. But for the indirect case, we m

[PATCH vhost v6 04/10] virtio_ring: split: remove double check of the unmap ops

2024-03-27 Thread Xuan Zhuo
In the functions vring_unmap_one_split and vring_unmap_one_split_indirect, multiple checks are made whether unmap is performed and whether it is INDIRECT. These two functions are usually called in a loop, and we should put the check outside the loop. And we unmap the descs with VRING_DESC_F_INDIR

[PATCH vhost v6 03/10] virtio_ring: packed: structure the indirect desc table

2024-03-27 Thread Xuan Zhuo
This commit structure the indirect desc table. Then we can get the desc num directly when doing unmap. And save the dma info to the struct, then the indirect will not use the dma fields of the desc_extra. The subsequent commits will make the dma fields are optional. But for the indirect case, we m

[PATCH vhost v6 02/10] virtio_ring: packed: remove double check of the unmap ops

2024-03-27 Thread Xuan Zhuo
In the functions vring_unmap_extra_packed and vring_unmap_desc_packed, multiple checks are made whether unmap is performed and whether it is INDIRECT. These two functions are usually called in a loop, and we should put the check outside the loop. And we unmap the descs with VRING_DESC_F_INDIRECT

[PATCH vhost v6 01/10] virtio_ring: introduce vring_need_unmap_buffer

2024-03-27 Thread Xuan Zhuo
To make the code readable, introduce vring_need_unmap_buffer() to replace do_unmap. use_dma_api premapped -> vring_need_unmap_buffer() 1. false falsefalse 2. truefalsetrue 3. truetrue false Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drive

[PATCH vhost v6 00/10] virtio: drivers maintain dma info for premapped vq

2024-03-27 Thread Xuan Zhuo
As discussed: http://lore.kernel.org/all/cacgkmevq0no8qgc46u4mgsmtud44fd_cflcpavmj3rhyqrz...@mail.gmail.com If the virtio is premapped mode, the driver should manage the dma info by self. So the virtio core should not store the dma info. We can release the memory used to store the dma info. For

Re: [PATCH vhost v5 00/10] virtio: drivers maintain dma info for premapped vq

2024-03-27 Thread Jason Wang
On Wed, Mar 27, 2024 at 4:07 PM Xuan Zhuo wrote: > > On Wed, 27 Mar 2024 15:50:17 +0800, Jason Wang wrote: > > On Wed, Mar 27, 2024 at 3:16 PM Xuan Zhuo > > wrote: > > > > > > On Tue, 26 Mar 2024 14:35:21 +0800, Jason Wang > > > wrote: > > > > On Mon, Mar 25, 2024 at 4:54 PM Xuan Zhuo > > >

Re: [PATCH vhost v5 00/10] virtio: drivers maintain dma info for premapped vq

2024-03-27 Thread Xuan Zhuo
On Wed, 27 Mar 2024 15:50:17 +0800, Jason Wang wrote: > On Wed, Mar 27, 2024 at 3:16 PM Xuan Zhuo wrote: > > > > On Tue, 26 Mar 2024 14:35:21 +0800, Jason Wang wrote: > > > On Mon, Mar 25, 2024 at 4:54 PM Xuan Zhuo > > > wrote: > > > > > > > > As discussed: > > > > > > > > http://lore.kernel.o

Re: [PATCH vhost v5 00/10] virtio: drivers maintain dma info for premapped vq

2024-03-27 Thread Jason Wang
On Wed, Mar 27, 2024 at 3:16 PM Xuan Zhuo wrote: > > On Tue, 26 Mar 2024 14:35:21 +0800, Jason Wang wrote: > > On Mon, Mar 25, 2024 at 4:54 PM Xuan Zhuo > > wrote: > > > > > > As discussed: > > > > > > http://lore.kernel.org/all/cacgkmevq0no8qgc46u4mgsmtud44fd_cflcpavmj3rhyqrz...@mail.gmail.com

Re: [PATCH vhost v5 00/10] virtio: drivers maintain dma info for premapped vq

2024-03-27 Thread Xuan Zhuo
On Tue, 26 Mar 2024 14:35:21 +0800, Jason Wang wrote: > On Mon, Mar 25, 2024 at 4:54 PM Xuan Zhuo wrote: > > > > As discussed: > > > > http://lore.kernel.org/all/cacgkmevq0no8qgc46u4mgsmtud44fd_cflcpavmj3rhyqrz...@mail.gmail.com > > > > If the virtio is premapped mode, the driver should manage th

Re: [PATCH vhost v4 02/10] virtio_ring: packed: remove double check of the unmap ops

2024-03-27 Thread Xuan Zhuo
On Tue, 26 Mar 2024 03:32:43 -0400, "Michael S. Tsirkin" wrote: > On Thu, Mar 21, 2024 at 04:20:09PM +0800, Xuan Zhuo wrote: > > On Thu, 21 Mar 2024 13:57:06 +0800, Jason Wang wrote: > > > On Tue, Mar 12, 2024 at 11:36 AM Xuan Zhuo > > > wrote: > > > > > > > > In the functions vring_unmap_extr

Re: REGRESSION: RIP: 0010:skb_release_data+0xb8/0x1e0 in vhost/tun

2024-03-27 Thread Jaroslav Pulchart
st 27. 3. 2024 v 4:11 odesílatel Jason Wang napsal: > > On Tue, Mar 26, 2024 at 9:26 PM Jaroslav Pulchart > wrote: > > > > > > > > On Mon, Mar 25, 2024 at 4:44 PM Igor Raits wrote: > > > > > > > > Hello, > > > > > > > > On Fri, Mar 22, 2024 at 12:19 PM Igor Raits wrote: > > > > > > > > > > Hi J