Re: [PATCH] Preserve hibenate-system-image on startup

2005-07-20 Thread Nigel Cunningham
Hi.

On Wed, 2005-07-20 at 20:54, Hiroyuki Machida wrote:
> Hi,
> 
> 
> With this function, system needs to mount read-write file systems on
> every boot cycle, due to avoid inconsistency between FS and memory.
> How did you address this problem? Did kernel check RW FS remained as
> mounted on boot up or hibernate time ?

You're right. We don't seek to address this problem, just document
clearly that filesystems in use when creating the image need to be
mounted readonly. You can of course mount another filesystem read/write
while the system is up.

> I think I need to discuss with you at San Jose at the beginning of 
> this year.

Yes, I think we did meet. Nice to talk to you again.

Regards,

Nigel

> 
> Regards,
> Hiroyuki Machida
> 
> Nigel Cunningham wrote:
> > Hi.
> > 
> > We've had this feature in Suspend2 for a couple of years and I can
> > confirm that the approach works, provided that the on-disk filesystem
> > remains unchanged throughout this. (Useful mainly for kiosks etc).
> > 
> > This is not to say that I've reviewed the code below for correctness.
> > 
> > Regards,
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
-- 
Evolution.
Enumerate the requirements.
Consider the interdependencies.
Calculate the probabilities.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Preserve hibenate-system-image on startup

2005-07-20 Thread Hiroyuki Machida
Hi,


With this function, system needs to mount read-write file systems on
every boot cycle, due to avoid inconsistency between FS and memory.
How did you address this problem? Did kernel check RW FS remained as
mounted on boot up or hibernate time ?


I think I need to discuss with you at San Jose at the beginning of 
this year.


Regards,
Hiroyuki Machida

Nigel Cunningham wrote:
> Hi.
> 
> We've had this feature in Suspend2 for a couple of years and I can
> confirm that the approach works, provided that the on-disk filesystem
> remains unchanged throughout this. (Useful mainly for kiosks etc).
> 
> This is not to say that I've reviewed the code below for correctness.
> 
> Regards,

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Preserve hibenate-system-image on startup

2005-07-20 Thread Hiroyuki Machida
Hi,


With this function, system needs to mount read-write file systems on
every boot cycle, due to avoid inconsistency between FS and memory.
How did you address this problem? Did kernel check RW FS remained as
mounted on boot up or hibernate time ?


I think I need to discuss with you at San Jose at the beginning of 
this year.


Regards,
Hiroyuki Machida

Nigel Cunningham wrote:
 Hi.
 
 We've had this feature in Suspend2 for a couple of years and I can
 confirm that the approach works, provided that the on-disk filesystem
 remains unchanged throughout this. (Useful mainly for kiosks etc).
 
 This is not to say that I've reviewed the code below for correctness.
 
 Regards,

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Preserve hibenate-system-image on startup

2005-07-20 Thread Nigel Cunningham
Hi.

On Wed, 2005-07-20 at 20:54, Hiroyuki Machida wrote:
 Hi,
 
 
 With this function, system needs to mount read-write file systems on
 every boot cycle, due to avoid inconsistency between FS and memory.
 How did you address this problem? Did kernel check RW FS remained as
 mounted on boot up or hibernate time ?

You're right. We don't seek to address this problem, just document
clearly that filesystems in use when creating the image need to be
mounted readonly. You can of course mount another filesystem read/write
while the system is up.

 I think I need to discuss with you at San Jose at the beginning of 
 this year.

Yes, I think we did meet. Nice to talk to you again.

Regards,

Nigel

 
 Regards,
 Hiroyuki Machida
 
 Nigel Cunningham wrote:
  Hi.
  
  We've had this feature in Suspend2 for a couple of years and I can
  confirm that the approach works, provided that the on-disk filesystem
  remains unchanged throughout this. (Useful mainly for kiosks etc).
  
  This is not to say that I've reviewed the code below for correctness.
  
  Regards,
 
 -
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
-- 
Evolution.
Enumerate the requirements.
Consider the interdependencies.
Calculate the probabilities.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Preserve hibenate-system-image on startup

2005-07-19 Thread Nigel Cunningham
Hi.

