linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC] KVM: PPC: Book3S HV: Fall back to same size HPT in allocation ioctl
@ 2016-09-12 11:13 Anshuman Khandual
  2016-09-12 11:33 ` Balbir Singh
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Anshuman Khandual @ 2016-09-12 11:13 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: paulus, aneesh.kumar, mpe

When the HPT size is explicitly passed on from the userspace, currently
the KVM_PPC_ALLOCATE_HTAB will try to allocate the requested size of HPT
from reserved CMA area and if that is not possible, the allocation just
fails. With the commit 572abd563befd56 ("KVM: PPC: Book3S HV: Don't fall
back to smaller HPT size in allocation ioctl"), it does not even try to
allocate the same order pages from the page allocator before failing for
good. Same order allocation should be attempted from the page allocator
as a fallback option when the CMA allocation attempt fails.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
- This change saves guests from failing to start after migration

 arch/powerpc/kvm/book3s_64_mmu_hv.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 05f09ae..0a30eb4 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -78,6 +78,14 @@ long kvmppc_alloc_hpt(struct kvm *kvm, u32 *htab_orderp)
 			--order;
 	}
 
+	/*
+	 * Fallback in case the userspace has provided a size via ioctl.
+	 * Try allocating the same order pages from the page allocator.
+	 */
+	if (!hpt && order > PPC_MIN_HPT_ORDER && htab_orderp)
+		hpt = __get_free_pages(GFP_KERNEL|__GFP_ZERO|__GFP_REPEAT|
+			__GFP_NOWARN, order - PAGE_SHIFT);
+
 	if (!hpt)
 		return -ENOMEM;
 
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-09-14  5:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-12 11:13 [RFC] KVM: PPC: Book3S HV: Fall back to same size HPT in allocation ioctl Anshuman Khandual
2016-09-12 11:33 ` Balbir Singh
2016-09-13  4:07   ` Anshuman Khandual
2016-09-13  4:34     ` Balbir Singh
2016-09-13  5:49       ` Anshuman Khandual
2016-09-13  9:26         ` Balbir Singh
2016-09-12 12:05 ` Aneesh Kumar K.V
2016-09-13  6:26   ` Anshuman Khandual
2016-09-13 23:57 ` Michael Ellerman
2016-09-14  0:12   ` Paul Mackerras
2016-09-14  3:55     ` Anshuman Khandual
2016-09-14  3:52   ` Anshuman Khandual
2016-09-14  5:28   ` Anshuman Khandual

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).