Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/mm: Only check for _PAGE_PRESENT in set_pte/pmd functions

We want to make sure we don't use these function when updating a pte
or pmd entry that have a valid hpte entry, because these functions
don't invalidate them. So limit the check to _PAGE_PRESENT bit.
Numafault core changes use these functions for updating _PAGE_NUMA bits.
That should be ok because when _PAGE_NUMA is set we can be sure that
hpte entries are not present.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Aneesh Kumar K.V and committed by
Benjamin Herrenschmidt
8937ba48 c8c06f5a

+2 -2
+1 -1
arch/powerpc/mm/pgtable.c
··· 174 174 pte_t pte) 175 175 { 176 176 #ifdef CONFIG_DEBUG_VM 177 - WARN_ON(pte_present(*ptep)); 177 + WARN_ON(pte_val(*ptep) & _PAGE_PRESENT); 178 178 #endif 179 179 /* Note: mm->context.id might not yet have been assigned as 180 180 * this context might not have been activated yet when this
+1 -1
arch/powerpc/mm/pgtable_64.c
··· 687 687 pmd_t *pmdp, pmd_t pmd) 688 688 { 689 689 #ifdef CONFIG_DEBUG_VM 690 - WARN_ON(!pmd_none(*pmdp)); 690 + WARN_ON(pmd_val(*pmdp) & _PAGE_PRESENT); 691 691 assert_spin_locked(&mm->page_table_lock); 692 692 WARN_ON(!pmd_trans_huge(pmd)); 693 693 #endif