We've had this feature in Suspend2 for a couple of years and I can
confirm that the approach works, provided that the on-disk filesystem
remains unchanged throughout this. (Useful mainly for kiosks etc).

This is not to say that I've reviewed the code below for correctness.

Regards,

Nigel

On Sun, 2005-07-17 at 16:26, Hiroyuki Machida wrote:
> We are now investigating fast startup/shutdown using
> 2.6 kernel PM functions.
> 
> An attached patch enables kernel to preserve system image
> on startup, to implement "Snapshot boot"[EMAIL PROTECTED] wrote:
> Conventionally system image will be broken after startup.
> 
> Snapshot boot uses un-hibernate from a permanent system image for
> startup. During shutdown, does a conventional shutdown without
> saving a system image.
> 
> We'll explain concept and initial work at OLS. So if you have
> interest, we can talk with you at Ottawa.
> 
> Thanks,
> Hiroyuki Machida
> 
> ---
> 
> This patch enables preserving swsuspend system image over boot cycle, 
> against 2.6.12
> 
> Signed-off-by: Hiroyui Machida <[EMAIL PROTECTED]> for CELF
> 
> -
> Index: alp-linux--dev-2-6-12--1.7/kernel/power/Kconfig
> ===
> --- alp-linux--dev-2-6-12--1.7.orig/kernel/power/Kconfig  2005-07-15 
> 14:59:20.0 -0400
> +++ alp-linux--dev-2-6-12--1.7/kernel/power/Kconfig   2005-07-16 
> 00:43:31.42000 -0400
> @@ -84,6 +84,20 @@
> suspended image to. It will simply pick the first available swap 
> device.
>  
> +config PRESERVE_SWSUSP_IMAGE
> + bool "Preserve swsuspend image"
> + depends on SOFTWARE_SUSPEND
> + default n
> + ---help---
> +   Useally boot with swsup destories the swsusp image.
> +   This function enables to preserve swsup image over boot cycle. 
> +   Default behavior is not chaged even this configuration turned on.
> +
> +   To preseve swsusp image, specify following option to command line;
> +
> + prsv-img
> +
> +
>  config DEFERRED_RESUME
>   bool "Deferred resume"
>   depends on PM
> Index: alp-linux--dev-2-6-12--1.7/kernel/power/disk.c
> ===
> --- alp-linux--dev-2-6-12--1.7.orig/kernel/power/disk.c   2005-07-16 
> 00:43:02.99000 -0400
> +++ alp-linux--dev-2-6-12--1.7/kernel/power/disk.c2005-07-16 
> 01:01:42.22000 -0400
> @@ -29,10 +29,29 @@
>  extern void swsusp_close(void);
>  extern int swsusp_resume(void);
>  extern int swsusp_free(void);
> +extern void dump_pagedir_nosave(void);
>  #ifdef   CONFIG_SAFE_SUSPEND
>  extern int suspend_remount(void);
>  extern int resume_remount(void);
>  #endif
> +#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
> +extern int preserve_swsusp_image;
> +extern dev_t swsusp_resume_device_nosave __nosavedata;
> +extern int swsusp_swap_rdonly(dev_t);
> +extern int swsusp_swap_off(dev_t);
> +#else
> +#define preserve_swsusp_image 0
> +#define swsusp_resume_device_nosave 0
> +static inline int swsusp_swap_rdonly(dev_t dev)
> +{
> + return 0;
> +}
> +static inline int swsusp_swap_off(dev_t dev)
> +{
> + return 0;
> +}
> +#endif
> +
>  
> 
>  static int noresume = 0;
> @@ -135,6 +154,26 @@
>   pm_restore_console();
>  }
>  
> +#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
> +void finish_in_resume(void)
> +{
> + device_resume();
> + platform_finish();
> + enable_nonboot_cpus();
> + thaw_processes();
> + if (preserve_swsusp_image) {
> + swsusp_swap_off(swsusp_resume_device_nosave);
> + }
> + pm_restore_console();
> +}
> +#else
> +void finish_in_resume(void)
> +{
> + finish();
> +}
> +#endif
> +
> +
>  extern atomic_t on_suspend;   /* See refrigerator() */
>  
>  static int prepare_processes(void)
> @@ -234,8 +273,15 @@
>   error = swsusp_write();
>   if (!error)
>   power_down(pm_disk_mode);
> - } else
> + } else  {
>   pr_debug("PM: Image restored successfully.\n");
> + if (preserve_swsusp_image) {
> + swsusp_swap_rdonly(swsusp_resume_device_nosave);
> + }
> + swsusp_free();
> + finish_in_resume();
> + return 0;
> + }
>   swsusp_free();
>   Done:
>   finish();
> Index: alp-linux--dev-2-6-12--1.7/kernel/power/swsusp.c
> ===
> --- alp-linux--dev-2-6-12--1.7.orig/kernel/power/swsusp.c 2005-07-16 
> 00:43:03.0 -0400
> +++ alp-linux--dev-2-6-12--1.7/kernel/power/swsusp.c  2005-07-16 
> 00:56:22.17000 -0400
> @@ -128,6 +128,11 @@
>  
>  static struct swsusp_info swsusp_info;
>  
> +#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
> +dev_t swsusp_resume_device_nosave __nosavedata;
> +struct swsusp_header swsusp_header_nosave __nosavedata ;
> +#endif
> +
>  /*
>   * XXX: We try to keep some more pages free so that I/O operations succeed
>   * without 

Re: [PATCH] Preserve hibenate-system-image on startup

2005-07-19 Thread Nigel Cunningham
Hi.

We've had this feature in Suspend2 for a couple of years and I can
confirm that the approach works, provided that the on-disk filesystem
remains unchanged throughout this. (Useful mainly for kiosks etc).

This is not to say that I've reviewed the code below for correctness.

Regards,

Nigel

On Sun, 2005-07-17 at 16:26, Hiroyuki Machida wrote:
 We are now investigating fast startup/shutdown using
 2.6 kernel PM functions.
 
 An attached patch enables kernel to preserve system image
 on startup, to implement Snapshot boot[EMAIL PROTECTED] wrote:
 Conventionally system image will be broken after startup.
 
 Snapshot boot uses un-hibernate from a permanent system image for
 startup. During shutdown, does a conventional shutdown without
 saving a system image.
 
 We'll explain concept and initial work at OLS. So if you have
 interest, we can talk with you at Ottawa.
 
 Thanks,
 Hiroyuki Machida
 
 ---
 
 This patch enables preserving swsuspend system image over boot cycle, 
 against 2.6.12
 
 Signed-off-by: Hiroyui Machida [EMAIL PROTECTED] for CELF
 
 -
 Index: alp-linux--dev-2-6-12--1.7/kernel/power/Kconfig
 ===
 --- alp-linux--dev-2-6-12--1.7.orig/kernel/power/Kconfig  2005-07-15 
 14:59:20.0 -0400
 +++ alp-linux--dev-2-6-12--1.7/kernel/power/Kconfig   2005-07-16 
 00:43:31.42000 -0400
 @@ -84,6 +84,20 @@
 suspended image to. It will simply pick the first available swap 
 device.
  
 +config PRESERVE_SWSUSP_IMAGE
 + bool Preserve swsuspend image
 + depends on SOFTWARE_SUSPEND
 + default n
 + ---help---
 +   Useally boot with swsup destories the swsusp image.
 +   This function enables to preserve swsup image over boot cycle. 
 +   Default behavior is not chaged even this configuration turned on.
 +
 +   To preseve swsusp image, specify following option to command line;
 +
 + prsv-img
 +
 +
  config DEFERRED_RESUME
   bool Deferred resume
   depends on PM
 Index: alp-linux--dev-2-6-12--1.7/kernel/power/disk.c
 ===
 --- alp-linux--dev-2-6-12--1.7.orig/kernel/power/disk.c   2005-07-16 
 00:43:02.99000 -0400
 +++ alp-linux--dev-2-6-12--1.7/kernel/power/disk.c2005-07-16 
 01:01:42.22000 -0400
 @@ -29,10 +29,29 @@
  extern void swsusp_close(void);
  extern int swsusp_resume(void);
  extern int swsusp_free(void);
 +extern void dump_pagedir_nosave(void);
  #ifdef   CONFIG_SAFE_SUSPEND
  extern int suspend_remount(void);
  extern int resume_remount(void);
  #endif
 +#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
 +extern int preserve_swsusp_image;
 +extern dev_t swsusp_resume_device_nosave __nosavedata;
 +extern int swsusp_swap_rdonly(dev_t);
 +extern int swsusp_swap_off(dev_t);
 +#else
 +#define preserve_swsusp_image 0
 +#define swsusp_resume_device_nosave 0
 +static inline int swsusp_swap_rdonly(dev_t dev)
 +{
 + return 0;
 +}
 +static inline int swsusp_swap_off(dev_t dev)
 +{
 + return 0;
 +}
 +#endif
 +
  
 
  static int noresume = 0;
 @@ -135,6 +154,26 @@
   pm_restore_console();
  }
  
 +#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
 +void finish_in_resume(void)
 +{
 + device_resume();
 + platform_finish();
 + enable_nonboot_cpus();
 + thaw_processes();
 + if (preserve_swsusp_image) {
 + swsusp_swap_off(swsusp_resume_device_nosave);
 + }
 + pm_restore_console();
 +}
 +#else
 +void finish_in_resume(void)
 +{
 + finish();
 +}
 +#endif
 +
 +
  extern atomic_t on_suspend;   /* See refrigerator() */
  
  static int prepare_processes(void)
 @@ -234,8 +273,15 @@
   error = swsusp_write();
   if (!error)
   power_down(pm_disk_mode);
 - } else
 + } else  {
   pr_debug(PM: Image restored successfully.\n);
 + if (preserve_swsusp_image) {
 + swsusp_swap_rdonly(swsusp_resume_device_nosave);
 + }
 + swsusp_free();
 + finish_in_resume();
 + return 0;
 + }
   swsusp_free();
   Done:
   finish();
 Index: alp-linux--dev-2-6-12--1.7/kernel/power/swsusp.c
 ===
 --- alp-linux--dev-2-6-12--1.7.orig/kernel/power/swsusp.c 2005-07-16 
 00:43:03.0 -0400
 +++ alp-linux--dev-2-6-12--1.7/kernel/power/swsusp.c  2005-07-16 
 00:56:22.17000 -0400
 @@ -128,6 +128,11 @@
  
  static struct swsusp_info swsusp_info;
  
 +#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
 +dev_t swsusp_resume_device_nosave __nosavedata;
 +struct swsusp_header swsusp_header_nosave __nosavedata ;
 +#endif
 +
  /*
   * XXX: We try to keep some more pages free so that I/O operations succeed
   * without paging. Might this be more?
 @@ -139,6 +144,24 @@
  #define PAGES_FOR_IO 512
  #endif
  
 +#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
 +int preserve_swsusp_image=0;
 +static 

Re: [PATCH] Preserve hibenate-system-image on startup

2005-07-18 Thread Pavel Machek
Hi!

> We are now investigating fast startup/shutdown using
> 2.6 kernel PM functions.
> 
> An attached patch enables kernel to preserve system image
> on startup, to implement "Snapshot boot"[EMAIL PROTECTED] wrote:
> Conventionally system image will be broken after startup.
> 
> Snapshot boot uses un-hibernate from a permanent system image for
> startup. During shutdown, does a conventional shutdown without
> saving a system image.
> 
> We'll explain concept and initial work at OLS. So if you have
> interest, we can talk with you at Ottawa.

Interesting

> +config PRESERVE_SWSUSP_IMAGE
> + bool "Preserve swsuspend image"
> + depends on SOFTWARE_SUSPEND
> + default n
> + ---help---
> +   Useally boot with swsup destories the swsusp image.
> +   This function enables to preserve swsup image over boot cycle. 
> +   Default behavior is not chaged even this configuration turned on.
> +
> +   To preseve swsusp image, specify following option to command line;
> +
> + prsv-img

You are missing "eeeae" here.

> +}
> +
> +/**
> + * swsusp_swpoff -  Turn off swap and set signature for swsusp image
 ~~
missing "a".

In general, the patch looks a bit too long, given it only needs to
comment out one write...
Pavel

-- 
teflon -- maybe it is a trademark, but it should not be.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Preserve hibenate-system-image on startup

2005-07-18 Thread Pavel Machek
Hi!

 We are now investigating fast startup/shutdown using
 2.6 kernel PM functions.
 
 An attached patch enables kernel to preserve system image
 on startup, to implement Snapshot boot[EMAIL PROTECTED] wrote:
 Conventionally system image will be broken after startup.
 
 Snapshot boot uses un-hibernate from a permanent system image for
 startup. During shutdown, does a conventional shutdown without
 saving a system image.
 
 We'll explain concept and initial work at OLS. So if you have
 interest, we can talk with you at Ottawa.

Interesting

 +config PRESERVE_SWSUSP_IMAGE
 + bool Preserve swsuspend image
 + depends on SOFTWARE_SUSPEND
 + default n
 + ---help---
 +   Useally boot with swsup destories the swsusp image.
 +   This function enables to preserve swsup image over boot cycle. 
 +   Default behavior is not chaged even this configuration turned on.
 +
 +   To preseve swsusp image, specify following option to command line;
 +
 + prsv-img

You are missing eeeae here.

 +}
 +
 +/**
 + * swsusp_swpoff -  Turn off swap and set signature for swsusp image
 ~~
missing a.

In general, the patch looks a bit too long, given it only needs to
comment out one write...
Pavel

-- 
teflon -- maybe it is a trademark, but it should not be.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Preserve hibenate-system-image on startup

2005-07-17 Thread Hiroyuki Machida

We are now investigating fast startup/shutdown using
2.6 kernel PM functions.

An attached patch enables kernel to preserve system image
on startup, to implement "Snapshot boot"[EMAIL PROTECTED] wrote:
Conventionally system image will be broken after startup.

Snapshot boot uses un-hibernate from a permanent system image for
startup. During shutdown, does a conventional shutdown without
saving a system image.

We'll explain concept and initial work at OLS. So if you have
interest, we can talk with you at Ottawa.

Thanks,
Hiroyuki Machida

---

This patch enables preserving swsuspend system image over boot cycle, 
against 2.6.12

Signed-off-by: Hiroyui Machida <[EMAIL PROTECTED]> for CELF

-
Index: alp-linux--dev-2-6-12--1.7/kernel/power/Kconfig
===
--- alp-linux--dev-2-6-12--1.7.orig/kernel/power/Kconfig2005-07-15 
14:59:20.0 -0400
+++ alp-linux--dev-2-6-12--1.7/kernel/power/Kconfig 2005-07-16 
00:43:31.42000 -0400
@@ -84,6 +84,20 @@
  suspended image to. It will simply pick the first available swap 
  device.
 
+config PRESERVE_SWSUSP_IMAGE
+   bool "Preserve swsuspend image"
+   depends on SOFTWARE_SUSPEND
+   default n
+   ---help---
+ Useally boot with swsup destories the swsusp image.
+ This function enables to preserve swsup image over boot cycle. 
+ Default behavior is not chaged even this configuration turned on.
+
+ To preseve swsusp image, specify following option to command line;
+
+   prsv-img
+
+
 config DEFERRED_RESUME
bool "Deferred resume"
depends on PM
Index: alp-linux--dev-2-6-12--1.7/kernel/power/disk.c
===
--- alp-linux--dev-2-6-12--1.7.orig/kernel/power/disk.c 2005-07-16 
00:43:02.99000 -0400
+++ alp-linux--dev-2-6-12--1.7/kernel/power/disk.c  2005-07-16 
01:01:42.22000 -0400
@@ -29,10 +29,29 @@
 extern void swsusp_close(void);
 extern int swsusp_resume(void);
 extern int swsusp_free(void);
+extern void dump_pagedir_nosave(void);
 #ifdef CONFIG_SAFE_SUSPEND
 extern int suspend_remount(void);
 extern int resume_remount(void);
 #endif
+#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
+extern int preserve_swsusp_image;
+extern dev_t swsusp_resume_device_nosave __nosavedata;
+extern int swsusp_swap_rdonly(dev_t);
+extern int swsusp_swap_off(dev_t);
+#else
+#define preserve_swsusp_image 0
+#define swsusp_resume_device_nosave 0
+static inline int swsusp_swap_rdonly(dev_t dev)
+{
+   return 0;
+}
+static inline int swsusp_swap_off(dev_t dev)
+{
+   return 0;
+}
+#endif
+
 
 
 static int noresume = 0;
@@ -135,6 +154,26 @@
pm_restore_console();
 }
 
+#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
+void finish_in_resume(void)
+{
+   device_resume();
+   platform_finish();
+   enable_nonboot_cpus();
+   thaw_processes();
+   if (preserve_swsusp_image) {
+   swsusp_swap_off(swsusp_resume_device_nosave);
+   }
+   pm_restore_console();
+}
+#else
+void finish_in_resume(void)
+{
+   finish();
+}
+#endif
+
+
 extern atomic_t on_suspend;   /* See refrigerator() */
 
 static int prepare_processes(void)
