KVM-PPC: Migrate Pinned Pages out of CMA
Subsystems (3)
RFC PATCH 1/1 KVM-PPC: Migrate Pinned Pages out of CMA
From: Balbir Singh <[email protected]>
When PCI/Device pass through is enabled via VFIO, KVM-PPC will pin pages using get_user_pages_fast(). One of the downsides of the pinning is that the page could be in CMA region. The CMA region is used for other allocations like the hash page table. Ideally we want the pinned pages to be from non CMA region.
This patch (currently only for KVM PPC with VFIO) forcefully migrates the pages out (huge pages are ommitted for the moment). There are more efficient ways of doing this, but that might be elaborate and might impact a larger audience beyond just the kvm ppc implementation.
The magic is in new_iommu_non_cma_page() which allocates the new page from a non CMA region.
I've tested the patches lightly at my end, but there might be bugs For example if after lru_add_drain(), the page is not isolated is this a BUG?
Second question - is mm_iommu_move_page_from_cma() generic enough to be used as helper ourside of KVM-PPC?
Previous discussion was at
http://permalink.gmane.org/gmane.linux.kernel.mm/136738
--- arch/powerpc/include/asm/mmu_context.h | 1 + arch/powerpc/mm/mmu_context_iommu.c | 80 ++++++++++++++++++++++++++++++++-- 2 files changed, 77 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/mmu_context.h +1 -0
@@ -18,6 +18,7 @@ extern void destroy_context(struct mm_struct *mm);#ifdef CONFIG_SPAPR_TCE_IOMMU struct mm_iommu_table_group_mem_t ; +extern int isolate_lru_page (struct page *page);/* internal.h */ extern bool mm_iommu_preregistered (void );extern long mm_iommu_get (unsigned long ua,unsigned long entries,struct mm_iommu_table_group_mem_t **pmem);
arch/powerpc/mm/mmu_context_iommu.c +76 -4
103 lines not on this page · raw message
Signature · 1 line
2.5.0