Skip to contentSkip to conversation

Suspend on Dell D420

DISCUSSION Steinar H. Gunderson 4 participants 19 messages Aug 4, 2006 – Aug 17, 2006

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

[Please Cc me on any followups]

Hi,

Suspend-to-RAM works fine on my new Dell Latitude D420 (with Core Duo) in 2.6.16, but it broke in 2.6.17 -- the machine suspends just fine, but when it resumes, the disk never spins up, the screen stays black and it just hangs. Bisecting shows that the following commit is where it broke:

commit 78eef01b0fae087c5fadbd85dd4fe2918c3a015f

Author: Andrew Morton <[email protected]>
Date:   Wed Mar 22 00:08:16 2006 -0800

[PATCH] on_each_cpu(): disable local interrupts

When on_each_cpu() runs the callback on other CPUs, it runs with local interrupts disabled. So we should run the function with local interrupts disabled on this CPU, too.

And do the same for UP, so the callback is run in the same environment on both UP and SMP. (strictly it should do preempt_disable() too, but I think local_irq_disable is sufficiently equivalent).

Also uninlines on_each_cpu(). softirq.c was the most appropriate file I could find, but it doesn't seem to justify creating a new file.

Oh, and fix up that comment over (under?) x86's smp_call_function(). It drives me nuts.

Applying the patch in reverse against 2.6.17 (it doesn't apply cleanly, but I've done what seems to be the moral equivalent) makes the suspend work again.

Any ideas? It does not work with the latest git checkout as of today.

/* Steinar */

Signature · 1 line
Homepage: http://www.sesse.net/
#1 lore raw
Quoted 26 lines · Steinar H. Gunderson

[Please Cc me on any followups]

Hi,

Suspend-to-RAM works fine on my new Dell Latitude D420 (with Core Duo) in 2.6.16, but it broke in 2.6.17 -- the machine suspends just fine, but when it resumes, the disk never spins up, the screen stays black and it just hangs. Bisecting shows that the following commit is where it broke:

commit 78eef01b0fae087c5fadbd85dd4fe2918c3a015f

Author: Andrew Morton <[email protected]>
Date:   Wed Mar 22 00:08:16 2006 -0800

[PATCH] on_each_cpu(): disable local interrupts

When on_each_cpu() runs the callback on other CPUs, it runs with local interrupts disabled. So we should run the function with local interrupts disabled on this CPU, too.

And do the same for UP, so the callback is run in the same environment on both UP and SMP. (strictly it should do preempt_disable() too, but I think local_irq_disable is sufficiently equivalent).

Also uninlines on_each_cpu(). softirq.c was the most appropriate file I could find, but it doesn't seem to justify creating a new file.

Quoted 8 lines

Oh, and fix up that comment over (under?) x86's smp_call_function(). It drives me nuts.

Applying the patch in reverse against 2.6.17 (it doesn't apply cleanly, but I've done what seems to be the moral equivalent) makes the suspend work again.

Any ideas? It does not work with the latest git checkout as of today.

I guess the patch may interfere with the CPU hotplug badly. Could you please check if you can take CPU1 offline/online?

Rafael

#2 lore raw
Quoted 30 lines · On Fri, 4 Aug 2006 23:27:38 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 29 lines · Steinar H. Gunderson

[Please Cc me on any followups]

Hi,

Suspend-to-RAM works fine on my new Dell Latitude D420 (with Core Duo) in 2.6.16, but it broke in 2.6.17 -- the machine suspends just fine, but when it resumes, the disk never spins up, the screen stays black and it just hangs. Bisecting shows that the following commit is where it broke:

commit 78eef01b0fae087c5fadbd85dd4fe2918c3a015f

Author: Andrew Morton <[email protected]>
Date:   Wed Mar 22 00:08:16 2006 -0800

[PATCH] on_each_cpu(): disable local interrupts

When on_each_cpu() runs the callback on other CPUs, it runs with local interrupts disabled. So we should run the function with local interrupts disabled on this CPU, too.

And do the same for UP, so the callback is run in the same environment on both UP and SMP. (strictly it should do preempt_disable() too, but I think local_irq_disable is sufficiently equivalent).

Also uninlines on_each_cpu(). softirq.c was the most appropriate file I could find, but it doesn't seem to justify creating a new file.

Oh, and fix up that comment over (under?) x86's smp_call_function(). It drives me nuts.

Quoted 7 lines
Quoted 5 lines

