kho: rename "scratch" to "bootmem"
Subsystems (12)
Pratyush Yadav
maintainerv2 cover kho: rename "scratch" to "bootmem"
From: "Pratyush Yadav (Google)" <[email protected]>
The term "KHO scratch" is vague and overloaded. It does not accurately describe what the memory is for. This was discussed previously at [0]. The conclusion was to rename "KHO scratch" to "KHO bootmem", since this is memory passed by the previous kernel for early boot allocations.
In addition, memblock does not care about the provenance of the memory. It cares more about how it should use it. Use MEMBLOCK_KHO_NOPRSRV, instead of MEMBLOCK_KHO_SCRATCH, to describe this memory to memblock.
This series does the renames. It also gets rid of a redundant Kconfig.
While the diffstat is big and scary, most of the changes are mechanical. The most interesting functional change is in patch 4.
This series touches a lot of files across a lot of trees. But since all of that is purely KHO-related code, I would like to collect ACKs from the maintainers and take it via the liveupdate tree.
Ideally we should queue it in liveupdate/next early in the v7.4 cycle since it will cause a lot of conflicts with other patches throughout the KHO tree.
[0] https://lore.kernel.org/kexec/[email protected]/T/#u
Changes in v2:
- Rebase on latest liveupdate/next.
Pratyush Yadav (Google) (4):
memblock: get rid of CONFIG_MEMBLOCK_KHO_SCRATCH
memblock: rename KHO_SCRATCH to KHO_NOPRSRV
kho: rename KHO scratch to KHO bootmem
kho: rename kho_scratch= commandline parameter to kho_bootmem=
.../admin-guide/kernel-parameters.txt | 15 +- Documentation/admin-guide/mm/kho.rst | 18 +- Documentation/core-api/kho/index.rst | 36 +- arch/x86/boot/compressed/kaslr.c | 12 +- arch/x86/include/uapi/asm/setup_data.h | 4 +- arch/x86/kernel/e820.c | 2 +- arch/x86/kernel/kexec-bzimage64.c | 6 +- arch/x86/kernel/setup.c | 2 +- arch/x86/realmode/init.c | 2 +- drivers/firmware/efi/efi-init.c | 6 +- drivers/of/kexec.c | 16 +- include/asm-generic/kexec_handover.h | 2 +- include/linux/kexec.h | 2 +- include/linux/kexec_handover.h | 16 +- include/linux/memblock.h | 30 +- kernel/liveupdate/Kconfig | 1 - kernel/liveupdate/kexec_handover.c | 340 +++++++++--------- kernel/liveupdate/kexec_handover_debugfs.c | 24 +- kernel/liveupdate/kexec_handover_internal.h | 4 +- mm/Kconfig | 4 - mm/memblock.c | 56 +-- mm/mm_init.c | 6 +- tools/testing/memblock/internal.h | 2 +- 23 files changed, 302 insertions(+), 304 deletions(-)
base-commit: c65687600ed075d237a204755d99ad538db34b47
Signature · 1 line
2.55.0.979.g7e5102b832-goog
Pratyush Yadav
maintainerPATCH v2 1/4 memblock: get rid of CONFIG_MEMBLOCK_KHO_SCRATCH
From: "Pratyush Yadav (Google)" <[email protected]>
This config is only a proxy for CONFIG_KEXEC_HANDOVER. It is only enabled by KHO. No point in the indirection. Use CONFIG_KEXEC_HANDOVER directly.
--- include/linux/memblock.h | 2 +- kernel/liveupdate/Kconfig | 1 - mm/Kconfig | 4 ---- mm/memblock.c | 4 ++-- 4 files changed, 3 insertions(+), 8 deletions(-)
include/linux/memblock.h +1 -1
@@ -614,7 +614,7 @@ static inline void early_memtest(phys_addr_t start, phys_addr_t end) { }static inline void memtest_report_meminfo (struct seq_file *m) { }#endif -#ifdef CONFIG_MEMBLOCK_KHO_SCRATCH +#ifdef CONFIG_KEXEC_HANDOVER void memblock_set_kho_scratch_only (void );void memblock_clear_kho_scratch_only (void );#else
kernel/liveupdate/Kconfig +0 -1
@@ -5,7 +5,6 @@ menu "Live Update and Kexec HandOver" config KEXEC_HANDOVER bool "kexec handover" depends on ARCH_SUPPORTS_KEXEC_HANDOVER && ARCH_SUPPORTS_KEXEC_FILE - select MEMBLOCK_KHO_SCRATCH select KEXEC_FILE select LIBFDT select CMA
mm/Kconfig +0 -4
@@ -483,10 +483,6 @@ config HAVE_GUP_FAST depends on MMU bool -# Enable memblock support for scratch memory which is needed for kexec handover -config MEMBLOCK_KHO_SCRATCH - bool - # Don't discard allocated memory used to track "memory" and "reserved" memblocks # after early boot, so it can still be used to test for validity of memory. # Also, memblocks are updated with memory hot(un)plug.
mm/memblock.c +2 -2
@@ -113,7 +113,7 @@ unsigned long min_low_pfn;unsigned long max_pfn;unsigned long long max_possible_pfn; -#ifdef CONFIG_MEMBLOCK_KHO_SCRATCH +#ifdef CONFIG_KEXEC_HANDOVER /* When set to true, only allocate from MEMBLOCK_KHO_SCRATCH ranges */ static bool kho_scratch_only;#else
@@ -2596,7 +2596,7 @@ int reserve_mem_release_by_name(const char *name)return 1 ; } -#ifdef CONFIG_MEMBLOCK_KHO_SCRATCH +#ifdef CONFIG_KEXEC_HANDOVER __init void memblock_set_kho_scratch_only (void ) { kho_scratch_only = true;
Signature · 1 line
2.55.0.979.g7e5102b832-goog
Pratyush Yadav
maintainerPATCH v2 2/4 memblock: rename KHO_SCRATCH to KHO_NOPRSRV
In reply to Pratyush YadavFrom: "Pratyush Yadav (Google)" <[email protected]>
The term "KHO scratch" is vague. It does not accurately describe what the memory is for. Generally, scratch is for things that don't contain anything useful. This is not true.
For memblock, KHO_SCRATCH is the _only_ useful memory during a KHO boot. It is memory passed by the previous kernel that is guaranteed to have no preserved pages, and so is the only thing safe to allocate from early in boot.
In addition, KHO now has the ability to discover other "scratch" areas. These aren't directly passed by the previous kernel. Instead, they are found by searching the KHO preserved memory map.
Memblock does not care about the difference between the two. From memblock's perspective, both are memory areas with no preservations and so they are safe to allocate from before KHO fully initializes.
Rename MEMBLOCK_KHO_SCRATCH to MEMBLOCK_KHO_NOPRSRV. This name clearly shows what the memory is for from memblock's perspective. Update memblock functions and comments that refer to scratch to use noprsrv.
There are no functional changes apart from the flag name change in debugfs.
--- arch/x86/kernel/e820.c | 2 +- arch/x86/realmode/init.c | 2 +- drivers/firmware/efi/efi-init.c | 2 +- include/linux/memblock.h | 28 +++++++++---------- kernel/liveupdate/kexec_handover.c | 8 +++--- mm/memblock.c | 44 +++++++++++++++--------------- 6 files changed, 43 insertions(+), 43 deletions(-)
arch/x86/kernel/e820.c +1 -1
@@ -1363,7 +1363,7 @@ __init void e820__memblock_setup(void)* After real mode trampoline is allocated, we clear that scratch * marking. */ -memblock_mark_kho_scratch (0 ,SZ_1M ); +memblock_mark_kho_noprsrv (0 ,SZ_1M );/* * 32-bit systems are limited to 4BG of memory even with HIGHMEM and
arch/x86/realmode/init.c +1 -1
@@ -66,7 +66,7 @@ void __init reserve_real_mode(void)*/ memblock_reserve (0 ,SZ_1M ); -memblock_clear_kho_scratch (0 ,SZ_1M ); +memblock_clear_kho_noprsrv (0 ,SZ_1M ); }static void __init sme_sev_setup_real_mode (struct trampoline_header *th)
drivers/firmware/efi/efi-init.c +1 -1
@@ -178,7 +178,7 @@ static __init void reserve_regions(void)/* Remove all non-KHO regions */ for_each_mem_region (r) { -if (!memblock_is_kho_scratch (r)) { +if (!memblock_is_kho_noprsrv (r)) {memblock_remove (r->base, r->size); r--; }
include/linux/memblock.h +14 -14
@@ -46,11 +46,11 @@ extern unsigned long long max_possible_pfn;* @MEMBLOCK_RSRV_KERN: memory region that is reserved for kernel use, * either explictitly with memblock_reserve_kern() or via memblock * allocation APIs. All memblock allocations set this flag. -* @MEMBLOCK_KHO_SCRATCH: memory region that kexec can pass to the next -* kernel in handover mode. During early boot, we do not know about all -* memory reservations yet, so we get scratch memory from the previous -* kernel that we know is good to use. It is the only memory that -* allocations may happen from in this phase. +* @MEMBLOCK_KHO_NOPRSRV: memory region with no preservation from kexec +* handover. During early boot, we do not know about all memory preservations +* yet, so we get memory with no preservations from the previous kernel that we +* know is good to use. It is the only memory that allocations may happen from +* in this phase. * @MEMBLOCK_RSRV_HUGETLB: memory is reserved for hugetlb pages */ enum memblock_flags {
@@ -61,7 +61,7 @@ enum memblock_flags {MEMBLOCK_DRIVER_MANAGED =0x8 ,/* always detected via a driver */ MEMBLOCK_RSRV_NOINIT =0x10 ,/* don't initialize struct pages */ MEMBLOCK_RSRV_KERN =0x20 ,/* memory reserved for kernel use */ -MEMBLOCK_KHO_SCRATCH =0x40 ,/* scratch memory for kexec handover */ +MEMBLOCK_KHO_NOPRSRV =0x40 ,/* memory with no KHO preservations */ MEMBLOCK_RSRV_HUGETLB = 0x80, /* memory reserved for hugetlb pages */ };
@@ -158,8 +158,8 @@ int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);int memblock_clear_nomap (phys_addr_t base,phys_addr_t size);int memblock_reserved_mark_noinit (phys_addr_t base,phys_addr_t size);int memblock_reserved_mark_kern (phys_addr_t base,phys_addr_t size); -int memblock_mark_kho_scratch (phys_addr_t base,phys_addr_t size); -int memblock_clear_kho_scratch (phys_addr_t base,phys_addr_t size); +int memblock_mark_kho_noprsrv (phys_addr_t base,phys_addr_t size); +int memblock_clear_kho_noprsrv (phys_addr_t base,phys_addr_t size);void memblock_free (void *ptr,size_t size);void reset_all_zones_managed_pages (void );
@@ -301,9 +301,9 @@ static inline bool memblock_is_driver_managed(struct memblock_region *m)return m->flags &MEMBLOCK_DRIVER_MANAGED ; } -static inline bool memblock_is_kho_scratch (struct memblock_region *m) +static inline bool memblock_is_kho_noprsrv (struct memblock_region *m) { -return m->flags &MEMBLOCK_KHO_SCRATCH ; +return m->flags &MEMBLOCK_KHO_NOPRSRV ; } int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn,
@@ -615,11 +615,11 @@ static inline void memtest_report_meminfo(struct seq_file *m) { }#endif #ifdef CONFIG_KEXEC_HANDOVER -void memblock_set_kho_scratch_only (void ); -void memblock_clear_kho_scratch_only (void ); +void memblock_set_kho_noprsrv_only (void ); +void memblock_clear_kho_noprsrv_only (void );#else -static inline void memblock_set_kho_scratch_only (void ) { } -static inline void memblock_clear_kho_scratch_only (void ) { } +static inline void memblock_set_kho_noprsev_only (void ) { } +static inline void memblock_clear_kho_noprsrv_only (void ) { }#endif #endif /* _LINUX_MEMBLOCK_H */
kernel/liveupdate/kexec_handover.c +4 -4
@@ -958,7 +958,7 @@ static int __init kho_ext_mark_scratch(unsigned long key, void *data)int err;if (start > *prev_end) { - err =memblock_mark_kho_scratch (*prev_end, start - *prev_end); + err =memblock_mark_kho_noprsrv (*prev_end, start - *prev_end);if (err)return err; }
@@ -1031,7 +1031,7 @@ static void __init kho_extend_scratch(void)/* Mark everything from last busy block to end of DRAM. */ if (prev_end <memblock_end_of_DRAM ()) - err =memblock_mark_kho_scratch (prev_end,memblock_end_of_DRAM () - prev_end); + err =memblock_mark_kho_noprsrv (prev_end,memblock_end_of_DRAM () - prev_end);/* fallthrough */ out:
@@ -2002,7 +2002,7 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,u64 size = area->size;memblock_add (area->addr, size); - err =memblock_mark_kho_scratch (area->addr, size); + err =memblock_mark_kho_noprsrv (area->addr, size);if (err) {pr_warn ("failed to mark the scratch region 0x%pa+0x%pa: %pe" , &area->addr, &size,ERR_PTR (err));
@@ -2020,7 +2020,7 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,* we initialize the page tables which we will need to ingest all * memory reservations from the previous kernel. */ -memblock_set_kho_scratch_only (); +memblock_set_kho_noprsrv_only (); kho_in.fdt_phys = fdt_phys; kho_in.scratch_phys = scratch_phys;
mm/memblock.c +22 -22
118 lines not on this page · raw message
Signature · 1 line
2.55.0.979.g7e5102b832-goog
[email protected]
AI reviewRe: [PATCH v2 2/4] memblock: rename KHO_SCRATCH to KHO_NOPRSRV
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Low] Typo in the dummy fallback function for `memblock_set_kho_noprsrv_only()` when…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Typo in the dummy fallback function for memblock_set_kho_noprsrv_only() when CONFIG_KEXEC_HANDOVER is disabled.
- [Low] Stale references to 'scratch' memory left unupdated in comments in arch/x86/kernel/e820.c.
--
commit 1cbb2e7144e320e54e1042768c9a90f6433c5d65
Author: Pratyush Yadav (Google) <[email protected]>
memblock: rename KHO_SCRATCH to KHO_NOPRSRV
This commit renames the vague MEMBLOCK_KHO_SCRATCH flag to MEMBLOCK_KHO_NOPRSRV to better reflect that it represents memory with no preservations during early KHO boot. It updates the memblock functions and comments accordingly.
arch/x86/kernel/e820.c __init void e820__memblock_setup(void) · line 1365
Quoted 8 lines
arch/x86/kernel/e820.c +0
-0@@ -1363,7 +1363,7 @@ __init void e820__memblock_setup(void)* After real mode trampoline is allocated, we clear that scratch * marking. */
[Severity: Low]
This isn't a bug, but should the block comment here in e820__memblock_setup() also be updated? It still refers to "scratch marking" and earlier in the block to "scratch memory", which seems to miss the commit's intent to update memblock comments to use "noprsrv".
Quoted 5 lines
arch/x86/kernel/e820.c +1
-1-memblock_mark_kho_scratch (0 ,SZ_1M ); +memblock_mark_kho_noprsrv (0 ,SZ_1M );/* * 32-bit systems are limited to 4BG of memory even with HIGHMEM and
[ ... ]
Quoted 4 lines
include/linux/memblock.h +0
-0
[ ... ]
include/linux/memblock.h static inline void memtest_report_meminfo(struct seq_file *m) { } · line 621
Quoted 12 lines
include/linux/memblock.h +3
-4@@ -615,11 +615,11 @@ static inline void memtest_report_meminfo(struct seq_file *m) { }#endif #ifdef CONFIG_KEXEC_HANDOVER -void memblock_set_kho_scratch_only (void ); -void memblock_clear_kho_scratch_only (void ); +void memblock_set_kho_noprsrv_only (void ); +void memblock_clear_kho_noprsrv_only (void );#else -static inline void memblock_set_kho_scratch_only (void ) { } -static inline void memblock_clear_kho_scratch_only (void ) { } +static inline void memblock_set_kho_noprsev_only (void ) { }
[Severity: Low]
Is there a typo in the name of this dummy fallback function? It is named memblock_set_kho_noprsev_only (with 'ev' instead of 'rv').
Could this cause a build failure due to a missing function declaration if code compiled without CONFIG_KEXEC_HANDOVER attempts to call memblock_set_kho_noprsrv_only()?
Quoted 4 lines
include/linux/memblock.h +1
-0+static inline void memblock_clear_kho_noprsrv_only (void ) { }#endif #endif /* _LINUX_MEMBLOCK_H */
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Pratyush Yadav
maintainerPATCH v2 3/4 kho: rename KHO scratch to KHO bootmem
In reply to Pratyush YadavFrom: "Pratyush Yadav (Google)" <[email protected]>
The term "KHO scratch" is vague and overloaded.
For one, it does not accurately describe what the memory is for. From KHO's perspective, it is memory passed by the previous kernel that is guaranteed to have no allocations and hence it is safe to allocate from.
For another, the term is overloaded. KHO also knows to discover other ranges of memory that don't have any preservations and are safe to allocate from. This is done by kho_extend_scratch(). These areas, while called "scratch", are completely different from the chunk of memory passed by the previous kernel for early boot allocations.
Rename "KHO scratch" to "KHO boot memory", or "KHO bootmem" in short. Update all function names, variable names, comments, and documentation to use this.
Call the discovered areas "noprsrv", matching what memblock would see them as. Rename kho_extend_scratch() to reflect this.
This patch largely has no functional changes. The only functional changes are renames of debugfs files from "scratch_phys" and "scratch_len" to "bootmem_phys" and "bootmem_len" respectively.
---
Note that while all the documentation and internal naming around the kho_scratch= parameter have changed, the parameter name stays the same. This is to avoid functional changes (outside debugfs) in this big commit. The name will be changed in the next patch.
--- .../admin-guide/kernel-parameters.txt | 13 +- Documentation/admin-guide/mm/kho.rst | 16 +- Documentation/core-api/kho/index.rst | 36 +- arch/x86/boot/compressed/kaslr.c | 12 +- arch/x86/include/uapi/asm/setup_data.h | 4 +- arch/x86/kernel/kexec-bzimage64.c | 6 +- arch/x86/kernel/setup.c | 2 +- drivers/firmware/efi/efi-init.c | 4 +- drivers/of/kexec.c | 16 +- include/asm-generic/kexec_handover.h | 2 +- include/linux/kexec.h | 2 +- include/linux/kexec_handover.h | 16 +- kernel/liveupdate/kexec_handover.c | 328 +++++++++--------- kernel/liveupdate/kexec_handover_debugfs.c | 24 +- kernel/liveupdate/kexec_handover_internal.h | 4 +- mm/memblock.c | 8 +- mm/mm_init.c | 6 +- tools/testing/memblock/internal.h | 2 +- 18 files changed, 252 insertions(+), 249 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +7 -6
@@ -3033,9 +3033,10 @@ Kernel parameters kho_scratch= [KEXEC,EARLY] Format: ll[KMG],mm[KMG],nn[KMG] | nn% - Defines the size of the KHO scratch region. The KHO - scratch regions are physically contiguous memory - ranges that can only be used for non-kernel + + Defines the size of the KHO boot memory region. The + KHO boot memory regions are physically contiguous + memory ranges that can only be used for non-kernel allocations. That way, even when memory is heavily fragmented with handed over memory, the kexeced kernel will always have enough contiguous ranges to
@@ -3044,10 +3045,10 @@ Kernel parameters It is possible to specify the exact amount of memory in the form of "ll[KMG],mm[KMG],nn[KMG]" where the first parameter defines the size of a low - memory scratch area, the second parameter defines - the size of a global scratch area and the third + memory bootmem area, the second parameter defines + the size of a global bootmem area and the third parameter defines the size of additional per-node - scratch areas. The form "nn%" defines scale factor + bootmem areas. The form "nn%" defines scale factor (in percents) of memory that was used during boot. kmac= [MIPS] Korina ethernet MAC address.
Documentation/admin-guide/mm/kho.rst +8 -8
@@ -21,9 +21,9 @@ kexec. To use KHO, please boot the kernel with the ``kho=on`` command line parameter. You may use ``kho_scratch`` parameter to define size of the -scratch regions. For example ``kho_scratch=16M,512M,256M`` will reserve a -16 MiB low memory scratch area, a 512 MiB global scratch region, and 256 MiB -per NUMA node scratch regions on boot. +boot memory regions. For example ``kho_scratch=16M,512M,256M`` will reserve a +16 MiB low memory bootmem area, a 512 MiB global bootmem region, and 256 MiB +per NUMA node bootmem regions on boot. Perform a KHO kexec ===================
@@ -96,15 +96,15 @@ stabilized. current KHO state in this file. Kexec user space tooling can use this as input file for the KHO payload image. -``/sys/kernel/debug/kho/out/scratch_len`` - Lengths of KHO scratch regions, which are physically contiguous +``/sys/kernel/debug/kho/out/bootmem_len`` + Lengths of KHO bootmem regions, which are physically contiguous memory regions that will always stay available for future kexec allocations. Kexec user space tools can use this file to determine where it should place its payload images. -``/sys/kernel/debug/kho/out/scratch_phys`` - Physical locations of KHO scratch regions. Kexec user space tools - can use this file in conjunction to scratch_phys to determine where +``/sys/kernel/debug/kho/out/bootmem_phys`` + Physical locations of KHO bootmem regions. Kexec user space tools + can use this file in conjunction to bootmem_phys to determine where it should place its payload images. ``/sys/kernel/debug/kho/out/sub_fdts/``
Documentation/core-api/kho/index.rst +18 -18
@@ -13,8 +13,8 @@ Kexec HandOver (KHO) is a mechanism that allows Linux to preserve memory regions, which could contain serialized system states, across kexec. KHO uses :ref:`flattened device tree (FDT) <kho_fdt>` to pass information about -the preserved state from pre-exec kernel to post-kexec kernel and :ref:`scratch -memory regions <kho_scratch>` to ensure integrity of the preserved memory. +the preserved state from pre-exec kernel to post-kexec kernel and :ref:`boot +memory regions <kho_bootmem>` to ensure integrity of the preserved memory. .. _kho_fdt:
@@ -40,31 +40,31 @@ and post-kexec kernels. This ABI is defined by header files in abi.rst -.. _kho_scratch: +.. _kho_bootmem: -Scratch Regions -=============== +Boot Memory Regions +=================== To boot into kexec, we need to have a physically contiguous memory range that contains no handed over memory. Kexec then places the target kernel and initrd into that region. The new kernel exclusively uses this region for memory allocations before during boot up to the initialization of the page allocator. -We guarantee that we always have such regions through the scratch regions: On -first boot KHO allocates several physically contiguous memory regions. Since +We guarantee that we always have such regions through the boot memory regions: +On first boot KHO allocates several physically contiguous memory regions. Since after kexec these regions will be used by early memory allocations, there is a -scratch region per NUMA node plus a scratch region to satisfy allocations -requests that do not require particular NUMA node assignment. -By default, size of the scratch region is calculated based on amount of memory -allocated during boot. The ``kho_scratch`` kernel command line option may be -used to explicitly define size of the scratch regions. -The scratch regions are declared as CMA when page allocator is initialized so -that their memory can be used during system lifetime. CMA gives us the -guarantee that no handover pages land in that region, because handover pages -must be at a static physical memory location and CMA enforces that only -movable pages can be located inside. +boot memory region per NUMA node plus a boot memory region to satisfy +allocations requests that do not require particular NUMA node assignment. By +default, size of the boot memory region is calculated based on amount of memory +allocated during boot. The ``kho_bootmem`` kernel command line option may be +used to explicitly define size of the boot memory regions. The boot memory +regions are declared as CMA when page allocator is initialized so that their +memory can be used during system lifetime. CMA gives us the guarantee that no +handover pages land in that region, because handover pages must be at a static +physical memory location and CMA enforces that only movable pages can be located +inside. -After KHO kexec, we ignore the ``kho_scratch`` kernel command line option and +After KHO kexec, we ignore the ``kho_bootmem`` kernel command line option and instead reuse the exact same region that was originally allocated. This allows us to recursively execute any amount of KHO kexecs. Because we used this region for boot memory allocations and as target memory for kexec blobs, some parts
arch/x86/boot/compressed/kaslr.c +6 -6
@@ -764,12 +764,12 @@ static void process_e820_entries(unsigned long minimum, }/* -* If KHO is active, only process its scratch areas to ensure we are not +* If KHO is active, only process its bootmem areas to ensure we are not * stepping onto preserved memory. */ static bool process_kho_entries (unsigned long minimum,unsigned long image_size) { -struct kho_scratch *kho_scratch; +struct kho_bootmem *kho_bootmem;struct setup_data *ptr;struct kho_data *kho;int i, nr_areas =0 ;
@@ -781,8 +781,8 @@ static bool process_kho_entries(unsigned long minimum, unsigned long image_size)while (ptr) {if (ptr->type ==SETUP_KEXEC_KHO ) { kho = (struct kho_data *)(unsigned long )ptr->data; - kho_scratch = (void *)(unsigned long )kho->scratch_addr; - nr_areas = kho->scratch_size /sizeof (*kho_scratch); + kho_bootmem = (void *)(unsigned long )kho->bootmem_addr; + nr_areas = kho->bootmem_size /sizeof (*kho_bootmem);break ; }
@@ -793,7 +793,7 @@ static bool process_kho_entries(unsigned long minimum, unsigned long image_size)return false;for (i =0 ; i < nr_areas; i++) { -struct kho_scratch *area = &kho_scratch[i]; +struct kho_bootmem *area = &kho_bootmem[i];struct mem_vector region = { .start = area->addr, .size = area->size,
@@ -822,7 +822,7 @@ static unsigned long find_random_phys_addr(unsigned long minimum, }/* -* During kexec handover only process KHO scratch areas that are known +* During kexec handover only process KHO bootmem areas that are known * not to contain any data that must be preserved. */ if (!process_kho_entries(minimum, image_size) &&
arch/x86/include/uapi/asm/setup_data.h +2 -2
@@ -85,8 +85,8 @@ struct ima_setup_data {struct kho_data {__u64 fdt_addr;__u64 fdt_size; -__u64 scratch_addr; -__u64 scratch_size; +__u64 bootmem_addr; +__u64 bootmem_size; } __attribute__((packed));#endif /* __ASSEMBLER__ */
arch/x86/kernel/kexec-bzimage64.c +3 -3
@@ -285,14 +285,14 @@ static void setup_kho(const struct kimage *image, struct boot_params *params, sd->len =sizeof (struct kho_data );/* Only add if we have all KHO images in place */ -if (!image->kho.fdt || !image->kho.scratch) +if (!image->kho.fdt || !image->kho.bootmem)return ;/* Add setup data */ kho->fdt_addr = image->kho.fdt; kho->fdt_size =PAGE_SIZE ; - kho->scratch_addr = image->kho.scratch->mem; - kho->scratch_size = image->kho.scratch->bufsz; + kho->bootmem_addr = image->kho.bootmem->mem; + kho->bootmem_size = image->kho.bootmem->bufsz; sd->next = params->hdr.setup_data; params->hdr.setup_data = params_load_addr + setup_data_offset; }
arch/x86/kernel/setup.c +1 -1
@@ -472,7 +472,7 @@ static void __init add_kho(u64 phys_addr, u32 data_len)return ; } -kho_populate (kho->fdt_addr, kho->fdt_size, kho->scratch_addr, kho->scratch_size); +kho_populate (kho->fdt_addr, kho->fdt_size, kho->bootmem_addr, kho->bootmem_size);early_memunmap (kho, size); }
drivers/firmware/efi/efi-init.c +2 -2
@@ -165,10 +165,10 @@ static __init void reserve_regions(void)pr_info ("Processing EFI memory map:\n" );/* -* Discard memblocks discovered so far except for KHO scratch +* Discard memblocks discovered so far except for KHO bootmem * regions. Most memblocks at this point originate from memory nodes * in the DT and UEFI uses its own memory map instead. However, if -* KHO is enabled, scratch regions, which are good known memory +* KHO is enabled, bootmem regions, which are good known memory * must be preserved. */ memblock_dump_all ();
drivers/of/kexec.c +8 -8
@@ -261,23 +261,23 @@ static int kho_add_chosen(const struct kimage *image, void *fdt, int chosen_node#ifdef CONFIG_KEXEC_HANDOVER phys_addr_t fdt_mem =0 ;phys_addr_t fdt_len =0 ; -phys_addr_t scratch_mem =0 ; -phys_addr_t scratch_len =0 ; +phys_addr_t bootmem_arr =0 ; +phys_addr_t bootmem_len =0 ; ret =fdt_delprop (fdt, chosen_node,"linux,kho-fdt" );if (ret && ret != -FDT_ERR_NOTFOUND )return ret; - ret =fdt_delprop (fdt, chosen_node,"linux,kho-scratch" ); + ret =fdt_delprop (fdt, chosen_node,"linux,kho-bootmem" );if (ret && ret != -FDT_ERR_NOTFOUND )return ret; -if (!image->kho.fdt || !image->kho.scratch) +if (!image->kho.fdt || !image->kho.bootmem)return 0 ; fdt_mem = image->kho.fdt; fdt_len =PAGE_SIZE ; - scratch_mem = image->kho.scratch->mem; - scratch_len = image->kho.scratch->bufsz; + bootmem_arr = image->kho.bootmem->mem; + bootmem_len = image->kho.bootmem->bufsz;pr_debug ("Adding kho metadata to DT" );
@@ -285,8 +285,8 @@ static int kho_add_chosen(const struct kimage *image, void *fdt, int chosen_node fdt_mem, fdt_len);if (ret)return ret; - ret =fdt_appendprop_addrrange (fdt,0 , chosen_node,"linux,kho-scratch" , - scratch_mem, scratch_len); + ret =fdt_appendprop_addrrange (fdt,0 , chosen_node,"linux,kho-bootmem" , + bootmem_arr, bootmem_len);#endif /* CONFIG_KEXEC_HANDOVER */ return ret;
include/asm-generic/kexec_handover.h +1 -1
@@ -4,7 +4,7 @@#include <linux/types.h> -struct kho_scratch { +struct kho_bootmem {phys_addr_t addr;phys_addr_t size; };
include/linux/kexec.h +1 -1
@@ -418,7 +418,7 @@ struct kimage {#endif struct { -struct kexec_segment *scratch; +struct kexec_segment *bootmem;phys_addr_t fdt; } kho;
include/linux/kexec_handover.h +8 -8
@@ -36,15 +36,15 @@ int kho_retrieve_subtree(const char *name, phys_addr_t *phys, size_t *size);void kho_memory_init (void );void kho_memory_init_early (void ); -void kho_populate (phys_addr_t fdt_phys,u64 fdt_len,phys_addr_t scratch_phys, -u64 scratch_len); +void kho_populate (phys_addr_t fdt_phys,u64 fdt_len,phys_addr_t bootmem_phys, +u64 bootmem_len); -bool kho_scratch_overlap (phys_addr_t phys,size_t size); +bool kho_bootmem_overlap (phys_addr_t phys,size_t size); -static inline enum migratetype kho_scratch_migratetype (unsigned long pfn, +static inline enum migratetype kho_bootmem_migratetype (unsigned long pfn,enum migratetype mt) { -if (kho_scratch_overlap (PFN_PHYS (pfn), pageblock_nr_pages <<PAGE_SHIFT )) +if (kho_bootmem_overlap (PFN_PHYS (pfn), pageblock_nr_pages <<PAGE_SHIFT ))return MIGRATE_CMA ;return mt; }
@@ -123,16 +123,16 @@ static inline void kho_memory_init(void) { }static inline void kho_memory_init_early (void ) { }static inline void kho_populate (phys_addr_t fdt_phys,u64 fdt_len, -phys_addr_t scratch_phys,u64 scratch_len) +phys_addr_t bootmem_phys,u64 bootmem_len) { } -static inline bool kho_scratch_overlap (phys_addr_t phys,size_t size) +static inline bool kho_bootmem_overlap (phys_addr_t phys,size_t size) {return false; } -static inline enum migratetype kho_scratch_migratetype (unsigned long pfn, +static inline enum migratetype kho_bootmem_migratetype (unsigned long pfn,enum migratetype mt) {return mt;
kernel/liveupdate/kexec_handover.c +165 -163
695 lines not on this page · raw message
kernel/liveupdate/kexec_handover_debugfs.c +12 -12
@@ -77,23 +77,23 @@ void kho_debugfs_blob_remove(struct kho_debugfs *dbg, void *blob) } } -static int scratch_phys_show (struct seq_file *m,void *v) +static int bootmem_phys_show (struct seq_file *m,void *v) { -for (int i =0 ; i < kho_scratch_cnt; i++) -seq_printf (m,"0x%llx\n" , kho_scratch[i].addr); +for (int i =0 ; i < kho_bootmem_cnt; i++) +seq_printf (m,"0x%llx\n" , kho_bootmem[i].addr);return 0 ; } -DEFINE_SHOW_ATTRIBUTE (scratch_phys); +DEFINE_SHOW_ATTRIBUTE (bootmem_phys); -static int scratch_len_show (struct seq_file *m,void *v) +static int bootmem_len_show (struct seq_file *m,void *v) { -for (int i =0 ; i < kho_scratch_cnt; i++) -seq_printf (m,"0x%llx\n" , kho_scratch[i].size); +for (int i =0 ; i < kho_bootmem_cnt; i++) +seq_printf (m,"0x%llx\n" , kho_bootmem[i].size);return 0 ; } -DEFINE_SHOW_ATTRIBUTE (scratch_len); +DEFINE_SHOW_ATTRIBUTE (bootmem_len);__init void kho_in_debugfs_init (struct kho_debugfs *dbg,const void *fdt) {
@@ -186,13 +186,13 @@ __init int kho_out_debugfs_init(struct kho_debugfs *dbg)if (IS_ERR (sub_fdt_dir)) goto err_rmdir; - f =debugfs_create_file ("scratch_phys" ,0400 , dir,NULL , - &scratch_phys_fops); + f =debugfs_create_file ("bootmem_phys" ,0400 , dir,NULL , + &bootmem_phys_fops);if (IS_ERR (f)) goto err_rmdir; - f =debugfs_create_file ("scratch_len" ,0400 , dir,NULL , - &scratch_len_fops); + f =debugfs_create_file ("bootmem_len" ,0400 , dir,NULL , + &bootmem_len_fops);if (IS_ERR (f)) goto err_rmdir;
kernel/liveupdate/kexec_handover_internal.h +2 -2
@@ -19,8 +19,8 @@ struct kho_debugfs {struct kho_debugfs {};#endif -extern struct kho_scratch *kho_scratch; -extern unsigned int kho_scratch_cnt; +extern struct kho_bootmem *kho_bootmem; +extern unsigned int kho_bootmem_cnt;#ifdef CONFIG_KEXEC_HANDOVER_DEBUGFS int kho_debugfs_init (void );
mm/memblock.c +4 -4
@@ -1794,7 +1794,7 @@ void * __init memblock_alloc_hugetlb(phys_addr_t size, int nid, bool exact_nid)if (numa_valid_node (nid) && !exact_nid) { nid =NUMA_NO_NODE ;/* -* If a previous candidate overlapped with KHO scratch, it would +* If a previous candidate overlapped with KHO bootmem, it would * update start or end. Now that the search is opening to all * nodes, reset them. */
@@ -1810,12 +1810,12 @@ void * __init memblock_alloc_hugetlb(phys_addr_t size, int nid, bool exact_nid) found:/* * HugeTLB pages can be preserved with KHO and no preserved memory can -* be in scratch. So retry if found address overlaps with scratch. +* be in bootmem. So retry if found address overlaps with bootmem. * -* Scratch areas are normally not very large, so this shouldn't take too +* Bootmem areas are normally not very large, so this shouldn't take too * many retries. */ -if (kho_scratch_overlap (addr, size)) { +if (kho_bootmem_overlap (addr, size)) {if (memblock_bottom_up ()) start = addr + size;else
mm/mm_init.c +3 -3
@@ -684,7 +684,7 @@ static __meminit void pageblock_migratetype_init_range(unsigned long pfn,const unsigned long end = pfn + nr_pages;for (pfn =pageblock_align (pfn); pfn < end; pfn += pageblock_nr_pages) { -enum migratetype mt =kho_scratch_migratetype (pfn, migratetype); +enum migratetype mt =kho_bootmem_migratetype (pfn, migratetype);init_pageblock_migratetype (pfn_to_page (pfn), mt, false);if (!atomic &&IS_ALIGNED (pfn,PAGES_PER_SECTION ))
@@ -767,7 +767,7 @@ static void __meminit __init_deferred_page(unsigned long pfn, int nid)if (pageblock_aligned (pfn)) {enum migratetype mt = -kho_scratch_migratetype (pfn,MIGRATE_MOVABLE ); +kho_bootmem_migratetype (pfn,MIGRATE_MOVABLE );init_pageblock_migratetype (pfn_to_page (pfn), mt, false); } }
@@ -903,7 +903,7 @@ void __meminit memmap_init_range(unsigned long size, int nid, unsigned long zone* over the place during system boot. */ if (pageblock_aligned (pfn)) { -enum migratetype mt =kho_scratch_migratetype (pfn, migratetype); +enum migratetype mt =kho_bootmem_migratetype (pfn, migratetype);init_pageblock_migratetype (page, mt, isolate_pageblock);cond_resched ();
tools/testing/memblock/internal.h +1 -1
@@ -46,7 +46,7 @@ static inline bool __is_kernel(unsigned long addr)#define __SetPageReserved (p) ((void)(p)) -static inline bool kho_scratch_overlap (phys_addr_t phys,size_t size) +static inline bool kho_bootmem_overlap (phys_addr_t phys,size_t size) {return false; }
Signature · 1 line
2.55.0.979.g7e5102b832-goog
[email protected]
AI reviewRe: [PATCH v2 3/4] kho: rename KHO scratch to KHO bootmem
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [High] Mismatch in device tree property names for KHO bootmem causes KHO initialization failure on OF platforms.
- [Medium] UAPI breakage: renamed fields in struct kho_data.
Pre-existing issues:
- [High] Kernel panic or Use-After-Free during early boot if KHO bootmem allocation fails. --
commit 3dec172ac499ac601fb7ed89fbed34f0bd01b393
Author: Pratyush Yadav (Google) <[email protected]>
kho: rename KHO scratch to KHO bootmem
This commit renames the term "KHO scratch" to "KHO boot memory" (or bootmem) across function names, variable names, comments, and documentation. The change clarifies that the memory is provided by the previous kernel for early boot allocations, while the discovered allocatable areas are now called "noprsrv".
Quoted 3 lines
arch/x86/include/uapi/asm/setup_data.h +0
-0
[ ... ]
arch/x86/include/uapi/asm/setup_data.h struct ima_setup_data { · line 90
Quoted 9 lines
arch/x86/include/uapi/asm/setup_data.h +2
-2@@ -85,8 +85,8 @@ struct ima_setup_data {struct kho_data {__u64 fdt_addr;__u64 fdt_size; -__u64 scratch_addr; -__u64 scratch_size; +__u64 bootmem_addr; +__u64 bootmem_size; } __attribute__((packed));
[Severity: Medium]
Will renaming these fields in a UAPI header break source compatibility for userspace tools (like kexec-tools) that are compiled against this structure? If userspace references scratch_addr and scratch_size, compiling against the new headers will fail.
Quoted 3 lines
drivers/of/kexec.c +0
-0
[ ... ]
drivers/of/kexec.c static int kho_add_chosen(const struct kimage *image, void *fdt, int chosen_node · line 289
Quoted 8 lines
drivers/of/kexec.c +2
-2@@ -285,8 +285,8 @@ static int kho_add_chosen(const struct kimage *image, void *fdt, int chosen_node fdt_mem, fdt_len);if (ret)return ret; - ret =fdt_appendprop_addrrange (fdt,0 , chosen_node,"linux,kho-scratch" , - scratch_mem, scratch_len); + ret =fdt_appendprop_addrrange (fdt,0 , chosen_node,"linux,kho-bootmem" , + bootmem_arr, bootmem_len);
[Severity: High]
Does this create a mismatch with the FDT reader? Looking at the boot-time initialization in early_init_dt_check_kho() in drivers/of/fdt.c, the new kernel still appears to search for the old linux,kho-scratch property.
If the reader side is not updated to match, will this cause the new kernel to silently discard the handed-over memory during kexec on OF platforms?
Quoted 3 lines
kernel/liveupdate/kexec_handover.c +0
-0
[ ... ]
Quoted 20 lines
kernel/liveupdate/kexec_handover.c +6
-6@@ -837,73 +837,73 @@ static void __init kho_reserve_bootmem(void)if (!kho_enable)return ; -scratch_size_update (); +bootmem_size_update ();/* FIXME: deal with node hot-plug/remove */ - kho_scratch_cnt =nodes_weight (node_states[N_MEMORY ]) +2 ; - size = kho_scratch_cnt *sizeof (*kho_scratch); - kho_scratch =memblock_alloc (size,PAGE_SIZE ); -if (!kho_scratch) { -pr_err ("Failed to reserve scratch array\n" ); + kho_bootmem_cnt =nodes_weight (node_states[N_MEMORY ]) +2 ; + size = kho_bootmem_cnt *sizeof (*kho_bootmem); + kho_bootmem =memblock_alloc (size,PAGE_SIZE ); +if (!kho_bootmem) { +pr_err ("Failed to reserve bootmem array\n" ); goto err_disable_kho; }
[ ... ]
Quoted 4 lines
kernel/liveupdate/kexec_handover.c +1
-2-err_free_scratch_areas: +err_free_bootmem_areas:for (i--; i >=0 ; i--) -memblock_phys_free (kho_scratch[i].addr, kho_scratch[i].size);
kernel/liveupdate/kexec_handover.c static void __init kho_reserve_scratch(void) · line 908
Quoted 10 lines
kernel/liveupdate/kexec_handover.c +4
-3-err_free_scratch_desc: -memblock_free (kho_scratch, kho_scratch_cnt *sizeof (*kho_scratch)); +memblock_phys_free (kho_bootmem[i].addr, kho_bootmem[i].size); +err_free_bootmem_desc: +memblock_free (kho_bootmem, kho_bootmem_cnt *sizeof (*kho_bootmem)); err_disable_kho: -pr_warn ("Failed to reserve scratch area, disabling kexec handover\n" ); +pr_warn ("Failed to reserve bootmem, disabling kexec handover\n" ); kho_enable = false; }
[Severity: High]
This is a pre-existing issue, but if the initial memblock_alloc() fails in kho_reserve_bootmem(), the error path sets kho_enable = false but fails to clear kho_bootmem_cnt back to zero.
If kho_bootmem_cnt is greater than zero and kho_bootmem is a NULL or freed pointer, could this cause a panic later in boot? Code like kho_bootmem_migratetype() unconditionally calls kho_bootmem_overlap(), which iterates up to kho_bootmem_cnt and blindly dereferences kho_bootmem:
bool kho_bootmem_overlap(phys_addr_t phys, size_t size)
{
...
for (i = 0; i < kho_bootmem_cnt; i++) {
bootmem_start = kho_bootmem[i].addr;
...
}Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Pratyush Yadav
maintainerPATCH v2 4/4 kho: rename kho_scratch= commandline parameter to kho_bootmem=
In reply to Pratyush YadavFrom: "Pratyush Yadav (Google)" <[email protected]>
KHO now no longer uses "scratch" to describe the memory areas passed by previous kernel. Instead, it calls them boot memory, or bootmem in short. Rename the kho_scratch= commandline parameter to reflect this terminology change.
--- Documentation/admin-guide/kernel-parameters.txt | 2 +- Documentation/admin-guide/mm/kho.rst | 4 ++-- kernel/liveupdate/kexec_handover.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +1 -1
@@ -3031,7 +3031,7 @@ Kernel parameters "0" | "off" | "n" - kexec handover is disabled "1" | "on" | "y" - kexec handover is enabled - kho_scratch= [KEXEC,EARLY] + kho_bootmem= [KEXEC,EARLY] Format: ll[KMG],mm[KMG],nn[KMG] | nn% Defines the size of the KHO boot memory region. The
Documentation/admin-guide/mm/kho.rst +2 -2
@@ -20,8 +20,8 @@ need to enable if you would like to preserve their respective state across kexec. To use KHO, please boot the kernel with the ``kho=on`` command line -parameter. You may use ``kho_scratch`` parameter to define size of the -boot memory regions. For example ``kho_scratch=16M,512M,256M`` will reserve a +parameter. You may use ``kho_bootmem`` parameter to define size of the +boot memory regions. For example ``kho_bootmem=16M,512M,256M`` will reserve a 16 MiB low memory bootmem area, a 512 MiB global bootmem region, and 256 MiB per NUMA node bootmem regions on boot.
kernel/liveupdate/kexec_handover.c +3 -3
@@ -671,12 +671,12 @@ unsigned int kho_bootmem_cnt;* The bootmem areas are scaled by default as percent of memory allocated from * memblock. A user can override the scale with command line parameter: * -* kho_scratch=N% +* kho_bootmem=N% * * It is also possible to explicitly define size for a lowmem, a global and * per-node bootmem areas: * -* kho_scratch=l[KMG],n[KMG],m[KMG] +* kho_bootmem=l[KMG],n[KMG],m[KMG] * * The explicit size definition takes precedence over scale definition. */
@@ -751,7 +751,7 @@ static int __init kho_parse_bootmem_size(char *p)return 0 ; } -early_param ("kho_scratch" , kho_parse_bootmem_size); +early_param ("kho_bootmem" , kho_parse_bootmem_size);static void __init bootmem_size_update (void ) {
Signature · 1 line
2.55.0.979.g7e5102b832-goog
[email protected]
AI reviewRe: [PATCH v2 4/4] kho: rename kho_scratch= commandline parameter to kho_bootmem=
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [High] The patch series renames the device tree property from 'linux,kho-scratch' to 'linux,kho-bootmem'…
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] The patch series renames the device tree property from 'linux,kho-scratch' to 'linux,kho-bootmem' in the kexec sender, but fails to update the receiver, breaking Kexec Handover completely on OF/DeviceTree platforms.
- [Medium] The kernel parameter kho_scratch= is renamed to kho_bootmem= without retaining a fallback, breaking backward compatibility.
- [Low] Typo in the dummy implementation of memblock_set_kho_noprsrv_only for !CONFIG_KEXEC_HANDOVER.
- [Low] The patch fails to update 'scratch' terminology in several KHO-related comments, leaving the subsystem documentation in an inconsistent state.
--
commit 59d6b2029e0b48c319862bcfeb71dd0dd1ccc43d
Author: Pratyush Yadav (Google) <[email protected]>
kho: rename kho_scratch= commandline parameter to kho_bootmem=
KHO now no longer uses "scratch" to describe the memory areas passed by previous kernel. Instead, it calls them boot memory, or bootmem in short. Rename the kho_scratch= commandline parameter to reflect this terminology change.
Quoted 4 lines
kernel/liveupdate/kexec_handover.c +0
-0
[ ... ]
kernel/liveupdate/kexec_handover.c static int __init kho_parse_bootmem_size(char *p) · line 754
Quoted 6 lines
kernel/liveupdate/kexec_handover.c +1
-1@@ -751,7 +751,7 @@ static int __init kho_parse_bootmem_size(char *p)return 0 ; } -early_param ("kho_scratch" , kho_parse_bootmem_size); +early_param ("kho_bootmem" , kho_parse_bootmem_size);
[Severity: Medium]
Does the removal of the old parameter alias completely drop support for existing configurations?
User configuration scripts or bootloaders using the kho_scratch= parameter will silently fail to configure the KHO bootmem size, potentially causing Kexec Handover to fail or behave incorrectly due to default memory allocations.
Could a fallback early_param for kho_scratch be retained to prevent this regression?
[Severity: High]
Does this patch series introduce a property name mismatch between the kexec sender and receiver?
The sender kernel writes the new property in drivers/of/kexec.c:
ret = fdt_appendprop_addrrange(fdt, 0, chosen_node, "linux,kho-bootmem",
bootmem_arr, bootmem_len);
However, the receiver kernel still attempts to read the device tree property using the obsolete name in drivers/of/fdt.c:early_init_dt_check_kho():
if (!of_flat_dt_get_addr_size(node, "linux,kho-scratch",
&scratch_start, &scratch_size))
return;
Will this mismatch cause a silent failure of the handover process on Device Tree-based architectures, since of_flat_dt_get_addr_size will fail to find the required property?
[Severity: Low]
This isn't a bug, but is there a typo in the fallback macro definition for !CONFIG_KEXEC_HANDOVER?
In include/linux/memblock.h:
#ifdef CONFIG_KEXEC_HANDOVER
void memblock_set_kho_noprsrv_only(void);
void memblock_clear_kho_noprsrv_only(void);
#else
static inline void memblock_set_kho_noprsev_only(void) { } static inline void memblock_clear_kho_noprsrv_only(void) { } #endif
The dummy function is defined as memblock_set_kho_noprsev_only instead of memblock_set_kho_noprsrv_only. Any future code attempting to call this function outside of conditionally compiled KHO code will encounter a compilation error.
[Severity: Low]
This isn't a bug, but several comments still use the obsolete scratch terminology.
In kernel/kexec_file.c:kexec_locate_mem_hole():
/*
* If KHO is active, only use KHO scratch memory. All other memory
* could potentially be handed over.
*/
In mm/memfd_luo.c:luo_memfd_pin_folios():
* ensures none of the folios are in CMA -- which ensures they don't
* fall in KHO scratch memory. It also moves swapped out folios back to
Could these comments be updated to reflect the new bootmem terminology for consistency?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4