[PATCH] riscv: patch: Avoid early page_to_phys()

Andrew Morton akpm at linux-foundation.org
Mon Mar 23 09:34:03 PDT 2026


On Mon, 23 Mar 2026 09:58:05 +0800 Vivian Wang <wangruikang at iscas.ac.cn> wrote:

> On 3/19/26 01:42, Paul Walmsley wrote:
> > On Tue, 10 Mar 2026, Vivian Wang wrote:
> >
> >> Similarly to commit 8d09e2d569f6 ("arm64: patching: avoid early
> >> page_to_phys()"), avoid using phys_to_page() for the kernel address case
> >> in patch_map().
> >>
> >> Since this is called from apply_boot_alternatives() in setup_arch(), and
> >> commit 4267739cabb8 ("arch, mm: consolidate initialization of SPARSE
> >> memory model") has moved sparse_init() to after setup_arch(),
> >> phys_to_page() is not available there yet, and it panics on boot with
> >> SPARSEMEM on RV32, which does not use SPARSEMEM_VMEMMAP.
> >>
> >> Reported-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
> >> Closes: https://lore.kernel.org/r/20260223144108-dcace0b9-02e8-4b67-a7ce-f263bed36f26@linutronix.de/
> >> Fixes: 4267739cabb8 ("arch, mm: consolidate initialization of SPARSE memory model")
> >> Suggested-by: Mike Rapoport <rppt at kernel.org>
> >> Signed-off-by: Vivian Wang <wangruikang at iscas.ac.cn>
> > Thanks, queued for v7.0-rc.
> 
> I have only just noticed that this patch was commited to both
> mm-hotfixes-stable [1] by Andrew and riscv fixes [2] by Paul. Is this
> intended?

It happens - better both than neither!

I'll drop the mm.git copy.



More information about the linux-riscv mailing list