mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>, rafael.j.wysocki@intel.com
Cc: Josef Bacik <josef@toxicpanda.com>,
	Dmitry Osipenko <dmitry.osipenko@collabora.com>,
	Petr Mladek <pmladek@suse.com>,
	Luis Chamberlain <mcgrof@kernel.org>,
	tangmeng <tangmeng@uniontech.com>,
	YueHaibing <yuehaibing@huawei.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] PM: ACPI: reboot: Reinstate S5 for reboot
Date: Tue, 6 Sep 2022 23:07:35 +0300	[thread overview]
Message-ID: <526160bf-f0f8-a861-55d4-1ed5437c9009@gmail.com> (raw)
In-Reply-To: <20220906143108.1749183-1-kai.heng.feng@canonical.com>

06.09.2022 17:31, Kai-Heng Feng пишет:
> 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 <josef@toxicpanda.com>
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
> 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));
>  }
>  
> -/**
> - *	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_list);
>   */
>  static ATOMIC_NOTIFIER_HEAD(power_off_handler_list);
>  
> +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();

Looks like an abuse to me. Adding new SYS_OFF_MODE_RESTART_PREPARE and
updating acpi_sleep_init() to use it should be a better solution.

  parent reply	other threads:[~2022-09-06 20:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 14:31 Kai-Heng Feng
2022-09-06 18:27 ` Luis Chamberlain
2022-09-06 20:07 ` Dmitry Osipenko [this message]
2022-09-13  0:11   ` Kai-Heng Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=526160bf-f0f8-a861-55d4-1ed5437c9009@gmail.com \
    --to=digetx@gmail.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=josef@toxicpanda.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=pmladek@suse.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tangmeng@uniontech.com \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®