Skip to content

Commit 6137fed

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
arch/tlb: Clean up simple architectures
For the architectures that do not implement their own tlb_flush() but do already use the generic mmu_gather, there are two options: 1) the platform has an efficient flush_tlb_range() and asm-generic/tlb.h doesn't need any overrides at all. 2) the platform lacks an efficient flush_tlb_range() and we select MMU_GATHER_NO_RANGE to minimize full invalidates. Convert all 'simple' architectures to one of these two forms. alpha: has no range invalidate -> 2 arc: already used flush_tlb_range() -> 1 c6x: has no range invalidate -> 2 hexagon: has an efficient flush_tlb_range() -> 1 (flush_tlb_mm() is in fact a full range invalidate, so no need to shoot down everything) m68k: has inefficient flush_tlb_range() -> 2 microblaze: has no flush_tlb_range() -> 2 mips: has efficient flush_tlb_range() -> 1 (even though it currently seems to use flush_tlb_mm()) nds32: already uses flush_tlb_range() -> 1 nios2: has inefficient flush_tlb_range() -> 2 (no limit on range iteration) openrisc: has inefficient flush_tlb_range() -> 2 (no limit on range iteration) parisc: already uses flush_tlb_range() -> 1 sparc32: already uses flush_tlb_range() -> 1 unicore32: has inefficient flush_tlb_range() -> 2 (no limit on range iteration) xtensa: has efficient flush_tlb_range() -> 1 Note this also fixes a bug in the existing code for a number platforms. Those platforms that did: tlb_end_vma() -> if (!full_mm) flush_tlb_*() tlb_flush -> if (full_mm) flush_tlb_mm() missed the case of shift_arg_pages(), which doesn't have @fullmm set, nor calls into tlb_*vma(), but still frees page-tables and thus needs an invalidate. The new code handles this by detecting a non-empty range, and either issuing the matching range invalidate or a full invalidate, depending on the capabilities. No change in behavior intended. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Aneesh Kumar K.V <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David S. Miller <[email protected]> Cc: Greentime Hu <[email protected]> Cc: Guan Xuetao <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Helge Deller <[email protected]> Cc: Jonas Bonn <[email protected]> Cc: Ley Foon Tan <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mark Salter <[email protected]> Cc: Max Filippov <[email protected]> Cc: Michal Simek <[email protected]> Cc: Nick Piggin <[email protected]> Cc: Paul Burton <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Richard Kuo <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 7bb8709 commit 6137fed

File tree

22 files changed

+16
-143
lines changed

22 files changed

+16
-143
lines changed

arch/alpha/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ config ALPHA
3636
select ODD_RT_SIGACTION
3737
select OLD_SIGSUSPEND
3838
select CPU_NO_EFFICIENT_FFS if !ALPHA_EV67
39+
select MMU_GATHER_NO_RANGE
3940
help
4041
The Alpha is a 64-bit general-purpose processor designed and
4142
marketed by the Digital Equipment Corporation of blessed memory,

arch/alpha/include/asm/tlb.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
#ifndef _ALPHA_TLB_H
33
#define _ALPHA_TLB_H
44

5-
#define tlb_start_vma(tlb, vma) do { } while (0)
6-
#define tlb_end_vma(tlb, vma) do { } while (0)
7-
#define __tlb_remove_tlb_entry(tlb, pte, addr) do { } while (0)
8-
9-
#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
10-
115
#include <asm-generic/tlb.h>
126

137
#define __pte_free_tlb(tlb, pte, address) pte_free((tlb)->mm, pte)

arch/arc/include/asm/tlb.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,6 @@
99
#ifndef _ASM_ARC_TLB_H
1010
#define _ASM_ARC_TLB_H
1111

12-
#define tlb_flush(tlb) \
13-
do { \
14-
if (tlb->fullmm) \
15-
flush_tlb_mm((tlb)->mm); \
16-
} while (0)
17-
18-
/*
19-
* This pair is called at time of munmap/exit to flush cache and TLB entries
20-
* for mappings being torn down.
21-
* 1) cache-flush part -implemented via tlb_start_vma( ) for VIPT aliasing D$
22-
* 2) tlb-flush part - implemted via tlb_end_vma( ) flushes the TLB range
23-
*
24-
* Note, read http://lkml.org/lkml/2004/1/15/6
25-
*/
26-
27-
#define tlb_end_vma(tlb, vma) \
28-
do { \
29-
if (!tlb->fullmm) \
30-
flush_tlb_range(vma, vma->vm_start, vma->vm_end); \
31-
} while (0)
32-
33-
#define __tlb_remove_tlb_entry(tlb, ptep, address)
34-
3512
#include <linux/pagemap.h>
3613
#include <asm-generic/tlb.h>
3714

arch/c6x/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ config C6X
2020
select GENERIC_CLOCKEVENTS
2121
select MODULES_USE_ELF_RELA
2222
select ARCH_NO_COHERENT_DMA_MMAP
23+
select MMU_GATHER_NO_RANGE if MMU
2324

2425
config MMU
2526
def_bool n

arch/c6x/include/asm/tlb.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#ifndef _ASM_C6X_TLB_H
33
#define _ASM_C6X_TLB_H
44

5-
#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
6-
75
#include <asm-generic/tlb.h>
86

97
#endif /* _ASM_C6X_TLB_H */

arch/h8300/include/asm/tlb.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#ifndef __H8300_TLB_H__
33
#define __H8300_TLB_H__
44

5-
#define tlb_flush(tlb) do { } while (0)
6-
75
#include <asm-generic/tlb.h>
86

97
#endif

arch/hexagon/include/asm/tlb.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,6 @@
2222
#include <linux/pagemap.h>
2323
#include <asm/tlbflush.h>
2424

25-
/*
26-
* We don't need any special per-pte or per-vma handling...
27-
*/
28-
#define tlb_start_vma(tlb, vma) do { } while (0)
29-
#define tlb_end_vma(tlb, vma) do { } while (0)
30-
#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
31-
32-
/*
33-
* .. because we flush the whole mm when it fills up
34-
*/
35-
#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
36-
3725
#include <asm-generic/tlb.h>
3826

3927
#endif

arch/m68k/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ config M68K
2828
select OLD_SIGSUSPEND3
2929
select OLD_SIGACTION
3030
select ARCH_DISCARD_MEMBLOCK
31+
select MMU_GATHER_NO_RANGE if MMU
3132

3233
config CPU_BIG_ENDIAN
3334
def_bool y

arch/m68k/include/asm/tlb.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,6 @@
22
#ifndef _M68K_TLB_H
33
#define _M68K_TLB_H
44

5-
/*
6-
* m68k doesn't need any special per-pte or
7-
* per-vma handling..
8-
*/
9-
#define tlb_start_vma(tlb, vma) do { } while (0)
10-
#define tlb_end_vma(tlb, vma) do { } while (0)
11-
#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
12-
13-
/*
14-
* .. because we flush the whole mm when it
15-
* fills up.
16-
*/
17-
#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
18-
195
#include <asm-generic/tlb.h>
206

217
#endif /* _M68K_TLB_H */

arch/microblaze/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ config MICROBLAZE
4141
select TRACING_SUPPORT
4242
select VIRT_TO_BUS
4343
select CPU_NO_EFFICIENT_FFS
44+
select MMU_GATHER_NO_RANGE if MMU
4445

4546
# Endianness selection
4647
choice

0 commit comments

Comments
 (0)