Re: [RFC PATCH 13/15] iommufd: Persist iommu domains for live update
From: Jason Gunthorpe
Date: Fri Oct 03 2025 - 08:09:47 EST
On Thu, Oct 02, 2025 at 04:56:57PM -0700, Samiullah Khawaja wrote:
> > So if you have a notion that finish is disallowed and when it is
> > actually finished maybe the order doesn't matter?
>
> I think FINISH for FDs in a SESSION is not atomic. If a dependency
> memfd gets its FINISH call first, it might make itself mutable before
> the iommufd FINISH callback fails because old HWPT is not replaced
> yet. By then, it would be too late; the memfd has already become
> mutable. That is why order would be needed.
I'm thinking of having an counter in the session and the iommu_domain
holds it elevated until it is destroyed. Finish can't even start until
the counter is 0.
If the counter is 0 then it is fine to unfreeze all the remaning
objects in any order.
Jason