From: Paul Walmsley <pjw@kernel.org>
To: Han Gao <gaohan@iscas.ac.cn>
Cc: "Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Song Shuai" <songshuaishuai@tinylab.org>,
"Björn Töpel" <bjorn@rivosinc.com>,
"Breno Leitao" <leitao@debian.org>, "Kees Cook" <kees@kernel.org>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
"Han Gao" <rabenda.cn@gmail.com>
Subject: Re: [PATCH] riscv: kexec_file: Constrain segment placement to direct map
Date: Thu, 21 May 2026 16:14:27 -0600 (MDT) [thread overview]
Message-ID: <4f1d7f4e-e2a3-9d9e-4116-861f037f2799@kernel.org> (raw)
In-Reply-To: <20260519170641.123517-1-gaohan@iscas.ac.cn>
On Wed, 20 May 2026, Han Gao wrote:
> When kexec_file_load places segments with buf_max=ULONG_MAX and
> top_down=true, they land at the highest available physical addresses.
> On RISC-V the size of the linear mapping is determined by the active
> VM mode: SV39 caps the direct map at roughly 128GB, while SV48/SV57
> extend the range substantially further. When the installed physical
> memory exceeds the direct map size of the active mode, top-down
> placement puts DTB/initrd at physical addresses outside the linearly
> mapped region. The kexec'd kernel cannot reach them during early
> boot, triggering a page fault at memcmp in start_kernel.
>
> Fix by constraining buf_max to PFN_PHYS(max_low_pfn), which reflects
> the runtime direct map boundary for the active VM mode (SV39/SV48/
> SV57). This keeps all kexec segments within the linearly mapped
> region while preserving the upstream top_down allocation strategy.
>
> Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
Thanks, queued for v7.1-rc.
- Paul
prev parent reply other threads:[~2026-05-21 22:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 17:06 Han Gao
2026-05-21 22:14 ` Paul Walmsley [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=4f1d7f4e-e2a3-9d9e-4116-861f037f2799@kernel.org \
--to=pjw@kernel.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=bjorn@rivosinc.com \
--cc=gaohan@iscas.ac.cn \
--cc=kees@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=rabenda.cn@gmail.com \
--cc=songshuaishuai@tinylab.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
Powered by JetHome