| Message ID | 20260922-rcu-pagetable-freeing-v4-3-fe1ad1f1e303@kernel.org |
|---|---|
| State | New |
| Headers | show |
| Series | mm: make userland page table freeing RCU-safe | expand |
On Tue, Sep 22, 2026 at 04:35:34PM +0100, Lorenzo Stoakes (ARM) wrote: >Currently riscv gates MMU_GATHER_RCU_TABLE_FREE on CONFIG_SMP and >CONFIG_MMU. > >Commit 69be3fb111e7 ("riscv: enable MMU_GATHER_RCU_TABLE_FREE for SMP && >MMU") enabled CONFIG_MMU_GATHER_RCU_TABLE_FREE for CONFIG_SMP, CONFIG_MMU >riscv builds. > >This is expressly for the safety of GUP-fast walkers (CONFIG_HAVE_GUP_FAST >is enabled if CONFIG_MMU is enabled). > >Naturally a single core system does not encounter issues with software page >table walkers being correctly synchronised across cores, as there is only a >single core. > >However, CONFIG_PREEMPT_RCU is still available on a riscv UP system, so for >a future RCU-only page table walker, this guarantee is required to prevent >concurrent page table teardown. > >All page table freeing is already done via tlb_remove_ptdesc() so the >conditions of CONFIG_MMU_GATHER_RCU_TABLE_FREE are already met. > >This forms part of an overall effort to switch every architecture to this >mode. > >Acked-by: Kiryl Shutsemau (Meta) <kas@kernel.org> >Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> >--- Yeah, for RISC-V, page-table freeing already goes through tlb_remove_ptdesc() :) Tested on QEMU, no issues seen :) Tested-by: Lance Yang <lance.yang@linux.dev>
On Wed, Sep 23, 2026 at 02:15:51PM +0800, Lance Yang wrote: > > On Tue, Sep 22, 2026 at 04:35:34PM +0100, Lorenzo Stoakes (ARM) wrote: > >Currently riscv gates MMU_GATHER_RCU_TABLE_FREE on CONFIG_SMP and > >CONFIG_MMU. > > > >Commit 69be3fb111e7 ("riscv: enable MMU_GATHER_RCU_TABLE_FREE for SMP && > >MMU") enabled CONFIG_MMU_GATHER_RCU_TABLE_FREE for CONFIG_SMP, CONFIG_MMU > >riscv builds. > > > >This is expressly for the safety of GUP-fast walkers (CONFIG_HAVE_GUP_FAST > >is enabled if CONFIG_MMU is enabled). > > > >Naturally a single core system does not encounter issues with software page > >table walkers being correctly synchronised across cores, as there is only a > >single core. > > > >However, CONFIG_PREEMPT_RCU is still available on a riscv UP system, so for > >a future RCU-only page table walker, this guarantee is required to prevent > >concurrent page table teardown. > > > >All page table freeing is already done via tlb_remove_ptdesc() so the > >conditions of CONFIG_MMU_GATHER_RCU_TABLE_FREE are already met. > > > >This forms part of an overall effort to switch every architecture to this > >mode. > > > >Acked-by: Kiryl Shutsemau (Meta) <kas@kernel.org> > >Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> > >--- > > Yeah, for RISC-V, page-table freeing already goes through > tlb_remove_ptdesc() :) Tested on QEMU, no issues seen :) > > Tested-by: Lance Yang <lance.yang@linux.dev> Thanks! :) A cheeky A-b tag possible too? :P -- Cheers, Lorenzo
On 2026/9/23 15:05, Lorenzo Stoakes (ARM) wrote: > On Wed, Sep 23, 2026 at 02:15:51PM +0800, Lance Yang wrote: >> >> On Tue, Sep 22, 2026 at 04:35:34PM +0100, Lorenzo Stoakes (ARM) wrote: >>> Currently riscv gates MMU_GATHER_RCU_TABLE_FREE on CONFIG_SMP and >>> CONFIG_MMU. >>> >>> Commit 69be3fb111e7 ("riscv: enable MMU_GATHER_RCU_TABLE_FREE for SMP && >>> MMU") enabled CONFIG_MMU_GATHER_RCU_TABLE_FREE for CONFIG_SMP, CONFIG_MMU >>> riscv builds. >>> >>> This is expressly for the safety of GUP-fast walkers (CONFIG_HAVE_GUP_FAST >>> is enabled if CONFIG_MMU is enabled). >>> >>> Naturally a single core system does not encounter issues with software page >>> table walkers being correctly synchronised across cores, as there is only a >>> single core. >>> >>> However, CONFIG_PREEMPT_RCU is still available on a riscv UP system, so for >>> a future RCU-only page table walker, this guarantee is required to prevent >>> concurrent page table teardown. >>> >>> All page table freeing is already done via tlb_remove_ptdesc() so the >>> conditions of CONFIG_MMU_GATHER_RCU_TABLE_FREE are already met. >>> >>> This forms part of an overall effort to switch every architecture to this >>> mode. >>> >>> Acked-by: Kiryl Shutsemau (Meta) <kas@kernel.org> >>> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> >>> --- >> >> Yeah, for RISC-V, page-table freeing already goes through >> tlb_remove_ptdesc() :) Tested on QEMU, no issues seen :) >> >> Tested-by: Lance Yang <lance.yang@linux.dev> > > Thanks! :) Cheers! > A cheeky A-b tag possible too? :P Sure thing! Here it is :D Acked-by: Lance Yang <lance.yang@linux.dev>
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 505eed4af932..3529ed1861ce 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -208,7 +208,7 @@ config RISCV select IRQ_FORCED_THREADING select KASAN_VMALLOC if KASAN select LOCK_MM_AND_FIND_VMA - select MMU_GATHER_RCU_TABLE_FREE if SMP && MMU + select MMU_GATHER_RCU_TABLE_FREE if MMU select MODULES_USE_ELF_RELA if MODULES select OF select OF_EARLY_FLATTREE
Currently riscv gates MMU_GATHER_RCU_TABLE_FREE on CONFIG_SMP and CONFIG_MMU. Commit 69be3fb111e7 ("riscv: enable MMU_GATHER_RCU_TABLE_FREE for SMP && MMU") enabled CONFIG_MMU_GATHER_RCU_TABLE_FREE for CONFIG_SMP, CONFIG_MMU riscv builds. This is expressly for the safety of GUP-fast walkers (CONFIG_HAVE_GUP_FAST is enabled if CONFIG_MMU is enabled). Naturally a single core system does not encounter issues with software page table walkers being correctly synchronised across cores, as there is only a single core. However, CONFIG_PREEMPT_RCU is still available on a riscv UP system, so for a future RCU-only page table walker, this guarantee is required to prevent concurrent page table teardown. All page table freeing is already done via tlb_remove_ptdesc() so the conditions of CONFIG_MMU_GATHER_RCU_TABLE_FREE are already met. This forms part of an overall effort to switch every architecture to this mode. Acked-by: Kiryl Shutsemau (Meta) <kas@kernel.org> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> --- arch/riscv/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)