Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/64s: do not re-activate batched TLB flush

Patch series "Nesting support for lazy MMU mode", v6.

When the lazy MMU mode was introduced eons ago, it wasn't made clear
whether such a sequence was legal:

arch_enter_lazy_mmu_mode()
...
arch_enter_lazy_mmu_mode()
...
arch_leave_lazy_mmu_mode()
...
arch_leave_lazy_mmu_mode()

It seems fair to say that nested calls to
arch_{enter,leave}_lazy_mmu_mode() were not expected, and most
architectures never explicitly supported it.

Nesting does in fact occur in certain configurations, and avoiding it has
proved difficult. This series therefore enables lazy_mmu sections to
nest, on all architectures.

Nesting is handled using a counter in task_struct (patch 8), like other
stateless APIs such as pagefault_{disable,enable}(). This is fully
handled in a new generic layer in <linux/pgtable.h>; the arch_* API
remains unchanged. A new pair of calls, lazy_mmu_mode_{pause,resume}(),
is also introduced to allow functions that are called with the lazy MMU
mode enabled to temporarily pause it, regardless of nesting.

An arch now opts in to using the lazy MMU mode by selecting
CONFIG_ARCH_LAZY_MMU; this is more appropriate now that we have a generic
API, especially with state conditionally added to task_struct.


This patch (of 14):

Since commit b9ef323ea168 ("powerpc/64s: Disable preemption in hash lazy
mmu mode") a task can not be preempted while in lazy MMU mode. Therefore,
the batch re-activation code is never called, so remove it.

Link: https://lkml.kernel.org/r/20251215150323.2218608-1-kevin.brodsky@arm.com
Link: https://lkml.kernel.org/r/20251215150323.2218608-2-kevin.brodsky@arm.com
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Borislav Betkov <bp@alien8.de>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: David S. Miller <davem@davemloft.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Juegren Gross <jgross@suse.com>
Cc: levi.yun <yeoreum.yun@arm.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Thomas Gleinxer <tglx@linutronix.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Cc: David Hildenbrand (Red Hat) <david@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Alexander Gordeev and committed by
Andrew Morton
58852f24 2a912d44

-27
-2
arch/powerpc/include/asm/thread_info.h
··· 154 154 /* Don't move TLF_NAPPING without adjusting the code in entry_32.S */ 155 155 #define TLF_NAPPING 0 /* idle thread enabled NAP mode */ 156 156 #define TLF_SLEEPING 1 /* suspend code enabled SLEEP mode */ 157 - #define TLF_LAZY_MMU 3 /* tlb_batch is active */ 158 157 #define TLF_RUNLATCH 4 /* Is the runlatch enabled? */ 159 158 160 159 #define _TLF_NAPPING (1 << TLF_NAPPING) 161 160 #define _TLF_SLEEPING (1 << TLF_SLEEPING) 162 - #define _TLF_LAZY_MMU (1 << TLF_LAZY_MMU) 163 161 #define _TLF_RUNLATCH (1 << TLF_RUNLATCH) 164 162 165 163 #ifndef __ASSEMBLER__
-25
arch/powerpc/kernel/process.c
··· 1281 1281 { 1282 1282 struct thread_struct *new_thread, *old_thread; 1283 1283 struct task_struct *last; 1284 - #ifdef CONFIG_PPC_64S_HASH_MMU 1285 - struct ppc64_tlb_batch *batch; 1286 - #endif 1287 1284 1288 1285 new_thread = &new->thread; 1289 1286 old_thread = &current->thread; ··· 1288 1291 WARN_ON(!irqs_disabled()); 1289 1292 1290 1293 #ifdef CONFIG_PPC_64S_HASH_MMU 1291 - batch = this_cpu_ptr(&ppc64_tlb_batch); 1292 - if (batch->active) { 1293 - current_thread_info()->local_flags |= _TLF_LAZY_MMU; 1294 - if (batch->index) 1295 - __flush_tlb_pending(batch); 1296 - batch->active = 0; 1297 - } 1298 - 1299 1294 /* 1300 1295 * On POWER9 the copy-paste buffer can only paste into 1301 1296 * foreign real addresses, so unprivileged processes can not ··· 1358 1369 */ 1359 1370 1360 1371 #ifdef CONFIG_PPC_BOOK3S_64 1361 - #ifdef CONFIG_PPC_64S_HASH_MMU 1362 - /* 1363 - * This applies to a process that was context switched while inside 1364 - * arch_enter_lazy_mmu_mode(), to re-activate the batch that was 1365 - * deactivated above, before _switch(). This will never be the case 1366 - * for new tasks. 1367 - */ 1368 - if (current_thread_info()->local_flags & _TLF_LAZY_MMU) { 1369 - current_thread_info()->local_flags &= ~_TLF_LAZY_MMU; 1370 - batch = this_cpu_ptr(&ppc64_tlb_batch); 1371 - batch->active = 1; 1372 - } 1373 - #endif 1374 - 1375 1372 /* 1376 1373 * Math facilities are masked out of the child MSR in copy_thread. 1377 1374 * A new task does not need to restore_math because it will