Re: [PATCH 2/2] virtio: fix vq # when vq skipped

2024-07-09 Thread Jason Wang
ult is that driver is out of spec. > > Implement what the API was supposed to do > in the 1st place. Compatibility with buggy hypervisors > is handled inside virtio-balloon, which is the only driver > making use of this facility, so far. > > Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Thanks

Re: [PATCH vhost v9 1/6] virtio_balloon: remove the dependence where names[] is null

2024-06-20 Thread Jason Wang
lement functionality > > to allow vq indexes to be discontinuous. So the current behavior of the > > virtio-balloon device is different for the spec. But this commit has no > > functional changes. > > > > Signed-off-by: Xuan Zhuo > > Acked-by: David Hildenbrand

Re: [PATCH vhost v7 5/6] virtio: vring_new_virtqueue(): pass struct instead of multi parameters

2024-03-28 Thread Jason Wang
y: Xuan Zhuo > Reviewed-by: Ilpo Järvinen Acked-by: Jason Wang Thanks

Re: [PATCH vhost v6 3/6] virtio: find_vqs: pass struct instead of multi parameters

2024-03-27 Thread Jason Wang
ccw); > + vqs[i] = virtio_ccw_setup_vq(vdev, i, ccw, cfg); > if (IS_ERR(vqs[i])) { > ret = PTR_ERR(vqs[i]); > vqs[i] = NULL; > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c > index 82ee4a288728..7f0fdc3f51cb 100644 > --- a/drivers/virtio/virtio_mmio.c > +++ b/drivers/virtio/virtio_mmio.c > @@ -370,8 +370,7 @@ static void vm_synchronize_cbs(struct virtio_device *vdev) > } > > static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, unsigned > int index, > - void (*callback)(struct virtqueue *vq), > - const char *name, bool ctx) > +struct virtio_vq_config *cfg) > { > struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); > bool (*notify)(struct virtqueue *vq); > @@ -386,9 +385,6 @@ static struct virtqueue *vm_setup_vq(struct virtio_device > *vdev, unsigned int in > else > notify = vm_notify; > > - if (!name) > - return NULL; Nit: This seems to belong to patch 2. Acked-by: Jason Wang Thanks

Re: [PATCH vhost v6 6/6] virtio_ring: simplify the parameters of the funcs related to vring_create/new_virtqueue()

2024-03-27 Thread Jason Wang
Signed-off-by: Xuan Zhuo > Reviewed-by: Ilpo Järvinen > --- Acked-by: Jason Wang Thanks

Re: [PATCH vhost v6 5/6] virtio: vring_new_virtqueue(): pass struct instead of multi parameters

2024-03-27 Thread Jason Wang
On Wed, Mar 27, 2024 at 5:58 PM Xuan Zhuo wrote: > > Now, we pass multi parameters to vring_new_virtqueue. These parameters > may from transport or from driver. > > vring_new_virtqueue is called by many places. > Every time, we try to add a new parameter, that is difficult. > > If parameters from

Re: [PATCH vhost v6 4/6] virtio: vring_create_virtqueue: pass struct instead of multi parameters

2024-03-27 Thread Jason Wang
f-by: Xuan Zhuo > Acked-by: Johannes Berg > Reviewed-by: Ilpo Järvinen Acked-by: Jason Wang Thanks

Re: [PATCH vhost v6 2/6] virtio: remove support for names array entries being null.

2024-03-27 Thread Jason Wang
d int nvqs, > struct cpumask *masks; > struct vdpa_callback cb; > bool has_affinity = desc && ops->set_vq_affinity; > - int i, err, queue_idx = 0; > + int i, err; > > if (has_affinity) { > masks = create_af

Re: [PATCH vhost v5 2/6] virtio: remove support for names array entries being null.

2024-03-25 Thread Jason Wang
On Mon, Mar 25, 2024 at 5:04 PM Xuan Zhuo wrote: > > commit 6457f126c888 ("virtio: support reserved vqs") introduced this > support. Multiqueue virtio-net use 2N as ctrl vq finally, so the logic > doesn't apply. And not one uses this. > > On the other side, that makes some trouble for us to refact

Re: [PATCH vhost v4 1/6] virtio_balloon: remove the dependence where names[] is null

2024-03-25 Thread Jason Wang
On Tue, Mar 26, 2024 at 12:11 PM Jason Wang wrote: > > On Mon, Mar 25, 2024 at 5:44 PM Cornelia Huck wrote: > > > > On Mon, Mar 25 2024, Xuan Zhuo wrote: > > > > > On Fri, 22 Mar 2024 22:02:27 +0100, David Hildenbrand > > > wrote: > > >>

Re: [PATCH vhost v5 1/6] virtio_balloon: remove the dependence where names[] is null

2024-03-25 Thread Jason Wang
part of the codebase. In an upcoming commit, we plan to > eliminate this dependency by removing the function entirely. Therefore, > with this change, we are ensuring that the virtio_balloon no longer > depends on the aforementioned function. > > Signed-off-by: Xuan Zhuo With the above tweak. Acked-by: Jason Wang Thanks

Re: [PATCH vhost v4 1/6] virtio_balloon: remove the dependence where names[] is null

2024-03-25 Thread Jason Wang
On Mon, Mar 25, 2024 at 5:44 PM Cornelia Huck wrote: > > On Mon, Mar 25 2024, Xuan Zhuo wrote: > > > On Fri, 22 Mar 2024 22:02:27 +0100, David Hildenbrand > > wrote: > >> On 22.03.24 20:16, Daniel Verkamp wrote: > >> > On Thu, Mar 21, 2024 at 3:16 AM Xuan Zhuo > >> > wrote: > >> >> > >> >> Cu

Re: [PATCH vhost v3 1/4] virtio: find_vqs: pass struct instead of multi parameters

2024-03-20 Thread Jason Wang
On Wed, Mar 20, 2024 at 5:41 PM Xuan Zhuo wrote: > > On Wed, 20 Mar 2024 17:22:50 +0800, Jason Wang wrote: > > On Tue, Mar 19, 2024 at 2:58 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Mar 18, 2024 at 01:59:52PM +0800, Xuan Zhuo wrote: > > > > On M

Re: [PATCH vhost v3 1/4] virtio: find_vqs: pass struct instead of multi parameters

2024-03-20 Thread Jason Wang
On Wed, Mar 20, 2024 at 6:07 PM Xuan Zhuo wrote: > > On Wed, 20 Mar 2024 17:39:29 +0800, Xuan Zhuo > wrote: > > On Wed, 20 Mar 2024 17:22:50 +0800, Jason Wang wrote: > > > On Tue, Mar 19, 2024 at 2:58 PM Michael S. Tsirkin > > > wrote: > > > > >

Re: [PATCH vhost v3 1/4] virtio: find_vqs: pass struct instead of multi parameters

2024-03-20 Thread Jason Wang
On Wed, Mar 20, 2024 at 5:22 PM Jason Wang wrote: > > On Tue, Mar 19, 2024 at 2:58 PM Michael S. Tsirkin wrote: > > > > On Mon, Mar 18, 2024 at 01:59:52PM +0800, Xuan Zhuo wrote: > > > On Mon, 18 Mar 2024 12:18:23 +0800, Jason Wang > > > wrote: > > >

Re: [PATCH vhost v3 1/4] virtio: find_vqs: pass struct instead of multi parameters

2024-03-20 Thread Jason Wang
On Tue, Mar 19, 2024 at 2:58 PM Michael S. Tsirkin wrote: > > On Mon, Mar 18, 2024 at 01:59:52PM +0800, Xuan Zhuo wrote: > > On Mon, 18 Mar 2024 12:18:23 +0800, Jason Wang wrote: > > > On Fri, Mar 15, 2024 at 3:26 PM Xuan Zhuo > > > wrote: > > > >

Re: [PATCH vhost v3 1/4] virtio: find_vqs: pass struct instead of multi parameters

2024-03-17 Thread Jason Wang
On Fri, Mar 15, 2024 at 3:26 PM Xuan Zhuo wrote: > > On Fri, 15 Mar 2024 11:51:48 +0800, Jason Wang wrote: > > On Thu, Mar 14, 2024 at 2:00 PM Xuan Zhuo > > wrote: > > > > > > On Thu, 14 Mar 2024 11:12:24 +0800, Jason Wang > > > wrote: >

Re: [PATCH vhost v3 1/4] virtio: find_vqs: pass struct instead of multi parameters

2024-03-14 Thread Jason Wang
On Thu, Mar 14, 2024 at 2:00 PM Xuan Zhuo wrote: > > On Thu, 14 Mar 2024 11:12:24 +0800, Jason Wang wrote: > > On Tue, Mar 12, 2024 at 10:10 AM Xuan Zhuo > > wrote: > > > > > > Now, we pass multi parameters to find_vqs. These parameters > >

Re: [PATCH vhost v3 1/4] virtio: find_vqs: pass struct instead of multi parameters

2024-03-13 Thread Jason Wang
On Tue, Mar 12, 2024 at 10:10 AM Xuan Zhuo wrote: > > Now, we pass multi parameters to find_vqs. These parameters > may work for transport or work for vring. > > And find_vqs has multi implements in many places: > > arch/um/drivers/virtio_uml.c > drivers/platform/mellanox/mlxbf-tmfifo.c > drive

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

2024-03-07 Thread Jason Wang
On Thu, Mar 7, 2024 at 4:15 PM Xuan Zhuo wrote: > > On Thu, 7 Mar 2024 13:28:27 +0800, Jason Wang wrote: > > On Wed, Mar 6, 2024 at 6:01 PM Xuan Zhuo wrote: > > > > > > On Thu, 29 Feb 2024 04:34:20 -0500, "Michael S. Tsirkin" > > > wrote: >

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

2024-03-06 Thread Jason Wang
On Wed, Mar 6, 2024 at 6:01 PM Xuan Zhuo wrote: > > On Thu, 29 Feb 2024 04:34:20 -0500, "Michael S. Tsirkin" > wrote: > > On Thu, Feb 29, 2024 at 05:02:37PM +0800, Xuan Zhuo wrote: > > > On Thu, 29 Feb 2024 03:21:14 -0500, "Michael S. Tsirkin" > > > wrote: > > > > On Thu, Feb 29, 2024 at 03:20

Re: [PATCH vhost 17/17] virtio_net: sq support premapped mode

2024-02-01 Thread Jason Wang
On Thu, Feb 1, 2024 at 2:01 PM Xuan Zhuo wrote: > > On Thu, 1 Feb 2024 13:36:46 +0800, Jason Wang wrote: > > On Thu, Feb 1, 2024 at 11:28 AM Xuan Zhuo > > wrote: > > > > > > On Wed, 31 Jan 2024 17:12:47 +0800, Jason Wang > > > wrote: >

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

2024-02-01 Thread Jason Wang
On Thu, Feb 1, 2024 at 2:05 PM Xuan Zhuo wrote: > > On Wed, 31 Jan 2024 17:12:29 +0800, Jason Wang wrote: > > On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo > > wrote: > > > > > > As discussed: > > > http://lore.kernel.org/all/CACGkMEug-=C+VQhkMYSg

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

2024-01-31 Thread Jason Wang
On Wed, Jan 31, 2024 at 5:43 PM Michael S. Tsirkin wrote: > > On Wed, Jan 31, 2024 at 05:12:22PM +0800, Jason Wang wrote: > > I post a patch to store flags unconditionally at: > > > > https://lore.kernel.org/all/20220224122655-mutt-send-email-...@kernel.org/ > > wha

Re: [PATCH vhost 17/17] virtio_net: sq support premapped mode

2024-01-31 Thread Jason Wang
On Thu, Feb 1, 2024 at 11:28 AM Xuan Zhuo wrote: > > On Wed, 31 Jan 2024 17:12:47 +0800, Jason Wang wrote: > > On Tue, Jan 30, 2024 at 7:43 PM Xuan Zhuo > > wrote: > > > > > > If the xsk is enabling, the xsk tx will share the send queue. > > > But

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

2024-01-31 Thread Jason Wang
On Wed, Jan 31, 2024 at 6:01 PM Xuan Zhuo wrote: > > On Wed, 31 Jan 2024 17:12:10 +0800, Jason Wang wrote: > > On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo > > wrote: > > > > > > This commit structure the indirect desc table. > > > Then we c

Re: [PATCH vhost 11/17] virtio_ring: export premapped to driver by struct virtqueue

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:43 PM Xuan Zhuo wrote: > > Export the premapped to drivers, then drivers can check > the vq premapped mode after the find_vqs(). This looks odd, it's the charge of the driver to set premapped, so it should know it? Thanks

Re: [PATCH vhost 17/17] virtio_net: sq support premapped mode

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:43 PM Xuan Zhuo wrote: > > 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_net.c | 1

Re: [PATCH vhost 07/17] virtio: find_vqs: pass struct instead of multi parameters

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > Now, we pass multi parameters to find_vqs. These parameters > may work for transport or work for vring. > > And find_vqs has multi implements in many places: > > But every time, > arch/um/drivers/virtio_uml.c > drivers/platform/mellanox/mlxbf-

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

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 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 08/17] virtio: vring_new_virtqueue(): pass struct instead of multi parameters

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > Just like find_vqs(), it is time to refactor the > vring_new_virtqueue(). We pass the similar struct to > vring_new_virtqueue. > Well, the vring_create_virtqueue() is converted with a structure. We need to be consistent. And it seems better to

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

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > 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

Re: [PATCH vhost 05/17] virtio_ring: split: structure the indirect desc table

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 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 02/17] virtio_ring: packed: remove double check of the unmap ops

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 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 vhost 06/17] virtio_ring: no store dma info when unmap is not needed

2024-01-31 Thread Jason Wang
On Tue, Jan 30, 2024 at 7:42 PM Xuan Zhuo wrote: > > 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 stor

Re: [PATCH vhost 01/17] virtio_ring: introduce vring_need_unmap_buffer

2024-01-31 Thread Jason Wang
ue > 3. truetrue false > > Signed-off-by: Xuan Zhuo Acked-by: Jason Wang Thanks

Re: [PATCH v13 16/42] virtio_ring: split: introduce virtqueue_resize_split()

2022-07-31 Thread Jason Wang
On Mon, Aug 1, 2022 at 2:13 PM Xuan Zhuo wrote: > > On Mon, 1 Aug 2022 12:49:12 +0800, Jason Wang wrote: > > On Thu, Jul 28, 2022 at 7:27 PM Xuan Zhuo > > wrote: > > > > > > On Thu, 28 Jul 2022 17:04:36 +0800, Jason Wang > > > wrote: >

Re: [PATCH v13 16/42] virtio_ring: split: introduce virtqueue_resize_split()

2022-07-31 Thread Jason Wang
On Thu, Jul 28, 2022 at 7:27 PM Xuan Zhuo wrote: > > On Thu, 28 Jul 2022 17:04:36 +0800, Jason Wang wrote: > > On Thu, Jul 28, 2022 at 4:18 PM Xuan Zhuo > > wrote: > > > > > > On Thu, 28 Jul 2022 15:42:50 +0800, Jason Wang > > > wrote: >

