[PATCH] riscv: patch: Avoid early page_to_phys()
Vivian Wang
wangruikang at iscas.ac.cn
Sun Mar 22 18:58:05 PDT 2026
Hi Andrew and Paul,
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?
While we're at it, Paul's subject correction is correct - it should have
said phys_to_page(), not page_to_phys(). Not that I can blame this on
anyone else, but apparently I wrote it while looking at the arm64 commit
without noticing.
Thanks and sorry for the hopefully minor inconvenience.
Vivian "dramforever" Wang
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/commit/?h=mm-hotfixes-stable&id=ac5f2c1256ede8b0acb2661f6441530d53d8f126
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git/commit/?h=fixes&id=3a876501fd9aaae9845026f046379c9507365bb5
More information about the linux-riscv
mailing list