linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Suspend2][ 0/4] Files shared with swsusp.
@ 2006-06-26 16:46 Nigel Cunningham
  2006-06-26 16:46 ` [Suspend2][ 1/4] [Suspend2] Suspend2 Kconfig modifications Nigel Cunningham
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Nigel Cunningham @ 2006-06-26 16:46 UTC (permalink / raw)
  To: linux-kernel


Modifications to files shared with swsusp. We implement
CONFIG_SUSPEND_SHARED, which is selected by either swsusp
or Suspend2 and causes the parts required by either
implementation to be compiled in. Swsusp's kernel/power
files are compiled in after Suspend2's because Suspend2
recognises swsusp files and ignores them, but swsusp doesn't
recognise Suspend2 signatures and complains about them.

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

* [Suspend2][ 1/4] [Suspend2] Suspend2 Kconfig modifications.
  2006-06-26 16:46 [Suspend2][ 0/4] Files shared with swsusp Nigel Cunningham
@ 2006-06-26 16:46 ` Nigel Cunningham
  2006-06-26 16:46 ` [Suspend2][ 2/4] [Suspend2] kernel/power/Makefile Suspend2 modifications Nigel Cunningham
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Nigel Cunningham @ 2006-06-26 16:46 UTC (permalink / raw)
  To: linux-kernel

Add Suspend2 Kconfig entries to the kernel/power/Kconfig file.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

 kernel/power/Kconfig |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index e8d57d1..cb5475a 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -98,6 +98,67 @@ config SUSPEND_SMP
 	bool
 	depends on HOTPLUG_CPU && X86 && PM
 	default y
+
+config SUSPEND2_CRYPTO
+	bool
+	depends on SUSPEND2 && CRYPTO
+	default y
+
+menuconfig SUSPEND2
+	bool "Suspend2"
+	depends on PM
+	select DYN_PAGEFLAGS
+	select HOTPLUG_CPU if SMP
+	---help---
+	  Suspend2 is the 'new and improved' suspend support.
+	  
+	  See the Suspend2 home page (suspend2.net)
+	  for FAQs, HOWTOs and other documentation.
+
+	comment 'Image Storage (you need at least one writer)'
+		depends on SUSPEND2
+	
+	config SUSPEND2_FILEWRITER
+		bool '  File Writer'
+		depends on SUSPEND2
+		---help---
+		  This option enables support for storing an image in a
+		  simple file. This should be possible, but we're still
+		  testing it.
+
+	config SUSPEND2_SWAPWRITER
+		bool '  Swap Writer'
+		depends on SUSPEND2
+		select SWAP
+		---help---
+		  This option enables support for storing an image in your
+		  swap space.
+
+	comment 'General Options'
+		depends on SUSPEND2
+
+	config SUSPEND2_DEFAULT_RESUME2
+		string '  Default resume device name'
+		depends on SUSPEND2
+		---help---
+		  You normally need to add a resume2= parameter to your lilo.conf or
+		  equivalent. With this option properly set, the kernel has a value
+		  to default. No damage will be done if the value is invalid.
+
+	config SUSPEND2_KEEP_IMAGE
+		bool '  Allow Keep Image Mode'
+		depends on SUSPEND2
+		---help---
+		  This option allows you to keep and image and reuse it. It is intended
+		  __ONLY__ for use with systems where all filesystems are mounted read-
+		  only (kiosks, for example). To use it, compile this option in and boot
+		  normally. Set the KEEP_IMAGE flag in /proc/suspend2 and suspend.
+		  When you resume, the image will not be removed. You will be unable to turn
+		  off swap partitions (assuming you are using the swap writer), but future
+		  suspends simply do a power-down. The image can be updated using the
+		  kernel command line parameter suspend_act= to turn off the keep image
+		  bit. Keep image mode is a little less user friendly on purpose - it
+		  should not be used without thought!
  
 config SUSPEND_SHARED
 	bool

--
Nigel Cunningham		nigel at suspend2 dot net

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

* [Suspend2][ 2/4] [Suspend2] kernel/power/Makefile Suspend2 modifications.
  2006-06-26 16:46 [Suspend2][ 0/4] Files shared with swsusp Nigel Cunningham
  2006-06-26 16:46 ` [Suspend2][ 1/4] [Suspend2] Suspend2 Kconfig modifications Nigel Cunningham
