[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACGkMEsRmkaBiU2WCQTepayhrhR18M1+bDQJXxTVxOUDG4sZyg@mail.gmail.com>
Date: Tue, 21 Oct 2025 11:36:12 +0800
From: Jason Wang <jasowang@...hat.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: xuanzhuo@...ux.alibaba.com, eperezma@...hat.com,
virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V8 18/19] virtio_ring: factor out split detaching logic
On Mon, Oct 20, 2025 at 11:18 PM Michael S. Tsirkin <mst@...hat.com> wrote:
>
> On Mon, Oct 20, 2025 at 03:10:02PM +0800, Jason Wang wrote:
> > This patch factors out the split core detaching logic that could be
> > reused by in order feature into a dedicated function.
> >
> > Acked-by: Eugenio Pérez <eperezma@...hat.com>
> > Reviewed-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> > Signed-off-by: Jason Wang <jasowang@...hat.com>
> > ---
> > drivers/virtio/virtio_ring.c | 18 ++++++++++++++----
> > 1 file changed, 14 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> > index 0f07a6637acb..96d7f165ec88 100644
> > --- a/drivers/virtio/virtio_ring.c
> > +++ b/drivers/virtio/virtio_ring.c
> > @@ -802,8 +802,9 @@ static void detach_indirect_split(struct vring_virtqueue *vq,
> > vq->split.desc_state[head].indir_desc = NULL;
> > }
> >
> > -static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
> > - void **ctx)
> > +static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
> > + unsigned int head,
> > + void **ctx)
>
>
> Well not really _inorder, right? This is a common function.
Yes, but inorder is a subset for ooo so I use this name.
> You want to call it __detach_buf_split or something maybe.
>
> Additionally the very first line in there is:
>
> __virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
>
> and the byte swap is not needed for inorder.
I don't see why?
> you could just do __cpu_to_virtio16(true, VRING_DESC_F_NEXT)
Probably you mean a leftover for hardening? E.g should we check
desc_extra.flag instead of desc.flag here?
while (vq->split.vring.desc[i].flags & nextflag) {
vring_unmap_one_split(vq, &extra[i]);
i = vq->split.desc_extra[i].next;
vq->vq.num_free++;
}
Thanks
Powered by blists - more mailing lists