diff options
| author | Alexander Graf <[email protected]> | 2025-05-09 07:46:20 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-05-13 06:50:39 +0000 |
| commit | d59f43b5748092557d34244e29a618221a250501 (patch) | |
| tree | a3e72c0da1387334d8a0fb2c9e2ed6a85bdb2d8f /mm/mm_init.c | |
| parent | memblock: add MEMBLOCK_RSRV_KERN flag (diff) | |
| download | kernel-d59f43b5748092557d34244e29a618221a250501.tar.gz kernel-d59f43b5748092557d34244e29a618221a250501.zip | |
memblock: add support for scratch memory
With KHO (Kexec HandOver), we need a way to ensure that the new kernel
does not allocate memory on top of any memory regions that the previous
kernel was handing over. But to know where those are, we need to include
them in the memblock.reserved array which may not be big enough to hold
all ranges that need to be persisted across kexec. To resize the array,
we need to allocate memory. That brings us into a catch 22 situation.
The solution to that is limit memblock allocations to the scratch regions:
safe regions to operate in the case when there is memory that should
remain intact across kexec.
KHO provides several "scratch regions" as part of its metadata. These
scratch regions are contiguous memory blocks that known not to contain any
memory that should be persisted across kexec. These regions should be
large enough to accommodate all memblock allocations done by the kexeced
kernel.
We introduce a new memblock_set_scratch_only() function that allows KHO to
indicate that any memblock allocation must happen from the scratch
regions.
Later, we may want to perform another KHO kexec. For that, we reuse the
same scratch regions. To ensure that no eventually handed over data gets
allocated inside a scratch region, we flip the semantics of the scratch
region with memblock_clear_scratch_only(): After that call, no allocations
may happen from scratch memblock regions. We will lift that restriction
in the next patch.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Alexander Graf <[email protected]>
Co-developed-by: Mike Rapoport (Microsoft) <[email protected]>
Signed-off-by: Mike Rapoport (Microsoft) <[email protected]>
Signed-off-by: Changyuan Lyu <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Anthony Yznaga <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Ashish Kalra <[email protected]>
Cc: Ben Herrenschmidt <[email protected]>
Cc: Borislav Betkov <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: Eric Biederman <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Gowans <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Marc Rutland <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Pasha Tatashin <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Pratyush Yadav <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Saravana Kannan <[email protected]>
Cc: Stanislav Kinsburskii <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Thomas Gleinxer <[email protected]>
Cc: Thomas Lendacky <[email protected]>
Cc: Will Deacon <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/mm_init.c')
0 files changed, 0 insertions, 0 deletions
