Skip to content

Commit bd0dbb7

Browse files
kvaneeshmpe
authored andcommitted
powerpc/mm/books3s: Add new pte bit to mark pte temporarily invalid.
When splitting a huge pmd pte, we need to mark the pmd entry invalid. We can do that by clearing _PAGE_PRESENT bit. But then that will be taken as a swap pte. In order to differentiate between the two use a software pte bit when invalidating. For regular pte, due to bd5050e ("powerpc/mm/radix: Change pte relax sequence to handle nest MMU hang") we need to mark the pte entry invalid when relaxing access permission. Instead of marking pte_none which can result in different page table walk routines possibly skipping this pte entry, invalidate it but still keep it marked present. Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 810e9f8 commit bd0dbb7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

arch/powerpc/include/asm/book3s/64/pgtable.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@
4444

4545
#define _PAGE_PTE 0x4000000000000000UL /* distinguishes PTEs from pointers */
4646
#define _PAGE_PRESENT 0x8000000000000000UL /* pte contains a translation */
47+
/*
48+
* We need to mark a pmd pte invalid while splitting. We can do that by clearing
49+
* the _PAGE_PRESENT bit. But then that will be taken as a swap pte. In order to
50+
* differentiate between two use a SW field when invalidating.
51+
*
52+
* We do that temporary invalidate for regular pte entry in ptep_set_access_flags
53+
*
54+
* This is used only when _PAGE_PRESENT is cleared.
55+
*/
56+
#define _PAGE_INVALID _RPAGE_SW0
4757

4858
/*
4959
* Top and bottom bits of RPN which can be used by hash
@@ -568,7 +578,13 @@ static inline pte_t pte_clear_savedwrite(pte_t pte)
568578

569579
static inline int pte_present(pte_t pte)
570580
{
571-
return !!(pte_raw(pte) & cpu_to_be64(_PAGE_PRESENT));
581+
/*
582+
* A pte is considerent present if _PAGE_PRESENT is set.
583+
* We also need to consider the pte present which is marked
584+
* invalid during ptep_set_access_flags. Hence we look for _PAGE_INVALID
585+
* if we find _PAGE_PRESENT cleared.
586+
*/
587+
return !!(pte_raw(pte) & cpu_to_be64(_PAGE_PRESENT | _PAGE_INVALID));
572588
}
573589

574590
#ifdef CONFIG_PPC_MEM_KEYS

0 commit comments

Comments
 (0)