@@ -234,8 +273,15 @@
error = swsusp_write();
if (!error)
power_down(pm_disk_mode);
-   } else
+   } else  {
pr_debug("PM: Image restored successfully.\n");
+   if (preserve_swsusp_image) {
+   swsusp_swap_rdonly(swsusp_resume_device_nosave);
+   }
+   swsusp_free();
+   finish_in_resume();
+   return 0;
+   }
swsusp_free();
  Done:
finish();
Index: alp-linux--dev-2-6-12--1.7/kernel/power/swsusp.c
===
--- alp-linux--dev-2-6-12--1.7.orig/kernel/power/swsusp.c   2005-07-16 
00:43:03.0 -0400
+++ alp-linux--dev-2-6-12--1.7/kernel/power/swsusp.c2005-07-16 
00:56:22.17000 -0400
@@ -128,6 +128,11 @@
 
 static struct swsusp_info swsusp_info;
 
+#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
+dev_t swsusp_resume_device_nosave __nosavedata;
+struct swsusp_header swsusp_header_nosave __nosavedata ;
+#endif
+
 /*
  * XXX: We try to keep some more pages free so that I/O operations succeed
  * without paging. Might this be more?
@@ -139,6 +144,24 @@
 #define PAGES_FOR_IO   512
 #endif
 
+#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
+int preserve_swsusp_image=0;
+static  int __init preserve_swsusp_image_setup(char *str)
+{
+   if (*str)
+   return 0;
+   preserve_swsusp_image = 1;
+   return 1;
+}
+#else
+static  int __init preserve_swsusp_image_setup(char *str)
+{
+   return 0;
+}
+#endif
+
+__setup("prsv-img", preserve_swsusp_image_setup);
+
 /*
  * Saving part...
  */
