On Fri, May 06, 2022 at 03:51:40AM +0000, Tian, Kevin wrote: > > From: Jason Gunthorpe <jgg@xxxxxxxxxx> > > Sent: Thursday, May 5, 2022 10:08 PM > > > > On Thu, May 05, 2022 at 07:40:37AM +0000, Tian, Kevin wrote: > > > > > In concept this is an iommu property instead of a domain property. > > > > Not really, domains shouldn't be changing behaviors once they are > > created. If a domain supports dirty tracking and I attach a new device > > then it still must support dirty tracking. > > That sort of suggests that userspace should specify whether a domain > supports dirty tracking when it's created. But how does userspace > know that it should create the domain in this way in the first place? > live migration is triggered on demand and it may not happen in the > lifetime of a VM. The best you could do is to look at the devices being plugged in at VM startup, and if they all support live migration then request dirty tracking, otherwise don't. However, tt costs nothing to have dirty tracking as long as all iommus support it in the system - which seems to be the normal case today. We should just always turn it on at this point. > and if the user always creates domain to allow dirty tracking by default, > how does it know a failed attach is due to missing dirty tracking support > by the IOMMU and then creates another domain which disables dirty > tracking and retry-attach again? The automatic logic is complicated for sure, if you had a device flag it would have to figure it out that way Jason