All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Parav Pandit <parav@nvidia.com>,
	Max Gurtovoy <mgurtovoy@nvidia.com>,
	"virtio-comment@lists.oasis-open.org"
	<virtio-comment@lists.oasis-open.org>,
	"cohuck@redhat.com" <cohuck@redhat.com>,
	"virtio-dev@lists.oasis-open.org"
	<virtio-dev@lists.oasis-open.org>,
	Shahaf Shuler <shahafs@nvidia.com>, Oren Duer <oren@nvidia.com>,
	"stefanha@redhat.com" <stefanha@redhat.com>
Subject: Re: [PATCH 4/5] virtio-net: add support for VIRTIO_F_ADMIN_VQ
Date: Wed, 26 Jan 2022 15:10:37 +0800	[thread overview]
Message-ID: <CACGkMEuOt8=f828-AyZPwq14=DdEN-e9F_nxow20_sxtKk87dQ@mail.gmail.com> (raw)
In-Reply-To: <20220126015630-mutt-send-email-mst@kernel.org>

On Wed, Jan 26, 2022 at 3:02 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Wed, Jan 26, 2022 at 01:49:05PM +0800, Jason Wang wrote:
> > On Tue, Jan 25, 2022 at 3:20 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> > >
> > > On Tue, Jan 25, 2022 at 11:53:35AM +0800, Jason Wang wrote:
> > > > On Wed, Jan 19, 2022 at 5:26 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> > > > >
> > > > > On Wed, Jan 19, 2022 at 12:16:47PM +0800, Jason Wang wrote:
> > > > > > > We also need
> > > > > > > - something like injecting cvq commands to control rx mode from the admin device
> > > > > > > - page fault / dirty page handling
> > > > > > >
> > > > > > > these two seem to call for a vq.
> > > > > >
> > > > > > Right, but vq is not necessarily for PF if we had PASID. And with
> > > > > > PASID we don't even need a dedicated new cvq.
> > > > >
> > > > > I don't think it's a good idea to mix transactions from
> > > > > multiple PASIDs on the same vq.
> > > >
> > > > To be clear, I don't mean to let a single vq use multiple PASIDs.
> > > >
> > > > >
> > > > > Attaching a PASID to a queue seems more reasonable.
> > > > > cvq is under guest control, so yes I think a separate
> > > > > vq is preferable.
> > > >
> > > > Sorry, I don't get here. E.g in the case of virtio-net, it's more than
> > > > sufficient to assign a dedicated PASID to cvq, any reason for yet
> > > > another one?
> > >
> > > Well I'm not sure how cheap it is to have an extra PASID.
> > > In theory you can share page tables making it not that
> > > expensive.
> >
> > I think it should not be expensive since PASID is per RID according to
> > the PCIe spec.
> >
> > > In practice is it hard for the MMU to do so?
> > > If page tables are not shared extra PASIDs become expensive.
> >
> > Why? For CVQ, we don't need sharing page tables, just maintaining one
> > dedicated buffer for command forwarding is sufficient.
>
> I am talking about the IOMMU page tables, these are not part of PCIe
> spec. You need to map all of guest memory to the device, this needs a
> set of PTEs. If two PASIDs map same memory you might be able to share
> PTEs but I am guessing that this will need some kind of reference
> counting to track their usage. I am not sure how complex/expensive that
> will turn out to be. In absence of that, we are doubling the amount of
> PTEs by using two PASIDs for the same device.

So it depends on the migration model

1) save and restore

or

2) trap and emulate

Then:

- If the device provides the facility to sync the state we don't need
a dedicated PASID for CVQ, and CVQ can be assigned to guests.
- If the device doesn't provide the facility to sync the state, we
need trap CVQ and get the state (what Qemu currently did), then CVQ
needs to be trapped (an emulated CVQ will be presented to guests). And
we need a dedicated PASID for hardware CVQ, but in this case we don't
need to map guest memory to hardware CVQ otherwise there will be
security implications. It's sufficient to map a small buffer.


