Skip to content

kho: history: track previous kernel version and kexec boot count

Breno Leitao kexec linux-mm lkml 9 versions – Applied

Status from this message: [merged mm-stable] kho-document-kexec-metadata-tracking-feature.patch removed from -mm tree

Get series with b4
b4 am [email protected] change-id 20251230-kho-7707e8a2ef1e

Versions newest first

  1. v9 Latest6 patches 5 repliesApplied 6/6
  2. v86 patches 14 repliesSuperseded
  3. v76 patches 4 repliesSuperseded
Earlier versions · 6
VersionPostedPatchesRepliesStatus
v64 patches3 repliesSuperseded
v54 patches6 repliesSuperseded
v41 patch9 repliesSuperseded
v32 patches6 repliesSuperseded
v22 patches14 repliesSuperseded
v1 RFC1 patch2 repliesSuperseded

Changes in v9 from the cover letter

- Rebase on top of new KHO changes
- Fail and ignore subtree in case size is invalid (Pratyush)
- Separate kexec_metadata into a new file (Pratyush)
- Link to v8: https://patch.msgid.link/[email protected]

Patches in v9 All 6 applied

#Subject and filesSizeRepliesApplied
1/6kho: add size parameter to kho_add_subtree()include/linux/kexec_handover.h kernel/liveupdate/kexec_handover.c kernel/liveupdate/kexec_handover_debugfs.c +4 more+24 -161 replyApplied
2/6kho: rename fdt parameter to blob in kho_add/remove_subtree()Documentation/admin-guide/mm/kho.rst include/linux/kexec_handover.h kernel/liveupdate/kexec_handover.c +2 more+43 -410 repliesApplied
3/6kho: persist blob size in KHO FDTinclude/linux/kexec_handover.h include/linux/kho/abi/kexec_handover.h kernel/liveupdate/kexec_handover.c +4 more+46 -151 replyApplied
4/6kho: fix kho_in_debugfs_init() to handle non-FDT blobskernel/liveupdate/kexec_handover_debugfs.c+21 -111 replyApplied
5/6kho: kexec-metadata: track previous kernel chaininclude/linux/kho/abi/kexec_metadata.h kernel/liveupdate/kexec_handover.c+144 -01 replyApplied
6/6kho: document kexec-metadata tracking featureDocumentation/admin-guide/mm/kho.rst+39 -00 repliesApplied

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchSeongJae ParkMike Rapoport (Microsoft)Pratyush Yadav
SeriesA-b
1/6R-b R-b
2/6R-b R-b
3/6R-b R-b
4/6R-b
5/6A-b R-b R-b
6/6R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v9 thread

Cover letter [PATCH v9 0/6] kho: history: track previous kernel version and kexec boot count

Use Kexec Handover (KHO) to pass the previous kernel's version string and the number of kexec reboots since the last cold boot to the next kernel, and print it at boot time.

Example
=======

	[    0.000000] Linux version 6.19.0-rc3-upstream-00047-ge5d992347849
	...
	[    0.000000] KHO: exec from: 6.19.0-rc4-next-20260107upstream-00004-g3071b0dc4498 (count 1)

Motivation
==========

Bugs that only reproduce when kexecing from specific kernel versions are difficult to diagnose. These issues occur when a buggy kernel kexecs into a new kernel, with the bug manifesting only in the second kernel.

Recent examples include:

* eb2266312507 ("x86/boot: Fix page table access in 5-level to 4-level paging transition")
* 77d48d39e991 ("efistub/tpm: Use ACPI reclaim memory for event log to avoid corruption")
* 64b45dd46e15 ("x86/efi: skip memattr table on kexec boot")

As kexec-based reboots become more common, these version-dependent bugs are appearing more frequently. At scale, correlating crashes to the previous kernel version is challenging, especially when issues only occur in specific transition scenarios.

Some bugs manifest only after multiple consecutive kexec reboots. Tracking the kexec count helps identify these cases (this metric is already used by live update sub-system).

KHO provides a reliable mechanism to pass information between kernels. By carrying the previous kernel's release string and kexec count forward, we can print this context at boot time to aid debugging.

The goal of this feature is to have this information being printed in early boot, so, users can trace back kernel releases in kexec. Systemd is not helpful because we cannot assume that the previous kernel has systemd or even write access to the disk (common when using Linux as bootloaders)

---
Changes in v9:
- Rebase on top of new KHO changes
- Fail and ignore subtree in case size is invalid (Pratyush)
- Separate kexec_metadata into a new file (Pratyush)
- Link to v8: https://patch.msgid.link/[email protected]

Changes in v8:
- Removed an unnecessary size variable (Mike)
- Moved some renaming to the proper rename patch (Mike)
- Link to v7: https://patch.msgid.link/[email protected]

Changes in v7:
- Persist blob size in KHO FDT as a "blob-size" property so the incoming kernel can determine blob sizes without assuming FDT format (Pratyush)
- Link to v6: https://patch.msgid.link/[email protected]

Changes in v6:
- s/UAPI/uABI (Mike)
- Expanded the rename of s/fdt/blob to kho_debugfs_* calls also (Mike)
- Link to v5: https://patch.msgid.link/[email protected]

Changes in v5:
- Add a patch to document the new feature.
- Change kho_add_subtree() to receive the size instad of guessing it.
- reworked some code path to make it more standard.
- Link to v4: https://patch.msgid.link/[email protected]

Changes in v4:
- Squashed everything in a single commit
- Moved from FDT to C structs (Pratyush)
- Usage of subtress intead of FDT directly (Pratyush)
- Renamed a bunch of variables and functions.
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Remove the extra CONFIG for this feature.
- Reworded some identifiers, properties and printks.
- Better documented the questions raised during v2.
- Link to v2: https://patch.msgid.link/[email protected]

Changes from v2 to v1 (RFC)
- Track the number of kexecs since cold boot (Pasha)
- Change the printk() order compared to KHO
- Rewording of the commit summary
- Link to RFC: https://patch.msgid.link/[email protected]

---
Breno Leitao (6):
kho: add size parameter to kho_add_subtree()
kho: rename fdt parameter to blob in kho_add/remove_subtree()
kho: persist blob size in KHO FDT
kho: fix kho_in_debugfs_init() to handle non-FDT blobs
kho: kexec-metadata: track previous kernel chain
kho: document kexec-metadata tracking feature

 Documentation/admin-guide/mm/kho.rst        |  41 +++++++-
 include/linux/kexec_handover.h              |  13 +--
 include/linux/kho/abi/kexec_handover.h      |  20 +++-
 include/linux/kho/abi/kexec_metadata.h      |  46 ++++++++
 kernel/liveupdate/kexec_handover.c          | 158 ++++++++++++++++++++++++----
 kernel/liveupdate/kexec_handover_debugfs.c  |  55 ++++++----
 kernel/liveupdate/kexec_handover_internal.h |  15 +--
 kernel/liveupdate/luo_core.c                |   5 +-
 lib/test_kho.c                              |   5 +-
 mm/memblock.c                               |   4 +-
 10 files changed, 298 insertions(+), 64 deletions(-)

---
base-commit: 5c9e55fecf9365890c64f14761a80f9413a3b1d1
change-id: 20251230-kho-7707e8a2ef1e

Best regards,

Signature · 1 line
Breno Leitao <[email protected]>