[PW_SID:1155899] kdump: reduce vmcore size and capture time - #2574
[PW_SID:1155899] kdump: reduce vmcore size and capture time#2574linux-riscv-bot wants to merge 11 commits into
Conversation
Commit 7d163a7 ("memblock: make HugeTLB bootmem allocation work with KHO") added MEMBLOCK_RSRV_HUGETLB but did not add the corresponding entry to flagname[]. As a result, memblock debugfs cannot report the flag by name. Add the missing RSV_HUGETLB entry. Fixes: 7d163a7 ("memblock: make HugeTLB bootmem allocation work with KHO") Signed-off-by: Meijing Zhao <zhaomeijing@lixiang.com> Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Link: https://lore.kernel.org/lkml/20260821020910.3428585-2-zhaomeijing100@gmail.com/ Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Replace walk_system_ram_res() with for_each_mem_range(). A later patch introduces MEMBLOCK_NODUMP in memblock, the reserved-memory regions marked with MEMBLOCK_NODUMP can be excluded from the vmcore by walking memblock. for_each_mem_range() iterates memblock.memory, which is freed after init unless ARCH_KEEP_MEMBLOCK is selected. riscv needs ARCH_KEEP_MEMBLOCK to filter reserved memory from the vmcore, so extend its condition (ACPI || KEXEC) with CRASH_DUMP. arm64 and loongarch already select ARCH_KEEP_MEMBLOCK unconditionally. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Tested-by: Meijing Zhao <zhaomeijing@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
arm64, loongarch and riscv open-code the same memblock walk in arch_get_system_nr_ranges() and arch_crash_populate_cmem(). Move it into the __weak defaults in kernel/crash_core.c and delete the arch copies. No functional change. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Tested-by: Meijing Zhao <zhaomeijing@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
crash_prepare_headers() counts memory ranges before populating the allocated crash_mem array. The weak implementation used by ARM64, RISC-V and LoongArch walks memblock.memory, while x86 performs the same two-pass operation over system RAM resources. Concurrent memory hotplug can change range source between the two walks and make the populate pass overflow cmem->ranges. Take device_hotplug_lock when preparing crash headers during kexec_file_load(). The x86 memory hotplug path already takes device_hotplug_lock, so call __crash_prepare_headers() directly to avoid recursive locking. Sashiko reported this issue in [1]. Fixes: 3751e72 ("arm64: kexec_file: add crash dump support") Fixes: 1bcca86 ("LoongArch: Add crash dump support for kexec_file") Fixes: 8acea45 ("RISC-V: Support for kexec_file on panic") Fixes: dd5f726 ("kexec: support for kexec on panic using new system call") Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Link: https://sashiko.dev/#/message/20260806101002.1F84E1F000E9@smtp.kernel.org [1] Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
for_each_mem_range() skips MEMBLOCK_NOMAP regions implicitly. Switch the weak defaults to for_each_mem_region(), which exposes struct memblock_region and per-region flags, and filter NOMAP regions explicitly via the new crash_should_skip_region() helper. This prepares for a subsequent patch to extend the skip filter. No functional change. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Tested-by: Meijing Zhao <zhaomeijing@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add MEMBLOCK_NODUMP to mark regions that should be excluded from kdump vmcores. The flag is meant for reserved memory that carries no data useful for crash analysis. Reusable reserved regions such as CMA may hold useful data, so these regions must not be marked MEMBLOCK_NODUMP. Subsequent patches wire this up for /reserved-memory and /memreserve/ entries. Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Tested-by: Meijing Zhao <zhaomeijing@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add a 'dumpable' flag to struct reserved_mem to decide whether a reserved area should be included in the kdump vmcore. Non-dumpable regions are later marked MEMBLOCK_NODUMP;the filtering itself happens in memblock, keeping the arch kdump code independent of the DT API. Most reserved regions are owned by devices and do not contain data useful for kernel crash analysis, so dumpable default to false. Reusable CMA regions are different: their pages are handed back to the buddy allocator and may contain key data for crash analysis, so set dumpable to true in rmem_cma_setup(). The dumpable flag is also used to check /memreserve/ entries for overlap with other dumpable regions. Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Tested-by: Meijing Zhao <zhaomeijing@lixiang.com> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Mark non-dumpable reserved-memory regions with MEMBLOCK_NODUMP so kdump can omit them from the vmcore. The marking is guarded by CONFIG_CRASH_DUMP so non-kdump kernels do not pay the cost of splitting memblock.memory entries at NODUMP boundaries. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Tested-by: Meijing Zhao <zhaomeijing@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The /memreserve/ entries are memory reservations made by the bootloader or firmware, their contents are not needed for kernel crash analysis, so mark them MEMBLOCK_NODUMP to have kdump omit them from the vmcore. Entries that overlap a dumpable region (such as CMA) are left unmarked, because the pages of a dumpable region may carry crash-relevant data. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Tested-by: Meijing Zhao <zhaomeijing@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Reserve regions (for GPU, DSP, ...) carry no data useful for crash analysis. Exclude MEMBLOCK_NODUMP regions from the vmcore ELF header to reduce vmcore size and capture time. crash_should_skip_region() now also returns true for MEMBLOCK_NODUMP. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Tested-by: Meijing Zhao <zhaomeijing@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 1: "[v6,01/10] mm: memblock: add missing HugeTLB flag name" |
|
Patch 2: "[v6,02/10] riscv: build crash_mem ranges from memblock instead of resource tree" |
|
Patch 2: "[v6,02/10] riscv: build crash_mem ranges from memblock instead of resource tree" |
|
Patch 2: "[v6,02/10] riscv: build crash_mem ranges from memblock instead of resource tree" |
|
Patch 2: "[v6,02/10] riscv: build crash_mem ranges from memblock instead of resource tree" |
|
Patch 2: "[v6,02/10] riscv: build crash_mem ranges from memblock instead of resource tree" |
|
Patch 2: "[v6,02/10] riscv: build crash_mem ranges from memblock instead of resource tree" |
|
Patch 2: "[v6,02/10] riscv: build crash_mem ranges from memblock instead of resource tree" |
|
Patch 8: "[v6,08/10] of: reserved_mem: mark /reserved-memory entries with MEMBLOCK_NODUMP" |
|
Patch 8: "[v6,08/10] of: reserved_mem: mark /reserved-memory entries with MEMBLOCK_NODUMP" |
|
Patch 8: "[v6,08/10] of: reserved_mem: mark /reserved-memory entries with MEMBLOCK_NODUMP" |
|
Patch 8: "[v6,08/10] of: reserved_mem: mark /reserved-memory entries with MEMBLOCK_NODUMP" |
|
Patch 8: "[v6,08/10] of: reserved_mem: mark /reserved-memory entries with MEMBLOCK_NODUMP" |
|
Patch 8: "[v6,08/10] of: reserved_mem: mark /reserved-memory entries with MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 9: "[v6,09/10] of: reserved_mem: mark /memreserve/ entries as MEMBLOCK_NODUMP" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
|
Patch 10: "[v6,10/10] crash_core: skip MEMBLOCK_NODUMP regions when building vmcore ELF header" |
PR for series 1155899 applied to workflow__riscv__fixes
Name: kdump: reduce vmcore size and capture time
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1155899
Version: 6