From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Yaxing Guo <guoyaxing@bosc.ac.cn>, Paul Walmsley <pjw@kernel.org>,
Mike Rapoport <rppt@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Andrew Morton <akpm@linux-foundation.org>,
Lorenzo Stoakes <ljs@kernel.org>,
Vlastimil Babka <vbabka@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Zhizun Wang <anzoso@outlook.com>
Subject: Re: [PATCH] riscv: mm: Flush vmemmap TLB after sparse_init()
Date: Thu, 27 Aug 2026 13:08:24 +0200 [thread overview]
Message-ID: <21329b69-1a58-4b3e-918b-26753a961339@kernel.org> (raw)
In-Reply-To: <20260827073603.141426-1-guoyaxing@bosc.ac.cn>
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
prev parent reply other threads:[~2026-08-27 11:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 7:36 Yaxing Guo
2026-08-27 11:08 ` David Hildenbrand (Arm) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21329b69-1a58-4b3e-918b-26753a961339@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=anzoso@outlook.com \
--cc=aou@eecs.berkeley.edu \
--cc=guoyaxing@bosc.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®