Re: [PATCH v13 16/42] virtio_ring: split: introduce virtqueue_resize_split()

2022-07-28 Thread Jason Wang
On Thu, Jul 28, 2022 at 4:18 PM Xuan Zhuo wrote: > > On Thu, 28 Jul 2022 15:42:50 +0800, Jason Wang wrote: > > On Thu, Jul 28, 2022 at 3:24 PM Xuan Zhuo > > wrote: > > > > > > On Thu, 28 Jul 2022 10:38:51 +0800, Jason Wang > > > wrote: >

Re: [PATCH v13 16/42] virtio_ring: split: introduce virtqueue_resize_split()

2022-07-28 Thread Jason Wang
On Thu, Jul 28, 2022 at 3:24 PM Xuan Zhuo wrote: > > On Thu, 28 Jul 2022 10:38:51 +0800, Jason Wang wrote: > > On Wed, Jul 27, 2022 at 3:44 PM Xuan Zhuo > > wrote: > > > > > > On Wed, 27 Jul 2022 11:12:19 +0800, Jason Wang > > > wrote: &g

Re: [PATCH v13 16/42] virtio_ring: split: introduce virtqueue_resize_split()

2022-07-27 Thread Jason Wang
On Wed, Jul 27, 2022 at 3:44 PM Xuan Zhuo wrote: > > On Wed, 27 Jul 2022 11:12:19 +0800, Jason Wang wrote: > > > > 在 2022/7/26 15:21, Xuan Zhuo 写道: > > > virtio ring split supports resize. > > > > > > Only after the new vring is successfully allocate