>
>
> > >
> > >
> > > > >
> > > > > What is true is that with subfunctions you would have
> > > > > PASID per subfunction and then one subfunction for control.
> > > >
> > > > Well, it's possible, but it's also possible to have everything self
> > > > contained in a single subfucntion. Then cvq can be assigned to a PASID
> > > > that is used only for the hypervisor.
> > > >
> > > > >
> > > > > I think a sketch of how things will work with scalable iov can't hurt as
> > > > > part of this proposal.  And, I'm not sure we should have so much
> > > > > flexibility: if there's an interface that works for SRIOV and SIOV then
> > > > > that seems preferable than having distinct transports for SRIOV and
> > > > > SIOV.
> > > >
> > > > Some of my understanding of SR-IOV vs SIOV:
> > > >
> > > > 1) SR-IOV doesn't requires a transport, VF use PCI config space; But
> > > > SIOV requires one
> > > > 2) SR-IOV doesn't support dynamic on demand provisioning where SIOV can
> > > >
> > > > So I'm not sure how hard it is if we want to unify the management
> > > > plane of the above two.
> > > >
> > > > Thanks
> > >
> > > Interesting. So are you fine with a proposal which ignores the PASID
> > > things completely then?
> >
> > I'm fine, just a note that:
> >
> > The main advantages of using admin virtqueue in another device (PF) is
> > that the DMA is isolated,
>
> Right
>
> > but with the help of PASID, there's no need
> > to do that
>
> In that you can make the AQ part of the VF itself?

Not sure, but I guess for nesting, A bar/register interface is much
more simpler/better for the case that doesn't need DMA.

>
> > and we will have a better interface for nesting.
> >
> > Thanks
>
> In fact, nesting is an interesting use case. I have not
> thought about this too much, it is worth thinking about
> how this interface will virtualize.

I totally agree.

Thanks