@ 2006-06-26 16:46 ` Nigel Cunningham
  2006-06-26 16:46 ` [Suspend2][ 3/4] [Suspend2] Correct kernel/power/smp.c credit Nigel Cunningham
  2006-06-26 16:46 ` [Suspend2][ 4/4] [Suspend2] Build swsusp lowlevel code for Suspend2 as well Nigel Cunningham
  3 siblings, 0 replies; 6+ messages in thread
From: Nigel Cunningham @ 2006-06-26 16:46 UTC (permalink / raw)
  To: linux-kernel

Add Makefile entries for suspend2 objects.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

 kernel/power/Makefile |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/kernel/power/Makefile b/kernel/power/Makefile
index 01f2230..0d0f132 100644
--- a/kernel/power/Makefile
+++ b/kernel/power/Makefile
@@ -5,9 +5,28 @@ endif
 
 obj-y				:= main.o process.o console.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o disk.o swap.o user.o
 
 obj-$(CONFIG_SUSPEND_SMP)	+= smp.o
 obj-$(CONFIG_SUSPEND_SHARED)	+= snapshot.o
 
+# Order is important for compression and encryption - we
+# compress before encrypting.
+
+suspend_core-objs := io.o pagedir.o prepare_image.o \
+		extent.o suspend.o modules.o \
+		pageflags.o ui.o proc.o \
+		power_off.o atomic_copy.o
+
+#ifdef CONFIG_NET
+suspend_core-objs += storage.o netlink.o
+#endif
+
+obj-$(CONFIG_SUSPEND2)			+= suspend_core.o
+obj-$(CONFIG_SUSPEND2_CRYPTO)		+= compression.o encryption.o
+
+obj-$(CONFIG_SUSPEND2_SWAPWRITER)	+= suspend_block_io.o suspend_swap.o
+obj-$(CONFIG_SUSPEND2_FILEWRITER)	+= suspend_block_io.o suspend_file.o
+
+obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o disk.o swap.o user.o
+
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o

--
Nigel Cunningham		nigel at suspend2 dot net

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

* [Suspend2][ 3/4] [Suspend2] Correct kernel/power/smp.c credit.
  2006-06-26 16:46 [Suspend2][ 0/4] Files shared with swsusp Nigel Cunningham
  2006-06-26 16:46 ` [Suspend2][ 1/4] [Suspend2] Suspend2 Kconfig modifications Nigel Cunningham
  2006-06-26 16:46 ` [Suspend2][ 2/4] [Suspend2] kernel/power/Makefile Suspend2 modifications Nigel Cunningham
@ 2006-06-26 16:46 ` Nigel Cunningham
  2006-06-28 20:48   ` Pavel Machek
  2006-06-26 16:46 ` [Suspend2][ 4/4] [Suspend2] Build swsusp lowlevel code for Suspend2 as well Nigel Cunningham
  3 siblings, 1 reply; 6+ messages in thread
From: Nigel Cunningham @ 2006-06-26 16:46 UTC (permalink / raw)
  To: linux-kernel

Modify kernel/power/smp.c credit to my current address.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

 kernel/power/smp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/power/smp.c b/kernel/power/smp.c
index 5957312..c102e7c 100644
--- a/kernel/power/smp.c
+++ b/kernel/power/smp.c
@@ -2,7 +2,7 @@
  * drivers/power/smp.c - Functions for stopping other CPUs.
  *
  * Copyright 2004 Pavel Machek <pavel@suse.cz>
- * Copyright (C) 2002-2003 Nigel Cunningham <ncunningham@clear.net.nz>
+ * Copyright (C) 2002-2003 Nigel Cunningham <nigel@suspend2.net>
  *
  * This file is released under the GPLv2.
  */

--
Nigel Cunningham		nigel at suspend2 dot net

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