Re: [PATCH v13 07/42] virtio_ring: split: stop __vring_new_virtqueue as export symbol

2022-07-27 Thread Jason Wang
On Wed, Jul 27, 2022 at 3:36 PM Xuan Zhuo wrote: > > On Wed, 27 Jul 2022 10:58:05 +0800, Jason Wang wrote: > > > > 在 2022/7/26 15:21, Xuan Zhuo 写道: > > > There is currently only one place to reference __vring_new_virtqueue() > > > directly from

Re: [PATCH v13 32/42] virtio_pci: support VIRTIO_F_RING_RESET

2022-07-26 Thread Jason Wang
enable the queue This patch implements virtio_reset_vq(), virtio_enable_resetq() in the pci scenario. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_pci_common.c | 12 +++- drivers/virtio/virtio_pci_modern.c | 88 ++ 2 files changed

Re: [PATCH v13 22/42] virtio_ring: packed: introduce virtqueue_reinit_packed()

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: Introduce a function to initialize vq without allocating new ring, desc_state, desc_extra. Subsequent patches will call this function after reset vq to reinitialize vq. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c

Re: [PATCH v13 21/42] virtio_ring: packed: extract the logic of attach vring

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: Separate the logic of attach vring, the subsequent patch will call it separately. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a

Re: [PATCH v13 20/42] virtio_ring: packed: extract the logic of vring init

2022-07-26 Thread Jason Wang
Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 32590d763c3b..fc4e3db9f93b 100644 --- a/drivers/virtio/virtio_ring.c

Re: [PATCH v13 19/42] virtio_ring: packed: extract the logic of alloc state and extra

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: Separate the logic for alloc desc_state and desc_extra, which will be called separately by subsequent patches. Use struct vring_packed to pass desc_state, desc_extra. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 48

Re: [PATCH v13 18/42] virtio_ring: packed: extract the logic of alloc queue

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: Separate the logic of packed to create vring queue. This feature is required for subsequent virtuqueue reset vring. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 80 +++- 1 file

Re: [PATCH v13 17/42] virtio_ring: packed: introduce vring_free_packed

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: Free the structure struct vring_vritqueue_packed. Subsequent patches require it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers

Re: [PATCH v13 11/42] virtio_ring: split: extract the logic of alloc state and extra

2022-07-26 Thread Jason Wang
在 2022/7/26 15:21, Xuan Zhuo 写道: Separate the logic of creating desc_state, desc_extra, and subsequent patches will call it independently. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 51 +--- 1 file changed, 35

Re: [PATCH v13 10/42] virtio_ring: split: extract the logic of alloc queue

