Messages in this thread Patch in this message | | | Date | Fri, 17 Jul 2020 13:10:15 +0200 | From | Peter Zijlstra <> | Subject | [PATCH v2 10/11] riscv/tlb: Fix __p*_free_tlb() |
| |
Just like regular pages, page directories need to observe the following order:
1) unhook 2) TLB invalidate 3) free
to ensure it is safe against concurrent accesses.
Since RISC-V has page based PMDs, no software walkers and IPI based TLB invalidation, it can use the simple tlb_remove_page() based freeer.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> --- arch/riscv/include/asm/pgalloc.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
--- a/arch/riscv/include/asm/pgalloc.h +++ b/arch/riscv/include/asm/pgalloc.h @@ -73,14 +73,15 @@ static inline void pmd_free(struct mm_st free_page((unsigned long)pmd); } -#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd) +#define __pmd_free_tlb(tlb, pmd, addr) \ + tlb_remove_table((tlb), virt_to_page(pmd)) #endif /* __PAGETABLE_PMD_FOLDED */ -#define __pte_free_tlb(tlb, pte, buf) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, buf) \ +do { \ + pgtable_pte_page_dtor(pte); \ + tlb_remove_table((tlb), (pte)); \ } while (0) #endif /* CONFIG_MMU */
| |