Skip to contentSkip to conversation

printing the final constructed kernel command line

RFC In review Eric DeVolder 3 participants 10 messages Dec 16, 2019 – Dec 23, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 printing the final constructed kernel command line

The --command-line, --append, and --reuse-cmdline options to kexec can be used in combination to craft a kernel command line for a kernel loaded via kexec. In addition, the kexec tool may also manipulate further the command line, eg. elfcorehdr addition.

To aid in debugging kdump/kexec related issues, it would be helpful for kexec to print the final constructed kernel command line argument.

For example, the following simple change (for i386/x86_64):

kexec/arch/i386/x86-linux-setup.c +2 -0
index 057ee14..6dc4adc 100644
@@ -57,6 +57,8 @@ void setup_linux_bootloader_parameters_high(
 	char *cmdline_ptr;
 	unsigned long initrd_base, initrd_addr_max;
 
+    printf("Final kernel cmdline: '%s'\n", cmdline);
+
 	/* Say I'm a boot loader */
 	real_mode->loader_type = LOADER_TYPE_KEXEC << 4;
 

results in the following on a systemd-based system (formatted to fit in 70 char lines):

% systemctl status -l kdump.service
● kdump.service - Crash recovery kernel arming
Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled;
vendor preset: enabled)
Active: active (exited) since Mon 2019-12-16 14:59:21 EST;
2min 53s ago
Process: 14058 ExecStop=/usr/bin/kdumpctl stop (code=exited,
status=0/SUCCESS)
Process: 14073 ExecStart=/usr/bin/kdumpctl start (code=exited,
status=0/SUCCESS)
Main PID: 14073 (code=exited, status=0/SUCCESS)

Dec 16 14:59:18 vm364 kdumpctl[14058]: Stopping kdump: [OK]
Dec 16 14:59:18 vm364 systemd[1]: Stopped Crash recovery kernel arming.
Dec 16 14:59:18 vm364 systemd[1]: Starting Crash recovery kernel arming...
Dec 16 14:59:21 vm364 kdumpctl[14073]: Final kernel cmdline: 'BOOT_IMAGE=
 /vmlinuz-4.14.35-1902.7.3.1.el7uek.x86_64 ro rhgb quiet LANG=en_US.UTF-8
 irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off
 udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug
 transparent_hugepage=never nokaslr novmcoredd disable_cpu_apicid=0
 elfcorehdr=901492K'
Dec 16 14:59:21 vm364 systemd[1]: Started Crash recovery kernel arming.
Dec 16 14:59:21 vm364 kdumpctl[14073]: kexec: loaded kdump kernel
Dec 16 14:59:21 vm364 kdumpctl[14073]: Starting kdump: [OK]

and the output is also available in /var/log/messages.

There might also be an opportunity to consolidate handling of the kernel command line, as most arch targets have the --command-line, --append, and --reuse-cmdline options, though each arch independently codes the support for these options.

Note: Simply printing the cmdline in scripts such as kdumpctl may not result in the same ordering, and will omit any addition made internally by kexec, such as the elfcorehdr.

I propose the addition of an option to kexec, --print-kcl (to mirror --print-ckr), that would control such printing, as well as the needed per arch conditional print statements similar to the above to print the final constructed kernel command line.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw
Quoted 62 lines · Eric DeVolder

The --command-line, --append, and --reuse-cmdline options to kexec can be used in combination to craft a kernel command line for a kernel loaded via kexec. In addition, the kexec tool may also manipulate further the command line, eg. elfcorehdr addition.

To aid in debugging kdump/kexec related issues, it would be helpful for kexec to print the final constructed kernel command line argument.

For example, the following simple change (for i386/x86_64):

kexec/arch/i386/x86-linux-setup.c +2 -0
index 057ee14..6dc4adc 100644
@@ -57,6 +57,8 @@ void setup_linux_bootloader_parameters_high(
 	char *cmdline_ptr;
 	unsigned long initrd_base, initrd_addr_max;
 
+    printf("Final kernel cmdline: '%s'\n", cmdline);
+
 	/* Say I'm a boot loader */
 	real_mode->loader_type = LOADER_TYPE_KEXEC << 4;
 

results in the following on a systemd-based system (formatted to fit in 70 char lines):

% systemctl status -l kdump.service
● kdump.service - Crash recovery kernel arming
Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled;
vendor preset: enabled)
Active: active (exited) since Mon 2019-12-16 14:59:21 EST;
2min 53s ago
Process: 14058 ExecStop=/usr/bin/kdumpctl stop (code=exited,
status=0/SUCCESS)
Process: 14073 ExecStart=/usr/bin/kdumpctl start (code=exited,
status=0/SUCCESS)
Main PID: 14073 (code=exited, status=0/SUCCESS)

Dec 16 14:59:18 vm364 kdumpctl[14058]: Stopping kdump: [OK]
Dec 16 14:59:18 vm364 systemd[1]: Stopped Crash recovery kernel arming.
Dec 16 14:59:18 vm364 systemd[1]: Starting Crash recovery kernel arming...
Dec 16 14:59:21 vm364 kdumpctl[14073]: Final kernel cmdline: 'BOOT_IMAGE=

/vmlinuz-4.14.35-1902.7.3.1.el7uek.x86_64 ro rhgb quiet LANG=en_US.UTF-8 irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never nokaslr novmcoredd disable_cpu_apicid=0 elfcorehdr=901492K'

Dec 16 14:59:21 vm364 systemd[1]: Started Crash recovery kernel arming.
Dec 16 14:59:21 vm364 kdumpctl[14073]: kexec: loaded kdump kernel
Dec 16 14:59:21 vm364 kdumpctl[14073]: Starting kdump: [OK]

and the output is also available in /var/log/messages.

There might also be an opportunity to consolidate handling of the kernel command line, as most arch targets have the --command-line, --append, and --reuse-cmdline options, though each arch independently codes the support for these options.

Quoted 8 lines

Note: Simply printing the cmdline in scripts such as kdumpctl may not result in the same ordering, and will omit any addition made internally by kexec, such as the elfcorehdr.

I propose the addition of an option to kexec, --print-kcl (to mirror --print-ckr), that would control such printing, as well as the needed per arch conditional print statements similar to the above to print the final constructed kernel command line.

