From: Tiwei Bie <tiwei.bie@intel.com>
To: Jason Wang <jasowang@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
alex.williamson@redhat.com, maxime.coquelin@redhat.com,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, dan.daly@intel.com,
cunming.liang@intel.com, zhihong.wang@intel.com,
lingshan.zhu@intel.com
Subject: Re: [PATCH v2] vhost: introduce mdev based hardware backend
Date: Tue, 29 Oct 2019 17:57:38 +0800 [thread overview]
Message-ID: <20191029095738.GA7228@___> (raw)
In-Reply-To: <5e8a623d-9d91-607a-1f9e-7a7086ba9a68@redhat.com>
On Mon, Oct 28, 2019 at 11:50:49AM +0800, Jason Wang wrote:
> On 2019/10/28 上午9:58, Tiwei Bie wrote:
> > On Fri, Oct 25, 2019 at 08:16:26AM -0400, Michael S. Tsirkin wrote:
> > > On Fri, Oct 25, 2019 at 05:54:55PM +0800, Jason Wang wrote:
> > > > On 2019/10/24 下午6:42, Jason Wang wrote:
> > > > > Yes.
> > > > >
> > > > >
> > > > > > And we should try to avoid
> > > > > > putting ctrl vq and Rx/Tx vqs in the same DMA space to prevent
> > > > > > guests having the chance to bypass the host (e.g. QEMU) to
> > > > > > setup the backend accelerator directly.
> > > > >
> > > > > That's really good point. So when "vhost" type is created, parent
> > > > > should assume addr of ctrl_vq is hva.
> > > > >
> > > > > Thanks
> > > >
> > > > This works for vhost but not virtio since there's no way for virtio kernel
> > > > driver to differ ctrl_vq with the rest when doing DMA map. One possible
> > > > solution is to provide DMA domain isolation between virtqueues. Then ctrl vq
> > > > can use its dedicated DMA domain for the work.
> > It might not be a bad idea to let the parent drivers distinguish
> > between virtio-mdev mdevs and vhost-mdev mdevs in ctrl-vq handling
> > by mdev's class id.
>
>
> Yes, that should work, I have something probable better, see below.
>
>
> >
> > > > Anyway, this could be done in the future. We can have a version first that
> > > > doesn't support ctrl_vq.
> > +1, thanks
> >
> > > > Thanks
> > > Well no ctrl_vq implies either no offloads, or no XDP (since XDP needs
> > > to disable offloads dynamically).
> > >
> > > if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)
> > > && (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) ||
> > > virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) ||
> > > virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) ||
> > > virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO) ||
> > > virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM))) {
> > > NL_SET_ERR_MSG_MOD(extack, "Can't set XDP while host is implementing LRO/CSUM, disable LRO/CSUM first");
> > > return -EOPNOTSUPP;
> > > }
> > >
> > > neither is very attractive.
> > >
> > > So yes ok just for development but we do need to figure out how it will
> > > work down the road in production.
> > Totally agree.
> >
> > > So really this specific virtio net device does not support control vq,
> > > instead it supports a different transport specific way to send commands
> > > to device.
> > >
> > > Some kind of extension to the transport? Ideas?
>
>
> So it's basically an issue of isolating DMA domains. Maybe we can start with
> transport API for querying per vq DMA domain/ASID?
>
> - for vhost-mdev, userspace can query the DMA domain for each specific
> virtqueue. For control vq, mdev can return id for software domain, for the
> rest mdev will return id of VFIO domain. Then userspace know that it should
> use different API for preparing the virtqueue, e.g for vq other than control
> vq, it should use VFIO DMA API. The control vq it should use hva instead.
>
> - for virito-mdev, we can introduce per-vq DMA device, and route DMA mapping
> request for control vq back to mdev instead of the hardware. (We can wrap
> them into library or helpers to ease the development of vendor physical
> drivers).
Thanks for this proposal! I'm thinking about it these days.
I think it might be too complicated. I'm wondering whether we
can have something simpler. I will post a RFC patch to show
my idea today.
Thanks,
Tiwei
>
> Thanks
>
>
> > >
> > >
> > > --
> > > MST
>
next prev parent reply other threads:[~2019-10-29 9:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 9:52 [PATCH v2] vhost: introduce mdev based hardware backend Tiwei Bie
2019-10-22 13:30 ` Jason Wang
2019-10-23 3:02 ` Tiwei Bie
2019-10-23 5:46 ` Jason Wang
2019-10-23 7:07 ` Tiwei Bie
2019-10-23 7:25 ` Jason Wang
2019-10-23 10:11 ` Tiwei Bie
2019-10-23 10:29 ` Jason Wang
2019-10-24 4:21 ` Tiwei Bie
2019-10-24 8:03 ` Jason Wang
2019-10-24 8:32 ` Jason Wang
2019-10-24 9:18 ` Tiwei Bie
2019-10-24 10:42 ` Jason Wang
2019-10-25 9:54 ` Jason Wang
2019-10-25 12:16 ` Michael S. Tsirkin
2019-10-28 1:58 ` Tiwei Bie
2019-10-28 3:50 ` Jason Wang
2019-10-29 9:57 ` Tiwei Bie [this message]
2019-10-29 10:48 ` Jason Wang
2019-10-30 1:27 ` Tiwei Bie
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=20191029095738.GA7228@___ \
--to=tiwei.bie@intel.com \
--cc=alex.williamson@redhat.com \
--cc=cunming.liang@intel.com \
--cc=dan.daly@intel.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lingshan.zhu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.coquelin@redhat.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=zhihong.wang@intel.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).