From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shriram Rajagopalan Subject: Re: [linux-pm] [PATCH v3 4/5] PM: Add visible HIBERNATION_INTERFACE and hide HIBERNATION Date: Sat, 19 Mar 2011 18:25:16 -0700 Message-ID: References: <1299906471-31011-1-git-send-email-rshriram@cs.ubc.ca> <201103160153.32080.rjw@sisk.pl> <201103182236.26624.rjw@sisk.pl> Reply-To: rshriram@cs.ubc.ca Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1778976329==" Return-path: In-Reply-To: <201103182236.26624.rjw@sisk.pl> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Rafael J. Wysocki" Cc: linux-pm@lists.linux-foundation.org, xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1778976329== Content-Type: multipart/alternative; boundary=0022152d69f18ca3dd049edfe46d --0022152d69f18ca3dd049edfe46d Content-Type: text/plain; charset=ISO-8859-1 On Fri, Mar 18, 2011 at 2:36 PM, Rafael J. Wysocki wrote: > On Wednesday, March 16, 2011, Rafael J. Wysocki wrote: > > On Tuesday, March 15, 2011, Shriram Rajagopalan wrote: > > > 2011/3/15 Rafael J. Wysocki : > ... > > > > Basically, I can do the patch for you, but that'll take some time. > > Stay tuned. :-) > > The patch below appears to work for me, please check if it works > for you when you put the Xen patch selecting HIBERNATION on top > of it. > > Thanks, > Rafael > > --- > 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 > =================================================================== > --- linux-2.6.orig/kernel/power/Kconfig > +++ 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--- > Index: linux-2.6/kernel/power/Makefile > =================================================================== > --- linux-2.6.orig/kernel/power/Makefile > +++ linux-2.6/kernel/power/Makefile > @@ -5,7 +5,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 > =================================================================== > --- linux-2.6.orig/include/linux/suspend.h > +++ 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) {} > > Index: linux-2.6/arch/x86/power/Makefile > =================================================================== > --- linux-2.6.orig/arch/x86/power/Makefile > +++ 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 > Index: linux-2.6/kernel/power/main.c > =================================================================== > --- linux-2.6.orig/kernel/power/main.c > +++ 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) > Index: linux-2.6/kernel/power/power.h > =================================================================== > --- linux-2.6.orig/kernel/power/power.h > +++ 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); > > > The code compiles perfectly. However, I am not able to test it in my installation (cant seem to boot a PV kernel - nothing to do with your patch). Will respond once I get the boot issue sorted. shriram --0022152d69f18ca3dd049edfe46d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Fri, Mar 18, 2011 at 2:36 PM, Rafael J. Wysoc= ki <rjw@sisk.pl>= wrote:
On Wednesday, March 16, 2011, Rafael J. Wysocki wrote: > On Tuesday, March 15, 2011, Shriram Rajagopalan wrote:
> > 2011/3/15 Rafael J. Wysocki <rj= w@sisk.pl>:
...
>
> Basically, I can do the patch for you, but that'll take some time.=
> Stay tuned. :-)

The patch below appears to work for me, please check if it works
for you when you put the Xen patch selecting HIBERNATION on top
of it.

Thanks,
Rafael

---
=A0arch/x86/power/Makefile | =A0 =A03 ++-
=A0include/linux/suspend.h | =A0 15 +++++----------
=A0kernel/power/Kconfig =A0 =A0| =A0 =A04 ++++
=A0kernel/power/Makefile =A0 | =A0 =A04 ++--
=A0kernel/power/main.c =A0 =A0 | =A0 =A02 +-
=A0kernel/power/power.h =A0 =A0| =A0 =A06 +++---
=A06 files changed, 17 insertions(+), 17 deletions(-)

Index: linux-2.6/kernel/power/Kconfig
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux-2.6.orig/kernel/power/Kconfig
+++ linux-2.6/kernel/power/Kconfig
@@ -19,8 +19,12 @@ config SUSPEND_FREEZER
=A0 =A0 =A0 =A0 =A0Turning OFF this setting is NOT recom= mended! If in doubt, say Y.

=A0config HIBERNATION
+ =A0 =A0 =A0 bool
+
+config HIBERNATE_INTERFACE
=A0 =A0 =A0 =A0bool "Hibernation (aka 'suspend = to disk')"
=A0 =A0 =A0 =A0depends on SWAP && ARCH_HIBERNATION_POSSIBLE<= br> + =A0 =A0 =A0 select HIBERNATION
=A0 =A0 =A0 =A0select LZO_COMPRESS
=A0 =A0 =A0 =A0select LZO_DECOMPRESS
=A0 =A0 =A0 =A0---help---
Index: linux-2.6/kernel/power/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux-2.6.orig/kernel/power/Makefile
+++ linux-2.6/kernel/power/Makefile
@@ -5,7 +5,7 @@ obj-$(CONFIG_PM_SLEEP) =A0 =A0 =A0 =A0 =A0+=3D console.o =A0obj-$(CONFIG_FREEZER) =A0 =A0 =A0 =A0 =A0+=3D process.o
=A0obj-$(CONFIG_SUSPEND) =A0 =A0 =A0 =A0 =A0+=3D suspend.o
=A0obj-$(CONFIG_PM_TEST_SUSPEND) =A0+=3D suspend_test.o
-obj-$(CONFIG_HIBERNATION) =A0 =A0 =A0+=3D hibernate.o snapshot.o swap.o us= er.o \
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0block_= io.o
+obj-$(CONFIG_HIBERNATE_INTERFACE) =A0 =A0 =A0+=3D hibernate.o snapshot.o s= wap.o \
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 user.o block_io.o

