Skip to contentSkip to conversation

powerpc: Fix hugetlb with CONFIG_PPC_MM_SLICES=y

PATCH In review Paul Mackerras 2 participants 2 messages Sep 21, 2011 – Sep 23, 2011 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Fix hugetlb with CONFIG_PPC_MM_SLICES=y

Commit 41151e77a4 ("powerpc: Hugetlb for BookE") added some #ifdef CONFIG_MM_SLICES conditionals to hugetlb_get_unmapped_area() and vma_mmu_pagesize(). Unfortunately this is not the correct config symbol; it should be CONFIG_PPC_MM_SLICES. The result is that attempting to use hugetlbfs on 64-bit Power server processors results in an infinite stack recursion between get_unmapped_area() and hugetlb_get_unmapped_area().

This fixes it by changing the #ifdef to use CONFIG_PPC_MM_SLICES in those functions and also in book3e_hugetlb_preload().

---
 arch/powerpc/mm/hugetlbpage-book3e.c |    2 +-
 arch/powerpc/mm/hugetlbpage.c        |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/mm/hugetlbpage-book3e.c +1 -1
index 1295b7c..343ad0b 100644
@@ -52,7 +52,7 @@ void book3e_hugetlb_preload(struct mm_struct *mm, unsigned long ea, pte_t pte)
 	if (unlikely(is_kernel_addr(ea)))
 		return;
 
-#ifdef CONFIG_MM_SLICES
+#ifdef CONFIG_PPC_MM_SLICES
 	psize = mmu_get_tsize(get_slice_psize(mm, ea));
 	tsize = mmu_get_psize(psize);
 	shift = mmu_psize_defs[psize].shift;
arch/powerpc/mm/hugetlbpage.c +2 -2
index 3a5f59d..48b65be 100644
@@ -690,7 +690,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 					unsigned long len, unsigned long pgoff,
 					unsigned long flags)
 {
-#ifdef CONFIG_MM_SLICES
+#ifdef CONFIG_PPC_MM_SLICES
 	struct hstate *hstate = hstate_file(file);
 	int mmu_psize = shift_to_mmu_psize(huge_page_shift(hstate));
 
@@ -702,7 +702,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 
 unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
 {
-#ifdef CONFIG_MM_SLICES
+#ifdef CONFIG_PPC_MM_SLICES
 	unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start);
 
 	return 1UL << mmu_psize_to_shift(psize);
Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 11 lines · Paul Mackerras

Commit 41151e77a4 ("powerpc: Hugetlb for BookE") added some #ifdef CONFIG_MM_SLICES conditionals to hugetlb_get_unmapped_area() and vma_mmu_pagesize(). Unfortunately this is not the correct config symbol; it should be CONFIG_PPC_MM_SLICES. The result is that attempting to use hugetlbfs on 64-bit Power server processors results in an infinite stack recursion between get_unmapped_area() and hugetlb_get_unmapped_area().
=20
This fixes it by changing the #ifdef to use CONFIG_PPC_MM_SLICES in those functions and also in book3e_hugetlb_preload(). =20

Quoted 1 line

Paul, Ben,

ACK since it looks like Ben has picked this up already..... but FYI I = have a different version of this fix in my tree. The = get_unmapped_area() shouldn't be there *at all* - we can just use the = generic code if we don't have slices. So instead the whole = hugetlb_get_unmapped_area function should be wrapped in PPC_MM_SLICES. = This is crufty debug stuff that I missed yanking out when I pushed the = patch, my apologies.

I'll just submit a followup patch to fix this.

Cheers,
B

=

Quoted 6 lines

---

arch/powerpc/mm/hugetlbpage-book3e.c |    2 +-
arch/powerpc/mm/hugetlbpage.c        |    4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

=20

= renamed from arch/powerpc/mm/hugetlbpage-book3e.c +0 -0

b/arch/powerpc/mm/hugetlbpage-book3e.c

arch/powerpc/mm/hugetlbpage-book3e.c void book3e_hugetlb_preload(struct mm_struct *mm, =

Quoted 4 lines

index 1295b7c..343ad0b 100644

arch/powerpc/mm/hugetlbpage-book3e.c +0 -0
@@ -52,7 +52,7 @@ void book3e_hugetlb_preload(struct mm_struct *mm, =

unsigned long ea, pte_t pte)

=

Quoted 9 lines
arch/powerpc/mm/hugetlbpage-book3e.c +0 -0
 	if (unlikely(is_kernel_addr(ea)))
 		return;

=20

arch/powerpc/mm/hugetlbpage-book3e.c +1 -1
-#ifdef CONFIG_MM_SLICES
+#ifdef CONFIG_PPC_MM_SLICES
	psize =3D mmu_get_tsize(get_slice_psize(mm, ea));
	tsize =3D mmu_get_psize(psize);
	shift =3D mmu_psize_defs[psize].shift;
= renamed from arch/powerpc/mm/hugetlbpage.c +0 -0

b/arch/powerpc/mm/hugetlbpage.c

arch/powerpc/mm/hugetlbpage.c unsigned long hugetlb_get_unmapped_area(struct =

Quoted 4 lines

index 3a5f59d..48b65be 100644

arch/powerpc/mm/hugetlbpage.c +0 -0
@@ -690,7 +690,7 @@ unsigned long hugetlb_get_unmapped_area(struct =

file *file, unsigned long addr,

arch/powerpc/mm/hugetlbpage.c unsigned long hugetlb_get_unmapped_area(struct = · line 690

Quoted 1 line
arch/powerpc/mm/hugetlbpage.c +0 -0
 					unsigned long len, unsigned long =

pgoff,

arch/powerpc/mm/hugetlbpage.c unsigned long hugetlb_get_unmapped_area(struct =

Quoted 8 lines
arch/powerpc/mm/hugetlbpage.c +1 -1
 					unsigned long flags)
 {
-#ifdef CONFIG_MM_SLICES
+#ifdef CONFIG_PPC_MM_SLICES
 	struct hstate *hstate =3D hstate_file(file);
 	int mmu_psize =3D shift_to_mmu_psize(huge_page_shift(hstate));

=20

arch/powerpc/mm/hugetlbpage.c +0 -0
@@ -702,7 +702,7 @@ unsigned long hugetlb_get_unmapped_area(struct =

file *file, unsigned long addr,

Quoted 6 lines

=20
unsigned long vma_mmu_pagesize(struct vm_area_struct *vma) {

arch/powerpc/mm/hugetlbpage.c +1 -1
-#ifdef CONFIG_MM_SLICES
+#ifdef CONFIG_PPC_MM_SLICES
	unsigned int psize =3D get_slice_psize(vma->vm_mm, =

vma->vm_start);

Quoted 4 lines

=20

	return 1UL << mmu_psize_to_shift(psize);

--=20
1.7.5.4