Skip to content

Commit c9f27f1

Browse files
committed
ARM: LPAE: Invalidate the TLB before freeing the PMD
Similar to the PTE freeing, this patch introduced __pmd_free_tlb() which invalidates the TLB before freeing a PMD page. This is needed because on newer processors the entry in the upper page table may be cached by the TLB and point to random data after the PMD has been freed. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 1b6ba46 commit c9f27f1

File tree

1 file changed

+10
-1
lines changed
  • arch/arm/include/asm

1 file changed

+10
-1
lines changed

arch/arm/include/asm/tlb.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,17 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
202202
tlb_remove_page(tlb, pte);
203203
}
204204

205+
static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
206+
unsigned long addr)
207+
{
208+
#ifdef CONFIG_ARM_LPAE
209+
tlb_add_flush(tlb, addr);
210+
tlb_remove_page(tlb, virt_to_page(pmdp));
211+
#endif
212+
}
213+
205214
#define pte_free_tlb(tlb, ptep, addr) __pte_free_tlb(tlb, ptep, addr)
206-
#define pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, pmdp)
215+
#define pmd_free_tlb(tlb, pmdp, addr) __pmd_free_tlb(tlb, pmdp, addr)
207216
#define pud_free_tlb(tlb, pudp, addr) pud_free((tlb)->mm, pudp)
208217

209218
#define tlb_migrate_finish(mm) do { } while (0)

0 commit comments

Comments
 (0)