powerpc/mm/radix: Don't do page walk cache flush when doing full mm flush
PATCH 1/2 powerpc/mm/radix: Don't do page walk cache flush when doing full mm flush
For fullmm tlb flush, we do a flush with RIC_FLUSH_ALL which will invalidate all related caches (radix__tlb_flush()). Hence the pwc flush is not needed.
--- arch/powerpc/mm/tlb-radix.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/powerpc/mm/tlb-radix.c +12 -0
@@ -129,6 +129,12 @@ void radix__local_flush_tlb_pwc(struct mmu_gather *tlb, unsigned long addr) {unsigned long pid;struct mm_struct *mm = tlb->mm; +/* +* If we are doing a full mm flush, we will do a tlb flush +* with RIC_FLUSH_ALL later. +*/ +if (tlb->fullmm) +return ;preempt_disable ();
@@ -195,6 +201,12 @@ void radix__flush_tlb_pwc(struct mmu_gather *tlb, unsigned long addr)unsigned long pid;struct mm_struct *mm = tlb->mm; +/* +* If we are doing a full mm flush, we will do a tlb flush +* with RIC_FLUSH_ALL later. +*/ +if (tlb->fullmm) +return ;preempt_disable (); pid = mm->context.id;
Signature · 1 line
2.7.4
PATCH 2/2 powerpc/mm/radix: Remove unnecessary ptesync
For a tlbiel with pid, we need to issue tlbiel with set number encoded. We don't need to do ptesync for each of those. Instead we need one for the entire tlbiel pid operation.
--- arch/powerpc/mm/tlb-radix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/mm/tlb-radix.c +2 -2
@@ -34,10 +34,8 @@ static inline void __tlbiel_pid(unsigned long pid, int set, prs =1 ;/* process scoped */ r =1 ;/* raidx format */ - asmvolatile ("ptesync" : : :"memory" ); asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1) : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory"); - asm volatile("ptesync": : :"memory"); }/*
@@ -47,9 +45,11 @@ static inline void _tlbiel_pid(unsigned long pid, unsigned long ric) {int set; + asmvolatile ("ptesync" : : :"memory" );for (set =0 ; set <POWER9_TLB_SETS_RADIX ; set++) {__tlbiel_pid (pid, set, ric); } + asmvolatile ("ptesync" : : :"memory" ); asmvolatile (PPC_INVALIDATE_ERAT "; isync" : : :"memory" ); }
Signature · 1 line
2.7.4
Re: [PATCH 2/2] powerpc/mm/radix: Remove unnecessary ptesync
Quoted 6 lines · On Sat, 1 Apr 2017 20:11:48 +0530 "Aneesh Kumar K.V"…
For a tlbiel with pid, we need to issue tlbiel with set number encoded. We don't need to do ptesync for each of those. Instead we need one for the entire tlbiel pid operation.
Signed-off-by Benjamin Herrenschmidt <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>
Thanks Aneesh.
Anton
Quoted 32 lines
--- arch/powerpc/mm/tlb-radix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/powerpc/mm/tlb-radix.c +0
-0@@ -34,10 +34,8 @@ static inline void __tlbiel_pid(unsigned long pid,int set, prs = 1; /* process scoped */
arch/powerpc/mm/tlb-radix.c +0
-1r =1 ;/* raidx format */ - asmvolatile ("ptesync" : : :"memory" ); asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1) : : "r"(rb), "i"(r), "i"(prs), "i"(ric),"r"(rs) : "memory");
arch/powerpc/mm/tlb-radix.c +2
-1- asmvolatile ("ptesync" : : :"memory" ); }/* @@ -47,9 +45,11 @@ static inline void _tlbiel_pid(unsigned long pid, unsigned long ric) {int set; + asmvolatile ("ptesync" : : :"memory" );for (set =0 ; set <POWER9_TLB_SETS_RADIX ; set++) {__tlbiel_pid (pid, set, ric); } + asmvolatile ("ptesync" : : :"memory" ); asmvolatile (PPC_INVALIDATE_ERAT "; isync" : : :"memory" ); }
Quoted 3 lines · On Sat, 1 Apr 2017 20:11:47 +0530 "Aneesh Kumar K.V"…
For fullmm tlb flush, we do a flush with
RIC_FLUSH_ALLwhich will invalidate all related caches (radix__tlb_flush()). Hence the pwc flush is not needed.
Thanks Aneesh. I see a 3x improvement in exec performance with these 2 patches.
Anton
Quoted 36 lines
Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/mm/tlb-radix.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)arch/powerpc/mm/tlb-radix.c +12
-0@@ -129,6 +129,12 @@ void radix__local_flush_tlb_pwc(struct mmu_gather *tlb, unsigned long addr) {unsigned long pid;struct mm_struct *mm = tlb->mm; +/* +* If we are doing a full mm flush, we will do a tlb flush +* with RIC_FLUSH_ALL later. +*/ +if (tlb->fullmm) +return ;preempt_disable ();@@ -195,6 +201,12 @@ void radix__flush_tlb_pwc(struct mmu_gather *tlb, unsigned long addr) unsigned long pid;struct mm_struct *mm = tlb->mm; +/* +* If we are doing a full mm flush, we will do a tlb flush +* with RIC_FLUSH_ALL later. +*/ +if (tlb->fullmm) +return ;preempt_disable (); pid = mm->context.id;
Michael Ellerman
AppliedQuoted 5 lines · Aneesh Kumar K.V
For fullmm tlb flush, we do a flush with
RIC_FLUSH_ALLwhich will invalidate all related caches (radix__tlb_flush()). Hence the pwc flush is not needed.Signed-off-by Aneesh Kumar K.V <[email protected]>Acked-by Anton Blanchard <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/f6b0df55cad252fedd60aa2ba75a02
cheers
Michael Ellerman
AppliedRe: [2/2] powerpc/mm/radix: Remove unnecessary ptesync
In reply to Aneesh Kumar K.VQuoted 7 lines · Aneesh Kumar K.V
For a tlbiel with pid, we need to issue tlbiel with set number encoded. We don't need to do ptesync for each of those. Instead we need one for the entire tlbiel pid operation.
Signed-off-by Benjamin Herrenschmidt <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>Acked-by Anton Blanchard <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/f7327e0ba3805470cced2acfa053e7
cheers