Skip to contentSkip to conversation

swsusp: Disable nonboot CPUs before entering platform suspend

PATCH In review Rafael J. Wysocki 6 participants 23 messages Mar 7, 2007 – Mar 9, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 swsusp: Disable nonboot CPUs before entering platform suspend

From: Rafael J. Wysocki <[email protected]>

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
kernel/power/disk.c +1 -0
Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;
kernel/power/user.c +1 -1
Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;
 
#1 lore raw
Quoted 29 lines · On Wed, 7 Mar 2007 20:44:11 +0100 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 9 lines
kernel/power/user.c +1 -1
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Is this considered 2.6.21 material? If so why?

Thanks.

#2 lore raw
Quoted 33 lines · Andrew Morton
Quoted 30 lines · On Wed, 7 Mar 2007 20:44:11 +0100 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c +0 -0
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
Quoted 10 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 8 lines
kernel/power/user.c +1 -1
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Is this considered 2.6.21 material? If so why?

Well, the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() triggers every time an SMP x86_64 box is suspended to disk using the platform mode (default), which is quite annoying IMHO and users think something wrong is going on. This will probably cause them to report the problem and I'd rather like to avoid handling these reports. ;-)

#3 lore raw

Hi!

Quoted 39 lines
Quoted 28 lines
Quoted 28 lines

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c +0 -0
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
Quoted 10 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 8 lines
kernel/power/user.c +1 -1
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Is this considered 2.6.21 material? If so why?

Quoted 5 lines

Well, the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() triggers every time an SMP x86_64 box is suspended to disk using the platform mode (default), which is quite annoying IMHO and users think something wrong is going on. This will probably cause them to report the problem and I'd rather like to avoid handling these reports. ;-)

I do not quite like the patch (explanation in separate mail). Can we remove the WARN_ON() ? ;-).
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw
Quoted 41 lines · Pavel Machek

Hi!

Quoted 39 lines
Quoted 38 lines
Quoted 27 lines

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 9 lines
kernel/power/user.c +1 -1
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Is this considered 2.6.21 material? If so why?

Quoted 8 lines
Quoted 5 lines

Well, the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() triggers every time an SMP x86_64 box is suspended to disk using the platform mode (default), which is quite annoying IMHO and users think something wrong is going on. This will probably cause them to report the problem and I'd rather like to avoid handling these reports. ;-)

I do not quite like the patch (explanation in separate mail). Can we remove the WARN_ON() ? ;-).

Yes, if you can tell me why it's there. :-)

Rafael

#5 lore raw
In reply to Rafael J. Wysocki
Quoted 45 lines · On Wed, 7 Mar 2007 23:14:29 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 33 lines · Andrew Morton
Quoted 30 lines · On Wed, 7 Mar 2007 20:44:11 +0100 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c +0 -0
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
Quoted 10 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 8 lines
kernel/power/user.c +1 -1
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Is this considered 2.6.21 material? If so why?

Quoted 5 lines

Well, the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() triggers every time an SMP x86_64 box is suspended to disk using the platform mode (default), which is quite annoying IMHO and users think something wrong is going on. This will probably cause them to report the problem and I'd rather like to avoid handling these reports. ;-)

Well sure - if patches were always error-free, we'd always apply them immediately.

The question is: is the risk of this patch breaking things exceeded by the benefit which you describe?

#6 lore raw
Quoted 54 lines · Andrew Morton
Quoted 45 lines · On Wed, 7 Mar 2007 23:14:29 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 33 lines · Andrew Morton
Quoted 30 lines · On Wed, 7 Mar 2007 20:44:11 +0100 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c +0 -0
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
Quoted 10 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 8 lines
kernel/power/user.c +1 -1
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Is this considered 2.6.21 material? If so why?

Quoted 5 lines

Well, the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() triggers every time an SMP x86_64 box is suspended to disk using the platform mode (default), which is quite annoying IMHO and users think something wrong is going on. This will probably cause them to report the problem and I'd rather like to avoid handling these reports. ;-)

