RE: [PATCH v2 5/8] vfio: Change vfio_external_check_extension() to vfio_file_enforced_coherent()

Tian, Kevin
2022-04-24T05:51:21Z

> From: Jason Gunthorpe <jgg@nvidia.com>
> Sent: Saturday, April 23, 2022 12:59 AM
>
> On Fri, Apr 22, 2022 at 12:32:58AM +0000, Tian, Kevin wrote:
> > > From: Tian, Kevin
> > > Sent: Friday, April 22, 2022 8:13 AM
> > >
> > > > From: Christoph Hellwig <hch@lst.de>
> > > > Sent: Thursday, April 21, 2022 1:41 PM
> > > >
> > > > I can see why a specific error might be nice for some cases and am
> > > > open to that, but as a simple transformation this already looks good:
> > > >
> > >
> > > There is a slight semantics change together with patch7.
> > >
> > > Before patch7 the container must be attached before calling
> > > KVM_DEV_VFIO_GROUP_ADD, otherwise vfio_group_get_external_user()
> > > will fail. In this case the result of cache coherency for a group is
> > > deterministic, either true or false.
>
> No, it isn't. The coherency is a propery of the iommu_domain/container
> and it can change when more groups are attached to the same
> domain. The best KVM can say is that if it is reporting coherency
> enforced it won't stop reporting that - which doesn't change in this
> series.

You are right. I thought this interface returns the domain property
which should be locked down once being attached by a group but
it actually checks the container property which is dynamic as you
pointed out.