kdumpで利用するcrashkernelパラメータに渡せる値はfedora系カーネルとupstreamカーネルの微妙な差があるので自分でビルドしたカーネルを使う場合は気をつけろという自分へのメモです。
kdumpをfedora・rhelなどでdumpを利用する場合、crashkernelに渡す値にautoが利用できます。rhel8のドキュメント(How should the crashkernel parameter be configured for using kdump on Red Hat Enterprise Linux 8 ? - Red Hat Customer Portal)だと通常はautoを指定するのを勧めてますね。autoを指定するとcrashkernelに指定するメモリ量をよしなに設定しれくれます。それってどこでやってんの?ということですが、fedoraの場合は0001-kdump-add-support-for-crashkernel-auto.patchが処理してます。このパッチの中の↓の部分がautoを指定された場合の処理です。
diff --git a/kernel/crash_core.c b/kernel/crash_core.c index d631d22089ba..c252221b2f4b 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -258,6 +258,20 @@ static int __init __parse_crashkernel(char *cmdline, if (suffix) return parse_crashkernel_suffix(ck_cmdline, crash_size, suffix); + + if (strncmp(ck_cmdline, "auto", 4) == 0) { +#ifdef CONFIG_X86_64 + ck_cmdline = "1G-64G:160M,64G-1T:256M,1T-:512M"; +#elif defined(CONFIG_S390) + ck_cmdline = "4G-64G:160M,64G-1T:256M,1T-:512M"; +#elif defined(CONFIG_ARM64) + ck_cmdline = "2G-:512M"; +#elif defined(CONFIG_PPC64) + ck_cmdline = "2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"; +#endif + pr_info("Using crashkernel=auto, the size choosed is a best effort estimation.\n"); + } + /* * if the commandline contains a ':', then that's the extended * syntax -- if not, it must be the classic syntax
見ての通りコマンドラインの内容を書き換えてるだけですね。設定内容はドキュメントにも追加されてます。
diff --git a/Documentation/admin-guide/kdump/kdump.rst b/Documentation/admin-guide/kdump/kdump.rst index 2da65fef2a1c..d53a524f80f0 100644 --- a/Documentation/admin-guide/kdump/kdump.rst +++ b/Documentation/admin-guide/kdump/kdump.rst @@ -285,6 +285,17 @@ This would mean: 2) if the RAM size is between 512M and 2G (exclusive), then reserve 64M 3) if the RAM size is larger than 2G, then reserve 128M +Or you can use crashkernel=auto if you have enough memory. The threshold +is 2G on x86_64, arm64, ppc64 and ppc64le. The threshold is 4G for s390x. +If your system memory is less than the threshold crashkernel=auto will not +reserve memory. + +The automatically reserved memory size varies based on architecture. +The size changes according to system memory size like below: + x86_64: 1G-64G:160M,64G-1T:256M,1T-:512M + s390x: 4G-64G:160M,64G-1T:256M,1T-:512M + arm64: 2G-:512M + ppc64: 2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G Boot into System Kernel
upstreamカーネルの場合はautoは当然解釈されないので適切にメモリ量を設定できません😨 ということで、利用したい機能がどこからきているか調べないとハマる場合があるということでした。