Skip to content

Commit 6245318

Browse files
wildea01Russell King
authored andcommitted
ARM: 8578/1: mm: ensure pmd_present only checks the valid bit
In a subsequent patch, pmd_mknotpresent will clear the valid bit of the pmd entry, resulting in a not-present entry from the hardware's perspective. Unfortunately, pmd_present simply checks for a non-zero pmd value and will therefore continue to return true even after a pmd_mknotpresent operation. Since pmd_mknotpresent is only used for managing huge entries, this is only an issue for the 3-level case. This patch fixes the 3-level pmd_present implementation to take into account the valid bit. For bisectability, the change is made before the fix to pmd_mknotpresent. [[email protected]: comment update regarding pmd_mknotpresent patch] Fixes: 8d96250 ("ARM: mm: Transparent huge page support for LPAE systems.") Cc: <[email protected]> # 3.11+ Cc: Russell King <[email protected]> Cc: Steve Capper <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Catalin Marinas <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent af8c34c commit 6245318

File tree

3 files changed

+2
-1
lines changed

3 files changed

+2
-1
lines changed

arch/arm/include/asm/pgtable-2level.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
193193

194194
#define pmd_large(pmd) (pmd_val(pmd) & 2)
195195
#define pmd_bad(pmd) (pmd_val(pmd) & 2)
196+
#define pmd_present(pmd) (pmd_val(pmd))
196197

197198
#define copy_pmd(pmdpd,pmdps) \
198199
do { \

arch/arm/include/asm/pgtable-3level.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
211211
: !!(pmd_val(pmd) & (val)))
212212
#define pmd_isclear(pmd, val) (!(pmd_val(pmd) & (val)))
213213

214+
#define pmd_present(pmd) (pmd_isset((pmd), L_PMD_SECT_VALID))
214215
#define pmd_young(pmd) (pmd_isset((pmd), PMD_SECT_AF))
215216
#define pte_special(pte) (pte_isset((pte), L_PTE_SPECIAL))
216217
static inline pte_t pte_mkspecial(pte_t pte)

arch/arm/include/asm/pgtable.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
182182
#define pgd_offset_k(addr) pgd_offset(&init_mm, addr)
183183

184184
#define pmd_none(pmd) (!pmd_val(pmd))
185-
#define pmd_present(pmd) (pmd_val(pmd))
186185

187186
static inline pte_t *pmd_page_vaddr(pmd_t pmd)
188187
{

0 commit comments

Comments
 (0)