From nobody Mon Apr 6 14:11:48 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD638ECAAA1 for ; Tue, 6 Sep 2022 15:40:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232949AbiIFPkV (ORCPT ); Tue, 6 Sep 2022 11:40:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234163AbiIFPjq (ORCPT ); Tue, 6 Sep 2022 11:39:46 -0400 Received: from smtp-relay-canonical-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B1F893534 for ; Tue, 6 Sep 2022 07:50:03 -0700 (PDT) Received: from localhost.localdomain (unknown [10.101.196.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 27AEB4157F; Tue, 6 Sep 2022 14:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1662474717; bh=n9gK6v8a7GQ3TOMqWKjrtAvZjsIH1MMsyRbJOU4kJOc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=i8wUTA7/J1TExbccWiaIZUkbBhyzqPjCLucDuDxfKL7zuEn0EzPRReiNbnwNM1oiJ YCx2Ja/xXQW3691DrH+d+cu/n1LY1jubJxFWTEBiAUteS8+vXHxOMhisVzB8i2rkOR 1HcaGjgMDSRPqfVieu7L8TkzTAI9vMzHVGZcf6DYLjoLtmybQCqOBLVTBALy/iXvvH SMPflEbVhYbTsZcb2IUEhZ8nxGhvRWLDjRD47gFyk91BBoKXxSIZ6lWqXXNzN9kHvX DRhpSYy4xMkztcZvQKpOAJXahNVxEocNyFJTDWaUXhwzlX6ZnxTDDuOmBWqqHmWW2v VU3SqrueCadLA== From: Kai-Heng Feng To: rafael.j.wysocki@intel.com Cc: Kai-Heng Feng , Josef Bacik , Dmitry Osipenko , Petr Mladek , Luis Chamberlain , tangmeng , YueHaibing , linux-kernel@vger.kernel.org Subject: [PATCH v2] PM: ACPI: reboot: Reinstate S5 for reboot Date: Tue, 6 Sep 2022 22:31:07 +0800 Message-Id: <20220906143108.1749183-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Commit d60cd06331a3 ("PM: ACPI: reboot: Use S5 for reboot") caused Dell PowerEdge r440 hangs at boot. The issue is fixed by commit 2ca1c94ce0b6 ("tg3: Disable tg3 device on system reboot to avoid triggering AER"), so reinstate the patch again. Cc: Josef Bacik Signed-off-by: Kai-Heng Feng --- v2: - Use do_kernel_power_off_prepare() instead. kernel/reboot.c | 55 +++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/kernel/reboot.c b/kernel/reboot.c index 3c35445bf5ad3..39cbb45afc54a 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -243,28 +243,6 @@ void migrate_to_reboot_cpu(void) set_cpus_allowed_ptr(current, cpumask_of(cpu)); } =20 -/** - * kernel_restart - reboot the system - * @cmd: pointer to buffer containing command to execute for restart - * or %NULL - * - * Shutdown everything and perform a clean reboot. - * This is not safe to call in interrupt context. - */ -void kernel_restart(char *cmd) -{ - kernel_restart_prepare(cmd); - migrate_to_reboot_cpu(); - syscore_shutdown(); - if (!cmd) - pr_emerg("Restarting system\n"); - else - pr_emerg("Restarting system with command '%s'\n", cmd); - kmsg_dump(KMSG_DUMP_SHUTDOWN); - machine_restart(cmd); -} -EXPORT_SYMBOL_GPL(kernel_restart); - static void kernel_shutdown_prepare(enum system_states state) { blocking_notifier_call_chain(&reboot_notifier_list, @@ -301,6 +279,34 @@ static BLOCKING_NOTIFIER_HEAD(power_off_prep_handler_l= ist); */ static ATOMIC_NOTIFIER_HEAD(power_off_handler_list); =20 +static void do_kernel_power_off_prepare(void) +{ + blocking_notifier_call_chain(&power_off_prep_handler_list, 0, NULL); +} + +/** + * kernel_restart - reboot the system + * @cmd: pointer to buffer containing command to execute for restart + * or %NULL + * + * Shutdown everything and perform a clean reboot. + * This is not safe to call in interrupt context. + */ +void kernel_restart(char *cmd) +{ + kernel_restart_prepare(cmd); + do_kernel_power_off_prepare(); + migrate_to_reboot_cpu(); + syscore_shutdown(); + if (!cmd) + pr_emerg("Restarting system\n"); + else + pr_emerg("Restarting system with command '%s'\n", cmd); + kmsg_dump(KMSG_DUMP_SHUTDOWN); + machine_restart(cmd); +} +EXPORT_SYMBOL_GPL(kernel_restart); + static int sys_off_notify(struct notifier_block *nb, unsigned long mode, void *cmd) { @@ -606,11 +612,6 @@ static int legacy_pm_power_off(struct sys_off_data *da= ta) return NOTIFY_DONE; } =20 -static void do_kernel_power_off_prepare(void) -{ - blocking_notifier_call_chain(&power_off_prep_handler_list, 0, NULL); -} - /** * do_kernel_power_off - Execute kernel power-off handler call chain * --=20 2.36.1