@@ -1250,6 +1273,53 @@
return error;
 }
 
+#ifdef 

[PATCH] Preserve hibenate-system-image on startup

2005-07-17 Thread Hiroyuki Machida

We are now investigating fast startup/shutdown using
2.6 kernel PM functions.

An attached patch enables kernel to preserve system image
on startup, to implement Snapshot boot[EMAIL PROTECTED] wrote:
Conventionally system image will be broken after startup.

Snapshot boot uses un-hibernate from a permanent system image for
startup. During shutdown, does a conventional shutdown without
saving a system image.

We'll explain concept and initial work at OLS. So if you have
interest, we can talk with you at Ottawa.

Thanks,
Hiroyuki Machida

---

This patch enables preserving swsuspend system image over boot cycle, 
against 2.6.12

Signed-off-by: Hiroyui Machida [EMAIL PROTECTED] for CELF

-
Index: alp-linux--dev-2-6-12--1.7/kernel/power/Kconfig
===
--- alp-linux--dev-2-6-12--1.7.orig/kernel/power/Kconfig2005-07-15 
14:59:20.0 -0400
+++ alp-linux--dev-2-6-12--1.7/kernel/power/Kconfig 2005-07-16 
00:43:31.42000 -0400
@@ -84,6 +84,20 @@
  suspended image to. It will simply pick the first available swap 
  device.
 
+config PRESERVE_SWSUSP_IMAGE
+   bool Preserve swsuspend image
+   depends on SOFTWARE_SUSPEND
+   default n
+   ---help---
+ Useally boot with swsup destories the swsusp image.
+ This function enables to preserve swsup image over boot cycle. 
+ Default behavior is not chaged even this configuration turned on.
+
+ To preseve swsusp image, specify following option to command line;
+
+   prsv-img
+
+
 config DEFERRED_RESUME
bool Deferred resume
depends on PM
Index: alp-linux--dev-2-6-12--1.7/kernel/power/disk.c
===
--- alp-linux--dev-2-6-12--1.7.orig/kernel/power/disk.c 2005-07-16 
00:43:02.99000 -0400
+++ alp-linux--dev-2-6-12--1.7/kernel/power/disk.c  2005-07-16 
01:01:42.22000 -0400
@@ -29,10 +29,29 @@
 extern void swsusp_close(void);
 extern int swsusp_resume(void);
 extern int swsusp_free(void);
+extern void dump_pagedir_nosave(void);
 #ifdef CONFIG_SAFE_SUSPEND
 extern int suspend_remount(void);
 extern int resume_remount(void);
 #endif
+#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
+extern int preserve_swsusp_image;
+extern dev_t swsusp_resume_device_nosave __nosavedata;
+extern int swsusp_swap_rdonly(dev_t);
+extern int swsusp_swap_off(dev_t);
+#else
+#define preserve_swsusp_image 0
+#define swsusp_resume_device_nosave 0
+static inline int swsusp_swap_rdonly(dev_t dev)
+{
+   return 0;
+}
+static inline int swsusp_swap_off(dev_t dev)
+{
+   return 0;
+}
+#endif
+
 
 
 static int noresume = 0;
