vmalloc faulting on RISC-V

Joerg Roedel jroedel at suse.de
Wed Sep 9 14:28:34 EDT 2020


On Wed, Sep 09, 2020 at 09:29:10AM +0300, Pekka Enberg wrote:
> Why does RISC-V need vmalloc faulting in do_page_fault()? If I
> understand correctly, some architectures implement it because process
> page tables can get out of sync with "init_mm.pgd". How does that
> happen on RISC-V?
> 
> I am asking because Joerg Roedel recently switched the x86
> architecture to a different approach because apparently vmalloc
> faulting is error-prone:
> 
> commit 7f0a002b5a21302d9f4b29ba83c96cd433ff3769
> Author: Joerg Roedel <jroedel at suse.de>
> Date:   Mon Jun 1 21:52:40 2020 -0700
> 
>     x86/mm: remove vmalloc faulting
> 
>     Remove fault handling on vmalloc areas, as the vmalloc code now takes
>     care of synchronizing changes to all page-tables in the system.

It is actually not vmalloc-faulting alone that was error-prone, it was
its combination with the (now removed) vmalloc_sync_* interfaces which
had to be called at random places in the kernel. This interface was
removed and replaced by arch_sync_kernel_mappings(), which makes sure
that mappings are synchronized to all page-tables before the vmalloc'ed
pointer is returned.

Above commit to remove vmalloc-faulting on x86 had to be (partially)
reverted, because relying on arch_sync_kernel_mappings() alone turned
out to have a race condition.

Please see commit

	4819e15f740e x86/mm/32: Bring back vmalloc faulting on x86_32

for details on that.

Regards,

	Joerg



More information about the linux-riscv mailing list