Skip to contentSkip to conversation

Patch "powerpc: Fix usage of _PAGE_RO in hugepage" has been added to the 4.8-stable tree

PATCH [email protected] 1 participant 1 message Oct 29, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

powerpc: Fix usage of _PAGE_RO in hugepage

to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
powerpc-fix-usage-of-_page_ro-in-hugepage.patch
and it can be found in the queue-4.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 6b8cb66a6a7cc182b47da6a0a1d4e5da324c0695 Mon Sep 17 00:00:00 2001

From: Christophe Leroy <[email protected]>
Date: Mon, 19 Sep 2016 12:58:54 +0200
Subject: powerpc: Fix usage of _PAGE_RO in hugepage

From: Christophe Leroy <[email protected]>

commit 6b8cb66a6a7cc182b47da6a0a1d4e5da324c0695 upstream.

On some CPUs like the 8xx, _PAGE_RW hence _PAGE_WRITE is defined as 0 and _PAGE_RO has to be set when a page is not writable

_PAGE_RO is defined by default in pte-common.h, however BOOK3S/64 doesn't include that file so _PAGE_RO has to be defined explicitly in book3s/64/pgtable.h

Fixes a7b9f671f2d14 ("powerpc32: adds handling of _PAGE_RO")
---
 arch/powerpc/include/asm/book3s/64/pgtable.h |    2 ++
 arch/powerpc/mm/hugetlbpage.c                |    7 +++++++
 2 files changed, 9 insertions(+)
arch/powerpc/include/asm/book3s/64/pgtable.h +2 -0
@@ -6,6 +6,8 @@
  */
 #define _PAGE_BIT_SWAP_TYPE	0
 
+#define _PAGE_RO		0
+
 #define _PAGE_EXEC		0x00001 /* execute permission */
 #define _PAGE_WRITE		0x00002 /* write access allowed */
 #define _PAGE_READ		0x00004	/* read access allowed */
arch/powerpc/mm/hugetlbpage.c +7 -0
@@ -1019,8 +1019,15 @@ int gup_hugepte(pte_t *ptep, unsigned lo
 
 	pte = READ_ONCE(*ptep);
 	mask = _PAGE_PRESENT | _PAGE_READ;
+
+	/*
+	 * On some CPUs like the 8xx, _PAGE_RW hence _PAGE_WRITE is defined
+	 * as 0 and _PAGE_RO has to be set when a page is not writable
+	 */
 	if (write)
 		mask |= _PAGE_WRITE;
+	else
+		mask |= _PAGE_RO;
 
 	if ((pte_val(pte) & mask) != mask)
 		return 0;

Patches currently in stable-queue which might be from [email protected] are

queue-4.8/powerpc-fix-usage-of-_page_ro-in-hugepage.patch