Re: [RFC PATCH 13/15] iommufd: Persist iommu domains for live update

From: Jason Gunthorpe
Date: Thu Oct 02 2025 - 07:57:27 EST


On Wed, Oct 01, 2025 at 03:28:56PM -0400, Pasha Tatashin wrote:
> > > 3. On FINISH, the IOMMU core updates the context entries of preserved
> > > devices to point to the new domain.
> >
> > No, finish should never do anything on the restore path, IMHO. User
> > should directly attach the newly created HWPT when it is ready.
>
> But, finish is our indicator that a particular session (VM) is out of
> blackout, and now we are free to do slow things, such as
> re-allocating/recreating page tables. Why start it before a VM is out
> of blackout?

Things should be paired.. The suspend side is

start luo - "brown out" - kernel does basically nothing as the luo is empty
add all sorts of things to sessions
finish - kernel does last minute things

While the resume is the symmetric opposite:

kexec boot - kernel restores the critical stuff it needs to boot to
userspace
userspace does all sorts of stuff and gets things out of the sessions
finish - luo should be empty now as everything was taken out by
userspace

I think when things come out of luo they should be fully operational
immediately.

Finish on resume shouldn't indicate anything specific beyond the luo
should be empty and everything should have been restored. It isn't
like finish on pre-kexec.

Userspace decides how it sequences things and what steps it takes
before ending blackout and resuming the VM.

Jason