From nobody Sat Feb 17 15:28:01 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 4TcXk94N4wz5BHlW; Sat, 17 Feb 2024 15:28:01 +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 4TcXk93c5sz4fcx; Sat, 17 Feb 2024 15:28:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708183681; 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=M8Az3tMV/BpUU7R/79Qf+eEt/pdEbadS9r7dNxvWwyg=; b=W8BLqiaUe49DS73QgJ79xk//CzrlOu77WsOZtBsQNFPxbCaIYQOMu2nIzgNszQYZ6/FoBt wC56N0w7q6OchTAXnyfILgZIQHtTsDckOrCI6Pae1ZfTSKmrzpNGcObs+e8Fw1ycJZpHbs s93z+wNs4Zlzys8dZHGstU64ttgBpz/UDcMlxrMnvfiCRnEFJkPCAlvajlNv3Bhk1h918I vowZhXeP9PsSAx6YCwlOdxFlWaKdk8l9K6CB/Q3NtI7ESQOD/OnlzJheJURQc6e84+3O4G eXwzdEEYxmmRzIZHoeS+iQcWaCvw3iiSb/mynKSoFBSB3WWcfVrnXwP/xVNQEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708183681; 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=M8Az3tMV/BpUU7R/79Qf+eEt/pdEbadS9r7dNxvWwyg=; b=opz3BzRDmzGF16ysTJQmYE/4wjCg8INBDl5iLfL+PRlPU1bbOG11MIFPEuPy8Oeqnht27W WZ0YO9tRZwT/rpHCKkS/M1drdR6GXXAnvKTMWBQSxZloeQTbGKvckUoU34xbe7C4Fg9xAR vP2GK/5yd6LvLSV/tR33Zj0OC4RoOuE+ZbFlNxVEFne7ukQaFoNL1JWewgNtrimMDpJk40 D10YcAw0X89ZZAZVqjChKSRvEIvcUzhpNM3FvaxtdDHuFH5+50WJXLQWkvXTSw/kDzRFZC uJqECjkwrGZzQkwfFdBjxtkD8Ak2RD1QhVMUnFVqaxpcbwmMA6rCAwBDIEf3WA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708183681; a=rsa-sha256; cv=none; b=DDnTPODBzzSSUmXGkalxEjKLhLIU5YH8Jm+2n4w5fDUEpPeI5Atq70AavDJWmssZbbKVoa z8TeiyuwhQ0gP0rV63u/sIiPUyx46vO0Mt2VWnu2iys5oUMn8NqGcO6VH+oLYDFA3/1X9U Xdz1kVS6xaoFO/ZGByBK1+ENuFIHgbmSpY8ZrOx6Eg3f052HHlp9fvdf1U5WaAShfwA8Mr adPYs80BXKKNJ7c5vX9ghQ56cmIgjJzVan+M6aEXZf+YiNq11MlJoB8xbe+Thcnld3orOk B3Sqh0eMJ14YofxVYn2P7y3kTf/IeN/7Z0S4TfwItOoB5n/YE0Uso85zY6ArPg== 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 4TcXk92YV9z1ClH; Sat, 17 Feb 2024 15:28:01 +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 41HFS1Gm098044; Sat, 17 Feb 2024 15:28:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41HFS1rx098041; Sat, 17 Feb 2024 15:28:01 GMT (envelope-from git) Date: Sat, 17 Feb 2024 15:28:01 GMT Message-Id: <202402171528.41HFS1rx098041@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: b46dedfa48ef - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: b46dedfa48efd5b448c33b5ea920df05241c04aa Auto-Submitted: auto-generated The branch stable/14 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=b46dedfa48efd5b448c33b5ea920df05241c04aa commit b46dedfa48efd5b448c33b5ea920df05241c04aa Author: Andriy Gapon AuthorDate: 2021-12-20 11:01:56 +0000 Commit: Andriy Gapon CommitDate: 2024-02-17 15:14:17 +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 9196c446ae80..7d1fc10afb9e 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -675,7 +675,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 ea86a7e24d06..149a9456173f 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -264,10 +264,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);