Re: [PATCH] riscv: mm: Flush vmemmap TLB after sparse_init()

"David Hildenbrand (Arm)" <[email protected]>
Newsgroups org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On 8/27/26 09:36, Yaxing Guo wrote:
> Commit 4267739cabb8 ("arch, mm: consolidate initialization of SPARSE
> memory model") moved sparse_init() from RISC-V arch setup code into
> free_area_init(), but left the RISC-V VMEMMAP TLB flush in
> misc_mem_init(). RISC-V now flushes the VMEMMAP range before
> sparse_init() populates the vmemmap page tables.
> 
> RISC-V supports caching non-present entries in the TLB. If a hart cached
> a non-present translation for the VMEMMAP range, installing the vmemmap
> page-table entries is not guaranteed to be observed until an sfence.vma
> invalidates the stale entry. The first access to the corresponding
> struct page during memmap initialization can then hit the old non-present
> entry.
> 
> Call an arch hook at the end of sparse_init(), after the boot-time
> vmemmap population has completed.

If it's a vmemmap thing, it should go into the vmemmap machinery, not slapped
into sparse.c.

Why can't the proposed vmemmap_populate_finalize() [1] cleanly take care of that?

[1]
https://lore.kernel.org/linux-riscv/20260630-mark-after-vmemmap-populate-v4-1-febbc15da028@iscas.ac.cn/

(independent of that, I really don't enjoy the suggested callback name)

-- 
Cheers,

David

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.