Quoted 5 lines

Well sure - if patches were always error-free, we'd always apply them immediately.

The question is: is the risk of this patch breaking things exceeded by the benefit which you describe?

Well, it has survived some testing (http://lkml.org/lkml/2007/3/7/16). Also, before the code ordering in 2.6.21-rc* we had been running on one CPU here, so I think the risk is small.

We could remove the WARN_ON() as Pavel has just suggested, but first I'd like to know who put it there and why.

#7 lore raw
Quoted 12 lines · Rafael J. Wysocki
Quoted 11 lines
Quoted 5 lines

Well, the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() triggers every time an SMP x86_64 box is suspended to disk using the platform mode (default), which is quite annoying IMHO and users think something wrong is going on. This will probably cause them to report the problem and I'd rather like to avoid handling these reports. ;-)

Well sure - if patches were always error-free, we'd always apply them immediately.

The question is: is the risk of this patch breaking things exceeded by the benefit which you describe?

Quoted 6 lines

Well, it has survived some testing (http://lkml.org/lkml/2007/3/7/16). Also, before the code ordering in 2.6.21-rc* we had been running on one CPU here, so I think the risk is small.

We could remove the WARN_ON() as Pavel has just suggested, but first I'd like to know who put it there and why.

It was introduced as part of ..

commit 55b2355eefc2f160246226d4d69fed431173a4d5

Author: Shaohua Li <[email protected]>
Date:   Fri Jun 23 02:04:49 2006 -0700

[PATCH] don't use flush_tlb_all in suspend time

flush_tlb_all uses on_each_cpu, which will disable/enable interrupt. In suspend/resume time, this will make interrupt wrongly enabled.

Signature · 1 line
http://www.codemonkey.org.uk
#8 lore raw
Quoted 23 lines · Dave Jones
Quoted 12 lines · Rafael J. Wysocki
Quoted 11 lines
Quoted 5 lines

Well, the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() triggers every time an SMP x86_64 box is suspended to disk using the platform mode (default), which is quite annoying IMHO and users think something wrong is going on. This will probably cause them to report the problem and I'd rather like to avoid handling these reports. ;-)

Well sure - if patches were always error-free, we'd always apply them immediately.

The question is: is the risk of this patch breaking things exceeded by the benefit which you describe?

Quoted 6 lines

Well, it has survived some testing (http://lkml.org/lkml/2007/3/7/16). Also, before the code ordering in 2.6.21-rc* we had been running on one CPU here, so I think the risk is small.

We could remove the WARN_ON() as Pavel has just suggested, but first I'd like to know who put it there and why.

It was introduced as part of ..

Quoted 8 lines

commit 55b2355eefc2f160246226d4d69fed431173a4d5

Author: Shaohua Li <[email protected]>
Date:   Fri Jun 23 02:04:49 2006 -0700

[PATCH] don't use flush_tlb_all in suspend time

flush_tlb_all uses on_each_cpu, which will disable/enable interrupt. In suspend/resume time, this will make interrupt wrongly enabled.

Ah, thanks.

So the question is what can go wrong if we ignore the TLBs of the other CPUs that may be on-line when init_low_mapping() is executed.

Frankly, I don't know.

reviewer
#9 lore raw
In reply to Rafael J. Wysocki
Quoted 61 lines · Rafael J. Wysocki
Quoted 54 lines · Andrew Morton
Quoted 45 lines · On Wed, 7 Mar 2007 23:14:29 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 33 lines · Andrew Morton
Quoted 30 lines · On Wed, 7 Mar 2007 20:44:11 +0100 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c +0 -0
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
Quoted 10 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 8 lines
kernel/power/user.c +1 -1
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Is this considered 2.6.21 material? If so why?

Quoted 5 lines

Well, the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() triggers every time an SMP x86_64 box is suspended to disk using the platform mode (default), which is quite annoying IMHO and users think something wrong is going on. This will probably cause them to report the problem and I'd rather like to avoid handling these reports. ;-)

Quoted 5 lines

Well sure - if patches were always error-free, we'd always apply them immediately.

The question is: is the risk of this patch breaking things exceeded by the benefit which you describe?

Quoted 7 lines

Well, it has survived some testing (http://lkml.org/lkml/2007/3/7/16). Also, before the code ordering in 2.6.21-rc* we had been running on one CPU here, so I think the risk is small.

We could remove the WARN_ON() as Pavel has just suggested, but first I'd like to know who put it there and why.

Shaohua added it between 2.6.17 and 2.6.18
55b2355eefc2f160246226d4d69fed431173a4d5

-Len

#10 lore raw
Quoted 66 lines · Len Brown
Quoted 65 lines · Rafael J. Wysocki
Quoted 54 lines · Andrew Morton
Quoted 45 lines · On Wed, 7 Mar 2007 23:14:29 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 33 lines · Andrew Morton
Quoted 30 lines · On Wed, 7 Mar 2007 20:44:11 +0100 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c +0 -0
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
Quoted 10 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 8 lines
kernel/power/user.c +1 -1
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Is this considered 2.6.21 material? If so why?

Quoted 5 lines

Well, the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() triggers every time an SMP x86_64 box is suspended to disk using the platform mode (default), which is quite annoying IMHO and users think something wrong is going on. This will probably cause them to report the problem and I'd rather like to avoid handling these reports. ;-)

Quoted 5 lines

Well sure - if patches were always error-free, we'd always apply them immediately.

The question is: is the risk of this patch breaking things exceeded by the benefit which you describe?

Well, it has survived some testing (http://lkml.org/lkml/2007/3/7/16). Also, before the code ordering in 2.6.21-rc* we had been running on one CPU here, so I think the risk is small.

Quoted 6 lines
Quoted 3 lines

We could remove the WARN_ON() as Pavel has just suggested, but first I'd like to know who put it there and why.

Shaohua added it between 2.6.17 and 2.6.18
55b2355eefc2f160246226d4d69fed431173a4d5

Yes, DaveJ has already noticed that, but what it's there for?

Rafael

#11 lore raw
In reply to Rafael J. Wysocki

Hi!

Quoted 15 lines

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c static void power_down(suspend_disk_meth · line 67

Quoted 7 lines
kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

...so, if pm_ops is non-null, power_down does nonboot cpu disabling, otherwise we proceed with cpus enabled?

That looks ugly.

Is the warning bogus? Or maybe we should *always* disable nonboot cpus in powerdown path?

Quoted 5 lines

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 9 lines
kernel/power/user.c +1 -1
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Foe an userland application, disabling cpus during pmops_enter is at least surprising.......

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#12 lore raw
Quoted 28 lines · Pavel Machek

Hi!

Quoted 15 lines

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c static void power_down(suspend_disk_meth · line 67

Quoted 7 lines
kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

...so, if pm_ops is non-null, power_down does nonboot cpu disabling, otherwise we proceed with cpus enabled?

Quoted 3 lines

That looks ugly.

Is the warning bogus?

Well, maybe. I'm not sure.

Quoted 1 line

Or maybe we should *always* disable nonboot cpus in powerdown path?

I think we should do that.

Quoted 6 lines
Quoted 6 lines

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c +0 -0
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
Quoted 11 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 8 lines
kernel/power/user.c +1 -1
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Foe an userland application, disabling cpus during pmops_enter is at least surprising.......

Yes, but this is not a usual ioctl(). OTOH, we can call enable_nonboot_cpus() if pm_ops->enter(PM_SUSPEND_DISK) returns an error (otherwise it souldn't return at all, no?).

Rafael

#13 lore raw

Hi!

Quoted 18 lines
Quoted 18 lines

kernel/power/disk.c static void power_down(suspend_disk_meth · line 67

Quoted 12 lines

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

...so, if pm_ops is non-null, power_down does nonboot cpu disabling, otherwise we proceed with cpus enabled?

That looks ugly.

Quoted 7 lines
Quoted 1 line

Is the warning bogus?

Well, maybe. I'm not sure.

Quoted 1 line

Or maybe we should *always* disable nonboot cpus in powerdown path?

I think we should do that.

That would be acceptable.

Quoted 18 lines
Quoted 6 lines
Quoted 6 lines

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c +0 -0
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
Quoted 11 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 8 lines
kernel/power/user.c +1 -1
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Foe an userland application, disabling cpus during pmops_enter is at least surprising.......

Quoted 3 lines

Yes, but this is not a usual ioctl(). OTOH, we can call enable_nonboot_cpus() if pm_ops->enter(PM_SUSPEND_DISK) returns an error (otherwise it souldn't return at all, no?).

Ok.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#14 lore raw

Hi,

Quoted 48 lines · Pavel Machek

Hi!

Quoted 18 lines
Quoted 18 lines

kernel/power/disk.c static void power_down(suspend_disk_meth · line 67

Quoted 12 lines

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

...so, if pm_ops is non-null, power_down does nonboot cpu disabling, otherwise we proceed with cpus enabled?

That looks ugly.

Quoted 7 lines
Quoted 1 line

Is the warning bogus?

Well, maybe. I'm not sure.

Quoted 1 line

Or maybe we should *always* disable nonboot cpus in powerdown path?

I think we should do that.

That would be acceptable.

Quoted 18 lines
Quoted 17 lines
Quoted 5 lines

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 9 lines
kernel/power/user.c +1 -1
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Foe an userland application, disabling cpus during pmops_enter is at least surprising.......

Quoted 5 lines
Quoted 3 lines

Yes, but this is not a usual ioctl(). OTOH, we can call enable_nonboot_cpus() if pm_ops->enter(PM_SUSPEND_DISK) returns an error (otherwise it souldn't return at all, no?).

Ok.

Well, does the appended patch look better?

Rafael

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
kernel/power/disk.c +1 -0
Index: linux-2.6.21-rc3/kernel/power/disk.c
===================================================================
@@ -58,6 +58,7 @@ static inline int platform_prepare(void)
 
 static void power_down(suspend_disk_method_t mode)
 {
+	disable_nonboot_cpus();
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
kernel/power/user.c +2 -1
Index: linux-2.6.21-rc3/kernel/power/user.c
===================================================================
@@ -402,9 +402,10 @@ static int snapshot_ioctl(struct inode *
 
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
+				enable_nonboot_cpus();
 			}
 			break;
 
#15 lore raw

Hi!

Quoted 46 lines
Quoted 46 lines
Quoted 18 lines
Quoted 18 lines

kernel/power/disk.c static void power_down(suspend_disk_meth · line 67

Quoted 12 lines

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

...so, if pm_ops is non-null, power_down does nonboot cpu disabling, otherwise we proceed with cpus enabled?

That looks ugly.

Quoted 7 lines
Quoted 1 line

Is the warning bogus?

Well, maybe. I'm not sure.

Quoted 1 line

Or maybe we should *always* disable nonboot cpus in powerdown path?

I think we should do that.

That would be acceptable.

Quoted 18 lines
Quoted 17 lines
Quoted 5 lines

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 9 lines
kernel/power/user.c +1 -1
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Foe an userland application, disabling cpus during pmops_enter is at least surprising.......

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Yes, but this is not a usual ioctl(). OTOH, we can call enable_nonboot_cpus() if pm_ops->enter(PM_SUSPEND_DISK) returns an error (otherwise it souldn't return at all, no?).

Ok.

Well, does the appended patch look better?

Yes.

Quoted 22 lines
---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc3/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -58,6 +58,7 @@ static inline int platform_prepare(void)
 
 static void power_down(suspend_disk_method_t mode)
 {
+	disable_nonboot_cpus();
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {

Index: linux-2.6.21-rc3/kernel/power/user.c
===================================================================

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 408

Quoted 8 lines
kernel/power/user.c +2 -1
@@ -402,9 +402,10 @@ static int snapshot_ioctl(struct inode *
 
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
+				enable_nonboot_cpus();

Why did we discard return code in previous versions? Do we still want to do that?

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#16 lore raw
Quoted 81 lines · Pavel Machek

Hi!

Quoted 46 lines
Quoted 46 lines
Quoted 18 lines
Quoted 18 lines

kernel/power/disk.c static void power_down(suspend_disk_meth · line 67

Quoted 12 lines

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

...so, if pm_ops is non-null, power_down does nonboot cpu disabling, otherwise we proceed with cpus enabled?

That looks ugly.

Quoted 7 lines
Quoted 1 line

Is the warning bogus?

Well, maybe. I'm not sure.

Quoted 1 line

Or maybe we should *always* disable nonboot cpus in powerdown path?

I think we should do that.

That would be acceptable.

Quoted 18 lines
Quoted 17 lines
Quoted 5 lines

Index: linux-2.6.21-rc2-mm2/kernel/power/user.c
===================================================================

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 405

Quoted 9 lines
kernel/power/user.c +1 -1
@@ -398,9 +398,9 @@ static int snapshot_ioctl(struct inode *
 
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
 			}
 			break;

Foe an userland application, disabling cpus during pmops_enter is at least surprising.......

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Yes, but this is not a usual ioctl(). OTOH, we can call enable_nonboot_cpus() if pm_ops->enter(PM_SUSPEND_DISK) returns an error (otherwise it souldn't return at all, no?).

Ok.

Well, does the appended patch look better?

Yes.

Quoted 23 lines
---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc3/kernel/power/disk.c
===================================================================

kernel/power/disk.c +1 -0
@@ -58,6 +58,7 @@ static inline int platform_prepare(void)
 
 static void power_down(suspend_disk_method_t mode)
 {
+	disable_nonboot_cpus();
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {

Index: linux-2.6.21-rc3/kernel/power/user.c
===================================================================

kernel/power/user.c +0 -0
@@ -402,9 +402,10 @@ static int snapshot_ioctl(struct inode *
 
Quoted 10 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 408

Quoted 7 lines
kernel/power/user.c +2 -1
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
+				enable_nonboot_cpus();

Why did we discard return code in previous versions? Do we still want to do that?

I think it was a mistake.

Rafael

#17 lore raw

Hi!

Quoted 17 lines
Quoted 6 lines
Quoted 6 lines

Index: linux-2.6.21-rc3/kernel/power/user.c
===================================================================

kernel/power/user.c +0 -0
@@ -402,9 +402,10 @@ static int snapshot_ioctl(struct inode *
 
Quoted 10 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 408

Quoted 7 lines
kernel/power/user.c +2 -1
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
+				enable_nonboot_cpus();

Why did we discard return code in previous versions? Do we still want to do that?

Quoted 1 line

I think it was a mistake.

I took a look at git-annotate, and it is yours code, so I assume you are right. ACK, then.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#18 lore raw
Quoted 19 lines · Pavel Machek

Hi!

Quoted 17 lines
Quoted 16 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 408

Quoted 13 lines

Index: linux-2.6.21-rc3/kernel/power/user.c
===================================================================

kernel/power/user.c +2 -1
@@ -402,9 +402,10 @@ static int snapshot_ioctl(struct inode *
 
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
+				enable_nonboot_cpus();

Why did we discard return code in previous versions? Do we still want to do that?

Quoted 4 lines
Quoted 1 line

I think it was a mistake.

I took a look at git-annotate, and it is yours code, so I assume you are right. ACK, then.

Thanks!

BTW, what about the patch at http://lkml.org/lkml/2007/3/8/363?

Rafael

#19 lore raw
Quoted 20 lines · Rafael J. Wysocki
Quoted 19 lines · Pavel Machek

Hi!

Quoted 17 lines
Quoted 16 lines

kernel/power/user.c static int snapshot_ioctl(struct inode * · line 408

Quoted 13 lines

Index: linux-2.6.21-rc3/kernel/power/user.c
===================================================================

kernel/power/user.c +2 -1
@@ -402,9 +402,10 @@ static int snapshot_ioctl(struct inode *
 
 		case PMOPS_ENTER:
 			if (data->platform_suspend) {
+				disable_nonboot_cpus();
 				kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 				error = pm_ops->enter(PM_SUSPEND_DISK);
-				error = 0;
+				enable_nonboot_cpus();

Why did we discard return code in previous versions? Do we still want to do that?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I think it was a mistake.

I took a look at git-annotate, and it is yours code, so I assume you are right. ACK, then.

Thanks!

BTW, what about the patch at http://lkml.org/lkml/2007/3/8/363?

Seems obviously correct to me (ACK), but I did not have time to test it.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#20 lore raw
In reply to Pavel Machek
Quoted 28 lines · Pavel Machek

Hi!

Quoted 15 lines

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c static void power_down(suspend_disk_meth · line 67

Quoted 7 lines
kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

...so, if pm_ops is non-null, power_down does nonboot cpu disabling, otherwise we proceed with cpus enabled?

Quoted 4 lines

That looks ugly.

Is the warning bogus? Or maybe we should *always* disable nonboot cpus in powerdown path?

Is disable_nonboot_cpus() assuming that first_cpu(cpu_present_map) is the boot cpu? Just wondering why disable_nonboot_cpus() isn't using just any_online_cpu(cpu_online_map)...

#21 lore raw
Quoted 29 lines · Heiko Carstens
Quoted 28 lines · Pavel Machek

Hi!

Quoted 15 lines

Prevent the WARN_ON() in arch/x86_64/kernel/acpi/sleep.c:init_low_mapping() from triggering by disabling nonboot CPUs before we finally enter the platform suspend.

---
 kernel/power/disk.c |    1 +
 kernel/power/user.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.21-rc2-mm2/kernel/power/disk.c
===================================================================

kernel/power/disk.c static void power_down(suspend_disk_meth · line 67

Quoted 7 lines
kernel/power/disk.c +1 -0
@@ -61,6 +61,7 @@ static void power_down(suspend_disk_meth
 	switch(mode) {
 	case PM_DISK_PLATFORM:
 		if (pm_ops && pm_ops->enter) {
+			disable_nonboot_cpus();
 			kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 			pm_ops->enter(PM_SUSPEND_DISK);
 			break;

...so, if pm_ops is non-null, power_down does nonboot cpu disabling, otherwise we proceed with cpus enabled?

Quoted 8 lines
Quoted 4 lines

That looks ugly.

Is the warning bogus? Or maybe we should *always* disable nonboot cpus in powerdown path?

Is disable_nonboot_cpus() assuming that first_cpu(cpu_present_map) is the boot cpu? Just wondering why disable_nonboot_cpus() isn't using just any_online_cpu(cpu_online_map)...

Is your question related to the code in kernel/cpu.c?

Rafael

#22 lore raw
In reply to Heiko Carstens

Hi!

Quoted 10 lines
Quoted 7 lines

...so, if pm_ops is non-null, power_down does nonboot cpu disabling, otherwise we proceed with cpus enabled?

That looks ugly.

Is the warning bogus? Or maybe we should *always* disable nonboot cpus in powerdown path?

Is disable_nonboot_cpus() assuming that first_cpu(cpu_present_map) is the boot cpu? Just wondering why disable_nonboot_cpus() isn't using just

I'd say so. It is nicer (and required on some APM systems?) to do shutdown from the boot cpu.
Pavel

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