[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200717111349.766472738@infradead.org>
Date: Fri, 17 Jul 2020 13:10:12 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Will Deacon <will@...nel.org>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Nick Piggin <npiggin@...il.com>,
Peter Zijlstra <peterz@...radead.org>
Cc: linux-arch@...r.kernel.org, linux-sh@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Rich Felker <dalias@...c.org>,
"David S. Miller" <davem@...emloft.net>,
Helge Deller <deller@....de>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Paul Burton <paulburton@...nel.org>,
Tony Luck <tony.luck@...el.com>,
Richard Henderson <rth@...ddle.net>,
Nick Hu <nickhu@...estech.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>,
Christoph Hellwig <hch@....de>
Subject: [PATCH v2 07/11] ia64/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 IA64 has page based P[UM]Ds, 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@...radead.org>
---
arch/ia64/include/asm/pgalloc.h | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/arch/ia64/include/asm/pgalloc.h
+++ b/arch/ia64/include/asm/pgalloc.h
@@ -50,7 +50,9 @@ static inline void pud_free(struct mm_st
{
free_page((unsigned long)pud);
}
-#define __pud_free_tlb(tlb, pud, address) pud_free((tlb)->mm, pud)
+
+#define __pud_free_tlb(tlb, pud, address) \
+ tlb_remove_table((tlb), virt_to_page(pud))
#endif /* CONFIG_PGTABLE_LEVELS == 4 */
static inline void
@@ -69,7 +71,8 @@ static inline void pmd_free(struct mm_st
free_page((unsigned long)pmd);
}
-#define __pmd_free_tlb(tlb, pmd, address) pmd_free((tlb)->mm, pmd)
+#define __pmd_free_tlb(tlb, pmd, address) \
+ tlb_remove_table((tlb), virt_to_page(pmd)
static inline void
pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, pgtable_t pte)
@@ -84,6 +87,10 @@ pmd_populate_kernel(struct mm_struct *mm
pmd_val(*pmd_entry) = __pa(pte);
}
-#define __pte_free_tlb(tlb, pte, address) pte_free((tlb)->mm, pte)
+#define __pte_free_tlb(tlb, pte, address) \
+do { \
+ pgtable_pte_page_dtor(pte); \
+ tlb_remove_table((tlb), (pte)); \
+} while (0)
#endif /* _ASM_IA64_PGALLOC_H */
Powered by blists - more mailing lists