Applying the patch in reverse against 2.6.17 (it doesn't apply cleanly, but I've done what seems to be the moral equivalent) makes the suspend work again.

Any ideas? It does not work with the latest git checkout as of today.

I guess the patch may interfere with the CPU hotplug badly.

Why do you think it would do that?

Quoted 2 lines

Could you please
check if you can take CPU1 offline/online?

If something really wants "disable irqs on the other CPUs but not on this CPU" semantics then it would need to use smp_call_function and a direct call. But it would be a strange thing to want to do, surely?

#3 lore raw
Quoted 37 lines · Andrew Morton
Quoted 34 lines · On Fri, 4 Aug 2006 23:27:38 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 33 lines · Steinar H. Gunderson

[Please Cc me on any followups]

Hi,

Suspend-to-RAM works fine on my new Dell Latitude D420 (with Core Duo) in 2.6.16, but it broke in 2.6.17 -- the machine suspends just fine, but when it resumes, the disk never spins up, the screen stays black and it just hangs. Bisecting shows that the following commit is where it broke:

commit 78eef01b0fae087c5fadbd85dd4fe2918c3a015f

Author: Andrew Morton <[email protected]>
Date:   Wed Mar 22 00:08:16 2006 -0800

[PATCH] on_each_cpu(): disable local interrupts

When on_each_cpu() runs the callback on other CPUs, it runs with local interrupts disabled. So we should run the function with local interrupts disabled on this CPU, too.

And do the same for UP, so the callback is run in the same environment on both UP and SMP. (strictly it should do preempt_disable() too, but I think local_irq_disable is sufficiently equivalent).

Also uninlines on_each_cpu(). softirq.c was the most appropriate file I could find, but it doesn't seem to justify creating a new file.

Oh, and fix up that comment over (under?) x86's smp_call_function(). It drives me nuts.

Applying the patch in reverse against 2.6.17 (it doesn't apply cleanly, but I've done what seems to be the moral equivalent) makes the suspend work again.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Any ideas? It does not work with the latest git checkout as of today.

I guess the patch may interfere with the CPU hotplug badly.

Why do you think it would do that?

Because the non-boot CPUs are taken off early, before anything else, and the system is effectively non-SMP during the entire suspend-resume cycle (well, almost). If SMP-related things go wrong during the suspend, CPU hotplug is the first suspect. ;-)

Quoted 6 lines
Quoted 2 lines

Could you please
check if you can take CPU1 offline/online?

If something really wants "disable irqs on the other CPUs but not on this CPU" semantics then it would need to use smp_call_function and a direct call. But it would be a strange thing to want to do, surely?

Yes, it would, but I have a little experience with these things.

Well, looks like on_each_cpu() is run via flush_tlb_all() from __smp_prepare_cpu() which is called by __cpu_up() and that's used by the CPU hotplug. Not that I can tell what goes wrong here, if anything.

Greetings,
Rafael

#4 lore raw
Quoted 4 lines · Rafael J. Wysocki

Because the non-boot CPUs are taken off early, before anything else, and the system is effectively non-SMP during the entire suspend-resume cycle (well, almost). If SMP-related things go wrong during the suspend, CPU hotplug is the first suspect. ;-)

Well, it seems to work fine during the suspend phase, at least, and it also seems to work well during normal use:

fugl:~# echo 0 > /sys/devices/system/cpu/cpu1/online 
fugl:~# echo 1 > /sys/devices/system/cpu/cpu1/online 

FWIW, there is an error in dmesg afterwards, though:

===
CPU 1 is now offline
SMP alternatives: switching to UP code
SMP alternatives: switching to SMP code
Booting processor 1/1 eip 3000
Initializing CPU#1
Calibrating delay using timer specific routine.. 2394.85 BogoMIPS (lpj=4789709)
CPU: After generic identify, caps: bfe9fbff 00100000 00000000 00000000 0000c1a9 00000000 00000000
CPU: After vendor identify, caps: bfe9fbff 00100000 00000000 00000000 0000c1a9 00000000 00000000 monitor/mwait feature present.
CPU: L1 I cache: 32K, L1 D cache: 32K
CPU: L2 cache: 2048K
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 1
CPU: After all inits, caps: bfe9fbff 00100000 00000000 00000140 0000c1a9 00000000 00000000 Intel machine check architecture supported.
Intel machine check reporting enabled on CPU#1.
CPU1: Intel Genuine Intel(R) CPU U2500 @ 1.20GHz stepping 08
APIC error on CPU1: 00(40)
===