=A0obj-$(CONFIG_MAGIC_SYSRQ) =A0 =A0 =A0+=3D poweroff.o
Index: linux-2.6/include/linux/suspend.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux-2.6.orig/include/linux/suspend.h
+++ linux-2.6/include/linux/suspend.h
@@ -229,7 +229,7 @@ struct platform_hibernation_ops {
=A0 =A0 =A0 =A0void (*recover)(void);
=A0};

-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
=A0/* kernel/power/snapshot.c */
=A0extern void __register_nosave_region(unsigned long b, unsigned long e, i= nt km);
=A0static inline void __init register_nosave_region(unsigned long b, unsign= ed long e)
@@ -248,7 +248,9 @@ extern unsigned long get_safe_page(gfp_t
=A0extern void hibernation_set_ops(const struct platform_hibernation_ops *o= ps);
=A0extern int hibernate(void);
=A0extern 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 l= ong e) {}
=A0static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }=
=A0static inline void swsusp_set_page_free(struct page *p) {}
=A0static inline void swsusp_unset_page_free(struct page *p) {}
@@ -256,7 +258,7 @@ static inline void swsusp_unset_page_fre
=A0static inline void hibernation_set_ops(const struct platform_hibernation= _ops *ops) {}
=A0static inline int hibernate(void) { return -ENOSYS; }
=A0static inline bool system_entering_hibernation(void) { return false; } -#endif /* CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */

=A0#ifdef CONFIG_PM_SLEEP
=A0void save_processor_state(void);
@@ -298,13 +300,6 @@ static inline bool pm_wakeup_pending(voi
=A0extern struct mutex pm_mutex;

=A0#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 l= ong e)
-{
-}
-
=A0static inline void lock_system_sleep(void) {}
=A0static inline void unlock_system_sleep(void) {}

Index: linux-2.6/arch/x86/power/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux-2.6.orig/arch/x86/power/Makefile
+++ linux-2.6/arch/x86/power/Makefile
@@ -4,4 +4,5 @@ nostackp :=3D $(call cc-option, -fno-stack
=A0CFLAGS_cpu.o =A0 :=3D $(nostackp)

=A0obj-$(CONFIG_PM_SLEEP) =A0 =A0 =A0 =A0 +=3D cpu.o
-obj-$(CONFIG_HIBERNATION) =A0 =A0 =A0+=3D hibernate_$(BITS).o hibernate_as= m_$(BITS).o
+obj-$(CONFIG_HIBERNATE_INTERFACE) =A0 =A0 =A0+=3D hibernate_$(BITS).o \ + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 hibernate_asm_$(BITS).o
Index: linux-2.6/kernel/power/main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux-2.6.orig/kernel/power/main.c
+++ linux-2.6/kernel/power/main.c
@@ -156,7 +156,7 @@ static ssize_t state_show(struct kobj= ect
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0s += =3D sprintf(s,"%s ", pm_states[i]);
=A0 =A0 =A0 =A0}
=A0#endif
-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
=A0 =A0 =A0 =A0s +=3D sprintf(s, "%s\n", "= ;disk");
=A0#else
=A0 =A0 =A0 =A0if (s !=3D buf)
Index: linux-2.6/kernel/power/power.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- linux-2.6.orig/kernel/power/power.h
+++ linux-2.6/kernel/power/power.h
@@ -13,7 +13,7 @@ struct swsusp_info {
=A0 =A0 =A0 =A0unsigned long =A0 =A0 =A0 =A0 =A0 size;
=A0} __attribute__((aligned(PAGE_SIZE)));

-#ifdef CONFIG_HIBERNATION
+#ifdef CONFIG_HIBERNATE_INTERFACE
=A0/* kernel/power/snapshot.c */
=A0extern void __init hibernate_image_size_init(void);

@@ -53,10 +53,10 @@ extern int hibernation_snapshot(int plat
=A0extern int hibernation_restore(int platform_mode);
=A0extern int hibernation_platform_enter(void);

-#else /* !CONFIG_HIBERNATION */
+#else /* !CONFIG_HIBERNATE_INTERFACE */

=A0static inline void hibernate_image_size_init(void) {}
-#endif /* !CONFIG_HIBERNATION */
+#endif /* !CONFIG_HIBERNATE_INTERFACE */

=A0extern int pfn_is_nosave(unsigned long);


The code compiles perfectly. However, I am not able to t= est it
in my installation (cant seem to boot a PV kernel - nothing to do=
with your patch).
Will respond once I get the boot issue sorted.
shriram
--0022152d69f18ca3dd049edfe46d-- --===============1778976329== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1778976329==--