* [PATCH v2] liveupdate: luo_session: include linux/mm.h for virt/phys translation
@ 2026-06-04 9:19 George Guo
2026-06-14 8:33 ` Mike Rapoport
0 siblings, 1 reply; 2+ messages in thread
From: George Guo @ 2026-06-04 9:19 UTC (permalink / raw)
To: pasha.tatashin, rppt, pratyush
Cc: kexec, linux-kernel, chenhuacai, loongarch, George Guo, Kexin Liu
From: George Guo <guodongtai@kylinos.cn>
luo_session.c calls virt_to_phys() and phys_to_virt(). On LoongArch with
CONFIG_KFENCE=y, these macros (in arch/loongarch/include/asm/io.h) expand
to offset_in_page() and page_address(), both declared in <linux/mm.h>.
Since luo_session.c only includes <linux/io.h>, the translation unit fails
to build with CONFIG_KFENCE=y:
asm/io.h: error: implicit declaration of function 'offset_in_page'
asm/io.h: error: implicit declaration of function 'page_address'
Add the missing include to fix these build errors.
Co-developed-by: Kexin Liu <liukexin@kylinos.cn>
Signed-off-by: Kexin Liu <liukexin@kylinos.cn>
Signed-off-by: George Guo <guodongtai@kylinos.cn>
---
v2: Move the include from arch/loongarch/include/asm/io.h to the consumer
luo_session.c, instead of pulling the heavy <linux/mm.h> into the
low-level asm/io.h header (per review feedback). The 0-day report
confirmed the v1 approach introduces a circular include
(slab.h -> kasan.h -> asm/kasan.h -> asm/io.h -> mm.h, where mm.h
needs kfree() before slab.h declares it).
Link: https://lore.kernel.org/r/20260521063310.52926-1-dongtai.guo@linux.dev/ # v1
kernel/liveupdate/luo_session.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c
index 7a42385dabe2..4ce7128a4ae9 100644
--- a/kernel/liveupdate/luo_session.c
+++ b/kernel/liveupdate/luo_session.c
@@ -62,6 +62,7 @@
#include <linux/libfdt.h>
#include <linux/list.h>
#include <linux/liveupdate.h>
+#include <linux/mm.h>
#include <linux/mutex.h>
#include <linux/rwsem.h>
#include <linux/slab.h>
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2] liveupdate: luo_session: include linux/mm.h for virt/phys translation
2026-06-04 9:19 [PATCH v2] liveupdate: luo_session: include linux/mm.h for virt/phys translation George Guo
@ 2026-06-14 8:33 ` Mike Rapoport
0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2026-06-14 8:33 UTC (permalink / raw)
To: George Guo
Cc: pasha.tatashin, pratyush, kexec, linux-kernel, chenhuacai,
loongarch, George Guo, Kexin Liu
On Thu, Jun 04, 2026 at 05:19:13PM +0800, George Guo wrote:
> From: George Guo <guodongtai@kylinos.cn>
>
> luo_session.c calls virt_to_phys() and phys_to_virt(). On LoongArch with
> CONFIG_KFENCE=y, these macros (in arch/loongarch/include/asm/io.h) expand
> to offset_in_page() and page_address(), both declared in <linux/mm.h>.
>
> Since luo_session.c only includes <linux/io.h>, the translation unit fails
> to build with CONFIG_KFENCE=y:
>
> asm/io.h: error: implicit declaration of function 'offset_in_page'
> asm/io.h: error: implicit declaration of function 'page_address'
>
> Add the missing include to fix these build errors.
>
> Co-developed-by: Kexin Liu <liukexin@kylinos.cn>
> Signed-off-by: Kexin Liu <liukexin@kylinos.cn>
> Signed-off-by: George Guo <guodongtai@kylinos.cn>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Please send this patch along with the series that enable KHO on LoongArch.
> ---
> v2: Move the include from arch/loongarch/include/asm/io.h to the consumer
> luo_session.c, instead of pulling the heavy <linux/mm.h> into the
> low-level asm/io.h header (per review feedback). The 0-day report
> confirmed the v1 approach introduces a circular include
> (slab.h -> kasan.h -> asm/kasan.h -> asm/io.h -> mm.h, where mm.h
> needs kfree() before slab.h declares it).
> Link: https://lore.kernel.org/r/20260521063310.52926-1-dongtai.guo@linux.dev/ # v1
>
> kernel/liveupdate/luo_session.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c
> index 7a42385dabe2..4ce7128a4ae9 100644
> --- a/kernel/liveupdate/luo_session.c
> +++ b/kernel/liveupdate/luo_session.c
> @@ -62,6 +62,7 @@
> #include <linux/libfdt.h>
> #include <linux/list.h>
> #include <linux/liveupdate.h>
> +#include <linux/mm.h>
> #include <linux/mutex.h>
> #include <linux/rwsem.h>
> #include <linux/slab.h>
> --
> 2.25.1
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-14 8:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 9:19 [PATCH v2] liveupdate: luo_session: include linux/mm.h for virt/phys translation George Guo
2026-06-14 8:33 ` Mike Rapoport
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.