linux-yocto/arch/sparc
Ryan Roberts 36106d1c27 sparc/mm: disable preemption in lazy mmu mode
commit a1d416bf9f upstream.

Since commit 38e0edb15b ("mm/apply_to_range: call pte function with lazy
updates") it's been possible for arch_[enter|leave]_lazy_mmu_mode() to be
called without holding a page table lock (for the kernel mappings case),
and therefore it is possible that preemption may occur while in the lazy
mmu mode.  The Sparc lazy mmu implementation is not robust to preemption
since it stores the lazy mode state in a per-cpu structure and does not
attempt to manage that state on task switch.

Powerpc had the same issue and fixed it by explicitly disabling preemption
in arch_enter_lazy_mmu_mode() and re-enabling in
arch_leave_lazy_mmu_mode().  See commit b9ef323ea1 ("powerpc/64s:
Disable preemption in hash lazy mmu mode").

Given Sparc's lazy mmu mode is based on powerpc's, let's fix it in the
same way here.

Link: https://lkml.kernel.org/r/20250303141542.3371656-4-ryan.roberts@arm.com
Fixes: 38e0edb15b ("mm/apply_to_range: call pte function with lazy updates")
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Andreas Larsson <andreas@gaisler.com>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Borislav Betkov <bp@alien8.de>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Juegren Gross <jgross@suse.com>
Cc: Matthew Wilcow (Oracle) <willy@infradead.org>
Cc: Thomas Gleinxer <tglx@linutronix.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-25 10:43:42 +02:00
..
boot
configs
crypto sparc: Explicitly include correct DT includes 2024-04-03 15:19:33 +02:00
include mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
kernel syscalls: fix compat_sys_io_pgetevents_time64 usage 2024-07-05 09:31:59 +02:00
lib sparc32: fix a braino in fault handling in csum_and_copy_..._user() 2023-11-02 09:35:32 +01:00
math-emu
mm sparc/mm: disable preemption in lazy mmu mode 2025-04-25 10:43:42 +02:00
net
power
prom sparc64: Fix incorrect function signature and add prototype for prom_cif_init 2024-08-03 08:49:16 +02:00
vdso sparc: vDSO: fix return value of __setup handler 2024-04-03 15:19:26 +02:00
Kbuild
Kconfig sparc/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 20:03:47 +02:00
Kconfig.debug
Makefile