Skip to contentSkip to conversation

powerpc/mm: Update PROTFAULT handling in the page fault path

PATCH Applied Aneesh Kumar K.V 2 participants 2 messages Jan 30, 2017 – Feb 16, 2017 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/mm: Update PROTFAULT handling in the page fault path

With radix, we can get page fault with DSISR_PROTFAULT value set in case of PROT_NONE or autonuma mapping. The PROT_NONE case in handled by the vma check where we consider the access bad. For autonuma we should fall through and fixup the access mask correctly.

Without this patch we trigger the WARN_ON() on radix. This code moves that WARN_ON() within a radix_enabled() check. I also moved the WARN_ON() outside the if condition making it apply for all type of faults (exec/write/read). It is also conditionalized for book3s, because BOOK3E can also get a PROTFAULT to handle the D/I cache sync.

---
 arch/powerpc/mm/copro_fault.c | 10 ++++++----
 arch/powerpc/mm/fault.c       | 43 +++++++++++++++++++++++++++++++++----------
 2 files changed, 39 insertions(+), 14 deletions(-)
arch/powerpc/mm/copro_fault.c +6 -4
index aaa7ec6788b9..697b70ad1195 100644
@@ -67,11 +67,13 @@ int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
 		if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
 			goto out_unlock;
 		/*
-		 * protfault should only happen due to us
-		 * mapping a region readonly temporarily. PROT_NONE
-		 * is also covered by the VMA check above.
+		 * PROT_NONE is covered by the VMA check above.
+		 * and hash should get a NOHPTE fault instead of
+		 * a PROTFAULT in case fixup is needed for things
+		 * like autonuma.
 		 */
-		WARN_ON_ONCE(dsisr & DSISR_PROTFAULT);
+		if (!radix_enabled())
+			WARN_ON_ONCE(dsisr & DSISR_PROTFAULT);
 	}
 
 	ret = 0;
arch/powerpc/mm/fault.c +33 -10

56 lines not on this page · raw message

Signature · 1 line
2.10.2
#1 lore raw
Quoted 5 lines · Aneesh Kumar K.V

With radix, we can get page fault with DSISR_PROTFAULT value set in case of PROT_NONE or autonuma mapping. The PROT_NONE case in handled by the vma check where we consider the access bad. For autonuma we should fall through and fixup the access mask correctly.

Quoted 7 lines

Without this patch we trigger the WARN_ON() on radix. This code moves that WARN_ON() within a radix_enabled() check. I also moved the WARN_ON() outside the if condition making it apply for all type of faults (exec/write/read). It is also conditionalized for book3s, because BOOK3E can also get a PROTFAULT to handle the D/I cache sync.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/18061c17c8ecdbdbf1e7d1695ec44e

cheers