[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 08/45] kernel: Add combined power-off+restart handler call chain API
- To: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
- From: Dmitry Osipenko <digetx@xxxxxxxxx>
- Date: Fri, 29 Oct 2021 00:58:32 +0300
- Cc: Thierry Reding <thierry.reding@xxxxxxxxx>, Jonathan Hunter <jonathanh@xxxxxxxxxx>, Lee Jones <lee.jones@xxxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Guenter Roeck <linux@xxxxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>, Ulf Hansson <ulf.hansson@xxxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>, Greg Ungerer <gerg@xxxxxxxxxxxxxx>, Joshua Thompson <funaho@xxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, Greentime Hu <green.hu@xxxxxxxxx>, Vincent Chen <deanbo422@xxxxxxxxx>, "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Paul Mackerras <paulus@xxxxxxxxx>, Paul Walmsley <paul.walmsley@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Albert Ou <aou@xxxxxxxxxxxxxxxxx>, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, Rich Felker <dalias@xxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, the arch/x86 maintainers <x86@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>, Santosh Shilimkar <ssantosh@xxxxxxxxxx>, Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>, Chen-Yu Tsai <wens@xxxxxxxx>, Jonathan Neuschäfer <j.neuschaefer@xxxxxxx>, Tony Lindgren <tony@xxxxxxxxxxx>, Liam Girdwood <lgirdwood@xxxxxxxxx>, Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>, Vladimir Zapolskiy <vz@xxxxxxxxx>, Avi Fishman <avifishman70@xxxxxxxxx>, Tomer Maimon <tmaimon77@xxxxxxxxx>, Tali Perry <tali.perry1@xxxxxxxxx>, Patrick Venture <venture@xxxxxxxxxx>, Nancy Yuen <yuenn@xxxxxxxxxx>, Benjamin Fair <benjaminfair@xxxxxxxxxx>, Pavel Machek <pavel@xxxxxx>, Linux ARM <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, linux-csky@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev <linuxppc-dev@xxxxxxxxxxxxxxxx>, linux-riscv@xxxxxxxxxxxxxxxxxxx, Linux-sh list <linux-sh@xxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, ACPI Devel Maling List <linux-acpi@xxxxxxxxxxxxxxx>, Linux OMAP Mailing List <linux-omap@xxxxxxxxxxxxxxx>, openbmc@xxxxxxxxxxxxxxxx, linux-tegra <linux-tegra@xxxxxxxxxxxxxxx>, Linux PM <linux-pm@xxxxxxxxxxxxxxx>
- Delivery-date: Thu, 28 Oct 2021 21:58:55 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
28.10.2021 12:59, Rafael J. Wysocki пишет:
>> +#define RESTART_PRIO_RESERVED 0
>> +#define RESTART_PRIO_DEFAULT 128
>> +#define RESTART_PRIO_HIGH 192
>>
>> enum reboot_mode {
>> REBOOT_UNDEFINED = -1,
>> @@ -49,6 +55,167 @@ int register_restart_handler(struct notifier_block *);
>> int unregister_restart_handler(struct notifier_block *);
>> void do_kernel_restart(char *cmd);
>>
>> +/*
>> + * Unified poweroff + restart API.
>> + */
>> +
>> +#define POWEROFF_PRIO_RESERVED 0
>> +#define POWEROFF_PRIO_PLATFORM 1
>> +#define POWEROFF_PRIO_DEFAULT 128
>> +#define POWEROFF_PRIO_HIGH 192
>> +#define POWEROFF_PRIO_FIRMWARE 224
> Also I'm wondering why these particular numbers were chosen, here and above?
These values are chosen based on priorities that drivers already use. I looked
thorough them all and ended with this scheme that fulfills the needs of the
current API users.
I'll add these comments in v3:
/*
* Standard restart priority levels. Intended to be set in the
* sys_off_handler.restart_priority field.
*
* Use `RESTART_PRIO_XXX +- prio` style for additional levels.
*
* RESTART_PRIO_RESERVED: Falls back to RESTART_PRIO_DEFAULT.
* Drivers may leave priority initialized
* to zero, to auto-set it to the default level.
*
* RESTART_PRIO_DEFAULT: Use this for generic handler.
*
* RESTART_PRIO_HIGH: Use this if you have multiple handlers and
* this handler has higher priority than the
* default handler.
*/
/*
* Standard power-off priority levels. Intended to be set in the
* sys_off_handler.power_off_priority field.
*
* Use `POWEROFF_PRIO_XXX +- prio` style for additional levels.
*
* POWEROFF_PRIO_RESERVED: Falls back to POWEROFF_PRIO_DEFAULT.
* Drivers may leave priority initialized
* to zero, to auto-set it to the default level.
*
* POWEROFF_PRIO_PLATFORM: Intended to be used by platform-level handler.
* Has lowest priority since device drivers are
* expected to take over platform handler which
* doesn't allow further callback chaining.
*
* POWEROFF_PRIO_DEFAULT: Use this for generic handler.
*
* POWEROFF_PRIO_HIGH: Use this if you have multiple handlers and
* this handler has higher priority than the
* default handler.
*
* POWEROFF_PRIO_FIRMWARE: Use this if handler uses firmware call.
* Has highest priority since firmware is expected
* to know best how to power-off hardware properly.
*/
|