No idea whether it's related. FWIW, resume didn't work with maxcpus=1 on boot either, so I'm not really sure how related it is.

/* Steinar */

Signature · 1 line
Homepage: http://www.sesse.net/
#5 lore raw
Quoted 35 lines · Steinar H. Gunderson
Quoted 4 lines · Rafael J. Wysocki

Because the non-boot CPUs are taken off early, before anything else, and the system is effectively non-SMP during the entire suspend-resume cycle (well, almost). If SMP-related things go wrong during the suspend, CPU hotplug is the first suspect. ;-)

Well, it seems to work fine during the suspend phase, at least, and it also seems to work well during normal use:

fugl:~# echo 0 > /sys/devices/system/cpu/cpu1/online 
fugl:~# echo 1 > /sys/devices/system/cpu/cpu1/online 

FWIW, there is an error in dmesg afterwards, though:

===
CPU 1 is now offline
SMP alternatives: switching to UP code
SMP alternatives: switching to SMP code
Booting processor 1/1 eip 3000
Initializing CPU#1
Calibrating delay using timer specific routine.. 2394.85 BogoMIPS (lpj=4789709)
CPU: After generic identify, caps: bfe9fbff 00100000 00000000 00000000 0000c1a9 00000000 00000000
CPU: After vendor identify, caps: bfe9fbff 00100000 00000000 00000000 0000c1a9 00000000 00000000 monitor/mwait feature present.
CPU: L1 I cache: 32K, L1 D cache: 32K
CPU: L2 cache: 2048K
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 1
CPU: After all inits, caps: bfe9fbff 00100000 00000000 00000140 0000c1a9 00000000 00000000 Intel machine check architecture supported.
Intel machine check reporting enabled on CPU#1.
CPU1: Intel Genuine Intel(R) CPU U2500 @ 1.20GHz stepping 08
APIC error on CPU1: 00(40)
===

Quoted 2 lines

No idea whether it's related. FWIW, resume didn't work with maxcpus=1 on boot either, so I'm not really sure how related it is.

Hm, could you please try it with a non-SMP kernel?

Rafael

#6 lore raw
Quoted 3 lines · Rafael J. Wysocki
Quoted 2 lines

No idea whether it's related. FWIW, resume didn't work with maxcpus=1 on boot either, so I'm not really sure how related it is.

Hm, could you please try it with a non-SMP kernel?

Compiling straight 2.6.17 with CONFIG_SMP=n suspends and resumes just fine.

/* Steinar */

Signature · 1 line
Homepage: http://www.sesse.net/
#7 lore raw

Hi!

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

No idea whether it's related. FWIW, resume didn't work with maxcpus=1 on boot either, so I'm not really sure how related it is.

Hm, could you please try it with a non-SMP kernel?

Compiling straight 2.6.17 with CONFIG_SMP=n suspends and resumes just fine.

Interesting... I guess getting some dump where it hangs is not an option? Does video work for you during resume?

Can you try minimal drivers? It works for other people (smp too), so it may be driver problem (althrough it looks unlikely)
Pavel

Signature · 1 line
Thanks for all the (sleeping) penguins.
#8 lore raw
Quoted 2 lines · Pavel Machek

Interesting... I guess getting some dump where it hangs is not an option? Does video work for you during resume?

Define "getting some dump". It doesn't react to anything, so I don't really think I can easily get anything out.

When the resume works (ie. with 2.6.16, with patched 2.6.17, or with 2.6.17 without SMP), video works, but only with the -s and -p flags to s2ram (sav VBE state and POST the video card, respectively).

Quoted 2 lines

Can you try minimal drivers? It works for other people (smp too), so it may be driver problem (althrough it looks unlikely)

I've tried from init=/bin/bash on an initramfs (which should be about the minimal you can get); no change in behaviour. (I've already blacklisted sdhci, since I got a tip it might be bad and I don't really need it; if I get this to work, I'll try whitelisting it again and see if resume works with it, but that's a different story.)

/* Steinar */

Signature · 1 line
Homepage: http://www.sesse.net/
#9 lore raw

Hi!

Quoted 5 lines
Quoted 2 lines

Interesting... I guess getting some dump where it hangs is not an option? Does video work for you during resume?

Define "getting some dump". It doesn't react to anything, so I don't really think I can easily get anything out.

With some luck, you'll still get some messages before it hangs.. on for example serial console.