* [Suspend2][ 4/4] [Suspend2] Build swsusp lowlevel code for Suspend2 as well
  2006-06-26 16:46 [Suspend2][ 0/4] Files shared with swsusp Nigel Cunningham
                   ` (2 preceding siblings ...)
  2006-06-26 16:46 ` [Suspend2][ 3/4] [Suspend2] Correct kernel/power/smp.c credit Nigel Cunningham
@ 2006-06-26 16:46 ` Nigel Cunningham
  3 siblings, 0 replies; 6+ messages in thread
From: Nigel Cunningham @ 2006-06-26 16:46 UTC (permalink / raw)
  To: linux-kernel

Suspend2 now uses the same lowlevel code as swsusp. This patch lets that
lowlevel code be built when swsusp is disabled but Suspend2 is enabled.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

 arch/i386/mm/init.c          |    2 +-
 arch/i386/power/Makefile     |    2 +-
 arch/powerpc/kernel/Makefile |    2 +-
 arch/x86_64/kernel/Makefile  |    2 +-
 arch/x86_64/kernel/suspend.c |    4 ++--
 kernel/power/Kconfig         |    5 +++++
 kernel/power/Makefile        |    3 ++-
 kernel/power/snapshot.c      |   17 ++++++++++++++++-
 8 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 3df1371..1678ec4 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -384,7 +384,7 @@ static void __init pagetable_init (void)
 #endif
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_SUSPEND_SHARED
 /*
  * Swap suspend & friends need this for resume because things like the intel-agp
  * driver might have split up a kernel 4MB mapping.
diff --git a/arch/i386/power/Makefile b/arch/i386/power/Makefile
index 8cfa4e8..7f4efb1 100644
--- a/arch/i386/power/Makefile
+++ b/arch/i386/power/Makefile
@@ -1,2 +1,2 @@
 obj-$(CONFIG_PM)		+= cpu.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o
+obj-$(CONFIG_SUSPEND_SHARED)	+= swsusp.o
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 803858e..86eabdc 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -36,7 +36,7 @@ obj64-$(CONFIG_PPC_MULTIPLATFORM) += nvr
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)		+= tau_6xx.o
-obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
+obj32-$(CONFIG_SUSPEND_SHARED)	+= swsusp_32.o
 obj32-$(CONFIG_MODULES)		+= module_32.o
 obj-$(CONFIG_E500)		+= perfmon_fsl_booke.o
 
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index 059c883..81881b5 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_X86_IO_APIC)	+= io_apic.o m
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o crash.o
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_PM)		+= suspend.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
+obj-$(CONFIG_SUSPEND_SHARED)	+= suspend_asm.o
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_GART_IOMMU)	+= pci-gart.o aperture.o
diff --git a/arch/x86_64/kernel/suspend.c b/arch/x86_64/kernel/suspend.c
index ecbd34c..510d369 100644
--- a/arch/x86_64/kernel/suspend.c
+++ b/arch/x86_64/kernel/suspend.c
@@ -141,7 +141,7 @@ void fix_processor_context(void)
 
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_SUSPEND_SHARED
 /* Defined in arch/x86_64/kernel/suspend_asm.S */
 extern int restore_image(void);
 
@@ -220,4 +220,4 @@ int swsusp_arch_resume(void)
 	restore_image();
 	return 0;
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_SUSPEND_SHARED */
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index ce0dfb8..e8d57d1 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -98,3 +98,8 @@ config SUSPEND_SMP
 	bool
 	depends on HOTPLUG_CPU && X86 && PM
 	default y
+ 
+config SUSPEND_SHARED
+	bool
+	depends on SUSPEND2 || SOFTWARE_SUSPEND
+	default y
diff --git a/kernel/power/Makefile b/kernel/power/Makefile
index 8d0af3d..01f2230 100644
--- a/kernel/power/Makefile
+++ b/kernel/power/Makefile
@@ -5,8 +5,9 @@ endif
 
 obj-y				:= main.o process.o console.o
 obj-$(CONFIG_PM_LEGACY)		+= pm.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o disk.o snapshot.o swap.o user.o
+obj-$(CONFIG_SOFTWARE_SUSPEND)	+= swsusp.o disk.o swap.o user.o
 
 obj-$(CONFIG_SUSPEND_SMP)	+= smp.o
+obj-$(CONFIG_SUSPEND_SHARED)	+= snapshot.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 3eeedbb..968b927 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -34,6 +34,13 @@
 
 #include "power.h"
 
+#ifdef CONFIG_SUSPEND2
+#include "pagedir.h"
+
+extern int suspend2_running;
+int suspend_post_context_save(void);
+#endif
+
 struct pbe *pagedir_nosave;
 static unsigned int nr_copy_pages;
 static unsigned int nr_meta_pages;
@@ -177,7 +184,6 @@ static int saveable(struct zone *zone, u
 		return 0;
 
 	page = pfn_to_page(pfn);
-	BUG_ON(PageReserved(page) && PageNosave(page));
 	if (PageNosave(page))
 		return 0;
 	if (PageReserved(page) && pfn_is_nosave(pfn))
@@ -358,6 +364,10 @@ static inline void *alloc_image_page(gfp
 
 unsigned long get_safe_page(gfp_t gfp_mask)
 {
+#ifdef CONFIG_SUSPEND2
+	if (suspend2_running)
+		return suspend_get_nonconflicting_page();
+#endif
 	return (unsigned long)alloc_image_page(gfp_mask, 1);
 }
 
@@ -480,6 +490,11 @@ asmlinkage int swsusp_save(void)
 {
 	unsigned int nr_pages;
 
+#ifdef CONFIG_SUSPEND2
+	if (suspend2_running)
+		return suspend_post_context_save();
+#endif
+
 	pr_debug("swsusp: critical section: \n");
 
 	drain_local_pages();

--
Nigel Cunningham		nigel at suspend2 dot net

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

* Re: [Suspend2][ 3/4] [Suspend2] Correct kernel/power/smp.c credit.
  2006-06-26 16:46 ` [Suspend2][ 3/4] [Suspend2] Correct kernel/power/smp.c credit Nigel Cunningham