@@ -135,6 +154,26 @@
pm_restore_console();
 }
 
+#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
+void finish_in_resume(void)
+{
+   device_resume();
+   platform_finish();
+   enable_nonboot_cpus();
+   thaw_processes();
+   if (preserve_swsusp_image) {
+   swsusp_swap_off(swsusp_resume_device_nosave);
+   }
+   pm_restore_console();
+}
+#else
+void finish_in_resume(void)
+{
+   finish();
+}
+#endif
+
+
 extern atomic_t on_suspend;   /* See refrigerator() */
 
 static int prepare_processes(void)
@@ -234,8 +273,15 @@
error = swsusp_write();
if (!error)
power_down(pm_disk_mode);
-   } else
+   } else  {
pr_debug(PM: Image restored successfully.\n);
+   if (preserve_swsusp_image) {
+   swsusp_swap_rdonly(swsusp_resume_device_nosave);
+   }
+   swsusp_free();
+   finish_in_resume();
+   return 0;
+   }
swsusp_free();
  Done:
finish();
Index: alp-linux--dev-2-6-12--1.7/kernel/power/swsusp.c
===
--- alp-linux--dev-2-6-12--1.7.orig/kernel/power/swsusp.c   2005-07-16 
00:43:03.0 -0400
+++ alp-linux--dev-2-6-12--1.7/kernel/power/swsusp.c2005-07-16 
00:56:22.17000 -0400
@@ -128,6 +128,11 @@
 
 static struct swsusp_info swsusp_info;
 
+#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
+dev_t swsusp_resume_device_nosave __nosavedata;
+struct swsusp_header swsusp_header_nosave __nosavedata ;
+#endif
+
 /*
  * XXX: We try to keep some more pages free so that I/O operations succeed
  * without paging. Might this be more?
@@ -139,6 +144,24 @@
 #define PAGES_FOR_IO   512
 #endif
 
+#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
+int preserve_swsusp_image=0;
+static  int __init preserve_swsusp_image_setup(char *str)
+{
+   if (*str)
+   return 0;
+   preserve_swsusp_image = 1;
+   return 1;
+}
+#else
+static  int __init preserve_swsusp_image_setup(char *str)
+{
+   return 0;
+}
+#endif
+
+__setup(prsv-img, preserve_swsusp_image_setup);
+
 /*
  * Saving part...
  */
@@ -1250,6 +1273,53 @@
return error;
 }
 
+#ifdef CONFIG_PRESERVE_SWSUSP_IMAGE
+/**