Is this common code available in the Arm environment too ?

If not, could you make it so ?

Quoted 5 lines

_______________________________________________
kexec mailing list
[email protected]
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_kexec&d=DwIGaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=t2fPg9D87F7D8jm0_3CG9yoiIKdRg4qc_thBw4bzMhc&m=ZhhaZ27OjZpnpmVNP_2CgDhpnINXnkvt9PET0xntIN8&s=P1BRdVtUzkC5WtAGPyTBQreSI-4nsTEuMJ7-D-5WzvU&e=

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw

Hi John,
See below.
eric

Quoted 66 lines · John Donnelly
Quoted 66 lines · Eric DeVolder

The --command-line, --append, and --reuse-cmdline options to kexec can be used in combination to craft a kernel command line for a kernel loaded via kexec. In addition, the kexec tool may also manipulate further the command line, eg. elfcorehdr addition.

To aid in debugging kdump/kexec related issues, it would be helpful for kexec to print the final constructed kernel command line argument.

For example, the following simple change (for i386/x86_64):

kexec/arch/i386/x86-linux-setup.c +2 -0
index 057ee14..6dc4adc 100644
@@ -57,6 +57,8 @@ void setup_linux_bootloader_parameters_high(
 	char *cmdline_ptr;
 	unsigned long initrd_base, initrd_addr_max;
 
+    printf("Final kernel cmdline: '%s'\n", cmdline);
+
 	/* Say I'm a boot loader */
 	real_mode->loader_type = LOADER_TYPE_KEXEC << 4;
 

results in the following on a systemd-based system (formatted to fit in 70 char lines):

% systemctl status -l kdump.service
● kdump.service - Crash recovery kernel arming
Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled;
vendor preset: enabled)
Active: active (exited) since Mon 2019-12-16 14:59:21 EST;
2min 53s ago
Process: 14058 ExecStop=/usr/bin/kdumpctl stop (code=exited,
status=0/SUCCESS)
Process: 14073 ExecStart=/usr/bin/kdumpctl start (code=exited,
status=0/SUCCESS)
Main PID: 14073 (code=exited, status=0/SUCCESS)

Dec 16 14:59:18 vm364 kdumpctl[14058]: Stopping kdump: [OK]
Dec 16 14:59:18 vm364 systemd[1]: Stopped Crash recovery kernel arming.
Dec 16 14:59:18 vm364 systemd[1]: Starting Crash recovery kernel arming...
Dec 16 14:59:21 vm364 kdumpctl[14073]: Final kernel cmdline: 'BOOT_IMAGE=

/vmlinuz-4.14.35-1902.7.3.1.el7uek.x86_64 ro rhgb quiet LANG=en_US.UTF-8 irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never nokaslr novmcoredd disable_cpu_apicid=0 elfcorehdr=901492K'

Dec 16 14:59:21 vm364 systemd[1]: Started Crash recovery kernel arming.
Dec 16 14:59:21 vm364 kdumpctl[14073]: kexec: loaded kdump kernel
Dec 16 14:59:21 vm364 kdumpctl[14073]: Starting kdump: [OK]

and the output is also available in /var/log/messages.

There might also be an opportunity to consolidate handling of the kernel command line, as most arch targets have the --command-line, --append, and --reuse-cmdline options, though each arch independently codes the support for these options.

Note: Simply printing the cmdline in scripts such as kdumpctl may not result in the same ordering, and will omit any addition made internally by kexec, such as the elfcorehdr.

Quoted 6 lines
Quoted 4 lines

I propose the addition of an option to kexec, --print-kcl (to mirror --print-ckr), that would control such printing, as well as the needed per arch conditional print statements similar to the above to print the final constructed kernel command line.

Is this common code available in the Arm environment too ?

The option would be in common code.

Quoted 2 lines

If not, could you make it so ?

I'm not sure, yet, as to what degree of consolidation of the --command-line --append and --resuse-cmdline options into common code is desirable.

Quoted 10 lines
Quoted 9 lines

_______________________________________________
kexec mailing list
[email protected]
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_kexec&d=DwIGaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=t2fPg9D87F7D8jm0_3CG9yoiIKdRg4qc_thBw4bzMhc&m=ZhhaZ27OjZpnpmVNP_2CgDhpnINXnkvt9PET0xntIN8&s=P1BRdVtUzkC5WtAGPyTBQreSI-4nsTEuMJ7-D-5WzvU&e=

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw
In reply to Eric DeVolder

Hi Eric,

Quoted 4 lines · Eric DeVolder

The --command-line, --append, and --reuse-cmdline options to kexec can be used in combination to craft a kernel command line for a kernel loaded via kexec. In addition, the kexec tool may also manipulate further the command line, eg. elfcorehdr addition.

Thanks for proposing this change. I have some comments/queries (see below).

Quoted 10 lines

To aid in debugging kdump/kexec related issues, it would be helpful for kexec to print the final constructed kernel command line argument.

For example, the following simple change (for i386/x86_64):

kexec/arch/i386/x86-linux-setup.c +0 -0
index 057ee14..6dc4adc 100644