2022-07-26 Thread Jason Wang
在 2022/7/26 15:21, Xuan Zhuo 写道: Separate the logic of split to create vring queue. This feature is required for subsequent virtuqueue reset vring. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 65 ++-- 1 file

Re: [PATCH v13 16/42] virtio_ring: split: introduce virtqueue_resize_split()

2022-07-26 Thread Jason Wang
-initialize(virtqueue_reinit_split()) the virtqueue to ensure that the vring can be used. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 34 ++ 1 file changed, 34 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers

Re: [PATCH v13 08/42] virtio_ring: split: __vring_new_virtqueue() accept struct vring_virtqueue_split

2022-07-26 Thread Jason Wang
在 2022/7/26 15:21, Xuan Zhuo 写道: __vring_new_virtqueue() instead accepts struct vring_virtqueue_split. The purpose of this is to pass more information into __vring_new_virtqueue() to make the code simpler and the structure cleaner. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang

Re: [PATCH v13 07/42] virtio_ring: split: stop __vring_new_virtqueue as export symbol

2022-07-26 Thread Jason Wang
, int num, struct virtio_device *vdev) memset(info->ring, 0, vring_size(num, 4096)); vring_init(&info->vring, num, info->ring, 4096); Let's remove the duplicated vring_init() here. With this removed: Acked-by: Jason Wang - info->vq = __vring_new_virt

Re: [PATCH v12 38/40] virtio_net: support rx queue resize

2022-07-25 Thread Jason Wang
On Mon, Jul 25, 2022 at 3:23 PM Xuan Zhuo wrote: > > On Mon, 25 Jul 2022 14:57:11 +0800, Jason Wang wrote: > > On Mon, Jul 25, 2022 at 2:43 PM Xuan Zhuo > > wrote: > > > > > > On Thu, 21 Jul 2022 17:25:59 +0800, Jason Wang > > > wrote: &g

Re: [PATCH v12 38/40] virtio_net: support rx queue resize

2022-07-24 Thread Jason Wang
On Mon, Jul 25, 2022 at 2:43 PM Xuan Zhuo wrote: > > On Thu, 21 Jul 2022 17:25:59 +0800, Jason Wang wrote: > > > > 在 2022/7/20 11:04, Xuan Zhuo 写道: > > > This patch implements the resize function of the rx queues. > > > Based on this function, it is po

Re: [PATCH v12 39/40] virtio_net: support tx queue resize

2022-07-21 Thread Jason Wang
在 2022/7/20 11:04, Xuan Zhuo 写道: This patch implements the resize function of the tx queues. Based on this function, it is possible to modify the ring num of the queue. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 47

Re: [PATCH v12 38/40] virtio_net: support rx queue resize

2022-07-21 Thread Jason Wang
在 2022/7/20 11:04, Xuan Zhuo 写道: This patch implements the resize function of the rx queues. Based on this function, it is possible to modify the ring num of the queue. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 22 ++ 1 file changed, 22 insertions(+) diff

Re: [PATCH v12 31/40] virtio: find_vqs() add arg sizes

2022-07-21 Thread Jason Wang
, the meaning of size is the largest size, because it may be limited by memory, the virtio core will try a smaller size. And the size is power of 2. Signed-off-by: Xuan Zhuo Acked-by: Hans de Goede Reviewed-by: Mathieu Poirier Acked-by: Jason Wang --- arch/um/drivers/virtio_uml.c

Re: [PATCH v12 22/40] virtio_ring: introduce virtqueue_resize()

2022-07-21 Thread Jason Wang
: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 69 include/linux/virtio.h | 3 ++ 2 files changed, 72 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index b092914e9dcd..cf4379175163

Re: [PATCH v12 30/40] virtio_pci: support VIRTIO_F_RING_RESET

2022-07-21 Thread Jason Wang
在 2022/7/20 11:04, Xuan Zhuo 写道: This patch implements virtio pci support for QUEUE RESET. Performing reset on a queue is divided into these steps: 1. notify the device to reset the queue 2. recycle the buffer submitted 3. reset the vring (may re-alloc) 4. mmap vring to device, and ena

Re: [PATCH v12 27/40] virtio_pci: struct virtio_pci_common_cfg add queue_reset

2022-07-21 Thread Jason Wang
在 2022/7/20 11:04, Xuan Zhuo 写道: Add queue_reset in virtio_pci_common_cfg. https://github.com/oasis-tcs/virtio-spec/issues/124 https://github.com/oasis-tcs/virtio-spec/issues/139 Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- include/linux/virtio_pci_modern.h | 2 +- include

Re: [PATCH v12 26/40] virtio_ring: struct virtqueue introduce reset

2022-07-21 Thread Jason Wang
在 2022/7/20 11:04, Xuan Zhuo 写道: Introduce a new member reset to the structure virtqueue to determine whether the current vq is in the reset state. Subsequent patches will use it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 2 ++ include/linux

Re: [PATCH v12 24/40] virtio: allow to unbreak/break virtqueue individually