@ 2006-06-28 20:48   ` Pavel Machek
  0 siblings, 0 replies; 6+ messages in thread
From: Pavel Machek @ 2006-06-28 20:48 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: linux-kernel

On Tue 2006-06-27 02:46:48, Nigel Cunningham wrote:
> Modify kernel/power/smp.c credit to my current address.

> Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

ACK on this one... if you have similar easy stuff, please retransmit
just that.
							Pavel

> diff --git a/kernel/power/smp.c b/kernel/power/smp.c
> index 5957312..c102e7c 100644
> --- a/kernel/power/smp.c
> +++ b/kernel/power/smp.c
> @@ -2,7 +2,7 @@
>   * drivers/power/smp.c - Functions for stopping other CPUs.
>   *
>   * Copyright 2004 Pavel Machek <pavel@suse.cz>
> - * Copyright (C) 2002-2003 Nigel Cunningham <ncunningham@clear.net.nz>
> + * Copyright (C) 2002-2003 Nigel Cunningham <nigel@suspend2.net>
>   *
>   * This file is released under the GPLv2.
>   */
> 
> --
> Nigel Cunningham		nigel at suspend2 dot net
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

end of thread, other threads:[~2006-06-28 20:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-26 16:46 [Suspend2][ 0/4] Files shared with swsusp Nigel Cunningham
2006-06-26 16:46 ` [Suspend2][ 1/4] [Suspend2] Suspend2 Kconfig modifications Nigel Cunningham
2006-06-26 16:46 ` [Suspend2][ 2/4] [Suspend2] kernel/power/Makefile Suspend2 modifications Nigel Cunningham
2006-06-26 16:46 ` [Suspend2][ 3/4] [Suspend2] Correct kernel/power/smp.c credit Nigel Cunningham
2006-06-28 20:48   ` Pavel Machek
2006-06-26 16:46 ` [Suspend2][ 4/4] [Suspend2] Build swsusp lowlevel code for Suspend2 as well Nigel Cunningham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).