[RFC/PATCH 1/2] swsusp: preserve boot-time printk output after resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Nigel, can I please get a sign-off for these if you're okay with them. 
Rafael, Pavel, please ACK or NAK. Thanks.

			Pekka

From: Nigel Cunningham <nigel@xxxxxxxxxxxxxxxxxx>

Adds a new config option CONFIG_PRINTK_NOSAVE which makes the kernel
preserve printk() output from boot after resume.  This is useful for
debugging hibernation.

Cc: Pavel Machek <pavel@xxxxxx>
Cc: Rafael J. Wysocki <rjw@xxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
---
 include/linux/suspend.h |    6 ++++++
 kernel/power/Kconfig    |   11 +++++++++++
 kernel/printk.c         |    7 ++++---
 3 files changed, 21 insertions(+), 3 deletions(-)

Index: 2.6/include/linux/suspend.h
===================================================================
--- 2.6.orig/include/linux/suspend.h	2007-04-27 14:42:13.000000000 +0300
+++ 2.6/include/linux/suspend.h	2007-04-27 14:43:13.000000000 +0300
@@ -55,4 +55,10 @@ unsigned long get_safe_page(gfp_t gfp_ma
  */
 #define PAGES_FOR_IO	1024
 
+#ifdef CONFIG_PRINTK_NOSAVE
+#define POSS_NOSAVE __nosavedata
+#else
+#define POSS_NOSAVE
+#endif
+
 #endif /* _LINUX_SWSUSP_H */
Index: 2.6/kernel/power/Kconfig
===================================================================
--- 2.6.orig/kernel/power/Kconfig	2007-04-27 14:42:13.000000000 +0300
+++ 2.6/kernel/power/Kconfig	2007-04-27 14:43:13.000000000 +0300
@@ -48,6 +48,17 @@ config DISABLE_CONSOLE_SUSPEND
 	suspend/resume routines, but may itself lead to problems, for example
 	if netconsole is used.
 
+config PRINTK_NOSAVE
+	bool "Preserve printk data from boot kernel when resuming."
+	default n
+	---help---
+	This option gives printk data and the associated variables the
+	attribute __nosave, which means that they will not be saves as
+	part of the image. The net effect is that after resuming, your
+	dmesg will show the messages from prior to the atomic restore,
+	instead of the messages from the resumed kernel. This may be
+	useful for debugging hibernation.
+
 config PM_TRACE
 	bool "Suspend/resume event tracing"
 	depends on PM && PM_DEBUG && X86_32 && EXPERIMENTAL
Index: 2.6/kernel/printk.c
===================================================================
--- 2.6.orig/kernel/printk.c	2007-04-27 14:42:13.000000000 +0300
+++ 2.6/kernel/printk.c	2007-04-27 14:43:13.000000000 +0300
@@ -32,6 +32,7 @@  *	01Mar01 Andrew Morton <andrewm@xxxxxx
 #include <linux/bootmem.h>
 #include <linux/syscalls.h>
 #include <linux/jiffies.h>
+#include <linux/suspend.h>
 
 #include <asm/uaccess.h>
 
@@ -92,9 +93,9 @@ static DEFINE_SPINLOCK(logbuf_lock);
  * The indices into log_buf are not constrained to log_buf_len - they
  * must be masked before subscripting
  */
-static unsigned long log_start;	/* Index into log_buf: next char to be read by syslog() */
-static unsigned long con_start;	/* Index into log_buf: next char to be sent to consoles */
-static unsigned long log_end;	/* Index into log_buf: most-recently-written-char + 1 */
+static unsigned long POSS_NOSAVE log_start;	/* Index into log_buf: next char to be read by syslog() */
+static unsigned long POSS_NOSAVE con_start;	/* Index into log_buf: next char to be sent to consoles */
+static unsigned long POSS_NOSAVE log_end;	/* Index into log_buf: most-recently-written-char + 1 */
 
 /*
  *	Array of consoles built from command line options (console=)
_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux