> From: Tian, Kevin > Sent: Friday, October 20, 2023 2:09 PM > > > From: Joao Martins <joao.m.martins@xxxxxxxxxx> > > Sent: Thursday, October 19, 2023 4:27 AM > > > > + > > +int iopt_set_dirty_tracking(struct io_pagetable *iopt, > > + struct iommu_domain *domain, bool enable) > > +{ > > + const struct iommu_dirty_ops *ops = domain->dirty_ops; > > + int ret = 0; > > + > > + if (!ops) > > + return -EOPNOTSUPP; > > + > > + down_read(&iopt->iova_rwsem); > > + > > + /* Clear dirty bits from PTEs to ensure a clean snapshot */ > > + if (enable) { > > + ret = iopt_clear_dirty_data(iopt, domain); > > + if (ret) > > + goto out_unlock; > > + } > > why not leaving this to the actual driver which wants to always > enable dirty instead of making it a general burden for all? > looks I was misled by the commit msg. This is really for the reality that there is no guarantee from previous cycle where the user will quiesce device, read/clean all the remaining dirty bits and then disable dirty tracking. It's true for live migration but not if just looking at this dirty tracking alone. So, Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>