[<prev] [next>] [day] [month] [year] [list]
Message-Id: <8cc8c64755ae63a6ef2b9808c1874664cdff8869.1580485010.git.christophe.leroy@c-s.fr>
Date: Fri, 31 Jan 2020 15:37:35 +0000 (UTC)
From: Christophe Leroy <christophe.leroy@....fr>
To: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>
Cc: linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: [PATCH] powerpc/nohash: Don't flush all TLBs when flushing one page
When flushing a range, the flushing function flushes all TLBs.
When the range is a single page, do a page flush instead.
Signed-off-by: Christophe Leroy <christophe.leroy@....fr>
---
arch/powerpc/mm/nohash/tlb.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c
index 696f568253a0..3d05d70c54dc 100644
--- a/arch/powerpc/mm/nohash/tlb.c
+++ b/arch/powerpc/mm/nohash/tlb.c
@@ -362,13 +362,32 @@ void __init early_init_mmu_47x(void)
*/
void flush_tlb_kernel_range(unsigned long start, unsigned long end)
{
+ int tsize = mmu_get_tsize(mmu_virtual_psize);
+
#ifdef CONFIG_SMP
preempt_disable();
- smp_call_function(do_flush_tlb_mm_ipi, NULL, 1);
- _tlbil_pid(0);
+#endif
+ start = ALIGN_DOWN(start, PAGE_SIZE);
+ end = ALIGN(end, PAGE_SIZE);
+ if (end - start == PAGE_SIZE) {
+#ifdef CONFIG_SMP
+ struct tlb_flush_param p = {
+ .pid = 0,
+ .addr = start,
+ .tsize = tsize,
+ .ind = 0,
+ };
+ smp_call_function(do_flush_tlb_page_ipi, &p, 1);
+#endif
+ _tlbil_va(start, 0, tsize, 0);
+ } else {
+#ifdef CONFIG_SMP
+ smp_call_function(do_flush_tlb_mm_ipi, NULL, 1);
+#endif
+ _tlbil_pid(0);
+ }
+#ifdef CONFIG_SMP
preempt_enable();
-#else
- _tlbil_pid(0);
#endif
}
EXPORT_SYMBOL(flush_tlb_kernel_range);
--
2.25.0
Powered by blists - more mailing lists