mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PM / Hibernate: remove duplicate disable_nonboot_cpus()
@ 2013-01-29 23:20 Stephen Warren
  2013-01-30 23:43 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Warren @ 2013-01-29 23:20 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown, Pavel Machek
  Cc: linux-pm, linux-kernel, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

Within hibernate.c, hibernation_platform_enter() is only called from
power_down(), which in turn is only called by hibernate() after having
called hibernation_snapshot(), which in turn calls create_image() which
in turn calls disable_nonboot_cpus().

Elsewhere, snapshot_ioctl() allows hibernation_snapshot() and
hibernation_platform_enter() to be invoked via separate IOCTLs, but I
assume the rule is that SNAPSHOT_CREATE_IMAGE must be executed before
IOCTL SNAPSHOT_POWER_OFF, and hence the same ordering applies.

This means that disable_nonboot_cpus() must have been called already
before hibernation_platform_enter() is entered, and hence the call there
is redundant, so remove it.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
Note: I have compile-tested this on x86-64, but have not attempted to test
it in any way; I'm proposing this patch following code inspection.
---
 kernel/power/hibernate.c |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index b26f5f1..4ddeacc 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -537,10 +537,6 @@ int hibernation_platform_enter(void)
 	if (error)
 		goto Platform_finish;
 
-	error = disable_nonboot_cpus();
-	if (error)
-		goto Platform_finish;
-
 	local_irq_disable();
 	syscore_suspend();
 	if (pm_wakeup_pending()) {
@@ -555,7 +551,6 @@ int hibernation_platform_enter(void)
  Power_up:
 	syscore_resume();
 	local_irq_enable();
-	enable_nonboot_cpus();
 
  Platform_finish:
 	hibernation_ops->finish();
-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] PM / Hibernate: remove duplicate disable_nonboot_cpus()
  2013-01-29 23:20 [PATCH] PM / Hibernate: remove duplicate disable_nonboot_cpus() Stephen Warren
@ 2013-01-30 23:43 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2013-01-30 23:43 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Len Brown, Pavel Machek, linux-pm, linux-kernel, Stephen Warren

On Tuesday, January 29, 2013 04:20:15 PM Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> Within hibernate.c, hibernation_platform_enter() is only called from
> power_down(), which in turn is only called by hibernate() after having
> called hibernation_snapshot(), which in turn calls create_image() which
> in turn calls disable_nonboot_cpus().
> 
> Elsewhere, snapshot_ioctl() allows hibernation_snapshot() and
> hibernation_platform_enter() to be invoked via separate IOCTLs, but I
> assume the rule is that SNAPSHOT_CREATE_IMAGE must be executed before
> IOCTL SNAPSHOT_POWER_OFF, and hence the same ordering applies.
> 
> This means that disable_nonboot_cpus() must have been called already
> before hibernation_platform_enter() is entered, and hence the call there
> is redundant, so remove it.

No, it isn't.  This is a different stage of hibernation and
enable_nonboot_cpus() is called before.

It works like this: First, before creating the image, the complete "freeze"
sequence is carried out which includes disable_nonboot_cpus().  Then, the
image is created and the complete "thaw" sequence is carried out which includes
enable_nonboot_cpus().  Next, the image is saved and finally the memory taken
up by it is freed and hibernation_platform_enter() is called.  Roughly.

Thanks,
Rafael


> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> Note: I have compile-tested this on x86-64, but have not attempted to test
> it in any way; I'm proposing this patch following code inspection.
> ---
>  kernel/power/hibernate.c |    5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index b26f5f1..4ddeacc 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -537,10 +537,6 @@ int hibernation_platform_enter(void)
>  	if (error)
>  		goto Platform_finish;
>  
> -	error = disable_nonboot_cpus();
> -	if (error)
> -		goto Platform_finish;
> -
>  	local_irq_disable();
>  	syscore_suspend();
>  	if (pm_wakeup_pending()) {
> @@ -555,7 +551,6 @@ int hibernation_platform_enter(void)
>   Power_up:
>  	syscore_resume();
>  	local_irq_enable();
> -	enable_nonboot_cpus();
>  
>   Platform_finish:
>  	hibernation_ops->finish();
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-30 23:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29 23:20 [PATCH] PM / Hibernate: remove duplicate disable_nonboot_cpus() Stephen Warren
2013-01-30 23:43 ` Rafael J. Wysocki

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®