Skip to contentSkip to conversation

Modules support.

PATCH In review Nigel Cunningham 39 participants 429 messages Feb 1, 2006 – Feb 27, 2006 10 messages not in the archive Page 2 of 2

Subsystems (20)
lore
Share & tools
lore
#256 lore raw

suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

In reply to Nigel Cunningham

Hi!

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

The only con I see is the complexity of the code, but then again, Nigel

..but thats a big con.

It's fud. Hopefully as I post more suspend2 patches to LKML, people will see that Suspend2 is simpler than what you are planning.

Well, good luck with that. But since you claimed I'm spreading FUD, I think I'll have to go through your patch.

Ouch, it is 500KB, 19K lines. How can you claim it is not complex?!

Lets see what can be done in userspace from that big patch.

arch/arm/kernel/signal.c +1 -1
diff -ruN linux-2.6.15-1/arch/arm/kernel/signal.c build-2.6.15.1/arch/arm/kernel/signal.c
@@ -637,7 +637,7 @@
 	if (!user_mode(regs))
 		return 0;
 
-	if (try_to_freeze())
+	if (try_todo_list())
 		goto no_signal;
 
 	if (current->ptrace & PT_SINGLESTEP)

Unrelated to suspend2; either push it or drop it. [There are more such changes, even for architectures you do not support suspend on... or do you support suspend on h8300?]

diff -ruN linux-2.6.15-1/arch/frv/kernel/signal.c build-2.6.15.1/arch/frv/kernel/signal.c diff -ruN linux-2.6.15-1/arch/h8300/kernel/signal.c build-2.6.15.1/arch/h8300/kernel/signal.c diff -ruN linux-2.6.15-1/arch/i386/kernel/io_apic.c build-2.6.15.1/arch/i386/kernel/io_apic.c diff -ruN linux-2.6.15-1/arch/i386/kernel/signal.c build-2.6.15.1/arch/i386/kernel/signal.c

Same here.

diff -ruN linux-2.6.15-1/arch/arm/mm/init.c build-2.6.15.1/arch/arm/mm/init.c

Ok, so you support arm.

arch/i386/kernel/time.c +10 -5
diff -ruN linux-2.6.15-1/arch/i386/kernel/time.c build-2.6.15.1/arch/i386/kernel/time.c
@@ -372,7 +372,8 @@
 	mod_timer(&sync_cmos_timer, jiffies + 1);
 }
 
-static long clock_cmos_diff, sleep_start;
+static long clock_cmos_diff;
+static unsigned long sleep_start;
 
 static struct timer_opts *last_timer;
 static int timer_suspend(struct sys_device *dev, pm_message_t state)
@@ -380,9 +381,11 @@
 	/*
 	 * Estimate time zone so that set_time can update the clock
 	 */
-	clock_cmos_diff = -get_cmos_time();
+	long cmos_time = __get_cmos_time();
+	
+	clock_cmos_diff = -cmos_time;
 	clock_cmos_diff += get_seconds();
-	sleep_start = get_cmos_time();
+	sleep_start = cmos_time;
 	last_timer = cur_timer;
 	cur_timer = &timer_none;
 	if (last_timer->suspend)
@@ -395,14 +398,16 @@
 	unsigned long flags;
 	unsigned long sec;
 	unsigned long sleep_length;
+	unsigned long cmos_time;
 
 #ifdef CONFIG_HPET_TIMER
 	if (is_hpet_enabled())
 		hpet_reenable();
 #endif
+	cmos_time = get_cmos_time();
+	sec = cmos_time + clock_cmos_diff;
+	sleep_length = (cmos_time - sleep_start) * HZ;
 	setup_pit_timer();
-	sec = get_cmos_time() + clock_cmos_diff;
-	sleep_length = (get_cmos_time() - sleep_start) * HZ;
 	write_seqlock_irqsave(&xtime_lock, flags);
 	xtime.tv_sec = sec;
 	xtime.tv_nsec = 0;

What problem does it solve? Do you want it in mainline? Unrelated to suspend2.

diff -ruN linux-2.6.15-1/arch/i386/mm/init.c build-2.6.15.1/arch/i386/mm/init.c
diff -ruN linux-2.6.15-1/arch/m32r/kernel/signal.c build-2.6.15.1/arch/m32r/kernel/signal.c diff -ruN linux-2.6.15-1/arch/mips/kernel/irixsig.c build-2.6.15.1/arch/mips/kernel/irixsig.c diff -ruN linux-2.6.15-1/arch/mips/kernel/signal32.c build-2.6.15.1/arch/mips/kernel/signal32.c diff -ruN linux-2.6.15-1/arch/powerpc/kernel/signal_32.c build-2.6.15.1/arch/powerpc/kernel/signal_32.c diff -ruN linux-2.6.15-1/arch/ppc/mm/init.c build-2.6.15.1/arch/ppc/mm/init.c
diff -ruN linux-2.6.15-1/arch/ppc/platforms/pmac_feature.c build-2.6.15.1/arch/ppc/platforms/pmac_feature.c diff -ruN linux-2.6.15-1/arch/sh/kernel/signal.c build-2.6.15.1/arch/sh/kernel/signal.c diff -ruN linux-2.6.15-1/arch/sh64/kernel/signal.c build-2.6.15.1/arch/sh64/kernel/signal.c

arch/x86_64/kernel/asm-offsets.c +2 -0
diff -ruN linux-2.6.15-1/arch/x86_64/kernel/asm-offsets.c build-2.6.15.1/arch/x86_64/kernel/asm-offsets.c
@@ -61,8 +61,10 @@
 	       offsetof (struct rt_sigframe32, uc.uc_mcontext));
 	BLANK();
 #endif
+#ifdef CONFIG_PM
 	DEFINE(pbe_address, offsetof(struct pbe, address));
 	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
 	DEFINE(pbe_next, offsetof(struct pbe, next));
+#endif
 	return 0;
 }

Do we want this in mailine?

diff -ruN linux-2.6.15-1/arch/x86_64/kernel/e820.c build-2.6.15.1/arch/x86_64/kernel/e820.c diff -ruN linux-2.6.15-1/arch/x86_64/kernel/signal.c build-2.6.15.1/arch/x86_64/kernel/signal.c

diff -ruN linux-2.6.15-1/arch/x86_64/kernel/suspend.c build-2.6.15.1/arch/x86_64/kernel/suspend.c

With uswsusp, you are using existing code...

arch/x86_64/kernel/suspend.c +2 -1
@@ -141,7 +144,7 @@
 
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#if defined(CONFIG_SOFTWARE_SUSPEND)
 /* Defined in arch/x86_64/kernel/suspend_asm.S */
 extern int restore_image(void);
 
@@ -220,4 +223,5 @@
 	restore_image();
 	return 0;
 }
+
 #endif /* CONFIG_SOFTWARE_SUSPEND */

Why such spurious changes?

arch/x86_64/kernel/time.c +50 -34

107 lines not on this page · raw message

What does this do? Seems independend from rest of suspend2.

diff -ruN linux-2.6.15-1/arch/x86_64/mm/init.c build-2.6.15.1/arch/x86_64/mm/init.c diff -ruN linux-2.6.15-1/block/ll_rw_blk.c build-2.6.15.1/block/ll_rw_blk.c

crypto/deflate.c +9 -2
diff -ruN linux-2.6.15-1/crypto/deflate.c build-2.6.15.1/crypto/deflate.c
@@ -143,8 +143,15 @@
 
 	ret = zlib_deflate(stream, Z_FINISH);
 	if (ret != Z_STREAM_END) {
-		ret = -EINVAL;
-		goto out;
+	    	if (!(ret == Z_OK && !stream->avail_in && !stream->avail_out)) {
+			ret = -EINVAL;
+			goto out;
+		} else {
+			u8 zerostuff = 0;
+			stream->next_out = &zerostuff;
+			stream->avail_out = 1; 
+			ret = zlib_deflate(stream, Z_FINISH);
+		}
 	}
 	ret = 0;
 	*dlen = stream->total_out;

WTF is this?

crypto/Kconfig +7 -0
diff -ruN linux-2.6.15-1/crypto/Kconfig build-2.6.15.1/crypto/Kconfig
@@ -285,6 +285,13 @@
 	  
 	  You will most probably want this if using IPSec.
 
+config CRYPTO_LZF
+	tristate "LZF compression algorithm"
+	depends on CRYPTO
+	help
+	  This is the LZF algorithm. It is especially useful for Suspend2,
+	  because it achieves good compression quickly.
+
 config CRYPTO_MICHAEL_MIC
 	tristate "Michael MIC keyed digest algorithm"
 	depends on CRYPTO

diff -ruN linux-2.6.15-1/crypto/lzf.c build-2.6.15.1/crypto/lzf.c diff -ruN linux-2.6.15-1/crypto/Makefile build-2.6.15.1/crypto/Makefile

With uswsusp, LZF can stay in userspace.

Documentation/kernel-parameters.txt +3 -0
diff -ruN linux-2.6.15-1/Documentation/kernel-parameters.txt build-2.6.15.1/Documentation/kernel-parameters.txt
@@ -71,6 +71,7 @@
 	SERIAL	Serial support is enabled.
 	SMP	The kernel is an SMP kernel.
 	SPARC	Sparc architecture is enabled.
+	SUSPEND2 Suspend2 is enabled.
 	SWSUSP	Software suspend is enabled.
 	TS	Appropriate touchscreen support is enabled.
 	USB	USB support is enabled.
@@ -966,6 +967,8 @@
 	noresume	[SWSUSP] Disables resume and restores original swap
 			space.
 
+	noresume2	[SUSPEND2] Disables resuming and restores original swap signature.
+ 
 	no-scroll	[VGA] Disables scrollback.
 			This is required for the Braillex ib80-piezo Braille
 			reader made by F.H. Papenmeier (Germany).

...and kernel parameters do not need to change...

Documentation/power/internals.txt +0 -0
diff -ruN linux-2.6.15-1/Documentation/power/internals.txt build-2.6.15.1/Documentation/power/internals.txt
+    Plugins are linked together in pipeline fashion. There may be zero or more
+    page transformers in a pipeline, and there is always exactly one writer.
+    The pipeline follows this pattern:

+
+ ---------------------------------
+ | Suspend2 Core
+ ---------------------------------

Notice missing '|'

+ |
+ |
+ ---------------------------------
+ | Page transformer 1 |
+ ---------------------------------
+ |
+ |
+ ---------------------------------
+ | Page transformer 2 |
+ ---------------------------------
+ |
+ |
+ ---------------------------------
+ | Writer |
+ ---------------------------------

Also notice that with uswsusp, this pipeline can stay in userspace.

diff -ruN linux-2.6.15-1/Documentation/power/kernel_threads.txt build-2.6.15.1/Documentation/power/kernel_threads.txt diff -ruN linux-2.6.15-1/Documentation/power/suspend2.txt build-2.6.15.1/Documentation/power/suspend2.txt

...and extensive documentation can stay with userspace tools.

diff -ruN linux-2.6.15-1/Documentation/power/swsusp.txt build-2.6.15.1/Documentation/power/swsusp.txt

drivers/acpi/osl.c +1 -1
diff -ruN linux-2.6.15-1/drivers/acpi/osl.c build-2.6.15.1/drivers/acpi/osl.c
@@ -91,7 +91,7 @@
 		       "Access to PCI configuration space unavailable\n");
 		return AE_NULL_ENTRY;
 	}
-	kacpid_wq = create_singlethread_workqueue("kacpid");
+	kacpid_wq = create_nofreeze_singlethread_workqueue("kacpid");
 	BUG_ON(!kacpid_wq);
 
 	return AE_OK;

Big search and replace all over the tree. Changes the default to unsafe one. Do you ever listen to comments?

diff -ruN linux-2.6.15-1/drivers/acpi/sleep/proc.c build-2.6.15.1/drivers/acpi/sleep/proc.c

drivers/base/power/resume.c +5 -0
diff -ruN linux-2.6.15-1/drivers/base/power/resume.c build-2.6.15.1/drivers/base/power/resume.c
@@ -101,6 +101,11 @@
 		list_del_init(entry);
 		list_add_tail(entry, &dpm_active);
 		resume_device(dev);
+		if (!irqs_disabled()) {
+			printk("WARNING: Interrupts reenabled while resuming sysdev driver %s.\n",
+			kobject_name(&dev->kobj));
+			local_irq_disable();
+		}
 		put_device(dev);
 	}
 }

Nothing to do with suspend2. Either it is good idea or it is not, and I think I saw mails telling you it is not.

diff -ruN linux-2.6.15-1/drivers/base/power/suspend.c build-2.6.15.1/drivers/base/power/suspend.c diff -ruN linux-2.6.15-1/drivers/base/sys.c build-2.6.15.1/drivers/base/sys.c

...but you still keep the bad patches in your tree.

diff -ruN linux-2.6.15-1/drivers/block/pktcdvd.c build-2.6.15.1/drivers/block/pktcdvd.c

diff -ruN linux-2.6.15-1/drivers/char/agp/agp_suspend.h build-2.6.15.1/drivers/char/agp/agp_suspend.h diff -ruN linux-2.6.15-1/drivers/char/agp/ati-agp.c build-2.6.15.1/drivers/char/agp/ati-agp.c diff -ruN linux-2.6.15-1/drivers/char/agp/nvidia-agp.c build-2.6.15.1/drivers/char/agp/nvidia-agp.c

AGP stuff is independed with rest of code. Ahha, it was probably included in latest trees, but your diff is still against 2.6.15.

diff -ruN linux-2.6.15-1/drivers/char/hvc_console.c build-2.6.15.1/drivers/char/hvc_console.c diff -ruN linux-2.6.15-1/drivers/char/hvcs.c build-2.6.15.1/drivers/char/hvcs.c
diff -ruN linux-2.6.15-1/drivers/ieee1394/ieee1394_core.c build-2.6.15.1/drivers/ieee1394/ieee1394_core.c diff -ruN linux-2.6.15-1/drivers/ieee1394/nodemgr.c build-2.6.15.1/drivers/ieee1394/nodemgr.c diff -ruN linux-2.6.15-1/drivers/input/gameport/gameport.c build-2.6.15.1/drivers/input/gameport/gameport.c

drivers/input/serio/serio.c +6 -0
diff -ruN linux-2.6.15-1/drivers/input/serio/serio.c build-2.6.15.1/drivers/input/serio/serio.c
@@ -314,6 +314,12 @@
 
 		serio_remove_duplicate_events(event);
 		serio_free_event(event);
+
+		if (unlikely(todo_list_active())) {
+  			up(&serio_sem);
+			try_todo_list();
+  			down(&serio_sem);
+		}
 	}
 
 	up(&serio_sem);

What is this?

drivers/macintosh/Kconfig +4 -0
diff -ruN linux-2.6.15-1/drivers/macintosh/Kconfig build-2.6.15.1/drivers/macintosh/Kconfig
@@ -192,4 +192,8 @@
 	tristate "Support for ANS LCD display"
 	depends on ADB_CUDA && PPC_PMAC
 
+config SOFTWARE_REPLACE_SLEEP
+	bool "Using Software suspend replace broken sleep function"
+	depends on SUSPEND2
+
 endmenu

If sleep function is broken, why would you ever want it enabled? Why does this need to be configurable?

diff -ruN linux-2.6.15-1/drivers/macintosh/therm_adt746x.c build-2.6.15.1/drivers/macintosh/therm_adt746x.c diff -ruN linux-2.6.15-1/drivers/macintosh/via-pmu.c build-2.6.15.1/drivers/macintosh/via-pmu.c
diff -ruN linux-2.6.15-1/drivers/md/dm-crypt.c build-2.6.15.1/drivers/md/dm-crypt.c
diff -ruN linux-2.6.15-1/drivers/md/md.c build-2.6.15.1/drivers/md/md.c
diff -ruN linux-2.6.15-1/drivers/media/dvb/dvb-core/dvb_frontend.c build-2.6.15.1/drivers/media/dvb/dvb-core/dvb_frontend.c diff -ruN linux-2.6.15-1/drivers/media/video/msp3400.c build-2.6.15.1/drivers/media/video/msp3400.c diff -ruN linux-2.6.15-1/drivers/media/video/tvaudio.c build-2.6.15.1/drivers/media/video/tvaudio.c diff -ruN linux-2.6.15-1/drivers/media/video/video-buf-dvb.c build-2.6.15.1/drivers/media/video/video-buf-dvb.c diff -ruN linux-2.6.15-1/drivers/net/8139too.c build-2.6.15.1/drivers/net/8139too.c

drivers/net/irda/sir_kthread.c +1 -3
diff -ruN linux-2.6.15-1/drivers/net/irda/sir_kthread.c build-2.6.15.1/drivers/net/irda/sir_kthread.c
@@ -112,6 +112,7 @@
 	DECLARE_WAITQUEUE(wait, current);
 
 	daemonize("kIrDAd");
+	current->flags |= PF_NOFREEZE;
 
 	irda_rq_queue.thread = current;
 
@@ -134,9 +135,6 @@
 			__set_task_state(current, TASK_RUNNING);
 		remove_wait_queue(&irda_rq_queue.kick, &wait);
 
-		/* make swsusp happy with our thread */
-		try_to_freeze();
-
 		run_irda_queue();
 	}
 

Why do you need irda threads running during suspend?

diff -ruN linux-2.6.15-1/drivers/net/irda/stir4200.c build-2.6.15.1/drivers/net/irda/stir4200.c diff -ruN linux-2.6.15-1/drivers/net/wireless/airo.c build-2.6.15.1/drivers/net/wireless/airo.c diff -ruN linux-2.6.15-1/drivers/pcmcia/cs.c build-2.6.15.1/drivers/pcmcia/cs.c
diff -ruN linux-2.6.15-1/drivers/pnp/pnpbios/core.c build-2.6.15.1/drivers/pnp/pnpbios/core.c diff -ruN linux-2.6.15-1/drivers/scsi/hosts.c build-2.6.15.1/drivers/scsi/hosts.c
diff -ruN linux-2.6.15-1/drivers/scsi/lpfc/lpfc_init.c build-2.6.15.1/drivers/scsi/lpfc/lpfc_init.c diff -ruN linux-2.6.15-1/drivers/usb/core/hub.c build-2.6.15.1/drivers/usb/core/hub.c
diff -ruN linux-2.6.15-1/drivers/usb/gadget/file_storage.c build-2.6.15.1/drivers/usb/gadget/file_storage.c diff -ruN linux-2.6.15-1/drivers/usb/net/pegasus.c build-2.6.15.1/drivers/usb/net/pegasus.c diff -ruN linux-2.6.15-1/drivers/usb/storage/usb.c build-2.6.15.1/drivers/usb/storage/usb.c diff -ruN linux-2.6.15-1/drivers/w1/w1.c build-2.6.15.1/drivers/w1/w1.c
diff -ruN linux-2.6.15-1/fs/afs/kafsasyncd.c build-2.6.15.1/fs/afs/kafsasyncd.c
diff -ruN linux-2.6.15-1/fs/afs/kafstimod.c build-2.6.15.1/fs/afs/kafstimod.c
diff -ruN linux-2.6.15-1/fs/jbd/journal.c build-2.6.15.1/fs/jbd/journal.c
diff -ruN linux-2.6.15-1/fs/jffs/intrep.c build-2.6.15.1/fs/jffs/intrep.c
diff -ruN linux-2.6.15-1/fs/jffs2/background.c build-2.6.15.1/fs/jffs2/background.c
diff -ruN linux-2.6.15-1/fs/jfs/jfs_logmgr.c build-2.6.15.1/fs/jfs/jfs_logmgr.c
diff -ruN linux-2.6.15-1/fs/jfs/jfs_txnmgr.c build-2.6.15.1/fs/jfs/jfs_txnmgr.c
diff -ruN linux-2.6.15-1/fs/lockd/clntlock.c build-2.6.15.1/fs/lockd/clntlock.c
diff -ruN linux-2.6.15-1/fs/lockd/clntproc.c build-2.6.15.1/fs/lockd/clntproc.c
diff -ruN linux-2.6.15-1/fs/lockd/svc.c build-2.6.15.1/fs/lockd/svc.c
diff -ruN linux-2.6.15-1/fs/xfs/linux-2.6/xfs_buf.c build-2.6.15.1/fs/xfs/linux-2.6/xfs_buf.c diff -ruN linux-2.6.15-1/fs/xfs/linux-2.6/xfs_super.c build-2.6.15.1/fs/xfs/linux-2.6/xfs_super.c

So you run big search & replace all over the tree, making your diff huge. Either drop them or merge them...

include/asm-arm/hw_irq.h +4 -0
diff -ruN linux-2.6.15-1/include/asm-arm/hw_irq.h build-2.6.15.1/include/asm-arm/hw_irq.h
@@ -0,0 +1,4 @@
+#ifndef __ASM_HARDIRQ_H
+#define __ASM_HARDIRQ_H
+#include <asm/hardirq.h>
+#endif

What does this have to do with suspend2?

diff -ruN linux-2.6.15-1/include/asm-arm/suspend2.h build-2.6.15.1/include/asm-arm/suspend2.h
diff -ruN linux-2.6.15-1/include/asm-i386/mach-default/mach_time.h build-2.6.15.1/include/asm-i386/mach-default/mach_time.h

include/asm-i386/suspend2.h +106 -0

106 lines not on this page · raw message

Can't you use existing suspend functions?

Same for the rest of file...

+static inline void suspend2_arch_flush_caches(void) +{
+#ifdef CONFIG_SMP
+ cpu_clear(0, per_cpu(cpu_tlbstate,
+ 0).active_mm->cpu_vm_mask);
+#endif
+ wbinvd();
+ __flush_tlb_all();
+
+}
+
+static inline void suspend2_arch_post_copyback(void) +{
+ BUG_ON(!irqs_disabled());
+
+ current_cpu_data.loops_per_jiffy =
+ c_loops_per_jiffy_ref;
+#ifndef CONFIG_SMP
+ loops_per_jiffy = c_loops_per_jiffy_ref;
+ cpu_khz = cpu_khz_ref;
+#endif
+}
+
+#endif

What is this? Is your method of dealing with SMP different from mainline's?

diff -ruN linux-2.6.15-1/include/asm-ppc/cpu_context.h build-2.6.15.1/include/asm-ppc/cpu_context.h diff -ruN linux-2.6.15-1/include/asm-x86_64/page.h build-2.6.15.1/include/asm-x86_64/page.h diff -ruN linux-2.6.15-1/include/asm-x86_64/suspend2.h build-2.6.15.1/include/asm-x86_64/suspend2.h

Same here. You should be able to use mainline's snapshot functionality. That's common piece between swsusp and suspend2, and having your own copy helps noone.

diff -ruN linux-2.6.15-1/include/asm-x86_64/suspend.h build-2.6.15.1/include/asm-x86_64/suspend.h

include/linux/bio.h +1 -0
diff -ruN linux-2.6.15-1/include/linux/bio.h build-2.6.15.1/include/linux/bio.h
@@ -124,6 +124,7 @@
 #define BIO_BOUNCED	5	/* bio is a bounce bio */
 #define BIO_USER_MAPPED 6	/* contains user pages */
 #define BIO_EOPNOTSUPP	7	/* not supported */
+#define BIO_SUSPEND2	8	/* Suspend2 bio - for corruption checking */
 #define bio_flagged(bio, flag)	((bio)->bi_flags & (1 << (flag)))
 
 /*

You just should not corrupt the data...

include/linux/dyn_pageflags.h +3 -0
diff -ruN linux-2.6.15-1/include/linux/dyn_pageflags.h build-2.6.15.1/include/linux/dyn_pageflags.h
@@ -0,0 +1,66 @@
+
+typedef unsigned long *** dyn_pageflags_t;
+

Eh....

Could not you just use normal page flags like swsusp does?

include/linux/freezer.h +28 -0
diff -ruN linux-2.6.15-1/include/linux/freezer.h build-2.6.15.1/include/linux/freezer.h
@@ -0,0 +1,28 @@
+/* Freezer declarations */
+
+#define FREEZER_ON 0
+#define ABORT_FREEZING 1
+
+#define FREEZER_KERNEL_THREADS 0
+#define FREEZER_ALL_THREADS 1
+
+#ifdef CONFIG_PM
+extern unsigned long freezer_state;
+
+#define test_freezer_state(bit) test_bit(bit, &freezer_state)
+#define set_freezer_state(bit) set_bit(bit, &freezer_state)
+#define clear_freezer_state(bit) clear_bit(bit, &freezer_state)
+
+#define freezer_is_on() (test_freezer_state(FREEZER_ON))
+
+extern void do_freeze_process(struct notifier_block *nl);
+
+#else
+
+#define test_freezer_state(bit) (0)
+#define set_freezer_state(bit) do { } while(0)
+#define clear_freezer_state(bit) do { } while(0)
+
+#define freezer_is_on() (0)
+
+#endif

So you have your own freezer. Can you still reproduce some failures in mainline's freezer? There's one nasty case with vfork() we do not have solved...

include/linux/kernel.h +2 -0
diff -ruN linux-2.6.15-1/include/linux/kernel.h build-2.6.15.1/include/linux/kernel.h
@@ -103,6 +103,8 @@
 	__attribute__ ((format (printf, 2, 0)));
 extern int snprintf(char * buf, size_t size, const char * fmt, ...)
 	__attribute__ ((format (printf, 3, 4)));
+extern int snprintf_used(char *buffer, int buffer_size,
+		const char *fmt, ...);
 extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
 	__attribute__ ((format (printf, 3, 0)));
 extern int scnprintf(char * buf, size_t size, const char * fmt, ...)

Why do you need to modify printf-like functions?!

diff -ruN linux-2.6.15-1/include/linux/kthread.h build-2.6.15.1/include/linux/kthread.h

include/linux/netlink.h +2 -0
diff -ruN linux-2.6.15-1/include/linux/netlink.h build-2.6.15.1/include/linux/netlink.h
@@ -21,6 +21,8 @@
 #define NETLINK_DNRTMSG		14	/* DECnet routing messages */
 #define NETLINK_KOBJECT_UEVENT	15	/* Kernel messages to userspace */
 #define NETLINK_GENERIC		16
+#define NETLINK_SUSPEND2_USERUI	17	/* For suspend2's userui */
+#define NETLINK_SUSPEND2_USM	18	/* For suspend2's userui */
 
 #define MAX_LINKS 32		
 

Yeh, and this is exactly why uswsusp is superior.

diff -ruN linux-2.6.15-1/include/linux/sched.h build-2.6.15.1/include/linux/sched.h diff -ruN linux-2.6.15-1/include/linux/suspend2.h build-2.6.15.1/include/linux/suspend2.h +
+/* Debug sections - if debugging compiled in */
+enum {
+ SUSPEND_ANY_SECTION,
+ SUSPEND_FREEZER,
+ SUSPEND_EAT_MEMORY,
+ SUSPEND_PAGESETS,
+ SUSPEND_IO,
+ SUSPEND_BMAP,
+ SUSPEND_HEADER,
+ SUSPEND_WRITER,
+ SUSPEND_MEMORY,
+ SUSPEND_EXTENTS,
+ SUSPEND_SPINLOCKS,
+ SUSPEND_MEM_POOL,
+ SUSPEND_RANGE_PARANOIA,
+ SUSPEND_NOSAVE,
+ SUSPEND_INTEGRITY
+};
+
+/* debugging levels. */
+#define SUSPEND_STATUS 0
+#define SUSPEND_ERROR 2
+#define SUSPEND_LOW 3
+#define SUSPEND_MEDIUM 4
+#define SUSPEND_HIGH 5
+#define SUSPEND_VERBOSE 6
+
+/* second status register */
+enum {
+ SUSPEND_REBOOT,
+ SUSPEND_PAUSE,
+ SUSPEND_SLOW,
+ SUSPEND_NOPAGESET2,
+ SUSPEND_LOGALL,
+ SUSPEND_CAN_CANCEL,
+ SUSPEND_KEEP_IMAGE,
+ SUSPEND_FREEZER_TEST,
+ SUSPEND_FREEZER_TEST_SHOWALL,
+ SUSPEND_SINGLESTEP,
+ SUSPEND_PAUSE_NEAR_PAGESET_END,
+ SUSPEND_USE_ACPI_S4,
+ SUSPEND_TEST_FILTER_SPEED,
+ SUSPEND_FREEZE_TIMERS,
+ SUSPEND_DISABLE_SYSDEV_SUPPORT,
+ SUSPEND_VGA_POST,
+ SUSPEND_TEST_BIO,
+ SUSPEND_NO_PAGESET2,
+};
+

Not sure what this does, but I surely don't like it.

+extern void __suspend_message(unsigned long section, unsigned long level, int log_normally,
+ const char *fmt, ...);
+
+#ifdef CONFIG_PM_DEBUG
+#define suspend_message(sn, lev, log, fmt, a...) \
+do { \
+ if (test_debug_state(sn)) \
+ __suspend_message(sn, lev, log, fmt, ##a); \
+} while(0)
+#else /* CONFIG_PM_DEBUG */
+#define suspend_message(sn, lev, log, fmt, a...) \
+do { \
+ if (lev == 0) \
+ __suspend_message(sn, lev, log, fmt, ##a); \
+} while(0)
+#endif /* CONFIG_PM_DEBUG */
+
+/* Suspend 2 */

Having your own debugging infrastructure means you are doing something wrong.

+enum {
+ SUSPEND_DISABLED,
+ SUSPEND_RUNNING,
+ SUSPEND_RESUME_DEVICE_OK,
+ SUSPEND_NORESUME_SPECIFIED,
+ SUSPEND_COMMANDLINE_ERROR,
+ SUSPEND_IGNORE_IMAGE,
+ SUSPEND_SANITY_CHECK_PROMPT,
+ SUSPEND_FREEZER_ON,
+ SUSPEND_BLOCK_PAGE_ALLOCATIONS,
+ SUSPEND_USE_MEMORY_POOL,
+ SUSPEND_STAGE2_CONTINUE,
+ SUSPEND_FREEZE_SMP,
+ SUSPEND_PAGESET2_NOT_LOADED,
+ SUSPEND_CONTINUE_REQ,
+ SUSPEND_RESUMED_BEFORE,
+ SUSPEND_RUNNING_INITRD,
+ SUSPEND_RESUME_NOT_DONE,
+ SUSPEND_BOOT_TIME,
+ SUSPEND_NOW_RESUMING,
+ SUSPEND_SLAB_ALLOC_FALLBACK,
+ SUSPEND_IGNORE_LOGLEVEL,
+ SUSPEND_TIMER_FREEZER_ON,
+ SUSPEND_ACT_USED,
+ SUSPEND_DBG_USED,
+ SUSPEND_LVL_USED,
+ SUSPEND_TRYING_TO_RESUME,
+ SUSPEND_FORK_COPYBACK_THREAD,
+ SUSPEND_TRY_RESUME_RD,
+ SUSPEND_IGNORE_ROOTFS,
+};

What's this? DBG_USED? LVL_USED?

diff -ruN linux-2.6.15-1/include/linux/suspend.h build-2.6.15.1/include/linux/suspend.h diff -ruN linux-2.6.15-1/include/linux/workqueue.h build-2.6.15.1/include/linux/workqueue.h diff -ruN linux-2.6.15-1/init/do_mounts.c build-2.6.15.1/init/do_mounts.c

init/do_mounts_initrd.c +4 -1
diff -ruN linux-2.6.15-1/init/do_mounts_initrd.c build-2.6.15.1/init/do_mounts_initrd.c
@@ -7,6 +7,7 @@
 #include <linux/romfs_fs.h>
 #include <linux/initrd.h>
 #include <linux/sched.h>
+#include <linux/suspend.h>
 
 #include "do_mounts.h"
 
@@ -58,10 +59,16 @@
 
 	pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
 	if (pid > 0) {
-		while (pid != sys_wait4(-1, NULL, 0, NULL))
+		while (pid != sys_wait4(-1, NULL, 0, NULL)) {
 			yield();
+			try_to_freeze();
+		}
 	}
 

Not run_todo_list? Do we want this in mainline?

diff -ruN linux-2.6.15-1/init/main.c build-2.6.15.1/init/main.c diff -ruN linux-2.6.15-1/kernel/audit.c build-2.6.15.1/kernel/audit.c

kernel/fork.c +7 -1
diff -ruN linux-2.6.15-1/kernel/fork.c build-2.6.15.1/kernel/fork.c
@@ -165,7 +166,13 @@
 	if (!tsk)
 		return NULL;
 
-	ti = alloc_thread_info(tsk);
+	if (test_suspend_state(SUSPEND_FORK_COPYBACK_THREAD)) {
+		extern void * suspend2_get_nonconflicting_pages(int);
+		ti = suspend2_get_nonconflicting_pages(get_order(THREAD_SIZE));
+		printk("Starting a copyback thread %p\n", ti);
+	} else
+		ti = alloc_thread_info(tsk);
+
 	if (!ti) {
 		free_task_struct(tsk);
 		return NULL;

With code like this (in fork!) how can you claim it is not complex? What does copyback do, anyway?

diff -ruN linux-2.6.15-1/kernel/kmod.c build-2.6.15.1/kernel/kmod.c diff -ruN linux-2.6.15-1/kernel/kthread.c build-2.6.15.1/kernel/kthread.c

kernel/power/atomic_copy.c +29 -0
diff -ruN linux-2.6.15-1/kernel/power/atomic_copy.c build-2.6.15.1/kernel/power/atomic_copy.c
@@ -0,0 +1,473 @@
+/*
+ */
+
+#include <linux/suspend.h>
+#include <linux/highmem.h>
+#include <linux/kthread.h>
+#include <asm/setup.h>
+#include <asm/param.h>
+#include <asm/thread_info.h>
+#include "suspend2_common.h"
+#include "io.h"
+#include "power_off.h"
+#include "version.h"
+#include "ui.h"
+#include "plugins.h"
+#include "atomic_copy.h"
+#include "suspend2.h"
+#include "checksum.h"
+#include "pageflags.h"
+#include "debug_pagealloc.h"
+#include "storage.h"
+
+#include <asm/suspend2.h>
+
+volatile static int state1 __nosavedata = 0;
+volatile static int state2 __nosavedata = 0;
+volatile static int state3 __nosavedata = 0;
+volatile static int io_speed_save[2][2] __nosavedata;
+

Heh, nice... volatile probably means you got the locking wrong, and no it is not nice to name variables like this.

Why can't you just use existing code for atomic copy?

(~400 lines of duplicated code skipped)

diff -ruN linux-2.6.15-1/kernel/power/atomic_copy.h build-2.6.15.1/kernel/power/atomic_copy.h

kernel/power/block_io.h +68 -0

68 lines not on this page · raw message

So you have your own disk operations... Nothing like that is needed with uswsusp.

kernel/power/checksum.h +11 -0
diff -ruN linux-2.6.15-1/kernel/power/checksum.h build-2.6.15.1/kernel/power/checksum.h
@@ -0,0 +1,11 @@
+#ifdef CONFIG_SUSPEND2_CHECKSUMS
+extern void suspend2_verify_checksums(void);
+extern void suspend2_checksum_calculate_checksums(void);
+extern void suspend2_checksum_print_differences(void);
+extern int suspend2_allocate_checksum_pages(void);
+#else
+static inline void suspend2_verify_checksums(void) { };
+static inline void suspend2_checksum_calculate_checksums(void) { };
+static inline void suspend2_checksum_print_differences(void) { };
+static inline int suspend2_allocate_checksum_pages(void) { return 0; };
+#endif

...and checksums can happily live in userspace.

kernel/power/compression.c +2 -0
diff -ruN linux-2.6.15-1/kernel/power/compression.c build-2.6.15.1/kernel/power/compression.c
@@ -0,0 +1,638 @@
+/*
+ * kernel/power/suspend2_core/compression.c

Wrong filename.

+ * Copyright (C) 2003-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * This file contains data compression routines for suspend,
+ * using LZH compression.

LZF?

Snipped 600 lines of code that can happily live in userspace.

kernel/power/debug_pagealloc.c +8 -0
diff -ruN linux-2.6.15-1/kernel/power/debug_pagealloc.c build-2.6.15.1/kernel/power/debug_pagealloc.c
@@ -0,0 +1,111 @@
+#include <linux/mm.h>
+#ifdef CONFIG_DEBUG_PAGEALLOC
+#include <linux/page-flags.h>
+#include <asm/pgtable.h>
+
+#include "pageflags.h"
+#include "suspend2.h"
+#include "pagedir.h"

What is this code doing?
diff -ruN linux-2.6.15-1/kernel/power/debug_pagealloc.h build-2.6.15.1/kernel/power/debug_pagealloc.h diff -ruN linux-2.6.15-1/kernel/power/disk.c build-2.6.15.1/kernel/power/disk.c

kernel/power/encryption.c +14 -0
diff -ruN linux-2.6.15-1/kernel/power/encryption.c build-2.6.15.1/kernel/power/encryption.c
@@ -0,0 +1,597 @@
+/*
+ * kernel/power/suspend2_core/encryption.c
+ *
+ * Copyright (C) 2003-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * This file contains data encryption routines for suspend,
+ * using cryptoapi transforms.
+ *
+ * ToDo:
+ * - Apply min/max_keysize the cipher changes.
+ * - Test.
+ */

Snipped 550 lines of code that can happily live in userspace.

kernel/power/extent.c +10 -0
diff -ruN linux-2.6.15-1/kernel/power/extent.c build-2.6.15.1/kernel/power/extent.c
@@ -0,0 +1,247 @@
+/* kernel/power/suspend2_core/extent.c
+ * 
+ * (C) 2003-2005 Nigel Cunningham <[email protected]>
+ *
+ * Distributed under GPLv2.
+ * 
+ * These functions encapsulate the manipulation of storage metadata. For
+ * pageflags, we use dynamically allocated bitmaps.
+ */
+

I do not know why you want to use extents; existing code seems to work well enough. Do you get .01% speedup or what?

diff -ruN linux-2.6.15-1/kernel/power/extent.h build-2.6.15.1/kernel/power/extent.h +
+#define extent_state_eof(state) ((state)->num_chains < (state)->current_chain) +
+#define extent_for_each(extent_chain, extentpointer, value) \
+if ((extent_chain)->first) \
+ for ((extentpointer) = (extent_chain)->first, (value) = \
+ (extentpointer)->minimum; \
+ ((extentpointer) && ((extentpointer)->next || (value) <= \
+ (extentpointer)->maximum)); \
+ (((value) == (extentpointer)->maximum) ? \
+ ((extentpointer) = (extentpointer)->next, (value) = \
+ ((extentpointer) ? (extentpointer)->minimum : 0)) : \
+ (value)++))
+
+/*
+ * When using compression and expected_compression > 0,
+ * we allocate fewer swap entries, so GET_EXTENT_NEXT can
+ * validly run out of data to return.
+ */
+#define GET_EXTENT_NEXT(currentextent, currentval) \
+{ \
+ if (currentextent) { \
+ if ((currentval) == (currentextent)->maximum) { \
+ if ((currentextent)->next) { \
+ (currentextent) = (currentextent)->next; \
+ (currentval) = (currentextent)->minimum; \
+ } else { \
+ (currentextent) = NULL; \
+ (currentval) = 0; \
+ } \
+ } else \
+ currentval++; \
+ } \
+}

Not nice at all.

kernel/power/io.c +13 -0
diff -ruN linux-2.6.15-1/kernel/power/io.c build-2.6.15.1/kernel/power/io.c
@@ -0,0 +1,1025 @@
+/*
+ * kernel/power/io.c
+ *
+ * Copyright (C) 1998-2001 Gabor Kuti <[email protected]>
+ * Copyright (C) 1998,2001,2002 Pavel Machek <[email protected]>
+ * Copyright (C) 2002-2003 Florent Chabaud <[email protected]>
+ * Copyright (C) 2002-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * It contains high level IO routines for suspending.
+ *
+ */

Snipped 1000 lines that can happily live in userspace. Yes, I have similar (but way simpler) code in kernel just now. Notice I want to remove it.

diff -ruN linux-2.6.15-1/kernel/power/io.h build-2.6.15.1/kernel/power/io.h

kernel/power/Kconfig +73 -0

76 lines not on this page · raw message

All this configuration can and should be done in userspace. That's 70 lines.

diff -ruN linux-2.6.15-1/kernel/power/main.c build-2.6.15.1/kernel/power/main.c diff -ruN linux-2.6.15-1/kernel/power/Makefile build-2.6.15.1/kernel/power/Makefile

kernel/power/netlink.c +5 -0
diff -ruN linux-2.6.15-1/kernel/power/netlink.c build-2.6.15.1/kernel/power/netlink.c
@@ -0,0 +1,365 @@
+/*
+ * netlink.c
+ *
+ * Functions for communicating with a userspace helper via netlink.
+ */

With Rafael's solution, you don't need to inform userspace of your progress -- because userspace is controlling the suspend. Snip 300 unneeded lines.

+static int suspend2_nl_gen_rcv_msg(struct user_helper_data *uhd,
+ struct sk_buff *skb, struct nlmsghdr *nlh)
+{
+ int type;
+ int *data;
+ int err;
+
+ /* Let the more specific handler go first. It returns
+ * 1 for valid messages that it doesn't know. */
+ if ((err = uhd->rcv_msg(skb, nlh)) != 1)
+ return err;

...some of them pretty cryptic.

+static int launch_userpace_program(struct user_helper_data *uhd) +{
+ int retval;
+ static char *envp[] = {
+ "HOME=/",
+ "TERM=linux",
+ "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
+ NULL };
+ static char *argv[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+ char *channel = kmalloc(6, GFP_KERNEL);
+ int arg = 0, size;
+ char test_read[255];
+ char *orig_posn = uhd->program;
+
+ if (!strlen(orig_posn))
+ return 1;
+
+ while (arg < 7) {
+ sscanf(orig_posn, "%s", test_read);
+ size = strlen(test_read);
+ if (!(size))
+ break;
+ argv[arg] = kmalloc(size + 1, GFP_ATOMIC);
+ strcpy(argv[arg], test_read);
+ orig_posn += size + 1;
+ *test_read = 0;
+ arg++;
+ }
+
+ sprintf(channel, "-c%d", uhd->netlink_id);
+ argv[arg] = channel;
+
+ retval = call_usermodehelper(argv[0], argv, envp, 0);

It is really better if userspace calls you...

diff -ruN linux-2.6.15-1/kernel/power/netlink.h build-2.6.15.1/kernel/power/netlink.h

kernel/power/pagedir.c +14 -0
diff -ruN linux-2.6.15-1/kernel/power/pagedir.c build-2.6.15.1/kernel/power/pagedir.c
@@ -0,0 +1,370 @@
+/*
+ * kernel/power/pagedir.c
+ *
+ * Copyright (C) 1998-2001 Gabor Kuti <[email protected]>
+ * Copyright (C) 1998,2001,2002 Pavel Machek <[email protected]>
+ * Copyright (C) 2002-2003 Florent Chabaud <[email protected]>
+ * Copyright (C) 2002-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * Routines for handling pagesets.
+ * Note that pbes aren't actually stored as such. They're stored as
+ * bitmaps and extents.
+ */

You should be able to use existing snapshotting...

+#include <linux/suspend.h>
+#include <linux/highmem.h>
+#include <linux/bootmem.h>
+#include <linux/hardirq.h>
+
+#include "pageflags.h"
+#include "ui.h"
+#include "pagedir.h"
+
+int extra_pagedir_pages_allocated = 0;

Do not zero-initialize static variables.

diff -ruN linux-2.6.15-1/kernel/power/pagedir.h build-2.6.15.1/kernel/power/pagedir.h

kernel/power/pageflags.c +2 -0
diff -ruN linux-2.6.15-1/kernel/power/pageflags.c build-2.6.15.1/kernel/power/pageflags.c
@@ -0,0 +1,139 @@
+/*
+ * kernel/power/suspend2_core/pageflags.c

Wrong name.

+ * Copyright (C) 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * Routines for dynamically allocating and releasing bitmaps
+ * used as pseudo-pageflags.
+ *
+ * Arrays are not contiguous. The first sizeof(void *) bytes are
+ * the pointer to the next page in the bitmap. This allows us to
+ * 1) work under low memory conditions where order 0 might be all
+ * that's available
+ * 2) save the pages at suspend time, reload and relocate them as
+ * necessary at resume time without breaking anything (cf
+ * extent pages).
+ */

Why do you need this?

diff -ruN linux-2.6.15-1/kernel/power/pageflags.h build-2.6.15.1/kernel/power/pageflags.h

kernel/power/plugins.c +6 -0
diff -ruN linux-2.6.15-1/kernel/power/plugins.c build-2.6.15.1/kernel/power/plugins.c
@@ -0,0 +1,312 @@
+/*
+ * kernel/power/plugins.c
+ *
+ * Copyright (C) 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ */

Oh, my favourite.. These should really be in userspace. 300 lines + 180 lines in header.

diff -ruN linux-2.6.15-1/kernel/power/plugins.h build-2.6.15.1/kernel/power/plugins.h diff -ruN linux-2.6.15-1/kernel/power/power.h build-2.6.15.1/kernel/power/power.h

/* References to section boundaries */
-extern const void __nosave_begin, __nosave_end; +//extern const void __nosave_begin, __nosave_end;

Delete it if you want it gone...

kernel/power/power_off.c +2 -0
diff -ruN linux-2.6.15-1/kernel/power/power_off.c build-2.6.15.1/kernel/power/power_off.c
@@ -0,0 +1,79 @@
+/*
+ * kernel/power/suspend2_core/power_off.c

Wrong name.

+void suspend_power_down(void)
+{
+ if (test_action_state(SUSPEND_REBOOT)) {
+ suspend2_prepare_status(DONT_CLEAR_BAR, "Ready to reboot.");
+ kernel_restart(NULL);
+ }

And we do not want UI code in kernel.
diff -ruN linux-2.6.15-1/kernel/power/power_off.h build-2.6.15.1/kernel/power/power_off.h

kernel/power/prepare_image.c +21 -0
diff -ruN linux-2.6.15-1/kernel/power/prepare_image.c build-2.6.15.1/kernel/power/prepare_image.c
@@ -0,0 +1,753 @@
+/*
+ * kernel/power/prepare_image.c
+ *
+ * Copyright (C) 2003-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * We need to eat memory until we can:
+ * 1. Perform the save without changing anything (RAM_NEEDED < max_pfn)
+ * 2. Fit it all in available space (active_writer->available_space() >=
+ *    storage_needed())
+ * 3. Reload the pagedir and pageset1 to places that don't collide with their
+ *    final destinations, not knowing to what extent the resumed kernel will
+ *    overlap with the one loaded at boot time. I think the resumed kernel
+ *    should overlap completely, but I don't want to rely on this as it is 
+ *    an unproven assumption. We therefore assume there will be no overlap at
+ *    all (worse case).
+ * 4. Meet the user's requested limit (if any) on the size of the image.
+ *    The limit is in MB, so pages/256 (assuming 4K pages).
+ *
+ */

There's existing code in kernel to do this, no?

diff -ruN linux-2.6.15-1/kernel/power/prepare_image.h build-2.6.15.1/kernel/power/prepare_image.h

kernel/power/proc.c +2 -0
diff -ruN linux-2.6.15-1/kernel/power/proc.c build-2.6.15.1/kernel/power/proc.c
@@ -0,0 +1,305 @@
+/*
+ * /kernel/power/proc.c

Spurious slash?

+ * Copyright (C) 2002-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * This file contains support for proc entries for tuning Suspend2.
+ *
+ * We have a generic handler that deals with the most common cases, and
+ * hooks for special handlers to use.
+ */

Well, we probably do not want more junk in /proc. And this would not be neccessary if (surprise) userspace controlled suspend. 300 lines unneeeded, and 70 lines in header.

diff -ruN linux-2.6.15-1/kernel/power/process.c build-2.6.15.1/kernel/power/process.c diff -ruN linux-2.6.15-1/kernel/power/proc.h build-2.6.15.1/kernel/power/proc.h diff -ruN linux-2.6.15-1/kernel/power/snapshot.c build-2.6.15.1/kernel/power/snapshot.c

kernel/power/storage.c +16 -0
diff -ruN linux-2.6.15-1/kernel/power/storage.c build-2.6.15.1/kernel/power/storage.c
@@ -0,0 +1,323 @@
+/*
+ * kernel/power/storage.c
+ *
+ * Copyright (C) 2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * Routines for talking to a userspace program that manages storage.
+ *
+ * The kernel side:
+ * - starts the userspace program;
+ * - sends messages telling it when to open and close the connection;
+ * - tells it when to quit;
+ *
+ * The user space side:
+ * - passes messages regarding status;

Yep, if you do it all in userspace, this vanishes. 340 lines down.

diff -ruN linux-2.6.15-1/kernel/power/storage.h build-2.6.15.1/kernel/power/storage.h diff -ruN linux-2.6.15-1/kernel/power/suspend2_common.h build-2.6.15.1/kernel/power/suspend2_common.h

kernel/power/suspend2.h +0 -0
diff -ruN linux-2.6.15-1/kernel/power/suspend2.h build-2.6.15.1/kernel/power/suspend2.h

+
+#define KB(x) ((x) << (PAGE_SHIFT - 10))
+#define MB(x) ((x) >> (20 - PAGE_SHIFT))
+

Eh, nice macros... this should be done for whole kernel or not t all.

kernel/power/suspend_block_io.c +2 -0
diff -ruN linux-2.6.15-1/kernel/power/suspend_block_io.c build-2.6.15.1/kernel/power/suspend_block_io.c
@@ -0,0 +1,1086 @@
+/*
+ * block_io.c

Wrong name.

+ * Copyright 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ * Distributed under GPLv2.
+ *
+ * This file contains block io functions for suspend2. These are
+ * used by the swapwriter and it is planned that they will also
+ * be used by the NFSwriter.
+ *
+ */

1080 lines that are not neccessary in uswsusp case, because we can simply use existing read/write routines.

kernel/power/suspend.c +2 -0
diff -ruN linux-2.6.15-1/kernel/power/suspend.c build-2.6.15.1/kernel/power/suspend.c
@@ -0,0 +1,1133 @@
+/*
+ * kernel/power/suspend2.c

Name?

+/* Compression ratio */
+__nosavedata unsigned long bytes_in = 0, bytes_out = 0; +

Should not compression live in its own plugin?

kernel/power/suspend_checksums.c +0 -0
diff -ruN linux-2.6.15-1/kernel/power/suspend_checksums.c build-2.6.15.1/kernel/power/suspend_checksums.c
@@ -0,0 +1,509 @@

Checksumming can live in userspace, 500 lines down.

kernel/power/suspend_file.c +2 -0
diff -ruN linux-2.6.15-1/kernel/power/suspend_file.c build-2.6.15.1/kernel/power/suspend_file.c
@@ -0,0 +1,1077 @@
+/*
+ * Filewriter.c

Name?

Can happily live in userspace (using bmap), 1070 lines down.

diff -ruN linux-2.6.15-1/kernel/power/suspend.h build-2.6.15.1/kernel/power/suspend.h

kernel/power/suspend_swap.c +10 -0
diff -ruN linux-2.6.15-1/kernel/power/suspend_swap.c build-2.6.15.1/kernel/power/suspend_swap.c
@@ -0,0 +1,1213 @@
+/*
+ * Swapwriter.c
+ *
+ * Copyright 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ * Distributed under GPLv2.
+ * 
+ * This file encapsulates functions for usage of swap space as a
+ * backing store.
+ */

Should be possible to put into userspace, 1200 lines.

diff -ruN linux-2.6.15-1/kernel/power/swsusp.c build-2.6.15.1/kernel/power/swsusp.c diff -ruN linux-2.6.15-1/kernel/power/swsusp.h build-2.6.15.1/kernel/power/swsusp.h

kernel/power/ui.c +23 -0
diff -ruN linux-2.6.15-1/kernel/power/ui.c build-2.6.15.1/kernel/power/ui.c
@@ -0,0 +1,853 @@
+/*
+ * kernel/power/ui.c
+ *
+ * Copyright (C) 1998-2001 Gabor Kuti <[email protected]>
+ * Copyright (C) 1998,2001,2002 Pavel Machek <[email protected]>
+ * Copyright (C) 2002-2003 Florent Chabaud <[email protected]>
+ * Copyright (C) 2002-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * Routines for Suspend2's user interface.
+ *
+ * The user interface code talks to a userspace program via a
+ * netlink socket.
+ *
+ * The kernel side:
+ * - starts the userui program;
+ * - sends text messages and progress bar status;
+ *
+ * The user space side:
+ * - passes messages regarding user requests (abort, toggle reboot etc)
+ *
+ */

Userinterface in kernel. Great. Fortunately Rafael's code allows this 850 lines not to be needed.

+char suspend_wait_for_keypress(int timeout)
+{
+ int fd;
+ char key = '\0';
+ struct termios t, t_backup;
+
+ if (ui_helper_data.pid != -1) {
+ wait_for_key_via_userui();
+ key = ' ';
+ goto out;
+ }
+
+ /* We should be guaranteed /dev/console exists after populate_rootfs() in
+ * init/main.c
+ */
+ if ((fd = sys_open("/dev/console", O_RDONLY, 0)) < 0) {
+ printk("Couldn't open /dev/console.\n");
+ goto out;
+ }

...and you still do user interface in kernel, despite having userland helper.

+/* abort_suspend
+ *
+ * Description: Begin to abort a cycle. If this wasn't at the user's request
+ * (and we're displaying output), tell the user why and wait for
+ * them to acknowledge the message.
+ * Arguments: A parameterised string (imagine this is printk) to display,
+ * telling the user why we're aborting.
+ */
+
+void abort_suspend(const char *fmt, ...)
+{
+ va_list args;
+ int printed_len = 0;

And your own printk... sweeet.

+ if (!test_result_state(SUSPEND_ABORTED)) {
+ if (!test_result_state(SUSPEND_ABORT_REQUESTED)) {
+ va_start(args, fmt);
+ printed_len = vsnprintf(local_printf_buf,
+ sizeof(local_printf_buf), fmt, args);
+ va_end(args);
+ if (ui_helper_data.pid != -1)
+ printed_len = sprintf(local_printf_buf + printed_len,
+ " (Press SPACE to continue)");
+ suspend2_prepare_status(CLEAR_BAR, local_printf_buf);

Even if you call userland for actuall printk(), this is still user interface.

+#if defined(CONFIG_VT) || defined(CONFIG_SERIAL_CONSOLE)
+ console_loglevel = 7;
+
+ say("=== Suspend2 ===\n\n");
+ if (warning_reason) {
+ say("BIG FAT WARNING!! %s\n\n", local_printf_buf);
+ switch (message_detail) {
+ case 0:
+ say("If you continue booting, note that any image WILL NOT BE REMOVED.\n");
+ say("Suspend is unable to do so because the appropriate modules aren't\n");
+ say("loaded. You should manually remove the image to avoid any\n");
+ say("possibility of corrupting your filesystem(s) later.\n");
+ break;
+ case 1:
+ say("If you want to use the current suspend image, reboot and try\n");
+ say("again with the same kernel that you suspended from. If you want\n");
+ say("to forget that image, continue and the image will be erased.\n");
+ break;
+ }
+ say("Press SPACE to reboot or C to continue booting with this kernel\n\n");
+ say("Default action if you don't select one in %d seconds is: %s.\n",
+ message_timeout,
+ default_answer == SUSPEND_CONTINUE_REQ ?
+ "continue booting" : "reboot");
+ } else {
+ say("BIG FAT WARNING!!\n\n");
+ say("You have tried to resume from this image before.\n");
+ say("If it failed once, it may well fail again.\n");
+ say("Would you like to remove the image and boot normally?\n");
+ say("This will be equivalent to entering noresume2 on the\n");
+ say("kernel command line.\n\n");
+ say("Press SPACE to remove the image or C to continue resuming.\n\n");
+ say("Default action if you don't select one in %d seconds is: %s.\n",
+ message_timeout,
+ !!default_answer ?
+ "continue resuming" : "remove the image");
+ }

Wonderful. Did not we agree that this has no place in kernel?

+ { .filename = "userui_progress_granularity",

+	  .permissions			= PROC_RW,
+	  .type				= SUSPEND_PROC_DATA_INTEGER,
+	  .data = {

+ .integer = {
+ .variable = &progress_granularity,
+ .minimum = 1,
+ .maximum = 2048,
+ }
+ }
+ },

So even progress granularity is configurable?
diff -ruN linux-2.6.15-1/kernel/power/ui.h build-2.6.15.1/kernel/power/ui.h diff -ruN linux-2.6.15-1/kernel/power/version.h build-2.6.15.1/kernel/power/version.h diff -ruN linux-2.6.15-1/kernel/sched.c build-2.6.15.1/kernel/sched.c diff -ruN linux-2.6.15-1/kernel/signal.c build-2.6.15.1/kernel/signal.c diff -ruN linux-2.6.15-1/kernel/softirq.c build-2.6.15.1/kernel/softirq.c

kernel/sys.c +5 -2
diff -ruN linux-2.6.15-1/kernel/sys.c build-2.6.15.1/kernel/sys.c
@@ -173,15 +173,18 @@
 {
 	int ret=NOTIFY_DONE;
 	struct notifier_block *nb = *n;
+	struct notifier_block *next;
 
 	while(nb)
 	{
-		ret=nb->notifier_call(nb,val,v);
+		/* Determining next here allows the notifier to unregister itself */
+		next = nb->next;
+		ret = nb->notifier_call(nb,val,v);
 		if(ret&NOTIFY_STOP_MASK)
 		{
 			return ret;
 		}
-		nb=nb->next;
+		nb = next;
 	}
 	return ret;
 }

What is this?
diff -ruN linux-2.6.15-1/kernel/workqueue.c build-2.6.15.1/kernel/workqueue.c diff -ruN linux-2.6.15-1/lib/dyn_pageflags.c build-2.6.15.1/lib/dyn_pageflags.c diff -ruN linux-2.6.15-1/lib/Kconfig build-2.6.15.1/lib/Kconfig diff -ruN linux-2.6.15-1/lib/Makefile build-2.6.15.1/lib/Makefile diff -ruN linux-2.6.15-1/lib/vsprintf.c build-2.6.15.1/lib/vsprintf.c diff -ruN linux-2.6.15-1/mm/bootmem.c build-2.6.15.1/mm/bootmem.c

mm/memory.c +9 -0
diff -ruN linux-2.6.15-1/mm/memory.c build-2.6.15.1/mm/memory.c
@@ -950,6 +950,15 @@
 	return page;
 }
 
+/*
+ * We want the address of the page for Suspend2 to mark as being in pageset1. 
+ */
+
+struct page *suspend2_follow_page(struct mm_struct *mm, unsigned long address)
+{
+	return follow_page(mm->mmap, address, 0);
+}
+
 int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
 		unsigned long start, int len, int write, int force,
 		struct page **pages, struct vm_area_struct **vmas)

In mm/memory.c? It has a comment, unfortunately it does not say anything.

mm/page_alloc.c +2 -2
diff -ruN linux-2.6.15-1/mm/page_alloc.c build-2.6.15.1/mm/page_alloc.c
@@ -920,8 +921,8 @@
 
 	/* This allocation should allow future memory freeing. */
 
-	if (((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE)))
-			&& !in_interrupt()) {
+	if ((((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE))) && 
+				!in_interrupt()) || (test_freezer_state(FREEZER_ON))) {
 		if (!(gfp_mask & __GFP_NOMEMALLOC)) {
 nofail_alloc:
 			/* go through the zonelist yet again, ignoring mins */

You have just made memory allocation slower. Oops.

diff -ruN linux-2.6.15-1/mm/pdflush.c build-2.6.15.1/mm/pdflush.c diff -ruN linux-2.6.15-1/mm/swapfile.c build-2.6.15.1/mm/swapfile.c diff -ruN linux-2.6.15-1/mm/vmscan.c build-2.6.15.1/mm/vmscan.c
diff -ruN linux-2.6.15-1/net/rxrpc/krxiod.c build-2.6.15.1/net/rxrpc/krxiod.c diff -ruN linux-2.6.15-1/net/rxrpc/krxsecd.c build-2.6.15.1/net/rxrpc/krxsecd.c diff -ruN linux-2.6.15-1/net/rxrpc/krxtimod.c build-2.6.15.1/net/rxrpc/krxtimod.c diff -ruN linux-2.6.15-1/net/sunrpc/sched.c build-2.6.15.1/net/sunrpc/sched.c diff -ruN linux-2.6.15-1/net/sunrpc/svcsock.c build-2.6.15.1/net/sunrpc/svcsock.c

So... I'm spreading FUD and suspend2 is not intrusive? I'd not say so.

And you claimed that uswsusp can not solve anything? With above analysis, at least 8040 lines can be moved into userspace. That's more than half of your patch...

Do we do anything really fundamental in userspace? No. Do you do anything fundamental in those 8040 lines? No. => userspace, please.

Now, suspend2 is quite a lot of old code, that does not properly use existing kernel infrastructure. Rather than trying to prove suspend2 is not intrusive (*)... can you just start using Rafael's existing code, and put that code into userspace?

Pavel
(*) it is hard to prove something that is not true.

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...

A message that is not in the archive (sent off-list or not yet received): [email protected]

#258 lore raw

Re: suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

Quoted 25 lines · Dmitry Torokhov
Quoted 16 lines · Pavel Machek
drivers/input/serio/serio.c  2006-01-23 21:38:28.000000000 +1000 renamed from drivers/input/serio/serio.c  2006-01-03 15:08:26.000000000 +1000 +0 -0
@@ -314,6 +314,12 @@


                serio_remove_duplicate_events(event); serio_free_event(event);
+
+               if (unlikely(todo_list_active())) {
+                       up(&serio_sem);
+                       try_todo_list();
+                       down(&serio_sem);
+               }
        }

        up(&serio_sem);

Quoted 2 lines

What is this?

I think it is a leftover from when serio and gameport cores were not "swsusp friendly" and were not releasing semaphore untill all pending messages have been processed. If you remember swsusp used to fail in this case. It can be safely dropped now.

Quoted 2 lines

Overall as you noted alot of changes in Nigel's patch are useable outside of swsuspend2 so it's intrusiveness is not as big as you making it appear.

Yes, some of them are usaeable outside. But many of them were attempted outside and vetoed for whatever reason :-(.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#259 lore raw

Re: suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

In reply to Pavel Machek

Hi.

Quoted 7 lines · Pavel Machek

Hi!

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

The only con I see is the complexity of the code, but then again, Nigel

..but thats a big con.

Quoted 7 lines
Quoted 2 lines

It's fud. Hopefully as I post more suspend2 patches to LKML, people will see that Suspend2 is simpler than what you are planning.

Well, good luck with that. But since you claimed I'm spreading FUD, I think I'll have to go through your patch.

Ouch, it is 500KB, 19K lines. How can you claim it is not complex?!

Size != complexity. Not necessarily.

Quoted 1 line

Lets see what can be done in userspace from that big patch.

Thanks for finally giving some technical feedback.

Quoted 14 lines

diff -ruN linux-2.6.15-1/arch/arm/kernel/signal.c
build-2.6.15.1/arch/arm/kernel/signal.c ---
linux-2.6.15-1/arch/arm/kernel/signal.c 2006-01-03 15:08:24.000000000 +1000
+++ build-2.6.15.1/arch/arm/kernel/signal.c 2006-01-23 21:38:28.000000000
+1000 @@ -637,7 +637,7 @@

arch/arm/kernel/signal.c +1 -1
 	if (!user_mode(regs))
 		return 0;
 
-	if (try_to_freeze())
+	if (try_todo_list())
 		goto no_signal;
 
 	if (current->ptrace & PT_SINGLESTEP)
Quoted 3 lines

Unrelated to suspend2; either push it or drop it. [There are more such changes, even for architectures you do not support suspend on... or do you support suspend on h8300?]

This is because you got 2.2 instead of the latest-devel patch. It (and some changes mentioned below) are got now (2.2.0.1).

Quoted 9 lines

diff -ruN linux-2.6.15-1/arch/frv/kernel/signal.c build-2.6.15.1/arch/frv/kernel/signal.c diff -ruN linux-2.6.15-1/arch/h8300/kernel/signal.c build-2.6.15.1/arch/h8300/kernel/signal.c diff -ruN linux-2.6.15-1/arch/i386/kernel/io_apic.c build-2.6.15.1/arch/i386/kernel/io_apic.c diff -ruN linux-2.6.15-1/arch/i386/kernel/signal.c build-2.6.15.1/arch/i386/kernel/signal.c

Quoted 6 lines

Same here.

diff -ruN linux-2.6.15-1/arch/arm/mm/init.c
build-2.6.15.1/arch/arm/mm/init.c

Ok, so you support arm.

Work in progress.

Quoted 48 lines

diff -ruN linux-2.6.15-1/arch/i386/kernel/time.c
build-2.6.15.1/arch/i386/kernel/time.c ---
linux-2.6.15-1/arch/i386/kernel/time.c 2006-01-03 15:08:25.000000000 +1000
+++ build-2.6.15.1/arch/i386/kernel/time.c 2006-01-23 21:38:28.000000000
+1000 @@ -372,7 +372,8 @@

arch/i386/kernel/time.c +10 -5
 	mod_timer(&sync_cmos_timer, jiffies + 1);
 }
 
-static long clock_cmos_diff, sleep_start;
+static long clock_cmos_diff;
+static unsigned long sleep_start;
 
 static struct timer_opts *last_timer;
 static int timer_suspend(struct sys_device *dev, pm_message_t state)
@@ -380,9 +381,11 @@
 	/*
 	 * Estimate time zone so that set_time can update the clock
 	 */
-	clock_cmos_diff = -get_cmos_time();
+	long cmos_time = __get_cmos_time();
+
+	clock_cmos_diff = -cmos_time;
 	clock_cmos_diff += get_seconds();
-	sleep_start = get_cmos_time();
+	sleep_start = cmos_time;
 	last_timer = cur_timer;
 	cur_timer = &timer_none;
 	if (last_timer->suspend)
@@ -395,14 +398,16 @@
 	unsigned long flags;
 	unsigned long sec;
 	unsigned long sleep_length;
+	unsigned long cmos_time;
 
 #ifdef CONFIG_HPET_TIMER
 	if (is_hpet_enabled())
 		hpet_reenable();
 #endif
+	cmos_time = get_cmos_time();
+	sec = cmos_time + clock_cmos_diff;
+	sleep_length = (cmos_time - sleep_start) * HZ;
 	setup_pit_timer();
-	sec = get_cmos_time() + clock_cmos_diff;
-	sleep_length = (get_cmos_time() - sleep_start) * HZ;
 	write_seqlock_irqsave(&xtime_lock, flags);
 	xtime.tv_sec = sec;
 	xtime.tv_nsec = 0;
Quoted 2 lines

What problem does it solve? Do you want it in mainline? Unrelated to suspend2.

I've discussed it with John Stultz, and intend to do so some more.

Quoted 34 lines

diff -ruN linux-2.6.15-1/arch/i386/mm/init.c build-2.6.15.1/arch/i386/mm/init.c diff -ruN linux-2.6.15-1/arch/m32r/kernel/signal.c build-2.6.15.1/arch/m32r/kernel/signal.c diff -ruN linux-2.6.15-1/arch/mips/kernel/irixsig.c build-2.6.15.1/arch/mips/kernel/irixsig.c diff -ruN linux-2.6.15-1/arch/mips/kernel/signal32.c build-2.6.15.1/arch/mips/kernel/signal32.c diff -ruN linux-2.6.15-1/arch/powerpc/kernel/signal_32.c build-2.6.15.1/arch/powerpc/kernel/signal_32.c diff -ruN linux-2.6.15-1/arch/ppc/mm/init.c build-2.6.15.1/arch/ppc/mm/init.c diff -ruN linux-2.6.15-1/arch/ppc/platforms/pmac_feature.c build-2.6.15.1/arch/ppc/platforms/pmac_feature.c diff -ruN linux-2.6.15-1/arch/sh/kernel/signal.c build-2.6.15.1/arch/sh/kernel/signal.c diff -ruN linux-2.6.15-1/arch/sh64/kernel/signal.c build-2.6.15.1/arch/sh64/kernel/signal.c diff -ruN linux-2.6.15-1/arch/x86_64/kernel/asm-offsets.c build-2.6.15.1/arch/x86_64/kernel/asm-offsets.c ---
linux-2.6.15-1/arch/x86_64/kernel/asm-offsets.c 2006-01-03
15:08:25.000000000 +1000 +++
build-2.6.15.1/arch/x86_64/kernel/asm-offsets.c 2006-01-23
21:38:28.000000000 +1000 @@ -61,8 +61,10 @@

arch/x86_64/kernel/asm-offsets.c +2 -0
 	       offsetof (struct rt_sigframe32, uc.uc_mcontext));
 	BLANK();
 #endif
+#ifdef CONFIG_PM
 	DEFINE(pbe_address, offsetof(struct pbe, address));
 	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
 	DEFINE(pbe_next, offsetof(struct pbe, next));
+#endif
 	return 0;
 }
Quoted 1 line

Do we want this in mailine?

Gone in 2.2.0.1.

Quoted 9 lines

diff -ruN linux-2.6.15-1/arch/x86_64/kernel/e820.c build-2.6.15.1/arch/x86_64/kernel/e820.c diff -ruN linux-2.6.15-1/arch/x86_64/kernel/signal.c build-2.6.15.1/arch/x86_64/kernel/signal.c

diff -ruN linux-2.6.15-1/arch/x86_64/kernel/suspend.c build-2.6.15.1/arch/x86_64/kernel/suspend.c

With uswsusp, you are using existing code...

If I could use your existing code, I would. Unfortunately I'm using a more compact method of storing the data (bitmaps), and I reckon I have zero chance of getting you to switch.

Quoted 19 lines

--- linux-2.6.15-1/arch/x86_64/kernel/suspend.c 2006-01-03
15:08:25.000000000 +1000 +++
build-2.6.15.1/arch/x86_64/kernel/suspend.c 2006-01-23 21:38:28.000000000
+1000 @@ -141,7 +144,7 @@

}

arch/x86_64/kernel/suspend.c +2 -1
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#if defined(CONFIG_SOFTWARE_SUSPEND)
 /* Defined in arch/x86_64/kernel/suspend_asm.S */
 extern int restore_image(void);
@@ -220,4 +223,5 @@
 	restore_image();
 	return 0;
 }
+
 #endif /* CONFIG_SOFTWARE_SUSPEND */
Quoted 1 line

Why such spurious changes?

Leftovers from previously trying #if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_SUSPEND2). Already cleaned up in 2.2.0.1.

Quoted 115 lines

diff -ruN linux-2.6.15-1/arch/x86_64/kernel/time.c build-2.6.15.1/arch/x86_64/kernel/time.c ---
linux-2.6.15-1/arch/x86_64/kernel/time.c 2006-01-03 15:08:25.000000000
+1000 +++ build-2.6.15.1/arch/x86_64/kernel/time.c 2006-01-23
21:38:28.000000000 +1000 @@ -509,11 +509,56 @@

arch/x86_64/kernel/time.c +25 -0
 	return cycles_2_ns(a);
 }
 
+unsigned long __get_cmos_time(void)
+{
+	unsigned int year, mon, day, hour, min, sec;
+
+	/*
+	 * Do we need the spinlock in here too?
+	 *
+	 * If we're called directly (not via get_cmos_time),
+	 * we're in the middle of a sysdev suspend/resume
+	 * and interrupts are disabled, so this
+	 * should be safe without any locking.
+	 * 				-- NC
+	 */
+
+	do {
+		sec = CMOS_READ(RTC_SECONDS);
+		min = CMOS_READ(RTC_MINUTES);
+		hour = CMOS_READ(RTC_HOURS);
+		day = CMOS_READ(RTC_DAY_OF_MONTH);
+		mon = CMOS_READ(RTC_MONTH);
+		year = CMOS_READ(RTC_YEAR);
+	} while (sec != CMOS_READ(RTC_SECONDS));
+
+	/*
+	 * We know that x86-64 always uses BCD format, no need to check the

config + * register.

arch/x86_64/kernel/time.c +21 -4
+	 */
+
+	BCD_TO_BIN(sec);
+	BCD_TO_BIN(min);
+	BCD_TO_BIN(hour);
+	BCD_TO_BIN(day);
+	BCD_TO_BIN(mon);
+	BCD_TO_BIN(year);
+
+	/*
+	 * This will work up to Dec 31, 2069.
+	 */
+
+	if ((year += 1900) < 1970)
+		year += 100;
+
+	return mktime(year, mon, day, hour, min, sec);
+}
+
 unsigned long get_cmos_time(void)
 {
-	unsigned int timeout, year, mon, day, hour, min, sec;
+	unsigned int timeout;
 	unsigned char last, this;
-	unsigned long flags;
+	unsigned long flags, result;
 
 /*
  * The Linux interpretation of the CMOS clock register contents: When the
@@ -534,39 +579,10 @@
 		timeout--;
 	}
 
-/*
- * Here we are safe to assume the registers won't change for a whole

second, so - * we just go ahead and read them.

arch/x86_64/kernel/time.c +3 -29
-	 */
-
-		sec = CMOS_READ(RTC_SECONDS);
-		min = CMOS_READ(RTC_MINUTES);
-		hour = CMOS_READ(RTC_HOURS);
-		day = CMOS_READ(RTC_DAY_OF_MONTH);
-		mon = CMOS_READ(RTC_MONTH);
-		year = CMOS_READ(RTC_YEAR);
-
+	result =  __get_cmos_time();
 	spin_unlock_irqrestore(&rtc_lock, flags);
 
-/*
- * We know that x86-64 always uses BCD format, no need to check the config
- * register.
- */
-
-	    BCD_TO_BIN(sec);
-	    BCD_TO_BIN(min);
-	    BCD_TO_BIN(hour);
-	    BCD_TO_BIN(day);
-	    BCD_TO_BIN(mon);
-	    BCD_TO_BIN(year);
-
-/*
- * x86-64 systems only exists since 2002.
- * This will work up to Dec 31, 2100
- */
-	year += 2000;
-
-	return mktime(year, mon, day, hour, min, sec);
+	return result;
 }
 
 #ifdef CONFIG_CPU_FREQ
@@ -1004,7 +1020,7 @@
 	/*
 	 * Estimate time zone so that set_time can update the clock
 	 */
-	long cmos_time =  get_cmos_time();
+	long cmos_time =  __get_cmos_time();
 
 	clock_cmos_diff = -cmos_time;
 	clock_cmos_diff += get_seconds();
Quoted 1 line

What does this do? Seems independend from rest of suspend2.

Discussing with John (see above).

Quoted 25 lines

diff -ruN linux-2.6.15-1/arch/x86_64/mm/init.c build-2.6.15.1/arch/x86_64/mm/init.c diff -ruN linux-2.6.15-1/block/ll_rw_blk.c build-2.6.15.1/block/ll_rw_blk.c diff -ruN linux-2.6.15-1/crypto/deflate.c build-2.6.15.1/crypto/deflate.c ---
linux-2.6.15-1/crypto/deflate.c 2006-01-03 15:08:25.000000000 +1000 +++
build-2.6.15.1/crypto/deflate.c 2006-01-23 21:38:28.000000000 +1000 @@
-143,8 +143,15 @@

crypto/deflate.c +9 -2
 	ret = zlib_deflate(stream, Z_FINISH);
 	if (ret != Z_STREAM_END) {
-		ret = -EINVAL;
-		goto out;
+	    	if (!(ret == Z_OK && !stream->avail_in && !stream->avail_out)) {
+			ret = -EINVAL;
+			goto out;
+		} else {
+			u8 zerostuff = 0;
+			stream->next_out = &zerostuff;
+			stream->avail_out = 1;
+			ret = zlib_deflate(stream, Z_FINISH);
+		}
 	}
 	ret = 0;
 	*dlen = stream->total_out;
Quoted 1 line

WTF is this?

The gzip cryptoapi plugin doesn't like decompressing a full page. There is already a similar patch in the inflate code iirc. I

Quoted 45 lines

diff -ruN linux-2.6.15-1/crypto/Kconfig build-2.6.15.1/crypto/Kconfig

crypto/Kconfig +7 -0
@@ -285,6 +285,13 @@
 
 	  You will most probably want this if using IPSec.
 
+config CRYPTO_LZF
+	tristate "LZF compression algorithm"
+	depends on CRYPTO
+	help
+	  This is the LZF algorithm. It is especially useful for Suspend2,
+	  because it achieves good compression quickly.
+
 config CRYPTO_MICHAEL_MIC
 	tristate "Michael MIC keyed digest algorithm"
 	depends on CRYPTO

diff -ruN linux-2.6.15-1/crypto/lzf.c build-2.6.15.1/crypto/lzf.c diff -ruN linux-2.6.15-1/crypto/Makefile build-2.6.15.1/crypto/Makefile

With uswsusp, LZF can stay in userspace.

diff -ruN linux-2.6.15-1/Documentation/kernel-parameters.txt build-2.6.15.1/Documentation/kernel-parameters.txt ---
linux-2.6.15-1/Documentation/kernel-parameters.txt 2006-01-03
15:08:24.000000000 +1000 +++
build-2.6.15.1/Documentation/kernel-parameters.txt 2006-01-23
21:38:28.000000000 +1000 @@ -71,6 +71,7 @@

crypto/Kconfig +2 -0
 	SERIAL	Serial support is enabled.
 	SMP	The kernel is an SMP kernel.
 	SPARC	Sparc architecture is enabled.
+	SUSPEND2 Suspend2 is enabled.
 	SWSUSP	Software suspend is enabled.
 	TS	Appropriate touchscreen support is enabled.
 	USB	USB support is enabled.
@@ -966,6 +967,8 @@
 	noresume	[SWSUSP] Disables resume and restores original swap
 			space.
 
+	noresume2	[SUSPEND2] Disables resuming and restores original swap

signature. +

crypto/Kconfig +0 -0
 	no-scroll	[VGA] Disables scrollback.
 			This is required for the Braillex ib80-piezo Braille
 			reader made by F.H. Papenmeier (Germany).
Quoted 1 line

...and kernel parameters do not need to change...

This is only because I'm deliberately not stomping on your code at the moment.

Quoted 14 lines

diff -ruN linux-2.6.15-1/Documentation/power/internals.txt build-2.6.15.1/Documentation/power/internals.txt ---
linux-2.6.15-1/Documentation/power/internals.txt 1970-01-01
10:00:00.000000000 +1000 +++
build-2.6.15.1/Documentation/power/internals.txt 2006-01-23
21:38:28.000000000 +1000 + Plugins are linked together in pipeline
fashion. There may be zero or more + page transformers in a pipeline,
and there is always exactly one writer. + The pipeline follows this
pattern:

crypto/Kconfig +4 -0
+
+		---------------------------------
+		|          Suspend2 Core
+		---------------------------------
Quoted 1 line

Notice missing '|'

Ta.

Quoted 41 lines
crypto/Kconfig +15 -0
+				|
+				|
+		---------------------------------
+		|	Page transformer 1	|
+		---------------------------------
+				|
+				|
+		---------------------------------
+		|	Page transformer 2	|
+		---------------------------------
+				|
+				|
+		---------------------------------
+		|            Writer		|
+		---------------------------------

Also notice that with uswsusp, this pipeline can stay in userspace.

diff -ruN linux-2.6.15-1/Documentation/power/kernel_threads.txt build-2.6.15.1/Documentation/power/kernel_threads.txt diff -ruN linux-2.6.15-1/Documentation/power/suspend2.txt build-2.6.15.1/Documentation/power/suspend2.txt

...and extensive documentation can stay with userspace tools.

diff -ruN linux-2.6.15-1/Documentation/power/swsusp.txt build-2.6.15.1/Documentation/power/swsusp.txt diff -ruN linux-2.6.15-1/drivers/acpi/osl.c build-2.6.15.1/drivers/acpi/osl.c ---
linux-2.6.15-1/drivers/acpi/osl.c 2006-01-03 15:08:26.000000000 +1000 +++
build-2.6.15.1/drivers/acpi/osl.c 2006-01-23 21:38:28.000000000 +1000 @@
-91,7 +91,7 @@

crypto/Kconfig +1 -1
 		       "Access to PCI configuration space unavailable\n");
 		return AE_NULL_ENTRY;
 	}
-	kacpid_wq = create_singlethread_workqueue("kacpid");
+	kacpid_wq = create_nofreeze_singlethread_workqueue("kacpid");
 	BUG_ON(!kacpid_wq);
 
 	return AE_OK;
Quoted 2 lines

Big search and replace all over the tree. Changes the default to unsafe one. Do you ever listen to comments?

"Changes the default to unsafe one"? It makes the default to be freezing kernel threads, which should be safer since they then won't unexpectedly do (random action).

Quoted 19 lines

diff -ruN linux-2.6.15-1/drivers/acpi/sleep/proc.c build-2.6.15.1/drivers/acpi/sleep/proc.c diff -ruN linux-2.6.15-1/drivers/base/power/resume.c build-2.6.15.1/drivers/base/power/resume.c ---
linux-2.6.15-1/drivers/base/power/resume.c 2006-01-03 15:08:26.000000000
+1000 +++ build-2.6.15.1/drivers/base/power/resume.c 2006-01-23
21:38:28.000000000 +1000 @@ -101,6 +101,11 @@

crypto/Kconfig +2 -0
 		list_del_init(entry);
 		list_add_tail(entry, &dpm_active);
 		resume_device(dev);
+		if (!irqs_disabled()) {
+			printk("WARNING: Interrupts reenabled while resuming sysdev driver

%s.\n", + kobject_name(&dev->kobj));

crypto/Kconfig +2 -0
+			local_irq_disable();
+		}
 		put_device(dev);
 	}
 }
Quoted 2 lines

Nothing to do with suspend2. Either it is good idea or it is not, and I think I saw mails telling you it is not.

Yes. Changed in 2.2.0.1.

Quoted 5 lines

diff -ruN linux-2.6.15-1/drivers/base/power/suspend.c build-2.6.15.1/drivers/base/power/suspend.c diff -ruN linux-2.6.15-1/drivers/base/sys.c build-2.6.15.1/drivers/base/sys.c

...but you still keep the bad patches in your tree.

Fixed in 2.2.0.1

Quoted 40 lines

diff -ruN linux-2.6.15-1/drivers/block/pktcdvd.c
build-2.6.15.1/drivers/block/pktcdvd.c

diff -ruN linux-2.6.15-1/drivers/char/agp/agp_suspend.h build-2.6.15.1/drivers/char/agp/agp_suspend.h diff -ruN linux-2.6.15-1/drivers/char/agp/ati-agp.c build-2.6.15.1/drivers/char/agp/ati-agp.c diff -ruN linux-2.6.15-1/drivers/char/agp/nvidia-agp.c build-2.6.15.1/drivers/char/agp/nvidia-agp.c

AGP stuff is independed with rest of code. Ahha, it was probably included in latest trees, but your diff is still against 2.6.15.

diff -ruN linux-2.6.15-1/drivers/char/hvc_console.c build-2.6.15.1/drivers/char/hvc_console.c diff -ruN linux-2.6.15-1/drivers/char/hvcs.c build-2.6.15.1/drivers/char/hvcs.c diff -ruN linux-2.6.15-1/drivers/ieee1394/ieee1394_core.c build-2.6.15.1/drivers/ieee1394/ieee1394_core.c diff -ruN linux-2.6.15-1/drivers/ieee1394/nodemgr.c build-2.6.15.1/drivers/ieee1394/nodemgr.c diff -ruN linux-2.6.15-1/drivers/input/gameport/gameport.c build-2.6.15.1/drivers/input/gameport/gameport.c diff -ruN linux-2.6.15-1/drivers/input/serio/serio.c build-2.6.15.1/drivers/input/serio/serio.c ---
linux-2.6.15-1/drivers/input/serio/serio.c 2006-01-03 15:08:26.000000000
+1000 +++ build-2.6.15.1/drivers/input/serio/serio.c 2006-01-23
21:38:28.000000000 +1000 @@ -314,6 +314,12 @@

crypto/Kconfig +6 -0
 		serio_remove_duplicate_events(event);
 		serio_free_event(event);
+
+		if (unlikely(todo_list_active())) {
+  			up(&serio_sem);
+			try_todo_list();
+  			down(&serio_sem);
+		}
 	}
 
 	up(&serio_sem);
Quoted 1 line

What is this?

From Christoph's patch - gone in 2.2.0.1.

Quoted 14 lines

diff -ruN linux-2.6.15-1/drivers/macintosh/Kconfig build-2.6.15.1/drivers/macintosh/Kconfig ---
linux-2.6.15-1/drivers/macintosh/Kconfig 2006-01-03 15:08:26.000000000
+1000 +++ build-2.6.15.1/drivers/macintosh/Kconfig 2006-01-23
21:38:28.000000000 +1000 @@ -192,4 +192,8 @@

crypto/Kconfig +4 -0
 	tristate "Support for ANS LCD display"
 	depends on ADB_CUDA && PPC_PMAC
 
+config SOFTWARE_REPLACE_SLEEP
+	bool "Using Software suspend replace broken sleep function"
+	depends on SUSPEND2
+
 endmenu
Quoted 2 lines

If sleep function is broken, why would you ever want it enabled? Why does this need to be configurable?

It gets unbroken if replaced with suspend2 (and I guess swsusp) :). This is from Hugang's patch, so I'm not claiming expert knowledge on this bit.

Quoted 38 lines

diff -ruN linux-2.6.15-1/drivers/macintosh/therm_adt746x.c build-2.6.15.1/drivers/macintosh/therm_adt746x.c diff -ruN linux-2.6.15-1/drivers/macintosh/via-pmu.c build-2.6.15.1/drivers/macintosh/via-pmu.c diff -ruN linux-2.6.15-1/drivers/md/dm-crypt.c build-2.6.15.1/drivers/md/dm-crypt.c diff -ruN linux-2.6.15-1/drivers/md/md.c build-2.6.15.1/drivers/md/md.c diff -ruN linux-2.6.15-1/drivers/media/dvb/dvb-core/dvb_frontend.c build-2.6.15.1/drivers/media/dvb/dvb-core/dvb_frontend.c diff -ruN linux-2.6.15-1/drivers/media/video/msp3400.c build-2.6.15.1/drivers/media/video/msp3400.c diff -ruN linux-2.6.15-1/drivers/media/video/tvaudio.c build-2.6.15.1/drivers/media/video/tvaudio.c diff -ruN linux-2.6.15-1/drivers/media/video/video-buf-dvb.c build-2.6.15.1/drivers/media/video/video-buf-dvb.c diff -ruN linux-2.6.15-1/drivers/net/8139too.c build-2.6.15.1/drivers/net/8139too.c diff -ruN linux-2.6.15-1/drivers/net/irda/sir_kthread.c build-2.6.15.1/drivers/net/irda/sir_kthread.c ---
linux-2.6.15-1/drivers/net/irda/sir_kthread.c 2006-01-03 15:08:29.000000000
+1000 +++ build-2.6.15.1/drivers/net/irda/sir_kthread.c 2006-01-23
21:38:28.000000000 +1000 @@ -112,6 +112,7 @@

crypto/Kconfig +1 -3
 	DECLARE_WAITQUEUE(wait, current);
 
 	daemonize("kIrDAd");
+	current->flags |= PF_NOFREEZE;
 
 	irda_rq_queue.thread = current;
@@ -134,9 +135,6 @@
 			__set_task_state(current, TASK_RUNNING);
 		remove_wait_queue(&irda_rq_queue.kick, &wait);
 
-		/* make swsusp happy with our thread */
-		try_to_freeze();
-
 		run_irda_queue();
 	}
 
Quoted 1 line

Why do you need irda threads running during suspend?

Not sure where that came from. Will revert.

Quoted 35 lines

diff -ruN linux-2.6.15-1/drivers/net/irda/stir4200.c build-2.6.15.1/drivers/net/irda/stir4200.c diff -ruN linux-2.6.15-1/drivers/net/wireless/airo.c build-2.6.15.1/drivers/net/wireless/airo.c diff -ruN linux-2.6.15-1/drivers/pcmcia/cs.c build-2.6.15.1/drivers/pcmcia/cs.c diff -ruN linux-2.6.15-1/drivers/pnp/pnpbios/core.c build-2.6.15.1/drivers/pnp/pnpbios/core.c diff -ruN linux-2.6.15-1/drivers/scsi/hosts.c build-2.6.15.1/drivers/scsi/hosts.c diff -ruN linux-2.6.15-1/drivers/scsi/lpfc/lpfc_init.c build-2.6.15.1/drivers/scsi/lpfc/lpfc_init.c diff -ruN linux-2.6.15-1/drivers/usb/core/hub.c build-2.6.15.1/drivers/usb/core/hub.c diff -ruN linux-2.6.15-1/drivers/usb/gadget/file_storage.c build-2.6.15.1/drivers/usb/gadget/file_storage.c diff -ruN linux-2.6.15-1/drivers/usb/net/pegasus.c build-2.6.15.1/drivers/usb/net/pegasus.c diff -ruN linux-2.6.15-1/drivers/usb/storage/usb.c build-2.6.15.1/drivers/usb/storage/usb.c diff -ruN linux-2.6.15-1/drivers/w1/w1.c build-2.6.15.1/drivers/w1/w1.c diff -ruN linux-2.6.15-1/fs/afs/kafsasyncd.c build-2.6.15.1/fs/afs/kafsasyncd.c diff -ruN linux-2.6.15-1/fs/afs/kafstimod.c build-2.6.15.1/fs/afs/kafstimod.c diff -ruN linux-2.6.15-1/fs/jbd/journal.c build-2.6.15.1/fs/jbd/journal.c diff -ruN linux-2.6.15-1/fs/jffs/intrep.c build-2.6.15.1/fs/jffs/intrep.c diff -ruN linux-2.6.15-1/fs/jffs2/background.c build-2.6.15.1/fs/jffs2/background.c diff -ruN linux-2.6.15-1/fs/jfs/jfs_logmgr.c build-2.6.15.1/fs/jfs/jfs_logmgr.c diff -ruN linux-2.6.15-1/fs/jfs/jfs_txnmgr.c build-2.6.15.1/fs/jfs/jfs_txnmgr.c diff -ruN linux-2.6.15-1/fs/lockd/clntlock.c build-2.6.15.1/fs/lockd/clntlock.c diff -ruN linux-2.6.15-1/fs/lockd/clntproc.c build-2.6.15.1/fs/lockd/clntproc.c diff -ruN linux-2.6.15-1/fs/lockd/svc.c build-2.6.15.1/fs/lockd/svc.c diff -ruN linux-2.6.15-1/fs/xfs/linux-2.6/xfs_buf.c build-2.6.15.1/fs/xfs/linux-2.6/xfs_buf.c diff -ruN linux-2.6.15-1/fs/xfs/linux-2.6/xfs_super.c build-2.6.15.1/fs/xfs/linux-2.6/xfs_super.c

Quoted 2 lines

So you run big search & replace all over the tree, making your diff huge. Either drop them or merge them...

That's the workqueue stuff, so it's not what you're thinking. There are a number of routines that aren't changed.

Quoted 11 lines

diff -ruN linux-2.6.15-1/include/asm-arm/hw_irq.h
build-2.6.15.1/include/asm-arm/hw_irq.h ---
linux-2.6.15-1/include/asm-arm/hw_irq.h 1970-01-01 10:00:00.000000000 +1000
+++ build-2.6.15.1/include/asm-arm/hw_irq.h 2006-01-23 21:38:28.000000000
+1000 @@ -0,0 +1,4 @@

crypto/Kconfig +4 -0
+#ifndef __ASM_HARDIRQ_H
+#define __ASM_HARDIRQ_H
+#include <asm/hardirq.h>
+#endif

What does this have to do with suspend2?

Not sure. I'll ask the guy who's working on the arm support.

Quoted 117 lines

diff -ruN linux-2.6.15-1/include/asm-arm/suspend2.h build-2.6.15.1/include/asm-arm/suspend2.h diff -ruN linux-2.6.15-1/include/asm-i386/mach-default/mach_time.h build-2.6.15.1/include/asm-i386/mach-default/mach_time.h diff -ruN linux-2.6.15-1/include/asm-i386/suspend2.h build-2.6.15.1/include/asm-i386/suspend2.h ---
linux-2.6.15-1/include/asm-i386/suspend2.h 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/include/asm-i386/suspend2.h 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,288 @@
+ /*

crypto/Kconfig +43 -0
+  * Copyright 2003-2005 Nigel Cunningham <[email protected]>
+  * Based on code
+  * Copyright 2001-2002 Pavel Machek <[email protected]>
+  * Based on code
+  * Copyright 2001 Patrick Mochel <[email protected]>
+  */
+#include <linux/irq.h>
+#include <asm/desc.h>
+#include <asm/i387.h>
+#include <asm/tlbflush.h>
+#include <asm/desc.h>
+#include <asm/processor.h>
+
+/* image of the saved processor states */
+struct suspend2_saved_context {
+	u32 eax, ebx, ecx, edx;
+	u32 esp, ebp, esi, edi;
+	u16 es, fs, gs, ss;
+	u32 cr0, cr2, cr3, cr4;
+	u16 gdt_pad;
+	u16 gdt_limit;
+	u32 gdt_base;
+	u16 idt_pad;
+	u16 idt_limit;
+	u32 idt_base;
+	u16 ldt;
+	u16 tss;
+	u32 tr;
+	u32 safety;
+	u32 return_address;
+	u32 eflags;
+} __attribute__((packed));
+typedef struct suspend2_saved_context suspend2_saved_context_t;
+
+/* temporary storage */
+extern struct suspend2_saved_context suspend2_saved_context;
+
+/*
+ * save_processor_context
+ *
+ * Save the state of the processor before we go to sleep.
+ *
+ * return_stack is the value of the stack pointer (%esp) as the caller

sees it. + * A good way could not be found to obtain it from here (don't want to make + * _too_ many assumptions about the layout of the stack this far down.) Also, + * the handy little __builtin_frame_pointer(level) where level > 0, is blatantly + * buggy - it returns the value of the stack at the proper location, not the + * location, like it should (as of gcc 2.91.66)
+ *
+ * Note that the context and timing of this function is pretty critical.
+ * With a minimal amount of things going on in the caller and in here, gcc
+ * does a good job of being just a dumb compiler. Watch the assembly output + * if anything changes, though, and make sure everything is going in the right + * place.
+ */

crypto/Kconfig +18 -0
+static inline void suspend2_arch_save_processor_context(void)
+{
+	kernel_fpu_begin();
+
+	/*
+	 * descriptor tables
+	 */
+	asm volatile ("sgdt (%0)" : "=m" (suspend2_saved_context.gdt_limit));
+	asm volatile ("sidt (%0)" : "=m" (suspend2_saved_context.idt_limit));
+	asm volatile ("sldt (%0)" : "=m" (suspend2_saved_context.ldt));
+	asm volatile ("str (%0)"  : "=m" (suspend2_saved_context.tr));
+
+	/*
+	 * save the general registers.
+	 * note that gcc has constructs to specify output of certain registers,
+	 * but they're not used here, because it assumes that you want to modify
+	 * those registers, so it tries to be smart and save them beforehand.
+	 * It's really not necessary, and kinda fishy (check the assembly

output), + * so it's avoided.

crypto/Kconfig +30 -0
+	 */
+	asm volatile ("movl %%esp, (%0)" : "=m" (suspend2_saved_context.esp));
+	asm volatile ("movl %%eax, (%0)" : "=m" (suspend2_saved_context.eax));
+	asm volatile ("movl %%ebx, (%0)" : "=m" (suspend2_saved_context.ebx));
+	asm volatile ("movl %%ecx, (%0)" : "=m" (suspend2_saved_context.ecx));
+	asm volatile ("movl %%edx, (%0)" : "=m" (suspend2_saved_context.edx));
+	asm volatile ("movl %%ebp, (%0)" : "=m" (suspend2_saved_context.ebp));
+	asm volatile ("movl %%esi, (%0)" : "=m" (suspend2_saved_context.esi));
+	asm volatile ("movl %%edi, (%0)" : "=m" (suspend2_saved_context.edi));
+
+	/*
+	 * segment registers
+	 */
+	asm volatile ("movw %%es, %0" : "=r" (suspend2_saved_context.es));
+	asm volatile ("movw %%fs, %0" : "=r" (suspend2_saved_context.fs));
+	asm volatile ("movw %%gs, %0" : "=r" (suspend2_saved_context.gs));
+	asm volatile ("movw %%ss, %0" : "=r" (suspend2_saved_context.ss));
+
+	/*
+	 * control registers
+	 */
+	asm volatile ("movl %%cr0, %0" : "=r" (suspend2_saved_context.cr0));
+	asm volatile ("movl %%cr2, %0" : "=r" (suspend2_saved_context.cr2));
+	asm volatile ("movl %%cr3, %0" : "=r" (suspend2_saved_context.cr3));
+	asm volatile ("movl %%cr4, %0" : "=r" (suspend2_saved_context.cr4));
+
+	/*
+	 * eflags
+	 */
+	asm volatile ("pushfl ; popl (%0)" : "=m"

(suspend2_saved_context.eflags)); +}

Quoted 1 line

Can't you use existing suspend functions?

I'd like to. I've forgotten why I think I can't - will check it out again.

Quoted 27 lines

Same for the rest of file...

crypto/Kconfig +24 -0
+static inline void suspend2_arch_flush_caches(void)
+{
+#ifdef CONFIG_SMP
+	cpu_clear(0, per_cpu(cpu_tlbstate,
+				0).active_mm->cpu_vm_mask);
+#endif
+	wbinvd();
+	__flush_tlb_all();
+
+}
+
+static inline void suspend2_arch_post_copyback(void)
+{
+	BUG_ON(!irqs_disabled());
+
+	current_cpu_data.loops_per_jiffy =
+		c_loops_per_jiffy_ref;
+#ifndef CONFIG_SMP
+	loops_per_jiffy = c_loops_per_jiffy_ref;
+	cpu_khz = cpu_khz_ref;
+#endif
+}
+
+#endif
Quoted 2 lines

What is this? Is your method of dealing with SMP different from mainline's?

It used to be (when I had SMP support and mainline didn't), and this is a vestage thought was still useful. Since you ask, I'll look at it again.

Quoted 10 lines

diff -ruN linux-2.6.15-1/include/asm-ppc/cpu_context.h build-2.6.15.1/include/asm-ppc/cpu_context.h diff -ruN linux-2.6.15-1/include/asm-x86_64/page.h build-2.6.15.1/include/asm-x86_64/page.h diff -ruN linux-2.6.15-1/include/asm-x86_64/suspend2.h build-2.6.15.1/include/asm-x86_64/suspend2.h

Same here. You should be able to use mainline's snapshot functionality. That's common piece between swsusp and suspend2, and having your own copy helps noone.

As mentioned above, I use a different method of storing the meta data (bitmaps). It's more space efficient, but I expect you won't want it because it will make your asm longer.

Quoted 12 lines

diff -ruN linux-2.6.15-1/include/asm-x86_64/suspend.h build-2.6.15.1/include/asm-x86_64/suspend.h diff -ruN linux-2.6.15-1/include/linux/bio.h build-2.6.15.1/include/linux/bio.h ---
linux-2.6.15-1/include/linux/bio.h 2006-01-03 15:08:44.000000000 +1000 +++
build-2.6.15.1/include/linux/bio.h 2006-01-23 21:38:28.000000000 +1000 @@
-124,6 +124,7 @@
#define BIO_BOUNCED 5 /* bio is a bounce bio */
#define BIO_USER_MAPPED 6 /* contains user pages */
#define BIO_EOPNOTSUPP 7 /* not supported */
+#define BIO_SUSPEND2 8 /* Suspend2 bio - for corruption checking */
#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))

Quoted 3 lines

/*

You just should not corrupt the data...

Agreed. It wasn't Suspend corrupting the data that I was checking for, but filesystems (XFS specifically) submitting I/O after freezing.

Quoted 9 lines

diff -ruN linux-2.6.15-1/include/linux/dyn_pageflags.h build-2.6.15.1/include/linux/dyn_pageflags.h ---
linux-2.6.15-1/include/linux/dyn_pageflags.h 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/include/linux/dyn_pageflags.h 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,66 @@

crypto/Kconfig +3 -0
+
+typedef unsigned long *** dyn_pageflags_t;
+
Quoted 3 lines

Eh....

Could not you just use normal page flags like swsusp does?

As mentioned above, I use these pseudo-pageflags to store almost all the metadata - which pages are to be saved, which are LRU, where they're to be copied to and from for the atomic copy etc. If I used real pageflags, I'd need four or five. This way, I leave the real ones free for people who really need them. By using pseudo-pageflags, I also make serialising the metadata much simpler (just another page to r/w).

Quoted 34 lines

diff -ruN linux-2.6.15-1/include/linux/freezer.h
build-2.6.15.1/include/linux/freezer.h ---
linux-2.6.15-1/include/linux/freezer.h 1970-01-01 10:00:00.000000000 +1000
+++ build-2.6.15.1/include/linux/freezer.h 2006-01-23 21:38:28.000000000
+1000 @@ -0,0 +1,28 @@

crypto/Kconfig +28 -0
+/* Freezer declarations */
+
+#define FREEZER_ON 0
+#define ABORT_FREEZING 1
+
+#define FREEZER_KERNEL_THREADS 0
+#define FREEZER_ALL_THREADS 1
+
+#ifdef CONFIG_PM
+extern unsigned long freezer_state;
+
+#define test_freezer_state(bit) test_bit(bit, &freezer_state)
+#define set_freezer_state(bit) set_bit(bit, &freezer_state)
+#define clear_freezer_state(bit) clear_bit(bit, &freezer_state)
+
+#define freezer_is_on() (test_freezer_state(FREEZER_ON))
+
+extern void do_freeze_process(struct notifier_block *nl);
+
+#else
+
+#define test_freezer_state(bit) (0)
+#define set_freezer_state(bit) do { } while(0)
+#define clear_freezer_state(bit) do { } while(0)
+
+#define freezer_is_on() (0)
+
+#endif
Quoted 3 lines

So you have your own freezer. Can you still reproduce some failures in mainline's freezer? There's one nasty case with vfork() we do not have solved...

You've seen the changes I have for process.c already. I'm yet to modify them to match what did get applied out of our recent discussions, but there's nothing you haven't seen. This file is just a result of moving some of the include/linx/sched.h declarations out, so you don't have to recompile everything that depends on sched.h just because you make a minor change to (say) a freezer function declaration.

Quoted 15 lines

diff -ruN linux-2.6.15-1/include/linux/kernel.h
build-2.6.15.1/include/linux/kernel.h ---
linux-2.6.15-1/include/linux/kernel.h 2006-01-03 15:08:45.000000000 +1000
+++ build-2.6.15.1/include/linux/kernel.h 2006-01-23 21:38:28.000000000
+1000 @@ -103,6 +103,8 @@

crypto/Kconfig +2 -0
 	__attribute__ ((format (printf, 2, 0)));
 extern int snprintf(char * buf, size_t size, const char * fmt, ...)
 	__attribute__ ((format (printf, 3, 4)));
+extern int snprintf_used(char *buffer, int buffer_size,
+		const char *fmt, ...);
 extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list

args) __attribute__ ((format (printf, 3, 0)));
extern int scnprintf(char * buf, size_t size, const char * fmt, ...)

Quoted 1 line

Why do you need to modify printf-like functions?!

It's not modified, but a new one. IIRC, the closest one to what I was after didn't return the info I needed.

Quoted 16 lines

diff -ruN linux-2.6.15-1/include/linux/kthread.h
build-2.6.15.1/include/linux/kthread.h diff -ruN
linux-2.6.15-1/include/linux/netlink.h
build-2.6.15.1/include/linux/netlink.h ---
linux-2.6.15-1/include/linux/netlink.h 2006-01-03 15:08:45.000000000 +1000
+++ build-2.6.15.1/include/linux/netlink.h 2006-01-23 21:38:28.000000000
+1000 @@ -21,6 +21,8 @@
#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
#define NETLINK_GENERIC 16

crypto/Kconfig +2 -0
+#define NETLINK_SUSPEND2_USERUI	17	/* For suspend2's userui */
+#define NETLINK_SUSPEND2_USM	18	/* For suspend2's userui */
 
 #define MAX_LINKS 32
Quoted 1 line

Yeh, and this is exactly why uswsusp is superior.

What am I missing?

Oops. The second comment should say storage manager, not userui.

Quoted 54 lines

diff -ruN linux-2.6.15-1/include/linux/sched.h
build-2.6.15.1/include/linux/sched.h diff -ruN
linux-2.6.15-1/include/linux/suspend2.h
build-2.6.15.1/include/linux/suspend2.h +

crypto/Kconfig +49 -0
+/* Debug sections  - if debugging compiled in */
+enum {
+	SUSPEND_ANY_SECTION,
+	SUSPEND_FREEZER,
+	SUSPEND_EAT_MEMORY,
+	SUSPEND_PAGESETS,
+	SUSPEND_IO,
+	SUSPEND_BMAP,
+	SUSPEND_HEADER,
+	SUSPEND_WRITER,
+	SUSPEND_MEMORY,
+	SUSPEND_EXTENTS,
+	SUSPEND_SPINLOCKS,
+	SUSPEND_MEM_POOL,
+	SUSPEND_RANGE_PARANOIA,
+	SUSPEND_NOSAVE,
+	SUSPEND_INTEGRITY
+};
+
+/* debugging levels. */
+#define SUSPEND_STATUS		0
+#define SUSPEND_ERROR		2
+#define SUSPEND_LOW	 	3
+#define SUSPEND_MEDIUM	 	4
+#define SUSPEND_HIGH	  	5
+#define SUSPEND_VERBOSE		6
+
+/* second status register */
+enum {
+	SUSPEND_REBOOT,
+	SUSPEND_PAUSE,
+	SUSPEND_SLOW,
+	SUSPEND_NOPAGESET2,
+	SUSPEND_LOGALL,
+	SUSPEND_CAN_CANCEL,
+	SUSPEND_KEEP_IMAGE,
+	SUSPEND_FREEZER_TEST,
+	SUSPEND_FREEZER_TEST_SHOWALL,
+	SUSPEND_SINGLESTEP,
+	SUSPEND_PAUSE_NEAR_PAGESET_END,
+	SUSPEND_USE_ACPI_S4,
+	SUSPEND_TEST_FILTER_SPEED,
+	SUSPEND_FREEZE_TIMERS,
+	SUSPEND_DISABLE_SYSDEV_SUPPORT,
+	SUSPEND_VGA_POST,
+	SUSPEND_TEST_BIO,
+	SUSPEND_NO_PAGESET2,
+};
+
Quoted 1 line

Not sure what this does, but I surely don't like it.

That's good logic :). They're the flags used internally to record what options we're in. Could do with a cleanup (thanks!). The 'second status register' goes way back to when we used a /proc entry with multiple numbers (echo 1 2 3

Quoted 21 lines

config style). Some of those have been unused for ages.

+extern void __suspend_message(unsigned long section, unsigned long level,
int log_normally, + const char *fmt, ...);

crypto/Kconfig +16 -0
+
+#ifdef CONFIG_PM_DEBUG
+#define suspend_message(sn, lev, log, fmt, a...) \
+do { \
+	if (test_debug_state(sn)) \
+		__suspend_message(sn, lev, log, fmt, ##a); \
+} while(0)
+#else /* CONFIG_PM_DEBUG */
+#define suspend_message(sn, lev, log, fmt, a...) \
+do { \
+	if (lev == 0) \
+		__suspend_message(sn, lev, log, fmt, ##a); \
+} while(0)
+#endif /* CONFIG_PM_DEBUG */
+
+/* Suspend 2 */
Quoted 2 lines

Having your own debugging infrastructure means you are doing something wrong.

It was just to provide finer grained debugging, which can be configured while suspending. You've seen this before.

Quoted 32 lines
crypto/Kconfig +31 -0
+enum {
+	SUSPEND_DISABLED,
+	SUSPEND_RUNNING,
+	SUSPEND_RESUME_DEVICE_OK,
+	SUSPEND_NORESUME_SPECIFIED,
+	SUSPEND_COMMANDLINE_ERROR,
+	SUSPEND_IGNORE_IMAGE,
+	SUSPEND_SANITY_CHECK_PROMPT,
+	SUSPEND_FREEZER_ON,
+	SUSPEND_BLOCK_PAGE_ALLOCATIONS,
+	SUSPEND_USE_MEMORY_POOL,
+	SUSPEND_STAGE2_CONTINUE,
+	SUSPEND_FREEZE_SMP,
+	SUSPEND_PAGESET2_NOT_LOADED,
+	SUSPEND_CONTINUE_REQ,
+	SUSPEND_RESUMED_BEFORE,
+	SUSPEND_RUNNING_INITRD,
+	SUSPEND_RESUME_NOT_DONE,
+	SUSPEND_BOOT_TIME,
+	SUSPEND_NOW_RESUMING,
+	SUSPEND_SLAB_ALLOC_FALLBACK,
+	SUSPEND_IGNORE_LOGLEVEL,
+	SUSPEND_TIMER_FREEZER_ON,
+	SUSPEND_ACT_USED,
+	SUSPEND_DBG_USED,
+	SUSPEND_LVL_USED,
+	SUSPEND_TRYING_TO_RESUME,
+	SUSPEND_FORK_COPYBACK_THREAD,
+	SUSPEND_TRY_RESUME_RD,
+	SUSPEND_IGNORE_ROOTFS,
+};
Quoted 1 line

What's this? DBG_USED? LVL_USED?

Some more obsolete entries in there. Dbg_used and lvl_used let me change the debugging from the command line when trying to resume, and these flags were used so that the settings in the image header didn't overwrite the values given on the command line. I doubt they're ever used nowadays, so could go too. Will be out in the next release.

Quoted 28 lines

diff -ruN linux-2.6.15-1/include/linux/suspend.h build-2.6.15.1/include/linux/suspend.h diff -ruN linux-2.6.15-1/include/linux/workqueue.h build-2.6.15.1/include/linux/workqueue.h diff -ruN linux-2.6.15-1/init/do_mounts.c build-2.6.15.1/init/do_mounts.c diff -ruN linux-2.6.15-1/init/do_mounts_initrd.c build-2.6.15.1/init/do_mounts_initrd.c ---
linux-2.6.15-1/init/do_mounts_initrd.c 2006-01-03 15:08:48.000000000 +1000
+++ build-2.6.15.1/init/do_mounts_initrd.c 2006-01-23 21:38:28.000000000
+1000 @@ -7,6 +7,7 @@
#include <linux/romfs_fs.h>
#include <linux/initrd.h>
#include <linux/sched.h>

crypto/Kconfig +4 -1
+#include <linux/suspend.h>
 
 #include "do_mounts.h"
@@ -58,10 +59,16 @@
 
 	pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
 	if (pid > 0) {
-		while (pid != sys_wait4(-1, NULL, 0, NULL))
+		while (pid != sys_wait4(-1, NULL, 0, NULL)) {
 			yield();
+			try_to_freeze();
+		}
 	}
 
Quoted 1 line

Not run_todo_list? Do we want this in mainline?

:) Christoph's patches made try_to_freeze() == run_todo_list, so it didn't matter. I think you will want it if you support starting a resume from an initrd and freeze processes before the atomic restore.

Quoted 21 lines

diff -ruN linux-2.6.15-1/init/main.c build-2.6.15.1/init/main.c diff -ruN linux-2.6.15-1/kernel/audit.c build-2.6.15.1/kernel/audit.c diff -ruN linux-2.6.15-1/kernel/fork.c build-2.6.15.1/kernel/fork.c

kernel/fork.c +7 -1
@@ -165,7 +166,13 @@
 	if (!tsk)
 		return NULL;
 
-	ti = alloc_thread_info(tsk);
+	if (test_suspend_state(SUSPEND_FORK_COPYBACK_THREAD)) {
+		extern void * suspend2_get_nonconflicting_pages(int);
+		ti = suspend2_get_nonconflicting_pages(get_order(THREAD_SIZE));
+		printk("Starting a copyback thread %p\n", ti);
+	} else
+		ti = alloc_thread_info(tsk);
+
 	if (!ti) {
 		free_task_struct(tsk);
 		return NULL;
Quoted 2 lines

With code like this (in fork!) how can you claim it is not complex? What does copyback do, anyway?

We're just making sure here that the stack page for the thread that gets started is in a page that won't be overwritten during the atomic restore. With that done, using stack in the atomic restore routine is safe.

Quoted 37 lines

diff -ruN linux-2.6.15-1/kernel/kmod.c build-2.6.15.1/kernel/kmod.c diff -ruN linux-2.6.15-1/kernel/kthread.c build-2.6.15.1/kernel/kthread.c diff -ruN linux-2.6.15-1/kernel/power/atomic_copy.c build-2.6.15.1/kernel/power/atomic_copy.c ---
linux-2.6.15-1/kernel/power/atomic_copy.c 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/kernel/power/atomic_copy.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,473 @@

kernel/fork.c +29 -0
+/*
+ */
+
+#include <linux/suspend.h>
+#include <linux/highmem.h>
+#include <linux/kthread.h>
+#include <asm/setup.h>
+#include <asm/param.h>
+#include <asm/thread_info.h>
+#include "suspend2_common.h"
+#include "io.h"
+#include "power_off.h"
+#include "version.h"
+#include "ui.h"
+#include "plugins.h"
+#include "atomic_copy.h"
+#include "suspend2.h"
+#include "checksum.h"
+#include "pageflags.h"
+#include "debug_pagealloc.h"
+#include "storage.h"
+
+#include <asm/suspend2.h>
+
+volatile static int state1 __nosavedata = 0;
+volatile static int state2 __nosavedata = 0;
+volatile static int state3 __nosavedata = 0;
+volatile static int io_speed_save[2][2] __nosavedata;
+
Quoted 2 lines

Heh, nice... volatile probably means you got the locking wrong, and no it is not nice to name variables like this.

What do you think I'm doing here? Actually volatile is just one of those cleanups that never got done by a user who didn't know they weren't needed to begin with :)

Quoted 3 lines

Why can't you just use existing code for atomic copy?

(~400 lines of duplicated code skipped)

As mentioned above, different data structures; the code isn't duplicated.

Quoted 76 lines

diff -ruN linux-2.6.15-1/kernel/power/atomic_copy.h build-2.6.15.1/kernel/power/atomic_copy.h diff -ruN linux-2.6.15-1/kernel/power/block_io.h build-2.6.15.1/kernel/power/block_io.h ---
linux-2.6.15-1/kernel/power/block_io.h 1970-01-01 10:00:00.000000000 +1000
+++ build-2.6.15.1/kernel/power/block_io.h 2006-01-23 21:38:28.000000000
+1000 @@ -0,0 +1,76 @@

kernel/fork.c +68 -0
+/*
+ * block_io.h
+ *
+ * Copyright 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ * Distributed under GPLv2.
+ *
+ * This file contains declarations for functions exported from
+ * block_io.c, which contains low level io functions.
+ */
+
+#include <linux/buffer_head.h>
+#include "extent.h"
+
+/*
+ * submit_params
+ *
+ * The structure we use for tracking submitted I/O.
+ */
+struct submit_params {
+	swp_entry_t swap_address;
+	struct page *page;
+	struct block_device *dev;
+	sector_t block[MAX_BUF_PER_PAGE];
+	int readahead_index;
+	struct submit_params *next;
+	int printme;
+};
+
+struct suspend2_bdev_info {
+	struct block_device *bdev;
+	dev_t dev_t;
+	int bmap_shift;
+	int blocks_per_page;
+};
+
+/*
+ * Our exported interface so the swapwriter and filewriter don't
+ * need these functions duplicated.
+ */
+struct suspend_bio_ops {
+	int (*submit_io) (int rw,
+		struct submit_params *submit_info, int syncio);
+	int (*bdev_page_io) (int rw, struct block_device *bdev, long pos,
+			struct page *page);
+	int (*rw_page) (int rw, struct page *page, int readahead_index,
+			int sync);
+	void (*wait_on_readahead) (int readahead_index);
+	void (*check_io_stats) (void);
+	void (*reset_io_stats) (void);
+	void (*finish_all_io) (void);
+	int (*prepare_readahead) (int index);
+	void (*cleanup_readahead) (int index);
+	struct page ** readahead_pages;
+	int (*readahead_ready) (int readahead_index);
+	int *need_extra_next;
+	int (*forward_one_page) (void);
+	void (*set_devinfo) (struct suspend2_bdev_info *info);
+	int (*read_init) (int stream_number);
+	int (*read_chunk) (struct page *buffer_page, int sync);
+	int (*read_cleanup) (void);
+	int (*write_init) (int stream_number);
+	int (*write_chunk) (struct page *buffer_page);
+	int (*write_cleanup) (void);
+	int (*read_header_chunk) (char *buffer, int buffer_size);
+	int (*write_header_chunk) (char *buffer, int buffer_size);
+	int (*write_header_chunk_finish) (void);
+};
Quoted 2 lines

So you have your own disk operations... Nothing like that is needed with uswsusp.

They're just the routines shared by the writers (which shoudl really be called something different now that I've moved all the real work to this file :>). I think I could further clean this up, removing the header specific routines. And the point to it all is doing the async I/O and readahead, given just lists of blocks on devices and (via these routines) the pages to write. If uswsusp supported swapfiles and ordinary files, it would have something like this.

Quoted 17 lines

diff -ruN linux-2.6.15-1/kernel/power/checksum.h
build-2.6.15.1/kernel/power/checksum.h ---
linux-2.6.15-1/kernel/power/checksum.h 1970-01-01 10:00:00.000000000 +1000
+++ build-2.6.15.1/kernel/power/checksum.h 2006-01-23 21:38:28.000000000
+1000 @@ -0,0 +1,11 @@

kernel/fork.c +11 -0
+#ifdef CONFIG_SUSPEND2_CHECKSUMS
+extern void suspend2_verify_checksums(void);
+extern void suspend2_checksum_calculate_checksums(void);
+extern void suspend2_checksum_print_differences(void);
+extern int suspend2_allocate_checksum_pages(void);
+#else
+static inline void suspend2_verify_checksums(void) { };
+static inline void suspend2_checksum_calculate_checksums(void) { };
+static inline void suspend2_checksum_print_differences(void) { };
+static inline int suspend2_allocate_checksum_pages(void) { return 0; };
+#endif
Quoted 1 line

...and checksums can happily live in userspace.

Yes. I should really clean this up and make it just another (optional) item in the pipeline.

Quoted 9 lines

diff -ruN linux-2.6.15-1/kernel/power/compression.c build-2.6.15.1/kernel/power/compression.c ---
linux-2.6.15-1/kernel/power/compression.c 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/kernel/power/compression.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,638 @@ +/*
+ * kernel/power/suspend2_core/compression.c

Wrong filename.

Thanks. Another cleanup missed.

Quoted 8 lines

+ * Copyright (C) 2003-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * This file contains data compression routines for suspend,
+ * using LZH compression.

LZF?

Should be cryptoapi now.

Quoted 1 line

Snipped 600 lines of code that can happily live in userspace.

You can use cryptoapi from userspace?

Quoted 15 lines

diff -ruN linux-2.6.15-1/kernel/power/debug_pagealloc.c build-2.6.15.1/kernel/power/debug_pagealloc.c ---
linux-2.6.15-1/kernel/power/debug_pagealloc.c 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/kernel/power/debug_pagealloc.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,111 @@

kernel/fork.c +8 -0
+#include <linux/mm.h>
+#ifdef CONFIG_DEBUG_PAGEALLOC
+#include <linux/page-flags.h>
+#include <asm/pgtable.h>
+
+#include "pageflags.h"
+#include "suspend2.h"
+#include "pagedir.h"
Quoted 1 line

What is this code doing?

Support for CONFIG_DEBUG_PAGEALLOC. Rarely used and I think it's broken. (I should check).

Quoted 23 lines

diff -ruN linux-2.6.15-1/kernel/power/debug_pagealloc.h build-2.6.15.1/kernel/power/debug_pagealloc.h diff -ruN linux-2.6.15-1/kernel/power/disk.c build-2.6.15.1/kernel/power/disk.c diff -ruN linux-2.6.15-1/kernel/power/encryption.c build-2.6.15.1/kernel/power/encryption.c ---
linux-2.6.15-1/kernel/power/encryption.c 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/kernel/power/encryption.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,597 @@
+/*
+ * kernel/power/suspend2_core/encryption.c
+ *
+ * Copyright (C) 2003-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * This file contains data encryption routines for suspend,
+ * using cryptoapi transforms.
+ *
+ * ToDo:
+ * - Apply min/max_keysize the cipher changes.
+ * - Test.
+ */

Quoted 1 line

Snipped 550 lines of code that can happily live in userspace.

(if cryptoapi can be used from there).

Quoted 16 lines

diff -ruN linux-2.6.15-1/kernel/power/extent.c
build-2.6.15.1/kernel/power/extent.c ---
linux-2.6.15-1/kernel/power/extent.c 1970-01-01 10:00:00.000000000 +1000
+++ build-2.6.15.1/kernel/power/extent.c 2006-01-23 21:38:28.000000000
+1000 @@ -0,0 +1,247 @@

kernel/fork.c +10 -0
+/* kernel/power/suspend2_core/extent.c
+ *
+ * (C) 2003-2005 Nigel Cunningham <[email protected]>
+ *
+ * Distributed under GPLv2.
+ *
+ * These functions encapsulate the manipulation of storage metadata. For
+ * pageflags, we use dynamically allocated bitmaps.
+ */
+
Quoted 2 lines

I do not know why you want to use extents; existing code seems to work well enough. Do you get .01% speedup or what?

They're used for storing the lists of blocks on each dev in which we store the image. It has nothing to do with a speedup, but rather efficient storage of the metadata.

Quoted 36 lines

diff -ruN linux-2.6.15-1/kernel/power/extent.h build-2.6.15.1/kernel/power/extent.h + +#define extent_state_eof(state) ((state)->num_chains < (state)->current_chain) +

kernel/fork.c +31 -0
+#define extent_for_each(extent_chain, extentpointer, value) \
+if ((extent_chain)->first) \
+	for ((extentpointer) = (extent_chain)->first, (value) = \
+			(extentpointer)->minimum; \
+	     ((extentpointer) && ((extentpointer)->next || (value) <= \
+				 (extentpointer)->maximum)); \
+	     (((value) == (extentpointer)->maximum) ? \
+		((extentpointer) = (extentpointer)->next, (value) = \
+		 ((extentpointer) ? (extentpointer)->minimum : 0)) : \
+			(value)++))
+
+/*
+ * When using compression and expected_compression > 0,
+ * we allocate fewer swap entries, so GET_EXTENT_NEXT can
+ * validly run out of data to return.
+ */
+#define GET_EXTENT_NEXT(currentextent, currentval) \
+{ \
+	if (currentextent) { \
+		if ((currentval) == (currentextent)->maximum) { \
+			if ((currentextent)->next) { \
+				(currentextent) = (currentextent)->next; \
+				(currentval) = (currentextent)->minimum; \
+			} else { \
+				(currentextent) = NULL; \
+				(currentval) = 0; \
+			} \
+		} else \
+			currentval++; \
+	} \
+}
Quoted 1 line

Not nice at all.

You have a nicer equivalent? I thought it was quite readable. Anyway, since it appears that it's now only used in one place, I can clean it up :) Done.

Quoted 18 lines

diff -ruN linux-2.6.15-1/kernel/power/io.c build-2.6.15.1/kernel/power/io.c

kernel/power/io.c +13 -0
@@ -0,0 +1,1025 @@
+/*
+ * kernel/power/io.c
+ *
+ * Copyright (C) 1998-2001 Gabor Kuti <[email protected]>
+ * Copyright (C) 1998,2001,2002 Pavel Machek <[email protected]>
+ * Copyright (C) 2002-2003 Florent Chabaud <[email protected]>
+ * Copyright (C) 2002-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * It contains high level IO routines for suspending.
+ *
+ */
Quoted 3 lines

Snipped 1000 lines that can happily live in userspace. Yes, I have similar (but way simpler) code in kernel just now. Notice I want to remove it.

Simpler because it's not providing the same functionality.

Quoted 100 lines

diff -ruN linux-2.6.15-1/kernel/power/io.h build-2.6.15.1/kernel/power/io.h diff -ruN linux-2.6.15-1/kernel/power/Kconfig build-2.6.15.1/kernel/power/Kconfig ---
linux-2.6.15-1/kernel/power/Kconfig 2006-01-03 15:08:48.000000000 +1000 +++
build-2.6.15.1/kernel/power/Kconfig 2006-01-23 21:38:28.000000000 +1000 @@
-98,3 +98,76 @@

kernel/power/io.c +68 -0
 	bool
 	depends on HOTPLUG_CPU && X86 && PM
 	default y
+
+config SUSPEND_DEBUG_PAGEALLOC
+	bool
+	depends on DEBUG_PAGEALLOC && (SOFTWARE_SUSPEND || SUSPEND2)
+	default y
+
+config SUSPEND2_CRYPTO
+	bool
+	depends on SUSPEND2 && CRYPTO
+	default y
+
+menuconfig SUSPEND2
+	bool "Suspend2"
+	select DYN_PAGEFLAGS
+	depends on PM
+	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_CHECKSUMMING
+		bool '  Checksum images - developer option (SLOW!)'
+		depends on PM_DEBUG && SUSPEND2
+		---help---
+		  This option implements checksumming of images. It is not designed
+		  for everyone to use, but as a development tool.
+
+	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!

All this configuration can and should be done in userspace. That's 70 lines.

diff -ruN linux-2.6.15-1/kernel/power/main.c build-2.6.15.1/kernel/power/main.c diff -ruN linux-2.6.15-1/kernel/power/Makefile build-2.6.15.1/kernel/power/Makefile diff -ruN linux-2.6.15-1/kernel/power/netlink.c build-2.6.15.1/kernel/power/netlink.c ---
linux-2.6.15-1/kernel/power/netlink.c 1970-01-01 10:00:00.000000000 +1000
+++ build-2.6.15.1/kernel/power/netlink.c 2006-01-23 21:38:28.000000000
+1000 @@ -0,0 +1,365 @@
+/*
+ * netlink.c
+ *
+ * Functions for communicating with a userspace helper via netlink.
+ */

Quoted 3 lines

With Rafael's solution, you don't need to inform userspace of your progress -- because userspace is controlling the suspend. Snip 300 unneeded lines.

True. There you have a point.

Quoted 13 lines
kernel/power/io.c +11 -0
+static int suspend2_nl_gen_rcv_msg(struct user_helper_data *uhd,
+		struct sk_buff *skb, struct nlmsghdr *nlh)
+{
+	int type;
+	int *data;
+	int err;
+
+	/* Let the more specific handler go first. It returns
+	 * 1 for valid messages that it doesn't know. */
+	if ((err = uhd->rcv_msg(skb, nlh)) != 1)
+		return err;
Quoted 1 line

...some of them pretty cryptic.

True. Will add to to do list :)

Quoted 34 lines
kernel/power/io.c +33 -0
+static int launch_userpace_program(struct user_helper_data *uhd)
+{
+	int retval;
+	static char *envp[] = {
+			"HOME=/",
+			"TERM=linux",
+			"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
+			NULL };
+	static char *argv[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+	char *channel = kmalloc(6, GFP_KERNEL);
+	int arg = 0, size;
+	char test_read[255];
+	char *orig_posn = uhd->program;
+
+	if (!strlen(orig_posn))
+		return 1;
+
+	while (arg < 7) {
+		sscanf(orig_posn, "%s", test_read);
+		size = strlen(test_read);
+		if (!(size))
+			break;
+		argv[arg] = kmalloc(size + 1, GFP_ATOMIC);
+		strcpy(argv[arg], test_read);
+		orig_posn += size + 1;
+		*test_read = 0;
+		arg++;
+	}
+
+	sprintf(channel, "-c%d", uhd->netlink_id);
+	argv[arg] = channel;
+
+	retval = call_usermodehelper(argv[0], argv, envp, 0);
Quoted 1 line

It is really better if userspace calls you...

Well, this way, we don't care if userspace doesn't come to the party. We can still suspend and resume without it.

Quoted 21 lines

diff -ruN linux-2.6.15-1/kernel/power/netlink.h build-2.6.15.1/kernel/power/netlink.h diff -ruN linux-2.6.15-1/kernel/power/pagedir.c build-2.6.15.1/kernel/power/pagedir.c
--- linux-2.6.15-1/kernel/power/pagedir.c 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/kernel/power/pagedir.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,370 @@
+/*
+ * kernel/power/pagedir.c
+ *
+ * Copyright (C) 1998-2001 Gabor Kuti <[email protected]>
+ * Copyright (C) 1998,2001,2002 Pavel Machek <[email protected]>
+ * Copyright (C) 2002-2003 Florent Chabaud <[email protected]>
+ * Copyright (C) 2002-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * Routines for handling pagesets.
+ * Note that pbes aren't actually stored as such. They're stored as
+ * bitmaps and extents.
+ */

Quoted 1 line

You should be able to use existing snapshotting...

If I get rid of support for storing a two sets of pages.

Quoted 11 lines
kernel/power/io.c +10 -0
+#include <linux/suspend.h>
+#include <linux/highmem.h>
+#include <linux/bootmem.h>
+#include <linux/hardirq.h>
+
+#include "pageflags.h"
+#include "ui.h"
+#include "pagedir.h"
+
+int extra_pagedir_pages_allocated = 0;
Quoted 1 line

Do not zero-initialize static variables.

Ta. Hadn't seen that.

Quoted 11 lines

diff -ruN linux-2.6.15-1/kernel/power/pagedir.h
build-2.6.15.1/kernel/power/pagedir.h diff -ruN
linux-2.6.15-1/kernel/power/pageflags.c
build-2.6.15.1/kernel/power/pageflags.c ---
linux-2.6.15-1/kernel/power/pageflags.c 1970-01-01 10:00:00.000000000 +1000
+++ build-2.6.15.1/kernel/power/pageflags.c 2006-01-23 21:38:28.000000000
+1000 @@ -0,0 +1,139 @@
+/*
+ * kernel/power/suspend2_core/pageflags.c

Wrong name.

Ta.

Quoted 16 lines

+ * Copyright (C) 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * Routines for dynamically allocating and releasing bitmaps
+ * used as pseudo-pageflags.
+ *
+ * Arrays are not contiguous. The first sizeof(void *) bytes are
+ * the pointer to the next page in the bitmap. This allows us to
+ * 1) work under low memory conditions where order 0 might be all
+ * that's available
+ * 2) save the pages at suspend time, reload and relocate them as
+ * necessary at resume time without breaking anything (cf
+ * extent pages).
+ */

Quoted 1 line

Why do you need this?

Ooh. That comment is old :). This is the suspend2 specific part of the pageflags code above. It allows us to serialise the flags and relocate parts of the bitmap that will be overwritten when restoring the original kernel data.

Quoted 13 lines

diff -ruN linux-2.6.15-1/kernel/power/pageflags.h build-2.6.15.1/kernel/power/pageflags.h diff -ruN linux-2.6.15-1/kernel/power/plugins.c build-2.6.15.1/kernel/power/plugins.c
--- linux-2.6.15-1/kernel/power/plugins.c 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/kernel/power/plugins.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,312 @@
+/*
+ * kernel/power/plugins.c
+ *
+ * Copyright (C) 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ */

Quoted 2 lines

Oh, my favourite.. These should really be in userspace. 300 lines + 180 lines in header.

Glad you like it :).

Quoted 10 lines

diff -ruN linux-2.6.15-1/kernel/power/plugins.h build-2.6.15.1/kernel/power/plugins.h diff -ruN linux-2.6.15-1/kernel/power/power.h build-2.6.15.1/kernel/power/power.h

/* References to section boundaries */

kernel/power/io.c +1 -1
-extern const void __nosave_begin, __nosave_end;
+//extern const void __nosave_begin, __nosave_end;

Delete it if you want it gone...

Done. Ta.

Quoted 9 lines

diff -ruN linux-2.6.15-1/kernel/power/power_off.c
build-2.6.15.1/kernel/power/power_off.c ---
linux-2.6.15-1/kernel/power/power_off.c 1970-01-01 10:00:00.000000000 +1000
+++ build-2.6.15.1/kernel/power/power_off.c 2006-01-23 21:38:28.000000000
+1000 @@ -0,0 +1,79 @@
+/*
+ * kernel/power/suspend2_core/power_off.c

Wrong name.

Ta.

Quoted 8 lines
kernel/power/io.c +6 -0
+void suspend_power_down(void)
+{
+	if (test_action_state(SUSPEND_REBOOT)) {
+		suspend2_prepare_status(DONT_CLEAR_BAR, "Ready to reboot.");
+		kernel_restart(NULL);
+	}

And we do not want UI code in kernel.

This is telling the UI what to do (as opposed to userspace telling the kernel what to do ;-)).

Quoted 29 lines

diff -ruN linux-2.6.15-1/kernel/power/power_off.h build-2.6.15.1/kernel/power/power_off.h diff -ruN linux-2.6.15-1/kernel/power/prepare_image.c build-2.6.15.1/kernel/power/prepare_image.c ---
linux-2.6.15-1/kernel/power/prepare_image.c 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/kernel/power/prepare_image.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,753 @@
+/*
+ * kernel/power/prepare_image.c
+ *
+ * Copyright (C) 2003-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * We need to eat memory until we can:
+ * 1. Perform the save without changing anything (RAM_NEEDED < max_pfn)
+ * 2. Fit it all in available space (active_writer->available_space() >=
+ * storage_needed())
+ * 3. Reload the pagedir and pageset1 to places that don't collide with
their + * final destinations, not knowing to what extent the resumed
kernel will + * overlap with the one loaded at boot time. I think the
resumed kernel + * should overlap completely, but I don't want to rely
on this as it is + * an unproven assumption. We therefore assume there
will be no overlap at + * all (worse case).
+ * 4. Meet the user's requested limit (if any) on the size of the image.
+ * The limit is in MB, so pages/256 (assuming 4K pages).
+ *
+ */

Quoted 1 line

There's existing code in kernel to do this, no?

No. It doesn't support letting the user configure the limit they want (without requiring a recompile) and it doesn't support storing a full image of memory. It is cleaner and simpler, but I'm not sure it would work as reliably under stress. I know I have cleanups to do here. There are surely still leftovers from when we used that memory pool and I know I currently have a bug to chase down.

Quoted 10 lines

diff -ruN linux-2.6.15-1/kernel/power/prepare_image.h build-2.6.15.1/kernel/power/prepare_image.h diff -ruN linux-2.6.15-1/kernel/power/proc.c build-2.6.15.1/kernel/power/proc.c ---
linux-2.6.15-1/kernel/power/proc.c 1970-01-01 10:00:00.000000000 +1000 +++
build-2.6.15.1/kernel/power/proc.c 2006-01-23 21:38:28.000000000 +1000 @@
-0,0 +1,305 @@
+/*
+ * /kernel/power/proc.c

Spurious slash?

Ta.

Quoted 10 lines

+ * Copyright (C) 2002-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * This file contains support for proc entries for tuning Suspend2.
+ *
+ * We have a generic handler that deals with the most common cases, and
+ * hooks for special handlers to use.
+ */

Quoted 3 lines

Well, we probably do not want more junk in /proc. And this would not be neccessary if (surprise) userspace controlled suspend. 300 lines unneeeded, and 70 lines in header.

:) But you would need more ioctls.

Quoted 26 lines

diff -ruN linux-2.6.15-1/kernel/power/process.c build-2.6.15.1/kernel/power/process.c diff -ruN linux-2.6.15-1/kernel/power/proc.h build-2.6.15.1/kernel/power/proc.h diff -ruN linux-2.6.15-1/kernel/power/snapshot.c build-2.6.15.1/kernel/power/snapshot.c diff -ruN linux-2.6.15-1/kernel/power/storage.c build-2.6.15.1/kernel/power/storage.c
--- linux-2.6.15-1/kernel/power/storage.c 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/kernel/power/storage.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,323 @@
+/*
+ * kernel/power/storage.c
+ *
+ * Copyright (C) 2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * Routines for talking to a userspace program that manages storage.
+ *
+ * The kernel side:
+ * - starts the userspace program;
+ * - sends messages telling it when to open and close the connection;
+ * - tells it when to quit;
+ *
+ * The user space side:
+ * - passes messages regarding status;

Quoted 1 line

Yep, if you do it all in userspace, this vanishes. 340 lines down.

And you gain? Let's try not to be too biased :).

Quoted 13 lines

diff -ruN linux-2.6.15-1/kernel/power/storage.h build-2.6.15.1/kernel/power/storage.h diff -ruN linux-2.6.15-1/kernel/power/suspend2_common.h build-2.6.15.1/kernel/power/suspend2_common.h diff -ruN linux-2.6.15-1/kernel/power/suspend2.h build-2.6.15.1/kernel/power/suspend2.h ---
linux-2.6.15-1/kernel/power/suspend2.h 1970-01-01 10:00:00.000000000 +1000
+++ build-2.6.15.1/kernel/power/suspend2.h 2006-01-23 21:38:28.000000000
+1000 +

kernel/power/io.c +3 -0
+#define KB(x) ((x) << (PAGE_SHIFT - 10))
+#define MB(x) ((x) >> (20 - PAGE_SHIFT))
+
Quoted 1 line

Eh, nice macros... this should be done for whole kernel or not t all.

Long time since I thought about them. Maybe someone has put the same thing elsewhere in the mean time. Todo list.

Quoted 10 lines

diff -ruN linux-2.6.15-1/kernel/power/suspend_block_io.c build-2.6.15.1/kernel/power/suspend_block_io.c ---
linux-2.6.15-1/kernel/power/suspend_block_io.c 1970-01-01
10:00:00.000000000 +1000 +++
build-2.6.15.1/kernel/power/suspend_block_io.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,1086 @@
+/*
+ * block_io.c

Wrong name.

Ta.

Quoted 10 lines

+ * Copyright 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ * Distributed under GPLv2.
+ *
+ * This file contains block io functions for suspend2. These are
+ * used by the swapwriter and it is planned that they will also
+ * be used by the NFSwriter.
+ *
+ */

Quoted 2 lines

1080 lines that are not neccessary in uswsusp case, because we can simply use existing read/write routines.

But only if you stick to only supporting writing to a single swap parttiion.

Quoted 9 lines

diff -ruN linux-2.6.15-1/kernel/power/suspend.c
build-2.6.15.1/kernel/power/suspend.c ---
linux-2.6.15-1/kernel/power/suspend.c 1970-01-01 10:00:00.000000000 +1000
+++ build-2.6.15.1/kernel/power/suspend.c 2006-01-23 21:38:28.000000000
+1000 @@ -0,0 +1,1133 @@
+/*
+ * kernel/power/suspend2.c

Name?

Ta.

Quoted 5 lines
kernel/power/io.c +3 -0
+/* Compression ratio */
+__nosavedata unsigned long bytes_in = 0, bytes_out = 0;
+

Should not compression live in its own plugin?

Another missed cleanup. The tricky bit here is that I don't know the final number of bytes sent to and output by the compressor until the end of writing the image, so to get the stats back at the end of resuming, it needs to be stored in the image header and then preserved during the atomic restore. I suppose re-reading the header at the end of resuming might be another idea. Will think on this some more.

Quoted 17 lines

diff -ruN linux-2.6.15-1/kernel/power/suspend_checksums.c build-2.6.15.1/kernel/power/suspend_checksums.c ---
linux-2.6.15-1/kernel/power/suspend_checksums.c 1970-01-01
10:00:00.000000000 +1000 +++
build-2.6.15.1/kernel/power/suspend_checksums.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,509 @@

Checksumming can live in userspace, 500 lines down.

diff -ruN linux-2.6.15-1/kernel/power/suspend_file.c build-2.6.15.1/kernel/power/suspend_file.c ---
linux-2.6.15-1/kernel/power/suspend_file.c 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/kernel/power/suspend_file.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,1077 @@ +/*
+ * Filewriter.c

Quoted 1 line

Name?

Ta.

Quoted 1 line

Can happily live in userspace (using bmap), 1070 lines down.

How would you do the I/O once you'd bmapped? I thought you rejected bios.

Quoted 74 lines

diff -ruN linux-2.6.15-1/kernel/power/suspend.h build-2.6.15.1/kernel/power/suspend.h diff -ruN linux-2.6.15-1/kernel/power/suspend_swap.c build-2.6.15.1/kernel/power/suspend_swap.c ---
linux-2.6.15-1/kernel/power/suspend_swap.c 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/kernel/power/suspend_swap.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,1213 @@
+/*
+ * Swapwriter.c
+ *
+ * Copyright 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ * Distributed under GPLv2.
+ *
+ * This file encapsulates functions for usage of swap space as a
+ * backing store.
+ */

Should be possible to put into userspace, 1200 lines.

diff -ruN linux-2.6.15-1/kernel/power/swsusp.c build-2.6.15.1/kernel/power/swsusp.c diff -ruN linux-2.6.15-1/kernel/power/swsusp.h build-2.6.15.1/kernel/power/swsusp.h diff -ruN linux-2.6.15-1/kernel/power/ui.c build-2.6.15.1/kernel/power/ui.c

kernel/power/ui.c +23 -1
-0,0 +1,853 @@
+/*
+ * kernel/power/ui.c
+ *
+ * Copyright (C) 1998-2001 Gabor Kuti <[email protected]>
+ * Copyright (C) 1998,2001,2002 Pavel Machek <[email protected]>
+ * Copyright (C) 2002-2003 Florent Chabaud <[email protected]>
+ * Copyright (C) 2002-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * Routines for Suspend2's user interface.
+ *
+ * The user interface code talks to a userspace program via a
+ * netlink socket.
+ *
+ * The kernel side:
+ * - starts the userui program;
+ * - sends text messages and progress bar status;
+ *
+ * The user space side:
+ * - passes messages regarding user requests (abort, toggle reboot etc)
+ *
+ */

Userinterface in kernel. Great. Fortunately Rafael's code allows this 850 lines not to be needed.

kernel/power/ui.c +19 -0
+char suspend_wait_for_keypress(int timeout)
+{
+	int fd;
+	char key = '\0';
+	struct termios t, t_backup;
+
+	if (ui_helper_data.pid != -1) {
+		wait_for_key_via_userui();
+		key = ' ';
+		goto out;
+	}
+
+	/* We should be guaranteed /dev/console exists after populate_rootfs() in
+	 * init/main.c
+	 */
+	if ((fd = sys_open("/dev/console", O_RDONLY, 0)) < 0) {
+		printk("Couldn't open /dev/console.\n");
+		goto out;
+	}
Quoted 2 lines

...and you still do user interface in kernel, despite having userland helper.

printks, yes. You don't do any printks?

Quoted 70 lines

+/* abort_suspend
+ *
+ * Description: Begin to abort a cycle. If this wasn't at the user's
request + * (and we're displaying output), tell the user why and wait for
+ * them to acknowledge the message.
+ * Arguments: A parameterised string (imagine this is printk) to display,
+ * telling the user why we're aborting.
+ */

kernel/power/ui.c +5 -0
+
+void abort_suspend(const char *fmt, ...)
+{
+	va_list args;
+	int printed_len = 0;

And your own printk... sweeet.

kernel/power/ui.c +10 -0
+	if (!test_result_state(SUSPEND_ABORTED)) {
+		if (!test_result_state(SUSPEND_ABORT_REQUESTED)) {
+			va_start(args, fmt);
+			printed_len = vsnprintf(local_printf_buf,
+					sizeof(local_printf_buf), fmt, args);
+			va_end(args);
+			if (ui_helper_data.pid != -1)
+				printed_len = sprintf(local_printf_buf + printed_len,
+					" (Press SPACE to continue)");
+			suspend2_prepare_status(CLEAR_BAR, local_printf_buf);

Even if you call userland for actuall printk(), this is still user interface.

kernel/power/ui.c +9 -0
+#if defined(CONFIG_VT) || defined(CONFIG_SERIAL_CONSOLE)
+	console_loglevel = 7;
+
+	say("=== Suspend2 ===\n\n");
+	if (warning_reason) {
+		say("BIG FAT WARNING!! %s\n\n", local_printf_buf);
+		switch (message_detail) {
+		 case 0:
+			say("If you continue booting, note that any image WILL NOT BE

REMOVED.\n"); + say("Suspend is unable to do so because the appropriate
modules aren't\n"); + say("loaded. You should manually remove the image
to avoid any\n"); + say("possibility of corrupting your filesystem(s)
later.\n");

kernel/power/ui.c +4 -0
+			break;
+		 case 1:
+			say("If you want to use the current suspend image, reboot and try\n");
+			say("again with the same kernel that you suspended from. If you

want\n"); + say("to forget that image, continue and the image will be
erased.\n"); + break;

kernel/power/ui.c +2 -0
+		}
+		say("Press SPACE to reboot or C to continue booting with this

kernel\n\n"); + say("Default action if you don't select one in %d seconds
is: %s.\n", + message_timeout,

kernel/power/ui.c +15 -0
+			default_answer == SUSPEND_CONTINUE_REQ ?
+			"continue booting" : "reboot");
+	} else {
+		say("BIG FAT WARNING!!\n\n");
+		say("You have tried to resume from this image before.\n");
+		say("If it failed once, it may well fail again.\n");
+		say("Would you like to remove the image and boot normally?\n");
+		say("This will be equivalent to entering noresume2 on the\n");
+		say("kernel command line.\n\n");
+		say("Press SPACE to remove the image or C to continue resuming.\n\n");
+		say("Default action if you don't select one in %d seconds is: %s.\n",
+			message_timeout,
+			!!default_answer ?
+			"continue resuming" : "remove the image");
+	}
Quoted 1 line

Wonderful. Did not we agree that this has no place in kernel?

No, we didn't agree. You said it, and I rejected your assertion. I believe I'm allowed to listen and disagree.

Quoted 12 lines
kernel/power/ui.c +11 -0
+	{ .filename			= "userui_progress_granularity",
+	  .permissions			= PROC_RW,
+	  .type				= SUSPEND_PROC_DATA_INTEGER,
+	  .data = {
+		.integer = {
+			.variable	= &progress_granularity,
+			.minimum	= 1,
+			.maximum	= 2048,
+		}
+	  }
+	},
Quoted 1 line

So even progress granularity is configurable?

Yes. FBsplash can be pretty painful on slow cpus (I think there's some inefficiency in there that could be addressed, but haven't bothered to do so myself). Letting users control the progress bar lets them have a nice looking display without making the process take 10x longer.

Quoted 31 lines

diff -ruN linux-2.6.15-1/kernel/power/ui.h build-2.6.15.1/kernel/power/ui.h diff -ruN linux-2.6.15-1/kernel/power/version.h build-2.6.15.1/kernel/power/version.h diff -ruN linux-2.6.15-1/kernel/sched.c build-2.6.15.1/kernel/sched.c diff -ruN linux-2.6.15-1/kernel/signal.c build-2.6.15.1/kernel/signal.c diff -ruN linux-2.6.15-1/kernel/softirq.c build-2.6.15.1/kernel/softirq.c diff -ruN linux-2.6.15-1/kernel/sys.c build-2.6.15.1/kernel/sys.c

kernel/sys.c +5 -2
@@ -173,15 +173,18 @@
 {
 	int ret=NOTIFY_DONE;
 	struct notifier_block *nb = *n;
+	struct notifier_block *next;
 
 	while(nb)
 	{
-		ret=nb->notifier_call(nb,val,v);
+		/* Determining next here allows the notifier to unregister itself */
+		next = nb->next;
+		ret = nb->notifier_call(nb,val,v);
 		if(ret&NOTIFY_STOP_MASK)
 		{
 			return ret;
 		}
-		nb=nb->next;
+		nb = next;
 	}
 	return ret;
 }
Quoted 1 line

What is this?

Christoph's patch, as I said above, no longer in 2.2.0.1.

Quoted 28 lines

diff -ruN linux-2.6.15-1/kernel/workqueue.c build-2.6.15.1/kernel/workqueue.c diff -ruN linux-2.6.15-1/lib/dyn_pageflags.c build-2.6.15.1/lib/dyn_pageflags.c diff -ruN linux-2.6.15-1/lib/Kconfig build-2.6.15.1/lib/Kconfig diff -ruN linux-2.6.15-1/lib/Makefile build-2.6.15.1/lib/Makefile diff -ruN linux-2.6.15-1/lib/vsprintf.c build-2.6.15.1/lib/vsprintf.c diff -ruN linux-2.6.15-1/mm/bootmem.c build-2.6.15.1/mm/bootmem.c diff -ruN linux-2.6.15-1/mm/memory.c build-2.6.15.1/mm/memory.c

mm/memory.c +2 -0
@@ -950,6 +950,15 @@
 	return page;
 }
 
+/*
+ * We want the address of the page for Suspend2 to mark as being in

pageset1. + */

mm/memory.c +2 -0
+
+struct page *suspend2_follow_page(struct mm_struct *mm, unsigned long

address) +{

mm/memory.c +3 -0
+	return follow_page(mm->mmap, address, 0);
+}
+
 int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
 		unsigned long start, int len, int write, int force,
 		struct page **pages, struct vm_area_struct **vmas)
Quoted 2 lines

In mm/memory.c? It has a comment, unfortunately it does not say anything.

Remember that we save the image in two parts - LRU and rest. Your userspace program's pages are going to be in the LRU, so to let it run during suspend, we need to make them part of the atomic copy instead. This lets us find and mark those pages as not being saved with the rest of the LRU, but instead as part of the atomic copy.

Quoted 15 lines

diff -ruN linux-2.6.15-1/mm/page_alloc.c build-2.6.15.1/mm/page_alloc.c

mm/page_alloc.c +1 -2
@@ -920,8 +921,8 @@
 
 	/* This allocation should allow future memory freeing. */
 
-	if (((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE)))
-			&& !in_interrupt()) {
+	if ((((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE)))
 && +				!in_interrupt()) || (test_freezer_state(FREEZER_ON))) {
 		if (!(gfp_mask & __GFP_NOMEMALLOC)) {
 nofail_alloc:
 			/* go through the zonelist yet again, ignoring mins */
Quoted 1 line

You have just made memory allocation slower. Oops.

Iff the freezer is on (we're suspending) and we actually manage to reach this far down in the code. (In this case, we're already on the slow path).

Quoted 12 lines

diff -ruN linux-2.6.15-1/mm/pdflush.c build-2.6.15.1/mm/pdflush.c diff -ruN linux-2.6.15-1/mm/swapfile.c build-2.6.15.1/mm/swapfile.c diff -ruN linux-2.6.15-1/mm/vmscan.c build-2.6.15.1/mm/vmscan.c diff -ruN linux-2.6.15-1/net/rxrpc/krxiod.c build-2.6.15.1/net/rxrpc/krxiod.c diff -ruN linux-2.6.15-1/net/rxrpc/krxsecd.c build-2.6.15.1/net/rxrpc/krxsecd.c diff -ruN linux-2.6.15-1/net/rxrpc/krxtimod.c build-2.6.15.1/net/rxrpc/krxtimod.c diff -ruN linux-2.6.15-1/net/sunrpc/sched.c build-2.6.15.1/net/sunrpc/sched.c diff -ruN linux-2.6.15-1/net/sunrpc/svcsock.c build-2.6.15.1/net/sunrpc/svcsock.c

Quoted 1 line

So... I'm spreading FUD and suspend2 is not intrusive? I'd not say so.

Look at the diffstat for 2.2.0.1 and re-evaluate this assertion. Look again in the next release (when I've applied more cleanups).

Quoted 3 lines

And you claimed that uswsusp can not solve anything? With above analysis, at least 8040 lines can be moved into userspace. That's more than half of your patch...

Remember though that you're making this assertion without actually having done any of that work. You don't know how much you'll have to add to userspace or kernel space to make this work. When you've actually done it, and we can compare apples with apples, then I'll listen to comparisons of lines added and removed.

Quoted 2 lines

Do we do anything really fundamental in userspace? No. Do you do anything fundamental in those 8040 lines? No. => userspace, please.

Writing the image isn't fundamental?

Quoted 4 lines

Now, suspend2 is quite a lot of old code, that does not properly use existing kernel infrastructure. Rather than trying to prove suspend2 is not intrusive (*)... can you just start using Rafael's existing code, and put that code into userspace?

I'm not going to waste my time. I have a working implementation today, and if I were to waste my time porting it to userspace, you'd reject it anyway. If and when you decide that you want to work on a userspace port, feel free.

Regards,

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#260 lore raw

Re: suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

Hi!

[Most fundamental stuff is at the end].

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

The only con I see is the complexity of the code, but then again, Nigel

..but thats a big con.

It's fud. Hopefully as I post more suspend2 patches to LKML, people will see that Suspend2 is simpler than what you are planning.

Quoted 6 lines
Quoted 4 lines

Well, good luck with that. But since you claimed I'm spreading FUD, I think I'll have to go through your patch.

Ouch, it is 500KB, 19K lines. How can you claim it is not complex?!

Size != complexity. Not necessarily.

Well, it is complex in this particular case.

Quoted 6 lines
Quoted 3 lines

Unrelated to suspend2; either push it or drop it. [There are more such changes, even for architectures you do not support suspend on... or do you support suspend on h8300?]

This is because you got 2.2 instead of the latest-devel patch. It (and some changes mentioned below) are got now (2.2.0.1).

I could not see 2.2.0.1 on the web page...

Quoted 5 lines
Quoted 5 lines

diff -ruN linux-2.6.15-1/arch/x86_64/kernel/e820.c build-2.6.15.1/arch/x86_64/kernel/e820.c diff -ruN linux-2.6.15-1/arch/x86_64/kernel/signal.c build-2.6.15.1/arch/x86_64/kernel/signal.c

Quoted 8 lines
Quoted 4 lines

diff -ruN linux-2.6.15-1/arch/x86_64/kernel/suspend.c build-2.6.15.1/arch/x86_64/kernel/suspend.c

With uswsusp, you are using existing code...

If I could use your existing code, I would. Unfortunately I'm using a more compact method of storing the data (bitmaps), and I reckon I have zero chance of getting you to switch.

And what chance do I have in getting _you_ to switch? Mainline code was fixed _long_ ago not to need higher order allocations, and rafael made it pretty compact lately, IIRC.

Please either switch to kernel code, or explain me that bitmaps have serious-enough advantage that I want to switch.

Quoted 23 lines
Quoted 23 lines

diff -ruN linux-2.6.15-1/Documentation/kernel-parameters.txt build-2.6.15.1/Documentation/kernel-parameters.txt ---
linux-2.6.15-1/Documentation/kernel-parameters.txt 2006-01-03
15:08:24.000000000 +1000 +++
build-2.6.15.1/Documentation/kernel-parameters.txt 2006-01-23
21:38:28.000000000 +1000 @@ -71,6 +71,7 @@

Documentation/kernel-parameters.txt +2 -0
 	SERIAL	Serial support is enabled.
 	SMP	The kernel is an SMP kernel.
 	SPARC	Sparc architecture is enabled.
+	SUSPEND2 Suspend2 is enabled.
 	SWSUSP	Software suspend is enabled.
 	TS	Appropriate touchscreen support is enabled.
 	USB	USB support is enabled.
@@ -966,6 +967,8 @@
 	noresume	[SWSUSP] Disables resume and restores original swap
 			space.
 
+	noresume2	[SUSPEND2] Disables resuming and restores original swap

signature. +

Documentation/kernel-parameters.txt +0 -0
 	no-scroll	[VGA] Disables scrollback.
 			This is required for the Braillex ib80-piezo Braille
 			reader made by F.H. Papenmeier (Germany).
Quoted 3 lines
Quoted 1 line

...and kernel parameters do not need to change...

This is only because I'm deliberately not stomping on your code at the moment.

I would actually like you to stomp on my code. Anything else can't lead to swsusp->suspend2 evolution...

Quoted 8 lines
Quoted 8 lines

-91,7 +91,7 @@

drivers/acpi/osl.c +1 -1
 		       "Access to PCI configuration space unavailable\n");
 		return AE_NULL_ENTRY;
 	}
-	kacpid_wq = create_singlethread_workqueue("kacpid");
+	kacpid_wq = create_nofreeze_singlethread_workqueue("kacpid");
 	BUG_ON(!kacpid_wq);
Quoted 8 lines
Quoted 4 lines

return AE_OK;

Big search and replace all over the tree. Changes the default to unsafe one. Do you ever listen to comments?

"Changes the default to unsafe one"? It makes the default to be freezing kernel threads, which should be safer since they then won't unexpectedly do (random action).

Well, you have just declared kacpid "NOFREEZE" here. I think Rafael explained to you why these are bad idea. If not, convince me they are good idea, but search&replace all over the tree is bad idea. (And current patches seem to work just fine).

Quoted 7 lines
Quoted 3 lines

Same here. You should be able to use mainline's snapshot functionality. That's common piece between swsusp and suspend2, and having your own copy helps noone.

As mentioned above, I use a different method of storing the meta data (bitmaps). It's more space efficient, but I expect you won't want it because it will make your asm longer.

Metadata are very small part of data being saved. How much space does it save in kernel image? It adds quite a lot of complexity....

Quoted 4 lines
Quoted 1 line

Why do you need to modify printf-like functions?!

It's not modified, but a new one. IIRC, the closest one to what I was after didn't return the info I needed.

Can you modify the caller? Noone else in kernel needs this printf-like variant, you should probably modify your code not to need it, too.

Quoted 5 lines
Quoted 3 lines

Why can't you just use existing code for atomic copy?

(~400 lines of duplicated code skipped)

As mentioned above, different data structures; the code isn't duplicated.

Switch to in-kernel data structures, then...

Quoted 10 lines
Quoted 2 lines

So you have your own disk operations... Nothing like that is needed with uswsusp.

They're just the routines shared by the writers (which shoudl really be called something different now that I've moved all the real work to this file :>). I think I could further clean this up, removing the header specific routines. And the point to it all is doing the async I/O and readahead, given just lists of blocks on devices and (via these routines) the pages to write. If uswsusp supported swapfiles and ordinary files, it would have something like this.

Maybe it would have something like this *in userspace*. Certainly not in kernel.

Quoted 3 lines
Quoted 1 line

Snipped 600 lines of code that can happily live in userspace.

You can use cryptoapi from userspace?

No, but I can link to liblzf/libssl just fine. And I think it is even possible to ask kernel to do crypto for you, not sure.

Quoted 15 lines
Quoted 15 lines

+/*
+ * kernel/power/suspend2_core/encryption.c
+ *
+ * Copyright (C) 2003-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * This file contains data encryption routines for suspend,
+ * using cryptoapi transforms.
+ *
+ * ToDo:
+ * - Apply min/max_keysize the cipher changes.
+ * - Test.
+ */

Quoted 3 lines
Quoted 1 line

Snipped 550 lines of code that can happily live in userspace.

(if cryptoapi can be used from there).

You don't need to use cryptoapi. Take a look at ssh, does it use cryptoapi? No. Is it broken? No.

Quoted 16 lines
Quoted 16 lines

diff -ruN linux-2.6.15-1/kernel/power/extent.c
build-2.6.15.1/kernel/power/extent.c ---
linux-2.6.15-1/kernel/power/extent.c 1970-01-01 10:00:00.000000000 +1000
+++ build-2.6.15.1/kernel/power/extent.c 2006-01-23 21:38:28.000000000
+1000 @@ -0,0 +1,247 @@

kernel/power/extent.c +10 -0
+/* kernel/power/suspend2_core/extent.c
+ *
+ * (C) 2003-2005 Nigel Cunningham <[email protected]>
+ *
+ * Distributed under GPLv2.
+ *
+ * These functions encapsulate the manipulation of storage metadata. For
+ * pageflags, we use dynamically allocated bitmaps.
+ */
+
Quoted 6 lines
Quoted 2 lines

I do not know why you want to use extents; existing code seems to work well enough. Do you get .01% speedup or what?

They're used for storing the lists of blocks on each dev in which we store the image. It has nothing to do with a speedup, but rather efficient storage of the metadata.

So... this is some code that is needed for swapfiles/normal files but not for swap partitions?

Quoted 13 lines
Quoted 13 lines
(quoted diff) +11 -0
+static int suspend2_nl_gen_rcv_msg(struct user_helper_data *uhd,
+		struct sk_buff *skb, struct nlmsghdr *nlh)
+{
+	int type;
+	int *data;
+	int err;
+
+	/* Let the more specific handler go first. It returns
+	 * 1 for valid messages that it doesn't know. */
+	if ((err = uhd->rcv_msg(skb, nlh)) != 1)
+		return err;
Quoted 3 lines
Quoted 1 line

...some of them pretty cryptic.

True. Will add to to do list :)

No need to clean it up, just switch to Rafael's solution ;-).

Quoted 10 lines
Quoted 7 lines
(quoted diff) +5 -0
+static int launch_userpace_program(struct user_helper_da
+	sprintf(channel, "-c%d", uhd->netlink_id);
+	argv[arg] = channel;
+
+	retval = call_usermodehelper(argv[0], argv, envp, 0);

It is really better if userspace calls you...

Well, this way, we don't care if userspace doesn't come to the party. We can still suspend and resume without it.

Well, that should not be a big problem. We can get distros to ship swsusp, and they use initrd-s, anyway.

Quoted 11 lines
Quoted 8 lines
(quoted diff) +6 -0
+void suspend_power_down(void)
+{
+	if (test_action_state(SUSPEND_REBOOT)) {
+		suspend2_prepare_status(DONT_CLEAR_BAR, "Ready to reboot.");
+		kernel_restart(NULL);
+	}

And we do not want UI code in kernel.

This is telling the UI what to do (as opposed to userspace telling the kernel what to do ;-)).

Yes, and it is why userspace telling kernel what to do is superior. You'd need to internationalize this etc.

Quoted 24 lines
Quoted 24 lines

+1000 +++ build-2.6.15.1/kernel/power/prepare_image.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,753 @@
+/*
+ * kernel/power/prepare_image.c
+ *
+ * Copyright (C) 2003-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * We need to eat memory until we can:
+ * 1. Perform the save without changing anything (RAM_NEEDED < max_pfn)
+ * 2. Fit it all in available space (active_writer->available_space() >=
+ * storage_needed())
+ * 3. Reload the pagedir and pageset1 to places that don't collide with
their + * final destinations, not knowing to what extent the resumed
kernel will + * overlap with the one loaded at boot time. I think the
resumed kernel + * should overlap completely, but I don't want to rely
on this as it is + * an unproven assumption. We therefore assume there
will be no overlap at + * all (worse case).
+ * 4. Meet the user's requested limit (if any) on the size of the image.
+ * The limit is in MB, so pages/256 (assuming 4K pages).
+ *
+ */

Quoted 8 lines
Quoted 1 line

There's existing code in kernel to do this, no?

No. It doesn't support letting the user configure the limit they want (without requiring a recompile) and it doesn't support storing a full image of memory. It is cleaner and simpler, but I'm not sure it would work as reliably under stress. I know I have cleanups to do here. There are surely still leftovers from when we used that memory pool and I know I currently have a bug to chase down.

Can you start the other way? Try kernel method, and if you can break it, fix it; rather than replacing it with completely new code?

Quoted 5 lines
Quoted 3 lines

Well, we probably do not want more junk in /proc. And this would not be neccessary if (surprise) userspace controlled suspend. 300 lines unneeeded, and 70 lines in header.

:) But you would need more ioctls.

:-).

Quoted 20 lines
Quoted 20 lines

--- linux-2.6.15-1/kernel/power/storage.c 1970-01-01 10:00:00.000000000
+1000 +++ build-2.6.15.1/kernel/power/storage.c 2006-01-23
21:38:28.000000000 +1000 @@ -0,0 +1,323 @@
+/*
+ * kernel/power/storage.c
+ *
+ * Copyright (C) 2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * Routines for talking to a userspace program that manages storage.
+ *
+ * The kernel side:
+ * - starts the userspace program;
+ * - sends messages telling it when to open and close the connection;
+ * - tells it when to quit;
+ *
+ * The user space side:
+ * - passes messages regarding status;

Quoted 3 lines
Quoted 1 line

Yep, if you do it all in userspace, this vanishes. 340 lines down.

And you gain? Let's try not to be too biased :).

I gain 340 less lines to review. For me to review, for akpm to review, and for Linus to review. That's important.

Quoted 10 lines
Quoted 10 lines

+ * Copyright 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ * Distributed under GPLv2.
+ *
+ * This file contains block io functions for suspend2. These are
+ * used by the swapwriter and it is planned that they will also
+ * be used by the NFSwriter.
+ *
+ */

Quoted 4 lines
Quoted 2 lines

1080 lines that are not neccessary in uswsusp case, because we can simply use existing read/write routines.

But only if you stick to only supporting writing to a single swap parttiion.

I don't see this, why?

userland parts of swsusp code still have access to normal read/write syscalls. I can write to normal (not swap) partition very easily, and in fact first version of uswsusp done that.

Quoted 3 lines
Quoted 1 line

Can happily live in userspace (using bmap), 1070 lines down.

How would you do the I/O once you'd bmapped? I thought you rejected bios.

Plain read/write syscalls on partition are safe.

Quoted 20 lines
Quoted 20 lines
(quoted diff) +19 -0
+char suspend_wait_for_keypress(int timeout)
+{
+	int fd;
+	char key = '\0';
+	struct termios t, t_backup;
+
+	if (ui_helper_data.pid != -1) {
+		wait_for_key_via_userui();
+		key = ' ';
+		goto out;
+	}
+
+	/* We should be guaranteed /dev/console exists after populate_rootfs() in
+	 * init/main.c
+	 */
+	if ((fd = sys_open("/dev/console", O_RDONLY, 0)) < 0) {
+		printk("Couldn't open /dev/console.\n");
+		goto out;
+	}
Quoted 4 lines
Quoted 2 lines

...and you still do user interface in kernel, despite having userland helper.

printks, yes. You don't do any printks?

I don't need to open files in kernel, that's quite a big "no-no".

Quoted 13 lines
Quoted 13 lines
(quoted diff) +12 -0
+		say("BIG FAT WARNING!!\n\n");
+		say("You have tried to resume from this image before.\n");
+		say("If it failed once, it may well fail again.\n");
+		say("Would you like to remove the image and boot normally?\n");
+		say("This will be equivalent to entering noresume2 on the\n");
+		say("kernel command line.\n\n");
+		say("Press SPACE to remove the image or C to continue resuming.\n\n");
+		say("Default action if you don't select one in %d seconds is: %s.\n",
+			message_timeout,
+			!!default_answer ?
+			"continue resuming" : "remove the image");
+	}
Quoted 4 lines
Quoted 1 line

Wonderful. Did not we agree that this has no place in kernel?

No, we didn't agree. You said it, and I rejected your assertion. I believe I'm allowed to listen and disagree.

And I'm allowed to NAK your patches, if you want to take it to this level. Piece above is enough to NAK whole series. How do you internationalize it, for example?

Quoted 4 lines
Quoted 1 line

So... I'm spreading FUD and suspend2 is not intrusive? I'd not say so.

Look at the diffstat for 2.2.0.1 and re-evaluate this assertion. Look again in the next release (when I've applied more cleanups).

You can clean it up any way you want to, but half of your code should not be in kernel in the first place.

Quoted 9 lines
Quoted 3 lines

And you claimed that uswsusp can not solve anything? With above analysis, at least 8040 lines can be moved into userspace. That's more than half of your patch...

Remember though that you're making this assertion without actually having done any of that work. You don't know how much you'll have to add to userspace or kernel space to make this work. When you've actually done it, and we can compare apples with apples, then I'll listen to comparisons of lines added and removed.

I'm pretty sure I don't have anything in kernel to add...

Quoted 4 lines
Quoted 2 lines

Do we do anything really fundamental in userspace? No. Do you do anything fundamental in those 8040 lines? No. => userspace, please.

Writing the image isn't fundamental?

Actually, no, writing the image isn't fundamental. You can send it over network, or do something like that...

Quoted 8 lines
Quoted 4 lines

Now, suspend2 is quite a lot of old code, that does not properly use existing kernel infrastructure. Rather than trying to prove suspend2 is not intrusive (*)... can you just start using Rafael's existing code, and put that code into userspace?

I'm not going to waste my time. I have a working implementation today, and if I were to waste my time porting it to userspace, you'd reject it anyway. If and when you decide that you want to work on a userspace port, feel free.

You are missing few things:

*) you are wasting your time, anyway, by cleaning code that does not belong into kernel in the first place.

*) I'd probably not reject your patches to userspace parts. My biggest complain about your code is that it lives in kernel space while it should live in userland.

*) I can't really reject userspace patches. I'm not distribution maintainer, and only a distribution can do that.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#261 lore raw

Re: suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

Quoted 6 lines · Pavel Machek
Quoted 3 lines
Quoted 1 line

Yep, if you do it all in userspace, this vanishes. 340 lines down.

And you gain? Let's try not to be too biased :).

I gain 340 less lines to review. For me to review, for akpm to review, and for Linus to review. That's important.

Pavel, if you mean that the userspace code will not be reviewed to standards the kernel code is, kill uswsusp _NOW_ before it does too much damage. Unreliable suspend eats filesystems for breakfast. The other userspace components of the kernels services are either optional (udev) or not that important (alsa).

OG.

#262 lore raw

Re: suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

Quoted 5 lines · Olivier Galibert
Quoted 4 lines · Pavel Machek
Quoted 3 lines
Quoted 1 line

Yep, if you do it all in userspace, this vanishes. 340 lines down.

And you gain? Let's try not to be too biased :).

Quoted 8 lines
Quoted 2 lines

I gain 340 less lines to review. For me to review, for akpm to review, and for Linus to review. That's important.

Pavel, if you mean that the userspace code will not be reviewed to standards the kernel code is, kill uswsusp _NOW_ before it does too much damage. Unreliable suspend eats filesystems for breakfast. The other userspace components of the kernels services are either optional (udev) or not that important (alsa).

At least it will be only me reviewing it, and not akpm and Linus.

suspend2 received no such review, and still people claim it is reliable. "I wish they'd kill suspend2 project, it already did enough damage." (Half joking here, but suspend2 split user/development community, and that's not good).

Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#263 lore raw

Re: suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

Quoted 9 lines · Pavel Machek
Quoted 8 lines · Olivier Galibert
Quoted 6 lines · Pavel Machek
Quoted 3 lines
Quoted 1 line

Yep, if you do it all in userspace, this vanishes. 340 lines down.

And you gain? Let's try not to be too biased :).

I gain 340 less lines to review. For me to review, for akpm to review, and for Linus to review. That's important.

Quoted 7 lines
Quoted 5 lines

Pavel, if you mean that the userspace code will not be reviewed to standards the kernel code is, kill uswsusp _NOW_ before it does too much damage. Unreliable suspend eats filesystems for breakfast. The other userspace components of the kernels services are either optional (udev) or not that important (alsa).

At least it will be only me reviewing it, and not akpm and Linus.

Ok, your answer was saying the contrary (that you wouldn't review it either). Frankly, you may want akpm or Linus to do reviews of even userspace code when appropriate, and others too like Al Viro. They have a freakingly good eye at detecting crap code.

Quoted 2 lines

suspend2 received no such review, and still people claim it is reliable.

Plain numbers. Just count the "suspend2 works for me which swsusp doesn't". I doubt it's purely luck, even if simply moving code around can change behaviours.

Quoted 3 lines

"I wish they'd kill suspend2 project, it already did enough damage." (Half joking here, but suspend2 split user/development community, and that's not good).

Yes, that's annoying. But be careful, you seem to be automatically rejecting everything Nigel at that point, or at least that's what it looks like.

You do what you want, obivously, but I suspect your reviews of the suspend2 code would be way more interesting if you accepted it's not uswsusp. Right now, they look more religious/political than really technical.

Can you try doing a review where you temporarily accept suspend2's kernel/userspace separation in the background, and review the code as is? That way you'll even have a chance to find out where the differences in reliability are coming from.

OG.

#264 lore raw

Re: suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

Quoted 9 lines · Olivier Galibert
Quoted 4 lines · Pavel Machek
Quoted 1 line · Olivier Galibert

On Mon, Feb 20, 2006 at 01:49:37PM +0100, Pavel Machek wrote:

suspend2 received no such review, and still people claim it is reliable.

Plain numbers. Just count the "suspend2 works for me which swsusp doesn't". I doubt it's purely luck, even if simply moving code around can change behaviours.

Well, people with broken swsusp tend to try suspend2... that's why you see so many reports. if you merged suspend2 and dropped swsusp, it would be the other way around.

Quoted 7 lines
Quoted 3 lines

"I wish they'd kill suspend2 project, it already did enough damage." (Half joking here, but suspend2 split user/development community, and that's not good).

Yes, that's annoying. But be careful, you seem to be automatically rejecting everything Nigel at that point, or at least that's what it looks like.

I'm not rejecting _everything_ Nigel does, but I have seen very little acceptable kernel patches from him.

Quoted 4 lines

You do what you want, obivously, but I suspect your reviews of the suspend2 code would be way more interesting if you accepted it's not uswsusp. Right now, they look more religious/political than really technical.

Feel free to review suspend2 yourself. You are likely to find many small issues, and Nigel is likely to fix them; but that's useless: as long as big issues are not fixed, code is not suitable for mainline merge.

(And it is going to be easier to do it in userspace using existing -mm infrastructure then to clean suspend2 patches).

Feel free to review suspend.sf.net code if you want to help; testing would be useful at this point, too.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#265 lore raw

Re: suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

In reply to Olivier Galibert
Quoted 6 lines · Olivier Galibert

Pavel, if you mean that the userspace code will not be reviewed to standards the kernel code is, kill uswsusp _NOW_ before it does too much damage. Unreliable suspend eats filesystems for breakfast. The other userspace components of the kernels services are either optional (udev) or not that important (alsa).

Why is sound less important than suspending, or networking, or any other subsystem? This is an insult to everyone who worked long and hard to get decent sound support on Linux.

This attitude is why many distro's sound support is godawful. Sometimes I suspect they are testing on machines without speakers connected.

Lee

maintainer
#266 lore raw

Re: suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

Quoted 8 lines · Lee Revell
Quoted 6 lines · Olivier Galibert

Pavel, if you mean that the userspace code will not be reviewed to standards the kernel code is, kill uswsusp _NOW_ before it does too much damage. Unreliable suspend eats filesystems for breakfast. The other userspace components of the kernels services are either optional (udev) or not that important (alsa).

Quoted 4 lines

Why is sound less important than suspending, or networking, or any other subsystem? This is an insult to everyone who worked long and hard to get decent sound support on Linux.

I bet this was not meant as an insult. Quote: "Unreliable suspend eats filesystems for breakfast". The worst thing mismatched ALSA library could cause is noice in my speakers.

--
Dmitry

#267 lore raw

Re: suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

Quoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Lee Revell
Quoted 6 lines · Olivier Galibert

Pavel, if you mean that the userspace code will not be reviewed to standards the kernel code is, kill uswsusp _NOW_ before it does too much damage. Unreliable suspend eats filesystems for breakfast. The other userspace components of the kernels services are either optional (udev) or not that important (alsa).

Quoted 8 lines
Quoted 4 lines

Why is sound less important than suspending, or networking, or any other subsystem? This is an insult to everyone who worked long and hard to get decent sound support on Linux.

I bet this was not meant as an insult. Quote: "Unreliable suspend eats filesystems for breakfast". The worst thing mismatched ALSA library could cause is noice in my speakers.

OK fair enough, I took that out of context.

Lee

#268 lore raw

Re: suspend2 review [was Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)]

In reply to Dmitry Torokhov
Quoted 8 lines · Dmitry Torokhov
Quoted 7 lines · Lee Revell
Quoted 6 lines · Olivier Galibert

Pavel, if you mean that the userspace code will not be reviewed to standards the kernel code is, kill uswsusp _NOW_ before it does too much damage. Unreliable suspend eats filesystems for breakfast. The other userspace components of the kernels services are either optional (udev) or not that important (alsa).

Quoted 8 lines
Quoted 4 lines

Why is sound less important than suspending, or networking, or any other subsystem? This is an insult to everyone who worked long and hard to get decent sound support on Linux.

I bet this was not meant as an insult. Quote: "Unreliable suspend eats filesystems for breakfast". The worst thing mismatched ALSA library could cause is noice in my speakers.

If you've got a Linux powered stereo in your car, you're going like the clappers and your speakers suddenly blast out white noise as loud as they possibly can, you will wish you had enough seconds left to run a measly fsck.

Signature · 1 line
Tristan Wibberley
#269 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek

Hi.

Quoted 1 line · Pavel Machek

Thanks for a fresh air in this flamewar...

Well, I would more like a technical based discussion instead of flamming. As I said previously, why not have both swsusp and suspend 2 in mainline, as they can coexists without any problem.

Quoted 8 lines
Quoted 6 lines

I have to completly agree with Sebastian here. 16 months ago I was in the need to have a suspend mode running on my new notebook. Back then Suspend 2 was the only choice, and while it had still problems it was surprisingly well behaving (in contrast to S3 mode and the mainline swsusp). The support of the community was, as said above, very good, and most issues very fixed fast.

Can you test recent swsusp?

Maybe I will, but my current setup does not allow this. When Fedora Core 5 comes out in some weeks I will give it a try. But as said, what I want is a stable and reliable suspend, not something that works in "most of the cases". Suspend 2 has proved to me and others that is stable.

(BTW: in the last 200 cycles I did with various Suspend 2 versions I had exactly 1 (_one_) "failure" (Xorg crashed on resume and I had to restart my windowmanager). That "failure" was not even Suspend 2 related, but a small bug in Xorg which got already fixed in the meantime.

Quoted 7 lines
Quoted 5 lines

Since it worked good for me, I started to contribute by supplying Fedora patched kernels, helper packages and some documentation. Today on Fedora, it is as easy as installing 4 RPM-packages and adding the "resume2=" parameter to the kernel commandline, and I know that it works this well on several other distributions too.

...well, thanks for your good work.

You are welcome.

Quoted 9 lines
Quoted 6 lines

Some more numbers: judging from my access logs and the feedback I get, I suspect at least 2000 Fedora users using Suspend 2 on a regular basis with success. Listening to the IRC channel and reading the forums and wikis, I see a huge bunch of people using Suspend 2 on nearly every distribution. The problems are incredible low, mostly minor things that get fixed nearly instantly.

Well, at least Fedora and SuSE ship swsusp by default. So it is getting huge ammount of testing, too.

No, I do not think so. I do not know about SuSE (although I think you are right there), but Fedora does _not_ ship swsusp. It was rejected for a long time because it was considered too dangerous. Recent rawhide as enabled it, but I doubt there are as many testers for it as there are for Suspend 2 (on Fedora). That might change with Core 5 (which is scheduled to be released in March), but I think we have to wait for that.

Quoted 11 lines
Quoted 10 lines

Some pros of Suspend 2 from my view:
- it is reliable and stable (really!)
- it is fast (10-30 seconds on my notebook with 1280 MB ram, depending on how much caches are saved)
- it can save all buffers and caches and the system is instantly responsible after resume (even Windows cannot do this and is very slow the first minute after resume)
- it works on all major platforms (x86, SMP, x86_64, there were success reports for PPC, and I believe even ARM works)
- and the most important thing, as already said, it is available _today_

Quoted 1 line

swsusp is also available today, and works better than you think.

OK, I will give it a try in some weeks.

Quoted 1 line

It is slightly slower,

Sorry, but that is just unacceptable.

Quoted 4 lines
Quoted 2 lines

The only con I see is the complexity of the code, but then again, Nigel

..but thats a big con.

So why is that? From what I see, most of the code is completly independ of the rest of the kernel, and just does not affect if it is disabled.

It won't do any harm to the kernel, and again, Nigel is constantly improving that situation, so for sure, that is no _big_ con.

Quoted 7 lines
Quoted 4 lines

Again, you said the code is complex, it might be, but still most part of the code is completly seperate from the rest of the kernel, and only touches minor things (and Nigel is still working on that). I believe it would not hurt.

It would hurt at least me, Andrew and Linus... It would make lot of suspend2 users very happy...

Why would it hurt? See above, I cannot see how Suspend 2 would affect the rest of the kernel and hurt people who are just not using it.

Quoted 9 lines
Quoted 4 lines

From a user, and contributor, point of view, I really do not understand why not even trying to push a working implementation into mainline (I know that you cannot just apply the Suspend 2 patches and shipping it,

It is less work to port suspend2's features into userspace than to make suspend2 acceptable to mainline. Both will mean big changes, and may cause some short-term problems, but it will be less pain than maintaining suspend2 forever. Please help with the former...

These "big changes" is something I have a problem with, since it means to delay a working suspend/resume in Linux for another "short-term" (so what does it mean: 1 month? six? twelve?). It is painful to get these things to work reliable, I have followed this for nearly 1.5 years. And
again: today there is a working implementation, so why not merge it and have something today, and then start working on the other things.

I would think that this would help both sides, as it would give us a working implementation now, and in some time (I would like to believe you, but sill think that it will take at least one year, maybe two, until you have uswsusp work stable) the new implementation (and then we can look which one works better, and maybe deprecate the other).

Regards,
Matthias

#270 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 3 lines · Matthias Hensler
Quoted 1 line

It is slightly slower,

Sorry, but that is just unacceptable.

Um... suspend2 puts extra tests into really hot paths like fork(), which is equally unacceptable to many people.

Why can't people understand that arguing "it works" without any consideration of possible performance tradeoffs is not a good enough argument for merging?

Lee

#271 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 7 lines · Lee Revell
Quoted 3 lines · Matthias Hensler
Quoted 1 line

It is slightly slower,

Sorry, but that is just unacceptable.

Um... suspend2 puts extra tests into really hot paths like fork(), which is equally unacceptable to many people.

OK, point taken.

Quoted 3 lines

Why can't people understand that arguing "it works" without any consideration of possible performance tradeoffs is not a good enough argument for merging?

It sure isn't the argument, you are right. My main concern here is to throw away a working implementation and starting over from the scratch, instead of solving these problems.

Regards,
Matthias

#272 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 7 lines · Matthias Hensler
Quoted 3 lines

Why can't people understand that arguing "it works" without any consideration of possible performance tradeoffs is not a good enough argument for merging?

It sure isn't the argument, you are right. My main concern here is to throw away a working implementation and starting over from the scratch, instead of solving these problems.

Take it up with the author for not working more closely with the kernel developers while Suspend2 was being developed, AFAICT a LOT of this could have been avoided with better communication.

Lee

#273 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 8 lines · Lee Revell
Quoted 3 lines · Matthias Hensler

It sure isn't the argument, you are right. My main concern here is to throw away a working implementation and starting over from the scratch, instead of solving these problems.

Take it up with the author for not working more closely with the kernel developers while Suspend2 was being developed, AFAICT a LOT of this could have been avoided with better communication.

I think Nigel already said that this went wrong, agreed. However, I remember that this was discussed a lot earlier and Suspend 2 was just not acceptable for the mainline, so work was done to get it acceptable.

But however, that is really not the point. I would like to go on and solve the issues with the current problems, and not to start from the beginning just because of mistakes that were made in the past.

Regards,
Matthias

#274 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Lee Revell

Hi.

Quoted 5 lines · Lee Revell
Quoted 4 lines · Matthias Hensler
Quoted 3 lines

Why can't people understand that arguing "it works" without any consideration of possible performance tradeoffs is not a good enough argument for merging?

Quoted 7 lines
Quoted 3 lines

It sure isn't the argument, you are right. My main concern here is to throw away a working implementation and starting over from the scratch, instead of solving these problems.

Take it up with the author for not working more closely with the kernel developers while Suspend2 was being developed, AFAICT a LOT of this could have been avoided with better communication.

Perhaps, but maybe there's more going on here than that.

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#275 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 12 lines · Nigel Cunningham

Hi.

Quoted 9 lines · Lee Revell
Quoted 7 lines · Matthias Hensler
Quoted 3 lines

Why can't people understand that arguing "it works" without any consideration of possible performance tradeoffs is not a good enough argument for merging?

It sure isn't the argument, you are right. My main concern here is to throw away a working implementation and starting over from the scratch, instead of solving these problems.

Quoted 5 lines
Quoted 3 lines

Take it up with the author for not working more closely with the kernel developers while Suspend2 was being developed, AFAICT a LOT of this could have been avoided with better communication.

Perhaps, but maybe there's more going on here than that.

Yes, there is:

1) you don't really watch mainline development.

2) you are not trying to improve mainline suspend, all you want is to merge suspend2.

3) you ask me to trust you to clean it up after merge.

4) you still have code that was declared unacceptable 12 months ago. ("press C to continue..." from kernel!)

5) you refuse to use existing mainline features, even through bugs that forced you to reimplement them were fixed _long_ time ago.

6) you spread FUD about swsusp. (I.e. latest attempt to redefine "working").

Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#276 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Lee Revell

Hi.

Quoted 7 lines · Lee Revell
Quoted 3 lines · Matthias Hensler
Quoted 1 line

It is slightly slower,

Sorry, but that is just unacceptable.

Um... suspend2 puts extra tests into really hot paths like fork(), which is equally unacceptable to many people.

It doesn't.

Fork is only a 'really hot path' if you have a fork bomb running. The scheduler is a really hot path (which Suspend2 patches don't touch, by the way).

The change in the page allocation routine follows a comment saying "This is the last chance, in general, before the goto nopage." It adds one further test to the four already done at that point.

Regards,

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#277 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 8 lines

Hi.

Quoted 5 lines · Lee Revell
Quoted 3 lines · Matthias Hensler
Quoted 1 line

It is slightly slower,

Sorry, but that is just unacceptable.

Quoted 8 lines
Quoted 2 lines

Um... suspend2 puts extra tests into really hot paths like fork(), which is equally unacceptable to many people.

It doesn't.

Fork is only a 'really hot path' if you have a fork bomb running. The scheduler is a really hot path (which Suspend2 patches don't touch, by the way).

Heh, tell that to Andrew and people running configure scripts. With attitude like this, do you wonder why you can't get a patch merged?

Pavel

Signature · 1 line
Thanks, Sharp!
maintainer
#278 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Lee Revell
Quoted 8 lines · Lee Revell
Quoted 3 lines · Matthias Hensler
Quoted 1 line

It is slightly slower,

Sorry, but that is just unacceptable.

Um... suspend2 puts extra tests into really hot paths like fork(), which is equally unacceptable to many people.

How bad is it really? From what I saw marking that swsuspend2 branch with "unlikely" should help the hot path.

Quoted 3 lines

Why can't people understand that arguing "it works" without any consideration of possible performance tradeoffs is not a good enough argument for merging?

Many of Pavel's arguments are not about performance tradeoffs but about perceived complexity of the code. I think if Nigel could run a clean up on his implementation and split it into couple of largish (not for inclusion but for general overview) pieces, like separate arch support, generally useful bits and the rest it would allow seeing more clearly how big and invasive swsuspend2 core is.

--
Dmitry

#279 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 12 lines · Lee Revell
Quoted 8 lines · Matthias Hensler
Quoted 3 lines
Quoted 1 line

It is slightly slower,

Sorry, but that is just unacceptable.

Um... suspend2 puts extra tests into really hot paths like fork(), which is equally unacceptable to many people.

How bad is it really? From what I saw marking that swsuspend2 branch with "unlikely" should help the hot path.

Not too bad, really.

Quoted 10 lines
Quoted 3 lines

Why can't people understand that arguing "it works" without any consideration of possible performance tradeoffs is not a good enough argument for merging?

Many of Pavel's arguments are not about performance tradeoffs but about perceived complexity of the code. I think if Nigel could run a clean up on his implementation and split it into couple of largish (not for inclusion but for general overview) pieces, like separate arch support, generally useful bits and the rest it would allow seeing more clearly how big and invasive swsuspend2 core is.

I have so many complains I do not know what to complain about, first. My main one is:

"This can be done in userspace" (on recent -mm).

then there are some more, like "this is 14000 lines of code" and "it touches places it should not really touch" (and maybe "its author does not understand how linux development works", to some extent).
Pavel

Signature · 1 line
Thanks, Sharp!
#280 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Dmitry Torokhov

Hi Dimitry.

Quoted 16 lines · Dmitry Torokhov
Quoted 7 lines · Lee Revell
Quoted 3 lines · Matthias Hensler
Quoted 1 line

It is slightly slower,

Sorry, but that is just unacceptable.

Um... suspend2 puts extra tests into really hot paths like fork(), which is equally unacceptable to many people.

How bad is it really? From what I saw marking that swsuspend2 branch with "unlikely" should help the hot path.

Quoted 3 lines

Why can't people understand that arguing "it works" without any consideration of possible performance tradeoffs is not a good enough argument for merging?

Quoted 6 lines

Many of Pavel's arguments are not about performance tradeoffs but about perceived complexity of the code. I think if Nigel could run a clean up on his implementation and split it into couple of largish (not for inclusion but for general overview) pieces, like separate arch support, generally useful bits and the rest it would allow seeing more clearly how big and invasive swsuspend2 core is.

I'm working on doing that right now. I was starting on it with the plugins patches a few weeks ago, and intended to follow it up pretty quickly with the rest. Unfortunately I've gotten sidetracked and overwhelmed by email :) and a lot of other things, so it's taking a lot longer than I wanted. Never-the-less, I'm working towards precisely this.

Regards,

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#281 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Matthias Hensler
Quoted 10 lines · Matthias Hensler
Quoted 4 lines
Quoted 2 lines

The only con I see is the complexity of the code, but then again, Nigel

..but thats a big con.

So why is that? From what I see, most of the code is completly independ of the rest of the kernel, and just does not affect if it is disabled.

It won't do any harm to the kernel, and again, Nigel is constantly improving that situation, so for sure, that is no _big_ con.

I might add that you'd drag a devoted developer into the kernel team more closely, which probably makes up for the 'added complexity' anyway.

The gain in working *together* on suspend2 is worth much more than the 'added complexity' Pavel complains about. Nigel has stated more than once that he'd be happy to maintain suspend2, and he's done so for quite some time already, which proves his point. Nigel is paid to work on suspend2, so it's not likely to go away once he has a new hobby (and again, he's been doing great work for some time already).

So what about working on merging suspend2 finally? Having a proven, stable and feature-rich implemenation available quickly, *and* someone who maintains *and* support it actively does not sound like a bad deal to me.

One should not underestimate the gains that a suspend2 merge has on the development merely by stating 'added complexity', that pays off _any_day_.

By the way, does 'working on uswsusp' mean that Pavel and will put less work in maintaining swsusp? That does not sound too promising to my sore ears.

Personally, to work with, I'd prefer a developer who's responsibly dealing with users' questions and problems any day to one who rejects 99% of emails that don't contain a patch and 95% of those that contain one, stating 'WTF, I don't like that'.

Bottom line: Judging developer resources only by lines of code added does not make too much sense.

Signature · 6 lines
sebas

 http://www.kde.org | http://vizZzion.org |  GPG Key ID: 9119 0EF9 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Accident, n.:	A condition in which presence of mind is good, but absence of 
body is better.  - Foolish Dictionary
#282 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 6 lines · Sebastian Kügler
Quoted 5 lines · Matthias Hensler
Quoted 4 lines
Quoted 2 lines

The only con I see is the complexity of the code, but then again, Nigel

..but thats a big con.

Quoted 8 lines
Quoted 5 lines

So why is that? From what I see, most of the code is completly independ of the rest of the kernel, and just does not affect if it is disabled.

It won't do any harm to the kernel, and again, Nigel is constantly improving that situation, so for sure, that is no _big_ con.

I might add that you'd drag a devoted developer into the kernel team more closely, which probably makes up for the 'added complexity' anyway.

I'd love to have Nigel helping me and kernel, but he's not interested. He wants suspend2 merged, he does not want better suspend in kernel.

Quoted 6 lines

The gain in working *together* on suspend2 is worth much more than the 'added complexity' Pavel complains about. Nigel has stated more than once that he'd be happy to maintain suspend2, and he's done so for quite some time already, which proves his point. Nigel is paid to work on suspend2, so it's not likely to go away once he has a new hobby (and again, he's been doing great work for some time already).

I do not think he's paid for suspend2 any more.

Quoted 3 lines

So what about working on merging suspend2 finally? Having a proven, stable and feature-rich implemenation available quickly, *and* someone who maintains *and* support it actively does not sound like a bad deal to me.

Nigel is not really maintaining it. He's willing to solve small problems, but not the big ones.

Quoted 5 lines

One should not underestimate the gains that a suspend2 merge has on the development merely by stating 'added complexity', that pays off _any_day_.

By the way, does 'working on uswsusp' mean that Pavel and will put less work in maintaining swsusp? That does not sound too promising to my sore ears.

uswsusp and swsusp share most of the important code (go take a look). No, in-kernel swap writing is not going to be improved too much, just the bugs fixed. That means very stable swsusp in kernel...

Quoted 4 lines

Personally, to work with, I'd prefer a developer who's responsibly dealing with users' questions and problems any day to one who rejects 99% of emails that don't contain a patch and 95% of those that contain one, stating 'WTF, I don't like that'.

Fine, feel free to help with answering users mails.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#283 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 3 lines · Pavel Machek

I'd love to have Nigel helping me and kernel, but he's not interested. He wants suspend2 merged, he does not want better suspend in kernel.

You are waaaay out of line!!!!
We _ALL_ want a better suspend in kernel!
You are the one who reject all other ideas and offerings. I think that almost every one who follow/read the thread understand that... Maybe except of you...

Quoted 2 lines

Nigel is not really maintaining it. He's willing to solve small problems, but not the big ones.

What?
It is a pleasure to work with Nigel!!! Unlike some other people here. Just read the suspend2 mailing lists and understand... Or maybe you are too blind to understand how to approach people.
When was the last time _YOU_ offered a new feature that helps the end-user? In fact swsusp is the one that is not maintained... It is just a toy for some programmers to say: "Hay I know to do that differently!"

Quoted 3 lines

uswsusp and swsusp share most of the important code (go take a look). No, in-kernel swap writing is not going to be improved too much, just the bugs fixed. That means very stable swsusp in kernel...

But both will not be able to write image to a file, right?
Both will not be able to write the image to the network, right? And what about the administrative interface (/proc), this is also not provided.

So swsusp and uswsusp will never reach the level of suspend2... Some of us understand that... But of course you reject the need... And going your way.... Although you know that providing the same level of features will require more in-kernel modifications.

Pavel, people are trying to help you!
It is one thing to reject their help.
But why to insult them?

Alon Bar-Lev.

#284 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek
Quoted 3 lines · Pavel Machek

I'd love to have Nigel helping me and kernel, but he's not interested. He wants suspend2 merged, he does not want better suspend in kernel.

If you made comments like that about me on a public mailing list I would feel it would be very difficult trying to cooperate with you.

Please reconsider your public replies regarding this already delicate issue a bit more before you criticize people who has spent a great deal of time trying to get a working solution.

Regards,
Brix

Signature · 2 lines
Henrik Brix Andersen <[email protected]>
Gentoo Metadistribution | Mobile computing herd
#285 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 10 lines · Henrik Brix Andersen
Quoted 3 lines

I'd love to have Nigel helping me and kernel, but he's not interested. He wants suspend2 merged, he does not want better suspend in kernel.

If you made comments like that about me on a public mailing list I would feel it would be very difficult trying to cooperate with you.

Please reconsider your public replies regarding this already delicate issue a bit more before you criticize people who has spent a great deal of time trying to get a working solution.

I'm going to have to second Henrik here. Pavel, there are times when you are starting to sound almost as strident as our cdrecord "friend".

Maybe you feel you are in a power position because your code happened to enter the kernel first, so you few you can have veto power over all other contenders. It sometimes works that way, but only up to a point. The fact of the matter is, Nigel code's *works* and swsusp has been at best slow and painful and unreliable. And while your been complaining about how swsusp2 has been splitting the user community sounds suspiciously like the NetBSD folks complaining that Linux took all over their user community -- never mind the fact that their attitude for a long time was, "if you can't figure out how to bootstrap NetBSD, you don't DESERVE to run our code"; in contrast, we worked on making Linux easy to install (the original reason why I implemented them ramdisk and boot floppy loader code was specifically to make the user install experience easier).

When users report problems, Nigel tries to help them. He doesn't say, "driver problem, not my problem", or "should be done in user space; why don't you implement it". Is it any surprise he has a huge user community?

- Ted

#286 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 8 lines · Theodore Ts'o
Quoted 7 lines · Henrik Brix Andersen
Quoted 3 lines

I'd love to have Nigel helping me and kernel, but he's not interested. He wants suspend2 merged, he does not want better suspend in kernel.

If you made comments like that about me on a public mailing list I would feel it would be very difficult trying to cooperate with you.

Quoted 7 lines
Quoted 3 lines

Please reconsider your public replies regarding this already delicate issue a bit more before you criticize people who has spent a great deal of time trying to get a working solution.

I'm going to have to second Henrik here. Pavel, there are times when you are starting to sound almost as strident as our cdrecord "friend".

Heh, I hope I'm not that bad.

Quoted 3 lines

Maybe you feel you are in a power position because your code happened to enter the kernel first, so you few you can have veto power over all other contenders. It sometimes works that way, but only up to a

Unfortunately, I do not need to veto suspend2. It is so complex that it vetoes itself. Last time akpm stopped it, IIRC.

You are welcome to take a look at those patches and try to get them into suitable form. But please don't compare me with Joerg unless you seen the patches.

Quoted 2 lines

point. The fact of the matter is, Nigel code's *works* and swsusp has been at best slow and painful and unreliable. And while your been

Painful and unreliable? Yep, it slow, at least it does not make rest of kernel slower. We are adressing "slow" with uswsusp...
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#287 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 17 lines · Pavel Machek
Quoted 8 lines · Theodore Ts'o
Quoted 7 lines · Henrik Brix Andersen
Quoted 3 lines

I'd love to have Nigel helping me and kernel, but he's not interested. He wants suspend2 merged, he does not want better suspend in kernel.

If you made comments like that about me on a public mailing list I would feel it would be very difficult trying to cooperate with you.

Quoted 7 lines
Quoted 3 lines

Please reconsider your public replies regarding this already delicate issue a bit more before you criticize people who has spent a great deal of time trying to get a working solution.

I'm going to have to second Henrik here. Pavel, there are times when you are starting to sound almost as strident as our cdrecord "friend".

Quoted 8 lines

Heh, I hope I'm not that bad.

Quoted 3 lines

Maybe you feel you are in a power position because your code happened to enter the kernel first, so you few you can have veto power over all other contenders. It sometimes works that way, but only up to a

Unfortunately, I do not need to veto suspend2. It is so complex that it vetoes itself. Last time akpm stopped it, IIRC.

...BTW... here's how you could help. Part of the problem is that Nigel does not trust me. When I tell him that something is not acceptable for kernel, he tends to ignore it (probably thinking it is me hating his code or something like that).

If you could take a look at the patches before they go to me, and either tell him what is wrong with them, or tell me that you consider them okay... I guess that would help a lot.

Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#288 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek

Hi.

Quoted 6 lines · Pavel Machek
Quoted 3 lines

Maybe you feel you are in a power position because your code happened to enter the kernel first, so you few you can have veto power over all other contenders. It sometimes works that way, but only up to a

Unfortunately, I do not need to veto suspend2. It is so complex that it vetoes itself. Last time akpm stopped it, IIRC.

I'm going to let most of the last 8 hours' emails float by without reply, but think I should comment here.

I don't believe I've ever seen an email from Andrew stopping a merge, and I shouldn't have, because I've never asked him to merge it. Being the perfectionist that I am, I've sought to get it as stable, reliable and comment-clean as I reasonably could before merging.

Regards,

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#289 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 7 lines · Nigel Cunningham

Hi.

Quoted 4 lines · Pavel Machek
Quoted 3 lines

Maybe you feel you are in a power position because your code happened to enter the kernel first, so you few you can have veto power over all other contenders. It sometimes works that way, but only up to a

Quoted 5 lines
Quoted 2 lines

Unfortunately, I do not need to veto suspend2. It is so complex that it vetoes itself. Last time akpm stopped it, IIRC.

I'm going to let most of the last 8 hours' emails float by without reply, but think I should comment here.

Thanks.

Quoted 4 lines

I don't believe I've ever seen an email from Andrew stopping a merge, and I shouldn't have, because I've never asked him to merge it. Being the perfectionist that I am, I've sought to get it as stable, reliable and comment-clean as I reasonably could before merging.

I believe I seen reply to that effect (saying "it is working and fast is not enough for merge", or something like that.

Anyway, please Cc me on merge attempts...
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#290 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 9 lines · Pavel Machek
Quoted 4 lines

I don't believe I've ever seen an email from Andrew stopping a merge, and I shouldn't have, because I've never asked him to merge it. Being the perfectionist that I am, I've sought to get it as stable, reliable and comment-clean as I reasonably could before merging.

I believe I seen reply to that effect (saying "it is working and fast is not enough for merge", or something like that.

Anyway, please Cc me on merge attempts...

Ah. So maybe it wasn't in response to a direct request from me. Okay.

With regard to real attempts, I'll be submitting the remainder for review soon (DV). I won't cc you then since you'll see it on LKML anyway. Don't take that as an attempt.

Regards,

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#291 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Matthias Hensler
Quoted 9 lines · Matthias Hensler

These "big changes" is something I have a problem with, since it means to delay a working suspend/resume in Linux for another "short-term" (so
what does it mean: 1 month? six? twelve?). It is painful to get these things to work reliable, I have followed this for nearly 1.5 years. And
again: today there is a working implementation, so why not merge it and
have something today, and then start working on the other things.

It never works that way in practice - if you let broken/suboptimal code into the kernel then it's a LOT less likely to get fixed later than if you make fixing it a condition of inclusion because once it's in there's much less motivation to fix it.

Lee

#292 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 9 lines · Lee Revell
Quoted 7 lines · Matthias Hensler

These "big changes" is something I have a problem with, since it means to delay a working suspend/resume in Linux for another "short-term" (so what does it mean: 1 month? six? twelve?). It is painful to get these things to work reliable, I have followed this for nearly 1.5 years. And again: today there is a working implementation, so why not merge it and have something today, and then start working on the other things.

Quoted 4 lines

It never works that way in practice - if you let broken/suboptimal code into the kernel then it's a LOT less likely to get fixed later than if you make fixing it a condition of inclusion because once it's in there's much less motivation to fix it.

Isn't this what happend with swusp? I tried it of a period of time when it was included in mainline, it was just buggy and nothing much improved.

I totally agree with you that nothing broken should be get into mainline, but I think that Suspend 2 has be proven to be stable, and it is worth to put work on it and to fix the remaining issues instead of just starting from the scratch.

Regards,
Matthias

#293 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 3 lines · Matthias Hensler

Isn't this what happend with swusp? I tried it of a period of time when it was included in mainline, it was just buggy and nothing much improved.

And you never explained why you can't try a recent version...

Lee

#294 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 6 lines · Lee Revell
Quoted 3 lines · Matthias Hensler

Isn't this what happend with swusp? I tried it of a period of time when it was included in mainline, it was just buggy and nothing much improved.

And you never explained why you can't try a recent version...

I said I surely will :-)

However, there wasn't a recent version until a short time before. I just did what you do in situations where you need a working solution: you stick to the most promising thing. While swsusp looked abandoned there was a huge work going on with Suspend 2.

As work started again on swsusp recently I will try that, but from what I have read so far it looks like swsusp is scheduled to become deprecated anyway and work will be put into uswsusp. That is all I complain about, it means throwing away everything that is working, or easy to get it working, and delaying working hibernate support for another time.

Regards,
Matthias

#295 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 4 lines · Matthias Hensler

That is all I
complain about, it means throwing away everything that is working, or easy to get it working, and delaying working hibernate support for another time.

But we have not established that the current implementation does not work! That's a pretty strong assertion to make with zero evidence.

Lee

#296 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 8 lines · Lee Revell
Quoted 4 lines · Matthias Hensler

That is all I
complain about, it means throwing away everything that is working, or easy to get it working, and delaying working hibernate support for another time.

But we have not established that the current implementation does not work! That's a pretty strong assertion to make with zero evidence.

...and that requires defining 'works'.

If we define it as "writes an image of some part of ram to a swap partition that can be and does normally get restored on the next boot", then yes, we have a working version in the existing vanilla kernel. If however you start talking about multiple swap partitions or swap files or ordinary files, about reliability or the ability to tune it to fit your system and preferences, about the responsiveness of the system post resume or the security of the image (IIRC, encryption support has just been removed from swsusp), about the ability to get help when you run into trouble or documentation, swsusp becomes less of a candidate for 'works'.

Regards,

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#297 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 14 lines

Hi.

Quoted 8 lines · Lee Revell
Quoted 4 lines · Matthias Hensler

That is all I
complain about, it means throwing away everything that is working, or easy to get it working, and delaying working hibernate support for another time.

But we have not established that the current implementation does not work! That's a pretty strong assertion to make with zero evidence.

...and that requires defining 'works'.

Quoted 9 lines

If we define it as "writes an image of some part of ram to a swap partition that can be and does normally get restored on the next boot", then yes, we have a working version in the existing vanilla kernel. If however you start talking about multiple swap partitions or swap files or ordinary files, about reliability or the ability to tune it to fit your system and preferences, about the responsiveness of the system post resume or the security of the image (IIRC, encryption support has just been removed from swsusp), about the ability to get help when you run into trouble or documentation, swsusp becomes less of a candidate for 'works'.

...so yes, it works, and the rest of features can be implemented in userspace. Feel free to help with documentation or userspace parts.
Pavel

Signature · 1 line
Thanks, Sharp!
#298 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Pavel Machek wrote:
..

Quoted 1 line

...so yes, it works...

About 50% of the time for me. The rest of the time I just see a complete fresh boot from scratch. What a pain!

-ml

#299 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 6 lines

Pavel Machek wrote:
..

Quoted 1 line

...so yes, it works...

About 50% of the time for me. The rest of the time I just see a complete fresh boot from scratch. What a pain!

Ouch... strange. Does it work reliably from init=/bin/bash boot? Do you see final steps of writing on the screen? Can you submit it to bugzilla.kernel.org?

Pavel

Signature · 1 line
Thanks, Sharp!
maintainer
#300 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 11 lines · Pavel Machek
Quoted 6 lines

Pavel Machek wrote:
..

Quoted 1 line

...so yes, it works...

About 50% of the time for me. The rest of the time I just see a complete fresh boot from scratch. What a pain!

Ouch... strange. Does it work reliably from init=/bin/bash boot? Do you see final steps of writing on the screen? Can you submit it to bugzilla.kernel.org?

I know I am bad for not reporting that earlier but swsusp was working OK for me till about 3 month ago when I started getting "soft lockup detected on CPU0" with no useable backtrace 3 times out of 4. I somehow suspect that having automounted nfs helps it to fail somehow...

For the record - I never tried swsuspend2 as I am tracking the tip of Linus's tree and prefre to have the tree clean for my work anyway.

--
Dmitry

#301 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 13 lines · Pavel Machek
Quoted 11 lines
Quoted 6 lines

Pavel Machek wrote:
..

Quoted 1 line

...so yes, it works...

About 50% of the time for me. The rest of the time I just see a complete fresh boot from scratch. What a pain!

Ouch... strange. Does it work reliably from init=/bin/bash boot? Do you see final steps of writing on the screen? Can you submit it to bugzilla.kernel.org?

Quoted 5 lines

I know I am bad for not reporting that earlier but swsusp was working OK for me till about 3 month ago when I started getting "soft lockup detected on CPU0" with no useable backtrace 3 times out of 4. I somehow suspect that having automounted nfs helps it to fail somehow...

Disable soft lockup watchdog :-).
Pavel

Signature · 1 line
Thanks, Sharp!
maintainer
#302 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 8 lines · Pavel Machek
Quoted 6 lines

I know I am bad for not reporting that earlier but swsusp was working OK for me till about 3 month ago when I started getting "soft lockup detected on CPU0" with no useable backtrace 3 times out of 4. I somehow suspect that having automounted nfs helps it to fail somehow...

Disable soft lockup watchdog :-).

Ok, I will try, but is this the permanent solution you are proposing?

--
Dmitry

#303 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 11 lines · Dmitry Torokhov
Quoted 8 lines · Pavel Machek
Quoted 6 lines

I know I am bad for not reporting that earlier but swsusp was working OK for me till about 3 month ago when I started getting "soft lockup detected on CPU0" with no useable backtrace 3 times out of 4. I somehow suspect that having automounted nfs helps it to fail somehow...

Disable soft lockup watchdog :-).

Ok, I will try, but is this the permanent solution you are proposing?

Certainly not.

The problem is the soft lockup watchdog tends to produce false-positives related to the clock resume vs timer interrupt dependencies that are hard to trace.

I used to get those on a regular basis until the timer resume on x86-64 got fixed a month ago or so.

Please try the latest -mm and see if it's not fixed there. If not, please file a bug report with bugzilla (with Cc to me).

Greetings,
Rafael

maintainer
#304 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 19 lines · Rafael J. Wysocki
Quoted 11 lines · Dmitry Torokhov
Quoted 8 lines · Pavel Machek
Quoted 6 lines

I know I am bad for not reporting that earlier but swsusp was working OK for me till about 3 month ago when I started getting "soft lockup detected on CPU0" with no useable backtrace 3 times out of 4. I somehow suspect that having automounted nfs helps it to fail somehow...

Disable soft lockup watchdog :-).

Ok, I will try, but is this the permanent solution you are proposing?

Certainly not.

The problem is the soft lockup watchdog tends to produce false-positives related to the clock resume vs timer interrupt dependencies that are hard to trace.

Quoted 6 lines

I used to get those on a regular basis until the timer resume on x86-64 got fixed a month ago or so.

Please try the latest -mm and see if it's not fixed there. If not, please file a bug report with bugzilla (with Cc to me).

Latest -mm is way too big a target. Do you have a specific patches in mind? Again my working kernel is based off tip of Linus's tree plus my patches, not -mm.

--
Dmitry

#305 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 23 lines · Dmitry Torokhov
Quoted 22 lines · Rafael J. Wysocki
Quoted 11 lines · Dmitry Torokhov
Quoted 8 lines · Pavel Machek
Quoted 6 lines

I know I am bad for not reporting that earlier but swsusp was working OK for me till about 3 month ago when I started getting "soft lockup detected on CPU0" with no useable backtrace 3 times out of 4. I somehow suspect that having automounted nfs helps it to fail somehow...

Disable soft lockup watchdog :-).

Ok, I will try, but is this the permanent solution you are proposing?

Certainly not.

The problem is the soft lockup watchdog tends to produce false-positives related to the clock resume vs timer interrupt dependencies that are hard to trace.

I used to get those on a regular basis until the timer resume on x86-64 got fixed a month ago or so.

Quoted 7 lines
Quoted 3 lines

Please try the latest -mm and see if it's not fixed there. If not, please file a bug report with bugzilla (with Cc to me).

Latest -mm is way too big a target. Do you have a specific patches in mind? Again my working kernel is based off tip of Linus's tree plus my patches, not -mm.

What architecture is it running on?

Rafael

maintainer
#306 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 8 lines · Rafael J. Wysocki
Quoted 4 lines · Dmitry Torokhov

Latest -mm is way too big a target. Do you have a specific patches in mind? Again my working kernel is based off tip of Linus's tree plus my patches, not -mm.

What architecture is it running on?

i386, nothing fancy.

--
Dmitry

#307 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 11 lines · Dmitry Torokhov
Quoted 8 lines · Rafael J. Wysocki
Quoted 4 lines · Dmitry Torokhov

Latest -mm is way too big a target. Do you have a specific patches in mind? Again my working kernel is based off tip of Linus's tree plus my patches, not -mm.

What architecture is it running on?

i386, nothing fancy.

OK, I'll try to figure out what exactly is wrong, but I'll need to set up an i386 test bed for this purpose which will take a few days.

Greetings,
Rafael

#308 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki

Certainly not.

The problem is the soft lockup watchdog tends to produce false-positives
related to the clock resume vs timer interrupt dependencies that are hard to trace.

I used to get those on a regular basis until the timer resume on x86-64
got fixed a month ago or so.

So it's uncovering bugs, exactly as intended.

Lee

#309 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek
Quoted 8 lines · Pavel Machek
Quoted 1 line

I know I am bad for not reporting that earlier but swsusp was

working

Quoted 4 lines

OK for me till about 3 month ago when I started getting "soft lockup detected on CPU0" with no useable backtrace 3 times out of 4. I somehow suspect that having automounted nfs helps it to fail somehow...

Disable soft lockup watchdog :-).

You do know that message is harmless and doesn't actually do anything right? It's just warning you that the kernel allowed something to hog the CPU without rescheduling for a LONG time.

Lee

#310 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 8 lines · Lee Revell
Quoted 7 lines · Pavel Machek
Quoted 1 line

I know I am bad for not reporting that earlier but swsusp was

working

Quoted 4 lines

OK for me till about 3 month ago when I started getting "soft lockup detected on CPU0" with no useable backtrace 3 times out of 4. I somehow suspect that having automounted nfs helps it to fail somehow...

Quoted 5 lines
Quoted 1 line

Disable soft lockup watchdog :-).

You do know that message is harmless and doesn't actually do anything right? It's just warning you that the kernel allowed something to hog the CPU without rescheduling for a LONG time.

This particular one is almost certainly a false-positive. Still it doesn't mean we shouldn't try to get rid of it.

Greetings,
Rafael

maintainer
#311 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Lee Revell
Quoted 8 lines · Lee Revell
Quoted 7 lines · Pavel Machek
Quoted 1 line

I know I am bad for not reporting that earlier but swsusp was

working

Quoted 4 lines

OK for me till about 3 month ago when I started getting "soft lockup detected on CPU0" with no useable backtrace 3 times out of 4. I somehow suspect that having automounted nfs helps it to fail somehow...

Quoted 5 lines
Quoted 1 line

Disable soft lockup watchdog :-).

You do know that message is harmless and doesn't actually do anything right? It's just warning you that the kernel allowed something to hog the CPU without rescheduling for a LONG time.

Well, if that is harmless I am not sure what you'd call harmful ;) because right after this message the box hangs solid and I have to push and hold power button to power it off and start again.

--
Dmitry

#312 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 11 lines · Dmitry Torokhov
Quoted 10 lines · Lee Revell
Quoted 8 lines · Pavel Machek
Quoted 1 line

I know I am bad for not reporting that earlier but swsusp was

working

Quoted 4 lines

OK for me till about 3 month ago when I started getting "soft lockup detected on CPU0" with no useable backtrace 3 times out of 4. I somehow suspect that having automounted nfs helps it to fail somehow...

Disable soft lockup watchdog :-).

Quoted 7 lines
Quoted 3 lines

You do know that message is harmless and doesn't actually do anything right? It's just warning you that the kernel allowed something to hog the CPU without rescheduling for a LONG time.

Well, if that is harmless I am not sure what you'd call harmful ;) because right after this message the box hangs solid and I have to push and hold power button to power it off and start again.

Now this means you get the "softlockup watchdog" message because of a bug that hangs your box and is actually detected by the watchdog. I didn't realize that before, so please disregard my previous messages.

Have you tried to boot the box with "init=/bin/bash" and suspend? [You'll have to mount /proc and /sys, and do "swapon -a" manually before
"echo disk > /sys/power/state".]

Greetings,
Rafael

#313 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Dmitry Torokhov
Quoted 4 lines · Dmitry Torokhov

Well, if that is harmless I am not sure what you'd call harmful ;) because right after this message the box hangs solid and I have to push and hold power button to power it off and start again.

I don't think the watchdog does this. Probably the machine would have locked up anyway. If you disable the watchdog does the machine keep going?

Lee

#314 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Lee Revell
Quoted 6 lines · Lee Revell
Quoted 3 lines

That is all I complain about, it means throwing away everything that is working, or easy to get it working, and delaying working hibernate support for another time.

But we have not established that the current implementation does not work! That's a pretty strong assertion to make with zero evidence.

As I said, it did not work. Efforts to make it work just started recently, at a time when Suspend 2 already was stable and reliable to me.

But, ok. Rawhide kernel 2.6.15-1.1955_FC5, which should be pretty close to what Fedora Core 5 will have (Dave might know this better).

The first try was a desaster, partly my own fault, partly because swsusp does not allow abortion (remember what I said about having a least some basic stuff in the kernel). However, I rebooted, fscked, no filesystem corruption *phew*.

The second try worked, with ugly messages scrolling over the console, but ok, Suspend 2 already fixes some drivers which has not yet been merged to mainline. The system resumed, which is fine.

Third try sound was gone. On the fourth try the system hanged after starting ppracer (to test GLX/DRI on my i855).

This is a much more recent kernel, than the ones I used with Suspend 2 for the last 1.5 problems. Problems discovered have been no issue with Suspend 2 for at least 7 or 8 months (no single crash or driver problems). This is mostly a driver issue and undoubtly can be solved, but I still do not see how this can be done when all efforts are put into just another suspend implementation (uswsusp).

Ah, and now the part I really like, some hard numbers:
swsusp takes between 26 and 30 seconds to suspend (in my four tries: 26, 30, 28, 26) and between 35 and 45 seconds to resume (35, 45, 39, 37).

Suspend 2 does suspend in around 14-16 seconds, and resume in 18 to 21.

That is factor 2!

Regards,
Matthias

#315 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 11 lines · Lee Revell
Quoted 6 lines
Quoted 3 lines

That is all I complain about, it means throwing away everything that is working, or easy to get it working, and delaying working hibernate support for another time.

But we have not established that the current implementation does not work! That's a pretty strong assertion to make with zero evidence.

As I said, it did not work. Efforts to make it work just started recently, at a time when Suspend 2 already was stable and reliable to me.

That is not true.

Quoted 7 lines

But, ok. Rawhide kernel 2.6.15-1.1955_FC5, which should be pretty close to what Fedora Core 5 will have (Dave might know this better).

The first try was a desaster, partly my own fault, partly because swsusp does not allow abortion (remember what I said about having a least some basic stuff in the kernel). However, I rebooted, fscked, no filesystem corruption *phew*.

Abortion can be done in userspace. Perhaps even as easily as ^c during the suspend script.

Quoted 3 lines

The second try worked, with ugly messages scrolling over the console, but ok, Suspend 2 already fixes some drivers which has not yet been merged to mainline. The system resumed, which is fine.

Submit driver fixes, then.

Quoted 2 lines

Third try sound was gone. On the fourth try the system hanged after starting ppracer (to test GLX/DRI on my i855).

Submit AGP fixes, then.

Quoted 6 lines

This is a much more recent kernel, than the ones I used with Suspend 2 for the last 1.5 problems. Problems discovered have been no issue with Suspend 2 for at least 7 or 8 months (no single crash or driver problems). This is mostly a driver issue and undoubtly can be solved, but I still do not see how this can be done when all efforts are put into just another suspend implementation (uswsusp).

uswsusp & swsusp & suspend2 share underlying drivers. If Nigel has some fixes he had not propagated upstream... that is not *my* fault.

(Or you can help here, take relevant driver updates from suspend2 and submit them yourself.)

Quoted 7 lines

Ah, and now the part I really like, some hard numbers:
swsusp takes between 26 and 30 seconds to suspend (in my four tries: 26, 30, 28, 26) and between 35 and 45 seconds to resume (35, 45, 39, 37).

Suspend 2 does suspend in around 14-16 seconds, and resume in 18 to 21.

That is factor 2!

Does that include time to boot resume kernel? It will not be that dramatic with that time included, and it is only fair to include it. Anyway uswsusp solves that issue.
Pavel

Signature · 1 line
Thanks, Sharp!
#316 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 10 lines · Pavel Machek
Quoted 8 lines · Lee Revell
Quoted 3 lines

But we have not established that the current implementation does not work! That's a pretty strong assertion to make with zero evidence.

As I said, it did not work. Efforts to make it work just started recently, at a time when Suspend 2 already was stable and reliable to me.

That is not true.

What? That Suspend 2 was stable for me that time? Yes, it definitly was. The same time when swsusp failed dramatically here, if there was progress I could not see it that time.

Quoted 7 lines
Quoted 4 lines

The first try was a desaster, partly my own fault, partly because swsusp does not allow abortion (remember what I said about having a least some basic stuff in the kernel). However, I rebooted, fscked, no filesystem corruption *phew*.

Abortion can be done in userspace. Perhaps even as easily as ^c during the suspend script.

Actually this was on resume, while the kernel was in full control. With Suspend 2 I could have pressed escape (that is the ugly stuff you complained about), while I had to fully restart the system with sysrq+b with swsusp.

Quoted 5 lines
Quoted 3 lines

The second try worked, with ugly messages scrolling over the console, but ok, Suspend 2 already fixes some drivers which has not yet been merged to mainline. The system resumed, which is fine.

Submit driver fixes, then.

Nigel did, that is why the patch is so huge.

Quoted 4 lines
Quoted 2 lines

Third try sound was gone. On the fourth try the system hanged after starting ppracer (to test GLX/DRI on my i855).

Submit AGP fixes, then.

I think no such fixes are in Suspend 2, but still it works there.

Quoted 9 lines
Quoted 6 lines

This is a much more recent kernel, than the ones I used with Suspend 2 for the last 1.5 problems. Problems discovered have been no issue with Suspend 2 for at least 7 or 8 months (no single crash or driver problems). This is mostly a driver issue and undoubtly can be solved, but I still do not see how this can be done when all efforts are put into just another suspend implementation (uswsusp).

uswsusp & swsusp & suspend2 share underlying drivers. If Nigel has some fixes he had not propagated upstream... that is not *my* fault.

Read again, I already said that this are some driver problems, and I think that most of them are already submitted.

But then again, this was about work/not work, and there are still problems, so there is still efford needed. In this situation it is not good to just start over, but take the things that are already there and work with it.

Quoted 11 lines
Quoted 8 lines

Ah, and now the part I really like, some hard numbers: swsusp takes between 26 and 30 seconds to suspend (in my four tries: 26, 30, 28,
26) and between 35 and 45 seconds to resume (35, 45, 39, 37).

Suspend 2 does suspend in around 14-16 seconds, and resume in 18 to 21.

That is factor 2!

Does that include time to boot resume kernel? It will not be that dramatic with that time included, and it is only fair to include it.

Actually it is, yes. This time is dramatic and includes the full time I see from a user point of view.

Time for suspend was measured from the time I started hibernate (Suspend 2)/echoed disk into /sys/power/state (swsusp) until the moment the notebook powered down.

Time for resume was measured from the time I pressed enter in grub and the system was back will full X and drivers and ready to work.

I think this is a fair time comparision, and it is a dramatic factor of
2. (BTW: the time from powering on the notebook until the grub-menu comes up takes 3 seconds, so feel free to add this. It would not make a huge difference.)

However, this test was made with very empty caches, I suspect after some more work when the caches get filled, this will change even more dramatically, thanks to LZF compression (which might be in uswsusp, but is not in swsusp).

Quoted 1 line

Anyway uswsusp solves that issue.

Maybe it will, but when?

I looks like that we are at the same point we started from: swsusp had a lot of problems in the past and is still not working so great and also very slow. Suspend 2 has proved to be stable and reliable for nearly a year. Work on uswsusp has just started and needs a lot of time to become mature.

And here is my point again: take the easiest way to make hibernation working fast, and when that is done start to work on any new implementation.

Regards,
Matthias

#317 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 11 lines · Pavel Machek
Quoted 6 lines
Quoted 4 lines · Lee Revell

As I said, it did not work. Efforts to make it work just started recently, at a time when Suspend 2 already was stable and reliable to me.

That is not true.

What? That Suspend 2 was stable for me that time? Yes, it definitly was. The same time when swsusp failed dramatically here, if there was progress I could not see it that time.

"That efforts to fix swsusp only started recently" part is untrue. Driver work was pretty much done from the time swsusp was merged, and is ongoing.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

The first try was a desaster, partly my own fault, partly because swsusp does not allow abortion (remember what I said about having a least some basic stuff in the kernel). However, I rebooted, fscked, no filesystem corruption *phew*.

Quoted 7 lines
Quoted 2 lines

Abortion can be done in userspace. Perhaps even as easily as ^c during the suspend script.

Actually this was on resume, while the kernel was in full control. With Suspend 2 I could have pressed escape (that is the ugly stuff you complained about), while I had to fully restart the system with sysrq+b with swsusp.

You should be able to ^c resume script, too. (But that's going to cause problems anyway, no?)

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

The second try worked, with ugly messages scrolling over the console, but ok, Suspend 2 already fixes some drivers which has not yet been merged to mainline. The system resumed, which is fine.

Submit driver fixes, then.

Nigel did, that is why the patch is so huge.

No, he did not. Driver fixes should be sent to relevant maintainers, not as a part of "suspend2 -- merge this"...

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

This is a much more recent kernel, than the ones I used with Suspend 2 for the last 1.5 problems. Problems discovered have been no issue with Suspend 2 for at least 7 or 8 months (no single crash or driver problems). This is mostly a driver issue and undoubtly can be solved, but I still do not see how this can be done when all efforts are put into just another suspend implementation (uswsusp).

Quoted 5 lines
Quoted 2 lines

uswsusp & swsusp & suspend2 share underlying drivers. If Nigel has some fixes he had not propagated upstream... that is not *my* fault.

Read again, I already said that this are some driver problems, and I think that most of them are already submitted.

You read again. As drivers are common in swsusp and uswsusp cases... of course we are working on fixing that.

Quoted 4 lines

But then again, this was about work/not work, and there are still problems, so there is still efford needed. In this situation it is not good to just start over, but take the things that are already there and work with it.

I seen Nigel's recent patch. Yes, it is easier to just start over. (8000 unneccessary lines... that's 3 times size of swsusp with uswsusp included!)

Quoted 5 lines

I think this is a fair time comparision, and it is a dramatic factor of
2. (BTW: the time from powering on the notebook until the grub-menu comes up takes 3 seconds, so feel free to add this. It would not make a huge difference.)

Quoted 8 lines

However, this test was made with very empty caches, I suspect after some more work when the caches get filled, this will change even more dramatically, thanks to LZF compression (which might be in uswsusp, but is not in swsusp).

Quoted 1 line

Anyway uswsusp solves that issue.

Maybe it will, but when?

It works today, try it.

Quoted 3 lines

And here is my point again: take the easiest way to make hibernation working fast, and when that is done start to work on any new implementation.

I'm not interested in "easiest way to fast hibernation". I'm interested in "right way to fast hibernation".
Pavel

Signature · 1 line
Thanks, Sharp!
#318 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 8 lines · Pavel Machek
Quoted 4 lines · Pavel Machek

What? That Suspend 2 was stable for me that time? Yes, it definitly was. The same time when swsusp failed dramatically here, if there was progress I could not see it that time.

"That efforts to fix swsusp only started recently" part is untrue. Driver work was pretty much done from the time swsusp was merged, and is ongoing.

As I did not really follow the ongoing work that time I will believe you here.

So I am left to my statement that Suspend 2 worked for nearly one year, where swsusp still has issues.

Quoted 2 lines

You should be able to ^c resume script, too. (But that's going to cause problems anyway, no?)

In this case swsusp wanted to restore an already invalid image (had a reboot with fsck before) which would have resulted in filesystem corruption. If you are able to stop the resume process with ^C that is fine, but that needs the "ugly" eventhandler in the kernel (which I think is not so ugly at all).

As I said, this situation was partly my own fault, and we do not need to discuss this further. It just reminds me on the bad things that could be happen.

Quoted 4 lines
Quoted 1 line

Nigel did, that is why the patch is so huge.

No, he did not. Driver fixes should be sent to relevant maintainers, not as a part of "suspend2 -- merge this"...

I think most patches were already submitted upstream. And I think we all agree that this is the way how it should happen.

So, cleanups are still necessary, and I believe Nigel mentioned that he is already working on it.

Quoted 8 lines
Quoted 4 lines

But then again, this was about work/not work, and there are still problems, so there is still efford needed. In this situation it is not good to just start over, but take the things that are already there and work with it.

I seen Nigel's recent patch. Yes, it is easier to just start over. (8000 unneccessary lines... that's 3 times size of swsusp with uswsusp included!)

Correct me if I am wrong, but I see your comments are about Suspend 2.2, while a lot of this was already be fixed in 2.2.0.1.

And Nigel has taken your points and preparing a new patch. So let see when it is ready.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Anyway uswsusp solves that issue.

Maybe it will, but when?

It works today, try it.

Using -mm is not an issue for me at the moment, so I cannot test it. I will believe you with that, however I doubt that uswsusp is in any better state than Suspend 2 when it comes to stability, reliabilty, documentation and availability of working packages (at least I see no userbase).

I do not say that uswsusp will not work, or never will, but I say that it is far from finished, that is why it should be considered to use the other solution first.

Quoted 6 lines
Quoted 3 lines

And here is my point again: take the easiest way to make hibernation working fast, and when that is done start to work on any new implementation.

I'm not interested in "easiest way to fast hibernation". I'm interested in "right way to fast hibernation".

OK, for me the "right way" is to take the working solution and work around the problems and issues that are left and prevent it from getting into mainline.

Regards,
Matthias

#319 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi!

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

But then again, this was about work/not work, and there are still problems, so there is still efford needed. In this situation it is not good to just start over, but take the things that are already there and work with it.

I seen Nigel's recent patch. Yes, it is easier to just start over. (8000 unneccessary lines... that's 3 times size of swsusp with uswsusp included!)

Quoted 5 lines

Correct me if I am wrong, but I see your comments are about Suspend 2.2, while a lot of this was already be fixed in 2.2.0.1.

And Nigel has taken your points and preparing a new patch. So let see when it is ready.

Well... I trust that all the typos and =0 and // comments are going to be fixed, but I somehow doubt he'll switch to mainline code and drop his bitmaps or drop plugin architecture. If 2.2.0.2 is 8000 lines smaller... I'd be pleasently surprised.
Pavel

Signature · 1 line
Thanks, Sharp!
#320 lore raw

agp fixes in suspend2 patch

In reply to Matthias Hensler
Quoted 6 lines · Matthias Hensler
Quoted 4 lines
Quoted 2 lines

Third try sound was gone. On the fourth try the system hanged after starting ppracer (to test GLX/DRI on my i855).

Submit AGP fixes, then.

I think no such fixes are in Suspend 2, but still it works there.

actually there're (well i didn't compile nor test suspend2) in 100-suspend2-2.2-for-2.6.15.1.patch:

it introduces agp_suspend.h and uses it in the various agp backend drivers in order to suspend/resume agp controllers (only for ati and nvidia though).

#321 lore raw

Re: agp fixes in suspend2 patch

Quoted 7 lines · Thierry Vignaud
Quoted 5 lines · Matthias Hensler
Quoted 4 lines
Quoted 2 lines

Third try sound was gone. On the fourth try the system hanged after starting ppracer (to test GLX/DRI on my i855).

Submit AGP fixes, then.

Quoted 8 lines
Quoted 1 line

I think no such fixes are in Suspend 2, but still it works there.

actually there're (well i didn't compile nor test suspend2) in 100-suspend2-2.2-for-2.6.15.1.patch:

it introduces agp_suspend.h and uses it in the various agp backend drivers in order to suspend/resume agp controllers (only for ati and nvidia though).

if they're the patches I'm thinking of, equivalent fixes went into 2.6.16rc already

Dave

#322 lore raw

Re: Which is simpler?

In reply to Pavel Machek
Quoted 11 lines · Pavel Machek
Quoted 7 lines

Ah, and now the part I really like, some hard numbers:
swsusp takes between 26 and 30 seconds to suspend (in my four tries: 26, 30, 28, 26) and between 35 and 45 seconds to resume (35, 45, 39, 37).

Suspend 2 does suspend in around 14-16 seconds, and resume in 18 to 21.

That is factor 2!

Does that include time to boot resume kernel? It will not be that dramatic with that time included, and it is only fair to include it. Anyway uswsusp solves that issue.

On my old ThinkPad, the difference is more like a factor of 3 to 4 - from the moment I press the power button until X is up and running.

Suspend2 resumes faster than Windows 2000 on this machine.

Signature · 1 line
Hilsen Harald.
#323 lore raw

Re: Which is simpler?

Quoted 8 lines
Quoted 6 lines · Pavel Machek
Quoted 6 lines

Ah, and now the part I really like, some hard numbers:
swsusp takes between 26 and 30 seconds to suspend (in my four tries: 26, 30, 28, 26) and between 35 and 45 seconds to resume (35, 45, 39, 37).

Suspend 2 does suspend in around 14-16 seconds, and resume in 18 to 21.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

That is factor 2!

Does that include time to boot resume kernel? It will not be that dramatic with that time included, and it is only fair to include it. Anyway uswsusp solves that issue.

On my old ThinkPad, the difference is more like a factor of 3 to 4 - from the moment I press the power button until X is up and running.

Well, yep, it really depends on CPU/harddisk.

Can you try code from suspend.sf.net? It should be as fast as suspend2.

Pavel

Signature · 1 line
Thanks, Sharp!
#324 lore raw

Re: Which is simpler?

Hi.

Quoted 1 line · Pavel Machek

Well, yep, it really depends on CPU/harddisk.

That is why a solution using LZF is needed, so either Suspend 2 or uswsusp.

Quoted 2 lines

Can you try code from suspend.sf.net? It should be as fast as suspend2.

I would like to have a look at it, but http://suspend.sourceforge.net/
gives me an empty directory and http://sourceforge.net/suspend/ a "page not found".

Regards,
Matthias

#325 lore raw

Re: Which is simpler?

Quoted 8 lines

Hi.

Quoted 1 line · Pavel Machek

Well, yep, it really depends on CPU/harddisk.

That is why a solution using LZF is needed, so either Suspend 2 or uswsusp.

Quoted 6 lines
Quoted 2 lines

Can you try code from suspend.sf.net? It should be as fast as suspend2.

I would like to have a look at it, but http://suspend.sourceforge.net/
gives me an empty directory and http://sourceforge.net/suspend/ a "page not found".

Ahha, sorry, go to www.sf.net/projects/suspend/ , then check out code from CVS, there's nice description how to do that there.
Pavel

Signature · 1 line
Thanks, Sharp!
#326 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Lee Revell

Hi.

Quoted 11 lines · Lee Revell
Quoted 9 lines · Matthias Hensler

These "big changes" is something I have a problem with, since it means to delay a working suspend/resume in Linux for another "short-term" (so
what does it mean: 1 month? six? twelve?). It is painful to get these things to work reliable, I have followed this for nearly 1.5 years. And
again: today there is a working implementation, so why not merge it and
have something today, and then start working on the other things.

Quoted 4 lines

It never works that way in practice - if you let broken/suboptimal code into the kernel then it's a LOT less likely to get fixed later than if you make fixing it a condition of inclusion because once it's in there's much less motivation to fix it.

I can be an exception, can't I?

Regards,

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#327 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 14 lines

Hi.

Quoted 11 lines · Lee Revell
Quoted 9 lines · Matthias Hensler

These "big changes" is something I have a problem with, since it means to delay a working suspend/resume in Linux for another "short-term" (so
what does it mean: 1 month? six? twelve?). It is painful to get these things to work reliable, I have followed this for nearly 1.5 years. And
again: today there is a working implementation, so why not merge it and
have something today, and then start working on the other things.

Quoted 6 lines
Quoted 4 lines

It never works that way in practice - if you let broken/suboptimal code into the kernel then it's a LOT less likely to get fixed later than if you make fixing it a condition of inclusion because once it's in there's much less motivation to fix it.

I can be an exception, can't I?

I do not trust you to be an exception, sorry. Your behaviour up to now also suggests you will not be.
Pavel

Signature · 1 line
Thanks, Sharp!
#328 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Matthias Hensler
Quoted 10 lines · Matthias Hensler
Quoted 2 lines

It is less work to port suspend2's features into userspace than to make suspend2 acceptable to mainline. Both will mean big changes,

and

Quoted 2 lines

may cause some short-term problems, but it will be less pain than maintaining suspend2 forever. Please help with the former...

These "big changes" is something I have a problem with, since it means to delay a working suspend/resume in Linux for another "short-term" (so
what does it mean: 1 month? six? twelve?).

If you have a big problem with this then ask the developer why he didn't submit it 1 or 6 or 12 months sooner, don't complain to the kernel developers.

Lee

#329 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 8 lines · Lee Revell
Quoted 3 lines · Matthias Hensler

These "big changes" is something I have a problem with, since it means to delay a working suspend/resume in Linux for another "short-term" (so what does it mean: 1 month? six? twelve?).

If you have a big problem with this then ask the developer why he didn't submit it 1 or 6 or 12 months sooner, don't complain to the kernel developers.

Well, that is up to Nigel, but he did spend a lot of time to make Suspend 2 clean and acceptable for the mainline first.

I do not complain that the patch is not inserted as it is. I too see the problems and open issues. But that is nothing that cannot be solved.

What I complain is to start from the scratch with something which is not necessarily better and takes a lot of time. I think uswsusp in the current form just has too many drawbacks.

Regards,
Matthias

#330 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 8 lines · Matthias Hensler

Hi.

Quoted 5 lines · Lee Revell
Quoted 3 lines · Matthias Hensler

These "big changes" is something I have a problem with, since it means to delay a working suspend/resume in Linux for another "short-term" (so what does it mean: 1 month? six? twelve?).

Quoted 6 lines
Quoted 3 lines

If you have a big problem with this then ask the developer why he didn't submit it 1 or 6 or 12 months sooner, don't complain to the kernel developers.

Well, that is up to Nigel, but he did spend a lot of time to make Suspend 2 clean and acceptable for the mainline first.

As I said.. Nigel is fixing small problems but not the big ones.

Quoted 2 lines

I do not complain that the patch is not inserted as it is. I too see the problems and open issues. But that is nothing that cannot be solved.

Nigel is unviling to solve that. I pointed out 8000 lines of code (>50% of his patch) that can better be done in userspace. I do not think he's willing to address that.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#331 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Lee Revell

Hi.

Quoted 9 lines · Lee Revell
Quoted 8 lines · Matthias Hensler
Quoted 2 lines

It is less work to port suspend2's features into userspace than to make suspend2 acceptable to mainline. Both will mean big changes,

and

Quoted 2 lines

may cause some short-term problems, but it will be less pain than maintaining suspend2 forever. Please help with the former...

Quoted 8 lines
Quoted 4 lines

These "big changes" is something I have a problem with, since it means to delay a working suspend/resume in Linux for another "short-term" (so
what does it mean: 1 month? six? twelve?).

If you have a big problem with this then ask the developer why he didn't submit it 1 or 6 or 12 months sooner, don't complain to the kernel developers.

I submitted it for review 15 months ago. Since then I've been working to apply the suggestions, clean things up more and finish the last few bits of missing functionality. Contrary to what Sebas implied earlier, I'm not paid to work on Suspend2 on a full time basis. I work on it up to 20% of work hours (thanks, Cyclades), and the remainder of the work is done in my own time. This often means that things move more slowly than I'd like, but my wife will happily testify that I still spend too much time on it :)

Regards,

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#332 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 5 lines · Nigel Cunningham

I submitted it for review 15 months ago. Since then I've been working to apply
the suggestions, clean things up more and finish the last few bits of missing
functionality. Contrary to what Sebas implied earlier, I'm not paid to

Quoted 8 lines

work
on Suspend2 on a full time basis. I work on it up to 20% of work hours
(thanks, Cyclades), and the remainder of the work is done in my own time.
This often means that things move more slowly than I'd like, but my wife will
happily testify that I still spend too much time on it :)

My point was simply that "we need this now" is not a good argument for immediate merging - I was not trying to imply that you aren't working fast enough ;-)

Lee

#333 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 2 lines · Lee Revell

My point was simply that "we need this now" is not a good argument for immediate merging

The point "we need this now" is indeed no argument for merging something which might be broken, but is an argument for working on getting the most promising solution.

Regards,
Matthias

#334 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Lee Revell
Quoted 3 lines · Lee Revell

My point was simply that "we need this now" is not a good argument for immediate merging - I was not trying to imply that you aren't working fast enough ;-)

What about "we need this two years ago" ?

I'm having a really hard time convincing myself that Pavel and friends, while rather good as developpers, haven't succumbed to a bad case of NIH syndrome. Even with wanting to move as many things to userspace as possible, merging suspend2 with cleanups if necessary, _then_ starting from there to move things to userspace seems more realistic long-term. Right now it really looks like they're only trying to redo what's already in suspend2, tested and debugged, only different and new, hence untested and undebugged.

The only thing I've seen that is really against suspend2 is the amount of code it adds to the kernel. Given that said code is actively maintained, moving what can be moved to userspace can easily be done afterwards.

OG.

#335 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 10 lines · Olivier Galibert
Quoted 3 lines · Lee Revell

My point was simply that "we need this now" is not a good argument for immediate merging - I was not trying to imply that you aren't working fast enough ;-)

What about "we need this two years ago" ?

I'm having a really hard time convincing myself that Pavel and friends, while rather good as developpers, haven't succumbed to a bad case of NIH syndrome.

Actually "Pavel and frieds" are Pavel and _me_ and _I_ don't like what you're saying here.

Quoted 4 lines

Even with wanting to move as many things to
userspace as possible, merging suspend2 with cleanups if necessary, _then_ starting from there to move things to userspace seems more realistic long-term.

The _only_ thing we moved to the user space was the writing and reading of the image. [We moved it quite literally, by porting the analogous swsusp code from the current -mm.]

Currently we are _not_ moving _anything_ to the user space. We're just _implementing_ some things in the user space, but _not_ from scratch.

Quoted 3 lines

Right now it really looks like they're only
trying to redo what's already in suspend2, tested and debugged, only different and new, hence untested and undebugged.

Actually a lot of the code that we use _has_ _been_ tested and debugged, because it _is_ used on a daily basis by many people, like eg.:
- MD5 from the coreutils package,
- libLZF (the original one)
(openSSL wil be used soon for the image encryption).

And I'm not trying to redo suspend2 in the user space. Instead I'm trying to use the code that's _already_ _available_ in the user space to obtain the functionality that suspend2 implements in the kernel space.

Quoted 4 lines

The only thing I've seen that is really against suspend2 is the amount of code it adds to the kernel. Given that said code is actively maintained, moving what can be moved to userspace can easily be done afterwards.

The problem is to merge suspend2 we'd have to clean it up first and actually solve some problems that it works around. That, arguably, would be more work than just implementing some _easy_ stuff in the user space.

Greetings,
Rafael

#336 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 2 lines · Rafael J. Wysocki

Actually "Pavel and frieds" are Pavel and _me_ and _I_ don't like what you're saying here.

Sorry about that. Look at the thread though, and the answers to questions of the "suspend2 as feature <x>" kind. They tend to be either "you don't need it" or "we need to reimplement it". That looks like a bad syndrome of NIHing to me and I should know, I catch myself often enough at it. It's really, really hard to admit that code that you write yourself, for which you will instinctively know your way around much better, may not in practice be better long term that what already exists. Often enough just because what already exists obviously existed for longer than code you're going to write and as a result has been way more debugged.

Quoted 5 lines
Quoted 4 lines

Even with wanting to move as many things to
userspace as possible, merging suspend2 with cleanups if necessary, _then_ starting from there to move things to userspace seems more realistic long-term.

Quoted 8 lines

The _only_ thing we moved to the user space was the writing and reading of the image. [We moved it quite literally, by porting the analogous swsusp code from the current -mm.]

Currently we are _not_ moving _anything_ to the user space. We're just _implementing_ some things in the user space, but _not_ from scratch.

From what I see of the messages in this thread, at that point you're

just trying to play catchup with suspend2. Don't that feel a little strange to you? You know you have working GPL code handy, tested with happy users, with a maintainer who would be happy to have it in the kernel, and instead of making it better you spend your talents redoing the same functionality only slightly differently. Why? Just for a semireligious argument on where the userspace/kernelspace separation should be in the suspend process?

Quoted 10 lines
Quoted 3 lines

Right now it really looks like they're only
trying to redo what's already in suspend2, tested and debugged, only different and new, hence untested and undebugged.

Actually a lot of the code that we use _has_ _been_ tested and debugged, because it _is_ used on a daily basis by many people, like eg.:
- MD5 from the coreutils package,
- libLZF (the original one)
(openSSL wil be used soon for the image encryption).

Quoted 3 lines

And I'm not trying to redo suspend2 in the user space. Instead I'm trying to use the code that's _already_ _available_ in the user space to obtain the functionality that suspend2 implements in the kernel space.

"obtaining the functionality that suspend2 implements" means "redoing suspend2". Don't play on words, please.

md5 is already in the kernel (twice). lzf is already in suspend2 (and arguably useful for more things than only suspending), so suspend2's implementation has been tested for use in a suspend context, while libLZF hasn't. You _will_ have bugs putting things together, that's a given.

Now explain me why you're tying together code from coreutils and other sources when you have the same code, only already tested in a suspend context (memory management, etc), in suspend2. Why, for the image save, did you port the code from swsusp with for instance its lack of async i/o, instead of porting the suspend2 code?

Quoted 4 lines

The problem is to merge suspend2 we'd have to clean it up first and actually solve some problems that it works around. That, arguably, would be more work than just implementing some _easy_ stuff in the user space.

Stuff that is _already_ _done_ and working.

Be careful though, you're awfully close to saying that userspace code is easier because it isn't reviewed[1] while kernel code has higher standards. I really doubt it from you guys, but it looks like that.

Ask yourself some important questions and see if you like the answers:

1- will uswsusp solve problems suspend2 doesn't? Real, currently
encountered problems, not philosophical problems about kernel/userspace code positions[2]. In particular, since according to Pavel 90+% of the problems are driver issues, why aren't you concentrating on drivers?

2- in the time you're going to need to reimplement all the features of
suspend2 and stabilize the code, wouldn't it be possible to fix the worked-around problems of suspend2? Will you ever be able to be as stable as suspend2 given the heads-up that code has?

3- if the main problem is really that some parts of suspend2 should be
in userspace instead of kernelspace, why aren't you working from the appropriate parts of the suspend2 code to port them to userspace use instead of going to coreutils/libLZF/etc? The constraints on userland suspend code are rather close to RT kernel code, so technically it would be a much better base.

4- why aren't you actively working at pushing the parts of suspend2
that actually are good and potentially useful to uswsusp in the mainline kernel. Do you really think nothing is worthwhile in there?

Are you really, really sure you're not rejecting suspend2 in bulk because you didn't write it? Do we need a John W. Linville as suspend maintainer for things to go better?

Please tell me what is wrong in my perception of what is going on.

OG, not even a suspend2 user.

[1] Look at s2ram.c and puke. I understand it has been clobbed together for testing and as such does not pretend to be of any quality, but it's so bad it's painful.

[2] Otherwise you can start net5 in userspace just because it doesn't absolutely need to be in kernelspace.

#337 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 7 lines · Olivier Galibert
Quoted 6 lines · Rafael J. Wysocki

Actually a lot of the code that we use _has_ _been_ tested and debugged, because it _is_ used on a daily basis by many people, like eg.:
- MD5 from the coreutils package,
- libLZF (the original one)
(openSSL wil be used soon for the image encryption).

Quoted 6 lines
Quoted 3 lines

And I'm not trying to redo suspend2 in the user space. Instead I'm trying to use the code that's _already_ _available_ in the user space to obtain the functionality that suspend2 implements in the kernel space.

"obtaining the functionality that suspend2 implements" means "redoing suspend2". Don't play on words, please.

through using the userspace helper he is able to use existing maintained libaries, something that isn't possible with kernelspace suspend. This is real code reduction.

Quoted 2 lines

md5 is already in the kernel (twice). lzf is already in suspend2 (and arguably useful for more things than only suspending),

Why (when LZF would be useful for other stuff) nobody proposed inclusion of it?

Quoted 6 lines
Quoted 4 lines

The problem is to merge suspend2 we'd have to clean it up first and actually solve some problems that it works around. That, arguably, would be more work than just implementing some _easy_ stuff in the user space.

Stuff that is _already_ _done_ and working.

While reading this 'discussion' I get the expression that swsusp isn't working. But this isn't true: it works for me since I can't remember when. The only problems were with some modules (ieee1394 had to be unloaded before suspending) and minor glinches (writing the image sometimes _very_ slow when suspending from a powersave cpufreq governor..).

Quoted 3 lines

1- will uswsusp solve problems suspend2 doesn't? Real, currently
encountered problems, not philosophical problems about kernel/userspace code positions[2].

swsusp works for me (TM), no problems at all, siree

Quoted 3 lines

In particular, since according
to Pavel 90+% of the problems are driver issues, why aren't you concentrating on drivers?

so submit driver specific patches through the driver's maintainer? Where does Pavel enter the picture?

Quoted 4 lines

3- if the main problem is really that some parts of suspend2 should be
in userspace instead of kernelspace, why aren't you working from the appropriate parts of the suspend2 code to port them to userspace use instead of going to coreutils/libLZF/etc?

code dupplication?

Quoted 3 lines

4- why aren't you actively working at pushing the parts of suspend2
that actually are good and potentially useful to uswsusp in the mainline kernel. Do you really think nothing is worthwhile in there?

Maybe the mentioned problems with bitmaps and the module infrastructure could explain that. Even Nigel said that the problem with evolutionary patches is that suspend2 changes some fundamentals.

Quoted 3 lines

Are you really, really sure you're not rejecting suspend2 in bulk because you didn't write it? Do we need a John W. Linville as suspend maintainer for things to go better?

Are you really threatening Pavel's position as maintainer? how subtle.

Quoted 3 lines

Please tell me what is wrong in my perception of what is going on.

OG, not even a suspend2 user.

andy, a long time swsusp user.

Quoted 2 lines

[2] Otherwise you can start net5 in userspace just because it doesn't absolutely need to be in kernelspace.

it seems like "Van Jacobson's network channels" [0] would move some stuff to userspace. Are you volunteering? (dislaimer: I have just glimpsed at the article).

[0] http://lwn.net/Articles/169961/

#338 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 3 lines · Andreas Happe

through using the userspace helper he is able to use existing maintained libaries, something that isn't possible with kernelspace suspend. This is real code reduction.

The only thing that is said will be used by uswsusp that isn't already in the kernel in lzf. md5 is there twice, crypto is there. lzf it seems belongs in cryptoloop too according to some of the reactions.

Quoted 5 lines
Quoted 2 lines

md5 is already in the kernel (twice). lzf is already in suspend2 (and arguably useful for more things than only suspending),

Why (when LZF would be useful for other stuff) nobody proposed inclusion of it?

You missed all the messages of people who would like it in cryptoloop for compressed filesystems? Part of the problem it seems with Nigel's code is that it is stamped "suspend2", and nobody looks for useful code in there.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

The problem is to merge suspend2 we'd have to clean it up first and actually solve some problems that it works around. That, arguably, would be more work than just implementing some _easy_ stuff in the user space.

Quoted 8 lines
Quoted 1 line

Stuff that is _already_ _done_ and working.

While reading this 'discussion' I get the expression that swsusp isn't working. But this isn't true: it works for me since I can't remember when. The only problems were with some modules (ieee1394 had to be unloaded before suspending) and minor glinches (writing the image sometimes _very_ slow when suspending from a powersave cpufreq governor..).

It hasn't worked for me reliably on any of the dell laptops we have around. Driver problem, irq problem, who knows. Pavel would sure like to have these problems fixed, no doubt about that, but uswsusp has nothing to do with fixing them. The entire point of uswsusp is to have progress bars, compression and encryption. It has _nothing_ to do with the reliability of suspend itself.

Suspend2 already has the progress bars and stuff. Hence the "already done and working".

Quoted 5 lines
Quoted 3 lines

1- will uswsusp solve problems suspend2 doesn't? Real, currently
encountered problems, not philosophical problems about kernel/userspace code positions[2].

swsusp works for me (TM), no problems at all, siree

That does not answer the question. If there are no problems with swsusp, there is no need for either suspend2 or uswsusp.

Quoted 6 lines
Quoted 3 lines

In particular, since according
to Pavel 90+% of the problems are driver issues, why aren't you concentrating on drivers?

so submit driver specific patches through the driver's maintainer? Where does Pavel enter the picture?

Pavel is the swsusp maintainer. Pavel is the one defining the interfaces drivers have to conform to to play ball. Quality and documentation of these interfaces is what makes the difference when you have to use them in the drivers.

At that point, with the last clash with Linus, I don't really know what has to be done with IRQs in particular.

Quoted 6 lines
Quoted 4 lines

3- if the main problem is really that some parts of suspend2 should be
in userspace instead of kernelspace, why aren't you working from the appropriate parts of the suspend2 code to port them to userspace use instead of going to coreutils/libLZF/etc?

code dupplication?

Duplicating what? There are multiple implementations, some in suspend2, some in libraries. The suspend2 ones, as kernel routines, are designed to work in a constrained environment, fs, network and memory-wise. The library ones aren't. Uswsusp needs code that works in a constrained environment. So the technically clueful way is to start from the libraries?

Quoted 7 lines
Quoted 3 lines

4- why aren't you actively working at pushing the parts of suspend2
that actually are good and potentially useful to uswsusp in the mainline kernel. Do you really think nothing is worthwhile in there?

Maybe the mentioned problems with bitmaps and the module infrastructure could explain that. Even Nigel said that the problem with evolutionary patches is that suspend2 changes some fundamentals.

For some people, like you, swsusp works as-is. Good. For some more people, swsusp doesn't work reliably, while suspend2 does. So there are some things in suspend2 that are better than the current implementation. I see zero effort to find out what these things are

Quoted 5 lines
Quoted 3 lines

Are you really, really sure you're not rejecting suspend2 in bulk because you didn't write it? Do we need a John W. Linville as suspend maintainer for things to go better?

Are you really threatening Pavel's position as maintainer? how subtle.

Am I? I have _zero_ authority over who maintains what, you know. I know that, Pavel knows that, Rafael knows that. And I never said Pavel or Rafael were not competent, quite the contrary. I'm just casting some doubt on their current methods. I don't like seeing anymore throwing of the baby with the bathwater going on than strictly necessary.

Quoted 8 lines
Quoted 2 lines

[2] Otherwise you can start net5 in userspace just because it doesn't absolutely need to be in kernelspace.

it seems like "Van Jacobson's network channels" [0] would move some stuff to userspace. Are you volunteering? (dislaimer: I have just glimpsed at the article).

[0] http://lwn.net/Articles/169961/

Obviously not. I think networking belongs to the kernel, and moving things to userspace because it somehow magically makes maintenance easier is complete bullshit. I have criteria to decide what should be in the kernel and what should be in userspace, and networking squarely belongs in kernelspace.

OG.

#339 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 6 lines · Olivier Galibert
Quoted 2 lines · Andreas Happe

Why (when LZF would be useful for other stuff) nobody proposed inclusion of it?

You missed all the messages of people who would like it in cryptoloop for compressed filesystems?

then why isn't it in mainline then?

Quoted 2 lines

Part of the problem it seems with Nigel's code is that it is stamped "suspend2", and nobody looks for useful code in there.

I seem to remember critisims of various aspects of the suspend2 patch (bitmaps etc., and those were not from neither Pavel or Rafael).

Quoted 4 lines

It hasn't worked for me reliably on any of the dell laptops we have around. Driver problem, irq problem, who knows. Pavel would sure like to have these problems fixed, no doubt about that, but uswsusp has nothing to do with fixing them.

And the answer to your bug reports were?

Quoted 3 lines

The entire point of uswsusp is to have progress bars, compression and encryption. It has _nothing_ to do with the reliability of suspend itself.

Well.. progress bars, compression and encryption are the advantages that suspend2 seems to have over swsusp in my current situation. (encryption somewhat dances out of line as this was already supported by swsusp).

Quoted 2 lines

Suspend2 already has the progress bars and stuff. Hence the "already done and working".

I do not really care about that stuff, swsusp works reliable for me. If it crashes for you maybe some bug reports or even debugging would be way more productive than those endless 'swsusp vs suspend2' debates.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

1- will uswsusp solve problems suspend2 doesn't? Real, currently encountered problems, not philosophical problems about kernel/userspace code positions[2].

swsusp works for me (TM), no problems at all, siree

That does not answer the question. If there are no problems with swsusp, there is no need for either suspend2 or uswsusp.

couldn't be stated clearer. Remember that only the users for which swsusp doesn't work will state their problems (or those that want more bling).

Although there seems to be a need for bling and encryption which can perfectly done in userspace (compare that to bootsplash vs. usplash).

Quoted 7 lines
Quoted 2 lines

so submit driver specific patches through the driver's maintainer? Where does Pavel enter the picture?

Pavel is the swsusp maintainer. Pavel is the one defining the interfaces drivers have to conform to to play ball. Quality and documentation of these interfaces is what makes the difference when you have to use them in the drivers.

I thought that those driver changes would mostly be power mgmt changes.. that would the existing infrastructure (i.e. maintained by Patrick Mochel).

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

3- if the main problem is really that some parts of suspend2 should be in userspace instead of kernelspace, why aren't you working from the appropriate parts of the suspend2 code to port them to userspace use instead of going to coreutils/libLZF/etc?

Quoted 8 lines
Quoted 1 line

code dupplication?

Duplicating what? There are multiple implementations, some in suspend2, some in libraries. The suspend2 ones, as kernel routines, are designed to work in a constrained environment, fs, network and memory-wise. The library ones aren't. Uswsusp needs code that works in a constrained environment. So the technically clueful way is to start from the libraries?

libraries will be used by more people -> more testing and bug fixes (for 'free'). The constraints should relate to hard disk/hardware activity? memory usage shouldn't be that much of a problem (and the userspace parts are used for transformations.. and if you can't trust in a working libopenssl.. you're already hosed).

Quoted 4 lines

For some people, like you, swsusp works as-is. Good. For some more people, swsusp doesn't work reliably, while suspend2 does. So there are some things in suspend2 that are better than the current implementation.

I think that 'some people, like you' may be more than you think.

I tried to use suspend2, but setup wasn't that great (i.e. didn't work as well or easy as swsusp) so I dropped it.

Quoted 1 line

I see zero effort to find out what these things are

Than pray do it. I think patches would be welcomed.

Quoted 2 lines

I don't like seeing anymore throwing of the baby with the bathwater going on than strictly necessary.

So you think the maintainer to be competent but you don't believe they got valid technical reasons to deny those patches? Have you seen the module support for suspend thread? or the bitmap thread? Those were not simple problems.

Quoted 5 lines

Obviously not. I think networking belongs to the kernel, and moving things to userspace because it somehow magically makes maintenance easier is complete bullshit. I have criteria to decide what should be in the kernel and what should be in userspace, and networking squarely belongs in kernelspace.

Encryption and compression for non-timecritical tasks: User or kernelspace? The other stuff would be driver fixes (which would be accepted) or infrastructure changes (rafael is at least interested in bdev freezing, other stuff like using bitmaps seem totaly not acceptable (and weren't for rather long.. but nigel didn't seem to mind)).

[BTW: the network stuff was about performance (reduced code complexitivity was just a side effect). Maintenance isn't easier, but the chances that you totally fsck up a system is smaller in userspace than in kernel space).

Andy

#340 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

On Tuesday 21 February 2006 10:52, Andreas Happe wrote:

[...]

Quoted 4 lines

I think that 'some people, like you' may be more than you think.

I tried to use suspend2, but setup wasn't that great (i.e. didn't work as well or easy as swsusp) so I dropped it.

Could you provide more detail? If there's something I can do to make it easier to use, I'm more than willing to consider that.

[...]

Quoted 5 lines

Encryption and compression for non-timecritical tasks: User or kernelspace? The other stuff would be driver fixes (which would be accepted) or infrastructure changes (rafael is at least interested in bdev freezing, other stuff like using bitmaps seem totaly not acceptable (and weren't for rather long.. but nigel didn't seem to mind)).

I'm not sure I get what you're saying I didn't seem to mind.

Your comment about using bitmaps made me do some math to see how much I'm saving by using them instead of Pavel's struct pbes. I don't think they were commented on as 'totally unacceptable', but as I look at them again now, I'm not so sure they're worth the effort. Will look again a little later in the day, particularly at the flow on effects of making such a change - perhaps I've forgotten something else).

(For the record, my thinking went: swsusp uses n (12?) bytes of meta data for every page you save, where as using bitmaps makes that much closer to a constant value (a small variable amount for recording where the image will be stored in extents). 12 bytes per page is 3MB/1GB. If swsusp was to add support for multiple swap partitions or writing to files, those requirements might be closer to 5MB/GB. Bitmaps, in comparison, use ~32K/GB (approx because it depends whether the gigabyte is all in one zone). Proportionally, bitmaps are eating a lot less space out of your gigabyte, but I don't think anyone is going to notice that they have 3 or 4MB more cache per gigabyte with Suspend2 than they have with swsusp).

Regards,

Nigel

#341 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 6 lines · Nigel Cunningham

For the record, my thinking went: swsusp uses n (12?) bytes of meta data for every page you save, where as using bitmaps makes that much closer to a constant value (a small variable amount for recording where the image will be stored in extents). 12 bytes per page is 3MB/1GB. If swsusp was to add support for multiple swap partitions or writing to files, those requirements might be closer to 5MB/GB.

5MB/GB amounts to 0.5% overhead, I don't think you should be concerned here. Much more important IMHO is that IIRC swsusp requires to be able to free 1/2 of the physical memory whuch is hard on low memory boxes.

Signature · 1 line
Dmitry
#342 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 11 lines · Dmitry Torokhov
Quoted 6 lines · Nigel Cunningham

For the record, my thinking went: swsusp uses n (12?) bytes of meta data for every page you save, where as using bitmaps makes that much closer to a constant value (a small variable amount for recording where the image will be stored in extents). 12 bytes per page is 3MB/1GB. If swsusp was to add support for multiple swap partitions or writing to files, those requirements might be closer to 5MB/GB.

5MB/GB amounts to 0.5% overhead, I don't think you should be concerned here. Much more important IMHO is that IIRC swsusp requires to be able to free 1/2 of the physical memory whuch is hard on low memory boxes.

Agreed. I'll look for related issues, and if there are none (or nothing serious), we can have one less difference between the two implementations. I may even be able to share the lowlevel code with Pavel then. That would be a good step forward.

Regards,

Nigel

#343 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 11 lines · Nigel Cunningham

Hi.

Quoted 8 lines · Dmitry Torokhov
Quoted 6 lines · Nigel Cunningham

For the record, my thinking went: swsusp uses n (12?) bytes of meta data for every page you save, where as using bitmaps makes that much closer to a constant value (a small variable amount for recording where the image will be stored in extents). 12 bytes per page is 3MB/1GB. If swsusp was to add support for multiple swap partitions or writing to files, those requirements might be closer to 5MB/GB.

Quoted 8 lines
Quoted 3 lines

5MB/GB amounts to 0.5% overhead, I don't think you should be concerned here. Much more important IMHO is that IIRC swsusp requires to be able to free 1/2 of the physical memory whuch is hard on low memory boxes.

Agreed. I'll look for related issues, and if there are none (or nothing serious), we can have one less difference between the two implementations. I may even be able to share the lowlevel code with Pavel then. That would be a good step forward.

Yep, that would be very nice.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#344 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Dmitry Torokhov
Quoted 11 lines · Dmitry Torokhov
Quoted 6 lines · Nigel Cunningham

For the record, my thinking went: swsusp uses n (12?) bytes of meta data for every page you save, where as using bitmaps makes that much closer to a constant value (a small variable amount for recording where the image will be stored in extents). 12 bytes per page is 3MB/1GB. If swsusp was to add support for multiple swap partitions or writing to files, those requirements might be closer to 5MB/GB.

5MB/GB amounts to 0.5% overhead, I don't think you should be concerned here. Much more important IMHO is that IIRC swsusp requires to be able to free 1/2 of the physical memory whuch is hard on low memory boxes.

I see another point in using bitmaps: we could avoid modifying page flags and use bitmaps to store all of the temporary information. I thought about it for some time and I think it's doable.

Greetings,
Rafael

#345 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi Rafael.

Quoted 9 lines · Rafael J. Wysocki
Quoted 8 lines · Dmitry Torokhov
Quoted 6 lines · Nigel Cunningham

For the record, my thinking went: swsusp uses n (12?) bytes of meta data for every page you save, where as using bitmaps makes that much closer to a constant value (a small variable amount for recording where the image will be stored in extents). 12 bytes per page is 3MB/1GB. If swsusp was to add support for multiple swap partitions or writing to files, those requirements might be closer to 5MB/GB.

Quoted 7 lines
Quoted 3 lines

5MB/GB amounts to 0.5% overhead, I don't think you should be concerned here. Much more important IMHO is that IIRC swsusp requires to be able to free 1/2 of the physical memory whuch is hard on low memory boxes.

I see another point in using bitmaps: we could avoid modifying page flags and use bitmaps to store all of the temporary information. I thought about it for some time and I think it's doable.

It is doable - I'm doing it now, but am thinking about reverting part of the code to use pbes again. If you're going to look at using bitmaps in place of pbes, me changing would be a waste of time. Do you want me to hold off for a while? (I'll happily do that, as I have far more than enough to keep me occupied at the moment anyway).

Regards,

Nigel

#346 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 18 lines · Nigel Cunningham
Quoted 9 lines · Rafael J. Wysocki
Quoted 8 lines · Dmitry Torokhov
Quoted 6 lines · Nigel Cunningham

For the record, my thinking went: swsusp uses n (12?) bytes of meta data for every page you save, where as using bitmaps makes that much closer to a constant value (a small variable amount for recording where the image will be stored in extents). 12 bytes per page is 3MB/1GB. If swsusp was to add support for multiple swap partitions or writing to files, those requirements might be closer to 5MB/GB.

Quoted 7 lines
Quoted 3 lines

5MB/GB amounts to 0.5% overhead, I don't think you should be concerned here. Much more important IMHO is that IIRC swsusp requires to be able to free 1/2 of the physical memory whuch is hard on low memory boxes.

I see another point in using bitmaps: we could avoid modifying page flags and use bitmaps to store all of the temporary information. I thought about it for some time and I think it's doable.

Quoted 5 lines

It is doable - I'm doing it now, but am thinking about reverting part of the code to use pbes again. If you're going to look at using bitmaps in place of pbes, me changing would be a waste of time. Do you want me to hold off for a while? (I'll happily do that, as I have far more than enough to keep me occupied at the moment anyway).

Well, I'd say so. :-)

Frankly, I didn't think of dropping PBEs right now, but in the long run that's worth considering, IMO. The advantage of PBEs is that they are easy to handle in the assembly parts, but apart from this they are a bit wasteful (not very much, though).

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

At this point I'd have to look at your snapshot-related code and see if it's suitable for snapshot.c (in -mm now) somehow. If you could point me to the specific parts of the suspend2 patch where this code is, I'd be grateful.

Greetings,
Rafael

#347 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 21 lines · Rafael J. Wysocki
Quoted 20 lines · Nigel Cunningham
Quoted 18 lines · Rafael J. Wysocki
Quoted 9 lines · Dmitry Torokhov
Quoted 7 lines · Nigel Cunningham

For the record, my thinking went: swsusp uses n (12?) bytes of meta data for every page you save, where as using bitmaps makes that much closer to a constant value (a small variable amount for recording where the image will be stored in extents). 12 bytes per page is 3MB/1GB. If swsusp was to add support for multiple swap partitions or writing to files, those requirements might be closer to 5MB/GB.

Quoted 4 lines

5MB/GB amounts to 0.5% overhead, I don't think you should be concerned here. Much more important IMHO is that IIRC swsusp requires to be able to free 1/2 of the physical memory whuch is hard on low memory boxes.

I see another point in using bitmaps: we could avoid modifying page flags and use bitmaps to store all of the temporary information. I thought about it for some time and I think it's doable.

Quoted 7 lines
Quoted 5 lines

It is doable - I'm doing it now, but am thinking about reverting part of the code to use pbes again. If you're going to look at using bitmaps in place of pbes, me changing would be a waste of time. Do you want me to hold off for a while? (I'll happily do that, as I have far more than enough to keep me occupied at the moment anyway).

Well, I'd say so. :-)

Ok.

Quoted 4 lines

Frankly, I didn't think of dropping PBEs right now, but in the long run that's worth considering, IMO. The advantage of PBEs is that they are easy to handle in the assembly parts, but apart from this they are a bit wasteful (not very much, though).

Fully agree. That's why I've sought to keep the copying in c - it makes it simpler to read and maintain (although at the expense of a little bit of ugliness with that if in the stack page allocation or (old way) working hard to make the C not use stack).

Quoted 5 lines

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

If you use the 'dynamically allocated pageflags' code (sure, pick a better name if you want), these changes will be pretty trivial - you can #define macros that could make the transition just a matter of switching PageNosave (eg) to PageSomethingElse. (Ditto for setting and clearing flags).

Quoted 4 lines

At this point I'd have to look at your snapshot-related code and see if it's suitable for snapshot.c (in -mm now) somehow. If you could point me to the specific parts of the suspend2 patch where this code is, I'd be grateful.

Sure. The bulk is in kernel/power/atomic_copy.c. Arch specific routines are include/asm-<arch>/suspend2.h.

Regards,

Nigel

Quoted 2 lines

Greetings,
Rafael

#348 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 32 lines · Nigel Cunningham
Quoted 21 lines · Rafael J. Wysocki
Quoted 20 lines · Nigel Cunningham
Quoted 18 lines · Rafael J. Wysocki
Quoted 9 lines · Dmitry Torokhov
Quoted 7 lines · Nigel Cunningham

For the record, my thinking went: swsusp uses n (12?) bytes of meta data for every page you save, where as using bitmaps makes that much closer to a constant value (a small variable amount for recording where the image will be stored in extents). 12 bytes per page is 3MB/1GB. If swsusp was to add support for multiple swap partitions or writing to files, those requirements might be closer to 5MB/GB.

Quoted 4 lines

5MB/GB amounts to 0.5% overhead, I don't think you should be concerned here. Much more important IMHO is that IIRC swsusp requires to be able to free 1/2 of the physical memory whuch is hard on low memory boxes.

I see another point in using bitmaps: we could avoid modifying page flags and use bitmaps to store all of the temporary information. I thought about it for some time and I think it's doable.

Quoted 7 lines
Quoted 5 lines

It is doable - I'm doing it now, but am thinking about reverting part of the code to use pbes again. If you're going to look at using bitmaps in place of pbes, me changing would be a waste of time. Do you want me to hold off for a while? (I'll happily do that, as I have far more than enough to keep me occupied at the moment anyway).

Well, I'd say so. :-)

Ok.

Quoted 8 lines
Quoted 4 lines

Frankly, I didn't think of dropping PBEs right now, but in the long run that's worth considering, IMO. The advantage of PBEs is that they are easy to handle in the assembly parts, but apart from this they are a bit wasteful (not very much, though).

Fully agree. That's why I've sought to keep the copying in c - it makes it simpler to read and maintain (although at the expense of a little bit of ugliness with that if in the stack page allocation

Well, that's a bit too much ugliness for me, sorry.

Quoted 1 line

or (old way) working hard to make the C not use stack).

I'd rather not get rid of the assembly parts. Instead, I'd modify them to handle bitmaps. I'm not going to drop them.

Quoted 10 lines
Quoted 5 lines

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

If you use the 'dynamically allocated pageflags' code (sure, pick a better name if you want), these changes will be pretty trivial - you can #define macros that could make the transition just a matter of switching PageNosave (eg) to PageSomethingElse. (Ditto for setting and clearing flags).

I think it could be done without that code and I'd prefer to do so. In fact, we only need to remember:
(a) saveable pages
(b) pages used to store the data from (a)
(c) pages allocated by us that we should release eventually (generally that may be a broader set than just (b)).
That's 3 bitmaps total and no need for using any more sophisticated stuff, if I remember everything correctly.

Quoted 7 lines
Quoted 4 lines

At this point I'd have to look at your snapshot-related code and see if it's suitable for snapshot.c (in -mm now) somehow. If you could point me to the specific parts of the suspend2 patch where this code is, I'd be grateful.

Sure. The bulk is in kernel/power/atomic_copy.c. Arch specific routines are include/asm-<arch>/suspend2.h.

OK, thanks.

Rafael

#349 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 9 lines · Rafael J. Wysocki
Quoted 8 lines
Quoted 4 lines

Frankly, I didn't think of dropping PBEs right now, but in the long run that's worth considering, IMO. The advantage of PBEs is that they are easy to handle in the assembly parts, but apart from this they are a bit wasteful (not very much, though).

Fully agree. That's why I've sought to keep the copying in c - it makes it simpler to read and maintain (although at the expense of a little bit of ugliness with that if in the stack page allocation

Quoted 6 lines

Well, that's a bit too much ugliness for me, sorry.

Quoted 1 line

or (old way) working hard to make the C not use stack).

I'd rather not get rid of the assembly parts. Instead, I'd modify them to handle bitmaps. I'm not going to drop them.

Well, if you do this, and I can, I will start using the code too. I don't know x86/x86_64/ppc/... assembly enough that I could help, but I would be willing to drop the current code if yours was usable. Come to that, (as I already said), I'm willing to work on switching to pbes prior to that and seeing if we can share that code earlier, if you want me to and I can find the time.

Quoted 13 lines
Quoted 7 lines
Quoted 6 lines

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

Quoted 5 lines

If you use the 'dynamically allocated pageflags' code (sure, pick a better name if you want), these changes will be pretty trivial - you can #define macros that could make the transition just a matter of switching PageNosave (eg) to PageSomethingElse. (Ditto for setting and clearing flags).

Quoted 8 lines

I think it could be done without that code and I'd prefer to do so. In fact, we only need to remember:
(a) saveable pages
(b) pages used to store the data from (a)
(c) pages allocated by us that we should release eventually (generally that may be a broader set than just (b)).
That's 3 bitmaps total and no need for using any more sophisticated stuff, if I remember everything correctly.

Maybe I have tunnel vision, but I'd be surprised if you didn't end up with something similar - I've tried to make it as simple as possible, and am basically doing the same thing (even if I'm using different terms for some of the concepts). I'd certainly be willing to interact on "Why did you do it this way?" questions and make changes if a better way is shown to me.

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

At this point I'd have to look at your snapshot-related code and see if it's suitable for snapshot.c (in -mm now) somehow. If you could point me to the specific parts of the suspend2 patch where this code is, I'd be grateful.

Sure. The bulk is in kernel/power/atomic_copy.c. Arch specific routines are include/asm-<arch>/suspend2.h.

OK, thanks.

Thank you! I much prefer this kind of interaction. It's far more constructive.

Nigel

#350 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 14 lines · Nigel Cunningham
Quoted 13 lines · Rafael J. Wysocki
Quoted 8 lines
Quoted 4 lines

Frankly, I didn't think of dropping PBEs right now, but in the long run that's worth considering, IMO. The advantage of PBEs is that they are easy to handle in the assembly parts, but apart from this they are a bit wasteful (not very much, though).

Fully agree. That's why I've sought to keep the copying in c - it makes it simpler to read and maintain (although at the expense of a little bit of ugliness with that if in the stack page allocation

Well, that's a bit too much ugliness for me, sorry.

Quoted 1 line

or (old way) working hard to make the C not use stack).

Quoted 8 lines
Quoted 2 lines

I'd rather not get rid of the assembly parts. Instead, I'd modify them to handle bitmaps. I'm not going to drop them.

Well, if you do this, and I can, I will start using the code too. I don't know x86/x86_64/ppc/... assembly enough that I could help, but I would be willing to drop the current code if yours was usable. Come to that, (as I already said), I'm willing to work on switching to pbes prior to that and seeing if we can share that code earlier, if you want me to and I can find the time.

Yes, it would be nice if we could share some code earlier. However I think the freezer is a better target short-term. If you could have a look at the -mm freezer and tell us what you'd like to add to that, we'd probably be able to get closer in that area.

Quoted 22 lines
Quoted 13 lines
Quoted 7 lines
Quoted 6 lines

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

Quoted 5 lines

If you use the 'dynamically allocated pageflags' code (sure, pick a better name if you want), these changes will be pretty trivial - you can #define macros that could make the transition just a matter of switching PageNosave (eg) to PageSomethingElse. (Ditto for setting and clearing flags).

Quoted 8 lines

I think it could be done without that code and I'd prefer to do so. In fact, we only need to remember:
(a) saveable pages
(b) pages used to store the data from (a)
(c) pages allocated by us that we should release eventually (generally that may be a broader set than just (b)).
That's 3 bitmaps total and no need for using any more sophisticated stuff, if I remember everything correctly.

Quoted 5 lines

Maybe I have tunnel vision, but I'd be surprised if you didn't end up with something similar - I've tried to make it as simple as possible, and am basically doing the same thing (even if I'm using different terms for some of the concepts). I'd certainly be willing to interact on "Why did you do it this way?" questions and make changes if a better way is shown to me.

OK

Greetings,
Rafael

#351 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Rafael J. Wysocki

Hi!

Quoted 6 lines
Quoted 5 lines

It is doable - I'm doing it now, but am thinking about reverting part of the code to use pbes again. If you're going to look at using bitmaps in place of pbes, me changing would be a waste of time. Do you want me to hold off for a while? (I'll happily do that, as I have far more than enough to keep me occupied at the moment anyway).

Quoted 6 lines

Well, I'd say so. :-)

Frankly, I didn't think of dropping PBEs right now, but in the long run that's worth considering, IMO. The advantage of PBEs is that they are easy to handle in the assembly parts, but apart from this they are a bit wasteful (not very much, though).

Of course it will depend on what patch looks like, but changing assembly parts is hard -- you have to change all the architectures, and better not make any mistake.

Quoted 6 lines

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

Well, we "only" use 2 bits... :-).
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#352 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 8 lines · Pavel Machek
Quoted 8 lines
Quoted 5 lines

It is doable - I'm doing it now, but am thinking about reverting part of the code to use pbes again. If you're going to look at using bitmaps in place of pbes, me changing would be a waste of time. Do you want me to hold off for a while? (I'll happily do that, as I have far more than enough to keep me occupied at the moment anyway).

Well, I'd say so. :-)

Quoted 8 lines
Quoted 4 lines

Frankly, I didn't think of dropping PBEs right now, but in the long run that's worth considering, IMO. The advantage of PBEs is that they are easy to handle in the assembly parts, but apart from this they are a bit wasteful (not very much, though).

Of course it will depend on what patch looks like, but changing assembly parts is hard -- you have to change all the architectures, and better not make any mistake.

Yes, that would be a lot of work, so it's rather a long term "vision". I think we should try to get the pagecache stuff right first anyway.

Quoted 8 lines
Quoted 6 lines

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

Well, we "only" use 2 bits... :-).

In my view the problem is this adds constraints that other people have to take into account. Not a good thing if avoidable IMHO.

Greetings,
Rafael

#353 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi!

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 5 lines

It is doable - I'm doing it now, but am thinking about reverting part of the code to use pbes again. If you're going to look at using bitmaps in place of pbes, me changing would be a waste of time. Do you want me to hold off for a while? (I'll happily do that, as I have far more than enough to keep me occupied at the moment anyway).

Well, I'd say so. :-)

Frankly, I didn't think of dropping PBEs right now, but in the long run that's worth considering, IMO. The advantage of PBEs is that they are easy to handle in the assembly parts, but apart from this they are a bit wasteful (not very much, though).

Quoted 6 lines
Quoted 3 lines

Of course it will depend on what patch looks like, but changing assembly parts is hard -- you have to change all the architectures, and better not make any mistake.

Yes, that would be a lot of work, so it's rather a long term "vision".

Ok, I have no problems with visions.

Quoted 1 line

I think we should try to get the pagecache stuff right first anyway.

Are you sure it is worth doing? I mean... it only helps on small machines, no?

OTOH having it for benchmarks will be nice, and perhaps we could use that kind it to speed up boot and similar things...

Quoted 11 lines
Quoted 8 lines
Quoted 6 lines

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

Well, we "only" use 2 bits... :-).

In my view the problem is this adds constraints that other people have to take into account. Not a good thing if avoidable IMHO.

Well, I hope that swsusp development will move to userland in future :-).
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#354 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 7 lines · Pavel Machek
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Well, we "only" use 2 bits... :-).

In my view the problem is this adds constraints that other people have to take into account. Not a good thing if avoidable IMHO.

Well, I hope that swsusp development will move to userland in future

:-).

I don't get your point. I mean, we're talking about flags that record what pages are going to be in the image, be atomically copied and so on. Are you planning on trying to export the free page information and the like to userspace too, along with atomic copy code?

Regards,

Nigel

#355 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi!

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

Well, we "only" use 2 bits... :-).

In my view the problem is this adds constraints that other people have to take into account. Not a good thing if avoidable IMHO.

Quoted 8 lines
Quoted 3 lines

Well, I hope that swsusp development will move to userland in future

:-).

I don't get your point. I mean, we're talking about flags that record what pages are going to be in the image, be atomically copied and so on. Are you planning on trying to export the free page information and the like to userspace too, along with atomic copy code?

No, certainly not.

Rafael said something like "being limited is bad, because it makes it hard to change in-kernel snapshoting code". My reply was something like "I hope people will stop changing in-kernel swsusp code, and hack userland instead".

Atomic copy code has to stay with kernel: it needs disabled interrupts, access to all the RAM, etc. It screams "kernel code".

Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#356 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 26 lines · Pavel Machek

Hi!

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
Quoted 7 lines

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

Well, we "only" use 2 bits... :-).

In my view the problem is this adds constraints that other people have to take into account. Not a good thing if avoidable IMHO.

Quoted 8 lines
Quoted 3 lines

Well, I hope that swsusp development will move to userland in future

:-).

I don't get your point. I mean, we're talking about flags that record what pages are going to be in the image, be atomically copied and so on. Are you planning on trying to export the free page information and the like to userspace too, along with atomic copy code?

No, certainly not.

Quoted 7 lines

Rafael said something like "being limited is bad, because it makes it hard to change in-kernel snapshoting code". My reply was something like "I hope people will stop changing in-kernel swsusp code, and hack userland instead".

Atomic copy code has to stay with kernel: it needs disabled interrupts, access to all the RAM, etc. It screams "kernel code".

Good to know. I was afraid you were losing the plot for a minute there :)

Nigel

#357 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek

Hi,

Quoted 21 lines · Pavel Machek
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines

The fact that we use page flags to store some suspend/resume-related information is a big disadvantage in my view, and I'd like to get rid of that in the future. In principle we could use a bitmap, or rather two of them, to store the same information independently of the page flags, and if we use bitmaps for this purpose, we can use them also instead of PBEs.

Well, we "only" use 2 bits... :-).

In my view the problem is this adds constraints that other people have to take into account. Not a good thing if avoidable IMHO.

Quoted 8 lines
Quoted 3 lines

Well, I hope that swsusp development will move to userland in future

:-).

I don't get your point. I mean, we're talking about flags that record what pages are going to be in the image, be atomically copied and so on. Are you planning on trying to export the free page information and the like to userspace too, along with atomic copy code?

Quoted 6 lines

No, certainly not.

Rafael said something like "being limited is bad, because it makes it hard to change in-kernel snapshoting code". My reply was something like "I hope people will stop changing in-kernel swsusp code, and hack userland instead".

Actually I meant all of the other users of page flags. If we didn't use page flags, they would be less constrained in what they're doing.

Greetings,
Rafael

#358 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek

Hi,

Quoted 22 lines · Pavel Machek
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 5 lines

It is doable - I'm doing it now, but am thinking about reverting part of the code to use pbes again. If you're going to look at using bitmaps in place of pbes, me changing would be a waste of time. Do you want me to hold off for a while? (I'll happily do that, as I have far more than enough to keep me occupied at the moment anyway).

Well, I'd say so. :-)

Frankly, I didn't think of dropping PBEs right now, but in the long run that's worth considering, IMO. The advantage of PBEs is that they are easy to handle in the assembly parts, but apart from this they are a bit wasteful (not very much, though).

Quoted 6 lines
Quoted 3 lines

Of course it will depend on what patch looks like, but changing assembly parts is hard -- you have to change all the architectures, and better not make any mistake.

Yes, that would be a lot of work, so it's rather a long term "vision".

Ok, I have no problems with visions.

Quoted 7 lines
Quoted 1 line

I think we should try to get the pagecache stuff right first anyway.

Are you sure it is worth doing? I mean... it only helps on small machines, no?

OTOH having it for benchmarks will be nice, and perhaps we could use that kind it to speed up boot and similar things...

Currently some people can't suspend with the mainline code because it cannot free as much memory as needed on their boxes. I think we should care for them too.

Besides, if they could suspend, we'd have more users and more testing coverage for device drivers, especially for devices that are no longer installed in newer boxes. ;-)

Greetings,
Rafael

#359 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi!

Quoted 7 lines
Quoted 7 lines

Ok, I have no problems with visions.

Quoted 1 line

I think we should try to get the pagecache stuff right first anyway.

Are you sure it is worth doing? I mean... it only helps on small machines, no?

Quoted 6 lines
Quoted 2 lines

OTOH having it for benchmarks will be nice, and perhaps we could use that kind it to speed up boot and similar things...

Currently some people can't suspend with the mainline code because it cannot free as much memory as needed on their boxes. I think we should care for them too.

But saving pagecache will not help them *at all*!

[Because pagecache is freeable, anyway, so it will be freed. Now... I have seen some problems where free_some_memory did not free enough, and schedule()/retry helped a bit... that probably should be fixed.]

Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#360 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 14 lines · Pavel Machek
Quoted 7 lines
Quoted 7 lines

Ok, I have no problems with visions.

Quoted 1 line

I think we should try to get the pagecache stuff right first anyway.

Are you sure it is worth doing? I mean... it only helps on small machines, no?

Quoted 6 lines
Quoted 2 lines

OTOH having it for benchmarks will be nice, and perhaps we could use that kind it to speed up boot and similar things...

Currently some people can't suspend with the mainline code because it cannot free as much memory as needed on their boxes. I think we should care for them too.

Quoted 5 lines

But saving pagecache will not help them *at all*!

[Because pagecache is freeable, anyway, so it will be freed. Now... I have seen some problems where free_some_memory did not free enough, and schedule()/retry helped a bit... that probably should be fixed.]

It seems I need to understand correctly what the difference between what we do and what Nigel does is. I thought the Nigel's approach was to save some cache pages to disk first and use the memory occupied by them to store the image data. If so, is the page cache involved in that or something else?

Rafael

#361 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 23 lines · Rafael J. Wysocki

Hi,

Quoted 14 lines · Pavel Machek
Quoted 7 lines
Quoted 7 lines

Ok, I have no problems with visions.

Quoted 1 line

I think we should try to get the pagecache stuff right first anyway.

Are you sure it is worth doing? I mean... it only helps on small machines, no?

Quoted 6 lines
Quoted 2 lines

OTOH having it for benchmarks will be nice, and perhaps we could use that kind it to speed up boot and similar things...

Currently some people can't suspend with the mainline code because it cannot free as much memory as needed on their boxes. I think we should care for them too.

Quoted 5 lines

But saving pagecache will not help them *at all*!

[Because pagecache is freeable, anyway, so it will be freed. Now... I have seen some problems where free_some_memory did not free enough, and schedule()/retry helped a bit... that probably should be fixed.]

Quoted 5 lines

It seems I need to understand correctly what the difference between what we do and what Nigel does is. I thought the Nigel's approach was to save some cache pages to disk first and use the memory occupied by them to store the image data. If so, is the page cache involved in that or something else?

I believe Nigel only saves pages that could have been freed anyway during phase1. Nigel, correct me here... suspend2 should work on same class of machines swsusp can, but will be able to save caches on machines where swsusp can not save any.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#362 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 10 lines · Pavel Machek
Quoted 9 lines
Quoted 3 lines

[Because pagecache is freeable, anyway, so it will be freed. Now... I have seen some problems where free_some_memory did not free enough, and schedule()/retry helped a bit... that probably should be fixed.]

It seems I need to understand correctly what the difference between what we do and what Nigel does is. I thought the Nigel's approach was to save some cache pages to disk first and use the memory occupied by them to store the image data. If so, is the page cache involved in that or something else?

Quoted 4 lines

I believe Nigel only saves pages that could have been freed anyway during phase1. Nigel, correct me here... suspend2 should work on same class of machines swsusp can, but will be able to save caches on machines where swsusp can not save any.

I'm not used to thinking in these terms :). It would be normally be right, except that there will be some LRU pages that will never be freed. These would allow suspend2 to work in some (not many) cases where swsusp can't. It's been ages since I did the intensive testing on the image preparation code, but I think that if we free as much memory as we can, we will always still have at least a few hundred LRU pages left. That's not much, but on machines with less ram, it might make the difference in a greater percentage of cases (compared to machines with more ram)?

If there were other pages that could be safely included in this set, we could perhaps make more cases where suspend2 could work but swsusp couldn't. LRU was low hanging fruit, and I didn't bother looking beyond it.

Nigel

#363 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi!

Quoted 15 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

[Because pagecache is freeable, anyway, so it will be freed. Now... I have seen some problems where free_some_memory did not free enough, and schedule()/retry helped a bit... that probably should be fixed.]

It seems I need to understand correctly what the difference between what we do and what Nigel does is. I thought the Nigel's approach was to save some cache pages to disk first and use the memory occupied by them to store the image data. If so, is the page cache involved in that or something else?

Quoted 4 lines

I believe Nigel only saves pages that could have been freed anyway during phase1. Nigel, correct me here... suspend2 should work on same class of machines swsusp can, but will be able to save caches on machines where swsusp can not save any.

Quoted 8 lines

I'm not used to thinking in these terms :). It would be normally be right, except that there will be some LRU pages that will never be freed. These would allow suspend2 to work in some (not many) cases where swsusp can't. It's been ages since I did the intensive testing on the image preparation code, but I think that if we free as much memory as we can, we will always still have at least a few hundred LRU pages left. That's not much, but on machines with less ram, it might make the difference in a greater percentage of cases (compared to machines with more ram)?

Well, pages in LRU should be user pages, and therefore freeable, AFAICT. It is possible that there's something wrong with freeing in swsusp1...
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#364 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 24 lines · Pavel Machek
Quoted 15 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

[Because pagecache is freeable, anyway, so it will be freed. Now... I have seen some problems where free_some_memory did not free enough, and schedule()/retry helped a bit... that probably should be fixed.]

It seems I need to understand correctly what the difference between what we do and what Nigel does is. I thought the Nigel's approach was to save some cache pages to disk first and use the memory occupied by them to store the image data. If so, is the page cache involved in that or something else?

Quoted 4 lines

I believe Nigel only saves pages that could have been freed anyway during phase1. Nigel, correct me here... suspend2 should work on same class of machines swsusp can, but will be able to save caches on machines where swsusp can not save any.

Quoted 8 lines

I'm not used to thinking in these terms :). It would be normally be right, except that there will be some LRU pages that will never be freed. These would allow suspend2 to work in some (not many) cases where swsusp can't. It's been ages since I did the intensive testing on the image preparation code, but I think that if we free as much memory as we can, we will always still have at least a few hundred LRU pages left. That's not much, but on machines with less ram, it might make the difference in a greater percentage of cases (compared to machines with more ram)?

Quoted 3 lines

Well, pages in LRU should be user pages, and therefore freeable, AFAICT. It is possible that there's something wrong with freeing in swsusp1...

Well, if all of the pages that Nigel saves before snapshot are freeable in theory, there evidently is something wrong with freeing in swsusp, as we have a testcase in which the user was unable to suspend with swsusp due to the lack of memory and could suspend with suspend2.

However, the only thing in swsusp_shrink_memory() that may be wrong is we return -ENOMEM as soon as shrink_all_memory() returns 0. Namely, if shrink_all_memory() can return 0 prematurely (ie. "there still are some freeable pages, but they could not be freed in _this_ call"), we should continue until it returns 0 twice in a row (or something like that). If this doesn't help, we'll have to fix shrink_all_memory() I'm afraid.

Greetings,
Rafael

#365 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 36 lines · Rafael J. Wysocki

Hi,

Quoted 24 lines · Pavel Machek
Quoted 15 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

[Because pagecache is freeable, anyway, so it will be freed. Now... I have seen some problems where free_some_memory did not free enough, and schedule()/retry helped a bit... that probably should be fixed.]

It seems I need to understand correctly what the difference between what we do and what Nigel does is. I thought the Nigel's approach was to save some cache pages to disk first and use the memory occupied by them to store the image data. If so, is the page cache involved in that or something else?

Quoted 4 lines

I believe Nigel only saves pages that could have been freed anyway during phase1. Nigel, correct me here... suspend2 should work on same class of machines swsusp can, but will be able to save caches on machines where swsusp can not save any.

Quoted 8 lines

I'm not used to thinking in these terms :). It would be normally be right, except that there will be some LRU pages that will never be freed. These would allow suspend2 to work in some (not many) cases where swsusp can't. It's been ages since I did the intensive testing on the image preparation code, but I think that if we free as much memory as we can, we will always still have at least a few hundred LRU pages left. That's not much, but on machines with less ram, it might make the difference in a greater percentage of cases (compared to machines with more ram)?

Quoted 3 lines

Well, pages in LRU should be user pages, and therefore freeable, AFAICT. It is possible that there's something wrong with freeing in swsusp1...

Well, if all of the pages that Nigel saves before snapshot are freeable in theory, there evidently is something wrong with freeing in swsusp, as we have a testcase in which the user was unable to suspend with swsusp due to the lack of memory and could suspend with suspend2.

Quoted 6 lines

However, the only thing in swsusp_shrink_memory() that may be wrong is we return -ENOMEM as soon as shrink_all_memory() returns 0. Namely, if shrink_all_memory() can return 0 prematurely (ie. "there still are some freeable pages, but they could not be freed in _this_ call"), we should continue until it returns 0 twice in a row (or something like that). If this doesn't help, we'll have to fix shrink_all_memory() I'm afraid.

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries. Sometimes it even freed 0 pages at the first try.

I did not push the patch because

1) it was way too ugly

2) shrink_all_memory() should be fixed. It should not really return if there are more pages freeable.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#366 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 42 lines · Pavel Machek
Quoted 34 lines · Rafael J. Wysocki
Quoted 24 lines · Pavel Machek
Quoted 15 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

[Because pagecache is freeable, anyway, so it will be freed. Now... I have seen some problems where free_some_memory did not free enough, and schedule()/retry helped a bit... that probably should be fixed.]

It seems I need to understand correctly what the difference between what we do and what Nigel does is. I thought the Nigel's approach was to save some cache pages to disk first and use the memory occupied by them to store the image data. If so, is the page cache involved in that or something else?

Quoted 4 lines

I believe Nigel only saves pages that could have been freed anyway during phase1. Nigel, correct me here... suspend2 should work on same class of machines swsusp can, but will be able to save caches on machines where swsusp can not save any.

Quoted 8 lines

I'm not used to thinking in these terms :). It would be normally be right, except that there will be some LRU pages that will never be freed. These would allow suspend2 to work in some (not many) cases where swsusp can't. It's been ages since I did the intensive testing on the image preparation code, but I think that if we free as much memory as we can, we will always still have at least a few hundred LRU pages left. That's not much, but on machines with less ram, it might make the difference in a greater percentage of cases (compared to machines with more ram)?

Quoted 3 lines

Well, pages in LRU should be user pages, and therefore freeable, AFAICT. It is possible that there's something wrong with freeing in swsusp1...

Well, if all of the pages that Nigel saves before snapshot are freeable in theory, there evidently is something wrong with freeing in swsusp, as we have a testcase in which the user was unable to suspend with swsusp due to the lack of memory and could suspend with suspend2.

Quoted 6 lines

However, the only thing in swsusp_shrink_memory() that may be wrong is we return -ENOMEM as soon as shrink_all_memory() returns 0. Namely, if shrink_all_memory() can return 0 prematurely (ie. "there still are some freeable pages, but they could not be freed in _this_ call"), we should continue until it returns 0 twice in a row (or something like that). If this doesn't help, we'll have to fix shrink_all_memory() I'm afraid.

Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

Quoted 5 lines

Sometimes it even freed 0 pages at the first try.

I did not push the patch because

1) it was way too ugly

I think I can do something like that in swsusp_shrink_memory() and it won't be very ugly.

Quoted 2 lines

2) shrink_all_memory() should be fixed. It should not really return if there are more pages freeable.

Well, that would be a long-run solution. However, until it's fixed we can use a workaround IMHO. ;-)

Greetings,
Rafael

#367 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 58 lines · Rafael J. Wysocki
Quoted 45 lines · Pavel Machek
Quoted 36 lines · Rafael J. Wysocki
Quoted 26 lines · Pavel Machek
Quoted 16 lines
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

[Because pagecache is freeable, anyway, so it will be freed. Now... I have seen some problems where free_some_memory did not free enough, and schedule()/retry helped a bit... that probably should be fixed.]

It seems I need to understand correctly what the difference between what we do and what Nigel does is. I thought the Nigel's approach was to save some cache pages to disk first and use the memory occupied by them to store the image data. If so, is the page cache involved in that or something else?

Quoted 4 lines

I believe Nigel only saves pages that could have been freed anyway during phase1. Nigel, correct me here... suspend2 should work on same class of machines swsusp can, but will be able to save caches on machines where swsusp can not save any.

Quoted 9 lines

I'm not used to thinking in these terms :). It would be normally be right, except that there will be some LRU pages that will never be freed. These would allow suspend2 to work in some (not many) cases where swsusp can't. It's been ages since I did the intensive testing on the image preparation code, but I think that if we free as much memory as we can, we will always still have at least a few hundred LRU pages left. That's not much, but on machines with less ram, it might make the difference in a greater percentage of cases (compared to machines with more ram)?

Quoted 3 lines

Well, pages in LRU should be user pages, and therefore freeable, AFAICT. It is possible that there's something wrong with freeing in swsusp1...

Well, if all of the pages that Nigel saves before snapshot are freeable in theory, there evidently is something wrong with freeing in swsusp, as we have a testcase in which the user was unable to suspend with swsusp due to the lack of memory and could suspend with suspend2.

Quoted 7 lines

However, the only thing in swsusp_shrink_memory() that may be wrong is we return -ENOMEM as soon as shrink_all_memory() returns 0. Namely, if shrink_all_memory() can return 0 prematurely (ie. "there still are some freeable pages, but they could not be freed in _this_ call"), we should continue until it returns 0 twice in a row (or something like that). If this doesn't help, we'll have to fix shrink_all_memory() I'm afraid.

Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

Quoted 5 lines

Sometimes it even freed 0 pages at the first try.

I did not push the patch because

1) it was way too ugly

Quoted 8 lines

I think I can do something like that in swsusp_shrink_memory() and it won't be very ugly.

Quoted 2 lines

2) shrink_all_memory() should be fixed. It should not really return if there are more pages freeable.

Well, that would be a long-run solution. However, until it's fixed we can use a workaround IMHO. ;-)

Isn't trying to free as much memory as you can the wrong solution anyway? I mean, that only means that the poor system has more pages to fault back in at resume time, before the user can even begin to think about doing anything useful. You might be able to say "Every machine that suspend2 works on, swsusp works on", but the later will be a pretty sad definition of works!

Regards,

Nigel

#368 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi!

Quoted 11 lines
Quoted 5 lines
Quoted 2 lines

2) shrink_all_memory() should be fixed. It should not really return if there are more pages freeable.

Well, that would be a long-run solution. However, until it's fixed we can use a workaround IMHO. ;-)

Isn't trying to free as much memory as you can the wrong solution anyway? I mean, that only means that the poor system has more pages to fault back in at resume time, before the user can even begin to think about doing anything useful. You might be able to say "Every machine that suspend2 works on, swsusp works on", but the later will be a pretty sad definition of works!

We are trying to catch a bug here. suspend2 or not, it is a bug and it should be fixed (or at least understood).

[Also please try to tone down your messages. Your suspend2 may be more user-friendly, you do not want to start that flamewar again, do you? Saying "don't bother fixing that" is not nice thing to do.]
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#369 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 14 lines · Pavel Machek

Hi!

Quoted 11 lines
Quoted 5 lines
Quoted 2 lines

2) shrink_all_memory() should be fixed. It should not really return if there are more pages freeable.

Well, that would be a long-run solution. However, until it's fixed we can use a workaround IMHO. ;-)

Isn't trying to free as much memory as you can the wrong solution anyway? I mean, that only means that the poor system has more pages to fault back in at resume time, before the user can even begin to think about doing anything useful. You might be able to say "Every machine that suspend2 works on, swsusp works on", but the later will be a pretty sad definition of works!

Quoted 6 lines

We are trying to catch a bug here. suspend2 or not, it is a bug and it should be fixed (or at least understood).

[Also please try to tone down your messages. Your suspend2 may be more user-friendly, you do not want to start that flamewar again, do you? Saying "don't bother fixing that" is not nice thing to do.]

Heh, I guess I should apologize for being offtopic on suspend2 mailing list... this was not about suspend2 any more..

I guess we should drop suspend2 and this huge cc list from future discussion. (And fix subject.)

Anyway, Rafael, do you think you could commit your encryption patches? Ready or not, bugs can be fixed later :-). [I'd like to do some work based on them; I think I figured out easy way to setup suspend so that password is needed only during resume...]
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#370 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 23 lines · Pavel Machek
Quoted 12 lines · Pavel Machek
Quoted 11 lines
Quoted 5 lines
Quoted 2 lines

2) shrink_all_memory() should be fixed. It should not really return if there are more pages freeable.

Well, that would be a long-run solution. However, until it's fixed we can use a workaround IMHO. ;-)

Isn't trying to free as much memory as you can the wrong solution anyway? I mean, that only means that the poor system has more pages to fault back in at resume time, before the user can even begin to think about doing anything useful. You might be able to say "Every machine that suspend2 works on, swsusp works on", but the later will be a pretty sad definition of works!

Quoted 6 lines

We are trying to catch a bug here. suspend2 or not, it is a bug and it should be fixed (or at least understood).

[Also please try to tone down your messages. Your suspend2 may be more user-friendly, you do not want to start that flamewar again, do you? Saying "don't bother fixing that" is not nice thing to do.]

Heh, I guess I should apologize for being offtopic on suspend2 mailing list... this was not about suspend2 any more..

Quoted 7 lines

I guess we should drop suspend2 and this huge cc list from future discussion. (And fix subject.)

Anyway, Rafael, do you think you could commit your encryption patches? Ready or not, bugs can be fixed later :-). [I'd like to do some work based on them; I think I figured out easy way to setup suspend so that password is needed only during resume...]

Done. I've also committed the patch to arrange the error messages in suspend in a better way.

Greetings,
Rafael

#371 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek

Hi.

Quoted 15 lines · Pavel Machek

Hi!

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

2) shrink_all_memory() should be fixed. It should not really return if there are more pages freeable.

Well, that would be a long-run solution. However, until it's fixed we can use a workaround IMHO. ;-)

Quoted 6 lines

Isn't trying to free as much memory as you can the wrong solution anyway? I mean, that only means that the poor system has more pages to fault back in at resume time, before the user can even begin to think about doing anything useful. You might be able to say "Every machine that suspend2 works on, swsusp works on", but the later will be a pretty sad definition of works!

Quoted 6 lines

We are trying to catch a bug here. suspend2 or not, it is a bug and it should be fixed (or at least understood).

[Also please try to tone down your messages. Your suspend2 may be more user-friendly, you do not want to start that flamewar again, do you? Saying "don't bother fixing that" is not nice thing to do.]

What's the bug?

Regards,

Nigel

#372 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi!

Quoted 8 lines
Quoted 6 lines

We are trying to catch a bug here. suspend2 or not, it is a bug and it should be fixed (or at least understood).

[Also please try to tone down your messages. Your suspend2 may be more user-friendly, you do not want to start that flamewar again, do you? Saying "don't bother fixing that" is not nice thing to do.]

What's the bug?

shrink_all_memory() returns zero, even throught there are still pages freeable.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#373 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Nigel Cunningham

Hi,

Quoted 3 lines · Nigel Cunningham
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Pavel Machek

On Pá 24-02-06 11:58:07, Rafael J. Wysocki wrote:

}-- snip --{

Quoted 28 lines
Quoted 28 lines
Quoted 13 lines
Quoted 5 lines

Well, if all of the pages that Nigel saves before snapshot are freeable in theory, there evidently is something wrong with freeing in swsusp, as we have a testcase in which the user was unable to suspend with swsusp due to the lack of memory and could suspend with suspend2.

Quoted 7 lines

However, the only thing in swsusp_shrink_memory() that may be wrong is we return -ENOMEM as soon as shrink_all_memory() returns 0. Namely, if shrink_all_memory() can return 0 prematurely (ie. "there still are some freeable pages, but they could not be freed in _this_ call"), we should continue until it returns 0 twice in a row (or something like that). If this doesn't help, we'll have to fix shrink_all_memory() I'm afraid.

Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

Quoted 5 lines

Sometimes it even freed 0 pages at the first try.

I did not push the patch because

1) it was way too ugly

I think I can do something like that in swsusp_shrink_memory() and it won't be very ugly.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

2) shrink_all_memory() should be fixed. It should not really return if there are more pages freeable.

Well, that would be a long-run solution. However, until it's fixed we can use a workaround IMHO. ;-)

Isn't trying to free as much memory as you can the wrong solution anyway?

No, it isn't. There are situations in which we would like to suspend "whatever it takes" and then we should be able to free as much memory as _really_ possible.

Besides, it is supposed to work, and it doesn't, so it needs fixing.

Quoted 3 lines

I mean, that only means that the poor system has more pages to fault back in at resume time, before the user can even begin to think about doing anything useful.

Well, that's not the only possibility. After we fix the memory freeing issue we can use the observation that page cache pages need not be saved to disk during suspend, because they already are in a storage. We only need to create a map of these pages during suspend with the information on where to get them from and prefetch them into memory during resume independently of the page fault mechanism.

This way we won't have to actually save anything before we snapshot the system and the system should be reasonably responsive after resume.

Greetings,
Rafael

#374 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 63 lines · Rafael J. Wysocki

Hi,

Quoted 3 lines · Nigel Cunningham
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Pavel Machek

On Pá 24-02-06 11:58:07, Rafael J. Wysocki wrote:

}-- snip --{

Quoted 29 lines
Quoted 29 lines
Quoted 14 lines
Quoted 6 lines

Well, if all of the pages that Nigel saves before snapshot are freeable in theory, there evidently is something wrong with freeing in swsusp, as we have a testcase in which the user was unable to suspend with swsusp due to the lack of memory and could suspend with suspend2.

Quoted 7 lines

However, the only thing in swsusp_shrink_memory() that may be wrong is we return -ENOMEM as soon as shrink_all_memory() returns 0. Namely, if shrink_all_memory() can return 0 prematurely (ie. "there still are some freeable pages, but they could not be freed in _this_ call"), we should continue until it returns 0 twice in a row (or something like that). If this doesn't help, we'll have to fix shrink_all_memory() I'm afraid.

Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

Quoted 5 lines

Sometimes it even freed 0 pages at the first try.

I did not push the patch because

1) it was way too ugly

I think I can do something like that in swsusp_shrink_memory() and it won't be very ugly.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

2) shrink_all_memory() should be fixed. It should not really return if there are more pages freeable.

Well, that would be a long-run solution. However, until it's fixed we can use a workaround IMHO. ;-)

Isn't trying to free as much memory as you can the wrong solution anyway?

No, it isn't. There are situations in which we would like to suspend "whatever it takes" and then we should be able to free as much memory as _really_ possible.

Besides, it is supposed to work, and it doesn't, so it needs fixing.

Quoted 3 lines

I mean, that only means that the poor system has more pages to fault back in at resume time, before the user can even begin to think about doing anything useful.

Well, that's not the only possibility. After we fix the memory freeing issue we can use the observation that page cache pages need not be saved to disk during suspend, because they already are in a storage. We only need to create a map of these pages during suspend with the information on where to get them from and prefetch them into memory during resume independently of the page fault mechanism.

Quoted 2 lines

This way we won't have to actually save anything before we snapshot the system and the system should be reasonably responsive after resume.

But this is going to be much more complicated than simply saving the pages in the first place. You'll need some mechanism for figuring out what pages to get, how to fault them in, etc. In addition, it will be much slower than simply reading them back from (ideally) contiguous storage.

Regards,

Nigel

#375 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 21 lines · Nigel Cunningham

Hi.

Quoted 18 lines · Rafael J. Wysocki

Hi,

Quoted 7 lines · Nigel Cunningham
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Pavel Machek

On Pá 24-02-06 11:58:07, Rafael J. Wysocki wrote:

I mean, that only means that the poor system has more pages to fault back in at resume time, before the user can even begin to think about doing anything useful.

Well, that's not the only possibility. After we fix the memory freeing issue we can use the observation that page cache pages need not be saved to disk during suspend, because they already are in a storage. We only need to create a map of these pages during suspend with the information on where to get them from and prefetch them into memory during resume independently of the page fault mechanism.

Quoted 7 lines
Quoted 2 lines

This way we won't have to actually save anything before we snapshot the system and the system should be reasonably responsive after resume.

But this is going to be much more complicated than simply saving the pages in the first place. You'll need some mechanism for figuring out what pages to get, how to fault them in, etc. In addition, it will be much slower than simply reading them back from (ideally) contiguous storage.

It will not be *much* slower. You gain some speed by not having to write anything, too. And done properly, it is going to be simple. Lets see what Rafael comes up with.

[Big advantage is that /proc/list-me-pagecache can be implemented without any dependencies on the rest of swsusp code, and is likely to be useful for speeding up boot, etc.]
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#376 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Nigel Cunningham

Hi,

Quoted 62 lines · Nigel Cunningham
Quoted 61 lines · Rafael J. Wysocki
Quoted 3 lines · Nigel Cunningham
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Pavel Machek

On Pá 24-02-06 11:58:07, Rafael J. Wysocki wrote:

}-- snip --{

Quoted 29 lines
Quoted 29 lines
Quoted 14 lines
Quoted 6 lines

Well, if all of the pages that Nigel saves before snapshot are freeable in theory, there evidently is something wrong with freeing in swsusp, as we have a testcase in which the user was unable to suspend with swsusp due to the lack of memory and could suspend with suspend2.

Quoted 7 lines

However, the only thing in swsusp_shrink_memory() that may be wrong is we return -ENOMEM as soon as shrink_all_memory() returns 0. Namely, if shrink_all_memory() can return 0 prematurely (ie. "there still are some freeable pages, but they could not be freed in _this_ call"), we should continue until it returns 0 twice in a row (or something like that). If this doesn't help, we'll have to fix shrink_all_memory() I'm afraid.

Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

Quoted 5 lines

Sometimes it even freed 0 pages at the first try.

I did not push the patch because

1) it was way too ugly

I think I can do something like that in swsusp_shrink_memory() and it won't be very ugly.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

2) shrink_all_memory() should be fixed. It should not really return if there are more pages freeable.

Well, that would be a long-run solution. However, until it's fixed we can use a workaround IMHO. ;-)

Isn't trying to free as much memory as you can the wrong solution anyway?

No, it isn't. There are situations in which we would like to suspend "whatever it takes" and then we should be able to free as much memory as _really_ possible.

Besides, it is supposed to work, and it doesn't, so it needs fixing.

Quoted 3 lines

I mean, that only means that the poor system has more pages to fault back in at resume time, before the user can even begin to think about doing anything useful.

Well, that's not the only possibility. After we fix the memory freeing issue we can use the observation that page cache pages need not be saved to disk during suspend, because they already are in a storage. We only need to create a map of these pages during suspend with the information on where to get them from and prefetch them into memory during resume independently of the page fault mechanism.

Quoted 6 lines
Quoted 2 lines

This way we won't have to actually save anything before we snapshot the system and the system should be reasonably responsive after resume.

But this is going to be much more complicated than simply saving the pages in the first place. You'll need some mechanism for figuring out what pages to get, how to fault them in, etc.

Yes, this is going to be quite difficult indeed. Still there's a price for saving the pages and I'd like to avoid paying it. ;-)

Quoted 2 lines

In addition, it will be much slower than simply reading them back from (ideally) contiguous storage.

Not necessarily. These pages may come from contiguous storage areas as well.

Greetings,
Rafael

#377 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 71 lines · Rafael J. Wysocki
Quoted 63 lines · Nigel Cunningham
Quoted 62 lines · Rafael J. Wysocki
Quoted 3 lines · Nigel Cunningham
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Pavel Machek

On Pá 24-02-06 11:58:07, Rafael J. Wysocki wrote:

}-- snip --{

Quoted 29 lines
Quoted 29 lines
Quoted 14 lines
Quoted 6 lines

Well, if all of the pages that Nigel saves before snapshot are freeable in theory, there evidently is something wrong with freeing in swsusp, as we have a testcase in which the user was unable to suspend with swsusp due to the lack of memory and could suspend with suspend2.

Quoted 7 lines

However, the only thing in swsusp_shrink_memory() that may be wrong is we return -ENOMEM as soon as shrink_all_memory() returns 0. Namely, if shrink_all_memory() can return 0 prematurely (ie. "there still are some freeable pages, but they could not be freed in _this_ call"), we should continue until it returns 0 twice in a row (or something like that). If this doesn't help, we'll have to fix shrink_all_memory() I'm afraid.

Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

Quoted 5 lines

Sometimes it even freed 0 pages at the first try.

I did not push the patch because

1) it was way too ugly

I think I can do something like that in swsusp_shrink_memory() and it won't be very ugly.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

2) shrink_all_memory() should be fixed. It should not really return if there are more pages freeable.

Well, that would be a long-run solution. However, until it's fixed we can use a workaround IMHO. ;-)

Isn't trying to free as much memory as you can the wrong solution anyway?

No, it isn't. There are situations in which we would like to suspend "whatever it takes" and then we should be able to free as much memory as _really_ possible.

Besides, it is supposed to work, and it doesn't, so it needs fixing.

Quoted 3 lines

I mean, that only means that the poor system has more pages to fault back in at resume time, before the user can even begin to think about doing anything useful.

Well, that's not the only possibility. After we fix the memory freeing issue we can use the observation that page cache pages need not be saved to disk during suspend, because they already are in a storage. We only need to create a map of these pages during suspend with the information on where to get them from and prefetch them into memory during resume independently of the page fault mechanism.

Quoted 6 lines
Quoted 2 lines

This way we won't have to actually save anything before we snapshot the system and the system should be reasonably responsive after resume.

But this is going to be much more complicated than simply saving the pages in the first place. You'll need some mechanism for figuring out what pages to get, how to fault them in, etc.

Quoted 8 lines

Yes, this is going to be quite difficult indeed. Still there's a price for saving the pages and I'd like to avoid paying it. ;-)

Quoted 2 lines

In addition, it will be much slower than simply reading them back from (ideally) contiguous storage.

Not necessarily. These pages may come from contiguous storage areas as well.

Oh well, I suppose we can compare once you've spent the time implementing it.

Regards,

Nigel

#378 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Rafael J. Wysocki

Hi!

Quoted 5 lines
Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

I was using this with some success... (Warning, against old kernel). But, as I said, I consider it ugly, and it would be better to fix shrink_all_memory.
Pavel

kernel/power/disk.c +17 -11
@@ -84,20 +84,26 @@ static int in_suspend __nosavedata = 0;
 
 static void free_some_memory(void)
 {
-	unsigned int i = 0;
-	unsigned int tmp;
-	unsigned long pages = 0;
-	char *p = "-\\|/";
-
-	printk("Freeing memory...  ");
-	while ((tmp = shrink_all_memory(10000))) {
-		pages += tmp;
-		printk("\b%c", p[i++ % 4]);
+	int i;
+	for (i=0; i<5; i++) {
+		int i = 0, tmp;
+		long pages = 0;
+		char *p = "-\\|/";
+
+		printk("Freeing memory...  ");
+		while ((tmp = shrink_all_memory(10000))) {
+			pages += tmp;
+			printk("\b%c", p[i]);
+			i++;
+			if (i > 3)
+				i = 0;
+		}
+		printk("\bdone (%li pages freed)\n", pages);
+		msleep_interruptible(200);
 	}
-	printk("\bdone (%li pages freed)\n", pages);
 }
 
-
+/* FIXME: Call it when appropriate */
 static inline void platform_finish(void)
 {
 	if (pm_disk_mode == PM_DISK_PLATFORM) {
Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#379 lore raw

PATCH 1/1 swsusp: improve memory shrinking

Hi,

Quoted 9 lines · Pavel Machek
Quoted 5 lines
Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

I was using this with some success... (Warning, against old kernel). But, as I said, I consider it ugly, and it would be better to fix shrink_all_memory.

Appended is a patch against the current -mm. [It also makes swsusp_shrink_memory() behave as documented for image_size = 0. Currently, if it states there's enough free RAM to suspend, it won't bother to free a single page.]

If anyone please can test it on a machine with less than 128 MB of RAM and see if it helps suspend there (in particular when X is running), and if changing the value of SHRINK_SLEEP to 200 (or more) makes any difference, I'll appreciate it very much.

Greetings,
Rafael

---
Make swsusp_shrink_memory() try harder to free more RAM if necessary or if the anticipated size of the image is greater than image_size.

---
 kernel/power/swsusp.c |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)
kernel/power/swsusp.c +18 -8
Index: linux-2.6.16-rc4-mm2/kernel/power/swsusp.c
===================================================================
@@ -175,6 +175,8 @@ void free_all_swap_pages(int swap, struc
  */
 
 #define SHRINK_BITE	10000
+#define SHRINK_RETRY	3
+#define SHRINK_SLEEP	100
 
 int swsusp_shrink_memory(void)
 {
@@ -182,6 +184,7 @@ int swsusp_shrink_memory(void)
 	struct zone *zone;
 	unsigned long pages = 0;
 	unsigned int i = 0;
+	int retry = SHRINK_RETRY;
 	char *p = "-\\|/";
 
 	printk("Shrinking memory...  ");
@@ -194,14 +197,21 @@ int swsusp_shrink_memory(void)
 		for_each_zone (zone)
 			if (!is_highmem(zone))
 				tmp -= zone->free_pages;
-		if (tmp > 0) {
-			tmp = shrink_all_memory(SHRINK_BITE);
-			if (!tmp)
-				return -ENOMEM;
-			pages += tmp;
-		} else if (size > image_size / PAGE_SIZE) {
-			tmp = shrink_all_memory(SHRINK_BITE);
-			pages += tmp;
+		if (tmp > 0 || size > image_size / PAGE_SIZE) {
+			long freed = shrink_all_memory(SHRINK_BITE);
+
+			if (freed > 0) {
+				pages += freed;
+				tmp = freed;
+				retry = SHRINK_RETRY;
+			} else {
+				if (--retry) {
+					msleep_interruptible(SHRINK_SLEEP);
+					tmp = size;
+				} else if (tmp > 0) {
+					return -ENOMEM;
+				}
+			}
 		}
 		printk("\b%c", p[i++%4]);
 	} while (tmp > 0);
#380 lore raw

Re: [RFC/RFT][PATCH -mm] swsusp: improve memory shrinking

Hi!

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

I was using this with some success... (Warning, against old kernel). But, as I said, I consider it ugly, and it would be better to fix shrink_all_memory.

Quoted 5 lines

Appended is a patch against the current -mm.
[It also makes
swsusp_shrink_memory() behave as documented for image_size = 0. Currently, if it states there's enough free RAM to suspend, it won't bother to free a single page.]

Could we get bugfix part separately?
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#381 lore raw

Re: [RFC/RFT][PATCH -mm] swsusp: improve memory shrinking

Hi,

Quoted 10 lines · Pavel Machek
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

I was using this with some success... (Warning, against old kernel). But, as I said, I consider it ugly, and it would be better to fix shrink_all_memory.

Quoted 7 lines
Quoted 5 lines

Appended is a patch against the current -mm.
[It also makes
swsusp_shrink_memory() behave as documented for image_size = 0. Currently, if it states there's enough free RAM to suspend, it won't bother to free a single page.]

Could we get bugfix part separately?

Sure. Appended is the bugfix (I haven't tested it separately yet, but I think it's simple enough) ...

---
Make swsusp_shrink_memory() behave as documented when image_size = 0.

---
 kernel/power/swsusp.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
kernel/power/swsusp.c +8 -7
Index: linux-2.6.16-rc4-mm2/kernel/power/swsusp.c
===================================================================
@@ -194,14 +194,15 @@ int swsusp_shrink_memory(void)
 		for_each_zone (zone)
 			if (!is_highmem(zone))
 				tmp -= zone->free_pages;
-		if (tmp > 0) {
-			tmp = shrink_all_memory(SHRINK_BITE);
-			if (!tmp)
+		if (tmp > 0 || size > image_size / PAGE_SIZE) {
+			long freed = shrink_all_memory(SHRINK_BITE);
+
+			if (freed > 0) {
+				pages += freed;
+				tmp = freed;
+			} else if (tmp > 0) {
 				return -ENOMEM;
-			pages += tmp;
-		} else if (size > image_size / PAGE_SIZE) {
-			tmp = shrink_all_memory(SHRINK_BITE);
-			pages += tmp;
+			}
 		}
 		printk("\b%c", p[i++%4]);
 	} while (tmp > 0);
#382 lore raw

Re: [RFC/RFT][PATCH -mm] swsusp: improve memory shrinking

Quoted 17 lines · Rafael J. Wysocki
Quoted 16 lines · Pavel Machek
Quoted 15 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

I was using this with some success... (Warning, against old kernel). But, as I said, I consider it ugly, and it would be better to fix shrink_all_memory.

Appended is a patch against the current -mm.
[It also makes
swsusp_shrink_memory() behave as documented for image_size = 0. Currently, if it states there's enough free RAM to suspend, it won't bother to free a single page.]

Quoted 4 lines
Quoted 1 line

Could we get bugfix part separately?

Sure. Appended is the bugfix (I haven't tested it separately yet, but I think it's simple enough) ...

... and this is the workaround of the "shrink_all_memory() returns 0 prematurely" problem (not tested separately yet). [Together these patches make my box actually free more memory when image_size = 0.]

---
Make swsusp_shrink_memory() try harder to free more RAM if necessary or if the anticipated size of the image is greater than image_size.

---
 kernel/power/swsusp.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
kernel/power/swsusp.c +11 -2
Index: linux-2.6.16-rc4-mm2/kernel/power/swsusp.c
===================================================================
@@ -175,6 +175,8 @@ void free_all_swap_pages(int swap, struc
  */
 
 #define SHRINK_BITE	10000
+#define SHRINK_RETRY	3
+#define SHRINK_SLEEP	100
 
 int swsusp_shrink_memory(void)
 {
@@ -182,6 +184,7 @@ int swsusp_shrink_memory(void)
 	struct zone *zone;
 	unsigned long pages = 0;
 	unsigned int i = 0;
+	int retry = SHRINK_RETRY;
 	char *p = "-\\|/";
 
 	printk("Shrinking memory...  ");
@@ -200,8 +203,14 @@ int swsusp_shrink_memory(void)
 			if (freed > 0) {
 				pages += freed;
 				tmp = freed;
-			} else if (tmp > 0) {
-				return -ENOMEM;
+				retry = SHRINK_RETRY;
+			} else {
+				if (--retry) {
+					msleep_interruptible(SHRINK_SLEEP);
+					tmp = size;
+				} else if (tmp > 0) {
+					return -ENOMEM;
+				}
 			}
 		}
 		printk("\b%c", p[i++%4]);
#383 lore raw

Re: [RFC/RFT][PATCH -mm] swsusp: improve memory shrinking

Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Rafael J. Wysocki
Quoted 16 lines · Pavel Machek
Quoted 15 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

I was using this with some success... (Warning, against old kernel). But, as I said, I consider it ugly, and it would be better to fix shrink_all_memory.

Appended is a patch against the current -mm.
[It also makes
swsusp_shrink_memory() behave as documented for image_size = 0. Currently, if it states there's enough free RAM to suspend, it won't bother to free a single page.]

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Could we get bugfix part separately?

Sure. Appended is the bugfix (I haven't tested it separately yet, but I think it's simple enough) ...

... and this is the workaround of the "shrink_all_memory() returns 0 prematurely" problem (not tested separately yet). [Together these patches make my box actually free more memory when image_size = 0.]

He he, move the workaround into mm/vmscan.c to get Andrew's attetion then attempt to push it :-))). That way

1) shrink_all_memory() will get fixed for all callers

2) you'll probably force akpm to fix it the right way :-).

Pavel

Signature · 1 line
Feeling evil tonight.
#384 lore raw

Re: [RFC/RFT][PATCH -mm] swsusp: improve memory shrinking

Quoted 28 lines · Pavel Machek
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Rafael J. Wysocki
Quoted 16 lines · Pavel Machek
Quoted 15 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

I was using this with some success... (Warning, against old kernel). But, as I said, I consider it ugly, and it would be better to fix shrink_all_memory.

Appended is a patch against the current -mm.
[It also makes
swsusp_shrink_memory() behave as documented for image_size = 0. Currently, if it states there's enough free RAM to suspend, it won't bother to free a single page.]

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Could we get bugfix part separately?

Sure. Appended is the bugfix (I haven't tested it separately yet, but I think it's simple enough) ...

... and this is the workaround of the "shrink_all_memory() returns 0 prematurely" problem (not tested separately yet). [Together these patches make my box actually free more memory when image_size = 0.]

Quoted 6 lines

He he, move the workaround into mm/vmscan.c to get Andrew's attetion then attempt to push it :-))). That way

1) shrink_all_memory() will get fixed for all callers

2) you'll probably force akpm to fix it the right way :-).

Well, it looks like there are only two users of shrink_all_memory(), swsusp.c and kernel/power/main.c, so we can change its behavior.

I think I'll leave swsusp.c as is and change shrink_all_memory() to "try harder". ;-)

Greetings,
Rafael

#385 lore raw

Re: [RFC/RFT][PATCH -mm] swsusp: improve memory shrinking

In reply to Rafael J. Wysocki
Quoted 19 lines · Rafael J. Wysocki

Hi,

Quoted 16 lines · Pavel Machek
Quoted 15 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

I was using this with some success... (Warning, against old kernel). But, as I said, I consider it ugly, and it would be better to fix shrink_all_memory.

Appended is a patch against the current -mm.
[It also makes
swsusp_shrink_memory() behave as documented for image_size = 0. Currently, if it states there's enough free RAM to suspend, it won't bother to free a single page.]

Quoted 4 lines
Quoted 1 line

Could we get bugfix part separately?

Sure. Appended is the bugfix (I haven't tested it separately yet, but I think it's simple enough) ...

Are you sure? The way I read old code ... it looks correct to me.

size is always > 1000 or so. if image_size = 0, size > image_size/PAGE_SIZE and we'll loop as long as shrink_all_memory() frees something.

								Pavel

        printk("Shrinking memory...  ");
        do {
                /* size = How much memory would we need if we did not
free anything? */
                size = 2 * count_highmem_pages();
                size += size / 50 + count_data_pages();
                size += (size + PBES_PER_PAGE - 1) / PBES_PER_PAGE +
                        PAGES_FOR_IO;

                /* tmp = How much memory do we *need* to free in order
to fit? */
                tmp = size;
                for_each_zone (zone)
                        if (!is_highmem(zone))
                                tmp -= zone->free_pages;
                if (tmp > 0) {
                        tmp = shrink_all_memory(SHRINK_BITE);
                        if (!tmp)
                                return -ENOMEM;
                        pages += tmp;
                } else if (size > image_size / PAGE_SIZE) {
                        tmp = shrink_all_memory(SHRINK_BITE);
                        pages += tmp;
                }
                printk("\b%c", p[i++%4]);
Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#386 lore raw

Re: [RFC/RFT][PATCH -mm] swsusp: improve memory shrinking

Hi,

Quoted 20 lines · Pavel Machek
Quoted 19 lines · Rafael J. Wysocki
Quoted 17 lines · Pavel Machek
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

I did try shrink_all_memory() five times, with .5 second delay between them, and it freed more memory at later tries.

I wonder if the delays are essential or if so, whether they may be shorter than .5 sec.

I was using this with some success... (Warning, against old kernel). But, as I said, I consider it ugly, and it would be better to fix shrink_all_memory.

Quoted 5 lines

Appended is a patch against the current -mm.
[It also makes
swsusp_shrink_memory() behave as documented for image_size = 0. Currently, if it states there's enough free RAM to suspend, it won't bother to free a single page.]

Could we get bugfix part separately?

Quoted 8 lines
Quoted 2 lines

Sure. Appended is the bugfix (I haven't tested it separately yet, but I think it's simple enough) ...

Are you sure? The way I read old code ... it looks correct to me.

size is always > 1000 or so. if image_size = 0, size > image_size/PAGE_SIZE and we'll loop as long as shrink_all_memory() frees something.

Of course, you are right.

So the original patch was what's needed to get the workaround in. :-)

Greetings,
Rafael

#387 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Rafael J. Wysocki
Quoted 24 lines · Rafael J. Wysocki

Hi,

Quoted 15 lines · Pavel Machek
Quoted 8 lines
Quoted 8 lines

Ok, I have no problems with visions.

Quoted 2 lines

I think we should try to get the pagecache stuff right first anyway.

Are you sure it is worth doing? I mean... it only helps on small machines, no?

Quoted 6 lines
Quoted 2 lines

OTOH having it for benchmarks will be nice, and perhaps we could use that kind it to speed up boot and similar things...

Currently some people can't suspend with the mainline code because it cannot free as much memory as needed on their boxes. I think we should care for them too.

Quoted 5 lines

But saving pagecache will not help them *at all*!

[Because pagecache is freeable, anyway, so it will be freed. Now... I have seen some problems where free_some_memory did not free enough, and schedule()/retry helped a bit... that probably should be fixed.]

Quoted 5 lines

It seems I need to understand correctly what the difference between what we do and what Nigel does is. I thought the Nigel's approach was to save some cache pages to disk first and use the memory occupied by them to store the image data. If so, is the page cache involved in that or something else?

You're right. The only point I would query is that I'm not sure on terminology
- whether 'page cache' == LRU. In case there's any difference, I'll say that I treat pages on the active and inactive LRU lists separately, saving them to disk first and using the memory occupied by them for the atomic copy (with the exception, of course, of pages belonging to processes such as userui - these are made part of the atomic copy and not overwritten).

Regards,

Nigel

#388 lore raw

Re: Which is simpler? (Was Re: Re: [ 00/10] [Suspend2] Modules support.)

In reply to Nigel Cunningham
Quoted 7 lines · Nigel Cunningham
Quoted 2 lines · Andreas Happe

I tried to use suspend2, but setup wasn't that great (i.e. didn't work as well or easy as swsusp) so I dropped it.

Could you provide more detail? If there's something I can do to make it eas= ier=20 to use, I'm more than willing to consider that.

it's way too long ago to remember specifics, the system didn't resume after suspending. Swsusp worked just out of the box (sans dri support after resuming) without the need to apply a patch (which wasn't supplied as normal patch (if i remember correctly) but was used by starting a script)). I'm sorry that I didn't submit a proper bug report, but the alternative worked for me.

You can't make it simpler except you get in included into mainline (even by making compromises).

Quoted 8 lines

12 bytes per page is 3MB/1GB. If swsusp was to add support for multiple swap partitions or writing to files, those requirement 20 might be closer to 5MB/GB. Bitmaps, in comparison, use ~32K/GB (approx because it depends whether the gigabyte is all in one zone). Proportionally ,20 bitmaps are eating a lot less space out of your gigabyte, but I don't think anyone is going to notice that they have 3 or 4MB more cache per gigabyte with Suspend2 than they have with swsusp).

This would take suspend2 a step closer to mainline.. you'll have a very honest 'Thank You' if that could happen..

andy

#389 lore raw

Re: Which is simpler? (Was Re: Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 8 lines · Andreas Happe
Quoted 6 lines · Nigel Cunningham
Quoted 2 lines · Andreas Happe

I tried to use suspend2, but setup wasn't that great (i.e. didn't work as well or easy as swsusp) so I dropped it.

Could you provide more detail? If there's something I can do to make it eas= ier=20 to use, I'm more than willing to consider that.

Quoted 6 lines

it's way too long ago to remember specifics, the system didn't resume after suspending. Swsusp worked just out of the box (sans dri support after resuming) without the need to apply a patch (which wasn't supplied as normal patch (if i remember correctly) but was used by starting a script)). I'm sorry that I didn't submit a proper bug report, but the alternative worked for me.

Ok. That was when I provided multiple patches - they're all combined now. The script is still there, but just to make applying easier for newbies.

Quoted 2 lines

You can't make it simpler except you get in included into mainline (even by making compromises).

Agreed.

Quoted 11 lines
Quoted 8 lines

12 bytes per page is 3MB/1GB. If swsusp was to add support for multiple swap partitions or writing to files, those requirement 20 might be closer to 5MB/GB. Bitmaps, in comparison, use ~32K/GB (approx because it depends whether the gigabyte is all in one zone). Proportionally ,20 bitmaps are eating a lot less space out of your gigabyte, but I don't think anyone is going to notice that they have 3 or 4MB more cache per gigabyte with Suspend2 than they have with swsusp).

This would take suspend2 a step closer to mainline.. you'll have a very honest 'Thank You' if that could happen..

Well, we'll see what Rafael and I can work out.

Regards,

Nigel

Quoted 7 lines

andy

-
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/

#390 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Olivier Galibert

Hi!

Quoted 12 lines
Quoted 11 lines
Quoted 4 lines

Even with wanting to move as many things to
userspace as possible, merging suspend2 with cleanups if necessary, _then_ starting from there to move things to userspace seems more realistic long-term.

The _only_ thing we moved to the user space was the writing and reading of the image. [We moved it quite literally, by porting the analogous swsusp code from the current -mm.]

Currently we are _not_ moving _anything_ to the user space. We're just _implementing_ some things in the user space, but _not_ from scratch.

Quoted 8 lines
Quoted 1 line

From what I see of the messages in this thread, at that point you're

just trying to play catchup with suspend2. Don't that feel a little strange to you? You know you have working GPL code handy, tested with happy users, with a maintainer who would be happy to have it in the kernel, and instead of making it better you spend your talents redoing the same functionality only slightly differently. Why? Just for a semireligious argument on where the userspace/kernelspace separation should be in the suspend process?

There is 14000 lines of code that is very far away from being mergeable into kernel. It is less work to reimplement it in userspace than clean it up for kernel inclusion.

And no, Nigel is *not* willing to help. He's willing to fix small problems, but not big ones.

Quoted 6 lines
Quoted 4 lines

The problem is to merge suspend2 we'd have to clean it up first and actually solve some problems that it works around. That, arguably, would be more work than just implementing some _easy_ stuff in the user space.

Stuff that is _already_ _done_ and working.

It is not done. It is too ugly, and it is not done in a way that could be merged into kernel.

Quoted 7 lines

Are you really, really sure you're not rejecting suspend2 in bulk because you didn't write it? Do we need a John W. Linville as suspend maintainer for things to go better?

Please tell me what is wrong in my perception of what is going on.

OG, not even a suspend2 user.

...and probably never seen suspend2 patch.

If you see suspend2 patch, and still feel some parts of it are good and could be reused in userspace, feel free to help.

Quoted 3 lines

[1] Look at s2ram.c and puke. I understand it has been clobbed together for testing and as such does not pretend to be of any quality, but it's so bad it's painful.

Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#391 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Olivier Galibert
Quoted 1 line · Olivier Galibert

On Mon, Feb 20, 2006 at 03:13:23PM +0100, Rafael J. Wysocki wrote:

}-- snip --{

Quoted 2 lines

From what I see of the messages in this thread, at that point you're just trying to play catchup with suspend2.

Well, I don't think I am. Or maybe a little. Still, are you trying to say that GNOME developers should give up because KDE is more advanced in some respects or vice versa?

Quoted 4 lines

Don't that feel a little strange to you? You know you have working GPL code handy, tested with happy users, with a maintainer who would be happy to have it in the kernel, and instead of making it better you spend your talents redoing the same functionality only slightly differently. Why?

_I_ am doing it as a proof of concept. Many people said it didn't make sense to implement this in the user space and that it wouldn't work, and it would take ages to do this etc. I don't agree with that and I want to show I'm right. Is that wrong?

Quoted 10 lines
Quoted 10 lines
Quoted 3 lines

Right now it really looks like they're only
trying to redo what's already in suspend2, tested and debugged, only different and new, hence untested and undebugged.

Actually a lot of the code that we use _has_ _been_ tested and debugged, because it _is_ used on a daily basis by many people, like eg.:
- MD5 from the coreutils package,
- libLZF (the original one)
(openSSL wil be used soon for the image encryption).

Quoted 6 lines
Quoted 3 lines

And I'm not trying to redo suspend2 in the user space. Instead I'm trying to use the code that's _already_ _available_ in the user space to obtain the functionality that suspend2 implements in the kernel space.

"obtaining the functionality that suspend2 implements" means "redoing suspend2".

No, it doesn't. By the same token you could say writing another mail client is redoing Mozilla Thunderbird.

Quoted 1 line

Don't play on words, please.

I don't. I really _think_ it's not the same. :-)

Quoted 2 lines

md5 is already in the kernel (twice). lzf is already in suspend2 (and arguably useful for more things than only suspending),

Now seriously. Nigel already _had_ submitted the LZF patch, but it was not accepted by the cryptoAPI maintainers. Neither me, nor Pavel took part in that. The same applies to many things in suspend2, just browse the LKML archives for the record.

Quoted 3 lines

so suspend2's implementation has been tested for use in a suspend context, while libLZF hasn't. You _will_ have bugs putting things together, that's a given.

You're probably right.

Quoted 3 lines

Now explain me why you're tying together code from coreutils and other sources when you have the same code, only already tested in a suspend context (memory management, etc), in suspend2.

Sorry, it's not like that. The memory management is not done by the userland part, it's done by the kernel. The role of the userland part is to read the image from the kernel, transform it (compress/encrypt/whatever) if needed and save to disk. All that.

Quoted 2 lines

Why, for the image save, did you port the code from swsusp with for instance its lack of async i/o, instead of porting the suspend2 code?

Because suspend2 code is incompatible with what's in the kernel now.

To use the suspend2 code I'd have to modify the kernel code substantially, and that's what Pavel didn't want. OTOH the swsusp code was known to work and I used it to test the new code, too.

Quoted 6 lines
Quoted 4 lines

The problem is to merge suspend2 we'd have to clean it up first and actually solve some problems that it works around. That, arguably, would be more work than just implementing some _easy_ stuff in the user space.

Stuff that is _already_ _done_ and working.

Functionality-wise, your right. The problem is how it's done, I think, and that is not so obvious.

Quoted 3 lines

Be careful though, you're awfully close to saying that userspace code is easier because it isn't reviewed[1] while kernel code has higher standards.

Oh, come on. You can review it, everybody can. Moreover, you're welcome to do this. :-)

}-- snip --{

Quoted 2 lines

The constraints on userland suspend code are rather close to RT kernel code, so technically it would be a much better base.

Can you please tell me why do you think so?

Quoted 3 lines

4- why aren't you actively working at pushing the parts of suspend2
that actually are good and potentially useful to uswsusp in the mainline kernel. Do you really think nothing is worthwhile in there?

Because there are no patches to work on? I'd _really_ love to work on patches that modify the current kernel code _gradually_ instead of just trying to replace it top-down with something else in one big shot.

For example, I'd really appreciate it if Nigel could prepare a patch against the current -mm implementing the freezing of bdevs he was talking about, and there are more things like that.

Quoted 2 lines

Are you really, really sure you're not rejecting suspend2 in bulk because you didn't write it?

Oh, _I_ am not rejecting it. I've never said so. I just don't think there's a chance it will be merged in the short run, for various reasons, so I'm working on an alternative.

}-- snip --{

Quoted 1 line

Please tell me what is wrong in my perception of what is going on.

I think you are assuming I'm doing this to prevent suspend2 from being merged. It is not so, as I've tried to explain above. If you don't accept my point of view, I'll respect that.

Greetings,
Rafael

PS
I didn't write s2ram, so I can't comment your observations wrt it.

#392 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 9 lines · Rafael J. Wysocki
Quoted 1 line · Olivier Galibert

On Mon, Feb 20, 2006 at 03:13:23PM +0100, Rafael J. Wysocki wrote:

}-- snip --{

Quoted 2 lines

From what I see of the messages in this thread, at that point you're just trying to play catchup with suspend2.

Well, I don't think I am. Or maybe a little. Still, are you trying to say that GNOME developers should give up because KDE is more advanced in some respects or vice versa?

The GNOME/KDE situation is an interesting parallel. GNOME was created as you probably know essentially because of licensing issues with Qt. I suspect RedHat wanting to differentiate itself from Suse probably helped justifying the financing. For a long while GNOME just played catchup with KDE. Current situation is amusing, though. Sanity has prevailed, applications are made interoperable between the two environments and a modern desktop uses from the two indifferently. There is slightly less duplication between the two, too. But at the same time both desktops are trying very hard to differenciate from each other, GNOME is playing the "user friendlyness" card for instance, whatever their definition of that is.

Now here, we're talking about suspend. Something where the best user interface is no user interface. Disk speeds and memory sizes being what there are you have to somehow tell the user that yes, things are still moving. But otherwise, there isn't much to do to differenciate from each other. Some amusing features could be added, especially at the interaction between suspend to ram and disk, but STR is even more unreliable than STD so it's not going to happen any time soon.

Quoted 9 lines
Quoted 4 lines

Don't that feel a little strange to you? You know you have working GPL code handy, tested with happy users, with a maintainer who would be happy to have it in the kernel, and instead of making it better you spend your talents redoing the same functionality only slightly differently. Why?

_I_ am doing it as a proof of concept. Many people said it didn't make sense to implement this in the user space and that it wouldn't work, and it would take ages to do this etc. I don't agree with that and I want to show I'm right. Is that wrong?

Nothing wrong with that. Cool hacks are cool pretty much by definition :-)

Now try another point of view. STD as currently in the kernel is unreliable, and don't get me started about STR. Assume that you are the suspend maintainer for the kernel (you are the co-maintainer at that point in practice). As such, you should want STD/STR to be reliable. As an engineer, tell me if you think uswsusp has a chance to make STD/STR more reliable than the current situation.

Quoted 2 lines

No, it doesn't. By the same token you could say writing another mail client is redoing Mozilla Thunderbird.

You have, say, xmh. You start working to make it look and act like Thunderbird. Isn't that redoing Thunderbird, whatever the implementation looks like at the end?

Quoted 7 lines
Quoted 2 lines

md5 is already in the kernel (twice). lzf is already in suspend2 (and arguably useful for more things than only suspending),

Now seriously. Nigel already _had_ submitted the LZF patch, but it was not accepted by the cryptoAPI maintainers. Neither me, nor Pavel took part in that. The same applies to many things in suspend2, just browse the LKML archives for the record.

I'll try to have a look. I'm curious for the reasons (we don't need that vs. we need that but that code is crap).

Quoted 8 lines
Quoted 3 lines

Now explain me why you're tying together code from coreutils and other sources when you have the same code, only already tested in a suspend context (memory management, etc), in suspend2.

Sorry, it's not like that. The memory management is not done by the userland part, it's done by the kernel. The role of the userland part is to read the image from the kernel, transform it (compress/encrypt/whatever) if needed and save to disk. All that.

If the memory usage of your userland part is not severely bounded you may have annoying issues. Libraries inmy experience tend to be quite liberal in their allocations.

Quoted 8 lines
Quoted 2 lines

Why, for the image save, did you port the code from swsusp with for instance its lack of async i/o, instead of porting the suspend2 code?

Because suspend2 code is incompatible with what's in the kernel now.

To use the suspend2 code I'd have to modify the kernel code substantially, and that's what Pavel didn't want. OTOH the swsusp code was known to work and I used it to test the new code, too.

Ok. I wouldn't have thought writing the image could be that different, but I definitively take your word for it.

Quoted 4 lines
Quoted 1 line

Stuff that is _already_ _done_ and working.

Functionality-wise, your right. The problem is how it's done, I think, and that is not so obvious.

Heh. It obviously has been way too long out of mainline. Pavel's reviews being 90% "you should do all that in userspace" are a little tiring after a while though.

Quoted 4 lines
Quoted 2 lines

The constraints on userland suspend code are rather close to RT kernel code, so technically it would be a much better base.

Can you please tell me why do you think so?

Well, from what I see (I can be very wrong mind you), the constraints are:
- no fs access at all
- careful with memory, you don't want to push things into swap once the image is done

That's very RT-ish. And all that essentially without the kernel protecting you from your errors.

Quoted 11 lines
Quoted 3 lines

4- why aren't you actively working at pushing the parts of suspend2
that actually are good and potentially useful to uswsusp in the mainline kernel. Do you really think nothing is worthwhile in there?

Because there are no patches to work on? I'd _really_ love to work on patches that modify the current kernel code _gradually_ instead of just trying to replace it top-down with something else in one big shot.

For example, I'd really appreciate it if Nigel could prepare a patch against the current -mm implementing the freezing of bdevs he was talking about, and there are more things like that.

Ok, that attitude I completely agree with.

Quoted 5 lines
Quoted 1 line

Please tell me what is wrong in my perception of what is going on.

I think you are assuming I'm doing this to prevent suspend2 from being merged. It is not so, as I've tried to explain above. If you don't accept my point of view, I'll respect that.

You're way saner about suspend2 than Pavel is.

OG.

#393 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 11 lines · Olivier Galibert
Quoted 6 lines · Rafael J. Wysocki
Quoted 2 lines · Olivier Galibert

On Mon, Feb 20, 2006 at 03:13:23PM +0100, Rafael J. Wysocki wrote:
Stuff that is _already_ _done_ and working.

Functionality-wise, your right. The problem is how it's done, I think, and that is not so obvious.

Heh. It obviously has been way too long out of mainline. Pavel's reviews being 90% "you should do all that in userspace" are a little tiring after a while though.

That does not make them wrong... having to review code that does not need to be in kernel in the first place is tiring, too.

Feel free to review that code yourself, and clean it up with Nigel; but it is useless as long as it contains stuff such as "press 'C' to continue, or any other key to reboot".
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#394 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Olivier Galibert
Quoted 3 lines · Olivier Galibert
Quoted 2 lines · Rafael J. Wysocki
Quoted 1 line · Olivier Galibert

On Mon, Feb 20, 2006 at 03:13:23PM +0100, Rafael J. Wysocki wrote:

}-- snip --{

Quoted 2 lines

Now try another point of view. STD as currently in the kernel is unreliable,

It works for me 100% of the time, as of 2.6.16-rc4, so this statement is too general, I think.

Besides, some important fixes are in -mm waiting for the 2.6.17 merging window.

Quoted 5 lines

and don't get me started about STR. Assume that you are the suspend maintainer for the kernel (you are the co-maintainer at that point in practice). As such, you should want STD/STR to be reliable. As an engineer, tell me if you think uswsusp has a chance to make STD/STR more reliable than the current situation.

Of course it doesn't, but the same applies to suspend2. It's not about fixing driver problems etc. It's all about checkpointing the system and saving the image (w/ some fancy transformations like encryption/compression).

[The suspend2 patch does contain driver fixes, but they really should be posted separately or forwarded to the respective driver maintainers (it's already happened, AFAICT). Please do not count the driver fixes as an advantage of suspend2.]

Now there are two differences that may cause suspend2 to work where swsusp doesn't: (1) suspend2 is able to free more memory during suspend, and
(2) suspend2 contains some code for freezing processes that is not present in the mainline swsusp.

Let's consider (2) first. The freezing of processes in swsusp has recently been improved so that it can freeze processes under _heavy_ load and it's been done in much simpler way than suspend2 does it (this patch is now in -mm). This code may be further improved by porting the freezing of bdevs from suspend2, but that's not critical in my view. OTOH this part of suspend2 contains at least one thing that was rejected about 1 year ago and not by me or Pavel.

Now as far as (1) is concerned, there is a question if the way in which that is done in suspend2 is really optimal. That will have to be considered for a while and by people who know the kernel internals much better than I do.

Quoted 6 lines
Quoted 2 lines

No, it doesn't. By the same token you could say writing another mail client is redoing Mozilla Thunderbird.

You have, say, xmh. You start working to make it look and act like Thunderbird. Isn't that redoing Thunderbird, whatever the implementation looks like at the end?

Well, I don't want it to look and act like suspend2. I'd like it to provide comparable functionality, in a different way.

}-- snip --{

Quoted 3 lines

If the memory usage of your userland part is not severely bounded you may have annoying issues. Libraries inmy experience tend to be quite liberal in their allocations.

It isn't all that bad, apparently. So far I haven't experienced any problems related to that.

}-- snip --{

Quoted 6 lines
Quoted 2 lines

Functionality-wise, your right. The problem is how it's done, I think, and that is not so obvious.

Heh. It obviously has been way too long out of mainline. Pavel's reviews being 90% "you should do all that in userspace" are a little tiring after a while though.

Well, I can't speak for Pavel.

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

The constraints on userland suspend code are rather close to RT kernel code, so technically it would be a much better base.

Can you please tell me why do you think so?

Well, from what I see (I can be very wrong mind you), the constraints are:
- no fs access at all
- careful with memory, you don't want to push things into swap once the image is done

The second one should be safe, I think (the image reflects the state of swap from before the "atomic snapshot" operation, so what happens to the swap afterwards doesn't really matter).

Quoted 2 lines

That's very RT-ish. And all that essentially without the kernel protecting you from your errors.

You're not so time-constrained, though, and there are no other threads to worry about. :-)

Greetings,
Rafael

#395 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Matthias Hensler

Hi!

Quoted 3 lines
Quoted 1 line

It is slightly slower,

Sorry, but that is just unacceptable.

Eh? Slower suspend is not acceptable while slowing runtime system is acceptable?

Quoted 10 lines
Quoted 4 lines
Quoted 2 lines

The only con I see is the complexity of the code, but then again, Nigel

..but thats a big con.

So why is that? From what I see, most of the code is completly independ of the rest of the kernel, and just does not affect if it is disabled.

It won't do any harm to the kernel, and again, Nigel is constantly improving that situation, so for sure, that is no _big_ con.

14000 lines is a lot of code to maintain.

Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

From a user, and contributor, point of view, I really do not understand why not even trying to push a working implementation into mainline (I know that you cannot just apply the Suspend 2 patches and shipping it,

It is less work to port suspend2's features into userspace than to make suspend2 acceptable to mainline. Both will mean big changes, and may cause some short-term problems, but it will be less pain than maintaining suspend2 forever. Please help with the former...

Quoted 6 lines

These "big changes" is something I have a problem with, since it means to delay a working suspend/resume in Linux for another "short-term" (so what does it mean: 1 month? six? twelve?). It is painful to get these things to work reliable, I have followed this for nearly 1.5 years. And
again: today there is a working implementation, so why not merge it and have something today, and then start working on the other things.

swsusp is reliable; suspend2 is faster... If you can't wait six months for uswsusp (which is as fast, today)... help me with uswsusp.

Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#396 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek

Hi,

Quoted 25 lines · Pavel Machek
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines

Personally I agree with you on suspend2, I think this is something that needed to Just Work yesterday, and every day it doesn't work we are losing users... but who am I to talk, I'm not the one who will have to maintain it.

It does just work in mainline now. If it does not please open bug account at bugzilla.kernel.org.

If mainline swsusp is too slow for you, install uswsusp. If it is still too slow for you, mail me a patch adding LZW to userland code (should be easy).

Quoted 6 lines

<horrified rebuke>

Pavel!

Responses like this are precisely why you're not the most popular kernel maintainer. Telling people to use beta (alpha?) code or fix it

I do not *want* to be the most popular maintainer. That is your place ;-).

Quoted 3 lines

themselves
(and then have their patches rejected by you) is no way to maintain a part of the kernel. Stop being a liability instead of an asset!

Quoted 7 lines

Ugh?

Lee is a programmer. He wants faster swsusp, and improving uswsusp is currently best way to get that. It may be alpha/beta quality, but someone has to start testing, and Lee should be good for that (played with realtime kernels etc...). Actually it is in good enough state that I'd like non-programmers to test it, too.

I'd rather like to wait with that until there's a howto. :-)

Greetings,
Rafael

#397 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

themselves
(and then have their patches rejected by you) is no way to maintain a part of the kernel. Stop being a liability instead of an asset!

Ugh?

Quoted 7 lines
Quoted 5 lines

Lee is a programmer. He wants faster swsusp, and improving uswsusp is currently best way to get that. It may be alpha/beta quality, but someone has to start testing, and Lee should be good for that (played with realtime kernels etc...). Actually it is in good enough state that I'd like non-programmers to test it, too.

I'd rather like to wait with that until there's a howto. :-)

Attached, now Lee or anyone can start hacking.

Suspend-to-disk HOWTO
~~~~~~~~~~~~~~~~~~~~
Copyright (C) 2006 Pavel Machek <[email protected]>

You'll need /dev/snapshot for these to work:

crw-r--r-- 1 root root 10, 231 Jan 13 21:21 /dev/snapshot

Then compile userspace tools in usual way. You'll need an -mm kernel for now. To suspend-to-disk, run

./suspend /dev/<your_swap_partition>

. (There should be just one, for now.) Suspend is easy, resume is slightly harder. Resume application has to be ran without any filesystems mounted rw, and without any journalling filesystems mounted at all, preferably from initrd (but read-only ext2 should do the trick, too). Resume is then as easy as running

./resume /dev/<your_swap_partition>

. You probably want to create script that attempts to resume with above command, and if that fails, fall back to init.

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#398 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 37 lines · Pavel Machek
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

themselves
(and then have their patches rejected by you) is no way to maintain a part of the kernel. Stop being a liability instead of an asset!

Ugh?

Quoted 7 lines
Quoted 5 lines

Lee is a programmer. He wants faster swsusp, and improving uswsusp is currently best way to get that. It may be alpha/beta quality, but someone has to start testing, and Lee should be good for that (played with realtime kernels etc...). Actually it is in good enough state that I'd like non-programmers to test it, too.

I'd rather like to wait with that until there's a howto. :-)

Attached, now Lee or anyone can start hacking.

Suspend-to-disk HOWTO
~~~~~~~~~~~~~~~~~~~~
Copyright (C) 2006 Pavel Machek <[email protected]>

You'll need /dev/snapshot for these to work:

crw-r--r-- 1 root root 10, 231 Jan 13 21:21 /dev/snapshot

Then compile userspace tools in usual way. You'll need an -mm kernel for now. To suspend-to-disk, run

./suspend /dev/<your_swap_partition>

. (There should be just one, for now.) Suspend is easy, resume is slightly harder. Resume application has to be ran without any filesystems mounted rw, and without any journalling filesystems mounted at all, preferably from initrd (but read-only ext2 should do the trick, too). Resume is then as easy as running

Quoted 4 lines

./resume /dev/<your_swap_partition>

. You probably want to create script that attempts to resume with above command, and if that fails, fall back to init.

If it's run fron an initrd, it'll fall back automatically. Also you can set the name of the resume partition in the header file swsusp.h and you'll be able to use the tools without any command line parameters (useful if you want to start resume from an initrd).

Besides, an -mm kernel is needed for this to work (preferrably 2.6.16-rc1-mm5, for now), and the CVS changes on a daily basis.

Greetings,
Rafael

#399 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi!

Quoted 5 lines
Quoted 5 lines

Suspend-to-disk HOWTO
~~~~~~~~~~~~~~~~~~~~
Copyright (C) 2006 Pavel Machek <[email protected]>

Quoted 7 lines
Quoted 7 lines

You'll need /dev/snapshot for these to work:

crw-r--r-- 1 root root 10, 231 Jan 13 21:21 /dev/snapshot

Then compile userspace tools in usual way. You'll need an -mm kernel for now. To suspend-to-disk, run

I actually added -mm warning here.

Quoted 10 lines
Quoted 10 lines

./suspend /dev/<your_swap_partition>

. (There should be just one, for now.) Suspend is easy, resume is slightly harder. Resume application has to be ran without any filesystems mounted rw, and without any journalling filesystems mounted at all, preferably from initrd (but read-only ext2 should do the trick, too). Resume is then as easy as running

./resume /dev/<your_swap_partition>

Quoted 7 lines
Quoted 2 lines

. You probably want to create script that attempts to resume with above command, and if that fails, fall back to init.

If it's run fron an initrd, it'll fall back automatically. Also you can set the name of the resume partition in the header file swsusp.h and you'll be able to use the tools without any command line parameters (useful if you want to start resume from an initrd).

I know a little about initrd. I've just commited HOWTO file, can you edit it to describe that?
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#400 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 7 lines · Pavel Machek
Quoted 7 lines
Quoted 7 lines

Suspend-to-disk HOWTO
~~~~~~~~~~~~~~~~~~~~
Copyright (C) 2006 Pavel Machek <[email protected]>

You'll need /dev/snapshot for these to work:

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

crw-r--r-- 1 root root 10, 231 Jan 13 21:21 /dev/snapshot

Then compile userspace tools in usual way. You'll need an -mm kernel for now. To suspend-to-disk, run

I actually added -mm warning here.

Oh, I didn't notice, sorry.

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

./suspend /dev/<your_swap_partition>

. (There should be just one, for now.) Suspend is easy, resume is slightly harder. Resume application has to be ran without any filesystems mounted rw, and without any journalling filesystems mounted at all, preferably from initrd (but read-only ext2 should do the trick, too). Resume is then as easy as running

./resume /dev/<your_swap_partition>

. You probably want to create script that attempts to resume with above command, and if that fails, fall back to init.

Quoted 7 lines
Quoted 4 lines

If it's run fron an initrd, it'll fall back automatically. Also you can set the name of the resume partition in the header file swsusp.h and you'll be able to use the tools without any command line parameters (useful if you want to start resume from an initrd).

I know a little about initrd. I've just commited HOWTO file, can you edit it to describe that?

OK, I will, but when I have some time for that (today in the night, probably).

Greetings,
Rafael

#401 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek
Quoted 7 lines · Pavel Machek

Ugh?

Lee is a programmer. He wants faster swsusp, and improving uswsusp is currently best way to get that. It may be alpha/beta quality, but someone has to start testing, and Lee should be good for that (played with realtime kernels etc...). Actually it is in good enough state that I'd like non-programmers to test it, too.

Unfortunately I won't have time to test this anytime soon, so I probably should have kept quiet...

Lee

#402 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek
Quoted 9 lines · Pavel Machek

Hi!
Ugh?

Lee is a programmer. He wants faster swsusp, and improving uswsusp is currently best way to get that. It may be alpha/beta quality, but someone has to start testing, and Lee should be good for that (played with realtime kernels etc...). Actually it is in good enough state that I'd like non-programmers to test it, too.

Quoted 3 lines

And yes, I'm a maintainer, and that means I have to reject bad patches from time to time, too.
Pavel

Best is a subjective term, I would say the 'best' way to get a swsusp implementation that can save all of his caches and still suspend/resume faster would be to just apply the Suspend2 patches and get on with whatever he'd rather be doing since the work's already been done.

Jim.

#403 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Jim Crilly
Quoted 6 lines · Jim Crilly

With uswsusp it'll be more flexible in that you'll be able to use any userland process or library to transform the image before storing it, but the suspend and resume processes are going to be a lot more complicated. For instance, how are you going to tell the kernel that you need the uswsusp UI binary, /bin/gzip and /usr/bin/gpg to run after the rest of userland has been frozen?

Unless someone at least gives a rough estimate of 1) what % of users can't suspend their laptops now and 2) of these, what % are helped by suspend2, this thread is just handwaving...

Lee

#404 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 11 lines · Lee Revell
Quoted 6 lines · Jim Crilly

With uswsusp it'll be more flexible in that you'll be able to use any userland process or library to transform the image before storing it, but the suspend and resume processes are going to be a lot more complicated. For instance, how are you going to tell the kernel that you need the uswsusp UI binary, /bin/gzip and /usr/bin/gpg to run after the rest of userland has been frozen?

Unless someone at least gives a rough estimate of 1) what % of users can't suspend their laptops now and 2) of these, what % are helped by suspend2, this thread is just handwaving...

Percentages would be pure guesswork, but I do have _some_ numbers.

For (1), I have no idea. Furthermore, I would think that if a user can suspend with Suspend2, they should be able to suspend with swsusp. There were 2 driver related patches I had that swsusp doesn't, with I sent to Andrew and to John Stultz this morning for consideration. The one sent to Andrew might make some people be able to suspend with Suspend2 who couldn't with swsusp, but I couldn't see how the timer related one I sent to John could make a difference (so I asked for his evaluation). Given that the right thing happens with them, I guess merging Suspend2 should make virtually zero difference to whatever the answer might be to #1.

Now to #2.I haven't seen download statistics for Suspend2 since last May. At that time, we had a release that was current for about 3 months. During that time, there were 12,000 downloads of the version (2.1.8 IIRC). Let's say that half of them actually applied the software and used it. Does 6000 people make it worth it? Of course, having said that, I don't know how many people would be more likely to use it if it was in mainline and they didn't have to patch their kernels, but I'd suspect it would be at least that number again.

Hope that helps.

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#405 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoting Nigel Cunningham <[email protected]>:

Quoted 4 lines

Of course, having said that, I don't know how
many people would be more likely to use it if it was in mainline and they didn't have to patch their kernels, but I'd suspect it would be at least that number again.

Well, there are far more people that use what distrubutions provide than anything else. And distributions tend to like applying some patches to the vanilla kernel, but if at all possible, not to be too far away from mainline. Which is a good policy, of course, as it reduces the amount of work for them and makes them submit improvements upstream.

So, when distributors are able to get their hands on something that Just Works in the mainline, they will make sure things are nicely integrated, variety of configs are supported (like suspending to swap partitions, swap files or regular files), that the whole thing looks pretty and performs well. All of this can be done with Suspend2 today.

So, it isn't just about the basics any more (i.e. who can suspend and who cannot). Majority of users prefer things that work better, are faster and look prettier.

Signature · 1 line
Bojan
#406 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Nigel Cunningham
Quoted 8 lines · Nigel Cunningham

Now to #2.I haven't seen download statistics for Suspend2 since last May. At that time, we had a release that was current for about 3 months. During that time, there were 12,000 downloads of the version (2.1.8 IIRC). Let's say that half of them actually applied the software and used it. Does 6000 people make it worth it? Of course, having said that, I don't know how many people would be more likely to use it if it was in mainline and they didn't have to patch their kernels, but I'd suspect it would be at least that number again.

And those downloads doesn't include the users of distributions, where suspend2 is already well integrated. In Gentoo, for instance, we mirror the suspend2 patches on our own mirror system (We didn't do this last May, though).

Regards,
Brix

Signature · 2 lines
Henrik Brix Andersen <[email protected]>
Gentoo Metadistribution | Mobile computing herd
#407 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Lee Revell
Quoted 11 lines · Lee Revell
Quoted 6 lines · Jim Crilly

With uswsusp it'll be more flexible in that you'll be able to use any userland process or library to transform the image before storing it, but the suspend and resume processes are going to be a lot more complicated. For instance, how are you going to tell the kernel that you need the uswsusp UI binary, /bin/gzip and /usr/bin/gpg to run after the rest of userland has been frozen?

Unless someone at least gives a rough estimate of 1) what % of users can't suspend their laptops now and 2) of these, what % are helped by suspend2, this thread is just handwaving...

and 3) for what % of users, suspend2 will actually break it (bugs happen).

Anyway it seems to be something like 1) 90% 2) 1% 3) .5%

Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#408 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 9 lines · Pavel Machek
Quoted 2 lines

Unless someone at least gives a rough estimate of 1) what % of users can't suspend their laptops now and 2) of these, what % are helped

by

Quoted 1 line

suspend2, this thread is just handwaving...

and 3) for what % of users, suspend2 will actually break it (bugs happen).

Anyway it seems to be something like 1) 90% 2) 1% 3) .5%

Presumably you mean 90% *can* suspend with mainline?

Lee

#409 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 4 lines · Lee Revell
Quoted 3 lines · Pavel Machek
Quoted 2 lines

Unless someone at least gives a rough estimate of 1) what % of users can't suspend their laptops now and 2) of these, what % are helped

by

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

suspend2, this thread is just handwaving...

and 3) for what % of users, suspend2 will actually break it (bugs happen).

Anyway it seems to be something like 1) 90% 2) 1% 3) .5%

Presumably you mean 90% *can* suspend with mainline?

Yes, sorry.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#410 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek

Hi.

Quoted 4 lines · Pavel Machek
Quoted 3 lines · Lee Revell
Quoted 2 lines · Jim Crilly

With uswsusp it'll be more flexible in that you'll be able to use any userland process or library to transform the image before storing it,

but

Quoted 1 line
Quoted 1 line
Quoted 1 line

the suspend and resume processes are going to be a lot more

complicated.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

For instance, how are you going to tell the kernel that you need the uswsusp UI binary, /bin/gzip and /usr/bin/gpg to run after the rest

of

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

userland has been frozen?

Unless someone at least gives a rough estimate of 1) what % of users can't suspend their laptops now and 2) of these, what % are helped by suspend2, this thread is just handwaving...

and 3) for what % of users, suspend2 will actually break it (bugs happen).

Yep, I'm fallible too :) Which is why we have a mailing list and bugzilla :)

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#411 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek

Hi.

Quoted 9 lines · Pavel Machek
Quoted 8 lines · Lee Revell
Quoted 6 lines · Jim Crilly

With uswsusp it'll be more flexible in that you'll be able to use any userland process or library to transform the image before storing it, but the suspend and resume processes are going to be a lot more complicated. For instance, how are you going to tell the kernel that you need the uswsusp UI binary, /bin/gzip and /usr/bin/gpg to run after the rest of userland has been frozen?

Quoted 8 lines
Quoted 3 lines

Unless someone at least gives a rough estimate of 1) what % of users can't suspend their laptops now and 2) of these, what % are helped by suspend2, this thread is just handwaving...

and 3) for what % of users, suspend2 will actually break it (bugs happen).

Anyway it seems to be something like 1) 90% 2) 1% 3) .5%

And the source for your numbers is?....

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#412 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 16 lines · Nigel Cunningham

Hi.

Quoted 13 lines · Pavel Machek
Quoted 11 lines · Lee Revell
Quoted 6 lines · Jim Crilly

With uswsusp it'll be more flexible in that you'll be able to use any userland process or library to transform the image before storing it, but the suspend and resume processes are going to be a lot more complicated. For instance, how are you going to tell the kernel that you need the uswsusp UI binary, /bin/gzip and /usr/bin/gpg to run after the rest of userland has been frozen?

Unless someone at least gives a rough estimate of 1) what % of users can't suspend their laptops now and 2) of these, what % are helped by suspend2, this thread is just handwaving...

Quoted 6 lines
Quoted 4 lines

and 3) for what % of users, suspend2 will actually break it (bugs happen).

Anyway it seems to be something like 1) 90% 2) 1% 3) .5%

And the source for your numbers is?....

Educated guess :-).
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#413 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Nigel Cunningham

Hi!

[Head straight down for j. if you hate long mails.]

Quoted 8 lines
Quoted 5 lines

Complexity in userspace: ungood.

Complexity in kernel: doubleplusungood.

It is not that hard to understand :-).

Heh. you'll soon be submitting patches to move interrupt handling and scheduling to userspace then?

If I figure out how to do that with equivalent performance and without excessive uglyness... yes.

[This has hidden assumption that we want to include *all* the features suspend2 has. We could do it... but we probably do not want to.]

Quoted 1 line

a. Freezing processes, freeing memory and preparing the image.

...

Quoted 2 lines

Freeing memory and preparing the image is significantly simpler for swsusp at the moment because it doesn't support swap files, and doesn't

I do not see why I'd have to modify freezer for supporting swap files. It is really unrelated part. If I want to support swap files, I'll just bmap() them from userspace, then write to blockdevice directly, like lilo or grub does.

b. missing?

Quoted 1 line

c. Compression and encryption.

...

Quoted 7 lines

libraries or using cryptoapi functions via ioctls or such like. Making such support optional and configurable would require further modification. Using userspace libraries for compression and encryption would increase the complexity of configuring uswsusp for a developer (extra packages to download/configure/install), and create greater potential for support issues for developers and distributions (uswusp gets blamed for any problems in those libraries but can't do anything to fix them!).

Yes, that is how libraries work. Any userland application has these "problems". uswsusp is clearly better here.

Quoted 5 lines

d. Storage of the image.

As it currently stands, the interface between userspace and the kernel for uswsusp looks clean and simple. This is mainly, however, because it only supports writing to swap, and strictly synchronously.

...and it is going to stay that way.

Quoted 6 lines

If you were going to match the functionality in suspend2, you would be looking at adding support for (a) asynchronous I/O, (b) for ordinary files, (c) for multiple swap devices (d) for swapfiles and (e) for the varying blocksizes of filesystems. I assume uswsusp won't currently work with swapfiles (as opposed to swap partitions) as it stands because I see a check for !S_ISBLK(resume_device) in suspend.c::main.

(a) Reading image from kernel is memory-to-memory transfer -- i.e. extremely fast. There's nothing to be gained by asynchronous I/O. (Write to disk can still be done asynchronous, kernel has interfaces to do that). (b) is going to be solved by bmap. Maybe I'll need some small changes for (c) and (d); don't see why (e) applies to me.

Quoted 7 lines

userspace for getting the sector numbers of storage. Finally, you'd want to use bio functions to submit the I/O, and a kernel routine to handle the completion. Then you'd need some mechanism to wait for or check for completion of I/O on a particular page or all pages. Of course you might decide not to do async I/O because it's too complex, but then you'd take the performance hit you currently have, and we wouldn't have an apples with apples comparison.

Submit bios from userspace? Eeek? We have perfectly working async io interface for userland, and BTW going async will not give you too much of performance advantage here...

Quoted 5 lines

e. Atomic copy/restore.

This is currently achieved in kernelspace, as it is for Suspend2. It would seem to be extremely unlikely that this could be implemented in userspace.

No, this stays in kernel.

Quoted 1 line

f. User tuning and configuration.

...

Quoted 7 lines

Suspend2 offers far more support for tuning and configuration via a proc interface. Suspend2 implements an additional layer on top of the base proc routines, which might be useful elsewhere in the kernel. This layer allows additional entries to be created at very little cost, and avoid duplicating code for each entry. This is an area of additional complexity that Suspend2 has at the moment, but similar additions would be helpful in the userspace program for the same reasons.

uswsusp wins here -- at least it does the config stuff in userspace.

Quoted 7 lines

g. Writing a full image of memory.

Not possible in uswsusp right now. If the algorithm of Suspend2 was used (wherein LRU pages are saved separately), support would need to be added for marking which LRU pages should be in the atomic copy (because they belong to the freezing process), and for reading and writing the sets of pages separately.

I'm not sure if we want to save full image of memory. Saving most-used caches only seems to work fairly well.

Quoted 7 lines

h. Powering down.

uswsusp currently supports using the sys_reboot restart and power off functions. There is no support for entering the ACPI S4 state, or for suspending-to-ram instead of powering off. Adding these would require additional ioctls and kernelspace functions, and the capability of configuring which powerdown method to use.

Yes, we'll need ioctls to enter S3 and S4.

Do you actually support suspend-to-ram at end of suspend2? That is one feature I'd like to play with.

Quoted 1 line

i. Status display.

...

Quoted 4 lines

is required when updating the kernel). It has also created additional complexity in that the code for doing the userui in the kernel didn't really go away - it was just replaced by code to communicate with userspace and get it to do the work. On the positive side, though,

As we do image writing in userspace, anyway, it does not mean aditional interface to userspace for us.

Quoted 3 lines

j. Summary.

At their cores, Suspend2 and uswsusp work in basically the same

Yes, basically. They'll be similar complexity in the end, differing very much where the complexity is.

Currently suspend2 is 14K lines of code in kernel. Not sure how much in userspace.

Current uswsusp is 3K lines of code in kernel, 1K lines of code in userspace.

When we are done, we'll have perhaps 2.5K lines of code in kernel (in-kernel swap writing support goes away), and maybe 20K lines in userspace.

That may not seem like a big difference to you, but it really is. It keeps complexity out-of-kernel.

Quoted 7 lines

It seems most likely that uswsusp would never match the current Suspend2 in terms of functionality, or would take a very long time to get there. Support for implementing a full image of memory will likely never happen, and asynchronous I/O would be unlikely too. If the flexibility in how to compress/encrypt and write the image that Suspend2 currently has were to be implemented in uswsusp, it would require a modular architecture along the lines of the one that has been rejected in the Modules support thread.

It was rejected *for kernel*. Putting it in userspace is okay.

Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#414 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 10 lines · Pavel Machek

Hi!

[Head straight down for j. if you hate long mails.]

Quoted 6 lines
Quoted 5 lines

Complexity in userspace: ungood.

Complexity in kernel: doubleplusungood.

It is not that hard to understand :-).

Quoted 8 lines
Quoted 2 lines

Heh. you'll soon be submitting patches to move interrupt handling and scheduling to userspace then?

If I figure out how to do that with equivalent performance and without excessive uglyness... yes.

[This has hidden assumption that we want to include *all* the features suspend2 has. We could do it... but we probably do not want to.]

Not hidden - I said I didn't expect you'd do most of the Suspend2 stuff, but was trying to compare apples with apples to make the comparison fair.

Quoted 4 lines
Quoted 1 line

a. Freezing processes, freeing memory and preparing the image.

...

Quoted 8 lines
Quoted 3 lines

Freeing memory and preparing the image is significantly simpler for swsusp at the moment because it doesn't support swap files, and doesn't

I do not see why I'd have to modify freezer for supporting swap files. It is really unrelated part. If I want to support swap files, I'll just bmap() them from userspace, then write to blockdevice directly, like lilo or grub does.

It would be needed because they're on filesystems. Freezing the filesystems, then trying to eat memory to the degree that the system tries to swap would lead to a deadlock if that swap was on a frozen filesystem. Conversely, trying to freeze the memory before freezing processes would be unreliable because it relies on not racing against other processes trying to work.

Quoted 1 line

b. missing?

Sorry.

Quoted 13 lines
Quoted 1 line

c. Compression and encryption.

...

Quoted 8 lines

libraries or using cryptoapi functions via ioctls or such like. Making such support optional and configurable would require further modification. Using userspace libraries for compression and encryption would increase the complexity of configuring uswsusp for a developer (extra packages to download/configure/install), and create greater potential for support issues for developers and distributions (uswusp gets blamed for any problems in those libraries but can't do anything to fix them!).

Quoted 2 lines

Yes, that is how libraries work. Any userland application has these "problems". uswsusp is clearly better here.

How so? For Suspend2, we just use existing cryptoapi modules without any requirement for particular libraries or such like.

Quoted 7 lines
Quoted 5 lines

d. Storage of the image.

As it currently stands, the interface between userspace and the kernel for uswsusp looks clean and simple. This is mainly, however, because it only supports writing to swap, and strictly synchronously.

...and it is going to stay that way.

No plans for writing to anywhere else but swap?

Quoted 7 lines
Quoted 6 lines

If you were going to match the functionality in suspend2, you would be looking at adding support for (a) asynchronous I/O, (b) for ordinary files, (c) for multiple swap devices (d) for swapfiles and (e) for the varying blocksizes of filesystems. I assume uswsusp won't currently work with swapfiles (as opposed to swap partitions) as it stands because I see a check for !S_ISBLK(resume_device) in suspend.c::main.

Quoted 6 lines

(a) Reading image from kernel is memory-to-memory transfer -- i.e. extremely fast. There's nothing to be gained by asynchronous I/O. (Write to disk can still be done asynchronous, kernel has interfaces to do that). (b) is going to be solved by bmap. Maybe I'll need some small changes for (c) and (d); don't see why (e) applies to me.

By I/O, I didn't mean the transfers between userspace and the kernel, but I/O - ie writing pages to disk (or whatever).

Quoted 9 lines
Quoted 7 lines

userspace for getting the sector numbers of storage. Finally, you'd want to use bio functions to submit the I/O, and a kernel routine to handle the completion. Then you'd need some mechanism to wait for or check for completion of I/O on a particular page or all pages. Of course you might decide not to do async I/O because it's too complex, but then you'd take the performance hit you currently have, and we wouldn't have an apples with apples comparison.

Submit bios from userspace? Eeek? We have perfectly working async io

Yes. But then how do you submit I/O to files on filesystems you can't mount? You're stuck with swap partitions only forever?

Quoted 2 lines

interface for userland, and BTW going async will not give you too much of performance advantage here...

How do you know that? Suspend2 has async I/O, and can write the image as fast as the drive can take it. Some testing I did a while ago showed a max throughput of 16MB/s for swsusp vs 35 (what the drive is capable of) for Suspend2. Add LZF compression and it's 70MB/s vs 16MB/s.

Quoted 21 lines
Quoted 5 lines

e. Atomic copy/restore.

This is currently achieved in kernelspace, as it is for Suspend2. It would seem to be extremely unlikely that this could be implemented in userspace.

No, this stays in kernel.

Quoted 1 line

f. User tuning and configuration.

...

Quoted 8 lines

Suspend2 offers far more support for tuning and configuration via a proc interface. Suspend2 implements an additional layer on top of the base proc routines, which might be useful elsewhere in the kernel. This layer allows additional entries to be created at very little cost, and avoid duplicating code for each entry. This is an area of additional complexity that Suspend2 has at the moment, but similar additions would be helpful in the userspace program for the same reasons.

Quoted 1 line

uswsusp wins here -- at least it does the config stuff in userspace.

The difference is really only in how the support is exported (ioctl vs proc).

Quoted 10 lines
Quoted 7 lines

g. Writing a full image of memory.

Not possible in uswsusp right now. If the algorithm of Suspend2 was used (wherein LRU pages are saved separately), support would need to be added for marking which LRU pages should be in the atomic copy (because they belong to the freezing process), and for reading and writing the sets of pages separately.

I'm not sure if we want to save full image of memory. Saving most-used caches only seems to work fairly well.

You're certainly doing a lot better than when you were eating everything you could. But whether 1/2 is adequate depends on the mix of applications and ultimately the user's requirements.

Quoted 9 lines
Quoted 7 lines

h. Powering down.

uswsusp currently supports using the sys_reboot restart and power off functions. There is no support for entering the ACPI S4 state, or for suspending-to-ram instead of powering off. Adding these would require additional ioctls and kernelspace functions, and the capability of configuring which powerdown method to use.

Yes, we'll need ioctls to enter S3 and S4.

Shouldn't be hard at all, either, of course.

Quoted 2 lines

Do you actually support suspend-to-ram at end of suspend2? That is one feature I'd like to play with.

Yes (provided that S3 works on your machine normally).

Quoted 11 lines
Quoted 1 line

i. Status display.

...

Quoted 4 lines

is required when updating the kernel). It has also created additional complexity in that the code for doing the userui in the kernel didn't really go away - it was just replaced by code to communicate with userspace and get it to do the work. On the positive side, though,

As we do image writing in userspace, anyway, it does not mean aditional interface to userspace for us.

But you don't. Doing image writing in userspace would involve having IDE drivers etc in userspace. You're copying the snapshot to userspace, then sending it straight back to the kernel one page at a time. I haven't looked again while writing this, but I wonder if userspace even knows exactly where the image is being stored.

Quoted 9 lines
Quoted 3 lines

j. Summary.

At their cores, Suspend2 and uswsusp work in basically the same

Yes, basically. They'll be similar complexity in the end, differing very much where the complexity is.

Currently suspend2 is 14K lines of code in kernel. Not sure how much in userspace.

I just did wc -l on the userui svn repository *.[ch] files. I think (Bernard's the expert) that this includes source for the text mode, fbsplash and experimental animation uis. It looks like the text and fbsplash onces are about 1k each and the animation one is larger, but I'm not sure.

Quoted 6 lines

Current uswsusp is 3K lines of code in kernel, 1K lines of code in userspace.

When we are done, we'll have perhaps 2.5K lines of code in kernel (in-kernel swap writing support goes away), and maybe 20K lines in userspace.

Without adding which out of async I/O, compression, encryption, swap file support, and ordinary file support?

Quoted 12 lines

That may not seem like a big difference to you, but it really is. It keeps complexity out-of-kernel.

Quoted 8 lines

It seems most likely that uswsusp would never match the current Suspend2 in terms of functionality, or would take a very long time to get there. Support for implementing a full image of memory will likely never happen, and asynchronous I/O would be unlikely too. If the flexibility in how to compress/encrypt and write the image that Suspend2 currently has were to be implemented in uswsusp, it would require a modular architecture along the lines of the one that has been rejected in the Modules support thread.

Quoted 1 line

It was rejected *for kernel*. Putting it in userspace is okay.

:)

Regards,

Nigel

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#415 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 7 lines · Nigel Cunningham
Quoted 4 lines · Pavel Machek

I do not see why I'd have to modify freezer for supporting swap files. It is really unrelated part. If I want to support swap files, I'll just bmap() them from userspace, then write to blockdevice directly, like lilo or grub does.

Quoted 6 lines

It would be needed because they're on filesystems. Freezing the filesystems, then trying to eat memory to the degree that the system tries to swap would lead to a deadlock if that swap was on a frozen filesystem. Conversely, trying to freeze the memory before freezing processes would be unreliable because it relies on not racing against other processes trying to work.

I need to think about that one... it should be possible to allocate space in swap file *before* freeze, and get disk address via bmap... are you sure swapfile accesses go through filesystems? I thought they use something bmap-like internally.

Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

d. Storage of the image.

As it currently stands, the interface between userspace and the kernel for uswsusp looks clean and simple. This is mainly, however, because it only supports writing to swap, and strictly synchronously.

...and it is going to stay that way.

No plans for writing to anywhere else but swap?

Yes, but with bmap, it is possible to do that with current interface. Early version even supported swap partitions.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

userspace for getting the sector numbers of storage. Finally, you'd want to use bio functions to submit the I/O, and a kernel routine to handle the completion. Then you'd need some mechanism to wait for or check for completion of I/O on a particular page or all pages. Of course you might decide not to do async I/O because it's too complex, but then you'd take the performance hit you currently have, and we wouldn't have an apples with apples comparison.

Quoted 4 lines
Quoted 1 line

Submit bios from userspace? Eeek? We have perfectly working async io

Yes. But then how do you submit I/O to files on filesystems you can't mount? You're stuck with swap partitions only forever?

read/write directly block device is perfectly possible from userspace. Small problem is finding suspend header with the map, but you somehow solved that already, right?

Quoted 7 lines
Quoted 2 lines

interface for userland, and BTW going async will not give you too much of performance advantage here...

How do you know that? Suspend2 has async I/O, and can write the image as fast as the drive can take it. Some testing I did a while ago showed a max throughput of 16MB/s for swsusp vs 35 (what the drive is capable of) for Suspend2. Add LZF compression and it's 70MB/s vs 16MB/s.

Userspace is perfectly capable of saturating I/O subsystem. No magical "async io" is needed for that. time dd if=/dev/zero of=/dev/hda bs=... if you don't believe me.

Quoted 9 lines
Quoted 6 lines

Current uswsusp is 3K lines of code in kernel, 1K lines of code in userspace.

When we are done, we'll have perhaps 2.5K lines of code in kernel (in-kernel swap writing support goes away), and maybe 20K lines in userspace.

Without adding which out of async I/O, compression, encryption, swap file support, and ordinary file support?

I'll get same bandwidth as you, without need for async I/O. Async I/O is not really a feature, suspend speed is. (There are existing interfaces for doing AIO from userspace, anyway, but I'm pretty sure they will not be needed

Compression, encryption, swapfile/normal file is planned, and should not affect kernel code.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#416 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 11 lines · Pavel Machek
Quoted 7 lines
Quoted 2 lines

interface for userland, and BTW going async will not give you too much of performance advantage here...

How do you know that? Suspend2 has async I/O, and can write the image as fast as the drive can take it. Some testing I did a while ago showed a max throughput of 16MB/s for swsusp vs 35 (what the drive is capable of) for Suspend2. Add LZF compression and it's 70MB/s vs 16MB/s.

Userspace is perfectly capable of saturating I/O subsystem. No magical "async io" is needed for that. time dd if=/dev/zero of=/dev/hda bs=... if you don't believe me.

But the in-kernel swsusp stuff (looking at the current linus kernel now) does write each page to the swap in a sync manner. That definitely is pretty slow, I would not be surprised if Nigels numbers are correct. If you repeated without write back caching enabled, a factor 10 in slowdown as compared to async io would not surprise me.

Why don't you split the writeout into a few seperate loops? Step 1, submission, step 2, wait for completion, step 3, check for io errors. You could even collapse step 2+3 if you wanted, the important bit is to queue all the io first.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Current uswsusp is 3K lines of code in kernel, 1K lines of code in userspace.

When we are done, we'll have perhaps 2.5K lines of code in kernel (in-kernel swap writing support goes away), and maybe 20K lines in userspace.

Quoted 7 lines
Quoted 2 lines

Without adding which out of async I/O, compression, encryption, swap file support, and ordinary file support?

I'll get same bandwidth as you, without need for async I/O. Async I/O is not really a feature, suspend speed is. (There are existing interfaces for doing AIO from userspace, anyway, but I'm pretty sure they will not be needed

If you keep writing single pages sync, you sure as hell wont get anywhere near async io in speed...

Signature · 1 line
Jens Axboe
#417 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi!

Quoted 18 lines
Quoted 11 lines
Quoted 7 lines
Quoted 2 lines

interface for userland, and BTW going async will not give you too much of performance advantage here...

How do you know that? Suspend2 has async I/O, and can write the image as fast as the drive can take it. Some testing I did a while ago showed a max throughput of 16MB/s for swsusp vs 35 (what the drive is capable of) for Suspend2. Add LZF compression and it's 70MB/s vs 16MB/s.

Userspace is perfectly capable of saturating I/O subsystem. No magical "async io" is needed for that. time dd if=/dev/zero of=/dev/hda bs=... if you don't believe me.

But the in-kernel swsusp stuff (looking at the current linus kernel now) does write each page to the swap in a sync manner. That definitely is pretty slow, I would not be surprised if Nigels numbers are correct. If you repeated without write back caching enabled, a factor 10 in slowdown as compared to async io would not surprise me.

Quoted 4 lines

Why don't you split the writeout into a few seperate loops? Step 1, submission, step 2, wait for completion, step 3, check for io errors. You could even collapse step 2+3 if you wanted, the important bit is to queue all the io first.

Nigel is right for current in-kernel stuff, but even existing userland suspend code at suspend.sf.net should solve this particular problem.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines

Current uswsusp is 3K lines of code in kernel, 1K lines of code in userspace.

When we are done, we'll have perhaps 2.5K lines of code in kernel (in-kernel swap writing support goes away), and maybe 20K lines in userspace.

Without adding which out of async I/O, compression, encryption, swap file support, and ordinary file support?

Quoted 7 lines
Quoted 4 lines

I'll get same bandwidth as you, without need for async I/O. Async I/O is not really a feature, suspend speed is. (There are existing interfaces for doing AIO from userspace, anyway, but I'm pretty sure they will not be needed

If you keep writing single pages sync, you sure as hell wont get anywhere near async io in speed...

well, we can perfectly do 128K block... just read 128K into userspace buffer, flush it via single write to block device. That should get us very close enough to media speed.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#418 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 11 lines · Pavel Machek
Quoted 7 lines
Quoted 4 lines

I'll get same bandwidth as you, without need for async I/O. Async I/O is not really a feature, suspend speed is. (There are existing interfaces for doing AIO from userspace, anyway, but I'm pretty sure they will not be needed

If you keep writing single pages sync, you sure as hell wont get anywhere near async io in speed...

well, we can perfectly do 128K block... just read 128K into userspace buffer, flush it via single write to block device. That should get us very close enough to media speed.

That'll help naturally, 128k sync blocks will be very close to async performance for most cases. Most cases here being drives with write back caching enabled, if that is disabled async will still be a big win.

Is there any reason _not_ to just go with async io? Usually the code is just as simple (or simpler), since the in-kernel stuff is inherently async to begin with.

Signature · 1 line
Jens Axboe
#419 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 13 lines · Jens Axboe
Quoted 11 lines · Pavel Machek
Quoted 7 lines
Quoted 4 lines

I'll get same bandwidth as you, without need for async I/O. Async I/O is not really a feature, suspend speed is. (There are existing interfaces for doing AIO from userspace, anyway, but I'm pretty sure they will not be needed

If you keep writing single pages sync, you sure as hell wont get anywhere near async io in speed...

well, we can perfectly do 128K block... just read 128K into userspace buffer, flush it via single write to block device. That should get us very close enough to media speed.

Quoted 7 lines

That'll help naturally, 128k sync blocks will be very close to async performance for most cases. Most cases here being drives with write back caching enabled, if that is disabled async will still be a big win.

Is there any reason _not_ to just go with async io? Usually the code is just as simple (or simpler), since the in-kernel stuff is inherently async to begin with.

Actually the userland tools we're working on use async I/O. [There's no real need for sync, I think.] Still we write one page at a time, for now, so the I/O performance is not that much better than for the built-in swsusp, but it _is_ better.

Greetings,
Rafael

#420 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 20 lines · Rafael J. Wysocki

Hi,

Quoted 17 lines · Jens Axboe
Quoted 11 lines · Pavel Machek
Quoted 7 lines
Quoted 4 lines

I'll get same bandwidth as you, without need for async I/O. Async I/O is not really a feature, suspend speed is. (There are existing interfaces for doing AIO from userspace, anyway, but I'm pretty sure they will not be needed

If you keep writing single pages sync, you sure as hell wont get anywhere near async io in speed...

well, we can perfectly do 128K block... just read 128K into userspace buffer, flush it via single write to block device. That should get us very close enough to media speed.

That'll help naturally, 128k sync blocks will be very close to async performance for most cases. Most cases here being drives with write back caching enabled, if that is disabled async will still be a big win.

Quoted 8 lines
Quoted 3 lines

Is there any reason _not_ to just go with async io? Usually the code is just as simple (or simpler), since the in-kernel stuff is inherently async to begin with.

Actually the userland tools we're working on use async I/O. [There's no real need for sync, I think.] Still we write one page at a time, for now, so the I/O performance is not that much better than for the built-in swsusp, but it _is_ better.

How many pages you write out at the time doesn't matter very much - that usually just boils down to how efficient you are wrt CPU usage, something that suspend probably doesn't need to care a whole lot about. What matters is how often you wait for a page. Writing 256MiB here, on a plain SATA drive:

4k sync writes:         17.9MiB/sec
4k async writes:        29.6MiB/sec
128k sync writes:       36.0MiB/sec
128k async writes:      41.9MiB/sec
Signature · 1 line
Jens Axboe
#421 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Jens Axboe

Hi!

Quoted 11 lines
Quoted 3 lines

well, we can perfectly do 128K block... just read 128K into userspace buffer, flush it via single write to block device. That should get us very close enough to media speed.

That'll help naturally, 128k sync blocks will be very close to async performance for most cases. Most cases here being drives with write back caching enabled, if that is disabled async will still be a big win.

Is there any reason _not_ to just go with async io? Usually the code is just as simple (or simpler), since the in-kernel stuff is inherently async to begin with.

Keeping it simple... when we are moving to doing writeback in userland, anyway.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#422 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek
Quoted 2 lines

I'm not sure if we want to save full image of memory. Saving most-used caches only seems to work fairly well.

No, it sucks. My machines take forever to become usable on resume with the current method. But dumping full image of memory will need compression to keep that from being sluggish as well.

Mmm.. I think I need to install swsusp2 here.

Cheers

#423 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 6 lines · Mark Lord
Quoted 2 lines

I'm not sure if we want to save full image of memory. Saving most-used caches only seems to work fairly well.

No, it sucks. My machines take forever to become usable on resume with the current method. But dumping full image of memory will need compression to keep that from being sluggish as well.

Are you sure? This changed recently, be sure to set /sys/power/image_size.

Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#424 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 9 lines · Pavel Machek
Quoted 5 lines · Mark Lord
Quoted 2 lines

I'm not sure if we want to save full image of memory. Saving most-used caches only seems to work fairly well.

No, it sucks. My machines take forever to become usable on resume with the current method. But dumping full image of memory will need compression to keep that from being sluggish as well.

Are you sure? This changed recently, be sure to set /sys/power/image_size.

No such pathname in 2.6.15 (the latest released kernel).

Cheers

#425 lore raw

Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 4 lines · Mark Lord
Quoted 3 lines · Pavel Machek
Quoted 2 lines · Mark Lord
Quoted 2 lines

I'm not sure if we want to save full image of memory. Saving most-used caches only seems to work fairly well.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

No, it sucks. My machines take forever to become usable on resume with the current method. But dumping full image of memory will need compression to keep that from being sluggish as well.

Are you sure? This changed recently, be sure to set /sys/power/image_size.

No such pathname in 2.6.15 (the latest released kernel).

_recently_. It's in 2.6.16-rc1 and later.

Signature · 1 line
~Randy

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#431 lore raw

Re: chroot in swsusp userland interface (was: Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Quoted 7 lines · Pavel Machek
Quoted 5 lines · Rafael J. Wysocki
Quoted 1 line

Now, the question is do we chroot or not?

What's wrong with setrlimit(RLIMIT_NOFILE, 0) (and RLIMIT_CORE). So long as you open all your necessary device nodes before doing so.

Nothing, but we got chroot idea, first.

Kinda like suspend2 didn't get into the kernel first?

I still think you're reinventing the wheel, and making it triangular :( I don't understand your motivations for moving something that is so intimately tied to the running kernel itself into userspace. A mouse driver, sure. But the more I think about it, the more it seems nuts to me.

Bernard.

Signature · 1 line
 Bernard Blackham <bernard at blackham dot com dot au>
#432 lore raw

Re: chroot in swsusp userland interface (was: Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 10 lines · Bernard Blackham
Quoted 7 lines · Pavel Machek
Quoted 5 lines · Rafael J. Wysocki
Quoted 1 line

Now, the question is do we chroot or not?

What's wrong with setrlimit(RLIMIT_NOFILE, 0) (and RLIMIT_CORE). So long as you open all your necessary device nodes before doing so.

Nothing, but we got chroot idea, first.

Kinda like suspend2 didn't get into the kernel first?

Practically that's 4 lines of setrlimit() code vs 4 lines of chroot()/chdir() code, so what's the problem? We can do this, we can do that, and we can replace this with that at any time, so it really doesn't matter. Or if you think it does, please let me know why.

Quoted 1 line

I still think you're reinventing the wheel, and making it triangular :(

To some extent you are right, but I don't agree with the "triangular" part.

Quoted 3 lines

I don't understand your motivations for moving something that is so intimately tied to the running kernel itself into userspace. A mouse driver, sure. But the more I think about it, the more it seems nuts to me.

Could you please provide some arguments? The more technical/practical they are, the better.

It is possible you are right and we're just missing something important, so let's discuss it. Seriously.

Greetings,
Rafael

#433 lore raw
In reply to Andrew Morton
Quoted 6 lines · Andrew Morton

Pavel Machek <[email protected]> wrote:

Random thoughts:

- swsusp has been a multi-year ongoing source of churn and bug reports. It hasn't been a big success and we have a way to go yet.

You don't get the success reports, only bug reports. It tends to work these days. I don't get success reports, too, but I'm not flooded with bugreports for distribution, either. (And actually see people using suspend2/swsusp).

Quoted 3 lines

- People seem to be doing too much development on the swsusp core and not enough development out where the actual problems are: drivers which don't suspend and resume correctly.

We only started developing swsusp core again at 11/2005. Problem with drivers is that I mostly do not have affected hardware. [Okay, there are some problems with Core Duo I can reproduce here, smp-only, but the machine is flakey, anyway, so it will take some time.]

Quoted 5 lines

- If you want my cheerfully uninformed opinion, we should toss both of them out and implement suspend3, which is based on the kexec/kdump infrastructure. There's so much duplication of intent here that it's not funny. And having them separate like this weakens both in the area where the real problems are: drivers.

I thought about it (at around 11/2005), but loosing 8+ MB of ram, permanently, is perhaps too big price to pay?
Pavel

Signature · 1 line
Thanks, Sharp!
#434 lore raw
In reply to Andrew Morton
Quoted 4 lines · Andrew Morton

Random thoughts:

- swsusp has been a multi-year ongoing source of churn and bug reports. It hasn't been a big success and we have a way to go yet.

swsusp may be an ongoing source of churn and bug reports, but it's also been more reliable for me (on multiple types of hardware) than Windows XP hibernate. In fact, at this point I'm perfectly satisfied with its reliability (i.e. I haven't had any problems lately).

(I just figure that I need to speak up, as a highly satisfied swsusp user.) --
-Barry K. Nathan <[email protected]>

#435 lore raw
Quoted 6 lines · Barry K. Nathan
Quoted 4 lines · Andrew Morton

Random thoughts:

- swsusp has been a multi-year ongoing source of churn and bug reports. It hasn't been a big success and we have a way to go yet.

Quoted 6 lines

swsusp may be an ongoing source of churn and bug reports, but it's also been more reliable for me (on multiple types of hardware) than Windows XP hibernate. In fact, at this point I'm perfectly satisfied with its reliability (i.e. I haven't had any problems lately).

(I just figure that I need to speak up, as a highly satisfied swsusp user.)

Thanks! :-)

Rafael

#436 lore raw
In reply to Andrew Morton
Quoted 5 lines · Andrew Morton

- If you want my cheerfully uninformed opinion, we should toss both of them out and implement suspend3, which is based on the kexec/kdump infrastructnure. There's so much duplication of intent here that it's not funny. And having them separate like this weakens both in the area where the real problems are: drivers.

Ahh!!! I'm surrounded.

suspend by kexec
suspend by migration

Is there a way out?

Can I avoid it?

Do all roads lead to suspend?

:)

Eric

#437 lore raw
Quoted 13 lines · On Sat, 11 Feb 2006 06:42:12 -0700 Eric W. Biederman wrote:
Quoted 5 lines · Andrew Morton

- If you want my cheerfully uninformed opinion, we should toss both of them out and implement suspend3, which is based on the kexec/kdump infrastructnure. There's so much duplication of intent here that it's not funny. And having them separate like this weakens both in the area where the real problems are: drivers.

Ahh!!! I'm surrounded.

suspend by kexec
suspend by migration

Quoted 7 lines

Is there a way out?

Can I avoid it?

Do all roads lead to suspend?

:)

All is not lost.
Recently I've had good results with suspend-to-disk (sort of a who cares). And suspend-to-RAM seems to work for me.... but no resume. :(

---
~Randy

#438 lore raw
In reply to Nigel Cunningham
Quoted 13 lines · Nigel Cunningham

Hi.

Quoted 10 lines · Pavel Machek

Hi!

Quoted 7 lines

This set of patches represents the core of Suspend2's module support.

Suspend2 uses a strong internal API to separate the method of determining the content of the image from the method by which it is saved. The code for determining the content is part of the core of Suspend2, and transformations (compression and/or encryption) and storage of the pages are handled by 'modules'.

Quoted 5 lines
Quoted 3 lines

swsusp already has a very strong API to separate image writing from image creation (in -mm patch, anyway). It is also very nice, just read() from /dev/snapshot. Please use it.

You know that's not an option.

(You could even use /dev/snapshot from kernelspace... for tests or something. But such patch is not going to be mergeable.)
Pavel

Signature · 1 line
Thanks, Sharp!