Signature · 1 line
Thanks for all the (sleeping) penguins.
#10 lore raw
In reply to Steinar H. Gunderson
Quoted 6 lines · Steinar H. Gunderson
Quoted 3 lines · Rafael J. Wysocki
Quoted 2 lines

No idea whether it's related. FWIW, resume didn't work with maxcpus=1 on boot either, so I'm not really sure how related it is.

Hm, could you please try it with a non-SMP kernel?

Compiling straight 2.6.17 with CONFIG_SMP=n suspends and resumes just fine.

Sorry for the delay, there have been some problems with -rc3-mm2 recently.

Please apply the appended patch to the SMP kernel and try the following:

(1)

# echo testproc > /sys/power/disk
# echo disk > /sys/power/state

This should turn off the non-boot CPU, freeze all processes, wait for 5 seconds and thaw the processes and the CPU.

(2)

# echo test > /sys/power/disk
# echo disk > /sys/power/state

This should turn off the non-boot CPU, freeze all processes, shrink memory, suspend all devices, wait for 5 seconds, resume the devices etc. IOW it does everything that's needed for a suspend except for actually suspending.

I think (1) will work and (2) will not, but let's see. :-)

Greetings,
Rafael

---
Add some tools for testing the suspend code.

---
 include/linux/pm.h  |    4 +++-
 kernel/power/disk.c |   35 +++++++++++++++++++++++++++--------
 2 files changed, 30 insertions(+), 9 deletions(-)
include/linux/pm.h +3 -1
Index: linux-2.6.18-rc2-mm1/include/linux/pm.h
===================================================================
@@ -116,7 +116,9 @@ typedef int __bitwise suspend_disk_metho
 #define	PM_DISK_PLATFORM	((__force suspend_disk_method_t) 2)
 #define	PM_DISK_SHUTDOWN	((__force suspend_disk_method_t) 3)
 #define	PM_DISK_REBOOT		((__force suspend_disk_method_t) 4)
-#define	PM_DISK_MAX		((__force suspend_disk_method_t) 5)
+#define	PM_DISK_TEST		((__force suspend_disk_method_t) 5)
+#define	PM_DISK_TESTPROC	((__force suspend_disk_method_t) 6)
+#define	PM_DISK_MAX		((__force suspend_disk_method_t) 7)
 
 struct pm_ops {
 	suspend_disk_method_t pm_disk_mode;
kernel/power/disk.c +27 -8
Index: linux-2.6.18-rc2-mm1/kernel/power/disk.c
===================================================================
@@ -83,6 +83,12 @@ static int prepare_processes(void)
 		goto thaw;
 	}
 
+	if (pm_disk_mode == PM_DISK_TESTPROC) {
+		printk("swsusp debug: Waiting for 5 seconds.\n");
+		mdelay(5000);
+		goto thaw;
+	}
+
 	/* Free memory before shutting down devices. */
 	if (!(error = swsusp_shrink_memory()))
 		return 0;
@@ -119,11 +125,19 @@ int pm_suspend_disk(void)
 	if (error)
 		return error;
 
+	if (pm_disk_mode == PM_DISK_TESTPROC)
+		goto Thaw;
+
 	error = device_suspend(PMSG_FREEZE);
 	if (error) {
 		printk("Some devices failed to suspend\n");
-		unprepare_processes();
-		return error;
+		goto Thaw;
+	}
+
+	if (pm_disk_mode == PM_DISK_TEST) {
+		printk("swsusp debug: Waiting for 5 seconds.\n");
+		mdelay(5000);
+		goto Done;
 	}
 
 	pr_debug("PM: snapshotting memory.\n");
@@ -139,15 +153,16 @@ int pm_suspend_disk(void)
 			power_down(pm_disk_mode);
 		else {
 			swsusp_free();
-			unprepare_processes();
-			return error;
+			goto Thaw;
 		}
-	} else
+	} else {
 		pr_debug("PM: Image restored successfully.\n");
+	}
 
 	swsusp_free();
  Done:
 	device_resume();
+ Thaw:
 	unprepare_processes();
 	return error;
 }
