Skip to content

[PW_SID:1101350] kdump: reduce vmcore size and capture time#2021

Open
linux-riscv-bot wants to merge 11 commits into
workflow__riscv__fixesfrom
pw1101350
Open

[PW_SID:1101350] kdump: reduce vmcore size and capture time#2021
linux-riscv-bot wants to merge 11 commits into
workflow__riscv__fixesfrom
pw1101350

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

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

Wandun Chen added 11 commits May 27, 2026 07:04
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>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 114.48 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1116.56 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1638.50 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.75 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.62 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 77.78 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
kdoc
Desc: Detects for kdoc errors
Duration: 0.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3,01/11] of: reserved_mem: handle NULL name in of_reserved_mem_lookup()"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 114.85 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1145.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1696.05 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.90 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.85 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.61 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v3,02/11] kexec/crash: provide crash_exclude_mem_range() stub when CONFIG_CRASH_DUMP=n"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 76.38 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 76.88 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore"
kdoc
Desc: Detects for kdoc errors
Duration: 0.72 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 9: "[v3,09/11] arm64: kdump: exclude non-dumpable reserved memory regions from vmcore"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 115.12 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1122.44 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1642.60 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.13 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.62 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 76.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
kdoc
Desc: Detects for kdoc errors
Duration: 0.72 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 10: "[v3,10/11] riscv: kdump: exclude non-dumpable reserved memory regions from vmcore"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 116.69 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1016.76 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1370.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.46 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.86 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.62 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 77.60 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
kdoc
Desc: Detects for kdoc errors
Duration: 0.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
module-param
Desc: Detect module_param changes
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 11: "[v3,11/11] loongarch: kdump: exclude non-dumpable reserved memory regions from vmcore"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.27 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant