git: 854db1db3f81 - stable/13 - run acpi_shutdown_final later to give other handlers a chance
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Feb 2024 19:58:48 UTC
The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=854db1db3f81f5b840e7f238f627bc584224b311 commit 854db1db3f81f5b840e7f238f627bc584224b311 Author: Andriy Gapon <avg@FreeBSD.org> AuthorDate: 2021-12-20 11:01:56 +0000 Commit: Andriy Gapon <avg@FreeBSD.org> CommitDate: 2024-02-17 19:58:10 +0000 run acpi_shutdown_final later to give other handlers a chance For example, shutdown_panic wants to produce some output and maybe take some input before a system is actually reset. The change should only make difference for the case of system reset (reboot), poweroff and halt should not be affected. The change makes difference only if hw.acpi.handle_reboot is set. It used to default to zero until r213755 / ac731af5670c7. Also, run shutdown_halt even later, after acpi_shutdown_final. The reason for that is that poweroff is requested by RB_POWEROFF | RB_HALT combination of flags. In my opinion, that command is a bit bipolar, but since we've been doing that forever, then so be it. Because of that flag combination, the order of shutdown_final handlers that check for either flag does matter. Some additional complexity comes from platform-specific shutdown_final handlers that aim to handle multiple reboot options at once. E.g., acpi_shutdown_final handles both poweroff and reboot / reset. As explained in 9cdf326b4f, such a handler must run after shutdown_panic to give it a chance. But as the change revealed, the handler must also run before shutdown_halt, so that the system can actually power off before entering the halt limbo. Previously, shutdown_panic and shutdown_halt had the same priority which appears to be incompatible with handlers that can do both poweroff and reset. The above also applies to power cycle handlers. (cherry picked from commit 9cdf326b4faef97f0d3314b5dd693308ac494d48) (cherry picked from commit e4ab361e53945a6c3e9d68c5e5ffc11de40a35f2) --- sys/dev/acpica/acpi.c | 2 +- sys/kern/kern_shutdown.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index fbb3c2bc7c1c..cd390ada512c 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -673,7 +673,7 @@ acpi_attach(device_t dev) /* Register our shutdown handler. */ EVENTHANDLER_REGISTER(shutdown_final, acpi_shutdown_final, sc, - SHUTDOWN_PRI_LAST); + SHUTDOWN_PRI_LAST + 150); /* * Register our acpi event handlers. diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 4e582d8c8bfa..4e168df25301 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -259,10 +259,10 @@ shutdown_conf(void *unused) EVENTHANDLER_REGISTER(shutdown_final, poweroff_wait, NULL, SHUTDOWN_PRI_FIRST); - EVENTHANDLER_REGISTER(shutdown_final, shutdown_halt, NULL, - SHUTDOWN_PRI_LAST + 100); EVENTHANDLER_REGISTER(shutdown_final, shutdown_panic, NULL, SHUTDOWN_PRI_LAST + 100); + EVENTHANDLER_REGISTER(shutdown_final, shutdown_halt, NULL, + SHUTDOWN_PRI_LAST + 200); } SYSINIT(shutdown_conf, SI_SUB_INTRINSIC, SI_ORDER_ANY, shutdown_conf, NULL);