Re: [PATCH] reboot: Fix variable assignments in type_store

From: Matteo Croce
Date: Thu Nov 12 2020 - 20:38:57 EST


On Fri, Nov 13, 2020 at 2:18 AM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, 13 Nov 2020 01:20:29 +0100 Matteo Croce <mcroce@xxxxxxxxxxxxxxxxxxx> wrote:
>
> > While writing the script I found that in the documentation I left for
> > 'type' the values from
> > Documentation/admin-guide/kernel-parameters.txt, which is 'pci' for
> > cf9_force reboot.
> > While at it, should we update the doc with the values 'cf9_force' and
> > 'cf9_safe', or rename to 'pci' and 'pci_safe' to be coherent with the
> > kernel cmdline?
>
> I looked at Documentation/admin-guide/kernel-parameters.txt's "reboot="
> section and decided that I don't understand your above words :( Can you
> please expand on all of this? Simple akpm-compatible words ;)
>

Heh sorry :)

I misread the code, I thought that BOOT_CF9_SAFE was user selectable
because of the enum value:

enum reboot_type {
...
BOOT_CF9_FORCE = 'p',
BOOT_CF9_SAFE = 'q',
};

But when parsing the cmdline, 'q' is simply ignored, so it's just an
internal flag.
It's used only by arch/x86/kernel/reboot.c in the loop which tries to
reboot in different modes until it succeeds.

The doc is right, never mind.

At this point, since 'pci' enables BOOT_CF9_FORCE type and
BOOT_CF9_SAFE is not user selectable, should I simply leave only
'pci'?
This way, we'll have the same set of options for both sysfs and kernel cmdline.

--
per aspera ad upstream