2022-07-21 Thread Jason Wang
在 2022/7/20 11:04, Xuan Zhuo 写道: This patch allows the new introduced __virtqueue_break()/__virtqueue_unbreak() to break/unbreak the virtqueue. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 24 include/linux/virtio.h

Re: [PATCH v12 08/40] virtio_ring: split: extract the logic of alloc queue

2022-07-21 Thread Jason Wang
在 2022/7/20 11:04, Xuan Zhuo 写道: Separate the logic of split to create vring queue. This feature is required for subsequent virtuqueue reset vring. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 68 ++-- 1 file changed, 42 insertions(+), 26 dele

Re: [PATCH v12 07/40] virtio_ring: split: introduce vring_free_split()

2022-07-21 Thread Jason Wang
在 2022/7/20 11:04, Xuan Zhuo 写道: Free the structure struct vring_vritqueue_split. Subsequent patches require it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/virtio

Re: [PATCH v12 06/40] virtio_ring: introduce virtqueue_init()

2022-07-21 Thread Jason Wang
在 2022/7/20 11:04, Xuan Zhuo 写道: Separate the logic of virtqueue initialization. This logic is irrelevant to ring layout. This logic can be called independently when implementing resize/reset later. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 61

Re: [PATCH v12 02/40] virtio: struct virtio_config_ops add callbacks for queue_reset

2022-07-20 Thread Jason Wang
the queue In order to support queue reset, add two callbacks in struct virtio_config_ops to implement steps 1 and 4. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- include/linux/virtio_config.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/include/linux

Re: [PATCH v12 01/40] virtio: record the maximum queue num supported by the device.

2022-07-20 Thread Jason Wang
: Jason Wang --- arch/um/drivers/virtio_uml.c | 1 + drivers/platform/mellanox/mlxbf-tmfifo.c | 2 ++ drivers/remoteproc/remoteproc_virtio.c | 2 ++ drivers/s390/virtio/virtio_ccw.c | 3 +++ drivers/virtio/virtio_mmio.c | 2 ++ drivers/virtio

[PATCH] um: Fix comment typo

