Move KHO to kernel/liveupdate/ in preparation of placing all Live Update
core kernel related files to the same place.
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
Documentation/core-api/kho/concepts.rst | 2 +-
MAINTAINERS | 2 +-
init/Kconfig | 2 +
kernel/Kconfig.kexec | 34 ----------------
kernel/Makefile | 4 +-
kernel/liveupdate/Kconfig | 39 +++++++++++++++++++
kernel/liveupdate/Makefile | 5 +++
kernel/{ => liveupdate}/kexec_handover.c | 4 +-
.../{ => liveupdate}/kexec_handover_debug.c | 0
.../{ => liveupdate}/kexec_handover_debugfs.c | 0
.../kexec_handover_internal.h | 0
11 files changed, 51 insertions(+), 41 deletions(-)
create mode 100644 kernel/liveupdate/Kconfig
create mode 100644 kernel/liveupdate/Makefile
rename kernel/{ => liveupdate}/kexec_handover.c (99%)
rename kernel/{ => liveupdate}/kexec_handover_debug.c (100%)
rename kernel/{ => liveupdate}/kexec_handover_debugfs.c (100%)
rename kernel/{ => liveupdate}/kexec_handover_internal.h (100%)
diff --git a/Documentation/core-api/kho/concepts.rst b/Documentation/core-api/kho/concepts.rst
index 36d5c05cfb30..d626d1dbd678 100644
--- a/Documentation/core-api/kho/concepts.rst
+++ b/Documentation/core-api/kho/concepts.rst
@@ -70,5 +70,5 @@ in the FDT. That state is called the KHO finalization phase.
Public API
==========
-.. kernel-doc:: kernel/kexec_handover.c
+.. kernel-doc:: kernel/liveupdate/kexec_handover.c
:export:
diff --git a/MAINTAINERS b/MAINTAINERS
index bdd0a1260421..764df916fae7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13795,7 +13795,7 @@ S: Maintained
F: Documentation/admin-guide/mm/kho.rst
F: Documentation/core-api/kho/*
F: include/linux/kexec_handover.h
-F: kernel/kexec_handover*
+F: kernel/liveupdate/kexec_handover*
F: tools/testing/selftests/kho/
KEYS-ENCRYPTED
diff --git a/init/Kconfig b/init/Kconfig
index cab3ad28ca49..0605de5d96c0 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -2138,6 +2138,8 @@ config TRACEPOINTS
source "kernel/Kconfig.kexec"
+source "kernel/liveupdate/Kconfig"
+
endmenu # General setup
source "arch/Kconfig"
diff --git a/kernel/Kconfig.kexec b/kernel/Kconfig.kexec
index cc6743137946..15632358bcf7 100644
--- a/kernel/Kconfig.kexec
+++ b/kernel/Kconfig.kexec
@@ -94,40 +94,6 @@ config KEXEC_JUMP
Jump between original kernel and kexeced kernel and invoke
code in physical address mode via KEXEC
-config KEXEC_HANDOVER
- bool "kexec handover"
- depends on ARCH_SUPPORTS_KEXEC_HANDOVER && ARCH_SUPPORTS_KEXEC_FILE
- depends on !DEFERRED_STRUCT_PAGE_INIT
- select MEMBLOCK_KHO_SCRATCH
- select KEXEC_FILE
- select LIBFDT
- select CMA
- help
- Allow kexec to hand over state across kernels by generating and
- passing additional metadata to the target kernel. This is useful
- to keep data or state alive across the kexec. For this to work,
- both source and target kernels need to have this option enabled.
-
-config KEXEC_HANDOVER_DEBUG
- bool "Enable Kexec Handover debug checks"
- depends on KEXEC_HANDOVER
- help
- This option enables extra sanity checks for the Kexec Handover
- subsystem. Since, KHO performance is crucial in live update
- scenarios and the extra code might be adding overhead it is
- only optionally enabled.
-
-config KEXEC_HANDOVER_DEBUGFS
- bool "kexec handover debugfs interface"
- default KEXEC_HANDOVER
- depends on KEXEC_HANDOVER
- select DEBUG_FS
- help
- Allow to control kexec handover device tree via debugfs
- interface, i.e. finalize the state or aborting the finalization.
- Also, enables inspecting the KHO fdt trees with the debugfs binary
- blobs.
-
config CRASH_DUMP
bool "kernel crash dumps"
default ARCH_DEFAULT_CRASH_DUMP
diff --git a/kernel/Makefile b/kernel/Makefile
index 2cf7909a74e5..e83669841b8c 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -52,6 +52,7 @@ obj-y += printk/
obj-y += irq/
obj-y += rcu/
obj-y += livepatch/
+obj-y += liveupdate/
obj-y += dma/
obj-y += entry/
obj-y += unwind/
@@ -82,9 +83,6 @@ obj-$(CONFIG_CRASH_DUMP_KUNIT_TEST) += crash_core_test.o
obj-$(CONFIG_KEXEC) += kexec.o
obj-$(CONFIG_KEXEC_FILE) += kexec_file.o
obj-$(CONFIG_KEXEC_ELF) += kexec_elf.o
-obj-$(CONFIG_KEXEC_HANDOVER) += kexec_handover.o
-obj-$(CONFIG_KEXEC_HANDOVER_DEBUG) += kexec_handover_debug.o
-obj-$(CONFIG_KEXEC_HANDOVER_DEBUGFS) += kexec_handover_debugfs.o
obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o
obj-$(CONFIG_COMPAT) += compat.o
obj-$(CONFIG_CGROUPS) += cgroup/
diff --git a/kernel/liveupdate/Kconfig b/kernel/liveupdate/Kconfig
new file mode 100644
index 000000000000..1379a4c40b09
--- /dev/null
+++ b/kernel/liveupdate/Kconfig
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+menu "Live Update and Kexec HandOver"
+
+config KEXEC_HANDOVER
+ bool "kexec handover"
+ depends on ARCH_SUPPORTS_KEXEC_HANDOVER && ARCH_SUPPORTS_KEXEC_FILE
+ depends on !DEFERRED_STRUCT_PAGE_INIT
+ select MEMBLOCK_KHO_SCRATCH
+ select KEXEC_FILE
+ select LIBFDT
+ select CMA
+ help
+ Allow kexec to hand over state across kernels by generating and
+ passing additional metadata to the target kernel. This is useful
+ to keep data or state alive across the kexec. For this to work,
+ both source and target kernels need to have this option enabled.
+
+config KEXEC_HANDOVER_DEBUG
+ bool "Enable Kexec Handover debug checks"
+ depends on KEXEC_HANDOVER
+ help
+ This option enables extra sanity checks for the Kexec Handover
+ subsystem. Since, KHO performance is crucial in live update
+ scenarios and the extra code might be adding overhead it is
+ only optionally enabled.
+
+config KEXEC_HANDOVER_DEBUGFS
+ bool "kexec handover debugfs interface"
+ default KEXEC_HANDOVER
+ depends on KEXEC_HANDOVER
+ select DEBUG_FS
+ help
+ Allow to control kexec handover device tree via debugfs
+ interface, i.e. finalize the state or aborting the finalization.
+ Also, enables inspecting the KHO fdt trees with the debugfs binary
+ blobs.
+
+endmenu
diff --git a/kernel/liveupdate/Makefile b/kernel/liveupdate/Makefile
new file mode 100644
index 000000000000..f52ce1ebcf86
--- /dev/null
+++ b/kernel/liveupdate/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_KEXEC_HANDOVER) += kexec_handover.o
+obj-$(CONFIG_KEXEC_HANDOVER_DEBUG) += kexec_handover_debug.o
+obj-$(CONFIG_KEXEC_HANDOVER_DEBUGFS) += kexec_handover_debugfs.o
diff --git a/kernel/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
similarity index 99%
rename from kernel/kexec_handover.c
rename to kernel/liveupdate/kexec_handover.c
index 3adf86c7c2db..be945c133a2f 100644
--- a/kernel/kexec_handover.c
+++ b/kernel/liveupdate/kexec_handover.c
@@ -26,8 +26,8 @@
* KHO is tightly coupled with mm init and needs access to some of mm
* internal APIs.
*/
-#include "../mm/internal.h"
-#include "kexec_internal.h"
+#include "../../mm/internal.h"
+#include "../kexec_internal.h"
#include "kexec_handover_internal.h"
#define KHO_FDT_COMPATIBLE "kho-v1"
diff --git a/kernel/kexec_handover_debug.c b/kernel/liveupdate/kexec_handover_debug.c
similarity index 100%
rename from kernel/kexec_handover_debug.c
rename to kernel/liveupdate/kexec_handover_debug.c
diff --git a/kernel/kexec_handover_debugfs.c b/kernel/liveupdate/kexec_handover_debugfs.c
similarity index 100%
rename from kernel/kexec_handover_debugfs.c
rename to kernel/liveupdate/kexec_handover_debugfs.c
diff --git a/kernel/kexec_handover_internal.h b/kernel/liveupdate/kexec_handover_internal.h
similarity index 100%
rename from kernel/kexec_handover_internal.h
rename to kernel/liveupdate/kexec_handover_internal.h
--
2.51.1.930.gacf6e81ea2-goog
On Sat, 1 Nov 2025 10:23:23 -0400 Pasha Tatashin <pasha.tatashin@soleen.com> wrote: > Move KHO to kernel/liveupdate/ in preparation of placing all Live Update > core kernel related files to the same place. I notice that menuconfig is a bit weird after this. The "General setup" menu offers the "Live Update and Kexec HandOver" menu but there's nothing in there. If one sets DEFERRED_STRUCT_PAGE_INIT then things look normal. Perhaps we shouldn't be offering "Live Update and Kexec HandOver" at all if !DEFERRED_STRUCT_PAGE_INIT.
On Fri, Nov 7, 2025 at 5:23 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Sat, 1 Nov 2025 10:23:23 -0400 Pasha Tatashin <pasha.tatashin@soleen.com> wrote:
>
> > Move KHO to kernel/liveupdate/ in preparation of placing all Live Update
> > core kernel related files to the same place.
>
> I notice that menuconfig is a bit weird after this.
>
> The "General setup" menu offers the "Live Update and Kexec HandOver"
> menu but there's nothing in there. If one sets
> DEFERRED_STRUCT_PAGE_INIT then things look normal.
>
> Perhaps we shouldn't be offering "Live Update and Kexec HandOver" at
> all if !DEFERRED_STRUCT_PAGE_INIT.
Hi Andrew, thank you for noticing this, yes, indeed it looks strange
when empty. Let's disable the menu when DEFERRED_STRUCT_PAGE_INIT
until we relax this KHO/deferred init dependency.
diff --git a/kernel/liveupdate/Kconfig b/kernel/liveupdate/Kconfig
index 054f6375a7af..d7344d347f69 100644
--- a/kernel/liveupdate/Kconfig
+++ b/kernel/liveupdate/Kconfig
@@ -7,6 +7,7 @@
#
menu "Live Update and Kexec HandOver"
+ depends on !DEFERRED_STRUCT_PAGE_INIT
config LIVEUPDATE
bool "Live Update Orchestrator"
Hello,
as we understand, this commit is not the root cause of the WARNING. but just
changes the stats as below table [1]
we just report FYI there is a WARNING caused by related code in our tests, in
case anybody think it's worth to look further. thanks
kernel test robot noticed "WARNING:at_kernel/liveupdate/kexec_handover.c:#kho_add_subtree" on:
commit: 91cb1aaea4b8276323b3814d35f6e62133f64c1b ("[PATCH v9 7/9] liveupdate: kho: move to kernel/liveupdate")
url: https://github.com/intel-lab-lkp/linux/commits/Pasha-Tatashin/kho-make-debugfs-interface-optional/20251101-222610
patch link: https://lore.kernel.org/all/20251101142325.1326536-8-pasha.tatashin@soleen.com/
patch subject: [PATCH v9 7/9] liveupdate: kho: move to kernel/liveupdate
in testcase: boot
config: x86_64-randconfig-001-20251015
compiler: gcc-14
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
(please refer to attached dmesg/kmsg for entire log/backtrace)
[1]
+--------------------------------------------------------------------------------------+------------+------------+
| | dc74e80622 | 91cb1aaea4 |
+--------------------------------------------------------------------------------------+------------+------------+
| WARNING:at_kernel/kexec_handover.c:#kho_add_subtree | 8 | |
| WARNING:at_kernel/liveupdate/kexec_handover.c:#kho_add_subtree | 0 | 11 |
+--------------------------------------------------------------------------------------+------------+------------+
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202511061443.64dd159-lkp@intel.com
[ 12.679864][ T1] ------------[ cut here ]------------
[ 12.680514][ T1] WARNING: CPU: 0 PID: 1 at kernel/liveupdate/kexec_handover.c:711 kho_add_subtree (kernel/liveupdate/kexec_handover.c:711)
[ 12.681526][ T1] Modules linked in:
[ 12.681957][ T1] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.18.0-rc3-00216-g91cb1aaea4b8 #1 VOLUNTARY
[ 12.682956][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 12.683951][ T1] RIP: 0010:kho_add_subtree (kernel/liveupdate/kexec_handover.c:711)
[ 12.684514][ T1] Code: c7 58 2e a7 85 31 ed e8 31 1a 00 00 48 c7 c7 c0 12 c9 86 85 c0 89 c3 40 0f 95 c5 31 c9 31 d2 89 ee e8 57 a0 13 00 85 db 74 02 <0f> 0b b9 01 00 00 00 31 d2 89 ee 48 c7 c7 90 12 c9 86 e8 3c a0 13
All code
========
0: c7 (bad)
1: 58 pop %rax
2: 2e a7 cmpsl %es:(%rdi),%ds:(%rsi)
4: 85 31 test %esi,(%rcx)
6: ed in (%dx),%eax
7: e8 31 1a 00 00 call 0x1a3d
c: 48 c7 c7 c0 12 c9 86 mov $0xffffffff86c912c0,%rdi
13: 85 c0 test %eax,%eax
15: 89 c3 mov %eax,%ebx
17: 40 0f 95 c5 setne %bpl
1b: 31 c9 xor %ecx,%ecx
1d: 31 d2 xor %edx,%edx
1f: 89 ee mov %ebp,%esi
21: e8 57 a0 13 00 call 0x13a07d
26: 85 db test %ebx,%ebx
28: 74 02 je 0x2c
2a:* 0f 0b ud2 <-- trapping instruction
2c: b9 01 00 00 00 mov $0x1,%ecx
31: 31 d2 xor %edx,%edx
33: 89 ee mov %ebp,%esi
35: 48 c7 c7 90 12 c9 86 mov $0xffffffff86c91290,%rdi
3c: e8 .byte 0xe8
3d: 3c a0 cmp $0xa0,%al
3f: 13 .byte 0x13
Code starting with the faulting instruction
===========================================
0: 0f 0b ud2
2: b9 01 00 00 00 mov $0x1,%ecx
7: 31 d2 xor %edx,%edx
9: 89 ee mov %ebp,%esi
b: 48 c7 c7 90 12 c9 86 mov $0xffffffff86c91290,%rdi
12: e8 .byte 0xe8
13: 3c a0 cmp $0xa0,%al
15: 13 .byte 0x13
[ 12.686315][ T1] RSP: 0018:ffffc9000001fc58 EFLAGS: 00010286
[ 12.687184][ T1] RAX: dffffc0000000000 RBX: 00000000ffffffff RCX: 0000000000000000
[ 12.688370][ T1] RDX: 1ffffffff0d9225c RSI: 0000000000000001 RDI: ffffffff86c912e0
[ 12.689572][ T1] RBP: 0000000000000001 R08: 0000000000000008 R09: fffffbfff0dfac6c
[ 12.690762][ T1] R10: 0000000000000000 R11: ffffffff86fd6367 R12: ffff888133ce6000
[ 12.691996][ T1] R13: ffffffff85a72d60 R14: ffff88810ce59888 R15: dffffc0000000000
[ 12.693231][ T1] FS: 0000000000000000(0000) GS:ffff888426da0000(0000) knlGS:0000000000000000
[ 12.694585][ T1] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 12.695569][ T1] CR2: 00007f6d5dc8f0ac CR3: 00000000054ea000 CR4: 00000000000406f0
[ 12.696832][ T1] Call Trace:
[ 12.697400][ T1] <TASK>
[ 12.697922][ T1] kho_test_preserve+0x2fa/0x360
[ 12.698835][ T1] ? folio_order (arch/x86/kvm/../../../virt/kvm/guest_memfd.c:181 (discriminator 3))
[ 12.699556][ T1] ? kho_test_generate_data+0x107/0x180
[ 12.700561][ T1] kho_test_init (lib/test_kho.c:222 lib/test_kho.c:327)
[ 12.701312][ T1] ? vmalloc_test_init (lib/test_kho.c:314)
[ 12.702100][ T1] ? add_device_randomness (drivers/char/random.c:944)
[ 12.702924][ T1] ? mix_pool_bytes (drivers/char/random.c:944)
[ 12.703646][ T1] ? trace_initcall_start (include/trace/events/initcall.h:27 (discriminator 3))
[ 12.704499][ T1] ? vmalloc_test_init (lib/test_kho.c:314)
[ 12.705291][ T1] do_one_initcall (init/main.c:1284)
[ 12.706047][ T1] ? trace_initcall_start (init/main.c:1274)
[ 12.706897][ T1] ? parse_one (kernel/params.c:143)
[ 12.707623][ T1] ? kasan_save_track (mm/kasan/common.c:69 (discriminator 1) mm/kasan/common.c:78 (discriminator 1))
[ 12.708394][ T1] ? __kmalloc_noprof (mm/slub.c:5659)
[ 12.709218][ T1] do_initcalls (init/main.c:1344 (discriminator 3) init/main.c:1361 (discriminator 3))
[ 12.709976][ T1] kernel_init_freeable (init/main.c:1595)
[ 12.710752][ T1] ? rest_init (init/main.c:1475)
[ 12.711473][ T1] kernel_init (init/main.c:1485)
[ 12.712165][ T1] ? rest_init (init/main.c:1475)
[ 12.712871][ T1] ret_from_fork (arch/x86/kernel/process.c:164)
[ 12.713609][ T1] ? rest_init (init/main.c:1475)
[ 12.714326][ T1] ret_from_fork_asm (arch/x86/entry/entry_64.S:255)
[ 12.715029][ T1] </TASK>
[ 12.715548][ T1] irq event stamp: 131753
[ 12.716243][ T1] hardirqs last enabled at (131763): __up_console_sem (arch/x86/include/asm/irqflags.h:26 arch/x86/include/asm/irqflags.h:109 arch/x86/include/asm/irqflags.h:151 kernel/printk/printk.c:345)
[ 12.717702][ T1] hardirqs last disabled at (131776): __up_console_sem (kernel/printk/printk.c:343 (discriminator 3))
[ 12.719185][ T1] softirqs last enabled at (131460): handle_softirqs (kernel/softirq.c:469 (discriminator 1) kernel/softirq.c:650 (discriminator 1))
[ 12.720632][ T1] softirqs last disabled at (131455): __irq_exit_rcu (kernel/softirq.c:496 kernel/softirq.c:723)
[ 12.721755][ T1] ---[ end trace 0000000000000000 ]---
The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20251106/202511061443.64dd159-lkp@intel.com
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2025 Red Hat, Inc.