lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACGkMEupNSQAaH6y6mcZV2BwdYh2fpCzb_JQXn+7CWOo0z8SmA@mail.gmail.com>
Date: Mon, 29 Dec 2025 15:16:47 +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 V11 14/19] virtio_ring: determine descriptor flags at one time

On Sat, Dec 27, 2025 at 3:33 AM Michael S. Tsirkin <mst@...hat.com> wrote:
>
> On Thu, Dec 25, 2025 at 12:26:03PM +0800, Jason Wang wrote:
> > Let's determine the last descriptor by counting the number of sg. This
> > would be consistent with packed virtqueue implementation and ease the
> > future in-order implementation.
> >
> > 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 | 28 +++++++++++++---------------
> >  1 file changed, 13 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> > index 4e905dc7b6cb..dbcd6f26df7d 100644
> > --- a/drivers/virtio/virtio_ring.c
> > +++ b/drivers/virtio/virtio_ring.c
> > @@ -575,7 +575,7 @@ static inline int virtqueue_add_split(struct vring_virtqueue *vq,
> >       struct vring_desc_extra *extra;
> >       struct scatterlist *sg;
> >       struct vring_desc *desc;
> > -     unsigned int i, n, avail, descs_used, prev, err_idx;
> > +     unsigned int i, n, avail, descs_used, err_idx, sg_count = 0;
> >       int head;
> >       bool indirect;
> >
> > @@ -635,42 +635,40 @@ static inline int virtqueue_add_split(struct vring_virtqueue *vq,
> >               for (sg = sgs[n]; sg; sg = sg_next(sg)) {
> >                       dma_addr_t addr;
> >                       u32 len;
> > +                     u16 flags = 0;
> > +
> > +                     if (++sg_count != total_sg)
> > +                             flags |= VRING_DESC_F_NEXT;
> >
> >                       if (vring_map_one_sg(vq, sg, DMA_TO_DEVICE, &addr, &len, premapped))
> >                               goto unmap_release;
> >
> > -                     prev = i;
> >                       /* Note that we trust indirect descriptor
> >                        * table since it use stream DMA mapping.
> >                        */
> > -                     i = virtqueue_add_desc_split(vq, desc, extra, i, addr, len,
> > -                                                  VRING_DESC_F_NEXT,
> > -                                                  premapped);
> > +                     i = virtqueue_add_desc_split(vq, desc, extra, i, addr,
> > +                                                  len, flags ,premapped);
>
> coding style violation.
>

Fixed.

Thanks


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