kexec/arch/i386/x86-linux-setup.c void setup_linux_bootloader_parameters_high( · line 61

Quoted 5 lines
kexec/arch/i386/x86-linux-setup.c +2 -0
@@ -57,6 +57,8 @@ void setup_linux_bootloader_parameters_high(
      char *cmdline_ptr;
      unsigned long initrd_base, initrd_addr_max;
 
+    printf("Final kernel cmdline: '%s'\n", cmdline);
+

If we want to add this for debugging purposes, its better to have dbgprintf() instead of printf() here. This will make sure that the debug message is printed only when '-d' flag is specified while calling kexec utility from command-line.

Quoted 31 lines
kexec/arch/i386/x86-linux-setup.c +0 -0
      /* Say I'm a boot loader */
      real_mode->loader_type = LOADER_TYPE_KEXEC << 4;
 

results in the following on a systemd-based system (formatted to fit in 70 char lines):

% systemctl status -l kdump.service
● kdump.service - Crash recovery kernel arming
Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled;
vendor preset: enabled)
Active: active (exited) since Mon 2019-12-16 14:59:21 EST;
2min 53s ago
Process: 14058 ExecStop=/usr/bin/kdumpctl stop (code=exited,
status=0/SUCCESS)
Process: 14073 ExecStart=/usr/bin/kdumpctl start (code=exited,
status=0/SUCCESS)
Main PID: 14073 (code=exited, status=0/SUCCESS)

Dec 16 14:59:18 vm364 kdumpctl[14058]: Stopping kdump: [OK]
Dec 16 14:59:18 vm364 systemd[1]: Stopped Crash recovery kernel arming.
Dec 16 14:59:18 vm364 systemd[1]: Starting Crash recovery kernel arming...
Dec 16 14:59:21 vm364 kdumpctl[14073]: Final kernel cmdline: 'BOOT_IMAGE=
  /vmlinuz-4.14.35-1902.7.3.1.el7uek.x86_64 ro rhgb quiet LANG=en_US.UTF-8
  irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off
  udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug
  transparent_hugepage=never nokaslr novmcoredd disable_cpu_apicid=0
  elfcorehdr=901492K'
Dec 16 14:59:21 vm364 systemd[1]: Started Crash recovery kernel arming.
Dec 16 14:59:21 vm364 kdumpctl[14073]: kexec: loaded kdump kernel
Dec 16 14:59:21 vm364 kdumpctl[14073]: Starting kdump: [OK]
Quoted 1 line

and the output is also available in /var/log/messages.

Since kdumpctl is a distribution specific script (Used by Fedora/RHEL), which invokes 'kexec' under the hood, we can discuss the features supported by 'kexec' rather than the distribution specific scripts (discussion regarding which are probably more suited to the Fedora kexec list: [email protected])

Quoted 4 lines

There might also be an opportunity to consolidate handling of the kernel command line, as most arch targets have the --command-line, --append, and --reuse-cmdline options, though each arch independently codes the support for these options.

This seems like a good idea, more on the same below ...

Quoted 8 lines

Note: Simply printing the cmdline in scripts such as kdumpctl may not result in the same ordering, and will omit any addition made internally by kexec, such as the elfcorehdr.

I propose the addition of an option to kexec, --print-kcl (to mirror --print-ckr), that would control such printing, as well as the needed per arch conditional print statements similar to the above to print the final constructed kernel command line.

... I am not sure I understand the above point. Looking at the latest kexec-tools man page (see: git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git), I couldn't find '--print-ckr' option:

--print-ckr-size: Print crash kernel region size, if available.

Can you please elaborate on '--print-ckr' and '--print-kcl' options more.

Thanks,
Bhupesh

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#4 lore raw

Thanks Bhupesh for the feedback, responses below!
eric

Quoted 23 lines · Bhupesh Sharma

Hi Eric,

Quoted 4 lines · Eric DeVolder

The --command-line, --append, and --reuse-cmdline options to kexec can be used in combination to craft a kernel command line for a kernel loaded via kexec. In addition, the kexec tool may also manipulate further the command line, eg.  elfcorehdr addition.

Thanks for proposing this change. I have some comments/queries (see below).

Quoted 13 lines

To aid in debugging kdump/kexec related issues, it would be helpful for kexec to print the final constructed kernel command line argument.

For example, the following simple change (for i386/x86_64):

kexec/arch/i386/x86-linux-setup.c +0 -0
index 057ee14..6dc4adc 100644
@@ -57,6 +57,8 @@ void setup_linux_bootloader_parameters_high(
       char *cmdline_ptr;
       unsigned long initrd_base, initrd_addr_max;
 
Quoted 4 lines

kexec/arch/i386/x86-linux-setup.c void setup_linux_bootloader_parameters_high( · line 61

Quoted 2 lines
kexec/arch/i386/x86-linux-setup.c +2 -0
+    printf("Final kernel cmdline: '%s'\n", cmdline);
+

If we want to add this for debugging purposes, its better to have dbgprintf() instead of printf() here. This will make sure that the debug message is printed only when '-d' flag is specified while calling kexec utility from command-line.

Yes! I used printf() merely to provide an example of what is possible.

Quoted 32 lines
Quoted 32 lines
kexec/arch/i386/x86-linux-setup.c +0 -0
       /* Say I'm a boot loader */
       real_mode->loader_type = LOADER_TYPE_KEXEC << 4;
 

results in the following on a systemd-based system (formatted to fit in 70 char lines):

% systemctl status -l kdump.service
● kdump.service - Crash recovery kernel arming
    Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled; vendor preset: enabled)
    Active: active (exited) since Mon 2019-12-16 14:59:21 EST; 2min 53s ago
   Process: 14058 ExecStop=/usr/bin/kdumpctl stop (code=exited, status=0/SUCCESS)
   Process: 14073 ExecStart=/usr/bin/kdumpctl start (code=exited, status=0/SUCCESS)
  Main PID: 14073 (code=exited, status=0/SUCCESS)

Dec 16 14:59:18 vm364 kdumpctl[14058]: Stopping kdump: [OK]
Dec 16 14:59:18 vm364 systemd[1]: Stopped Crash recovery kernel arming.
Dec 16 14:59:18 vm364 systemd[1]: Starting Crash recovery kernel arming...
Dec 16 14:59:21 vm364 kdumpctl[14073]: Final kernel cmdline: 'BOOT_IMAGE=

  /vmlinuz-4.14.35-1902.7.3.1.el7uek.x86_64 ro rhgb quiet LANG=en_US.UTF-8 irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never nokaslr novmcoredd disable_cpu_apicid=0 elfcorehdr=901492K'

Dec 16 14:59:21 vm364 systemd[1]: Started Crash recovery kernel arming.
Dec 16 14:59:21 vm364 kdumpctl[14073]: kexec: loaded kdump kernel
Dec 16 14:59:21 vm364 kdumpctl[14073]: Starting kdump: [OK]
Quoted 3 lines
Quoted 1 line

and the output is also available in /var/log/messages.

Since kdumpctl is a distribution specific script (Used by Fedora/RHEL), which invokes 'kexec' under the hood, we can discuss the features supported by 'kexec' rather than the distribution specific scripts (discussion regarding which are probably more suited to the Fedora kexec list: [email protected])

Agreed, this RFC is for a change to kexec, noting that wrapper scripts such as kdumpctl are insufficient to provide the functionality requested.

Quoted 17 lines
Quoted 5 lines

There might also be an opportunity to consolidate handling of the kernel command line, as most arch targets have the --command-line, --append, and --reuse-cmdline options, though each arch independently codes the support for these options.

This seems like a good idea, more on the same below ...

Quoted 8 lines

Note: Simply printing the cmdline in scripts such as kdumpctl may not result in the same ordering, and will omit any addition made internally by kexec, such as the elfcorehdr.

I propose the addition of an option to kexec, --print-kcl (to mirror --print-ckr), that would control such printing, as well as the needed per arch conditional print statements similar to the above to print the final constructed kernel command line.

Quoted 5 lines

... I am not sure I understand the above point. Looking at the latest kexec-tools man page (see: git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git), I couldn't find '--print-ckr' option:

--print-ckr-size: Print crash kernel region size, if available.

Can you please elaborate on '--print-ckr' and '--print-kcl' options more.

You proposed using dbgprintf() in conjunction with the -d option; and that makes great sense; I had not in my eagerness to produce this RFC.

Instead, I proposed another option --print-kcl (for print kernel command line) to conditionally print the information. I was using --print-ckr as an example of similar option used to print information (in this case, the crash kernel region). Other than a similar naming convention, there is no correlation between --print-ckr and --print-kcl, and indeed even --print-kcl might be un-necessary given dbgprintf().

Quoted 9 lines

Thanks,
Bhupesh

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#5 lore raw
Quoted 83 lines · Eric DeVolder

Thanks Bhupesh for the feedback, responses below!
eric

Quoted 20 lines · Bhupesh Sharma

Hi Eric,

Quoted 4 lines · Eric DeVolder

The --command-line, --append, and --reuse-cmdline options to kexec can be used in combination to craft a kernel command line for a kernel loaded via kexec. In addition, the kexec tool may also manipulate further the command line, eg. elfcorehdr addition.

Thanks for proposing this change. I have some comments/queries (see below).

Quoted 13 lines

To aid in debugging kdump/kexec related issues, it would be helpful for kexec to print the final constructed kernel command line argument.

For example, the following simple change (for i386/x86_64):

kexec/arch/i386/x86-linux-setup.c +0 -0
index 057ee14..6dc4adc 100644
@@ -57,6 +57,8 @@ void setup_linux_bootloader_parameters_high(
      char *cmdline_ptr;
      unsigned long initrd_base, initrd_addr_max;
 
Quoted 3 lines

kexec/arch/i386/x86-linux-setup.c void setup_linux_bootloader_parameters_high( · line 61

Quoted 2 lines
kexec/arch/i386/x86-linux-setup.c +2 -0
+    printf("Final kernel cmdline: '%s'\n", cmdline);
+

If we want to add this for debugging purposes, its better to have dbgprintf() instead of printf() here. This will make sure that the debug message is printed only when '-d' flag is specified while calling kexec utility from command-line.

Yes! I used printf() merely to provide an example of what is possible.

Quoted 31 lines
Quoted 31 lines
kexec/arch/i386/x86-linux-setup.c +0 -0
      /* Say I'm a boot loader */
      real_mode->loader_type = LOADER_TYPE_KEXEC << 4;
 

results in the following on a systemd-based system (formatted to fit in 70 char lines):

% systemctl status -l kdump.service
● kdump.service - Crash recovery kernel arming
Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled;
vendor preset: enabled)
Active: active (exited) since Mon 2019-12-16 14:59:21 EST;
2min 53s ago
Process: 14058 ExecStop=/usr/bin/kdumpctl stop (code=exited,
status=0/SUCCESS)
Process: 14073 ExecStart=/usr/bin/kdumpctl start (code=exited,
status=0/SUCCESS)
Main PID: 14073 (code=exited, status=0/SUCCESS)

Dec 16 14:59:18 vm364 kdumpctl[14058]: Stopping kdump: [OK]
Dec 16 14:59:18 vm364 systemd[1]: Stopped Crash recovery kernel arming.
Dec 16 14:59:18 vm364 systemd[1]: Starting Crash recovery kernel arming...
Dec 16 14:59:21 vm364 kdumpctl[14073]: Final kernel cmdline: 'BOOT_IMAGE=
  /vmlinuz-4.14.35-1902.7.3.1.el7uek.x86_64 ro rhgb quiet LANG=en_US.UTF-8
  irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off
  udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug
  transparent_hugepage=never nokaslr novmcoredd disable_cpu_apicid=0
  elfcorehdr=901492K'
Dec 16 14:59:21 vm364 systemd[1]: Started Crash recovery kernel arming.
Dec 16 14:59:21 vm364 kdumpctl[14073]: kexec: loaded kdump kernel
Dec 16 14:59:21 vm364 kdumpctl[14073]: Starting kdump: [OK]
Quoted 2 lines
Quoted 1 line

and the output is also available in /var/log/messages.

Since kdumpctl is a distribution specific script (Used by Fedora/RHEL), which invokes 'kexec' under the hood, we can discuss the features supported by 'kexec' rather than the distribution specific scripts (discussion regarding which are probably more suited to the Fedora kexec list: [email protected])

Agreed, this RFC is for a change to kexec, noting that wrapper scripts such as kdumpctl are insufficient to provide the functionality requested.

Quoted 13 lines
Quoted 4 lines

There might also be an opportunity to consolidate handling of the kernel command line, as most arch targets have the --command-line, --append, and --reuse-cmdline options, though each arch independently codes the support for these options.

This seems like a good idea, more on the same below ...

Quoted 8 lines

Note: Simply printing the cmdline in scripts such as kdumpctl may not result in the same ordering, and will omit any addition made internally by kexec, such as the elfcorehdr.

I propose the addition of an option to kexec, --print-kcl (to mirror --print-ckr), that would control such printing, as well as the needed per arch conditional print statements similar to the above to print the final constructed kernel command line.

Quoted 8 lines
Quoted 3 lines

... I am not sure I understand the above point. Looking at the latest kexec-tools man page (see: git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git), I couldn't find '--print-ckr' option:
--print-ckr-size: Print crash kernel region size, if available.
Can you please elaborate on '--print-ckr' and '--print-kcl' options more.

You proposed using dbgprintf() in conjunction with the -d option; and that makes great sense; I had not in my eagerness to produce this RFC.

Instead, I proposed another option --print-kcl (for print kernel command line) to conditionally print the information. I was using --print-ckr as an example of similar option used to print information (in this case, the crash kernel region). Other than a similar naming convention, there is no correlation between --print-ckr and --print-kcl, and indeed even --print-kcl might be un-necessary given dbgprintf().

I don’t see a need for -d ; or extra options ; I’d like to see makedumpfile be a little more verbose when it runs to show the configuration options because it is often ran in times of great need to isolate a system problem, and the more details available - the better.

Quoted 8 lines
Quoted 7 lines

Thanks,
Bhupesh
_______________________________________________
kexec mailing list
[email protected]
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_kexec&d=DwIGaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=t2fPg9D87F7D8jm0_3CG9yoiIKdRg4qc_thBw4bzMhc&m=7JBOzDV5ajrrDTc1AATk5hoYZXQ_iNQe6--eETKXU-0&s=L8MYALerLchCqH99TA1ds3Fw7b4bs1FEpHYSGBcqiMA&e=

Quoted 4 lines

_______________________________________________
kexec mailing list
[email protected]
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_kexec&d=DwIGaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=t2fPg9D87F7D8jm0_3CG9yoiIKdRg4qc_thBw4bzMhc&m=7JBOzDV5ajrrDTc1AATk5hoYZXQ_iNQe6--eETKXU-0&s=L8MYALerLchCqH99TA1ds3Fw7b4bs1FEpHYSGBcqiMA&e=

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#6 lore raw
Quoted 87 lines · John Donnelly
Quoted 87 lines · Eric DeVolder

Thanks Bhupesh for the feedback, responses below!
eric

Quoted 20 lines · Bhupesh Sharma

Hi Eric,

Quoted 4 lines · Eric DeVolder

The --command-line, --append, and --reuse-cmdline options to kexec can be used in combination to craft a kernel command line for a kernel loaded via kexec. In addition, the kexec tool may also manipulate further the command line, eg. elfcorehdr addition.

Thanks for proposing this change. I have some comments/queries (see below).

Quoted 13 lines

To aid in debugging kdump/kexec related issues, it would be helpful for kexec to print the final constructed kernel command line argument.

For example, the following simple change (for i386/x86_64):

kexec/arch/i386/x86-linux-setup.c +0 -0
index 057ee14..6dc4adc 100644
@@ -57,6 +57,8 @@ void setup_linux_bootloader_parameters_high(
       char *cmdline_ptr;
       unsigned long initrd_base, initrd_addr_max;
 
Quoted 3 lines

kexec/arch/i386/x86-linux-setup.c void setup_linux_bootloader_parameters_high( · line 61

Quoted 2 lines
kexec/arch/i386/x86-linux-setup.c +2 -0
+    printf("Final kernel cmdline: '%s'\n", cmdline);
+

If we want to add this for debugging purposes, its better to have dbgprintf() instead of printf() here. This will make sure that the debug message is printed only when '-d' flag is specified while calling kexec utility from command-line.

Yes! I used printf() merely to provide an example of what is possible.

Quoted 31 lines
Quoted 31 lines
kexec/arch/i386/x86-linux-setup.c +0 -0
       /* Say I'm a boot loader */
       real_mode->loader_type = LOADER_TYPE_KEXEC << 4;
 

results in the following on a systemd-based system (formatted to fit in 70 char lines):

% systemctl status -l kdump.service
● kdump.service - Crash recovery kernel arming
Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled;
vendor preset: enabled)
Active: active (exited) since Mon 2019-12-16 14:59:21 EST;
2min 53s ago
Process: 14058 ExecStop=/usr/bin/kdumpctl stop (code=exited,
status=0/SUCCESS)
Process: 14073 ExecStart=/usr/bin/kdumpctl start (code=exited,
status=0/SUCCESS)
Main PID: 14073 (code=exited, status=0/SUCCESS)

Dec 16 14:59:18 vm364 kdumpctl[14058]: Stopping kdump: [OK]
Dec 16 14:59:18 vm364 systemd[1]: Stopped Crash recovery kernel arming.
Dec 16 14:59:18 vm364 systemd[1]: Starting Crash recovery kernel arming...
Dec 16 14:59:21 vm364 kdumpctl[14073]: Final kernel cmdline: 'BOOT_IMAGE=
   /vmlinuz-4.14.35-1902.7.3.1.el7uek.x86_64 ro rhgb quiet LANG=en_US.UTF-8
   irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off
   udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug
   transparent_hugepage=never nokaslr novmcoredd disable_cpu_apicid=0
   elfcorehdr=901492K'
Dec 16 14:59:21 vm364 systemd[1]: Started Crash recovery kernel arming.
Dec 16 14:59:21 vm364 kdumpctl[14073]: kexec: loaded kdump kernel
Dec 16 14:59:21 vm364 kdumpctl[14073]: Starting kdump: [OK]
Quoted 2 lines
Quoted 1 line

and the output is also available in /var/log/messages.

Since kdumpctl is a distribution specific script (Used by Fedora/RHEL), which invokes 'kexec' under the hood, we can discuss the features supported by 'kexec' rather than the distribution specific scripts (discussion regarding which are probably more suited to the Fedora kexec list: [email protected])

Agreed, this RFC is for a change to kexec, noting that wrapper scripts such as kdumpctl are insufficient to provide the functionality requested.

Quoted 16 lines
Quoted 4 lines

There might also be an opportunity to consolidate handling of the kernel command line, as most arch targets have the --command-line, --append, and --reuse-cmdline options, though each arch independently codes the support for these options.

This seems like a good idea, more on the same below ...

Quoted 8 lines

Note: Simply printing the cmdline in scripts such as kdumpctl may not result in the same ordering, and will omit any addition made internally by kexec, such as the elfcorehdr.

I propose the addition of an option to kexec, --print-kcl (to mirror --print-ckr), that would control such printing, as well as the needed per arch conditional print statements similar to the above to print the final constructed kernel command line.

... I am not sure I understand the above point. Looking at the latest kexec-tools man page (see: git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git), I couldn't find '--print-ckr' option:
--print-ckr-size: Print crash kernel region size, if available.
Can you please elaborate on '--print-ckr' and '--print-kcl' options more.

Quoted 7 lines
Quoted 4 lines

You proposed using dbgprintf() in conjunction with the -d option; and that makes great sense; I had not in my eagerness to produce this RFC.

Instead, I proposed another option --print-kcl (for print kernel command line) to conditionally print the information. I was using --print-ckr as an example of similar option used to print information (in this case, the crash kernel region). Other than a similar naming convention, there is no correlation between --print-ckr and --print-kcl, and indeed even --print-kcl might be un-necessary given dbgprintf().

I don’t see a need for -d ; or extra options ; I’d like to see makedumpfile be a little more verbose when it runs to show the configuration options because it is often ran in times of great need to isolate a system problem, and the more details available - the better.

The '-d' option already exits for kexec-tools, so we don't need to make any additional effort. makedumpfile is different from kexec-tools, but it also has a '-d' option for enabling debug prints, so just make sure your calling script for makedumpfile/kexec invokes them with '-d' option.

Thanks,
Bhupesh

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#7 lore raw
In reply to Eric DeVolder

Hi Eric,

Quoted 27 lines · Eric DeVolder

Thanks Bhupesh for the feedback, responses below!
eric

Quoted 23 lines · Bhupesh Sharma

Hi Eric,

Quoted 4 lines · Eric DeVolder

The --command-line, --append, and --reuse-cmdline options to kexec can be used in combination to craft a kernel command line for a kernel loaded via kexec. In addition, the kexec tool may also manipulate further the command line, eg. elfcorehdr addition.

Thanks for proposing this change. I have some comments/queries (see below).

Quoted 13 lines

To aid in debugging kdump/kexec related issues, it would be helpful for kexec to print the final constructed kernel command line argument.

For example, the following simple change (for i386/x86_64):

kexec/arch/i386/x86-linux-setup.c +0 -0
index 057ee14..6dc4adc 100644
@@ -57,6 +57,8 @@ void setup_linux_bootloader_parameters_high(
      char *cmdline_ptr;
      unsigned long initrd_base, initrd_addr_max;
 
Quoted 6 lines
Quoted 4 lines

kexec/arch/i386/x86-linux-setup.c void setup_linux_bootloader_parameters_high( · line 61

Quoted 2 lines
kexec/arch/i386/x86-linux-setup.c +2 -0
+    printf("Final kernel cmdline: '%s'\n", cmdline);
+

If we want to add this for debugging purposes, its better to have dbgprintf() instead of printf() here. This will make sure that the debug message is printed only when '-d' flag is specified while calling kexec utility from command-line.

Yes! I used printf() merely to provide an example of what is possible.

Ok.

Quoted 55 lines
Quoted 32 lines
Quoted 32 lines
kexec/arch/i386/x86-linux-setup.c +0 -0
      /* Say I'm a boot loader */
      real_mode->loader_type = LOADER_TYPE_KEXEC << 4;
 

results in the following on a systemd-based system (formatted to fit in 70 char lines):

% systemctl status -l kdump.service
● kdump.service - Crash recovery kernel arming
Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled;
vendor preset: enabled)
Active: active (exited) since Mon 2019-12-16 14:59:21 EST;
2min 53s ago
Process: 14058 ExecStop=/usr/bin/kdumpctl stop (code=exited,
status=0/SUCCESS)
Process: 14073 ExecStart=/usr/bin/kdumpctl start (code=exited,
status=0/SUCCESS)
Main PID: 14073 (code=exited, status=0/SUCCESS)

Dec 16 14:59:18 vm364 kdumpctl[14058]: Stopping kdump: [OK]
Dec 16 14:59:18 vm364 systemd[1]: Stopped Crash recovery kernel arming.
Dec 16 14:59:18 vm364 systemd[1]: Starting Crash recovery kernel arming...
Dec 16 14:59:21 vm364 kdumpctl[14073]: Final kernel cmdline: 'BOOT_IMAGE=
  /vmlinuz-4.14.35-1902.7.3.1.el7uek.x86_64 ro rhgb quiet 

LANG=en_US.UTF-8
irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never nokaslr novmcoredd disable_cpu_apicid=0 elfcorehdr=901492K'

Dec 16 14:59:21 vm364 systemd[1]: Started Crash recovery kernel arming.
Dec 16 14:59:21 vm364 kdumpctl[14073]: kexec: loaded kdump kernel
Dec 16 14:59:21 vm364 kdumpctl[14073]: Starting kdump: [OK]
Quoted 3 lines
Quoted 1 line

and the output is also available in /var/log/messages.

Since kdumpctl is a distribution specific script (Used by Fedora/RHEL), which invokes 'kexec' under the hood, we can discuss the features supported by 'kexec' rather than the distribution specific scripts (discussion regarding which are probably more suited to the Fedora kexec list: [email protected])

Agreed, this RFC is for a change to kexec, noting that wrapper scripts such as kdumpctl are insufficient to provide the functionality requested.

Quoted 17 lines
Quoted 5 lines

There might also be an opportunity to consolidate handling of the kernel command line, as most arch targets have the --command-line, --append, and --reuse-cmdline options, though each arch independently codes the support for these options.

This seems like a good idea, more on the same below ...

Quoted 8 lines

Note: Simply printing the cmdline in scripts such as kdumpctl may not result in the same ordering, and will omit any addition made internally by kexec, such as the elfcorehdr.

I propose the addition of an option to kexec, --print-kcl (to mirror --print-ckr), that would control such printing, as well as the needed per arch conditional print statements similar to the above to print the final constructed kernel command line.

Quoted 7 lines
Quoted 5 lines

... I am not sure I understand the above point. Looking at the latest kexec-tools man page (see: git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git), I couldn't find '--print-ckr' option:

--print-ckr-size: Print crash kernel region size, if available.

Can you please elaborate on '--print-ckr' and '--print-kcl' options more.

You proposed using dbgprintf() in conjunction with the -d option; and that makes great sense; I had not in my eagerness to produce this RFC.

Ok, no problem.

Quoted 2 lines

Instead, I proposed another option --print-kcl (for print kernel command line) to conditionally print the information. I was using --print-ckr as an example of similar option used to print information (in this case, the crash kernel region). Other than a similar naming convention, there is no correlation between --print-ckr and --print-kcl, and indeed even --print-kcl might be un-necessary given dbgprintf().

Sure, makes sense.
I think you can go ahead and post a formal patch with 'dbgprintf()' being used. Or if you want, I can try and propose a similar patch for upstream kexec-tools.

Please let me know.

Thanks,
Bhupesh

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#8 lore raw

Bhupesh,
Thank you. For the formal patch, would you be ok with a two phase approach, first where we add in the dbgprintf(), and followed later by a consolidation of the --command-line, --append, --reuse-cmdline option code? Thanks,
eric

Quoted 105 lines · Bhupesh Sharma

Hi Eric,

Quoted 27 lines · Eric DeVolder

Thanks Bhupesh for the feedback, responses below!
eric

Quoted 23 lines · Bhupesh Sharma

Hi Eric,

Quoted 4 lines · Eric DeVolder

The --command-line, --append, and --reuse-cmdline options to kexec can be used in combination to craft a kernel command line for a kernel loaded via kexec. In addition, the kexec tool may also manipulate further the command line, eg.  elfcorehdr addition.

Thanks for proposing this change. I have some comments/queries (see below).

Quoted 13 lines

To aid in debugging kdump/kexec related issues, it would be helpful for kexec to print the final constructed kernel command line argument.

For example, the following simple change (for i386/x86_64):

kexec/arch/i386/x86-linux-setup.c +0 -0
index 057ee14..6dc4adc 100644
@@ -57,6 +57,8 @@ void setup_linux_bootloader_parameters_high(
       char *cmdline_ptr;
       unsigned long initrd_base, initrd_addr_max;
 
Quoted 6 lines
Quoted 4 lines

kexec/arch/i386/x86-linux-setup.c void setup_linux_bootloader_parameters_high( · line 61

Quoted 2 lines
kexec/arch/i386/x86-linux-setup.c +2 -0
+    printf("Final kernel cmdline: '%s'\n", cmdline);
+

If we want to add this for debugging purposes, its better to have dbgprintf() instead of printf() here. This will make sure that the debug message is printed only when '-d' flag is specified while calling kexec utility from command-line.

Yes! I used printf() merely to provide an example of what is possible.

Ok.

Quoted 54 lines
Quoted 31 lines
Quoted 31 lines
kexec/arch/i386/x86-linux-setup.c +0 -0
       /* Say I'm a boot loader */
       real_mode->loader_type = LOADER_TYPE_KEXEC << 4;
 

results in the following on a systemd-based system (formatted to fit in 70 char lines):

% systemctl status -l kdump.service
● kdump.service - Crash recovery kernel arming
    Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled; vendor preset: enabled)
    Active: active (exited) since Mon 2019-12-16 14:59:21 EST; 2min 53s ago
   Process: 14058 ExecStop=/usr/bin/kdumpctl stop (code=exited, status=0/SUCCESS)
   Process: 14073 ExecStart=/usr/bin/kdumpctl start (code=exited, status=0/SUCCESS)
  Main PID: 14073 (code=exited, status=0/SUCCESS)

Dec 16 14:59:18 vm364 kdumpctl[14058]: Stopping kdump: [OK]
Dec 16 14:59:18 vm364 systemd[1]: Stopped Crash recovery kernel arming.
Dec 16 14:59:18 vm364 systemd[1]: Starting Crash recovery kernel arming...
Dec 16 14:59:21 vm364 kdumpctl[14073]: Final kernel cmdline: 'BOOT_IMAGE=

  /vmlinuz-4.14.35-1902.7.3.1.el7uek.x86_64 ro rhgb quiet LANG=en_US.UTF-8 irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never nokaslr novmcoredd disable_cpu_apicid=0 elfcorehdr=901492K'

Dec 16 14:59:21 vm364 systemd[1]: Started Crash recovery kernel arming.
Dec 16 14:59:21 vm364 kdumpctl[14073]: kexec: loaded kdump kernel
Dec 16 14:59:21 vm364 kdumpctl[14073]: Starting kdump: [OK]
Quoted 3 lines
Quoted 1 line

and the output is also available in /var/log/messages.

Since kdumpctl is a distribution specific script (Used by Fedora/RHEL), which invokes 'kexec' under the hood, we can discuss the features supported by 'kexec' rather than the distribution specific scripts (discussion regarding which are probably more suited to the Fedora kexec list: [email protected])

Agreed, this RFC is for a change to kexec, noting that wrapper scripts such as kdumpctl are insufficient to provide the functionality requested.

Quoted 17 lines
Quoted 5 lines

There might also be an opportunity to consolidate handling of the kernel command line, as most arch targets have the --command-line, --append, and --reuse-cmdline options, though each arch independently codes the support for these options.

This seems like a good idea, more on the same below ...

Quoted 8 lines

Note: Simply printing the cmdline in scripts such as kdumpctl may not result in the same ordering, and will omit any addition made internally by kexec, such as the elfcorehdr.

I propose the addition of an option to kexec, --print-kcl (to mirror --print-ckr), that would control such printing, as well as the needed per arch conditional print statements similar to the above to print the final constructed kernel command line.

Quoted 7 lines
Quoted 5 lines

... I am not sure I understand the above point. Looking at the latest kexec-tools man page (see: git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git), I couldn't find '--print-ckr' option:

--print-ckr-size: Print crash kernel region size, if available.

Can you please elaborate on '--print-ckr' and '--print-kcl' options more.

You proposed using dbgprintf() in conjunction with the -d option; and that makes great sense; I had not in my eagerness to produce this RFC.

Ok, no problem.

Quoted 1 line

Instead, I proposed another option --print-kcl (for print kernel command line) to conditionally print the information. I was using --print-ckr as an example of similar option used to print information (in this case, the crash kernel region). Other than a similar naming convention, there is no correlation between --print-ckr and --print-kcl, and indeed even --print-kcl might be un-necessary given dbgprintf().

Quoted 8 lines

Sure, makes sense.
I think you can go ahead and post a formal patch with 'dbgprintf()' being used. Or if you want, I can try and propose a similar patch for upstream kexec-tools.

Please let me know.

Thanks,
Bhupesh

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#9 lore raw
Quoted 4 lines · Eric DeVolder

Bhupesh,
Thank you. For the formal patch, would you be ok with a two phase approach, first where we add in the dbgprintf(),

Sure Eric, I think you can send the patch with the dbgprintf() right away. It seems a straight forward change and should be acceptable to other reviewers I believe.

Quoted 2 lines

and followed later by a consolidation of the --command-line, --append, --reuse-cmdline option code?

Actually, I did some work a few months ago (on the request of an arm32 kexec-tools user) on this consolidation, but I never got the time to complete the same.

I will try to find out some time over this week to consolidate these features and send an RFC patch. I will Cc you to the same. Hopefully that should do the trick.

Thanks,
Bhupesh

Quoted 123 lines · Bhupesh Sharma
Quoted 122 lines

Hi Eric,

Quoted 27 lines · Eric DeVolder

Thanks Bhupesh for the feedback, responses below!
eric

Quoted 23 lines · Bhupesh Sharma

Hi Eric,

Quoted 4 lines · Eric DeVolder

The --command-line, --append, and --reuse-cmdline options to kexec can be used in combination to craft a kernel command line for a kernel loaded via kexec. In addition, the kexec tool may also manipulate further the command line, eg. elfcorehdr addition.

Thanks for proposing this change. I have some comments/queries (see below).

Quoted 13 lines

To aid in debugging kdump/kexec related issues, it would be helpful for kexec to print the final constructed kernel command line argument.

For example, the following simple change (for i386/x86_64):

kexec/arch/i386/x86-linux-setup.c +0 -0
index 057ee14..6dc4adc 100644
@@ -57,6 +57,8 @@ void setup_linux_bootloader_parameters_high(
      char *cmdline_ptr;
      unsigned long initrd_base, initrd_addr_max;
 
Quoted 8 lines
Quoted 6 lines

kexec/arch/i386/x86-linux-setup.c void setup_linux_bootloader_parameters_high( · line 61

Quoted 2 lines
kexec/arch/i386/x86-linux-setup.c +2 -0
+    printf("Final kernel cmdline: '%s'\n", cmdline);
+

If we want to add this for debugging purposes, its better to have dbgprintf() instead of printf() here. This will make sure that the debug message is printed only when '-d' flag is specified while calling kexec utility from command-line.

Yes! I used printf() merely to provide an example of what is possible.

Ok.

Quoted 62 lines
Quoted 31 lines
Quoted 31 lines
kexec/arch/i386/x86-linux-setup.c +0 -0
      /* Say I'm a boot loader */
      real_mode->loader_type = LOADER_TYPE_KEXEC << 4;
 

results in the following on a systemd-based system (formatted to fit in 70 char lines):

% systemctl status -l kdump.service
● kdump.service - Crash recovery kernel arming
Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled;
vendor preset: enabled)
Active: active (exited) since Mon 2019-12-16 14:59:21 EST;
2min 53s ago
Process: 14058 ExecStop=/usr/bin/kdumpctl stop (code=exited,
status=0/SUCCESS)
Process: 14073 ExecStart=/usr/bin/kdumpctl start (code=exited,
status=0/SUCCESS)
Main PID: 14073 (code=exited, status=0/SUCCESS)

Dec 16 14:59:18 vm364 kdumpctl[14058]: Stopping kdump: [OK]
Dec 16 14:59:18 vm364 systemd[1]: Stopped Crash recovery kernel arming.
Dec 16 14:59:18 vm364 systemd[1]: Starting Crash recovery kernel arming...
Dec 16 14:59:21 vm364 kdumpctl[14073]: Final kernel cmdline: 'BOOT_IMAGE=
  /vmlinuz-4.14.35-1902.7.3.1.el7uek.x86_64 ro rhgb quiet LANG=en_US.UTF-8
  irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off
  udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug
  transparent_hugepage=never nokaslr novmcoredd disable_cpu_apicid=0
  elfcorehdr=901492K'
Dec 16 14:59:21 vm364 systemd[1]: Started Crash recovery kernel arming.
Dec 16 14:59:21 vm364 kdumpctl[14073]: kexec: loaded kdump kernel
Dec 16 14:59:21 vm364 kdumpctl[14073]: Starting kdump: [OK]
Quoted 6 lines
Quoted 1 line

and the output is also available in /var/log/messages.

Since kdumpctl is a distribution specific script (Used by Fedora/RHEL), which invokes 'kexec' under the hood, we can discuss the features supported by 'kexec' rather than the distribution specific scripts (discussion regarding which are probably more suited to the Fedora kexec list:
[email protected])

Agreed, this RFC is for a change to kexec, noting that wrapper scripts such as kdumpctl are insufficient to provide the functionality requested.

Quoted 21 lines
Quoted 5 lines

There might also be an opportunity to consolidate handling of the kernel command line, as most arch targets have the --command-line, --append, and --reuse-cmdline options, though each arch independently codes the support for these options.

This seems like a good idea, more on the same below ...

Quoted 8 lines

Note: Simply printing the cmdline in scripts such as kdumpctl may not result in the same ordering, and will omit any addition made internally by kexec, such as the elfcorehdr.

I propose the addition of an option to kexec, --print-kcl (to mirror --print-ckr), that would control such printing, as well as the needed per arch conditional print statements similar to the above to print the final constructed kernel command line.

... I am not sure I understand the above point. Looking at the latest kexec-tools man page (see:
git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git), I couldn't find '--print-ckr' option:

Quoted 6 lines
Quoted 3 lines

--print-ckr-size: Print crash kernel region size, if available.

Can you please elaborate on '--print-ckr' and '--print-kcl' options more.

You proposed using dbgprintf() in conjunction with the -d option; and that makes great sense; I had not in my eagerness to produce this RFC.

Ok, no problem.

Quoted 5 lines

Instead, I proposed another option --print-kcl (for print kernel command line) to conditionally print the information. I was using --print-ckr as an example of similar option used to print information (in this case, the crash kernel region). Other than a similar naming convention, there is no correlation between --print-ckr and --print-kcl, and indeed even --print-kcl might be un-necessary given dbgprintf().

Sure, makes sense.
I think you can go ahead and post a formal patch with 'dbgprintf()' being used. Or if you want, I can try and propose a similar patch for upstream kexec-tools.

Quoted 6 lines
Quoted 5 lines

Please let me know.

Thanks,
Bhupesh

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec