> From: Christoph Hellwig <hch@xxxxxx> > 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. After patch7 vfio_group_get_external_user() is not called. It's possible that KVM_DEV_VFIO_GROUP_ADD is called before a container is attached by the group. In this case cache coherency of the group cannot be determined at that point. I prefer to returning an error in this callback so KVM can still fail adding the group, instead of letting the inaccurate coherency info to bit the user in a much latter point... Thanks Kevin