Skip to content

Commit 9e1b32c

Browse files
ozbenhtorvalds
authored andcommitted
mm: Pass virtual address to [__]p{te,ud,md}_free_tlb()
mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() Upcoming paches to support the new 64-bit "BookE" powerpc architecture will need to have the virtual address corresponding to PTE page when freeing it, due to the way the HW table walker works. Basically, the TLB can be loaded with "large" pages that cover the whole virtual space (well, sort-of, half of it actually) represented by a PTE page, and which contain an "indirect" bit indicating that this TLB entry RPN points to an array of PTEs from which the TLB can then create direct entries. Thus, in order to invalidate those when PTE pages are deleted, we need the virtual address to pass to tlbilx or tlbivax instructions. The old trick of sticking it somewhere in the PTE page struct page sucks too much, the address is almost readily available in all call sites and almost everybody implemets these as macros, so we may as well add the argument everywhere. I added it to the pmd and pud variants for consistency. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: David Howells <dhowells@redhat.com> [MN10300 & FRV] Acked-by: Nick Piggin <npiggin@suse.de> Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> [s390] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4be3bd7 commit 9e1b32c

34 files changed

Lines changed: 107 additions & 82 deletions

File tree

‎arch/alpha/include/asm/tlb.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <asm-generic/tlb.h>
1111

12-
#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, pte)
13-
#define __pmd_free_tlb(tlb, pmd) pmd_free((tlb)->mm, pmd)
12+
#define __pte_free_tlb(tlb, pte, address) pte_free((tlb)->mm, pte)
13+
#define __pmd_free_tlb(tlb, pmd, address) pmd_free((tlb)->mm, pmd)
1414

1515
#endif

‎arch/arm/include/asm/tlb.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
102102
}
103103

104104
#define tlb_remove_page(tlb,page) free_page_and_swap_cache(page)
105-
#define pte_free_tlb(tlb, ptep) pte_free((tlb)->mm, ptep)
106-
#define pmd_free_tlb(tlb, pmdp) pmd_free((tlb)->mm, pmdp)
105+
#define pte_free_tlb(tlb, ptep, addr) pte_free((tlb)->mm, ptep)
106+
#define pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, pmdp)
107107

108108
#define tlb_migrate_finish(mm) do { } while (0)
109109

‎arch/avr32/include/asm/pgalloc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
8383
quicklist_free_page(QUICK_PT, NULL, pte);
8484
}
8585

86-
#define __pte_free_tlb(tlb,pte) \
86+
#define __pte_free_tlb(tlb,pte,addr) \
8787
do { \
8888
pgtable_page_dtor(pte); \
8989
tlb_remove_page((tlb), pte); \

‎arch/cris/include/asm/pgalloc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
4747
__free_page(pte);
4848
}
4949

50-
#define __pte_free_tlb(tlb,pte) \
50+
#define __pte_free_tlb(tlb,pte,address) \
5151
do { \
5252
pgtable_page_dtor(pte); \
5353
tlb_remove_page((tlb), pte); \

‎arch/frv/include/asm/pgalloc.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
4949
__free_page(pte);
5050
}
5151

52-
#define __pte_free_tlb(tlb,pte) \
52+
#define __pte_free_tlb(tlb,pte,address) \
5353
do { \
5454
pgtable_page_dtor(pte); \
5555
tlb_remove_page((tlb),(pte)); \
@@ -62,7 +62,7 @@ do { \
6262
*/
6363
#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *) 2); })
6464
#define pmd_free(mm, x) do { } while (0)
65-
#define __pmd_free_tlb(tlb,x) do { } while (0)
65+
#define __pmd_free_tlb(tlb,x,a) do { } while (0)
6666

6767
#endif /* CONFIG_MMU */
6868

‎arch/frv/include/asm/pgtable.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
225225
*/
226226
#define pud_alloc_one(mm, address) NULL
227227
#define pud_free(mm, x) do { } while (0)
228-
#define __pud_free_tlb(tlb, x) do { } while (0)
228+
#define __pud_free_tlb(tlb, x, address) do { } while (0)
229229

230230
/*
231231
* The "pud_xxx()" functions here are trivial for a folded two-level

‎arch/ia64/include/asm/pgalloc.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud)
4848
{
4949
quicklist_free(0, NULL, pud);
5050
}
51-
#define __pud_free_tlb(tlb, pud) pud_free((tlb)->mm, pud)
51+
#define __pud_free_tlb(tlb, pud, address) pud_free((tlb)->mm, pud)
5252
#endif /* CONFIG_PGTABLE_4 */
5353

5454
static inline void
@@ -67,7 +67,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
6767
quicklist_free(0, NULL, pmd);
6868
}
6969

70-
#define __pmd_free_tlb(tlb, pmd) pmd_free((tlb)->mm, pmd)
70+
#define __pmd_free_tlb(tlb, pmd, address) pmd_free((tlb)->mm, pmd)
7171

7272
static inline void
7373
pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, pgtable_t pte)
@@ -117,6 +117,6 @@ static inline void check_pgt_cache(void)
117117
quicklist_trim(0, NULL, 25, 16);
118118
}
119119

120-
#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, pte)
120+
#define __pte_free_tlb(tlb, pte, address) pte_free((tlb)->mm, pte)
121121

122122
#endif /* _ASM_IA64_PGALLOC_H */

‎arch/ia64/include/asm/tlb.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,22 +236,22 @@ do { \
236236
__tlb_remove_tlb_entry(tlb, ptep, addr); \
237237
} while (0)
238238

239-
#define pte_free_tlb(tlb, ptep) \
239+
#define pte_free_tlb(tlb, ptep, address) \
240240
do { \
241241
tlb->need_flush = 1; \
242-
__pte_free_tlb(tlb, ptep); \
242+
__pte_free_tlb(tlb, ptep, address); \
243243
} while (0)
244244

245-
#define pmd_free_tlb(tlb, ptep) \
245+
#define pmd_free_tlb(tlb, ptep, address) \
246246
do { \
247247
tlb->need_flush = 1; \
248-
__pmd_free_tlb(tlb, ptep); \
248+
__pmd_free_tlb(tlb, ptep, address); \
249249
} while (0)
250250

251-
#define pud_free_tlb(tlb, pudp) \
251+
#define pud_free_tlb(tlb, pudp, address) \
252252
do { \
253253
tlb->need_flush = 1; \
254-
__pud_free_tlb(tlb, pudp); \
254+
__pud_free_tlb(tlb, pudp, address); \
255255
} while (0)
256256

257257
#endif /* _ASM_IA64_TLB_H */

‎arch/m32r/include/asm/pgalloc.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
5858
__free_page(pte);
5959
}
6060

61-
#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, (pte))
61+
#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, (pte))
6262

6363
/*
6464
* allocating and freeing a pmd is trivial: the 1-entry pmd is
@@ -68,7 +68,7 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
6868

6969
#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
7070
#define pmd_free(mm, x) do { } while (0)
71-
#define __pmd_free_tlb(tlb, x) do { } while (0)
71+
#define __pmd_free_tlb(tlb, x, addr) do { } while (0)
7272
#define pgd_populate(mm, pmd, pte) BUG()
7373

7474
#define check_pgt_cache() do { } while (0)

‎arch/m68k/include/asm/motorola_pgalloc.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t page)
5454
__free_page(page);
5555
}
5656

57-
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page)
57+
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
58+
unsigned long address)
5859
{
5960
pgtable_page_dtor(page);
6061
cache_page(kmap(page));
@@ -73,7 +74,8 @@ static inline int pmd_free(struct mm_struct *mm, pmd_t *pmd)
7374
return free_pointer_table(pmd);
7475
}
7576

76-
static inline int __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
77+
static inline int __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
78+
unsigned long address)
7779
{
7880
return free_pointer_table(pmd);
7981
}

0 commit comments

Comments
 (0)