lkml.org 
[lkml]   [2019]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 17/17] 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 */


\
 
 \ /
  Last update: 2019-12-11 13:32    [W:0.153 / U:2.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site