On Mon, Jun 05, 2017 at 11:15:11AM +0800, Peter Xu wrote: > On Fri, Jun 02, 2017 at 06:45:05PM +0300, Michael S. Tsirkin wrote: > > On Fri, Jun 02, 2017 at 07:50:54PM +0800, Peter Xu wrote: > > > This patch pre-heat vhost iotlb cache when passthrough mode enabled. > > > > > > Sometimes, even if user specified iommu_platform for vhost devices, > > > IOMMU might still be disabled. One case is passthrough mode in VT-d > > > implementation. We can detect this by observing iommu_list. If it's > > > empty, it means IOMMU translation is disabled, then we can actually > > > pre-heat the translation (it'll be static mapping then) by first > > > invalidating all IOTLB, then cache existing memory ranges into vhost > > > backend iotlb using 1:1 mapping. > > > > > > Reviewed-by: Jason Wang <jasow...@redhat.com> > > > Signed-off-by: Peter Xu <pet...@redhat.com> > > > > This is still a hack I think. What if there's an invalidation? > > I think the right thing is to send updates only when requested, > > but sent the largest mapping including the iova, not from iova until end > > of page. Thoughts? > > Indeed it's kind of a hack, but it does not hurt anything but will > definitely boost performance in most cases... > > Yes "sent the largest mapping including the iova" is okay, but the > first IO on one region would be delayed as well, so IMHO it's not the > best solution as well. I think the best solution should be (for sure) > that vhost knows it's PT, then it just skips the translation > completely. I just don't sure whether there's simple/good way to do > this. > > Thanks,
If you send the whole 64 bit area, then backend can detect this easily. > -- > Peter Xu