Skip to contentSkip to conversation

PM / Hibernate: Introduce CONFIG_HIBERNATE_INTERFACE

PATCH In review Rafael J. Wysocki 3 participants 9 messages Mar 26, 2011 – Mar 30, 2011

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

PATCH 1/1 PM / Hibernate: Introduce CONFIG_HIBERNATE_INTERFACE

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

Xen save/restore is going to use hibernate device callbacks for quiescing devices and putting them back to normal operations and it would need to select CONFIG_HIBERNATION for this purpose. However, that also would cause the hibernate interfaces for user space to be enabled, which might confuse user space, because the Xen kernels don't support hibernation. Moreover, it would be wasteful, as it would make the Xen kernels include a substantial amount of code that they would never use.

To address this issue introduce new power management Kconfig option CONFIG_HIBERNATE_INTERFACE, such that the hibernate interfaces for user space and the image-handling code will depend on it and it will select CONFIG_HIBERNATION. Then, Xen save/restore will be able to select CONFIG_HIBERNATION without dragging the entire hibernate code along with it.

---
 arch/x86/power/Makefile |    3 ++-
 include/linux/suspend.h |   15 +++++----------
 kernel/power/Kconfig    |    4 ++++
 kernel/power/Makefile   |    4 ++--
 kernel/power/main.c     |    2 +-
 kernel/power/power.h    |    6 +++---
 6 files changed, 17 insertions(+), 17 deletions(-)
kernel/power/Kconfig +4 -0
Index: linux-2.6/kernel/power/Kconfig
===================================================================
@@ -19,8 +19,12 @@ config SUSPEND_FREEZER
 	  Turning OFF this setting is NOT recommended! If in doubt, say Y.
 
 config HIBERNATION
+	bool
+
+config HIBERNATE_INTERFACE
 	bool "Hibernation (aka 'suspend to disk')"
 	depends on SWAP && ARCH_HIBERNATION_POSSIBLE
+	select HIBERNATION
 	select LZO_COMPRESS
 	select LZO_DECOMPRESS
 	---help---
kernel/power/Makefile +2 -2
Index: linux-2.6/kernel/power/Makefile
===================================================================
@@ -6,7 +6,7 @@ obj-$(CONFIG_PM_SLEEP)		+= console.o
 obj-$(CONFIG_FREEZER)		+= process.o
 obj-$(CONFIG_SUSPEND)		+= suspend.o
 obj-$(CONFIG_PM_TEST_SUSPEND)	+= suspend_test.o
-obj-$(CONFIG_HIBERNATION)	+= hibernate.o snapshot.o swap.o user.o \
-				   block_io.o
+obj-$(CONFIG_HIBERNATE_INTERFACE)	+= hibernate.o snapshot.o swap.o \
+						user.o block_io.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
include/linux/suspend.h +5 -10
Index: linux-2.6/include/linux/suspend.h
===================================================================
@@ -229,7 +229,7 @@ struct platform_hibernation_ops {
 	void (*recover)(void);
 };
 
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
 static inline void __init register_nosave_region(unsigned long b, unsigned long e)
