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.

mm: introduce CONFIG_ARCH_HAS_LAZY_MMU_MODE

Architectures currently opt in for implementing lazy_mmu helpers by
defining __HAVE_ARCH_ENTER_LAZY_MMU_MODE.

In preparation for introducing a generic lazy_mmu layer that will require
storage in task_struct, let's switch to a cleaner approach: instead of
defining a macro, select a CONFIG option.

This patch introduces CONFIG_ARCH_HAS_LAZY_MMU_MODE and has each arch
select it when it implements lazy_mmu helpers.
__HAVE_ARCH_ENTER_LAZY_MMU_MODE is removed and <linux/pgtable.h> relies on
the new CONFIG instead.

On x86, lazy_mmu helpers are only implemented if PARAVIRT_XXL is selected.
This creates some complications in arch/x86/boot/, because a few files
manually undefine PARAVIRT* options. As a result <asm/paravirt.h> does
not define the lazy_mmu helpers, but this breaks the build as
<linux/pgtable.h> only defines them if !CONFIG_ARCH_HAS_LAZY_MMU_MODE.
There does not seem to be a clean way out of this - let's just undefine
that new CONFIG too.

Link: https://lkml.kernel.org/r/20251215150323.2218608-7-kevin.brodsky@arm.com
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Acked-by: Andreas Larsson <andreas@gaisler.com> [sparc]
Cc: Alexander Gordeev <agordeev@linux.ibm.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 Hildenbrand (Red Hat) <david@kernel.org>
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: 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: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Kevin Brodsky and committed by
Andrew Morton
7303ecbf f2be7450

+14 -7
+1
arch/arm64/Kconfig
··· 35 35 select ARCH_HAS_KCOV 36 36 select ARCH_HAS_KERNEL_FPU_SUPPORT if KERNEL_MODE_NEON 37 37 select ARCH_HAS_KEEPINITRD 38 + select ARCH_HAS_LAZY_MMU_MODE 38 39 select ARCH_HAS_MEMBARRIER_SYNC_CORE 39 40 select ARCH_HAS_MEM_ENCRYPT 40 41 select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
-1
arch/arm64/include/asm/pgtable.h
··· 80 80 } 81 81 } 82 82 83 - #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 84 83 static inline void arch_enter_lazy_mmu_mode(void) 85 84 { 86 85 /*
-2
arch/powerpc/include/asm/book3s/64/tlbflush-hash.h
··· 24 24 25 25 extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch); 26 26 27 - #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 28 - 29 27 static inline void arch_enter_lazy_mmu_mode(void) 30 28 { 31 29 struct ppc64_tlb_batch *batch;
+1
arch/powerpc/platforms/Kconfig.cputype
··· 93 93 select IRQ_WORK 94 94 select PPC_64S_HASH_MMU if !PPC_RADIX_MMU 95 95 select KASAN_VMALLOC if KASAN 96 + select ARCH_HAS_LAZY_MMU_MODE 96 97 97 98 config PPC_BOOK3E_64 98 99 bool "Embedded processors"
+1
arch/sparc/Kconfig
··· 112 112 select NEED_PER_CPU_PAGE_FIRST_CHUNK 113 113 select ARCH_SUPPORTS_SCHED_SMT if SMP 114 114 select ARCH_SUPPORTS_SCHED_MC if SMP 115 + select ARCH_HAS_LAZY_MMU_MODE 115 116 116 117 config ARCH_PROC_KCORE_TEXT 117 118 def_bool y
-2
arch/sparc/include/asm/tlbflush_64.h
··· 39 39 40 40 void flush_tlb_kernel_range(unsigned long start, unsigned long end); 41 41 42 - #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 43 - 44 42 void flush_tlb_pending(void); 45 43 void arch_enter_lazy_mmu_mode(void); 46 44 void arch_flush_lazy_mmu_mode(void);
+1
arch/x86/Kconfig
··· 808 808 config PARAVIRT_XXL 809 809 bool 810 810 depends on X86_64 811 + select ARCH_HAS_LAZY_MMU_MODE 811 812 812 813 config PARAVIRT_DEBUG 813 814 bool "paravirt-ops debugging"
+1
arch/x86/boot/compressed/misc.h
··· 11 11 #undef CONFIG_PARAVIRT 12 12 #undef CONFIG_PARAVIRT_XXL 13 13 #undef CONFIG_PARAVIRT_SPINLOCKS 14 + #undef CONFIG_ARCH_HAS_LAZY_MMU_MODE 14 15 #undef CONFIG_KASAN 15 16 #undef CONFIG_KASAN_GENERIC 16 17
+1
arch/x86/boot/startup/sme.c
··· 24 24 #undef CONFIG_PARAVIRT 25 25 #undef CONFIG_PARAVIRT_XXL 26 26 #undef CONFIG_PARAVIRT_SPINLOCKS 27 + #undef CONFIG_ARCH_HAS_LAZY_MMU_MODE 27 28 28 29 /* 29 30 * This code runs before CPU feature bits are set. By default, the
-1
arch/x86/include/asm/paravirt.h
··· 526 526 PVOP_VCALL1(cpu.end_context_switch, next); 527 527 } 528 528 529 - #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 530 529 static inline void arch_enter_lazy_mmu_mode(void) 531 530 { 532 531 PVOP_VCALL0(mmu.lazy_mode.enter);
+1 -1
include/linux/pgtable.h
··· 235 235 * 236 236 * Nesting is not permitted and the mode cannot be used in interrupt context. 237 237 */ 238 - #ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE 238 + #ifndef CONFIG_ARCH_HAS_LAZY_MMU_MODE 239 239 static inline void arch_enter_lazy_mmu_mode(void) {} 240 240 static inline void arch_leave_lazy_mmu_mode(void) {} 241 241 static inline void arch_flush_lazy_mmu_mode(void) {}
+7
mm/Kconfig
··· 1468 1468 config FIND_NORMAL_PAGE 1469 1469 def_bool n 1470 1470 1471 + config ARCH_HAS_LAZY_MMU_MODE 1472 + bool 1473 + help 1474 + The architecture uses the lazy MMU mode. This allows changes to 1475 + MMU-related architectural state to be deferred until the mode is 1476 + exited. See <linux/pgtable.h> for details. 1477 + 1471 1478 source "mm/damon/Kconfig" 1472 1479 1473 1480 endmenu