2014-04-22 00:30:52

by Sebastian Capella

[permalink] [raw]
Subject: [PATCH v2] PM / Hibernate: no kernel_power_off when pm_power_off NULL

Reboot logic in kernel/reboot will avoid calling kernel_power_off
when pm_power_off is null, and instead uses kernel_halt. Change
hibernate's power_down to follow the behavior in the reboot call.

Calling the notifier twice (once for SYS_POWER_OFF and again for
SYS_HALT) causes a panic during hibernation on Kirkwood
Openblocks A6 board.

Signed-off-by: Sebastian Capella <[email protected]>
Reported-by: Ezequiel Garcia <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Russell King <[email protected]>
Cc: One Thousand Gnomes <[email protected]>

---
kernel/power/hibernate.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index f4f2073..7642932 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -595,7 +595,8 @@ static void power_down(void)
case HIBERNATION_PLATFORM:
hibernation_platform_enter();
case HIBERNATION_SHUTDOWN:
- kernel_power_off();
+ if (pm_power_off)
+ kernel_power_off();
break;
#ifdef CONFIG_SUSPEND
case HIBERNATION_SUSPEND:
@@ -623,7 +624,8 @@ static void power_down(void)
* corruption after resume.
*/
printk(KERN_CRIT "PM: Please power down manually\n");
- while(1);
+ while (1)
+ cpu_relax();
}

/**
--
1.7.9.5


2014-04-22 07:10:06

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH v2] PM / Hibernate: no kernel_power_off when pm_power_off NULL

On Mon 2014-04-21 17:30:46, Sebastian Capella wrote:
> Reboot logic in kernel/reboot will avoid calling kernel_power_off
> when pm_power_off is null, and instead uses kernel_halt. Change
> hibernate's power_down to follow the behavior in the reboot call.
>
> Calling the notifier twice (once for SYS_POWER_OFF and again for
> SYS_HALT) causes a panic during hibernation on Kirkwood
> Openblocks A6 board.
>
> Signed-off-by: Sebastian Capella <[email protected]>
> Reported-by: Ezequiel Garcia <[email protected]>
> Cc: Len Brown <[email protected]>

Reviewed-by: Pavel Machek <[email protected]>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

2014-04-30 23:05:13

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v2] PM / Hibernate: no kernel_power_off when pm_power_off NULL

On Tuesday, April 22, 2014 09:09:55 AM Pavel Machek wrote:
> On Mon 2014-04-21 17:30:46, Sebastian Capella wrote:
> > Reboot logic in kernel/reboot will avoid calling kernel_power_off
> > when pm_power_off is null, and instead uses kernel_halt. Change
> > hibernate's power_down to follow the behavior in the reboot call.
> >
> > Calling the notifier twice (once for SYS_POWER_OFF and again for
> > SYS_HALT) causes a panic during hibernation on Kirkwood
> > Openblocks A6 board.
> >
> > Signed-off-by: Sebastian Capella <[email protected]>
> > Reported-by: Ezequiel Garcia <[email protected]>
> > Cc: Len Brown <[email protected]>
>
> Reviewed-by: Pavel Machek <[email protected]>

Queued up for 3.16, thanks!

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.