From: Jason Wang <jasowang@redhat.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: virtualization@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH vhost v6 09/10] virtio_net: set premapped mode by find_vqs()
Date: Mon, 8 Apr 2024 13:01:56 +0800 [thread overview]
Message-ID: <CACGkMEvPy+5_x24MCn8xbSyEkhFG8iz=XQ9gpoHO5y49ORsQKA@mail.gmail.com> (raw)
In-Reply-To: <1712469641.4145665-1-xuanzhuo@linux.alibaba.com>
On Sun, Apr 7, 2024 at 2:03 PM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
>
> On Sun, 7 Apr 2024 12:24:00 +0800, Jason Wang <jasowang@redhat.com> wrote:
> > On Mon, Apr 1, 2024 at 11:10 AM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
> > >
> > > On Mon, 1 Apr 2024 09:40:07 +0800, Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
> > > > On Fri, 29 Mar 2024 11:20:08 +0800, Jason Wang <jasowang@redhat.com> wrote:
> > > > > On Thu, Mar 28, 2024 at 4:27 PM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
> > > > > >
> > > > > > On Thu, 28 Mar 2024 16:05:02 +0800, Jason Wang <jasowang@redhat.com> wrote:
> > > > > > > On Wed, Mar 27, 2024 at 7:14 PM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
> > > > > > > >
> > > > > > > > Now, the virtio core can set the premapped mode by find_vqs().
> > > > > > > > If the premapped can be enabled, the dma array will not be
> > > > > > > > allocated. So virtio-net use the api of find_vqs to enable the
> > > > > > > > premapped.
> > > > > > > >
> > > > > > > > Judge the premapped mode by the vq->premapped instead of saving
> > > > > > > > local variable.
> > > > > > > >
> > > > > > > > Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> > > > > > > > ---
> > > > > > >
> > > > > > > I wonder what's the reason to keep a fallback when premapped is not enabled?
> > > > > >
> > > > > > Rethink this.
> > > > > >
> > > > > > I think you are right. We can remove the fallback.
> > > > > >
> > > > > > Because we have the virtio dma apis that wrap all the cases.
> > > > > > So I will remove the fallback from the virtio-net in next version.
> > > > >
> > > > > Ok.
> > > > >
> > > > > >
> > > > > > But we still need to export the premapped to the drivers.
> > > > > > Because we can enable the AF_XDP only when premapped is true.
> > > > >
> > > > > I may miss something but it should work like
> > > > >
> > > > > enable AF_XDP -> enable remapping
> > > > >
> > > > > So can we fail during remapping enablement?
> > > >
> > > >
> > > > YES.
> > > >
> > > > Enabling the premapped mode may fail, then we must stop to enable AF_XDP.
> > > >
> > > > AF-XDP requires that we export the dma dev to the af-xdp.
> > > > We can do that only when the virtio core works with use_dma_api.
> > > > Other other side, if we support the page-pool in future, we may have the
> > > > same requirement.
> > >
> > > Rethink this.
> > >
> > > Enable premapped MUST NOT fail. No care the use_dma_api is true or not, because
> > > we have the DMA APIs for virtio. Then the virtio-net rx will work with
> > > premapped (I will make the big mode work with premapped mode)
> >
> > Just to make sure we're at the same page. Rx will always work in the
> > mode or pre mapping. So we can easily fail the probe if we fail to
> > enable RX premapping?
>
>
> NO, enabling premapped mode can not fail. So the rx will always work
> in the premapping mode.
Ok, kind of my understanding.
>
>
> >
> > >
> > > AF_XDP checks the virtqueue_dma_dev() when enabling.
> > >
> > > But disabling premapped mode may fail, because that virtio ring need to
> > > allocate memory for dma.
> >
> > That's kind of too tricky, what if we just allocate the memory for dma
> > unconditionally?
>
> It's ok, but we waste the memory.
Probably, but the point is to reduce the complexity of the codes for symmetry:
We don't need to have and maintain codes for fallback mode when we
fail to disable premapping.
Thanks
>
> Thanks.
>
>
>
> >
> > Thanks
> >
> > >
> > > Thanks.
> > >
> > >
> > >
> > > >
> > > >
> > > > Thanks.
> > > >
> > > >
> > > > >
> > > > > THanks
> > > > >
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > Thanks
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
next prev parent reply other threads:[~2024-04-08 5:02 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 11:14 [PATCH vhost v6 00/10] virtio: drivers maintain dma info for premapped vq Xuan Zhuo
2024-03-27 11:14 ` [PATCH vhost v6 01/10] virtio_ring: introduce vring_need_unmap_buffer Xuan Zhuo
2024-03-27 11:14 ` [PATCH vhost v6 02/10] virtio_ring: packed: remove double check of the unmap ops Xuan Zhuo
2024-03-28 6:56 ` Jason Wang
2024-03-28 7:27 ` Xuan Zhuo
2024-03-28 8:07 ` Jason Wang
2024-03-28 8:15 ` Xuan Zhuo
2024-03-29 3:24 ` Jason Wang
2024-03-27 11:14 ` [PATCH vhost v6 03/10] virtio_ring: packed: structure the indirect desc table Xuan Zhuo
2024-03-28 6:56 ` Jason Wang
2024-03-28 7:36 ` Xuan Zhuo
2024-03-28 8:07 ` Jason Wang
2024-03-28 8:17 ` Xuan Zhuo
2024-03-27 11:14 ` [PATCH vhost v6 04/10] virtio_ring: split: remove double check of the unmap ops Xuan Zhuo
2024-03-27 11:14 ` [PATCH vhost v6 05/10] virtio_ring: split: structure the indirect desc table Xuan Zhuo
2024-03-28 7:01 ` Jason Wang
2024-03-28 7:42 ` Xuan Zhuo
2024-03-27 11:14 ` [PATCH vhost v6 06/10] virtio_ring: no store dma info when unmap is not needed Xuan Zhuo
2024-03-28 7:06 ` Jason Wang
2024-03-28 7:40 ` Xuan Zhuo
2024-03-29 3:16 ` Jason Wang
2024-03-27 11:14 ` [PATCH vhost v6 07/10] virtio: find_vqs: add new parameter premapped Xuan Zhuo
2024-03-28 7:56 ` Jason Wang
2024-03-27 11:14 ` [PATCH vhost v6 08/10] virtio_ring: export premapped to driver by struct virtqueue Xuan Zhuo
2024-03-28 7:58 ` Jason Wang
2024-03-27 11:14 ` [PATCH vhost v6 09/10] virtio_net: set premapped mode by find_vqs() Xuan Zhuo
2024-03-28 8:05 ` Jason Wang
2024-03-28 8:22 ` Xuan Zhuo
2024-03-29 3:20 ` Jason Wang
2024-04-01 1:40 ` Xuan Zhuo
2024-04-01 3:00 ` Xuan Zhuo
2024-04-07 4:24 ` Jason Wang
2024-04-07 6:00 ` Xuan Zhuo
2024-04-08 5:01 ` Jason Wang [this message]
2024-03-27 11:14 ` [PATCH vhost v6 10/10] virtio_ring: virtqueue_set_dma_premapped support disable 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='CACGkMEvPy+5_x24MCn8xbSyEkhFG8iz=XQ9gpoHO5y49ORsQKA@mail.gmail.com' \
--to=jasowang@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=virtualization@lists.linux.dev \
--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 read-only IMAP folder(s) and NNTP newsgroup(s).