Re: [PATCH][RESEND] Revert "PM: ACPI: reboot: Use S5 for reboot"

From: Rafael J. Wysocki
Date: Thu Mar 18 2021 - 12:00:46 EST


On 3/18/2021 6:42 AM, Kai-Heng Feng wrote:
On Thu, Mar 18, 2021 at 1:25 AM Josef Bacik <josef@xxxxxxxxxxxxxx> wrote:
[snipped]
"shutdown now" works fine with and without your patch. Thanks,
Rafael,
Please revert the patch while we are working on it.

Done, thanks!


Josef,
Can you please test the following patch:

diff --git a/kernel/reboot.c b/kernel/reboot.c
index eb1b15850761..263444a3fb38 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -233,6 +233,15 @@ void migrate_to_reboot_cpu(void)
set_cpus_allowed_ptr(current, cpumask_of(cpu));
}

+static void kernel_shutdown_prepare(enum system_states state)
+{
+ blocking_notifier_call_chain(&reboot_notifier_list,
+ (state == SYSTEM_HALT) ? SYS_HALT : SYS_POWER_OFF, NULL);
+ system_state = state;
+ usermodehelper_disable();
+ device_shutdown();
+}
+
/**
* kernel_restart - reboot the system
* @cmd: pointer to buffer containing command to execute for restart
@@ -243,7 +252,7 @@ void migrate_to_reboot_cpu(void)
*/
void kernel_restart(char *cmd)
{
- kernel_restart_prepare(cmd);
+ kernel_shutdown_prepare(SYSTEM_POWER_OFF);
if (pm_power_off_prepare)
pm_power_off_prepare();
migrate_to_reboot_cpu();
@@ -257,14 +266,6 @@ void kernel_restart(char *cmd)
}
EXPORT_SYMBOL_GPL(kernel_restart);

-static void kernel_shutdown_prepare(enum system_states state)
-{
- blocking_notifier_call_chain(&reboot_notifier_list,
- (state == SYSTEM_HALT) ? SYS_HALT : SYS_POWER_OFF, NULL);
- system_state = state;
- usermodehelper_disable();
- device_shutdown();
-}
/**
* kernel_halt - halt the system
*

Josef