LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch] suspend debugging: simulate suspend-to-RAM
@ 2007-01-25 11:33 Ingo Molnar
2007-01-25 13:07 ` Pavel Machek
2007-01-25 18:03 ` Andrey Borzenkov
0 siblings, 2 replies; 10+ messages in thread
From: Ingo Molnar @ 2007-01-25 11:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Linus Torvalds, Pavel Machek, Len Brown
Subject: [patch] suspend debugging: simulate suspend-to-RAM
From: Ingo Molnar <mingo@elte.hu>
most resume bugs are due to the kernel hanging or crashing while trying
to resume a specific device. It is extremely hard to debug such hangs
because often when the hang happens there's no console available yet.
Make debugging such bugs easier by offering a resume mode that does not
actually call into the BIOS to turn off the machine. This, in
combination with earlyprintk=serial,ttyS0,115200,keep ,
CONFIG_PM_DEBUG=y, CONFIG_DISABLE_CONSOLE_SUSPEND=y and
/sys/power/filter enables me to have a fully functional serial console
during the full suspend/resume cycle.
I debugged two suspend bugs in the -rt kernel this way already, so it's
pretty useful.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
Documentation/kernel-parameters.txt | 4 ++++
drivers/acpi/sleep/main.c | 15 ++++++++++++++-
include/linux/acpi.h | 1 +
kernel/sysctl.c | 16 ++++++++++++++++
4 files changed, 35 insertions(+), 1 deletion(-)
Index: linux/Documentation/kernel-parameters.txt
===================================================================
--- linux.orig/Documentation/kernel-parameters.txt
+++ linux/Documentation/kernel-parameters.txt
@@ -159,6 +159,10 @@ and is between 256 and 4096 characters.
acpi_osi= [HW,ACPI] empty param disables _OSI
+ acpi_simulate_suspend_to_ram
+ [KNL] Do not call into BIOS to do suspend-to-RAM
+ Format: <0/1>
+
acpi_serialize [HW,ACPI] force serialization of AML methods
acpi_skip_timer_override [HW,ACPI]
Index: linux/drivers/acpi/sleep/main.c
===================================================================
--- linux.orig/drivers/acpi/sleep/main.c
+++ linux/drivers/acpi/sleep/main.c
@@ -35,6 +35,14 @@ static u32 acpi_suspend_states[] = {
static int init_8259A_after_S1;
+/*
+ * simulate entry into the BIOS - this way the system will not
+ * be turned off for real, and the kernel's resume functionality
+ * can be debugged while still having some system capabilities
+ * left. This is especially useful in combination with /sys/power/filter.
+ */
+int acpi_simulate_suspend_to_ram;
+
/**
* acpi_pm_prepare - Do preliminary suspend work.
* @pm_state: suspend state we're entering.
@@ -91,7 +99,12 @@ static int acpi_pm_enter(suspend_state_t
break;
case PM_SUSPEND_MEM:
- do_suspend_lowlevel();
+ if (unlikely(acpi_simulate_suspend_to_ram)) {
+ printk(KERN_INFO "ACPI: simulating suspend-to-RAM: "
+ "not calling BIOS.\n");
+ } else {
+ do_suspend_lowlevel();
+ }
break;
case PM_SUSPEND_DISK:
Index: linux/include/linux/acpi.h
===================================================================
--- linux.orig/include/linux/acpi.h
+++ linux/include/linux/acpi.h
@@ -438,6 +438,7 @@ extern int pci_mmcfg_config_num;
extern int sbf_port;
extern unsigned long acpi_video_flags;
+extern int acpi_simulate_suspend_to_ram;
#else /* !CONFIG_ACPI */
Index: linux/kernel/sysctl.c
===================================================================
--- linux.orig/kernel/sysctl.c
+++ linux/kernel/sysctl.c
@@ -329,6 +329,14 @@ static ctl_table kern_table[] = {
.proc_handler = &proc_dointvec,
},
{
+ .ctl_name = CTL_UNNUMBERED,
+ .procname = "futex_performance_hack",
+ .data = &futex_performance_hack,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
+ {
.ctl_name = KERN_PANIC,
.procname = "prof_pid",
.data = &prof_pid,
@@ -908,6 +916,14 @@ static ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = &proc_doulongvec_minmax,
},
+ {
+ .ctl_name = CTL_UNNUMBERED,
+ .procname = "acpi_simulate_suspend_to_ram",
+ .data = &acpi_simulate_suspend_to_ram,
+ .maxlen = sizeof (int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
#endif
#ifdef CONFIG_IA64
{
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] suspend debugging: simulate suspend-to-RAM
2007-01-25 11:33 [patch] suspend debugging: simulate suspend-to-RAM Ingo Molnar
@ 2007-01-25 13:07 ` Pavel Machek
2007-01-25 13:29 ` Rafael J. Wysocki
2007-01-25 18:03 ` Andrey Borzenkov
1 sibling, 1 reply; 10+ messages in thread
From: Pavel Machek @ 2007-01-25 13:07 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andrew Morton, linux-kernel, Linus Torvalds, Len Brown
Hi!
> Subject: [patch] suspend debugging: simulate suspend-to-RAM
> From: Ingo Molnar <mingo@elte.hu>
>
> most resume bugs are due to the kernel hanging or crashing while trying
> to resume a specific device. It is extremely hard to debug such hangs
> because often when the hang happens there's no console available
> yet.
While the functionality is useful, no I do not think this should be
configured by sysctl or kernel parameter.
Perhaps right interface is "echo fake-mem > /sys/power/state"?
Pavel
> Index: linux/kernel/sysctl.c
> ===================================================================
> --- linux.orig/kernel/sysctl.c
> +++ linux/kernel/sysctl.c
> @@ -329,6 +329,14 @@ static ctl_table kern_table[] = {
> .proc_handler = &proc_dointvec,
> },
> {
> + .ctl_name = CTL_UNNUMBERED,
> + .procname = "futex_performance_hack",
> + .data = &futex_performance_hack,
> + .maxlen = sizeof(int),
> + .mode = 0644,
> + .proc_handler = &proc_dointvec,
> + },
> + {
> .ctl_name = KERN_PANIC,
> .procname = "prof_pid",
> .data = &prof_pid,
Leftover hunk?
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] suspend debugging: simulate suspend-to-RAM
2007-01-25 13:07 ` Pavel Machek
@ 2007-01-25 13:29 ` Rafael J. Wysocki
2007-01-25 13:30 ` Pavel Machek
0 siblings, 1 reply; 10+ messages in thread
From: Rafael J. Wysocki @ 2007-01-25 13:29 UTC (permalink / raw)
To: Pavel Machek
Cc: Ingo Molnar, Andrew Morton, linux-kernel, Linus Torvalds, Len Brown
On Thursday, 25 January 2007 14:07, Pavel Machek wrote:
> Hi!
>
> > Subject: [patch] suspend debugging: simulate suspend-to-RAM
> > From: Ingo Molnar <mingo@elte.hu>
> >
> > most resume bugs are due to the kernel hanging or crashing while trying
> > to resume a specific device. It is extremely hard to debug such hangs
> > because often when the hang happens there's no console available
> > yet.
>
> While the functionality is useful, no I do not think this should be
> configured by sysctl or kernel parameter.
>
> Perhaps right interface is "echo fake-mem > /sys/power/state"?
Yes, the "test" and "testproc" debug modes are started via /sys/power/state,
so let's make it consistent.
Greetings,
Rafael
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] suspend debugging: simulate suspend-to-RAM
2007-01-25 13:29 ` Rafael J. Wysocki
@ 2007-01-25 13:30 ` Pavel Machek
0 siblings, 0 replies; 10+ messages in thread
From: Pavel Machek @ 2007-01-25 13:30 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Ingo Molnar, Andrew Morton, linux-kernel, Linus Torvalds, Len Brown
On Thu 2007-01-25 14:29:24, Rafael J. Wysocki wrote:
> On Thursday, 25 January 2007 14:07, Pavel Machek wrote:
> > Hi!
> >
> > > Subject: [patch] suspend debugging: simulate suspend-to-RAM
> > > From: Ingo Molnar <mingo@elte.hu>
> > >
> > > most resume bugs are due to the kernel hanging or crashing while trying
> > > to resume a specific device. It is extremely hard to debug such hangs
> > > because often when the hang happens there's no console available
> > > yet.
> >
> > While the functionality is useful, no I do not think this should be
> > configured by sysctl or kernel parameter.
> >
> > Perhaps right interface is "echo fake-mem > /sys/power/state"?
>
> Yes, the "test" and "testproc" debug modes are started via /sys/power/state,
> so let's make it consistent.
Ok, so this one should be "testmem".
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] suspend debugging: simulate suspend-to-RAM
2007-01-25 11:33 [patch] suspend debugging: simulate suspend-to-RAM Ingo Molnar
2007-01-25 13:07 ` Pavel Machek
@ 2007-01-25 18:03 ` Andrey Borzenkov
2007-01-25 21:26 ` Matt Mackall
2007-01-29 15:41 ` Andi Kleen
1 sibling, 2 replies; 10+ messages in thread
From: Andrey Borzenkov @ 2007-01-25 18:03 UTC (permalink / raw)
To: Ingo Molnar, linux-kernel
Ingo Molnar wrote:
> Make debugging such bugs easier by offering a resume mode that does not
> actually call into the BIOS to turn off the machine. This, in
> combination with earlyprintk=serial,ttyS0,115200,keep ,
> CONFIG_PM_DEBUG=y, CONFIG_DISABLE_CONSOLE_SUSPEND=y and
> /sys/power/filter enables me to have a fully functional serial console
> during the full suspend/resume cycle.
>
Will it work with netconsole too? COM port is often missing in notebooks
today.
-andrey
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] suspend debugging: simulate suspend-to-RAM
2007-01-25 18:03 ` Andrey Borzenkov
@ 2007-01-25 21:26 ` Matt Mackall
2007-01-25 22:41 ` Rafael J. Wysocki
2007-01-29 15:41 ` Andi Kleen
1 sibling, 1 reply; 10+ messages in thread
From: Matt Mackall @ 2007-01-25 21:26 UTC (permalink / raw)
To: Andrey Borzenkov; +Cc: Ingo Molnar, linux-kernel
On Thu, Jan 25, 2007 at 09:03:22PM +0300, Andrey Borzenkov wrote:
> Ingo Molnar wrote:
> > Make debugging such bugs easier by offering a resume mode that does not
> > actually call into the BIOS to turn off the machine. This, in
> > combination with earlyprintk=serial,ttyS0,115200,keep ,
> > CONFIG_PM_DEBUG=y, CONFIG_DISABLE_CONSOLE_SUSPEND=y and
> > /sys/power/filter enables me to have a fully functional serial console
> > during the full suspend/resume cycle.
> >
>
> Will it work with netconsole too? COM port is often missing in notebooks
> today.
Should, if you add your network device to the aforementioned filter.
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] suspend debugging: simulate suspend-to-RAM
2007-01-25 21:26 ` Matt Mackall
@ 2007-01-25 22:41 ` Rafael J. Wysocki
0 siblings, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2007-01-25 22:41 UTC (permalink / raw)
To: Matt Mackall; +Cc: Andrey Borzenkov, Ingo Molnar, linux-kernel
On Thursday, 25 January 2007 22:26, Matt Mackall wrote:
> On Thu, Jan 25, 2007 at 09:03:22PM +0300, Andrey Borzenkov wrote:
> > Ingo Molnar wrote:
> > > Make debugging such bugs easier by offering a resume mode that does not
> > > actually call into the BIOS to turn off the machine. This, in
> > > combination with earlyprintk=serial,ttyS0,115200,keep ,
> > > CONFIG_PM_DEBUG=y, CONFIG_DISABLE_CONSOLE_SUSPEND=y and
> > > /sys/power/filter enables me to have a fully functional serial console
> > > during the full suspend/resume cycle.
> > >
> >
> > Will it work with netconsole too? COM port is often missing in notebooks
> > today.
>
> Should, if you add your network device to the aforementioned filter.
Hm, what about the bus to which the device is connected?
Rafael
--
If you don't have the time to read,
you don't have the time or the tools to write.
- Stephen King
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] suspend debugging: simulate suspend-to-RAM
2007-01-25 18:03 ` Andrey Borzenkov
2007-01-25 21:26 ` Matt Mackall
@ 2007-01-29 15:41 ` Andi Kleen
2007-01-31 9:12 ` Ingo Molnar
1 sibling, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2007-01-29 15:41 UTC (permalink / raw)
To: Andrey Borzenkov; +Cc: Ingo Molnar, linux-kernel
Andrey Borzenkov <arvidjaar@mail.ru> writes:
> Will it work with netconsole too? COM port is often missing in notebooks
> today.
It will work with some luck with firescope (in the worst case you
might need to disable suspend in ochi1394). Many laptops have firewire
ports.
ftp://ftp.firstfloor.org/pub/ak/firescope/
-Andi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] suspend debugging: simulate suspend-to-RAM
2007-01-29 15:41 ` Andi Kleen
@ 2007-01-31 9:12 ` Ingo Molnar
2007-01-31 9:25 ` Andi Kleen
0 siblings, 1 reply; 10+ messages in thread
From: Ingo Molnar @ 2007-01-31 9:12 UTC (permalink / raw)
To: Andi Kleen; +Cc: Andrey Borzenkov, linux-kernel
* Andi Kleen <ak@suse.de> wrote:
> Andrey Borzenkov <arvidjaar@mail.ru> writes:
>
> > Will it work with netconsole too? COM port is often missing in notebooks
> > today.
>
> It will work with some luck with firescope (in the worst case you
> might need to disable suspend in ochi1394). Many laptops have firewire
> ports.
>
> ftp://ftp.firstfloor.org/pub/ak/firescope/
wow, that's really neat!
Ingo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] suspend debugging: simulate suspend-to-RAM
2007-01-31 9:12 ` Ingo Molnar
@ 2007-01-31 9:25 ` Andi Kleen
0 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2007-01-31 9:25 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andrey Borzenkov, linux-kernel, bk
On Wednesday 31 January 2007 10:12, Ingo Molnar wrote:
>
> * Andi Kleen <ak@suse.de> wrote:
>
> > Andrey Borzenkov <arvidjaar@mail.ru> writes:
> >
> > > Will it work with netconsole too? COM port is often missing in notebooks
> > > today.
> >
> > It will work with some luck with firescope (in the worst case you
> > might need to disable suspend in ochi1394). Many laptops have firewire
> > ports.
> >
> > ftp://ftp.firstfloor.org/pub/ak/firescope/
>
> wow, that's really neat!
To give proper credit firescope originally came from Ben Herrenschmidt
for PPC. I just ported it to x86 with a few changes.
BTW if you like firescope you might also like fireproxy
http://www.suse.de/~bk/firewire/
There's also a early ohci1394 driver in there to make
firescope/fireproxy work earlier during boot, but it's still somewhat
experimental.
-Andi
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-01-31 9:25 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-25 11:33 [patch] suspend debugging: simulate suspend-to-RAM Ingo Molnar
2007-01-25 13:07 ` Pavel Machek
2007-01-25 13:29 ` Rafael J. Wysocki
2007-01-25 13:30 ` Pavel Machek
2007-01-25 18:03 ` Andrey Borzenkov
2007-01-25 21:26 ` Matt Mackall
2007-01-25 22:41 ` Rafael J. Wysocki
2007-01-29 15:41 ` Andi Kleen
2007-01-31 9:12 ` Ingo Molnar
2007-01-31 9:25 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).