[PW_SID:1101350] kdump: reduce vmcore size and capture time#2021
[PW_SID:1101350] kdump: reduce vmcore size and capture time#2021linux-riscv-bot wants to merge 11 commits into
Conversation
Prepare for an upcoming change that appends /memreserve/ entries to reserved_mem[]; such entries have no name. No functional change. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…_DUMP=n Prepare for an upcoming change that excludes non-dumpable reserved regions from the kdump vmcore and will call crash_exclude_mem_range() from generic, non-arch code. No functional change. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
… fails The global pointer 'reserved_mem' continues to reference the reserved_mem_array which lives in __initdata if alloc_reserved_mem_array() fails. of_reserved_mem_lookup() is exported for post-init use, that would dereference freed memory and trigger a use-after-free. So reset reserved_mem_count to 0 when alloc_reserved_mem_array() fails. Fixes: 00c9a45 ("of: reserved_mem: Add code to dynamically allocate reserved_mem array") Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…emory entry Prepare for storing /memreserve/ entries in the reserved_mem array. Zero total_reserved_mem_cnt if no valid /reserved-memory entry, instead of keeping it's initial value of MAX_RESERVED_REGIONS, this allows accounting /memreserve entries based on total_reserved_mem_cnt in a follow-up patch. No functional change. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…rved_mem_late() Prepare for storing /memreserve/ entries in the reserved_mem array. alloc_reserved_mem_array is skipped if the device tree lacks a /reserved-memory node, pointer 'reserved_mem' continues to reference the reserved_mem_array which lives in __initdata, storing /memreserve/ entries into reserved_mem_array would result in metadata loss, and an out-of-bounds memory access will occur if the device tree contains more than MAX_RESERVED_REGIONS /memreserve/ entries. So split alloc_reserved_mem_array() from fdt_scan_reserved_mem_late(), and call alloc_reserved_mem_array() whether or not there is a /reserved-memory node. No functional change. The actual /memreserve/ population is added in a follow-up patch. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add a 'dumpable' flag to struct reserved_mem so the kernel can decide whether a reserved area should be included in the kdump vmcore. Most reserved regions are owned by devices and do not contain data useful for kernel crash analysis, so excluding them by default is the right behaviour. Reusable CMA regions are different: pages in a CMA region are handed back to the buddy allocator and may contain key data for crash analysis, so set dumpable to true in rmem_cma_setup(). 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> Link: https://lore.kernel.org/all/20260506144542.GA2072596-robh@kernel.org/ Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
/memreserve/ is used by firmware or bootloaders, such regions hold no useful data for crash analysis, they should be excluded from the kdump vmcore, so save /memreserve/ entries into the reserved_mem array for later exclusion. If a /memreserve/ entry overlaps any dumpable reserved region, mark the whole memreserve entry dumpable as well. This may keep slightly more memory in vmcore than strictly necessary, but avoids splitting entries and never drops data that may be useful for crash analysis. 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 two helpers to exclude non-dumpable regions for arch-specific code. - of_reserved_mem_kdump_nr_ranges() returns the count of regions that are not dumpable. Each excluded region may split an existing crash_mem range into two, so callers use this to calculate crash_mem allocation size. - of_reserved_mem_kdump_exclude() walks reserved_mem[] and calls crash_exclude_mem_range() for every non-dumpable region. 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>
Reserved memory regions are excluded from vmcore by default unless marked dumpable. Honor the dumpable flag to filter out device firmware regions (e.g., GPU, DSP, modem) reserved via device tree, since they typically contain data not useful for kernel crash analysis and can significantly increase vmcore size. Use of_reserved_mem_kdump_exclude() to perform the exclusion, and pre-size the crash_mem array via of_reserved_mem_kdump_nr_ranges(). 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>
Apply the same non-dumpable reserved memory filtering to RISC-V kdump as was done for arm64. Use of_reserved_mem_kdump_exclude() to drop flagged regions from the elfcorehdr PT_LOAD segments, and of_reserved_mem_kdump_nr_ranges() to pre-size the crash_mem array. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…mcore Apply the same non-dumpable reserved memory filtering to LoongArch kdump as was done for arm64. Use of_reserved_mem_kdump_exclude() to drop flagged regions from the elfcorehdr PT_LOAD segments, and of_reserved_mem_kdump_nr_ranges() to pre-size the crash_mem array. Signed-off-by: Wandun Chen <chenwandun@lixiang.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()" |
|
Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n" |
|
Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n" |
|
Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n" |
|
Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n" |
|
Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n" |
|
Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n" |
|
Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n" |
|
Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
|
Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore" |
PR for series 1101350 applied to workflow__riscv__fixes
Name: kdump: reduce vmcore size and capture time
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1101350
Version: 3