@@ -248,7 +248,9 @@ extern unsigned long get_safe_page(gfp_t
 extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
 extern int hibernate(void);
 extern bool system_entering_hibernation(void);
-#else /* CONFIG_HIBERNATION */
+#else /* !CONFIG_HIBERNATE_INTERFACE */
+static inline void register_nosave_region(unsigned long b, unsigned long e) {}
+static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
@@ -256,7 +258,7 @@ static inline void swsusp_unset_page_fre
 static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {}
 static inline int hibernate(void) { return -ENOSYS; }
 static inline bool system_entering_hibernation(void) { return false; }
-#endif /* CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */
 
 #ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
@@ -298,13 +300,6 @@ static inline bool pm_wakeup_pending(voi
 extern struct mutex pm_mutex;
 
 #ifndef CONFIG_HIBERNATION
-static inline void register_nosave_region(unsigned long b, unsigned long e)
-{
-}
-static inline void register_nosave_region_late(unsigned long b, unsigned long e)
-{
-}
-
 static inline void lock_system_sleep(void) {}
 static inline void unlock_system_sleep(void) {}
 
arch/x86/power/Makefile +2 -1
Index: linux-2.6/arch/x86/power/Makefile
===================================================================
@@ -4,4 +4,5 @@ nostackp := $(call cc-option, -fno-stack
 CFLAGS_cpu.o	:= $(nostackp)
 
 obj-$(CONFIG_PM_SLEEP)		+= cpu.o
-obj-$(CONFIG_HIBERNATION)	+= hibernate_$(BITS).o hibernate_asm_$(BITS).o
+obj-$(CONFIG_HIBERNATE_INTERFACE)	+= hibernate_$(BITS).o \
+						hibernate_asm_$(BITS).o
kernel/power/main.c +1 -1
Index: linux-2.6/kernel/power/main.c
===================================================================
@@ -156,7 +156,7 @@ static ssize_t state_show(struct kobject
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
 #endif
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 	s += sprintf(s, "%s\n", "disk");
 #else
 	if (s != buf)
kernel/power/power.h +3 -3
Index: linux-2.6/kernel/power/power.h
===================================================================
@@ -13,7 +13,7 @@ struct swsusp_info {
 	unsigned long		size;
 } __attribute__((aligned(PAGE_SIZE)));
 
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 /* kernel/power/snapshot.c */
 extern void __init hibernate_image_size_init(void);
 
@@ -53,10 +53,10 @@ extern int hibernation_snapshot(int plat
 extern int hibernation_restore(int platform_mode);
 extern int hibernation_platform_enter(void);
 
-#else /* !CONFIG_HIBERNATION */
+#else /* !CONFIG_HIBERNATE_INTERFACE */
 
 static inline void hibernate_image_size_init(void) {}
-#endif /* !CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */
 
 extern int pfn_is_nosave(unsigned long);
 
#1 lore raw

Hi Rafael,

Quoted 11 lines · Rafael J. Wysocki

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

Xen save/restore is going to use hibernate device callbacks for quiescing devices and putting them back to normal operations and it would need to select CONFIG_HIBERNATION for this purpose. However, that also would cause the hibernate interfaces for user space to be enabled, which might confuse user space, because the Xen kernels don't support hibernation. Moreover, it would be wasteful, as it would make the Xen kernels include a substantial amount of code that they would never use.

Quoted 8 lines

To address this issue introduce new power management Kconfig option CONFIG_HIBERNATE_INTERFACE, such that the hibernate interfaces for user space and the image-handling code will depend on it and it will select CONFIG_HIBERNATION. Then, Xen save/restore will be able to select CONFIG_HIBERNATION without dragging the entire hibernate code along with it.

Were you planning to put this forward for 2.6.39 or are you waiting for 2.6.40?

Quoted 1 line

Shriram,

Is the additional Xen side patch still the same as in <[email protected]> ? Is there anything else which isn't already in upstream?

Ian.

Quoted 142 lines
---
 arch/x86/power/Makefile |    3 ++-
 include/linux/suspend.h |   15 +++++----------
 kernel/power/Kconfig    |    4 ++++
 kernel/power/Makefile   |    4 ++--
 kernel/power/main.c     |    2 +-
 kernel/power/power.h    |    6 +++---
 6 files changed, 17 insertions(+), 17 deletions(-)

Index: linux-2.6/kernel/power/Kconfig
===================================================================

kernel/power/Kconfig +4 -0
@@ -19,8 +19,12 @@ config SUSPEND_FREEZER
 	  Turning OFF this setting is NOT recommended! If in doubt, say Y.
 
 config HIBERNATION
+	bool
+
+config HIBERNATE_INTERFACE
 	bool "Hibernation (aka 'suspend to disk')"
 	depends on SWAP && ARCH_HIBERNATION_POSSIBLE
+	select HIBERNATION
 	select LZO_COMPRESS
 	select LZO_DECOMPRESS
 	---help---

Index: linux-2.6/kernel/power/Makefile
===================================================================

kernel/power/Makefile +2 -2
@@ -6,7 +6,7 @@ obj-$(CONFIG_PM_SLEEP)		+= console.o
 obj-$(CONFIG_FREEZER)		+= process.o
 obj-$(CONFIG_SUSPEND)		+= suspend.o
 obj-$(CONFIG_PM_TEST_SUSPEND)	+= suspend_test.o
-obj-$(CONFIG_HIBERNATION)	+= hibernate.o snapshot.o swap.o user.o \
-				   block_io.o
+obj-$(CONFIG_HIBERNATE_INTERFACE)	+= hibernate.o snapshot.o swap.o \
+						user.o block_io.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o

Index: linux-2.6/include/linux/suspend.h
===================================================================

include/linux/suspend.h +5 -10
@@ -229,7 +229,7 @@ struct platform_hibernation_ops {
 	void (*recover)(void);
 };
 
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
 static inline void __init register_nosave_region(unsigned long b, unsigned long e)
@@ -248,7 +248,9 @@ extern unsigned long get_safe_page(gfp_t
 extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
 extern int hibernate(void);
 extern bool system_entering_hibernation(void);
-#else /* CONFIG_HIBERNATION */
+#else /* !CONFIG_HIBERNATE_INTERFACE */
+static inline void register_nosave_region(unsigned long b, unsigned long e) {}
+static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
@@ -256,7 +258,7 @@ static inline void swsusp_unset_page_fre
 static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {}
 static inline int hibernate(void) { return -ENOSYS; }
 static inline bool system_entering_hibernation(void) { return false; }
-#endif /* CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */
 
 #ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
@@ -298,13 +300,6 @@ static inline bool pm_wakeup_pending(voi
 extern struct mutex pm_mutex;
 
 #ifndef CONFIG_HIBERNATION
-static inline void register_nosave_region(unsigned long b, unsigned long e)
-{
-}
-static inline void register_nosave_region_late(unsigned long b, unsigned long e)
-{
-}
-
 static inline void lock_system_sleep(void) {}
 static inline void unlock_system_sleep(void) {}
 

Index: linux-2.6/arch/x86/power/Makefile
===================================================================

arch/x86/power/Makefile +2 -1
@@ -4,4 +4,5 @@ nostackp := $(call cc-option, -fno-stack
 CFLAGS_cpu.o	:= $(nostackp)
 
 obj-$(CONFIG_PM_SLEEP)		+= cpu.o
-obj-$(CONFIG_HIBERNATION)	+= hibernate_$(BITS).o hibernate_asm_$(BITS).o
+obj-$(CONFIG_HIBERNATE_INTERFACE)	+= hibernate_$(BITS).o \
+						hibernate_asm_$(BITS).o

Index: linux-2.6/kernel/power/main.c
===================================================================

kernel/power/main.c +1 -1
@@ -156,7 +156,7 @@ static ssize_t state_show(struct kobject
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
 #endif
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 	s += sprintf(s, "%s\n", "disk");
 #else
 	if (s != buf)

Index: linux-2.6/kernel/power/power.h
===================================================================

kernel/power/power.h +3 -3
@@ -13,7 +13,7 @@ struct swsusp_info {
 	unsigned long		size;
 } __attribute__((aligned(PAGE_SIZE)));
 
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 /* kernel/power/snapshot.c */
 extern void __init hibernate_image_size_init(void);
 
@@ -53,10 +53,10 @@ extern int hibernation_snapshot(int plat
 extern int hibernation_restore(int platform_mode);
 extern int hibernation_platform_enter(void);
 
-#else /* !CONFIG_HIBERNATION */
+#else /* !CONFIG_HIBERNATE_INTERFACE */
 
 static inline void hibernate_image_size_init(void) {}
-#endif /* !CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */
 
 extern int pfn_is_nosave(unsigned long);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 28 lines · Ian Campbell

Hi Rafael,

Quoted 11 lines · Rafael J. Wysocki

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

Xen save/restore is going to use hibernate device callbacks for quiescing devices and putting them back to normal operations and it would need to select CONFIG_HIBERNATION for this purpose. However, that also would cause the hibernate interfaces for user space to be enabled, which might confuse user space, because the Xen kernels don't support hibernation. Moreover, it would be wasteful, as it would make the Xen kernels include a substantial amount of code that they would never use.

Quoted 8 lines

To address this issue introduce new power management Kconfig option CONFIG_HIBERNATE_INTERFACE, such that the hibernate interfaces for user space and the image-handling code will depend on it and it will select CONFIG_HIBERNATION. Then, Xen save/restore will be able to select CONFIG_HIBERNATION without dragging the entire hibernate code along with it.

Were you planning to put this forward for 2.6.39 or are you waiting for 2.6.40?

Quoted 1 line
Quoted 7 lines

Shriram,

Is the additional Xen side patch still the same as in <[email protected]> ? Is there anything else which isn't already in upstream?

Ah. I knew I was missing something.

Yes. That patch remains the same.

thanks
shriram

Quoted 156 lines

Ian.

Quoted 45 lines
---
 arch/x86/power/Makefile |    3 ++-
 include/linux/suspend.h |   15 +++++----------
 kernel/power/Kconfig    |    4 ++++
 kernel/power/Makefile   |    4 ++--
 kernel/power/main.c     |    2 +-
 kernel/power/power.h    |    6 +++---
 6 files changed, 17 insertions(+), 17 deletions(-)

Index: linux-2.6/kernel/power/Kconfig
===================================================================

kernel/power/Kconfig +4 -0
@@ -19,8 +19,12 @@ config SUSPEND_FREEZER
        Turning OFF this setting is NOT recommended! If in doubt, say Y.
 
 config HIBERNATION
+     bool
+
+config HIBERNATE_INTERFACE
      bool "Hibernation (aka 'suspend to disk')"
      depends on SWAP && ARCH_HIBERNATION_POSSIBLE
+     select HIBERNATION
      select LZO_COMPRESS
      select LZO_DECOMPRESS
      ---help---

Index: linux-2.6/kernel/power/Makefile
===================================================================

kernel/power/Makefile +2 -2
@@ -6,7 +6,7 @@ obj-$(CONFIG_PM_SLEEP)                += console.o
 obj-$(CONFIG_FREEZER)                += process.o
 obj-$(CONFIG_SUSPEND)                += suspend.o
 obj-$(CONFIG_PM_TEST_SUSPEND)        += suspend_test.o
-obj-$(CONFIG_HIBERNATION)    += hibernate.o snapshot.o swap.o user.o \
-                                block_io.o
+obj-$(CONFIG_HIBERNATE_INTERFACE)    += hibernate.o snapshot.o swap.o \
+                                             user.o block_io.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)    += poweroff.o

Index: linux-2.6/include/linux/suspend.h
===================================================================

include/linux/suspend.h struct platform_hibernation_ops { · line 234

Quoted 7 lines
include/linux/suspend.h +1 -1
@@ -229,7 +229,7 @@ struct platform_hibernation_ops {
      void (*recover)(void);
 };
 
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e,

int km);

include/linux/suspend.h struct platform_hibernation_ops { · line 235

Quoted 1 line
include/linux/suspend.h +0 -0
 static inline void __init register_nosave_region(unsigned long b,

unsigned long e)

include/linux/suspend.h extern unsigned long get_safe_page(gfp_t · line 248

Quoted 2 lines
include/linux/suspend.h +0 -0
@@ -248,7 +248,9 @@ extern unsigned long get_safe_page(gfp_t
 extern void hibernation_set_ops(const struct platform_hibernation_ops

*ops);

include/linux/suspend.h extern unsigned long get_safe_page(gfp_t

Quoted 5 lines
include/linux/suspend.h +2 -1
 extern int hibernate(void);
 extern bool system_entering_hibernation(void);
-#else /* CONFIG_HIBERNATION */
+#else /* !CONFIG_HIBERNATE_INTERFACE */
+static inline void register_nosave_region(unsigned long b, unsigned long

e) {}

include/linux/suspend.h extern unsigned long get_safe_page(gfp_t · line 253

Quoted 1 line
include/linux/suspend.h +1 -0
+static inline void register_nosave_region_late(unsigned long b, unsigned

long e) {}

include/linux/suspend.h static inline void swsusp_unset_page_fre · line 258

Quoted 5 lines
include/linux/suspend.h +0 -0
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
@@ -256,7 +258,7 @@ static inline void swsusp_unset_page_fre
 static inline void hibernation_set_ops(const struct

platform_hibernation_ops *ops) {}

include/linux/suspend.h static inline bool pm_wakeup_pending(voi · line 301

Quoted 12 lines
include/linux/suspend.h +1 -2
 static inline int hibernate(void) { return -ENOSYS; }
 static inline bool system_entering_hibernation(void) { return false; }
-#endif /* CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */
 
 #ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
@@ -298,13 +300,6 @@ static inline bool pm_wakeup_pending(voi
 extern struct mutex pm_mutex;
 
 #ifndef CONFIG_HIBERNATION
-static inline void register_nosave_region(unsigned long b, unsigned long

e)

include/linux/suspend.h static inline bool pm_wakeup_pending(voi

Quoted 3 lines
include/linux/suspend.h +0 -3
-{
-}
-static inline void register_nosave_region_late(unsigned long b, unsigned

long e)

Quoted 11 lines
include/linux/suspend.h +0 -3
-{
-}
-
 static inline void lock_system_sleep(void) {}
 static inline void unlock_system_sleep(void) {}
 

Index: linux-2.6/arch/x86/power/Makefile
===================================================================

arch/x86/power/Makefile nostackp := $(call cc-option, -fno-stack · line 7

Quoted 4 lines
arch/x86/power/Makefile +0 -1
@@ -4,4 +4,5 @@ nostackp := $(call cc-option, -fno-stack
 CFLAGS_cpu.o := $(nostackp)
 
 obj-$(CONFIG_PM_SLEEP)               += cpu.o
-obj-$(CONFIG_HIBERNATION)    += hibernate_$(BITS).o

hibernate_asm_$(BITS).o

Quoted 46 lines
arch/x86/power/Makefile +2 -0
+obj-$(CONFIG_HIBERNATE_INTERFACE)    += hibernate_$(BITS).o \
+                                             hibernate_asm_$(BITS).o

Index: linux-2.6/kernel/power/main.c
===================================================================

kernel/power/main.c +1 -1
@@ -156,7 +156,7 @@ static ssize_t state_show(struct kobject
                      s += sprintf(s,"%s ", pm_states[i]);
      }
 #endif
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
      s += sprintf(s, "%s\n", "disk");
 #else
      if (s != buf)

Index: linux-2.6/kernel/power/power.h
===================================================================

kernel/power/power.h +3 -3
@@ -13,7 +13,7 @@ struct swsusp_info {
      unsigned long           size;
 } __attribute__((aligned(PAGE_SIZE)));
 
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 /* kernel/power/snapshot.c */
 extern void __init hibernate_image_size_init(void);
 
@@ -53,10 +53,10 @@ extern int hibernation_snapshot(int plat
 extern int hibernation_restore(int platform_mode);
 extern int hibernation_platform_enter(void);
 
-#else /* !CONFIG_HIBERNATION */
+#else /* !CONFIG_HIBERNATE_INTERFACE */
 
 static inline void hibernate_image_size_init(void) {}
-#endif /* !CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */
 
 extern int pfn_is_nosave(unsigned long);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
In reply to Ian Campbell
Quoted 28 lines · Ian Campbell

Hi Rafael,

Quoted 11 lines · Rafael J. Wysocki

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

Xen save/restore is going to use hibernate device callbacks for quiescing devices and putting them back to normal operations and it would need to select CONFIG_HIBERNATION for this purpose. However, that also would cause the hibernate interfaces for user space to be enabled, which might confuse user space, because the Xen kernels don't support hibernation. Moreover, it would be wasteful, as it would make the Xen kernels include a substantial amount of code that they would never use.

Quoted 8 lines

To address this issue introduce new power management Kconfig option CONFIG_HIBERNATE_INTERFACE, such that the hibernate interfaces for user space and the image-handling code will depend on it and it will select CONFIG_HIBERNATION. Then, Xen save/restore will be able to select CONFIG_HIBERNATION without dragging the entire hibernate code along with it.

Were you planning to put this forward for 2.6.39 or are you waiting for 2.6.40?

Quoted 1 line
Quoted 7 lines

Shriram,

Is the additional Xen side patch still the same as in <[email protected]> ? Is there anything else which isn't already in upstream?

Ah. I knew I was missing something.

Yes. That patch remains the same.

thanks
shriram

Quoted 146 lines

Ian.

Quoted 45 lines
---
 arch/x86/power/Makefile |    3 ++-
 include/linux/suspend.h |   15 +++++----------
 kernel/power/Kconfig    |    4 ++++
 kernel/power/Makefile   |    4 ++--
 kernel/power/main.c     |    2 +-
 kernel/power/power.h    |    6 +++---
 6 files changed, 17 insertions(+), 17 deletions(-)

Index: linux-2.6/kernel/power/Kconfig
===================================================================

kernel/power/Kconfig +4 -0
@@ -19,8 +19,12 @@ config SUSPEND_FREEZER
        Turning OFF this setting is NOT recommended! If in doubt, say Y.
 
 config HIBERNATION
+     bool
+
+config HIBERNATE_INTERFACE
      bool "Hibernation (aka 'suspend to disk')"
      depends on SWAP && ARCH_HIBERNATION_POSSIBLE
+     select HIBERNATION
      select LZO_COMPRESS
      select LZO_DECOMPRESS
      ---help---

Index: linux-2.6/kernel/power/Makefile
===================================================================

kernel/power/Makefile +2 -2
@@ -6,7 +6,7 @@ obj-$(CONFIG_PM_SLEEP)                += console.o
 obj-$(CONFIG_FREEZER)                += process.o
 obj-$(CONFIG_SUSPEND)                += suspend.o
 obj-$(CONFIG_PM_TEST_SUSPEND)        += suspend_test.o
-obj-$(CONFIG_HIBERNATION)    += hibernate.o snapshot.o swap.o user.o \
-                                block_io.o
+obj-$(CONFIG_HIBERNATE_INTERFACE)    += hibernate.o snapshot.o swap.o \
+                                             user.o block_io.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)    += poweroff.o

Index: linux-2.6/include/linux/suspend.h
===================================================================

include/linux/suspend.h struct platform_hibernation_ops { · line 234

Quoted 7 lines
include/linux/suspend.h +1 -1
@@ -229,7 +229,7 @@ struct platform_hibernation_ops {
      void (*recover)(void);
 };
 
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e,

int km);

include/linux/suspend.h struct platform_hibernation_ops { · line 235

Quoted 1 line
include/linux/suspend.h +0 -0
 static inline void __init register_nosave_region(unsigned long b,

unsigned long e)

include/linux/suspend.h extern unsigned long get_safe_page(gfp_t · line 248

Quoted 2 lines
include/linux/suspend.h +0 -0
@@ -248,7 +248,9 @@ extern unsigned long get_safe_page(gfp_t
 extern void hibernation_set_ops(const struct platform_hibernation_ops

*ops);

include/linux/suspend.h extern unsigned long get_safe_page(gfp_t

Quoted 5 lines
include/linux/suspend.h +2 -1
 extern int hibernate(void);
 extern bool system_entering_hibernation(void);
-#else /* CONFIG_HIBERNATION */
+#else /* !CONFIG_HIBERNATE_INTERFACE */
+static inline void register_nosave_region(unsigned long b, unsigned long

e) {}

include/linux/suspend.h extern unsigned long get_safe_page(gfp_t · line 253

Quoted 1 line
include/linux/suspend.h +1 -0
+static inline void register_nosave_region_late(unsigned long b, unsigned

long e) {}

include/linux/suspend.h static inline void swsusp_unset_page_fre · line 258

Quoted 5 lines
include/linux/suspend.h +0 -0
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
@@ -256,7 +258,7 @@ static inline void swsusp_unset_page_fre
 static inline void hibernation_set_ops(const struct

platform_hibernation_ops *ops) {}

include/linux/suspend.h static inline bool pm_wakeup_pending(voi · line 301

Quoted 12 lines
include/linux/suspend.h +1 -2
 static inline int hibernate(void) { return -ENOSYS; }
 static inline bool system_entering_hibernation(void) { return false; }
-#endif /* CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */
 
 #ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
@@ -298,13 +300,6 @@ static inline bool pm_wakeup_pending(voi
 extern struct mutex pm_mutex;
 
 #ifndef CONFIG_HIBERNATION
-static inline void register_nosave_region(unsigned long b, unsigned long

e)

include/linux/suspend.h static inline bool pm_wakeup_pending(voi

Quoted 3 lines
include/linux/suspend.h +0 -3
-{
-}
-static inline void register_nosave_region_late(unsigned long b, unsigned

long e)

Quoted 11 lines
include/linux/suspend.h +0 -3
-{
-}
-
 static inline void lock_system_sleep(void) {}
 static inline void unlock_system_sleep(void) {}
 

Index: linux-2.6/arch/x86/power/Makefile
===================================================================

arch/x86/power/Makefile nostackp := $(call cc-option, -fno-stack · line 7

Quoted 4 lines
arch/x86/power/Makefile +0 -1
@@ -4,4 +4,5 @@ nostackp := $(call cc-option, -fno-stack
 CFLAGS_cpu.o := $(nostackp)
 
 obj-$(CONFIG_PM_SLEEP)               += cpu.o
-obj-$(CONFIG_HIBERNATION)    += hibernate_$(BITS).o

hibernate_asm_$(BITS).o

Quoted 39 lines
arch/x86/power/Makefile +2 -0
+obj-$(CONFIG_HIBERNATE_INTERFACE)    += hibernate_$(BITS).o \
+                                             hibernate_asm_$(BITS).o

Index: linux-2.6/kernel/power/main.c
===================================================================

kernel/power/main.c +1 -1
@@ -156,7 +156,7 @@ static ssize_t state_show(struct kobject
                      s += sprintf(s,"%s ", pm_states[i]);
      }
 #endif
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
      s += sprintf(s, "%s\n", "disk");
 #else
      if (s != buf)

Index: linux-2.6/kernel/power/power.h
===================================================================

kernel/power/power.h +3 -3
@@ -13,7 +13,7 @@ struct swsusp_info {
      unsigned long           size;
 } __attribute__((aligned(PAGE_SIZE)));
 
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 /* kernel/power/snapshot.c */
 extern void __init hibernate_image_size_init(void);
 
@@ -53,10 +53,10 @@ extern int hibernation_snapshot(int plat
 extern int hibernation_restore(int platform_mode);
 extern int hibernation_platform_enter(void);
 
-#else /* !CONFIG_HIBERNATION */
+#else /* !CONFIG_HIBERNATE_INTERFACE */
 
 static inline void hibernate_image_size_init(void) {}
-#endif /* !CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */
 
Quoted 10 lines
Quoted 7 lines
kernel/power/power.h +0 -0
 extern int pfn_is_nosave(unsigned long);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
In reply to Ian Campbell
Quoted 21 lines · Ian Campbell

Hi Rafael,

Quoted 18 lines · Rafael J. Wysocki

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

Xen save/restore is going to use hibernate device callbacks for quiescing devices and putting them back to normal operations and it would need to select CONFIG_HIBERNATION for this purpose. However, that also would cause the hibernate interfaces for user space to be enabled, which might confuse user space, because the Xen kernels don't support hibernation. Moreover, it would be wasteful, as it would make the Xen kernels include a substantial amount of code that they would never use.

To address this issue introduce new power management Kconfig option CONFIG_HIBERNATE_INTERFACE, such that the hibernate interfaces for user space and the image-handling code will depend on it and it will select CONFIG_HIBERNATION. Then, Xen save/restore will be able to select CONFIG_HIBERNATION without dragging the entire hibernate code along with it.

Quoted 4 lines
Quoted 1 line

Were you planning to put this forward for 2.6.39 or are you waiting for 2.6.40?

I'm goint to push it for 2.6.39. In fact, I'm going to send the pull request shortly.

Thanks,
Rafael

#5 lore raw
Quoted 22 lines · Rafael J. Wysocki
Quoted 21 lines · Ian Campbell

Hi Rafael,

Quoted 18 lines · Rafael J. Wysocki

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

Xen save/restore is going to use hibernate device callbacks for quiescing devices and putting them back to normal operations and it would need to select CONFIG_HIBERNATION for this purpose. However, that also would cause the hibernate interfaces for user space to be enabled, which might confuse user space, because the Xen kernels don't support hibernation. Moreover, it would be wasteful, as it would make the Xen kernels include a substantial amount of code that they would never use.

To address this issue introduce new power management Kconfig option CONFIG_HIBERNATE_INTERFACE, such that the hibernate interfaces for user space and the image-handling code will depend on it and it will select CONFIG_HIBERNATION. Then, Xen save/restore will be able to select CONFIG_HIBERNATION without dragging the entire hibernate code along with it.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Were you planning to put this forward for 2.6.39 or are you waiting for 2.6.40?

I'm goint to push it for 2.6.39. In fact, I'm going to send the pull request shortly.

Unfortunately Linus didn't like it, so I need to rework it to make him happy.

As a result the patch is not going to go into 2.6.39.

Thanks,
Rafael

#6 lore raw
In reply to Rafael J. Wysocki
Quoted 22 lines · Rafael J. Wysocki
Quoted 21 lines · Ian Campbell

Hi Rafael,

Quoted 18 lines · Rafael J. Wysocki

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

Xen save/restore is going to use hibernate device callbacks for quiescing devices and putting them back to normal operations and it would need to select CONFIG_HIBERNATION for this purpose. However, that also would cause the hibernate interfaces for user space to be enabled, which might confuse user space, because the Xen kernels don't support hibernation. Moreover, it would be wasteful, as it would make the Xen kernels include a substantial amount of code that they would never use.

To address this issue introduce new power management Kconfig option CONFIG_HIBERNATE_INTERFACE, such that the hibernate interfaces for user space and the image-handling code will depend on it and it will select CONFIG_HIBERNATION. Then, Xen save/restore will be able to select CONFIG_HIBERNATION without dragging the entire hibernate code along with it.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Were you planning to put this forward for 2.6.39 or are you waiting for 2.6.40?

I'm goint to push it for 2.6.39. In fact, I'm going to send the pull request shortly.

Unfortunately Linus didn't like it, so I need to rework it to make him happy.

As a result the patch is not going to go into 2.6.39.

Thanks,
Rafael

#7 lore raw
In reply to Ian Campbell
Quoted 21 lines · Ian Campbell

Hi Rafael,

Quoted 18 lines · Rafael J. Wysocki

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

Xen save/restore is going to use hibernate device callbacks for quiescing devices and putting them back to normal operations and it would need to select CONFIG_HIBERNATION for this purpose. However, that also would cause the hibernate interfaces for user space to be enabled, which might confuse user space, because the Xen kernels don't support hibernation. Moreover, it would be wasteful, as it would make the Xen kernels include a substantial amount of code that they would never use.

To address this issue introduce new power management Kconfig option CONFIG_HIBERNATE_INTERFACE, such that the hibernate interfaces for user space and the image-handling code will depend on it and it will select CONFIG_HIBERNATION. Then, Xen save/restore will be able to select CONFIG_HIBERNATION without dragging the entire hibernate code along with it.

Quoted 4 lines
Quoted 1 line

Were you planning to put this forward for 2.6.39 or are you waiting for 2.6.40?

I'm goint to push it for 2.6.39. In fact, I'm going to send the pull request shortly.

Thanks,
Rafael

#8 lore raw
In reply to Rafael J. Wysocki

Hi Rafael,

Quoted 11 lines · Rafael J. Wysocki

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

Xen save/restore is going to use hibernate device callbacks for quiescing devices and putting them back to normal operations and it would need to select CONFIG_HIBERNATION for this purpose. However, that also would cause the hibernate interfaces for user space to be enabled, which might confuse user space, because the Xen kernels don't support hibernation. Moreover, it would be wasteful, as it would make the Xen kernels include a substantial amount of code that they would never use.

Quoted 8 lines

To address this issue introduce new power management Kconfig option CONFIG_HIBERNATE_INTERFACE, such that the hibernate interfaces for user space and the image-handling code will depend on it and it will select CONFIG_HIBERNATION. Then, Xen save/restore will be able to select CONFIG_HIBERNATION without dragging the entire hibernate code along with it.

Were you planning to put this forward for 2.6.39 or are you waiting for 2.6.40?

Quoted 1 line

Shriram,

Is the additional Xen side patch still the same as in <[email protected]> ? Is there anything else which isn't already in upstream?

Ian.

Quoted 142 lines
---
 arch/x86/power/Makefile |    3 ++-
 include/linux/suspend.h |   15 +++++----------
 kernel/power/Kconfig    |    4 ++++
 kernel/power/Makefile   |    4 ++--
 kernel/power/main.c     |    2 +-
 kernel/power/power.h    |    6 +++---
 6 files changed, 17 insertions(+), 17 deletions(-)

Index: linux-2.6/kernel/power/Kconfig
===================================================================

kernel/power/Kconfig +4 -0
@@ -19,8 +19,12 @@ config SUSPEND_FREEZER
 	  Turning OFF this setting is NOT recommended! If in doubt, say Y.
 
 config HIBERNATION
+	bool
+
+config HIBERNATE_INTERFACE
 	bool "Hibernation (aka 'suspend to disk')"
 	depends on SWAP && ARCH_HIBERNATION_POSSIBLE
+	select HIBERNATION
 	select LZO_COMPRESS
 	select LZO_DECOMPRESS
 	---help---

Index: linux-2.6/kernel/power/Makefile
===================================================================

kernel/power/Makefile +2 -2
@@ -6,7 +6,7 @@ obj-$(CONFIG_PM_SLEEP)		+= console.o
 obj-$(CONFIG_FREEZER)		+= process.o
 obj-$(CONFIG_SUSPEND)		+= suspend.o
 obj-$(CONFIG_PM_TEST_SUSPEND)	+= suspend_test.o
-obj-$(CONFIG_HIBERNATION)	+= hibernate.o snapshot.o swap.o user.o \
-				   block_io.o
+obj-$(CONFIG_HIBERNATE_INTERFACE)	+= hibernate.o snapshot.o swap.o \
+						user.o block_io.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o

Index: linux-2.6/include/linux/suspend.h
===================================================================

include/linux/suspend.h +5 -10
@@ -229,7 +229,7 @@ struct platform_hibernation_ops {
 	void (*recover)(void);
 };
 
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
 static inline void __init register_nosave_region(unsigned long b, unsigned long e)
@@ -248,7 +248,9 @@ extern unsigned long get_safe_page(gfp_t
 extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
 extern int hibernate(void);
 extern bool system_entering_hibernation(void);
-#else /* CONFIG_HIBERNATION */
+#else /* !CONFIG_HIBERNATE_INTERFACE */
+static inline void register_nosave_region(unsigned long b, unsigned long e) {}
+static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
@@ -256,7 +258,7 @@ static inline void swsusp_unset_page_fre
 static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {}
 static inline int hibernate(void) { return -ENOSYS; }
 static inline bool system_entering_hibernation(void) { return false; }
-#endif /* CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */
 
 #ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
@@ -298,13 +300,6 @@ static inline bool pm_wakeup_pending(voi
 extern struct mutex pm_mutex;
 
 #ifndef CONFIG_HIBERNATION
-static inline void register_nosave_region(unsigned long b, unsigned long e)
-{
-}
-static inline void register_nosave_region_late(unsigned long b, unsigned long e)
-{
-}
-
 static inline void lock_system_sleep(void) {}
 static inline void unlock_system_sleep(void) {}
 

Index: linux-2.6/arch/x86/power/Makefile
===================================================================

arch/x86/power/Makefile +2 -1
@@ -4,4 +4,5 @@ nostackp := $(call cc-option, -fno-stack
 CFLAGS_cpu.o	:= $(nostackp)
 
 obj-$(CONFIG_PM_SLEEP)		+= cpu.o
-obj-$(CONFIG_HIBERNATION)	+= hibernate_$(BITS).o hibernate_asm_$(BITS).o
+obj-$(CONFIG_HIBERNATE_INTERFACE)	+= hibernate_$(BITS).o \
+						hibernate_asm_$(BITS).o

Index: linux-2.6/kernel/power/main.c
===================================================================

kernel/power/main.c +1 -1
@@ -156,7 +156,7 @@ static ssize_t state_show(struct kobject
 			s += sprintf(s,"%s ", pm_states[i]);
 	}
 #endif
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 	s += sprintf(s, "%s\n", "disk");
 #else
 	if (s != buf)

Index: linux-2.6/kernel/power/power.h
===================================================================

kernel/power/power.h +3 -3
@@ -13,7 +13,7 @@ struct swsusp_info {
 	unsigned long		size;
 } __attribute__((aligned(PAGE_SIZE)));
 
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
 /* kernel/power/snapshot.c */
 extern void __init hibernate_image_size_init(void);
 
@@ -53,10 +53,10 @@ extern int hibernation_snapshot(int plat
 extern int hibernation_restore(int platform_mode);
 extern int hibernation_platform_enter(void);
 
-#else /* !CONFIG_HIBERNATION */
+#else /* !CONFIG_HIBERNATE_INTERFACE */
 
 static inline void hibernate_image_size_init(void) {}
-#endif /* !CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */
 
 extern int pfn_is_nosave(unsigned long);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel