Re: [PATCH v3] reboot: allow to specify reboot mode via sysfs

From: Petr Mladek
Date: Tue Nov 10 2020 - 09:58:38 EST


On Mon 2020-11-09 17:45:38, Matteo Croce wrote:
> From: Matteo Croce <mcroce@xxxxxxxxxxxxx>
>
> The kernel cmdline reboot= option offers some sort of control
> on how the reboot is issued.
> Add handles in sysfs to allow setting these reboot options, so they
> can be changed when the system is booted, other than at boot time.
>
> The handlers are under <sysfs>/kernel/reboot, can be read to
> get the current configuration and written to alter it.
>
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-kernel-reboot
> @@ -0,0 +1,31 @@
> +What: /sys/kernel/reboot
> +Date: November 2020
> +KernelVersion: 5.11
> +Contact: Matteo Croce <mcroce@xxxxxxxxxxxxx>
> +Description: Interface to set the kernel reboot mode, similarly to
> + what can be done via the reboot= cmdline option.
> + (see Documentation/admin-guide/kernel-parameters.txt)
> +

s/reboot mode/reboot behavior/

The reboot mode is only one of the modified parameters.


> +What: /sys/kernel/reboot/mode
> +Date: November 2020
> +KernelVersion: 5.11
> +Contact: Matteo Croce <mcroce@xxxxxxxxxxxxx>
> +Description: Reboot mode. Valid values are: cold warm hard soft gpio
> +
> +What: /sys/kernel/reboot/type
> +Date: November 2020
> +KernelVersion: 5.11
> +Contact: Matteo Croce <mcroce@xxxxxxxxxxxxx>
> +Description: Reboot type. Valid values are: bios acpi kbd triple efi pci
> +
> +What: /sys/kernel/reboot/cpu
> +Date: November 2020
> +KernelVersion: 5.11
> +Contact: Matteo Croce <mcroce@xxxxxxxxxxxxx>
> +Description: CPU number to use to reboot.
> +
> +What: /sys/kernel/reboot/force
> +Date: November 2020
> +KernelVersion: 5.11
> +Contact: Matteo Croce <mcroce@xxxxxxxxxxxxx>
> +Description: Force an immediate reboot.

This makes me feel like that the kernel will reboot
immediately when you write "1". It would deserve a better
explanation that would make it clear, something like:

Description: Use forced reboot that does not contact the init system.


Otherwise, it looks good to me. With the two above updates:

Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>

Best Regards,
Petr