Re: [PATCH] mips: kdump: Crash kernel should be able to see old memories

From: Maciej W. Rozycki
Date: Mon Jun 07 2021 - 20:17:14 EST


On Tue, 20 Apr 2021, Youling Tang wrote:

> > Why depend on a config instead of a runtime variable?
> >
> If not depend on config, we can determine whether the command line contains
> the "elfcorehdr=" parameter, because the "mem=" and "elfcorhdr=" parameters
> are automatically added in kexec-tools. So if there is an "elfcorehdr="
> parameter in the command line, it means that the currently running kernel
> is a capture kernel, and the memblock_remove() operation is not called.
>
> The revised patch is as follows:
> if (usermem == 0) {
> usermem = 1;
> - memblock_remove(memblock_start_of_DRAM(),
> - memblock_end_of_DRAM() - memblock_start_of_DRAM());
> + if (!strstr(boot_command_line, "elfcorehdr")) {
> + memblock_remove(memblock_start_of_DRAM(),
> + memblock_end_of_DRAM() -
> memblock_start_of_DRAM());
> + }
>
> Do you think it is feasible?

This looks like a hack to me. How do other platforms solve it, e.g. x86?

Maciej