Unify TLB gather implementations -v2
Subsystems (15)
cover Unify TLB gather implementations -v2
This is a series that attempts to unify and fix the current tlb gather implementations. Only s390 is left unconverted and most aren't event compiled but other than that its mostly complete (ia64, arm, sh are compile tested).
This second installment doesn't try to change flush_tlb_range() for all architectures but simply uses a fake vma and fills in VM_EXEC and VM_HUGETLB.
This series depends on the mmu_gather rework -v2 series send last week:
https://lkml.org/lkml/2011/3/2/323
which is also available (including the anon_vma refcount simplification,
mm preemtibilidy and davem's sparc64 gup_fast implementation) as a git tree based on next-20110307:
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-mmu_gather.git mmu_gather
The whole series, including the depending patches is available through:
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-mmu_gather.git mmu_unify
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 1/15 mm, powerpc: Dont use tlb_flush for external tlb flushes
Both sparc64 and powerpc64 use tlb_flush() to flush their respective hash-tables which is entirely different from what flush_tlb_range()/flush_tlb_mm() would do.
Powerpc64 already uses arch_*_lazy_mmu_mode() to batch and flush these so any tlb_flush() caller should already find an empty batch. So remove this functionality from tlb_flush().
--- arch/powerpc/mm/tlb_hash64.c | 10 ---------- arch/sparc/include/asm/tlb_64.h | 2 +- arch/sparc/include/asm/tlbflush_64.h | 13 +++++++++++++ 3 files changed, 14 insertions(+), 11 deletions(-)
arch/powerpc/mm/tlb_hash64.c +0 -10
@@ -155,16 +155,6 @@ void __flush_tlb_pending(struct ppc64_tlvoid tlb_flush (struct mmu_gather *tlb) { -struct ppc64_tlb_batch *tlbbatch = &get_cpu_var (ppc64_tlb_batch); - -/* If there's a TLB batch pending, then we must flush it because the -* pages are going to be freed and we really don't want to have a CPU -* access a freed page because it has a stale TLB -*/ -if (tlbbatch->index) -__flush_tlb_pending (tlbbatch); - -put_cpu_var (ppc64_tlb_batch); }/**
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 2/15 mm, sparc64: Dont use tlb_flush for external tlb flushes
In reply to Peter ZijlstraBoth sparc64 and powerpc64 use tlb_flush() to flush their respective hash-tables which is entirely different from what flush_tlb_range()/flush_tlb_mm() would do.
Powerpc64 already uses arch_*_lazy_mmu_mode() to batch and flush these so any tlb_flush() caller should already find an empty batch, make sparc64 do the same.
This ensures all platforms now have a tlb_flush() implementation that is either flush_tlb_mm() or flush_tlb_range().
--- arch/powerpc/mm/tlb_hash64.c | 10 ---------- arch/sparc/include/asm/tlb_64.h | 2 +- arch/sparc/include/asm/tlbflush_64.h | 13 +++++++++++++ 3 files changed, 14 insertions(+), 11 deletions(-)
arch/sparc/include/asm/tlbflush_64.h +13 -0
@@ -26,6 +26,19 @@ extern void flush_tlb_pending(void);#define flush_tlb_page (vma,addr) flush_tlb_pending()#define flush_tlb_mm (mm) flush_tlb_pending() +#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE + +static inline void arch_enter_lazy_mmu_mode (void ) +{ +} + +static inline void arch_leave_lazy_mmu_mode (void ) +{ +flush_tlb_pending (); +} + +#define arch_flush_lazy_mmu_mode () do {} while (0) +/* Local cpu only. */ extern void __flush_tlb_all (void );
arch/sparc/include/asm/tlb_64.h +1 -1
@@ -25,7 +25,7 @@ extern void flush_tlb_pending(void);#define tlb_start_vma (tlb, vma) do { } while (0)#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0) -#define tlb_flush (tlb) flush_tlb_pending() +#define tlb_flush (tlb) do { } while (0)#include <asm-generic/tlb.h>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 3/15 mm, arch: Remove tlb_flush()
In reply to Peter ZijlstraSince all asm-generic/tlb.h users their tlb_flush() implementation is now either a nop or flush_tlb_mm(), remove it and make the generic code use flush_tlb_mm() directly.
--- arch/alpha/include/asm/tlb.h | 2 -- arch/arm/include/asm/tlb.h | 2 -- arch/avr32/include/asm/tlb.h | 5 ----- arch/blackfin/include/asm/tlb.h | 6 ------ arch/cris/include/asm/tlb.h | 1 - arch/frv/include/asm/tlb.h | 5 ----- arch/h8300/include/asm/tlb.h | 13 ------------- arch/m32r/include/asm/tlb.h | 6 ------ arch/m68k/include/asm/tlb.h | 6 ------ arch/microblaze/include/asm/tlb.h | 2 -- arch/mips/include/asm/tlb.h | 5 ----- arch/mn10300/include/asm/tlb.h | 5 ----- arch/parisc/include/asm/tlb.h | 5 ----- arch/powerpc/include/asm/tlb.h | 2 -- arch/powerpc/mm/tlb_hash32.c | 15 --------------- arch/powerpc/mm/tlb_hash64.c | 4 ---- arch/powerpc/mm/tlb_nohash.c | 5 ----- arch/score/include/asm/tlb.h | 1 - arch/sh/include/asm/tlb.h | 1 - arch/sparc/include/asm/tlb_32.h | 5 ----- arch/sparc/include/asm/tlb_64.h | 1 - arch/tile/include/asm/tlb.h | 1 - arch/x86/include/asm/tlb.h | 1 - arch/xtensa/include/asm/tlb.h | 1 - include/asm-generic/tlb.h | 2 +- 25 files changed, 1 insertion(+), 101 deletions(-)
arch/alpha/include/asm/tlb.h +0 -2
@@ -5,8 +5,6 @@#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, pte, addr) do { } while (0) -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm) -#include <asm-generic/tlb.h> #define __pte_free_tlb (tlb, pte, address) pte_free((tlb)->mm, pte)
arch/arm/include/asm/tlb.h +0 -2
@@ -23,8 +23,6 @@#include <linux/pagemap.h> -#define tlb_flush (tlb) ((void) tlb) -#include <asm-generic/tlb.h> #else /* !CONFIG_MMU */
arch/avr32/include/asm/tlb.h +0 -5
@@ -16,11 +16,6 @@#define __tlb_remove_tlb_entry (tlb, pte, address) do { } while(0) -/* -* Flush whole TLB for MM -*/ -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm) -#include <asm-generic/tlb.h> /*
arch/blackfin/include/asm/tlb.h +0 -6
@@ -11,12 +11,6 @@#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0) -/* -* .. because we flush the whole mm when it -* fills up. -*/ -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm) -#include <asm-generic/tlb.h> #endif /* _BLACKFIN_TLB_H */
arch/cris/include/asm/tlb.h +0 -1
@@ -13,7 +13,6 @@#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0) -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm)#include <asm-generic/tlb.h> #endif
arch/frv/include/asm/tlb.h +0 -5
@@ -16,11 +16,6 @@ extern void check_pgt_cache(void);#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0) -/* -* .. because we flush the whole mm when it fills up -*/ -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm) -#include <asm-generic/tlb.h> #endif /* _ASM_TLB_H */
arch/h8300/include/asm/tlb.h +0 -13
@@ -5,19 +5,6 @@#ifndef __H8300_TLB_H__#define __H8300_TLB_H__ -#define tlb_flush (tlb) do { } while(0) - -/* -include/asm-h8300/tlb.h -*/ - -#ifndef __H8300_TLB_H__ -#define __H8300_TLB_H__ - -#define tlb_flush (tlb) do { } while(0) -#include <asm-generic/tlb.h> #endif - -#endif
arch/m32r/include/asm/tlb.h +0 -6
@@ -9,12 +9,6 @@#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, pte, address) do { } while (0) -/* -* .. because we flush the whole mm when it -* fills up. -*/ -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm) -#include <asm-generic/tlb.h> #endif /* _M32R_TLB_H */
arch/m68k/include/asm/tlb.h +0 -6
@@ -9,12 +9,6 @@#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0) -/* -* .. because we flush the whole mm when it -* fills up. -*/ -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm) -#include <asm-generic/tlb.h> #endif /* _M68K_TLB_H */
arch/microblaze/include/asm/tlb.h +0 -2
@@ -11,8 +11,6 @@#ifndef _ASM_MICROBLAZE_TLB_H#define _ASM_MICROBLAZE_TLB_H -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm) -#include <linux/pagemap.h> #include <asm-generic/tlb.h>
arch/mips/include/asm/tlb.h +0 -5
@@ -13,11 +13,6 @@#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0) -/* -* .. because we flush the whole mm when it fills up. -*/ -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm) -#include <asm-generic/tlb.h> #endif /* __ASM_TLB_H */
arch/mn10300/include/asm/tlb.h +0 -5
@@ -23,11 +23,6 @@ extern void check_pgt_cache(void);#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0) -/* -* .. because we flush the whole mm when it fills up -*/ -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm) -/* for now, just use the generic stuff */ #include <asm-generic/tlb.h>
arch/parisc/include/asm/tlb.h +0 -5
@@ -1,11 +1,6 @@#ifndef _PARISC_TLB_H#define _PARISC_TLB_H -#define tlb_flush (tlb) \ -do { if ((tlb)->fullmm) \ - flush_tlb_mm((tlb)->mm);\ -} while (0) -#define tlb_start_vma (tlb, vma) \ do { if (!(tlb)->fullmm) \ flush_cache_range(vma, vma->vm_start, vma->vm_end); \
arch/powerpc/include/asm/tlb.h +0 -2
@@ -28,8 +28,6 @@#define tlb_start_vma (tlb, vma) do { } while (0)#define tlb_end_vma (tlb, vma) do { } while (0) -extern void tlb_flush (struct mmu_gather *tlb); -/* Get the generic bits... */ #include <asm-generic/tlb.h>
arch/powerpc/mm/tlb_hash32.c +0 -15
@@ -59,21 +59,6 @@ void flush_tlb_page_nohash(struct vm_are }/* -* Called at the end of a mmu_gather operation to make sure the -* TLB flush is completely done. -*/ -void tlb_flush (struct mmu_gather *tlb) -{ -if (Hash ==0 ) { -/* -* 603 needs to flush the whole TLB here since -* it doesn't use a hash table. -*/ -_tlbia (); - } -} - -/* * TLB flushing: * * - flush_tlb_mm(mm) flushes the specified mm context TLB's
arch/powerpc/mm/tlb_hash64.c +0 -4
@@ -153,10 +153,6 @@ void __flush_tlb_pending(struct ppc64_tl batch->index =0 ; } -void tlb_flush (struct mmu_gather *tlb) -{ -} -/** * __flush_hash_table_range - Flush all HPTEs for a given address range * from the hash table (and the TLB). But keeps
arch/powerpc/mm/tlb_nohash.c +0 -5
@@ -296,11 +296,6 @@ void flush_tlb_range(struct vm_area_stru }EXPORT_SYMBOL (flush_tlb_range); -void tlb_flush (struct mmu_gather *tlb) -{ -flush_tlb_mm (tlb->mm); -} -/* * Below are functions specific to the 64-bit variant of Book3E though that * may change in the future
arch/score/include/asm/tlb.h +0 -1
@@ -8,7 +8,6 @@#define tlb_start_vma (tlb, vma) do {} while (0)#define tlb_end_vma (tlb, vma) do {} while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do {} while (0) -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm)extern void score7_FTLB_refill_Handler (void );
arch/sh/include/asm/tlb.h +0 -1
@@ -125,7 +125,6 @@ static inline void tlb_unwire_entry(void#define tlb_start_vma (tlb, vma) do { } while (0)#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, pte, address) do { } while (0) -#define tlb_flush (tlb) do { } while (0)#include <asm-generic/tlb.h>
arch/sparc/include/asm/tlb_32.h +0 -5
@@ -14,11 +14,6 @@ do { \#define __tlb_remove_tlb_entry (tlb, pte, address) \ do { } while (0) -#define tlb_flush (tlb) \ -do { \ - flush_tlb_mm((tlb)->mm); \ -} while (0) -#include <asm-generic/tlb.h> #endif /* _SPARC_TLB_H */
arch/sparc/include/asm/tlb_64.h +0 -1
@@ -25,7 +25,6 @@ extern void flush_tlb_pending(void);#define tlb_start_vma (tlb, vma) do { } while (0)#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0) -#define tlb_flush (tlb) do { } while (0)#include <asm-generic/tlb.h>
arch/tile/include/asm/tlb.h +0 -1
@@ -18,7 +18,6 @@#define tlb_start_vma (tlb, vma) do { } while (0)#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0) -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm)#include <asm-generic/tlb.h>
arch/x86/include/asm/tlb.h +0 -1
@@ -4,7 +4,6 @@#define tlb_start_vma (tlb, vma) do { } while (0)#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0) -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm)#include <asm-generic/tlb.h>
arch/xtensa/include/asm/tlb.h +0 -1
@@ -38,7 +38,6 @@#endif #define __tlb_remove_tlb_entry (tlb,pte,addr) do { } while (0) -#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm)#include <asm-generic/tlb.h>
include/asm-generic/tlb.h +1 -1
@@ -159,7 +159,7 @@ tlb_flush_mmu(struct mmu_gather *tlb)if (!tlb->need_flush)return ; tlb->need_flush =0 ; -tlb_flush (tlb); +flush_tlb_mm (tlb->mm);#ifdef CONFIG_HAVE_RCU_TABLE_FREE tlb_table_flush (tlb);#endif
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 4/15 mm: Optimize fullmm TLB flushing
In reply to Peter ZijlstraThis originated from s390 which does something similar and would allow s390 to use the generic TLB flushing code.
The idea is to flush the mm wide cache and tlb a priory and not bother with multiple flushes if the batching isn't large enough.
This can be safely done since there cannot be any concurrency on this mm, its either after the process died (exit) or in the middle of execve where the thread switched to the new mm.
--- include/asm-generic/tlb.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
include/asm-generic/tlb.h +11 -4
@@ -149,6 +149,11 @@ tlb_gather_mmu(struct mmu_gather *tlb, s#ifdef CONFIG_HAVE_RCU_TABLE_FREE tlb->batch =NULL ;#endif + +if (fullmm) { +flush_cache_mm (mm); +flush_tlb_mm (mm); + } } static inline void
@@ -156,13 +161,15 @@ tlb_flush_mmu(struct mmu_gather *tlb) {struct mmu_gather_batch *batch; -if (!tlb->need_flush) -return ; - tlb->need_flush =0 ; -flush_tlb_mm (tlb->mm); +if (!tlb->fullmm && tlb->need_flush) { + tlb->need_flush =0 ; +flush_tlb_mm (tlb->mm); + } +#ifdef CONFIG_HAVE_RCU_TABLE_FREE tlb_table_flush (tlb);#endif +if (tlb_fast_mode (tlb))return ;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 5/15 mm, tile: Change flush_tlb_range() VM_HUGETLB semantics
In reply to Peter ZijlstraSince we're going to provide a fake VMA covering a large range, we need to change the VM_HUGETLB semantic to mean _also_ wipe HPAGE TLBs.
--- arch/tile/kernel/tlb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/tile/kernel/tlb.c +6 -3
@@ -67,11 +67,14 @@ EXPORT_SYMBOL(flush_tlb_page);void flush_tlb_range (const struct vm_area_struct *vma,unsigned long start,unsigned long end) { -unsigned long size =hv_page_size (vma);struct mm_struct *mm = vma->vm_mm;int cache = (vma->vm_flags &VM_EXEC ) ?HV_FLUSH_EVICT_L1I :0 ; -flush_remote (0 , cache, &mm->cpu_vm_mask, start, end - start, size, - &mm->cpu_vm_mask,NULL ,0 ); +flush_remote (0 , cache, &mm->cpu_vm_mask, start, end - start, +PAGE_SIZE , &mm->cpu_vm_mask,NULL ,0 ); +if (vma->vm_flags &VM_HUGETLB ) { +flush_remote (0 ,0 , &mm->cpu_vm_mask, start, end - start, +HPAGE_SIZE , &mm->cpu_vm_mask,NULL ,0 ); + } }void flush_tlb_all (void )
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 6/15 mm: Provide generic range tracking and flushing
In reply to Peter ZijlstraIn order to convert various architectures to generic tlb we need to provide some extra infrastructure to track the range of the flushed page tables.
There are two mmu_gather cases to consider:
unmap_region()
tlb_gather_mmu()
unmap_vmas()
for (; vma; vma = vma->vm_next)
unmap_page_range()
tlb_start_vma() -> flush cache range/track vm_flags
zap_*_range()
arch_enter_lazy_mmu_mode()
ptep_get_and_clear_full() -> batch/track external tlbs
tlb_remove_tlb_entry() -> track range/external tlbs
tlb_remove_page() -> batch page
arch_lazy_leave_mmu_mode() -> flush external tlbs
tlb_end_vma()
free_pgtables()
while (vma)
unlink_*_vma()
free_*_range()
*_free_tlb() -> track range/batch page
tlb_finish_mmu() -> flush TLBs and flush everythingfree vmas
and:
shift_arg_pages()
tlb_gather_mmu()
free_*_range()
*_free_tlb() -> track tlb range
tlb_finish_mmu() -> flush thingsThere are various reasons that we need to flush TLBs _after_ tearing down the page-tables themselves. For some architectures (x86 among others) this serializes against (both hardware and software) page table walkers like gup_fast().
For others (ARM) this is (also) needed to evict stale page-table caches - ARM LPAE mode apparently caches page tables and concurrent hardware walkers could re-populate these caches if the final tlb flush were to be from tlb_end_vma() since an concurrent walk could still be in progress.
So implement generic range tracking over both clearing the PTEs and tearing down the page-tables.
--- arch/Kconfig | 3 + include/asm-generic/tlb.h | 122 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 105 insertions(+), 20 deletions(-)
arch/Kconfig +3 -0
@@ -187,4 +187,7 @@ config ARCH_HAVE_NMI_SAFE_CMPXCHG config HAVE_RCU_TABLE_FREE bool +config HAVE_MMU_GATHER_RANGE + bool + source "kernel/gcov/Kconfig"
include/asm-generic/tlb.h +102 -20
166 lines not on this page · raw message
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 7/15 mm, arm: Convert arm to generic tlb
In reply to Peter ZijlstraMight want to optimize the tlb_flush() function to do a full mm flush when the range is 'large', IA64 does this too.
--- arch/arm/Kconfig | 1 arch/arm/include/asm/tlb.h | 174 +-------------------------------------------- 2 files changed, 6 insertions(+), 169 deletions(-)
arch/arm/Kconfig +1 -0
@@ -28,6 +28,7 @@ config ARM select HAVE_C_RECORDMCOUNT select HAVE_GENERIC_HARDIRQS select HAVE_SPARSE_IRQ + select HAVE_MMU_GATHER_RANGE if MMU help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and
arch/arm/include/asm/tlb.h +5 -169
189 lines not on this page · raw message
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 8/15 mm, ia64: Convert ia64 to generic tlb
In reply to Peter Zijlstra--- arch/ia64/Kconfig | 1 arch/ia64/include/asm/tlb.h | 234 --------------------------------------- arch/ia64/include/asm/tlbflush.h | 25 ++++ arch/ia64/mm/tlb.c | 24 +++- 4 files changed, 49 insertions(+), 235 deletions(-)
arch/ia64/Kconfig +1 -0
@@ -25,6 +25,7 @@ config IA64 select HAVE_GENERIC_HARDIRQS select GENERIC_IRQ_PROBE select GENERIC_PENDING_IRQ if SMP + select HAVE_MMU_GATHER_RANGE select IRQ_PER_CPU select ARCH_HAVE_NMI_SAFE_CMPXCHG default y
arch/ia64/include/asm/tlb.h +2 -232
241 lines not on this page · raw message
arch/ia64/include/asm/tlbflush.h +25 -0
@@ -13,6 +13,31 @@#include <asm/mmu_context.h> #include <asm/page.h> +struct ia64_tr_entry { +u64 ifa; +u64 itir; +u64 pte; +u64 rr; +};/*Record for tr entry!*/ + +extern int ia64_itr_entry (u64 target_mask,u64 va,u64 pte,u64 log_size); +extern void ia64_ptr_entry (u64 target_mask,int slot); +extern struct ia64_tr_entry *ia64_idtrs[NR_CPUS ]; + +/* +region register macros +*/ +#define RR_TO_VE (val) (((val) >> 0) & 0x0000000000000001) +#define RR_VE (val) (((val) & 0x0000000000000001) << 0) +#define RR_VE_MASK 0x0000000000000001L +#define RR_VE_SHIFT 0 +#define RR_TO_PS (val) (((val) >> 2) & 0x000000000000003f) +#define RR_PS (val) (((val) & 0x000000000000003f) << 2) +#define RR_PS_MASK 0x00000000000000fcL +#define RR_PS_SHIFT 2 +#define RR_RID_MASK 0x00000000ffffff00L +#define RR_TO_RID (val) ((val >> 8) & 0xffffff) +/* * Now for some TLB flushing routines. This is the kind of stuff that * can be very expensive, so try to avoid them whenever possible.
arch/ia64/mm/tlb.c +21 -3
@@ -297,9 +297,8 @@ local_flush_tlb_all (void)ia64_srlz_i ();/* srlz.i implies srlz.d */ } -void -flush_tlb_range (struct vm_area_struct *vma,unsigned long start, -unsigned long end) +void __flush_tlb_range (struct vm_area_struct *vma, +unsigned long start,unsigned long end) {struct mm_struct *mm = vma->vm_mm;unsigned long size = end - start;
@@ -335,6 +334,25 @@ flush_tlb_range (struct vm_area_struct *preempt_enable ();ia64_srlz_i ();/* srlz.i implies srlz.d */ } + +void flush_tlb_range (struct vm_area_struct *vma, +unsigned long start,unsigned long end) +{ +if (unlikely (end - start >=1024 *1024 *1024 *1024UL + ||REGION_NUMBER (start) !=REGION_NUMBER (end -1 ))) { +/* +* If we flush more than a tera-byte or across regions, we're +* probably better off just flushing the entire TLB(s). This +* should be very rare and is not worth optimizing for. +*/ +flush_tlb_all (); + }else { +/* flush the address range from the tlb */ +__flush_tlb_range (vma, start, end); +/* flush the virt. page-table area mapping the addr range */ +__flush_tlb_range (vma,ia64_thash (start),ia64_thash (end)); + } +}EXPORT_SYMBOL (flush_tlb_range);void __devinit
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 9/15 mm, sh: Convert sh to generic tlb
In reply to Peter Zijlstra--- arch/sh/Kconfig | 1 arch/sh/include/asm/tlb.h | 98 ++-------------------------------------------- 2 files changed, 6 insertions(+), 93 deletions(-)
arch/sh/Kconfig +1 -0
@@ -24,6 +24,7 @@ config SUPERH select HAVE_SPARSE_IRQ select RTC_LIB select GENERIC_ATOMIC64 + select HAVE_MMU_GATHER_RANGE if MMU # Support the deprecated APIs until MFD and GPIOLIB catch up. select GENERIC_HARDIRQS_NO_DEPRECATED if !MFD_SUPPORT && !GPIOLIB help
arch/sh/include/asm/tlb.h +5 -93
113 lines not on this page · raw message
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 10/15 mm, um, Convert um to generic tlb
In reply to Peter Zijlstra--- arch/um/Kconfig.common | 1 arch/um/include/asm/tlb.h | 111 +--------------------------------------------- arch/um/kernel/tlb.c | 13 ----- 3 files changed, 4 insertions(+), 121 deletions(-)
arch/um/Kconfig.common +1 -0
@@ -8,6 +8,7 @@ config UML default y select HAVE_GENERIC_HARDIRQS select GENERIC_HARDIRQS_NO_DEPRECATED + select HAVE_MMU_GATHER_RANGE config MMU bool
arch/um/include/asm/tlb.h +3 -108
117 lines not on this page · raw message
arch/um/kernel/tlb.c +0 -13
@@ -500,19 +500,6 @@ void flush_tlb_range(struct vm_area_struelse fix_range (vma->vm_mm, start, end,0 ); } -void flush_tlb_mm_range (struct mm_struct *mm,unsigned long start, -unsigned long end) -{ -/* -* Don't bother flushing if this address space is about to be -* destroyed. -*/ -if (atomic_read (&mm->mm_users) ==0 ) -return ; - -fix_range (mm, start, end,0 ); -} -void flush_tlb_mm (struct mm_struct *mm) {struct vm_area_struct *vma = mm->mmap;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 11/15 mm, avr32: Convert avr32 to generic tlb
In reply to Peter Zijlstra--- arch/avr32/Kconfig | 1 + arch/avr32/include/asm/tlb.h | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-)
arch/avr32/Kconfig +1 -0
@@ -7,6 +7,7 @@ config AVR32 select HAVE_OPROFILE select HAVE_KPROBES select ARCH_HAVE_NMI_SAFE_CMPXCHG + select HAVE_MMU_GATHER_RANGE help AVR32 is a high-performance 32-bit RISC microprocessor core, designed for cost-sensitive embedded applications, with particular
arch/avr32/include/asm/tlb.h +0 -6
@@ -8,12 +8,6 @@#ifndef __ASM_AVR32_TLB_H#define __ASM_AVR32_TLB_H -#define tlb_start_vma (tlb, vma) \ - flush_cache_range(vma, vma->vm_start, vma->vm_end) - -#define tlb_end_vma (tlb, vma) \ - flush_tlb_range(vma, vma->vm_start, vma->vm_end) -#define __tlb_remove_tlb_entry (tlb, pte, address) do { } while(0)#include <asm-generic/tlb.h>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 12/15 mm, mips: Convert mips to generic tlb
In reply to Peter Zijlstra--- arch/mips/Kconfig | 1 + arch/mips/include/asm/tlb.h | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-)
arch/mips/Kconfig +1 -0
@@ -22,6 +22,7 @@ config MIPS select HAVE_GENERIC_HARDIRQS select GENERIC_IRQ_PROBE select HAVE_ARCH_JUMP_LABEL + select HAVE_MMU_GATHER_RANGE menu "Machine selection"
arch/mips/include/asm/tlb.h +0 -10
@@ -1,16 +1,6 @@#ifndef __ASM_TLB_H#define __ASM_TLB_H -/* -* MIPS doesn't need any special per-pte or per-vma handling, except -* we need to flush cache for area to be unmapped. -*/ -#define tlb_start_vma (tlb, vma) \ - do { \ - if (!tlb->fullmm) \ - flush_cache_range(vma, vma->vm_start, vma->vm_end); \ - } while (0) -#define tlb_end_vma (tlb, vma) do { } while (0)#define __tlb_remove_tlb_entry (tlb, ptep, address) do { } while (0)#include <asm-generic/tlb.h>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 13/15 mm, parisc: Convert parisc to generic tlb
In reply to Peter Zijlstra--- arch/parisc/Kconfig | 1 + arch/parisc/include/asm/tlb.h | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-)
arch/parisc/Kconfig +1 -0
@@ -17,6 +17,7 @@ config PARISC select IRQ_PER_CPU select GENERIC_HARDIRQS_NO_DEPRECATED select ARCH_HAVE_NMI_SAFE_CMPXCHG + select HAVE_MMU_GATHER_RANGE help The PA-RISC microprocessor is designed by Hewlett-Packard and used
arch/parisc/include/asm/tlb.h +0 -10
@@ -1,16 +1,6 @@#ifndef _PARISC_TLB_H#define _PARISC_TLB_H -#define tlb_start_vma (tlb, vma) \ -do { if (!(tlb)->fullmm) \ - flush_cache_range(vma, vma->vm_start, vma->vm_end); \ -} while (0) - -#define tlb_end_vma (tlb, vma) \ -do { if (!(tlb)->fullmm) \ - flush_tlb_range(vma, vma->vm_start, vma->vm_end); \ -} while (0) -#define __tlb_remove_tlb_entry (tlb, pte, address) \ do { } while (0)
RFC PATCH 14/15 mm, sparc32: Convert sparc32 to generic tlb
In reply to Peter Zijlstra--- arch/sparc/Kconfig | 1 + arch/sparc/include/asm/tlb_32.h | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-)
arch/sparc/Kconfig +1 -0
@@ -25,6 +25,7 @@ config SPARC select HAVE_DMA_ATTRS select HAVE_DMA_API_DEBUG select HAVE_ARCH_JUMP_LABEL + select HAVE_MMU_GATHER_RANGE config SPARC32 def_bool !64BIT
arch/sparc/include/asm/tlb_32.h +0 -10
@@ -1,16 +1,6 @@#ifndef _SPARC_TLB_H#define _SPARC_TLB_H -#define tlb_start_vma (tlb, vma) \ -do { \ - flush_cache_range(vma, vma->vm_start, vma->vm_end); \ -} while (0) - -#define tlb_end_vma (tlb, vma) \ -do { \ - flush_tlb_range(vma, vma->vm_start, vma->vm_end); \ -} while (0) -#define __tlb_remove_tlb_entry (tlb, pte, address) \ do { } while (0)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [RFC][PATCH 14/15] mm, sparc32: Convert sparc32 to generic tlb
Quoted 13 lines · Peter Zijlstra
plain text document attachment (sparc32-mmu_range.patch)
Cc David Miller <[email protected]>Signed-off-by Peter Zijlstra <[email protected]>--- arch/sparc/Kconfig | 1 + arch/sparc/include/asm/tlb_32.h | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-)Index: linux-2.6/arch/sparc/Kconfig
===================================================================
arch/sparc/Kconfig config SPARC · line 31
Quoted 7 lines
arch/sparc/Kconfig +1
-0@@ -25,6 +25,7 @@ config SPARC select HAVE_DMA_ATTRS select HAVE_DMA_API_DEBUG select HAVE_ARCH_JUMP_LABEL + select HAVE_MMU_GATHER_RANGE config SPARC32 def_bool !64BIT
Ah, I probably should put that in the SPARC32 bit.. ;-)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC PATCH 15/15 mm, xtensa: Convert xtensa to generic tlb
In reply to Peter Zijlstra--- arch/xtensa/Kconfig | 1 + arch/xtensa/include/asm/tlb.h | 23 ----------------------- 2 files changed, 1 insertion(+), 23 deletions(-)
arch/xtensa/Kconfig +1 -0
@@ -7,6 +7,7 @@ config ZONE_DMA config XTENSA def_bool y select HAVE_IDE + select HAVE_MMU_GATHER_RANGE help Xtensa processors are 32-bit RISC machines designed by Tensilica primarily for embedded systems. These processors are both
arch/xtensa/include/asm/tlb.h +0 -23
@@ -14,29 +14,6 @@#include <asm/cache.h> #include <asm/page.h> -#if (DCACHE_WAY_SIZE <=PAGE_SIZE ) - -/* Note, read http://lkml.org/lkml/2004/1/15/6 */ - -# define tlb_start_vma (tlb,vma) do { } while (0) -# define tlb_end_vma (tlb,vma) do { } while (0) - -#else - -# define tlb_start_vma (tlb, vma) \ - do { \ - if (!tlb->fullmm) \ - flush_cache_range(vma, vma->vm_start, vma->vm_end); \ - } while(0) - -# define tlb_end_vma (tlb, vma) \ - do { \ - if (!tlb->fullmm) \ - flush_tlb_range(vma, vma->vm_start, vma->vm_end); \ - } while(0) - -#endif -#define __tlb_remove_tlb_entry (tlb,pte,addr) do { } while (0)#include <asm-generic/tlb.h>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>