[PATCH v4 00/10] kdump: reduce vmcore size and capture time
Wandun
chenwandun1 at gmail.com
Mon Jul 27 23:45:32 PDT 2026
On 7/24/26 07:41, Rob Herring wrote:
> On Tue, Jun 30, 2026 at 03:47:04PM +0800, Wandun Chen wrote:
>> From: Wandun Chen <chenwandun at lixiang.com>
>>
>> On SoCs that carve out large firmware-owned reserved memory (GPU
>> firmware, DSP, modem, camera ISP, NPU, ...), kdump currently dumps
>> those carveouts as part of system RAM even though their contents are
>> firmware state that is not useful for kernel crash analysis.
>
> What about reserved regions on ACPI based systems?
ACPI based systems already filter out these reserved regions from vmcore.
In the EFI memory map, firmware carveouts are reported with the type
EFI_RESERVED_TYPE. This type of memory gets the nomap flag set in
memblock.memory (is_usable_memory() returns false in reserve_regions()
and mark these regions with nomap flag), during prepare_elf_headers(),
for_each_mem_range() filters out these nomap regions. Therefore, the
memory reserved on ACPI based systems will not be dumped into the vmcore.
>
>> This series introduces an opt-in 'dumpable' flag [1] on struct
>> reserved_mem and uses it to filter the elfcorehdr PT_LOAD ranges on
>> DT-based architectures (arm64, riscv, loongarch). By default reserved
>> regions are treated as non-dumpable; CMA regions are explicitly opted
>> in because their pages are returned to the buddy allocator and may
>> carry key crash-analysis data.
>
> I never like seeing the same change being made to each architecture.
> That's generally a sign of restructuring needed. loongarch and arm64
> prepare_elf_headers() look about the same. riscv version uses
> walk_system_ram_res() for some reason.
>
> Perhaps the dumpable flag belongs in memblock instead? Then at least we
> wouldn't need more DT APIs exposed to the arch code, and the code stays
> independent of the firmware API.
Agreed on both points. Adding the flag to memblock can indeed eliminate
the duplicated code in prepare_elf_headers, and avoid expose APIs to the
arch code.
I will add a dumpability marker to memblock for future extensibility
and to avoid duplicating the same code across different architectures.
I'm inclined to add a nodump flag, similar to nomap, by default all memory
is dumpable, and only the small fraction of memory that carries this flag
would be excluded from the vmcore, What do you think about this approach?
walk_system_ram_res() in riscv could be reworked into the same form as in
the arm64/loongarch architectures, will do in next version.
>
> I'd really like Marek's review on the reserved memory code changes.
Marek, could you take a look when you have a chance about the reserved
memory code changes, I'm happy to respin and address any feedback.
>
> Rob
Best regards,
Wandun
More information about the linux-riscv
mailing list