Re: [PATCH v4 3/4] liveupdate: luo_session: include linux/mm.h for virt/phys translation
From: George Guo
Date: Wed Aug 12 2026 - 06:28:23 EST
Hi Pratyush,
You are right: the current luo_session.c does not call virt_to_phys() or
phys_to_virt(). I failed to update the target of this fix when rebasing the
patch. The calls that trigger the current failure are in
kernel/liveupdate/kho_block.c. Sorry about that.
I also checked the include chain. asm/kfence.h is not included by this
translation unit. include/linux/slab.h does not include linux/kfence.h; that
inclusion is in the MM-private mm/slab.h. Moreover, asm/kfence.h itself
includes linux/kfence.h, which includes linux/mm.h, so
arch_kfence_init_pool() already has the required declarations.
The actual failure is:
kernel/liveupdate/kho_block.c: In function 'kho_block_set_is_cyclic':
./arch/loongarch/include/asm/io.h:81:9: error: implicit declaration of function 'page_address'
kernel/liveupdate/kho_block.c:210:16: note: in expansion of macro 'phys_to_virt'
The underlying issue is that LoongArch's CONFIG_KFENCE version of
phys_to_virt() uses page_address(), which is provided by linux/mm.h.
Your broader point about fixing this at the architecture level is valid. I
previously tried including linux/mm.h from asm/io.h [1], but that introduces a
circular include through:
linux/slab.h -> linux/kasan.h -> asm/kasan.h -> asm/io.h
-> linux/mm.h -> linux/slab.h
As reported by the kernel test robot [2], this leaves kfree() undeclared while
linux/mm.h is being parsed. A proper architecture-wide fix therefore requires
refactoring the address conversion helpers rather than adding that include to
asm/io.h.
For this series I will move the linux/mm.h include from luo_session.c to the
actual user, kho_block.c, and consider the architecture-wide cleanup
separately.
[1] https://lore.kernel.org/r/20260521063310.52926-1-dongtai.guo@xxxxxxxxx/
[2] https://lore.kernel.org/r/202605211925.DbDvQ6ii-lkp@xxxxxxxxx/
Thanks,
George