From: Alex Williamson <alex.williamson@redhat.com>
To: Joao Martins <joao.m.martins@oracle.com>
Cc: Yishai Hadas <yishaih@nvidia.com>,
Jason Gunthorpe <jgg@nvidia.com>,
mst@redhat.com, jasowang@redhat.com, kvm@vger.kernel.org,
virtualization@lists.linux-foundation.org, parav@nvidia.com,
feliu@nvidia.com, kevin.tian@intel.com, leonro@nvidia.com,
maorg@nvidia.com
Subject: Re: [PATCH V1 vfio 7/7] vfio/virtio: Enable live migration once VIRTIO_PCI was configured
Date: Mon, 11 Nov 2024 14:27:36 -0700 [thread overview]
Message-ID: <20241111142736.18a625df.alex.williamson@redhat.com> (raw)
In-Reply-To: <112ebe08-06f3-4cb5-8cf0-8b49c56eac89@oracle.com>
On Mon, 11 Nov 2024 15:30:47 +0000
Joao Martins <joao.m.martins@oracle.com> wrote:
> On 11/11/2024 14:17, Yishai Hadas wrote:
> > On 11/11/2024 12:32, Joao Martins wrote:
> >>>>> depends on VIRTIO_PCI
> >>>>> select VFIO_PCI_CORE
> >>>>> select IOMMUFD_DRIVER
> >>>>
> >>>> IIUC, this is not a dependency, the device will just lack dirty page
> >>>> tracking with either the type1 backend or when using iommufd when the
> >>>> IOMMU hardware doesn't have dirty page tracking, therefore all VM
> >>>> memory is perpetually dirty. Do I have that right?
> >>>
> >>> IOMMUFD_DRIVER is selected to utilize the dirty tracking functionality of IOMMU.
> >>> Therefore, this is a select option rather than a dependency, similar to how the
> >>> pds and mlx5 VFIO drivers handle it in their Kconfig files.
> >>>
> >>
> >> Yishai, I think Alex is right here.
> >>
> >> 'select IOMMUFD_DRIVER' is more for VF dirty trackers where it uses the same
> >> helpers as IOMMUFD does for dirty tracking. But it's definitely not signaling
> >> intent for 'IOMMU dirty tracking' but rather 'VF dirty tracking'
> >
> > I see, please see below.
> >
> I should have said that in the context of VFIO drivers selecting it, not broadly
> across all drivers that select it.
>
> >>
> >> If you want to tie in to IOMMU dirty tracking you probably want to do:
> >>
> >> 'select IOMMUFD'
> >>
> >
> > Looking at the below Kconfig(s) for AMD/INTEL_IOMMU [1], we can see that if
> > IOMMUFD is set IOMMFD_DRIVER is selected.
> >
> Correct.
>
> > From that we can assume that to have 'IOMMU dirty tracking' the IOMMFD_DRIVER is
> > finally needed/selected, right ?
> >
>
> Right, if you have CONFIG_IOMMUFD then the IOMMU will in the end auto-select
> IOMMU_DRIVER. But standalone at best you can assume that 'something does dirty
> tracking'. The context (i.e. who selects it) is what tells you if it's VF or IOMMU.
>
> In your example above, that option is meant to be selected by *a* dirty tracker,
> and it's because AMD/Intel was selecting that you would have IOMMU dirty
> tracking. The option essentially selects IOVA bitmaps helpers (zerocopy scheme
> to set bits in a bitmap) which is both used by VF dirty trackers and IOMMU dirty
> trackers. Originally this started in VFIO and later got moved into IOMMUFD which
> is why we have this kconfig to allow independent use.
Yeah, I agree. IOMMUFD_DRIVER is only configuring in iova_bitmap
support independent of IOMMUFD, which mlx5 requires, but this does not.
> > So you are saying that it's redundant in the vfio/virtio driver as it will be
> > selected down the road once needed ?
> >
> Right.
>
> Of course, it will always depend on user enabling the right kconfigs and such.
> But that would be no different than the other drivers than don't support VF
> dirty tracking.
>
> > [1]
> > https://elixir.bootlin.com/linux/v6.12-rc6/source/drivers/iommu/intel/Kconfig#L17
> > https://elixir.bootlin.com/linux/v6.12-rc6/source/drivers/iommu/amd/Kconfig#L16
> >
> >> But that is a big hammer, as you also need the VFIO_DEVICE_CDEV kconfig selected
> >> as well and probably more.
> >
> > I agree, we didn't plan to add those dependencies.
> >
> >>
> >> Perhaps best to do like qat/hisilicon drivers and letting the user optionally
> >> pick it. Migration is anyways disabled when using type1 (unless you force it,
> >> and it then it does the perpectual dirty trick).
Yes, at least for QEMU, unless the user forces the device to support
migration we'll add a migration blocker rather than use the perpetually
dirty trick. Ultimately the support depends on the underlying IOMMU
capabilities where we're running anyway, so it makes sense to me to
leave this to the user rather than trying to force a kernel config that
can support IOMMU dirty page tracking. Thanks,
Alex
next prev parent reply other threads:[~2024-11-11 21:27 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 10:21 [PATCH V1 vfio 0/7] Enhance the vfio-virtio driver to support live migration Yishai Hadas
2024-11-04 10:21 ` [PATCH V1 vfio 1/7] virtio_pci: Introduce device parts access commands Yishai Hadas
2024-11-04 10:21 ` [PATCH V1 vfio 2/7] virtio: Extend the admin command to include the result size Yishai Hadas
2024-11-04 10:21 ` [PATCH V1 vfio 3/7] virtio: Manage device and driver capabilities via the admin commands Yishai Hadas
2024-11-04 10:21 ` [PATCH V1 vfio 4/7] virtio-pci: Introduce APIs to execute device parts " Yishai Hadas
2024-11-04 10:21 ` [PATCH V1 vfio 5/7] vfio/virtio: Add support for the basic live migration functionality Yishai Hadas
2024-11-05 22:47 ` Alex Williamson
2024-11-06 10:21 ` Yishai Hadas
2024-11-06 21:33 ` Alex Williamson
2024-11-07 9:39 ` Yishai Hadas
2024-11-06 15:48 ` Jason Gunthorpe
2024-11-04 10:21 ` [PATCH V1 vfio 6/7] vfio/virtio: Add PRE_COPY support for live migration Yishai Hadas
2024-11-05 23:18 ` Alex Williamson
2024-11-06 11:16 ` Yishai Hadas
2024-11-06 21:40 ` Alex Williamson
2024-11-04 10:21 ` [PATCH V1 vfio 7/7] vfio/virtio: Enable live migration once VIRTIO_PCI was configured Yishai Hadas
2024-11-05 23:29 ` Alex Williamson
2024-11-06 13:59 ` Jason Gunthorpe
2024-11-06 22:27 ` Alex Williamson
2024-11-07 12:57 ` Yishai Hadas
2024-11-07 21:25 ` Alex Williamson
2024-11-11 8:22 ` Yishai Hadas
2024-11-11 10:32 ` Joao Martins
2024-11-11 14:17 ` Yishai Hadas
2024-11-11 15:30 ` Joao Martins
2024-11-11 21:27 ` Alex Williamson [this message]
2024-11-06 9:32 ` [PATCH V1 vfio 0/7] Enhance the vfio-virtio driver to support live migration Michael S. Tsirkin
2024-11-06 22:30 ` Alex Williamson
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=20241111142736.18a625df.alex.williamson@redhat.com \
--to=alex.williamson@redhat.com \
--cc=feliu@nvidia.com \
--cc=jasowang@redhat.com \
--cc=jgg@nvidia.com \
--cc=joao.m.martins@oracle.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=leonro@nvidia.com \
--cc=maorg@nvidia.com \
--cc=mst@redhat.com \
--cc=parav@nvidia.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=yishaih@nvidia.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).