Re: [RFC PATCH 05/13] iommufd: Serialise persisted iommufds and ioas

Jacob Pan
2024-10-28T16:03:13Z

Hi James,

Just a gentle reminder. Let me also explain the problem we are trying
to solve for the live update of OpenHCL paravisor[1]. OpenHCL has user
space drivers based on VFIO noiommu mode, we are in the process of
converting to iommufd cdev.

Similarly, running DMA continuously across updates is required, but
unlike your case, OpenHCL updates do not involve preserving the IO page
tables in that it is managed by the hypervisor which is not part of the
update.

It seems reasonable to share the device persistence code path
with the plan laid out in your cover letter. IOAS code path will be
different since noiommu option does not have IOAS.

If we were to revive noiommu support for iommufd cdev[2], can we use
the persistent iommufd context to allow device persistence? Perhaps
through IOMMUFD_OBJ_DEVICE and IOMMUFD_OBJ_ACCESS(used in [2])?

@David, @Jason, @Alex, @Yi, any comments or suggestions?

Thanks,

Jacob

1. (openvmm/Guide/src/reference/architecture/openhcl.md at main ·
microsoft/openvmm.
2. [PATCH v11 00/23] Add vfio_device cdev for
iommufd support - Yi Liu

On Wed, 16 Oct 2024 15:20:47 -0700 Jacob Pan
<jacob.pan@linux.microsoft.com> wrote:

> Hi James,
>
> On Mon, 16 Sep 2024 13:30:54 +0200
> James Gowans <jgowans@amazon.com> wrote:
>
> > +static int serialise_iommufd(void *fdt, struct iommufd_ctx *ictx)
> > +{
> > + int err = 0;
> > + char name[24];
> > + struct iommufd_object *obj;
> > + unsigned long obj_idx;
> > +
> > + snprintf(name, sizeof(name), "%lu", ictx->persistent_id);
> > + err |= fdt_begin_node(fdt, name);
> > + err |= fdt_begin_node(fdt, "ioases");
> > + xa_for_each(&ictx->objects, obj_idx, obj) {
> > + struct iommufd_ioas *ioas;
> > + struct iopt_area *area;
> > + int area_idx = 0;
> > +
> > + if (obj->type != IOMMUFD_OBJ_IOAS)
> > + continue;
> I was wondering how device state persistency is managed here. Is it
> correct to assume that all devices bound to an iommufd context should
> be persistent? If so, should we be serializing IOMMUFD_OBJ_DEVICE as
> well?
>
> I'm considering this from the perspective of user mode drivers,
> including those that use noiommu mode (need to be added to iommufd
> cdev). In this scenario, we only need to maintain the device states
> persistently without IOAS.