All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation
@ 2016-07-07  6:40 Chen Yu
  2016-07-13  9:50 ` Pavel Machek
  0 siblings, 1 reply; 13+ messages in thread
From: Chen Yu @ 2016-07-07  6:40 UTC (permalink / raw)
  To: linux-pm
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown, linux-kernel, Chen Yu

This mode is to verify if the snapshot data written to
swap device can be successfully restored to memory. It
is useful to ease the debugging process on hibernation,
since this mode can not only bypass the BIOSen/bootloader,
but also the system re-initialization.

For example:
$ sudo echo snapshot > /sys/power/disk
$ sudo echo disk > /sys/power/state

/* manual resume.*/
$ sudo echo 8:3 > /sys/power/resume

Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
 kernel/power/hibernate.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index fca9254..667d926 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -52,6 +52,7 @@ enum {
 #ifdef CONFIG_SUSPEND
 	HIBERNATION_SUSPEND,
 #endif
+	HIBERNATION_SNAPSHOT,
 	/* keep last */
 	__HIBERNATION_AFTER_LAST
 };
@@ -631,6 +632,9 @@ static void power_down(void)
 			                "Try swapon -a.\n");
 		return;
 #endif
+	case HIBERNATION_SNAPSHOT:
+		/* Do nothing. */
+		return;
 	}
 	kernel_halt();
 	/*
@@ -878,6 +882,7 @@ static const char * const hibernation_modes[] = {
 #ifdef CONFIG_SUSPEND
 	[HIBERNATION_SUSPEND]	= "suspend",
 #endif
+	[HIBERNATION_SNAPSHOT]	= "snapshot",
 };
 
 /*
@@ -924,6 +929,7 @@ static ssize_t disk_show(struct kobject *kobj, struct kobj_attribute *attr,
 #ifdef CONFIG_SUSPEND
 		case HIBERNATION_SUSPEND:
 #endif
+		case HIBERNATION_SNAPSHOT:
 			break;
 		case HIBERNATION_PLATFORM:
 			if (hibernation_ops)
@@ -970,6 +976,7 @@ static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr,
 #ifdef CONFIG_SUSPEND
 		case HIBERNATION_SUSPEND:
 #endif
+		case HIBERNATION_SNAPSHOT:
 			hibernation_mode = mode;
 			break;
 		case HIBERNATION_PLATFORM:
-- 
2.7.4


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

end of thread, other threads:[~2016-07-14 10:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-07  6:40 [PATCH] PM / hibernate: Introduce snapshot test mode for hibernation Chen Yu
2016-07-13  9:50 ` Pavel Machek
2016-07-13 10:20   ` Chen Yu
2016-07-13 10:21     ` Pavel Machek
2016-07-13 10:39       ` Chen Yu
2016-07-13 17:01         ` Pavel Machek
2016-07-13 20:04           ` Rafael J. Wysocki
2016-07-13 20:26             ` Pavel Machek
2016-07-13 20:44               ` Rafael J. Wysocki
2016-07-13 21:45                 ` Pavel Machek
2016-07-13 22:00                   ` Rafael J. Wysocki
2016-07-13 22:18                     ` Rafael J. Wysocki
2016-07-14 10:44                       ` Chen Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.