From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
To: Jason Wang <jasowang@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Magnus Karlsson <magnus.karlsson@intel.com>,
virtualization <virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH 0/6] virtio: support advance DMA
Date: Tue, 11 Jan 2022 14:17:22 +0800 [thread overview]
Message-ID: <1641881842.1001978-2-xuanzhuo@linux.alibaba.com> (raw)
In-Reply-To: <CACGkMEshgEO3GBezLVo1t1hQHN00e2rZbsXhDfq4-dANc-CXEA@mail.gmail.com>
On Tue, 11 Jan 2022 10:54:45 +0800, Jason Wang <jasowang@redhat.com> wrote:
> On Mon, Jan 10, 2022 at 5:59 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Fri, Jan 07, 2022 at 02:33:00PM +0800, Xuan Zhuo wrote:
> > > virtqueue_add() only supports virtual addresses, dma is completed in
> > > virtqueue_add().
> > >
> > > In some scenarios (such as the AF_XDP scenario), DMA is completed in advance, so
> > > it is necessary for us to support passing the DMA address to virtqueue_add().
> > >
> > > This patch set stipulates that if sg->dma_address is not NULL, use this
> > > address as the DMA address. And record this information in extra->flags,
> > > which can be skipped when executing dma unmap.
> > >
> > > extra->flags |= VRING_DESC_F_PREDMA;
> > >
> > > But the indirect desc does not have a corresponding extra, so the second and
> > > third patches of this patch set are to allocate the corresponding extra while
> > > allocating the indirect desc. Each desc must have a corresponding extra because
> > > it is possible in an sgs some are advance DMA, while others are virtual
> > > addresses. So we must allocate an extra for each indirect desc.
> >
> >
> > I didn't realize AF_XDP didn't have space to stuff the header into.
> > Jason, is that expected?
>
> I might be wrong but it looks to me AF_XDP allows to reserve
> sufficient headroom via xdp_umem_reg_v1.
>
I understand that there is a headroom for receiving packages, which can be used
to put virtio headers. But there is no headroom defined in the direction of
sending packages. I hope Magnus Karlsson can help confirm whether there is any
misunderstanding.
It would be best if we could not use indirect.
Thanks.
> > It would be best to fix that, performance is
> > best if header is linear with the data ...
>
> This looks like a must otherwise we may meet trouble in zerocopy receive.
>
> Thanks
>
> > Or maybe we can reduce the use of indirect somewhat, at least while
> > the ring is mostly empty?
> >
> > > Xuan Zhuo (6):
> > > virtio: rename vring_unmap_state_packed() to
> > > vring_unmap_extra_packed()
> > > virtio: split: alloc indirect desc with extra
> > > virtio: packed: alloc indirect desc with extra
> > > virtio: split: virtqueue_add_split() support dma address
> > > virtio: packed: virtqueue_add_packed() support dma address
> > > virtio: add api virtio_dma_map() for advance dma
> > >
> > > drivers/virtio/virtio_ring.c | 387 ++++++++++++++++++++---------------
> > > include/linux/virtio.h | 9 +
> > > 2 files changed, 232 insertions(+), 164 deletions(-)
> > >
> > > --
> > > 2.31.0
> >
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
prev parent reply other threads:[~2022-01-11 6:28 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 6:33 [PATCH 0/6] virtio: support advance DMA Xuan Zhuo
2022-01-07 6:33 ` [PATCH 1/6] virtio: rename vring_unmap_state_packed() to vring_unmap_extra_packed() Xuan Zhuo
2022-01-10 6:19 ` Jason Wang
2022-01-07 6:33 ` [PATCH 2/6] virtio: split: alloc indirect desc with extra Xuan Zhuo
2022-01-10 6:43 ` Jason Wang
2022-01-10 7:19 ` Xuan Zhuo
2022-01-10 7:41 ` Jason Wang
2022-01-10 7:52 ` Xuan Zhuo
2022-01-10 8:54 ` Jason Wang
2022-01-10 9:23 ` Xuan Zhuo
2022-01-10 9:49 ` Michael S. Tsirkin
2022-01-10 9:58 ` Xuan Zhuo
2022-01-10 10:06 ` Michael S. Tsirkin
2022-01-11 2:44 ` Jason Wang
2022-01-11 5:57 ` Xuan Zhuo
2022-01-07 6:33 ` [PATCH 3/6] virtio: packed: " Xuan Zhuo
2022-01-07 6:33 ` [PATCH 4/6] virtio: split: virtqueue_add_split() support dma address Xuan Zhuo
2022-01-10 6:45 ` Jason Wang
2022-01-10 7:24 ` Xuan Zhuo
2022-01-07 6:33 ` [PATCH 5/6] virtio: packed: virtqueue_add_packed() " Xuan Zhuo
2022-01-07 6:33 ` [PATCH 6/6] virtio: add api virtio_dma_map() for advance dma Xuan Zhuo
2022-01-10 7:12 ` Michael S. Tsirkin
2022-01-10 7:24 ` Xuan Zhuo
2022-01-10 9:59 ` [PATCH 0/6] virtio: support advance DMA Michael S. Tsirkin
2022-01-11 2:54 ` Jason Wang
2022-01-11 6:17 ` Xuan Zhuo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1641881842.1001978-2-xuanzhuo@linux.alibaba.com \
--to=xuanzhuo@linux.alibaba.com \
--cc=jasowang@redhat.com \
--cc=magnus.karlsson@intel.com \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).