From nobody Sat Feb 17 19:58:48 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Tcfkc2nPPz544Gb; Sat, 17 Feb 2024 19:58:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Tcfkc1phFz4Mkt; Sat, 17 Feb 2024 19:58:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708199928; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VsmMwZHEhvotY2c/eWnv4omqrQq5RzvzO2DJmP5OOrw=; b=ic+Xc5XGa3h9GKcMyZE1IkXFbPWcouZmq1mlqTdmT9DczZMmLOEPVPrqe0C7dZQZ7vD1Q2 O2H1GIOgzI7+dcLQV5Yicn/whTlVe8wY47YbGa2xjC570fyXbZP8tFjf/G2Xw+Ln3XBONp apHg2NJg0urC/Vh9TwjlVlvXFeNSDn/rfIkGHvRLshp4bL1QgZ0r+x0MzJ7MAN4P4MqF4k 3s2hWKvtr4dIGiQ4MLa9fQG6IeHfSXNasJs0zYHSRHdMw9XSlpUuH315SF5I5u6bfDWmtR UtQxg2MIjZ+O0xX5bgiuFYWe+3Txlk8HfB1mCXYva0PVqVSKmYvvdZiFnT5lMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708199928; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VsmMwZHEhvotY2c/eWnv4omqrQq5RzvzO2DJmP5OOrw=; b=lzCtwwcfW1wulQvJqDpslkbN0D0FBb5ZM40Be9VkMmXzOiAPntxVAq6xRWf4MGAZ8lXQL4 QYK4MdCO4CrjRrTA2+xRlU1Q+y8syHajI1YPduSAQjum2dqdSdSeDjXEBllapfXKSacksl pImgTk1Ui+gLJQ0vnMdW3ZiBJJagq6J+tMb6Rl41xn0DQLmras3uiL2ZaOpXM03xNj40MZ 06rEKEYHhdvcMmEE4TnBrgqA3fLnX/X8dweKokOM+TohyxUWPXyrPfkaMpTJ6jnCSb/nZl CBdS+0COLvT8av70Ld/AZfXHezlHxgTra2EGT33MfRfyXa0AtDXieq9PHmWigg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708199928; a=rsa-sha256; cv=none; b=CBsJsKEo1v9h5DXGP4JsrqOfJTRbA7HaYUiSUGxMpTB/b4tiDxRp2JTRm3+IsWL0nlH/2m KB8XyxhFHW88OsZhjgfhMjKhBQDaHGGw1XGo2u7vO7275rnTil18DT7k3jgS1zsVTf7FNc dk9xUXeYVNKCbruSzv6yhtEbZpbdt1rN0VpbSZCC07JFzBBzdwJHXtfwbos97zupJScAht llQ8iBhbbu8dU9oUuPRV9+b/zD02oqqNGpfP/WOTUfq4YPln7YNZntcy7XgbVLQChafjdy c4RQngNpRT8JFZU5+WiTPcCKnvSWdBPJcbZoFrXrq65wTtLedZOvrqb3/MStvQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Tcfkc0sndzM5G; Sat, 17 Feb 2024 19:58:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41HJwmmM051442; Sat, 17 Feb 2024 19:58:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41HJwmGw051438; Sat, 17 Feb 2024 19:58:48 GMT (envelope-from git) Date: Sat, 17 Feb 2024 19:58:48 GMT Message-Id: <202402171958.41HJwmGw051438@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 854db1db3f81 - stable/13 - run acpi_shutdown_final later to give other handlers a chance List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 854db1db3f81f5b840e7f238f627bc584224b311 Auto-Submitted: auto-generated The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=854db1db3f81f5b840e7f238f627bc584224b311 commit 854db1db3f81f5b840e7f238f627bc584224b311 Author: Andriy Gapon AuthorDate: 2021-12-20 11:01:56 +0000 Commit: Andriy Gapon 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);