2022-07-18 Thread Jason Wang
The double `in' is duplicated in line 172, remove one. Signed-off-by: Jason Wang --- arch/um/kernel/physmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index e7c7b53a1435..91485119ae67 100644 --- a/arch/um/k

Re: [PATCH v11 39/40] virtio_net: support tx queue resize

2022-07-18 Thread Jason Wang
On Fri, Jul 15, 2022 at 4:32 PM Xuan Zhuo wrote: > > On Fri, 8 Jul 2022 14:23:57 +0800, Jason Wang wrote: > > On Tue, Jul 5, 2022 at 10:01 AM Xuan Zhuo > > wrote: > > > > > > On Mon, 4 Jul 2022 11:45:52 +0800, Jason Wang wrote: > > > > > &g

Re: [PATCH v11 38/40] virtio_net: support rx queue resize

2022-07-18 Thread Jason Wang
On Fri, Jul 15, 2022 at 4:37 PM Xuan Zhuo wrote: > > On Fri, 8 Jul 2022 14:20:52 +0800, Jason Wang wrote: > > On Tue, Jul 5, 2022 at 10:00 AM Xuan Zhuo > > wrote: > > > > > > On Mon, 4 Jul 2022 11:44:12 +0800, Jason Wang wrote: > > > > > &g

Re: [PATCH v11 39/40] virtio_net: support tx queue resize

2022-07-07 Thread Jason Wang
On Tue, Jul 5, 2022 at 10:01 AM Xuan Zhuo wrote: > > On Mon, 4 Jul 2022 11:45:52 +0800, Jason Wang wrote: > > > > 在 2022/6/29 14:56, Xuan Zhuo 写道: > > > This patch implements the resize function of the tx queues. > > > Based on this function, it is po

Re: [PATCH v11 38/40] virtio_net: support rx queue resize

2022-07-07 Thread Jason Wang
On Tue, Jul 5, 2022 at 10:00 AM Xuan Zhuo wrote: > > On Mon, 4 Jul 2022 11:44:12 +0800, Jason Wang wrote: > > > > 在 2022/6/29 14:56, Xuan Zhuo 写道: > > > This patch implements the resize function of the rx queues. > > > Based on this function, it is po

Re: [PATCH v11 21/40] virtio_ring: packed: introduce virtqueue_resize_packed()

2022-07-03 Thread Jason Wang
在 2022/7/4 10:13, Xuan Zhuo 写道: On Fri, 1 Jul 2022 17:27:48 +0800, Jason Wang wrote: 在 2022/6/29 14:56, Xuan Zhuo 写道: virtio ring packed supports resize. Only after the new vring is successfully allocated based on the new num, we will release the old vring. In any case, an error is returned

Re: [PATCH v11 08/40] virtio_ring: split: extract the logic of alloc queue

2022-07-03 Thread Jason Wang
在 2022/7/1 16:45, Xuan Zhuo 写道: On Fri, 1 Jul 2022 16:26:25 +0800, Jason Wang wrote: 在 2022/6/29 14:56, Xuan Zhuo 写道: Separate the logic of split to create vring queue. This feature is required for subsequent virtuqueue reset vring. Signed-off-by: Xuan Zhuo --- drivers/virtio

Re: [PATCH v11 25/40] virtio: allow to unbreak/break virtqueue individually

2022-07-03 Thread Jason Wang
在 2022/7/1 17:36, Jason Wang 写道: 在 2022/7/1 14:31, Michael S. Tsirkin 写道: On Wed, Jun 29, 2022 at 02:56:41PM +0800, Xuan Zhuo wrote: This patch allows the new introduced __virtqueue_break()/__virtqueue_unbreak() to break/unbreak the virtqueue. Signed-off-by: Xuan Zhuo I wonder how this

Re: [PATCH v11 39/40] virtio_net: support tx queue resize

2022-07-03 Thread Jason Wang
在 2022/6/29 14:56, Xuan Zhuo 写道: This patch implements the resize function of the tx queues. Based on this function, it is possible to modify the ring num of the queue. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 48 1 file changed, 48 in

Re: [PATCH v11 38/40] virtio_net: support rx queue resize

2022-07-03 Thread Jason Wang
在 2022/6/29 14:56, Xuan Zhuo 写道: This patch implements the resize function of the rx queues. Based on this function, it is possible to modify the ring num of the queue. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 22 ++ 1 file changed, 22 insertions(+) diff

Re: [PATCH v11 30/40] virtio_pci: support VIRTIO_F_RING_RESET

2022-07-03 Thread Jason Wang
在 2022/6/29 14:56, Xuan Zhuo 写道: This patch implements virtio pci support for QUEUE RESET. Performing reset on a queue is divided into these steps: 1. notify the device to reset the queue 2. recycle the buffer submitted 3. reset the vring (may re-alloc) 4. mmap vring to device, and ena

Re: [PATCH v11 28/40] virtio_pci: introduce helper to get/set queue reset

2022-07-01 Thread Jason Wang
在 2022/6/29 14:56, Xuan Zhuo 写道: Introduce new helpers to implement queue reset and get queue reset status. https://github.com/oasis-tcs/virtio-spec/issues/124 https://github.com/oasis-tcs/virtio-spec/issues/139 Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio

Re: [PATCH v11 25/40] virtio: allow to unbreak/break virtqueue individually

2022-07-01 Thread Jason Wang
在 2022/7/1 14:31, Michael S. Tsirkin 写道: On Wed, Jun 29, 2022 at 02:56:41PM +0800, Xuan Zhuo wrote: This patch allows the new introduced __virtqueue_break()/__virtqueue_unbreak() to break/unbreak the virtqueue. Signed-off-by: Xuan Zhuo I wonder how this interacts with the hardening patches.

Re: [PATCH v11 24/40] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-07-01 Thread Jason Wang
在 2022/6/29 14:56, Xuan Zhuo 写道: Add queue_notify_data in struct virtio_pci_common_cfg, which comes from here https://github.com/oasis-tcs/virtio-spec/issues/89 Since I want to add queue_reset after queue_notify_data, I submitted this patch first. Signed-off-by: Xuan Zhuo Acked-by: Jason

Re: [PATCH v11 23/40] virtio_pci: move struct virtio_pci_common_cfg to virtio_pci_modern.h

2022-07-01 Thread Jason Wang
在 2022/6/29 14:56, Xuan Zhuo 写道: In order to facilitate the expansion of virtio_pci_common_cfg in the future, move it from uapi to virtio_pci_modern.h. In this way, we can freely expand virtio_pci_common_cfg in the future. Other projects using virtio_pci_common_cfg in uapi need to maintain a se

Re: [PATCH v11 22/40] virtio_ring: introduce virtqueue_resize()

2022-07-01 Thread Jason Wang
在 2022/6/29 14:56, Xuan Zhuo 写道: Introduce virtqueue_resize() to implement the resize of vring. Based on these, the driver can dynamically adjust the size of the vring. For example: ethtool -G. virtqueue_resize() implements resize based on the vq reset function. In case of failure to allocate a

Re: [PATCH v11 21/40] virtio_ring: packed: introduce virtqueue_resize_packed()

2022-07-01 Thread Jason Wang
在 2022/6/29 14:56, Xuan Zhuo 写道: virtio ring packed supports resize. Only after the new vring is successfully allocated based on the new num, we will release the old vring. In any case, an error is returned, indicating that the vring still points to the old vring. In the case of an error, re-i

Re: [PATCH v11 14/40] virtio_ring: split: introduce virtqueue_resize_split()

2022-07-01 Thread Jason Wang
vq->split.may_reduce_num); + if (err) + goto err; It's better to have decouple the allocation future more to avoid any rewind here in the future. But the patch should be fine. So Acked-by: Jason Wang + + err = vring_alloc_state_extra_split(&v

Re: [PATCH v11 13/40] virtio_ring: split: reserve vring_align, may_reduce_num

2022-07-01 Thread Jason Wang
在 2022/6/29 14:56, Xuan Zhuo 写道: In vring_create_virtqueue_split() save vring_align, may_reduce_num to structure vring_virtqueue_split. Used to create a new vring when implementing resize . Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 9

Re: [PATCH v11 11/40] virtio_ring: split: extract the logic of vring init

2022-07-01 Thread Jason Wang
Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 9025bd373d3b..35540daaa1e7 100644 --- a/drivers/virtio

Re: [PATCH v11 10/40] virtio_ring: split: extract the logic of attach vring

2022-07-01 Thread Jason Wang
s assignment for queue_dma_addr/queue_size_in_bytes can keep the same as the original code. On the other hand, subsequent patches can use the "struct vring_virtqueue_split split" obtained by vring_alloc_queue_split() to directly complete the attach operation. Signed-off-by: Xuan Zhu

Re: [PATCH v11 09/40] virtio_ring: split: extract the logic of alloc state and extra

2022-07-01 Thread Jason Wang
在 2022/6/29 14:56, Xuan Zhuo 写道: Separate the logic of creating desc_state, desc_extra, and subsequent patches will call it independently. Since only the structure vring is passed into __vring_new_virtqueue(), when creating the function vring_alloc_state_extra_split(), we prefer to use vring_vi

Re: [PATCH v11 08/40] virtio_ring: split: extract the logic of alloc queue

2022-07-01 Thread Jason Wang
在 2022/6/29 14:56, Xuan Zhuo 写道: Separate the logic of split to create vring queue. This feature is required for subsequent virtuqueue reset vring. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 68 ++-- 1 file changed, 42 insertions(+), 26 dele

Re: [PATCH v11 05/40] virtio_ring: split vring_virtqueue

2022-06-29 Thread Jason Wang
by: Xuan Zhuo Acked-by: Jason Wang > --- > drivers/virtio/virtio_ring.c | 116 ++- > 1 file changed, 60 insertions(+), 56 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index bb4e8ae09c9b..2806e033a651 1

Re: [PATCH v11 02/40] virtio: struct virtio_config_ops add callbacks for queue_reset

2022-06-29 Thread Jason Wang
On Wed, Jun 29, 2022 at 2:57 PM Xuan Zhuo wrote: > > reset can be divided into the following four steps (example): > 1. transport: notify the device to reset the queue > 2. vring: recycle the buffer submitted > 3. vring: reset/resize the vring (may re-alloc) > 4. transport: mmap vring

Re: [PATCH v11 01/40] virtio: add helper virtqueue_get_vring_max_size()

2022-06-29 Thread Jason Wang
On Wed, Jun 29, 2022 at 2:57 PM Xuan Zhuo wrote: > > Record the maximum queue num supported by the device. > > virtio-net can display the maximum (supported by hardware) ring size in > ethtool -g eth0. > > When the subsequent patch implements vring reset, it can judge whether > the ring size passe

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Jason Wang
On Tue, Jun 28, 2022 at 2:10 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 02:07:28PM +0800, Jason Wang wrote: > > On Tue, Jun 28, 2022 at 1:46 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Jun 28, 2022 at 11:50:37AM +0800, Jason Wang wrote: > >

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Jason Wang
On Tue, Jun 28, 2022 at 1:46 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 11:50:37AM +0800, Jason Wang wrote: > > On Mon, Jun 27, 2022 at 7:53 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Jun 27, 2022 at 04:14:20PM +0800, Jason Wang wrote: > >

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Jason Wang
On Mon, Jun 27, 2022 at 7:53 PM Michael S. Tsirkin wrote: > > On Mon, Jun 27, 2022 at 04:14:20PM +0800, Jason Wang wrote: > > On Mon, Jun 27, 2022 at 3:58 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Jun 27, 2022 at 03:45:30PM +0800, Jason Wang wrote: > >

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Jason Wang
On Mon, Jun 27, 2022 at 3:58 PM Michael S. Tsirkin wrote: > > On Mon, Jun 27, 2022 at 03:45:30PM +0800, Jason Wang wrote: > > On Mon, Jun 27, 2022 at 2:39 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Jun 27, 2022 at 10:30:42AM +0800, Jason Wang wrote: > >

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Jason Wang
On Mon, Jun 27, 2022 at 2:39 PM Michael S. Tsirkin wrote: > > On Mon, Jun 27, 2022 at 10:30:42AM +0800, Jason Wang wrote: > > On Fri, Jun 24, 2022 at 2:59 PM Michael S. Tsirkin wrote: > > > > > > On Fri, Jun 24, 2022 at 10:56:05AM +0800, Xuan Zhuo wrote: > >

  1   2   >