Patch "powerpc/mm/radix: Use tlbiel only if we ever ran on the current cpu" has been added to the 4.8-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
powerpc/mm/radix: Use tlbiel only if we ever ran on the current cpu
to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
powerpc-mm-radix-use-tlbiel-only-if-we-ever-ran-on-the-current-cpu.patch
and it can be found in the queue-4.8 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
bd77c4498616e27d5725b5959d880ce2272fefa9Mon Sep 17 00:00:00 2001
From: "Aneesh Kumar K.V" <[email protected]>
Date: Mon, 24 Oct 2016 08:50:43 +0530
Subject: powerpc/mm/radix: Use tlbiel only if we ever ran on the current cpu
From: Aneesh Kumar K.V <[email protected]>
commit bd77c4498616e27d5725b5959d880ce2272fefa9 upstream.
Before this patch, we used tlbiel, if we ever ran only on this core. That was mostly derived from the nohash usage of the same. But is incorrect, the ISA 3.0 clarifies tlbiel such that:
"All TLB entries that have all of the following properties are made invalid on the thread executing the tlbiel instruction"
ie. tlbiel only invalidates TLB entries on the current thread. So if the mm has been used on any other thread (aka. cpu) then we must broadcast the invalidate.
This bug could lead to invalid TLB entries if a program runs on multiple threads of a core.
Hence use tlbiel, if we only ever ran on only the current cpu.
--- arch/powerpc/include/asm/tlb.h | 12 ++++++++++++ arch/powerpc/mm/tlb-radix.c | 8 ++++---- 2 files changed, 16 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/tlb.h +12 -0
@@ -52,11 +52,23 @@ static inline int mm_is_core_local(strucreturn cpumask_subset (mm_cpumask (mm),topology_sibling_cpumask (smp_processor_id ())); } + +static inline int mm_is_thread_local (struct mm_struct *mm) +{ +return cpumask_equal (mm_cpumask (mm), +cpumask_of (smp_processor_id ())); +} +#else static inline int mm_is_core_local (struct mm_struct *mm) {return 1 ; } + +static inline int mm_is_thread_local (struct mm_struct *mm) +{ +return 1 ; +}#endif #endif /* __KERNEL__ */
arch/powerpc/mm/tlb-radix.c +4 -4
@@ -175,7 +175,7 @@ void radix__flush_tlb_mm(struct mm_strucif (unlikely (pid ==MMU_NO_CONTEXT )) goto no_context; -if (!mm_is_core_local (mm)) { +if (!mm_is_thread_local (mm)) {int lock_tlbie = !mmu_has_feature (MMU_FTR_LOCKLESS_TLBIE );if (lock_tlbie)
@@ -201,7 +201,7 @@ void radix__flush_tlb_pwc(struct mmu_gatif (unlikely (pid ==MMU_NO_CONTEXT )) goto no_context; -if (!mm_is_core_local (mm)) { +if (!mm_is_thread_local (mm)) {int lock_tlbie = !mmu_has_feature (MMU_FTR_LOCKLESS_TLBIE );if (lock_tlbie)
@@ -226,7 +226,7 @@ void radix__flush_tlb_page_psize(struct pid = mm ? mm->context.id :0 ;if (unlikely (pid ==MMU_NO_CONTEXT )) goto bail; -if (!mm_is_core_local (mm)) { +if (!mm_is_thread_local (mm)) {int lock_tlbie = !mmu_has_feature (MMU_FTR_LOCKLESS_TLBIE );if (lock_tlbie)
@@ -321,7 +321,7 @@ void radix__flush_tlb_range_psize(struct {unsigned long pid;unsigned long addr; -int local =mm_is_core_local (mm); +int local =mm_is_thread_local (mm);unsigned long ap =mmu_get_ap (psize);int lock_tlbie = !mmu_has_feature (MMU_FTR_LOCKLESS_TLBIE );unsigned long page_size =1UL << mmu_psize_defs[psize].shift;
Patches currently in stable-queue which might be from [email protected] are
queue-4.8/powerpc-mm-radix-use-tlbiel-only-if-we-ever-ran-on-the-current-cpu.patch