From: "Michael S. Tsirkin" <mst@redhat.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: Jason Wang <jasowang@redhat.com>,
virtualization@lists.linux-foundation.org,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
netdev@vger.kernel.org, bpf@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH vhost v13 05/12] virtio_ring: introduce virtqueue_dma_dev()
Date: Mon, 14 Aug 2023 07:24:59 -0400 [thread overview]
Message-ID: <20230814072350-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <1692003413.6339955-1-xuanzhuo@linux.alibaba.com>
On Mon, Aug 14, 2023 at 04:56:53PM +0800, Xuan Zhuo wrote:
> On Mon, 14 Aug 2023 11:05:49 +0800, Jason Wang <jasowang@redhat.com> wrote:
> > On Thu, Aug 10, 2023 at 8:31 PM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
> > >
> > > Added virtqueue_dma_dev() to get DMA device for virtio. Then the
> > > caller can do dma operation in advance. The purpose is to keep memory
> > > mapped across multiple add/get buf operations.
> > >
> > > Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> > > Acked-by: Jason Wang <jasowang@redhat.com>
> >
> > So I think we don't have actual users for this in this series? Can we
> > simply have another independent patch for this?
>
> I am ok. I will remove this from the next version.
>
> But I also help merge this to 6.6. Then we can let the virtio-net to support
> AF_XDP in 6.7+.
Is there going to be a next version? Because if yes it will be too late for the next release.
if all you want to do is drop this patch then just say so, no need
for another version.
>
> >
> > > ---
> > > drivers/virtio/virtio_ring.c | 17 +++++++++++++++++
> > > include/linux/virtio.h | 2 ++
> > > 2 files changed, 19 insertions(+)
> > >
> > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> > > index f9f772e85a38..bb3d73d221cd 100644
> > > --- a/drivers/virtio/virtio_ring.c
> > > +++ b/drivers/virtio/virtio_ring.c
> > > @@ -2265,6 +2265,23 @@ int virtqueue_add_inbuf_ctx(struct virtqueue *vq,
> > > }
> > > EXPORT_SYMBOL_GPL(virtqueue_add_inbuf_ctx);
> > >
> > > +/**
> > > + * virtqueue_dma_dev - get the dma dev
> > > + * @_vq: the struct virtqueue we're talking about.
> > > + *
> > > + * Returns the dma dev. That can been used for dma api.
> > > + */
> > > +struct device *virtqueue_dma_dev(struct virtqueue *_vq)
> > > +{
> > > + struct vring_virtqueue *vq = to_vvq(_vq);
> > > +
> > > + if (vq->use_dma_api)
> > > + return vring_dma_dev(vq);
> > > + else
> > > + return NULL;
> > > +}
> > > +EXPORT_SYMBOL_GPL(virtqueue_dma_dev);
> >
> > One possible concern is that exporting things like NULL may result in
> > the switch in the caller (driver). I wonder if it's better to do
> > BUG_ON() in the path of NULL?
>
>
> I agree.
>
> But we need a new helper to tell the driver(or AF_XDP) that the device support
> ACCESS_PLATFORM or not.
>
> We need a switch, but we can make the switch is irrelevant to the DMA.
>
> Thanks.
>
>
>
> >
> > Thanks
> >
> > > +
> > > /**
> > > * virtqueue_kick_prepare - first half of split virtqueue_kick call.
> > > * @_vq: the struct virtqueue
> > > diff --git a/include/linux/virtio.h b/include/linux/virtio.h
> > > index 8add38038877..bd55a05eec04 100644
> > > --- a/include/linux/virtio.h
> > > +++ b/include/linux/virtio.h
> > > @@ -61,6 +61,8 @@ int virtqueue_add_sgs(struct virtqueue *vq,
> > > void *data,
> > > gfp_t gfp);
> > >
> > > +struct device *virtqueue_dma_dev(struct virtqueue *vq);
> > > +
> > > bool virtqueue_kick(struct virtqueue *vq);
> > >
> > > bool virtqueue_kick_prepare(struct virtqueue *vq);
> > > --
> > > 2.32.0.3.g01195cf9f
> > >
> >
next prev parent reply other threads:[~2023-08-14 11:25 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-10 12:30 [PATCH vhost v13 00/12] virtio core prepares for AF_XDP Xuan Zhuo
2023-08-10 12:30 ` [PATCH vhost v13 01/12] virtio_ring: check use_dma_api before unmap desc for indirect Xuan Zhuo
2023-08-10 12:30 ` [PATCH vhost v13 02/12] virtio_ring: put mapping error check in vring_map_one_sg Xuan Zhuo
2023-08-10 12:30 ` [PATCH vhost v13 03/12] virtio_ring: introduce virtqueue_set_dma_premapped() Xuan Zhuo
2023-08-10 12:30 ` [PATCH vhost v13 04/12] virtio_ring: support add premapped buf Xuan Zhuo
2024-06-04 16:07 ` Ilya Leoshkevich
2024-06-04 16:17 ` Alexander Potapenko
2024-06-05 16:02 ` Ilya Leoshkevich
2024-06-06 3:23 ` Xuan Zhuo
[not found] ` <CAG_fn=UsqAhH57s08+prkj2iJshhxuLznzDNft4dPXHKX9V72Q@mail.gmail.com>
2024-06-06 8:24 ` Xuan Zhuo
2024-06-06 9:49 ` Alexander Potapenko
2024-06-06 8:26 ` Alexander Potapenko
2023-08-10 12:30 ` [PATCH vhost v13 05/12] virtio_ring: introduce virtqueue_dma_dev() Xuan Zhuo
2023-08-14 3:05 ` Jason Wang
2023-08-14 8:56 ` Xuan Zhuo
2023-08-14 11:24 ` Michael S. Tsirkin [this message]
2023-08-14 11:55 ` Xuan Zhuo
2023-08-15 6:30 ` Xuan Zhuo
2023-08-15 7:50 ` Jason Wang
2023-08-15 9:27 ` Xuan Zhuo
2023-08-16 1:13 ` Jason Wang
2023-08-16 2:08 ` Xuan Zhuo
2023-08-16 2:19 ` Jason Wang
2023-08-16 2:21 ` Xuan Zhuo
2023-08-16 2:33 ` Jason Wang
2023-08-16 3:22 ` Xuan Zhuo
2023-08-15 11:57 ` Michael S. Tsirkin
2023-08-10 12:30 ` [PATCH vhost v13 06/12] virtio_ring: skip unmap for premapped Xuan Zhuo
2023-08-10 12:30 ` [PATCH vhost v13 07/12] virtio_ring: correct the expression of the description of virtqueue_resize() Xuan Zhuo
2023-08-10 12:30 ` [PATCH vhost v13 08/12] virtio_ring: separate the logic of reset/enable from virtqueue_resize Xuan Zhuo
2023-08-10 12:30 ` [PATCH vhost v13 09/12] virtio_ring: introduce virtqueue_reset() Xuan Zhuo
2023-08-10 12:30 ` [PATCH vhost v13 10/12] virtio_ring: introduce dma map api for virtqueue Xuan Zhuo
2023-08-10 12:30 ` [PATCH vhost v13 11/12] virtio_ring: introduce dma sync " Xuan Zhuo
2023-11-30 9:45 ` Michael S. Tsirkin
2023-11-30 9:49 ` Xuan Zhuo
2023-11-30 10:10 ` Michael S. Tsirkin
2023-11-30 10:15 ` Xuan Zhuo
2023-08-10 12:30 ` [PATCH vhost v13 12/12] virtio_net: merge dma operations when filling mergeable buffers Xuan Zhuo
2023-09-26 16:01 ` Michael S. Tsirkin
2023-09-27 1:50 ` Xuan Zhuo
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=20230814072350-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=hch@infradead.org \
--cc=jasowang@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=xuanzhuo@linux.alibaba.com \
/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).