[PATCH v4] riscv: mm: Avoid spurious fault after hotplugging vmemmap

Andrew Morton akpm at linux-foundation.org
Tue Jun 30 21:11:00 PDT 2026


On Tue, 30 Jun 2026 15:51:59 +0800 Vivian Wang <wangruikang at iscas.ac.cn> wrote:

> section_activate() does not flush TLB after populating new vmemmap
> pages. On most architectures, this is okay. However it is a problem on
> RISC-V since there the TLB caching non-present entries is permitted,
> which causes spurious faults on some hardwares.
> 
> This seems to be most easily reproduced with DEBUG_VM=y and
> PAGE_POISONING=y, which causes these newly mapped struct pages to be
> poisoned i.e. written to immediately after mapping.
> 
> Add a hook vmemmap_populate_finalize() in __populate_section_memmap()
> after population, to allow architectures to handle such situations as
> needed. Then implement it on RISC-V to arrange for the existing
> exception handler code to deal with these faults if they happen.

Thanks, I'll get this into linux-next for some testing exposure.

I'd of course prefer that the riscv maintainers review and merge this,
or I can upstream it with their ack?

btw, AI review suggests that there's a missing barrier in there (a
pre-existing thing)

	https://sashiko.dev/#/patchset/20260630-mark-after-vmemmap-populate-v4-1-febbc15da028@iscas.ac.cn



More information about the linux-riscv mailing list