[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACGkMEv08s6vt7r218rQ1_oAppGWRnsMZBzULFX8zMiMi8e6kA@mail.gmail.com>
Date: Fri, 29 Mar 2024 11:16:35 +0800
From: Jason Wang <jasowang@...hat.com>
To: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Cc: virtualization@...ts.linux.dev, "Michael S. Tsirkin" <mst@...hat.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org
Subject: Re: [PATCH vhost v6 06/10] virtio_ring: no store dma info when unmap
is not needed
On Thu, Mar 28, 2024 at 3:42 PM Xuan Zhuo <xuanzhuo@...ux.alibaba.com> wrote:
>
> On Thu, 28 Mar 2024 15:06:33 +0800, Jason Wang <jasowang@...hat.com> wrote:
> > On Wed, Mar 27, 2024 at 7:14 PM Xuan Zhuo <xuanzhuo@...ux.alibaba.com> wrote:
> > >
> > > As discussed:
> > > http://lore.kernel.org/all/CACGkMEug-=C+VQhkMYSgUKMC==04m7-uem_yC21bgGkKZh845w@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 dma
> > > info.
> > >
> > > If the use_dma_api is false, the memory is also not allocated.
> > >
> > > Signed-off-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> > > ---
> > > drivers/virtio/virtio_ring.c | 120 ++++++++++++++++++++++++++++-------
> > > 1 file changed, 97 insertions(+), 23 deletions(-)
> > >
> > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> > > index 1f7c96543d58..08e4f6e1d722 100644
> > > --- a/drivers/virtio/virtio_ring.c
> > > +++ b/drivers/virtio/virtio_ring.c
> > > @@ -69,23 +69,26 @@
> > >
> > > struct vring_desc_state_split {
> > > void *data; /* Data for callback. */
> > > - struct vring_desc_extra *indir_desc; /* Indirect descriptor, if any. */
> > > + struct vring_desc_dma *indir_desc; /* Indirect descriptor, if any. */
> > > };
> > >
> > > struct vring_desc_state_packed {
> > > void *data; /* Data for callback. */
> > > - struct vring_desc_extra *indir_desc; /* Indirect descriptor, if any. */
> > > + struct vring_desc_dma *indir_desc; /* Indirect descriptor, if any. */
> > > u16 num; /* Descriptor list length. */
> > > u16 last; /* The last desc state in a list. */
> > > };
> > >
> > > struct vring_desc_extra {
> > > - dma_addr_t addr; /* Descriptor DMA addr. */
> > > - u32 len; /* Descriptor length. */
> > > u16 flags; /* Descriptor flags. */
> > > u16 next; /* The next desc state in a list. */
> > > };
> > >
> > > +struct vring_desc_dma {
> > > + dma_addr_t addr; /* Descriptor DMA addr. */
> > > + u32 len; /* Descriptor length. */
> >
> > This seems to be odd, flag should be part of dma info.
>
> flags contains F_NEXT, that is used by detach when no dma info.
Right, so it is needed for hardening.
>
> >
> > To reduce the changeset, I would split out next.
>
> Do you mean split this patch set?
No, then this patch looks ok.
Thanks
>
> Thanks
>
>
>
> >
> > Thank
> >
>
Powered by blists - more mailing lists