Re: [PATCH v12 7/7] x86/crash: Add x86 crash hotplug support

From: Eric DeVolder
Date: Fri Oct 28 2022 - 17:24:33 EST




On 10/28/22 15:30, Borislav Petkov wrote:
On Fri, Oct 28, 2022 at 02:26:58PM -0500, Eric DeVolder wrote:
config CRASH_MAX_MEMORY_RANGES
depends on CRASH_DUMP && KEXEC_FILE && MEMORY_HOTPLUG
int
default 8192
help
For the kexec_file_load path, specify the maximum number of
memory regions, eg. as represented by the 'System RAM' entries
in /proc/iomem, that the elfcorehdr buffer/segment can accommodate.
This value is combined with NR_CPUS and multiplied by Elf64_Phdr
size to determine the final buffer size.

No, do this:

config CRASH_MEMORY_HOTPLUG_SUPPORT
depends on CRASH_DUMP && KEXEC_FILE && MEMORY_HOTPLUG
help
Help text explaining what this feature is

this thing will simply get enabled when the user enables MEMORY_HOTPLUG
and CRASH_DUMP.

and then you do in the code:

/*
* A comment explaining how the 8192 value has been selected.
*/
#define CRASH_MAX_MEMORY_RANGES 8192

Thx.


How is this comment?

/*
* For the kexec_file_load() syscall path, specify the maximum number of
* memory regions that the elfcorehdr buffer/segment can accommodate.
* These regions are obtained via walk_system_ram_res(); eg. the
* 'System RAM' entries in /proc/iomem.
* This value is combined with NR_CPUS and multiplied by sizeof(Elf64_Phdr)
* to determine the final elfcorehdr memory buffer/segment size.
* The value 8192, for example, covers a (sparsely populated) 1TiB system
* consisting of 128MiB memblock size, while resulting in an elfcorehdr
* memory buffer/segment size under 1MiB.
*/
#define CRASH_MAX_MEMORY_RANGES 8192