lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 22 Mar 2018 10:23:02 +0800
From:   Baolin Wang <baolin.wang@...aro.org>
To:     Pavel Machek <pavel@....cz>
Cc:     rjw@...ysocki.net, Len Brown <lenb@...nel.org>,
        Andrey Smirnov <andrew.smirnov@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Mark Brown <broonie@...nel.org>, Arnd Bergmann <arnd@...db.de>,
        linux-acpi@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
        Linux PM list <linux-pm@...r.kernel.org>
Subject: Re: [PATCH 1/2] ACPI / PM: Use register_reboot_notifier() instead of pm_power_off_prepare

Hi Pavel,

On 21 March 2018 at 22:04, Pavel Machek <pavel@....cz> wrote:
> On Wed 2018-03-21 19:30:16, Baolin Wang wrote:
>> We can register one notifier through register_reboot_notifier() function to
>> prepare to power off the system, then we can remove the 'pm_power_off_prepare'
>> hook in following patch.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
>> ---
>> Note: Please help to review carefully, since I have no platform to test
>> this conversion.
>>
>> I saw there is another reboot notifier in this driver, I am not sure the
>> orders between them. I can change the priority of notifier to keep their
>> orders if it is necessary.
>
> I don't understand why this is good idea... and you should really test
> it. I'm sure you can find PC or notebook somewhere...

I want to test it, but I have no opensource board with x86
architecture. But I will try to find one or ask other guys to help to
test it. Thanks for your comments.

>>  drivers/acpi/sleep.c |   22 ++++++++++++++++------
>>  1 file changed, 16 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
>> index 46cde091..b3de894 100644
>> --- a/drivers/acpi/sleep.c
>> +++ b/drivers/acpi/sleep.c
>> @@ -1229,14 +1229,24 @@ static void acpi_sleep_hibernate_setup(void)
>>  static inline void acpi_sleep_hibernate_setup(void) {}
>>  #endif /* !CONFIG_HIBERNATION */
>>
>> -static void acpi_power_off_prepare(void)
>> +static int acpi_reboot_notify(struct notifier_block *this, unsigned long code,
>> +                           void *x)
>>  {
>> -     /* Prepare to power off the system */
>> -     acpi_sleep_prepare(ACPI_STATE_S5);
>> -     acpi_disable_all_gpes();
>> -     acpi_os_wait_events_complete();
>> +     if (code == SYSTEM_POWER_OFF) {
>> +             /* Prepare to power off the system */
>> +             acpi_sleep_prepare(ACPI_STATE_S5);
>> +             acpi_disable_all_gpes();
>> +             acpi_os_wait_events_complete();
>> +     }
>> +
>> +     return NOTIFY_DONE;
>>  }
>>
>> +static struct notifier_block acpi_reboot_notifier = {
>> +     .notifier_call  = acpi_reboot_notify,
>> +     .priority       = 0,
>> +};
>> +
>>  static void acpi_power_off(void)
>>  {
>>       /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
>> @@ -1261,7 +1271,7 @@ int __init acpi_sleep_init(void)
>>
>>       if (acpi_sleep_state_supported(ACPI_STATE_S5)) {
>>               sleep_states[ACPI_STATE_S5] = 1;
>> -             pm_power_off_prepare = acpi_power_off_prepare;
>> +             register_reboot_notifier(&acpi_reboot_notifier);
>>               pm_power_off = acpi_power_off;
>>       } else {
>>               acpi_no_s5 = true;
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html



-- 
Baolin.wang
Best Regards

Powered by blists - more mailing lists