@@ -241,6 +256,8 @@ static const char * const pm_disk_modes[
 	[PM_DISK_PLATFORM]	= "platform",
 	[PM_DISK_SHUTDOWN]	= "shutdown",
 	[PM_DISK_REBOOT]	= "reboot",
+	[PM_DISK_TEST]		= "test",
+	[PM_DISK_TESTPROC]	= "testproc",
 };
 
 /**
@@ -295,17 +312,19 @@ static ssize_t disk_store(struct subsyst
 		}
 	}
 	if (mode) {
-		if (mode == PM_DISK_SHUTDOWN || mode == PM_DISK_REBOOT)
+		if (mode == PM_DISK_SHUTDOWN || mode == PM_DISK_REBOOT ||
+		     mode == PM_DISK_TEST || mode == PM_DISK_TESTPROC) {
 			pm_disk_mode = mode;
-		else {
+		} else {
 			if (pm_ops && pm_ops->enter &&
 			    (mode == pm_ops->pm_disk_mode))
 				pm_disk_mode = mode;
 			else
 				error = -EINVAL;
 		}
-	} else
+	} else {
 		error = -EINVAL;
+	}
 
 	pr_debug("PM: suspend-to-disk mode set to '%s'\n",
 		 pm_disk_modes[mode]);
#11 lore raw
Quoted 5 lines · Rafael J. Wysocki

Please apply the appended patch to the SMP kernel and try the following:

[...]

I think (1) will work and (2) will not, but let's see. :-)

Actually, both worked just fine. The first one (testproc) gave me EPERM on the actual write call according to echo, but I guess that's just a side effect of sloppy test code :-)

/* Steinar */

Signature · 1 line
Homepage: http://www.sesse.net/
#12 lore raw
Quoted 10 lines · Steinar H. Gunderson
Quoted 5 lines · Rafael J. Wysocki

Please apply the appended patch to the SMP kernel and try the following:

[...]

I think (1) will work and (2) will not, but let's see. :-)

Actually, both worked just fine. The first one (testproc) gave me EPERM on the actual write call according to echo, but I guess that's just a side effect of sloppy test code :-)

Oh, I just forgot to initialize error in kernel/power/disk.c#prepare_processes.c . Sorry.

However, this means the drivers' suspend and resume routines seem to work fine and the problem is somehow related to the BIOS black magic that happens during the "real" suspend.

No idea what to do next. :-(

Rafael

#13 lore raw
Quoted 12 lines · Rafael J. Wysocki
Quoted 10 lines · Steinar H. Gunderson
Quoted 5 lines · Rafael J. Wysocki

Please apply the appended patch to the SMP kernel and try the following:

[...]

I think (1) will work and (2) will not, but let's see. :-)

Actually, both worked just fine. The first one (testproc) gave me EPERM on the actual write call according to echo, but I guess that's just a side effect of sloppy test code :-)

Quoted 8 lines

Oh, I just forgot to initialize error in kernel/power/disk.c#prepare_processes.c . Sorry.

However, this means the drivers' suspend and resume routines seem to work fine and the problem is somehow related to the BIOS black magic that happens during the "real" suspend.

No idea what to do next. :-(

(Can we get bugzilla entry? I somehow lost track).

Can you try with method=powerdown or method=reboot? BIOS black magic is not involved at least in reboot parts...
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
Quoted 2 lines · Pavel Machek

Can you try with method=powerdown or method=reboot? BIOS black magic is not involved at least in reboot parts...

I lost you here; I've never heard of these options, nor does Google seem to. Do I specify them on the kernel command line, or something else?

/* Steinar */

Signature · 1 line
Homepage: http://www.sesse.net/
#15 lore raw

Hi!

Quoted 5 lines
Quoted 2 lines

Can you try with method=powerdown or method=reboot? BIOS black magic is not involved at least in reboot parts...

I lost you here; I've never heard of these options, nor does Google seem to. Do I specify them on the kernel command line, or something else?

echo reboot > /sys/power/disk

Pavel

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 3 lines · Pavel Machek
Quoted 2 lines

I lost you here; I've never heard of these options, nor does Google seem to. Do I specify them on the kernel command line, or something else?

echo reboot > /sys/power/disk

But we were discussing suspend-to-RAM, not suspend-to-disk, right? Suspend-to-disk works just fine.

/* Steinar */

Signature · 1 line
Homepage: http://www.sesse.net/
#17 lore raw

Hi!

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

I lost you here; I've never heard of these options, nor does Google seem to. Do I specify them on the kernel command line, or something else?

echo reboot > /sys/power/disk

But we were discussing suspend-to-RAM, not suspend-to-disk, right? Suspend-to-disk works just fine.

Aha, too bad, I was confused. Thats bugzilla.kernel.org, acpi category, I guess.
Pavel

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