Skip to content

RFC memblock: keep reserve_mem regions out of KHO bootmem

Jose A. Perez de Azpillaga kexec linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2memblock: factor out the KHO bootmem check from memblock_alloc_hugetlb()mm/memblock.c+36 -340 replies
2/2memblock: don't allocate reserve_mem regions from KHO bootmemmm/memblock.c+28 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/2] memblock: keep reserve_mem regions out of KHO bootmem

On a KHO boot, a reserve_mem= region that can't be revived (new name, size or alignment) can be allocated from KHO bootmem, which the next kernel boots out of. With CONFIG_KEXEC_HANDOVER_DEBUG preserving it fails; without it, the next kernel's memmap ends up on top of it.

Patch 1 factors the bootmem check out of memblock_alloc_hugetlb(), and patch 2 uses it for reserve_mem. That also drops the TODO in reserve_mem(), which asks for the allocation to be outside KHO_NOPRSRV, though it's bootmem it has to stay out of.

Questions:

- If kho_discover_noprsrv() fails, only bootmem is NOPRSRV, and reserve_mem() now fails with -ENOMEM instead of using it. Is that the right thing to do?

- Should reserve_mem skip mirrored memory like HugeTLB does, rather than keep the fallback?

No Cc: stable, since patch 2 relies on 14773e2aa4c5 ("kho: extend scratch") for room outside bootmem.

Based on next-20261021, as it needs the KHO bootmem rename from liveupdate-7.4 and touches code changed in memblock for-next.

Tested on x86_64 in QEMU.

Jose A. Perez de Azpillaga (2):
memblock: factor out the KHO bootmem check from
memblock_alloc_hugetlb()
memblock: don't allocate reserve_mem regions from KHO bootmem

 mm/memblock.c | 100 ++++++++++++++++++++++++++++++++------------------
 1 file changed, 64 insertions(+), 36 deletions(-)

base-commit: 9a482184d910775cf648863148944945b74e2815 --
2.55.0