>
> > > If yes can we take that discussion to
> > > a different thread then? This one is already too long ...
> > >
> > >
> > > >
> > > > >
> > > > >
> > > > > --
> > > > > MST
> > > > >
> > >
>


  reply	other threads:[~2022-01-26  7:10 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 14:50 [PATCH v1 0/5] VIRTIO: Provision maximum MSI-X vectors for a VF Max Gurtovoy
2022-01-13 14:50 ` [PATCH 1/5] Add virtio Admin Virtqueue specification Max Gurtovoy
2022-01-13 17:53   ` Michael S. Tsirkin
2022-01-17  9:56     ` Max Gurtovoy
2022-01-17 21:30       ` Michael S. Tsirkin
2022-01-18  3:22         ` Parav Pandit
2022-01-18  6:17           ` Michael S. Tsirkin
2022-01-18  7:57             ` Parav Pandit
2022-01-18  8:05               ` Michael S. Tsirkin
2022-01-18  8:23                 ` Parav Pandit
2022-01-18 10:26                   ` Michael S. Tsirkin
2022-01-18 10:30                     ` Parav Pandit
2022-01-18 10:41                       ` Michael S. Tsirkin
2022-01-19  3:04         ` Jason Wang
2022-01-19  8:11           ` Michael S. Tsirkin
2022-01-25  3:35             ` Jason Wang
2022-01-17 14:12     ` Parav Pandit
2022-01-17 22:03       ` Michael S. Tsirkin
2022-01-18  3:36         ` Parav Pandit
2022-01-18  7:07           ` Michael S. Tsirkin
2022-01-18  7:14             ` Parav Pandit
2022-01-18  7:20               ` Michael S. Tsirkin
2022-01-19 11:33                 ` Max Gurtovoy
2022-01-19 12:21                   ` Parav Pandit
2022-01-19 14:47                     ` Max Gurtovoy
2022-01-19 15:38                       ` Michael S. Tsirkin
2022-01-19 15:47                         ` Max Gurtovoy
2022-01-13 14:51 ` [PATCH 2/5] Introduce VIRTIO_F_ADMIN_VQ_INDIRECT_DESC/VIRTIO_F_ADMIN_VQ_IN_ORDER Max Gurtovoy
2022-01-13 15:33   ` Michael S. Tsirkin
2022-01-13 17:07     ` Max Gurtovoy
2022-01-13 17:25       ` Michael S. Tsirkin
2022-01-17 13:59         ` Parav Pandit
2022-01-17 22:14           ` Michael S. Tsirkin
2022-01-18  4:44             ` Parav Pandit
2022-01-18  6:23               ` Michael S. Tsirkin
2022-01-18  6:32                 ` Parav Pandit
2022-01-18  6:54                   ` Michael S. Tsirkin
2022-01-18  7:07                     ` Parav Pandit
2022-01-18  7:12                       ` Michael S. Tsirkin
2022-01-18  7:30                         ` Parav Pandit
2022-01-18  7:40                           ` Michael S. Tsirkin
2022-01-19  4:21                             ` Jason Wang
2022-01-19  9:30                               ` Michael S. Tsirkin
2022-01-25  3:39                                 ` Jason Wang
2022-01-18 10:38                           ` Michael S. Tsirkin
2022-01-18 10:50                             ` Parav Pandit
2022-01-18 15:09                               ` Michael S. Tsirkin
2022-01-18 17:17                                 ` Parav Pandit
2022-01-19  7:20                                   ` Michael S. Tsirkin
2022-01-19  8:15                                     ` [virtio-dev] " Parav Pandit
2022-01-19  8:21                                       ` Michael S. Tsirkin
2022-01-19 10:10                                         ` Parav Pandit
2022-01-19 16:40                                           ` Michael S. Tsirkin
2022-01-19 17:07                                             ` Parav Pandit
2022-01-18  7:13                       ` Michael S. Tsirkin
2022-01-18  7:21                         ` Parav Pandit
2022-01-18  7:37                           ` Michael S. Tsirkin
2022-01-19  4:03                       ` Jason Wang
2022-01-19  4:48                         ` Parav Pandit
2022-01-19 20:25                           ` Parav Pandit
2022-01-25  3:45                             ` Jason Wang
2022-01-25  4:07                               ` Parav Pandit
2022-01-25  3:29                           ` Jason Wang
2022-01-25  3:52                             ` Parav Pandit
2022-01-25 10:59                               ` Max Gurtovoy
2022-01-25 12:09                                 ` Michael S. Tsirkin
2022-01-26 13:29                                   ` Parav Pandit
2022-01-26 14:11                                     ` Michael S. Tsirkin
2022-01-27  3:49                                       ` Parav Pandit
2022-01-27 13:05                                         ` Michael S. Tsirkin
2022-01-27 13:25                                           ` [virtio-dev] " Parav Pandit
2022-01-28  4:35                                     ` Jason Wang
2022-01-26  7:03                                 ` Jason Wang
2022-01-26  9:27                                   ` Max Gurtovoy
2022-01-26  9:34                                     ` Jason Wang
2022-01-26  9:45                                       ` Max Gurtovoy
2022-01-27  3:46                                         ` Jason Wang
2022-01-26  5:04                               ` Jason Wang
2022-01-26  5:26                                 ` Parav Pandit
2022-01-26  5:45                                   ` Jason Wang
2022-01-26  5:58                                     ` Parav Pandit
2022-01-26  6:06                                       ` Jason Wang
2022-01-26  6:24                                         ` Parav Pandit
2022-01-26  6:54                                           ` Jason Wang
2022-01-26  8:09                                             ` Parav Pandit
2022-01-26  9:07                                               ` Jason Wang
2022-01-26  9:47                                                 ` Parav Pandit
2022-01-13 14:51 ` [PATCH 3/5] virtio-blk: add support for VIRTIO_F_ADMIN_VQ Max Gurtovoy
2022-01-13 18:24   ` Michael S. Tsirkin
2022-01-13 14:51 ` [PATCH 4/5] virtio-net: " Max Gurtovoy
2022-01-13 17:56   ` Michael S. Tsirkin
2022-01-16  9:47     ` Max Gurtovoy
2022-01-16 16:45       ` Michael S. Tsirkin
2022-01-17 14:07       ` Parav Pandit
2022-01-17 22:22         ` Michael S. Tsirkin
2022-01-18  2:18           ` Jason Wang
2022-01-18  5:25             ` Michael S. Tsirkin
2022-01-19  4:16               ` Jason Wang
2022-01-19  9:26                 ` Michael S. Tsirkin
2022-01-25  3:53                   ` Jason Wang
2022-01-25  7:19                     ` Michael S. Tsirkin
2022-01-26  5:49                       ` Jason Wang
2022-01-26  7:02                         ` Michael S. Tsirkin
2022-01-26  7:10                           ` Jason Wang [this message]
2022-01-13 14:51 ` [PATCH 5/5] Add support for dynamic MSI-X vector mgmt for VFs Max Gurtovoy
2022-01-13 18:20   ` Michael S. Tsirkin
2022-01-18 10:38   ` Michael S. Tsirkin
2022-01-13 18:32 ` [PATCH v1 0/5] VIRTIO: Provision maximum MSI-X vectors for a VF Michael S. Tsirkin
2022-01-17 10:00   ` Shahaf Shuler
2022-01-17 21:41     ` Michael S. Tsirkin

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='CACGkMEuOt8=f828-AyZPwq14=DdEN-e9F_nxow20_sxtKk87dQ@mail.gmail.com' \
    --to=jasowang@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=mgurtovoy@nvidia.com \
    --cc=mst@redhat.com \
    --cc=oren@nvidia.com \
    --cc=parav@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=stefanha@redhat.com \
    --cc=virtio-comment@lists.oasis-open.org \
    --cc=virtio-dev@lists.oasis-open.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.