]> www.infradead.org Git - users/jedix/linux-maple.git/commit
x86/mm: make MMU_GATHER_RCU_TABLE_FREE unconditional
authorRik van Riel <riel@surriel.com>
Thu, 13 Feb 2025 16:13:52 +0000 (11:13 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 4 Mar 2025 05:50:32 +0000 (21:50 -0800)
commita17c9da9264d18bc1735f6be03b11fb2ce9fd784
tree55b6605dc8e6a03515fde31dc1da2d8b992299ce
parent554d249d50d208d999c1c63ec49f556e7eaf1a8d
x86/mm: make MMU_GATHER_RCU_TABLE_FREE unconditional

Currently x86 uses CONFIG_MMU_GATHER_TABLE_FREE when using
    paravirt, and not when running on bare metal.

There is no real good reason to do things differently for
    each setup. Make them all the same.

Currently get_user_pages_fast synchronizes against page table
    freeing in two different ways:

- on bare metal, by blocking IRQs, which block TLB flush IPIs
- on paravirt, with MMU_GATHER_RCU_TABLE_FREE

This is done because some paravirt TLB flush implementations
handle the TLB flush in the hypervisor, and will do the flush
even when the target CPU has interrupts disabled.

Always handle page table freeing with MMU_GATHER_RCU_TABLE_FREE.
Using RCU synchronization between page table freeing and get_user_pages_fast()
allows bare metal to also do TLB flushing while interrupts are disabled.

Various places in the mm do still block IRQs or disable preemption
as an implicit way to block RCU frees.

That makes it safe to use INVLPGB on AMD CPUs.

Link: https://lore.kernel.org/r/20250213161423.449435-2-riel@surriel.com
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Rik van Riel <riel@surriel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Manali Shukla <Manali.Shukla@amd.com>
Tested-by: Brendan Jackman <jackmanb@google.com>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/x86/Kconfig
arch/x86/kernel/paravirt.c
arch/x86/mm/pgtable.c