On Wed, 3 Aug 2016 18:40:47 +1000 Alexey Kardashevskiy <a...@ozlabs.ru> wrote:
> At the moment VFIO IOMMU SPAPR v2 driver pins all guest RAM pages when > the userspace starts using VFIO. When the userspace process finishes, > all the pinned pages need to be put; this is done as a part of > the userspace memory context (MM) destruction which happens on > the very last mmdrop(). > > This approach has a problem that a MM of the userspace process > may live longer than the userspace process itself as kernel threads > use userspace process MMs which was runnning on a CPU where > the kernel thread was scheduled to. If this happened, the MM remains > referenced until this exact kernel thread wakes up again > and releases the very last reference to the MM, on an idle system this > can take even hours. > > This references and caches MM once per container and adds tracking > how many times each preregistered area was registered in > a specific container. This way we do not depend on @current pointing to > a valid task descriptor. > > This changes the userspace interface to return EBUSY if memory is > already registered (mm_iommu_get() used to increment the counter); > however it should not have any practical effect as the only > userspace tool available now does register memory area once per > container anyway. > > As tce_iommu_register_pages/tce_iommu_unregister_pages are called > under container->lock, this does not need additional locking. > > Signed-off-by: Alexey Kardashevskiy <a...@ozlabs.ru> Reviewed-by: Nicholas Piggin <npig...@gmail.com> _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev