All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] kho: handle failures to reserve preserved memory
@ 2026-12-06  4:15 Chris Down
  2026-12-06  4:15 ` [PATCH v3 1/3] kho: don't use is_kho_boot() to check for inherited bootmem Chris Down
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chris Down @ 2026-12-06  4:15 UTC (permalink / raw)
  To: rppt, tatashin, pratyush
  Cc: pasha.tatashin, graf, kexec, linux-mm, linux-kernel, kernel-team,
	sashiko-bot

When a kernel boots with a handover, kho_preserved_memory_reserve()
reserves each range of preserved memory in memblock, but it ignores
failures. If one happens, memory that a KHO user still expects to
restore can be released to the page allocator. This needs memblock to
fail to grow its reserved array, so it's unlikely. But if it does
happen, the result is bad enough to be worth handling.

Patch 3 makes the walk stop on such a failure, so that
kho_mem_retrieve() drops the handover and the boot carries on without
it. For that to be safe, reserve_mem_kho_revive() now reserves its own
region, and patches 1 and 2 make KHO keep treating the bootmem areas as
inherited after a failed handover.

From a quick check I did with one of the reservations forced to fail,
the kernel logs the failure and boots without the handover. The
reserve_mem region stays reserved, and a later KHO kexec out of that
kernel works.

This is based on the next branch of the liveupdate tree, as it needs
the CMA accounting from liveupdate-7.5 as well as 0e88c65680e2 ("kho:
don't release incoming bootmem areas when kho_init() fails") from
mainline, and only next has both.

v3:

- Check kho_in.bootmem_phys for the CMA accounting and in kho_init()'s
  error path as well, in a new patch 1
- Keep kho_in.bootmem_phys and kho_bootmem set when
  kho_memory_init_early() fails, and don't reserve new bootmem areas in
  that case (Pratyush)
- Retitle what was patch 1 and is now patch 2, as it's no longer only
  about kho_init()
- Reword the comments in kho_init() and reserve_mem_kho_revive()
  (Pratyush)
- Say in patch 3 what it takes for the reservation to fail (Mike)
- Show in patch 3 that the kernel still boots after a failed
  reservation, with a way to trigger one

v2:

- Drop the handover and carry on instead of panicking, with
  reserve_mem_kho_revive() reserving its own region (Mike)
- Stop kho_init() from releasing inherited bootmem areas after a failed
  retrieval, as a separate patch (Mike)

v2: https://lore.kernel.org/r/cover.1796126791.git.chris@chrisdown.name
v1: https://lore.kernel.org/r/avQUquBK6cO6tUUI@chrisdown.name

Chris Down (3):
  kho: don't use is_kho_boot() to check for inherited bootmem
  kho: leave inherited bootmem alone if the handover fails
  kho: drop the handover if preserved memory can't be reserved

 kernel/liveupdate/kho_core.c | 61 ++++++++++++++++++++++--------------
 mm/memblock.c                | 11 +++++++
 2 files changed, 49 insertions(+), 23 deletions(-)


base-commit: 13278f869c76f01ab1a6f6c694f718d9f487bd68
-- 
2.56.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-06  4:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-06  4:15 [PATCH v3 0/3] kho: handle failures to reserve preserved memory Chris Down
2026-12-06  4:15 ` [PATCH v3 1/3] kho: don't use is_kho_boot() to check for inherited bootmem Chris Down
2026-12-06  4:15 ` [PATCH v3 2/3] kho: leave inherited bootmem alone if the handover fails Chris Down
2026-12-06  4:15 ` [PATCH v3 3/3] kho: drop the handover if preserved memory can't be reserved Chris Down
2026-12-06  4:30 ` [PATCH v3 0/3] kho: handle failures to reserve preserved memory sashiko-bot

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.