> > If you want to minimize flushes then you can't store flush > > minimization information in the pages because it isn't global to the > > pages and will not be accurate enough. > > > > > > If pfn_reader_fill_span() does batch_from_domain() and > > > > the source domain's storage_domain is non-coherent then you can skip > > > > the flush. This is not pedantically perfect in skipping all flushes, but > > > > in practice it is probably good enough. > > > > > We don't know whether the source storage_domain is non-coherent since > > > area->storage_domain is of "struct iommu_domain". > > > > > Do you want to add a flag in "area", e.g. area->storage_domain_is_noncoherent, > > > and set this flag along side setting storage_domain? > > > > Sure, that could work. > When the storage_domain is set in iopt_area_fill_domains(), > "area->storage_domain = xa_load(&area->iopt->domains, 0);" > is there a convenient way to know the storage_domain is non-coherent? Also asking for when storage_domain is switching to an arbitrary remaining domain in iopt_unfill_domain(). And in iopt_area_unfill_domains(), after iopt_area_unmap_domain_range() of a non-coherent domain which is not the storage domain, how can we know that the domain is non-coherent?