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 1 of 2

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

cover Modules support.

Hi everyone.

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'.

The name is currently mostly historical, from the time when these components could be built as kernel modules. That function was dropped to help with merging, but I'd like to reintroduce it later, since some embedded developers want to use Suspend2 to improve boot times. If/when that happens, I'll do it in a way that doesn't require as many exported symbols as was previously required. For now, though, the name remains, along with a few functions that are needed for building as modules. My expectation is that merging will take some time; perhaps by that time, I'll have modular support back in, in a better form.

--
Nigel Cunningham nigel at suspend2 dot net http://suspend2.net

#1 lore raw

PATCH 1/10 kernel/power/modules.h

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'.

The name is currently mostly historical, from the time when these components could be built as kernel modules. That function was dropped to help with merging, but I'd like to reintroduce it later, since some embedded developers want to use Suspend2 to improve boot times. If/when that happens, I'll do it in a way that doesn't require as many exported symbols as was previously required. For now, though, the name remains, along with a few functions that are needed for building as modules. My expectation is that merging will take some time; perhaps by that time, I'll have modular support back in, in a better form.

 0 files changed, 0 insertions(+), 0 deletions(-)

--
Nigel Cunningham nigel at suspend2 dot net

#2 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Quoted 5 lines · Nigel Cunningham

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'.

[snip]

Quoted 3 lines
 0 files changed, 0 insertions(+), 0 deletions(-)

Uh, oh, where's the patch?

Pekka

#3 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Quoted 7 lines · Pekka Enberg
Quoted 5 lines · Nigel Cunningham

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 7 lines

[snip]

Quoted 3 lines
 0 files changed, 0 insertions(+), 0 deletions(-)

Uh, oh, where's the patch?

Indeed! Oops! I think I've managed to put this in kmail without having it mangled!

Nigel

[Suspend2] kernel/power/modules.h

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'.

The name is currently mostly historical, from the time when these components could be built as kernel modules. That function was dropped to help with merging, but I'd like to reintroduce it later, since some embedded developers want to use Suspend2 to improve boot times. If/when that happens, I'll do it in a way that doesn't require as many exported symbols as was previously required. For now, though, the name remains, along with a few functions that are needed for building as modules. My expectation is that merging will take some time; perhaps by that time, I'll have modular support back in, in a better form.

---
commit a97697c4228b1f4daa0d692b373f3811bec9cb76
tree 8bf0c9e2bff6abe18ca410a14062a3e2ed8e4214
parent 424a2272be7e6858b3929bae5fbc645c35897482
author Nigel Cunningham <[email protected]> Wed, 01 Feb 2006 22:37:48 +1000 committer root <[email protected]> Wed, 01 Feb 2006 22:37:48 +1000

 kernel/power/modules.h |  179 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 179 insertions(+), 0 deletions(-)
kernel/power/modules.h new file +179 -0
new file mode 100644
index 0000000..ee34199
@@ -0,0 +1,179 @@
+/*
+ * kernel/power/module.h
+ *
+ * Copyright (C) 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ * This file is released under the GPLv2.
+ *
+ * It contains declarations for modules. Plugins are additions to
+ * suspend2 that provide facilities such as image compression or
+ * encryption, backends for storage of the image and user interfaces.
+ *
+ */
+
+/* This is the maximum size we store in the image header for a module name */
+#define SUSPEND_MAX_PLUGIN_NAME_LENGTH 30
+
+/* Per-module metadata */
+struct module_header {
+	char name[SUSPEND_MAX_PLUGIN_NAME_LENGTH];
+	int disabled;
+	int type;
+	int index;
+	int data_length;
+	unsigned long signature;
+};
+
+extern int num_modules, num_writers;
+
+enum {
+	FILTER_PLUGIN,
+	WRITER_PLUGIN,
+	MISC_PLUGIN, // Block writer, eg.
+	CHECKSUM_PLUGIN
+};
+
+enum {
+	SUSPEND_ASYNC,
+	SUSPEND_SYNC
+};
+
+struct suspend_filter_ops {
+	/* Writing the image proper */
+	int (*write_chunk) (struct page *buffer_page);
+
+	/* Reading the image proper */
+	int (*read_chunk) (struct page *buffer_page, int sync);
+
+	/* Reset module if image exists but reading aborted */
+	void (*noresume_reset) (void);
+	struct list_head filter_list;
+};
+
+struct suspend_writer_ops {
+	
+	/* Writing the image proper */
+	int (*write_chunk) (struct page *buffer_page);
+
+	/* Reading the image proper */
+	int (*read_chunk) (struct page *buffer_page, int sync);
+
+	/* Reset module if image exists but reading aborted */
+	void (*noresume_reset) (void);
+
+	/* Calls for allocating storage */
+
+	int (*storage_available) (void); // Maximum size of image we can save
+					  // (incl. space already allocated).
+	
+	int (*storage_allocated) (void);
+					// Amount of storage already allocated
+	int (*release_storage) (void);
+	
+	/* 
+	 * Header space is allocated separately. Note that allocation
+	 * of space for the header might result in allocated space 
+	 * being stolen from the main pool if there is no unallocated
+	 * space. We have to be able to allocate enough space for
+	 * the header. We can eat memory to ensure there is enough
+	 * for the main pool.
+	 */
+	int (*allocate_header_space) (int space_requested);
+	int (*allocate_storage) (int space_requested);
+	
+	/* Read and write the metadata */	
+	int (*write_header_init) (void);
+	int (*write_header_chunk) (char *buffer_start, int buffer_size);
+	int (*write_header_cleanup) (void);
+
+	int (*read_header_init) (void);
+	int (*read_header_chunk) (char *buffer_start, int buffer_size);
+	int (*read_header_cleanup) (void);
+
+	/* Prepare metadata to be saved (relativise/absolutise extents) */
+	int (*serialise_extents) (void);
+	int (*load_extents) (void);
+	
+	/* Attempt to parse an image location */
+	int (*parse_sig_location) (char *buffer, int only_writer);
+
+	/* Determine whether image exists that we can restore */
+	int (*image_exists) (void);
+	
+	/* Mark the image as having tried to resume */
+	void (*mark_resume_attempted) (void);
+
+	/* Destroy image if one exists */
+	int (*invalidate_image) (void);
+	
+	/* Wait on I/O */
+	int (*wait_on_io) (int flush_all);
+
+	struct list_head writer_list;
+};
+
+struct suspend_module_ops {
+	/* Functions common to all modules */
+	int type;
+	char *name;
+	struct module *module;
+	int disabled;
+	struct list_head module_list;
+
+	/* Bytes! */
+	unsigned long (*memory_needed) (void);
+	unsigned long (*storage_needed) (void);
+
+	int (*print_debug_info) (char *buffer, int size);
+	int (*save_config_info) (char *buffer);
+	void (*load_config_info) (char *buffer, int len);
+	
+	/* Initialise & cleanup - general routines called
+	 * at the start and end of a cycle. */
+	int (*initialise) (int starting_cycle);
+	void (*cleanup) (int finishing_cycle);
+
+	int (*write_init) (int stream_number);
+	int (*write_cleanup) (void);
+
+	int (*read_init) (int stream_number);
+	int (*read_cleanup) (void);
+
+	union {
+		struct suspend_filter_ops filter;
+		struct suspend_writer_ops writer;
+	} ops;
+};
+
+extern struct suspend_module_ops *active_writer;
+extern struct list_head suspend_filters, suspend_writers, suspend_modules;
+
+extern void prepare_console_modules(void);
+extern void cleanup_console_modules(void);
+
+extern struct suspend_module_ops *find_module_given_name(char *name);
+extern struct suspend_module_ops *get_next_filter(struct suspend_module_ops *);
+
+extern int suspend_register_module(struct suspend_module_ops *module);
+extern void suspend_move_module_tail(struct suspend_module_ops *module);
+
+extern unsigned long header_storage_for_modules(void);
+extern unsigned long memory_for_modules(void);
+
+extern int print_module_debug_info(char *buffer, int buffer_size);
+extern int suspend_register_module(struct suspend_module_ops *module);
+extern void suspend_unregister_module(struct suspend_module_ops *module);
+
+extern int suspend2_initialise_modules(int starting_cycle);
+extern void suspend2_cleanup_modules(int finishing_cycle);
+
+int suspend2_get_modules(void);
+void suspend2_put_modules(void);
+
+static inline void suspend_initialise_module_lists(void) {
+	INIT_LIST_HEAD(&suspend_filters);
+	INIT_LIST_HEAD(&suspend_writers);
+	INIT_LIST_HEAD(&suspend_modules);
+}
+
+extern int expected_compression_ratio(void);
Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#4 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Quoted 4 lines · Nigel Cunningham
kernel/power/modules.h new file +1 -0
 
+struct module_header {

[snip]

Quoted 1 line

+extern int num_modules, num_writers;

[snip]

Quoted 1 line

+extern struct suspend_module_ops *active_writer;

[snip]

kernel/power/modules.h line 152

Quoted 2 lines
kernel/power/modules.h new file +2 -0
+extern void prepare_console_modules(void);
+extern void cleanup_console_modules(void);

[snip, snip]

kernel/power/modules.h line 163

Quoted 4 lines
kernel/power/modules.h new file +4 -0
+extern unsigned long header_storage_for_modules(void);
+extern unsigned long memory_for_modules(void);
+
+extern int print_module_debug_info(char *buffer, int buffer_size);

Suspend prefix for the names of all of the above please? They're confusing with kernel/module.c now.

kernel/power/modules.h line 171

Quoted 8 lines
kernel/power/modules.h new file +8 -0
+extern int suspend_register_module(struct suspend_module_ops *module);
+extern void suspend_unregister_module(struct suspend_module_ops *module);
+
+extern int suspend2_initialise_modules(int starting_cycle);
+extern void suspend2_cleanup_modules(int finishing_cycle);
+
+int suspend2_get_modules(void);
+void suspend2_put_modules(void);

I think we can call these suspend_{get|set}_modules instead i.e. without the extra '2'.

kernel/power/modules.h line 177

Quoted 6 lines
kernel/power/modules.h new file +6 -0
+
+static inline void suspend_initialise_module_lists(void) {
+       INIT_LIST_HEAD(&suspend_filters);
+       INIT_LIST_HEAD(&suspend_writers);
+       INIT_LIST_HEAD(&suspend_modules);
+}

I couldn't find a user for this. I would imagine there's only one, though, and this should be inlined there?

Pekka

#5 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi.

Quoted 21 lines · Pekka Enberg
Quoted 4 lines · Nigel Cunningham
kernel/power/modules.h new file +1 -0
 
+struct module_header {

[snip]

Quoted 1 line

+extern int num_modules, num_writers;

[snip]

Quoted 1 line

+extern struct suspend_module_ops *active_writer;

[snip]

kernel/power/modules.h line 152

Quoted 2 lines
kernel/power/modules.h new file +2 -0
+extern void prepare_console_modules(void);
+extern void cleanup_console_modules(void);

[snip, snip]

Quoted 7 lines

kernel/power/modules.h line 163

Quoted 4 lines
kernel/power/modules.h new file +4 -0
+extern unsigned long header_storage_for_modules(void);
+extern unsigned long memory_for_modules(void);
+
+extern int print_module_debug_info(char *buffer, int buffer_size);

Suspend prefix for the names of all of the above please? They're confusing with kernel/module.c now.

Fair enough. Will do.

Quoted 11 lines

kernel/power/modules.h line 171

Quoted 8 lines
kernel/power/modules.h new file +2 -0
+extern int suspend_register_module(struct suspend_module_ops *module);
+extern void suspend_unregister_module(struct suspend_module_ops

*module); +

kernel/power/modules.h new file +5 -0
+extern int suspend2_initialise_modules(int starting_cycle);
+extern void suspend2_cleanup_modules(int finishing_cycle);
+
+int suspend2_get_modules(void);
+void suspend2_put_modules(void);

I think we can call these suspend_{get|set}_modules instead i.e. without the extra '2'.

I wanted to avoid confusion with similar routine names Pavel might use. For example, he has a resume_setup and I have a resume2_setup.

Quoted 9 lines

kernel/power/modules.h line 177

Quoted 6 lines
kernel/power/modules.h new file +6 -0
+
+static inline void suspend_initialise_module_lists(void) {
+       INIT_LIST_HEAD(&suspend_filters);
+       INIT_LIST_HEAD(&suspend_writers);
+       INIT_LIST_HEAD(&suspend_modules);
+}

I couldn't find a user for this. I would imagine there's only one, though, and this should be inlined there?

Ok.

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Quoted 2 lines · Pekka Enberg
Quoted 2 lines

I think we can call these suspend_{get|set}_modules instead i.e. without the extra '2'.

Quoted 2 lines · Nigel Cunningham

I wanted to avoid confusion with similar routine names Pavel might use. For example, he has a resume_setup and I have a resume2_setup.

Is that necessary for the mainline, though? We have only one suspend in the kernel, not "Pavel suspend" and "Nigel suspend", right?

Pekka

#7 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi.

Quoted 10 lines · Pekka Enberg
Quoted 2 lines · Pekka Enberg
Quoted 2 lines

I think we can call these suspend_{get|set}_modules instead i.e. without the extra '2'.

Quoted 2 lines · Nigel Cunningham

I wanted to avoid confusion with similar routine names Pavel might use. For example, he has a resume_setup and I have a resume2_setup.

Is that necessary for the mainline, though? We have only one suspend in the kernel, not "Pavel suspend" and "Nigel suspend", right?

Well, I'd love that to be true, but I don't believe Pavel's going to roll over and say "Ok Nigel. You've got a better implementation. I'll submit patches to remove mine." I might be wrong, and I hope I will be, but I fear they're going to coexist for a while.

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
#8 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi,

Quoted 9 lines · Nigel Cunningham
Quoted 8 lines · Pekka Enberg
Quoted 2 lines · Pekka Enberg
Quoted 2 lines

I think we can call these suspend_{get|set}_modules instead i.e. without the extra '2'.

Quoted 2 lines · Nigel Cunningham

I wanted to avoid confusion with similar routine names Pavel might use. For example, he has a resume_setup and I have a resume2_setup.

Quoted 7 lines
Quoted 2 lines

Is that necessary for the mainline, though? We have only one suspend in the kernel, not "Pavel suspend" and "Nigel suspend", right?

Well, I'd love that to be true, but I don't believe Pavel's going to roll over and say "Ok Nigel. You've got a better implementation. I'll submit patches to remove mine." I might be wrong, and I hope I will be, but I fear they're going to coexist for a while.

First, your code introduces many changes in many parts of the kernel, so to merge it you'll have to ask many people for acceptance.

Second, swsusp is actively developed, not only by Pavel, and you know that, so you could be nicer. ;-)

Still our approach is quite different to yours. We are focused on keepeing the code possibly simple and non-intrusive wrt the other parts of the kernel, whereas you seem to concentrate on features (which is not wrong, IMO, it's just a different point of view). We're moving towards the implementation of the features like the system image compression and encryption, graphical progress meters etc. in the user space, which has some advantages, and I think this approach is correct for a laptop/desktop system.

Its limitation , however, is that it requires a lot of memory for the system memory snapshot which may be impractical for systems with limited RAM, and that's where your solution may be required.

In conclusion, I see the room for both, as long as the do not conflict, so could we please bury the hatched and start working _together_?

Greetings,
Rafael

#9 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi Rafael.

Quoted 7 lines · Rafael J. Wysocki
Quoted 4 lines

Well, I'd love that to be true, but I don't believe Pavel's going to roll over and say "Ok Nigel. You've got a better implementation. I'll submit patches to remove mine." I might be wrong, and I hope I will be, but I fear they're going to coexist for a while.

First, your code introduces many changes in many parts of the kernel, so to merge it you'll have to ask many people for acceptance.

I really must work harder to get rid of that perception. It used to be the case, but isn't nowadays. Just about all of suspend2's changes are new files in kernel/power and include/<arch>/suspend2.h. The remainder are misc fixes, and enhancements like Christoph's todo list.

Quoted 2 lines

Second, swsusp is actively developed, not only by Pavel, and you know that, so you could be nicer. ;-)

It was hardly touched for a long time, but that has certainly been changing in the last few months. I wasn't meaning to be uncharitable. Sorry for giving that impression.

Quoted 10 lines

Still our approach is quite different to yours. We are focused on keepeing the code possibly simple and non-intrusive wrt the other parts of the kernel, whereas you seem to concentrate on features (which is not wrong, IMO, it's just a different point of view). We're moving towards the implementation of the features like the system image compression and encryption,
graphical progress meters etc. in the user space, which has some advantages, and I think this approach is correct for a laptop/desktop system.

Quoted 3 lines

Its limitation , however, is that it requires a lot of memory for the system memory snapshot which may be impractical for systems with limited RAM, and that's where your solution may be required.

I'm more concerned about the security implications. I'll freely admit that I haven't spent any real time looking at your code, but I'm concerned that the additional functionality made available could be used by viruses and the like. I'm sure you'd have to be root to do anything, but how could the interfaces be misused?

Quoted 2 lines

In conclusion, I see the room for both, as long as the do not conflict, so could we please bury the hatched and start working _together_?

I didn't realise I was holding one :). I'm not sure that I agree that there's a need for both, but I have no desire whatsoever to act an any sort of nasty way. All I want is to help provide Linux users with stable, reliable, flexible and fast suspend-to-disk functionality.

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
#10 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi!

Quoted 14 lines
Quoted 10 lines

Still our approach is quite different to yours. We are focused on keepeing the code possibly simple and non-intrusive wrt the other parts of the kernel, whereas you seem to concentrate on features (which is not wrong, IMO, it's just a different point of view). We're moving towards the implementation of the features like the system image compression and encryption,
graphical progress meters etc. in the user space, which has some advantages, and I think this approach is correct for a laptop/desktop system.

Quoted 3 lines

Its limitation , however, is that it requires a lot of memory for the system memory snapshot which may be impractical for systems with limited RAM, and that's where your solution may be required.

Quoted 5 lines

I'm more concerned about the security implications. I'll freely admit that I haven't spent any real time looking at your code, but I'm concerned that the additional functionality made available could be used by viruses and the like. I'm sure you'd have to be root to do anything, but how could the interfaces be misused?

In vanilla kernel userland suspend has no security implications: root can just do what he wants in /dev/mem, anyway.

In fedora kernel, userland suspend can be [miss]used to snapshot an image, modify it, and write it back. Fortunately, this is going to take *long* time so people will notice. [Interface changed on DaveJ's request, now we have separate device, we no longer mess with /dev/mem]. And similar problem exists in suspend2 -- malicious graphical progress bar could probably modify memory image on disk.

Quoted 7 lines
Quoted 2 lines

In conclusion, I see the room for both, as long as the do not conflict, so could we please bury the hatched and start working _together_?

I didn't realise I was holding one :). I'm not sure that I agree that there's a need for both, but I have no desire whatsoever to act an any sort of nasty way. All I want is to help provide Linux users with stable, reliable, flexible and fast suspend-to-disk functionality.

Please take a look at current -mm series. It has everything neccessary for your goals.
Pavel

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi.

Quoted 8 lines · Pavel Machek
Quoted 5 lines

I'm more concerned about the security implications. I'll freely admit that I haven't spent any real time looking at your code, but I'm concerned that the additional functionality made available could be used by viruses and the like. I'm sure you'd have to be root to do anything, but how could the interfaces be misused?

In vanilla kernel userland suspend has no security implications: root can just do what he wants in /dev/mem, anyway.

Ok.

Quoted 6 lines

In fedora kernel, userland suspend can be [miss]used to snapshot an image, modify it, and write it back. Fortunately, this is going to take *long* time so people will notice. [Interface changed on DaveJ's request, now we have separate device, we no longer mess with /dev/mem]. And similar problem exists in suspend2 -- malicious graphical progress bar could probably modify memory image on disk.

How? It's just an ordinary process with no special permissions or access to memory. The communication between the userspace process and the kernel is in the form of a netlink socket, with the only messages sent back and forth being what should be displayed or what actions the user requested. Everything related to preparing the image and performing the I/O is done in the kernel. There's no way I can see that a malicious userspace program could modify anything but its own memory.

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
#12 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi!

Quoted 18 lines
Quoted 8 lines
Quoted 5 lines

I'm more concerned about the security implications. I'll freely admit that I haven't spent any real time looking at your code, but I'm concerned that the additional functionality made available could be used by viruses and the like. I'm sure you'd have to be root to do anything, but how could the interfaces be misused?

In vanilla kernel userland suspend has no security implications: root can just do what he wants in /dev/mem, anyway.

Ok.

Quoted 6 lines

In fedora kernel, userland suspend can be [miss]used to snapshot an image, modify it, and write it back. Fortunately, this is going to take *long* time so people will notice. [Interface changed on DaveJ's request, now we have separate device, we no longer mess with /dev/mem]. And similar problem exists in suspend2 -- malicious graphical progress bar could probably modify memory image on disk.

Quoted 7 lines

How? It's just an ordinary process with no special permissions or access to memory. The communication between the userspace process and the kernel is in the form of a netlink socket, with the only messages sent back and forth being what should be displayed or what actions the user requested. Everything related to preparing the image and performing the I/O is done in the kernel. There's no way I can see that a malicious userspace program could modify anything but its own memory.

Fedora people have some "interesting" ideas about security. They want to prevent userland to modify kernel memory, root or not. AFAICS progress bar helper could access kernel memory while it is on disk, then wait for resume to pick up the modifications.
Pavel

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi.

Quoted 28 lines · Pavel Machek

Hi!

Quoted 18 lines
Quoted 8 lines
Quoted 5 lines

I'm more concerned about the security implications. I'll freely admit that I haven't spent any real time looking at your code, but I'm concerned that the additional functionality made available could be used by viruses and the like. I'm sure you'd have to be root to do anything, but how could the interfaces be misused?

In vanilla kernel userland suspend has no security implications: root can just do what he wants in /dev/mem, anyway.

Ok.

Quoted 6 lines

In fedora kernel, userland suspend can be [miss]used to snapshot an image, modify it, and write it back. Fortunately, this is going to take *long* time so people will notice. [Interface changed on DaveJ's request, now we have separate device, we no longer mess with /dev/mem]. And similar problem exists in suspend2 -- malicious graphical progress bar could probably modify memory image on disk.

Quoted 7 lines

How? It's just an ordinary process with no special permissions or access to memory. The communication between the userspace process and the kernel is in the form of a netlink socket, with the only messages sent back and forth being what should be displayed or what actions the user requested. Everything related to preparing the image and performing the I/O is done in the kernel. There's no way I can see that a malicious userspace program could modify anything but its own memory.

Quoted 4 lines

Fedora people have some "interesting" ideas about security. They want to prevent userland to modify kernel memory, root or not. AFAICS progress bar helper could access kernel memory while it is on disk, then wait for resume to pick up the modifications.

Hi again.

Maybe I'm just being thick, but I don't see what you mean by "progress bar helper could access kernel memory while it is on disk". I suppose it could potentially be given some means of writing directly to the disk that bypassed filesystem code (remember that filesystems are frozen), but even if it could overwrite a page of the image, most Suspend2 users compress the image, and the corruption would be detected at resume time because the data wouldn't decompress properly. The hypothetical malicious program wouldn't be able to assume that blocks are page aligned, or that a particular compression method was used. Encryption might also be used, and that could be using any of the cryptoapi modules in any valid configuration.

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
#14 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi!

Quoted 20 lines
Quoted 15 lines
Quoted 7 lines
Quoted 6 lines

In fedora kernel, userland suspend can be [miss]used to snapshot an image, modify it, and write it back. Fortunately, this is going to take *long* time so people will notice. [Interface changed on DaveJ's request, now we have separate device, we no longer mess with /dev/mem]. And similar problem exists in suspend2 -- malicious graphical progress bar could probably modify memory image on disk.

Quoted 7 lines

How? It's just an ordinary process with no special permissions or access to memory. The communication between the userspace process and the kernel is in the form of a netlink socket, with the only messages sent back and forth being what should be displayed or what actions the user requested. Everything related to preparing the image and performing the I/O is done in the kernel. There's no way I can see that a malicious userspace program could modify anything but its own memory.

Quoted 4 lines

Fedora people have some "interesting" ideas about security. They want to prevent userland to modify kernel memory, root or not. AFAICS progress bar helper could access kernel memory while it is on disk, then wait for resume to pick up the modifications.

Quoted 7 lines

Hi again.

Maybe I'm just being thick, but I don't see what you mean by "progress bar helper could access kernel memory while it is on disk". I suppose it could potentially be given some means of writing directly to the disk that bypassed filesystem code (remember that filesystems are frozen), but even if it could overwrite a page of the image, most Suspend2 users compress the image, and

...yep, I said that fedora people have ""interesting"" ideas about security :-).
Pavel

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

In reply to Nigel Cunningham

Hi Nigel,

Quoted 6 lines · Nigel Cunningham
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines

Well, I'd love that to be true, but I don't believe Pavel's going to roll over and say "Ok Nigel. You've got a better implementation. I'll submit patches to remove mine." I might be wrong, and I hope I will be, but I fear they're going to coexist for a while.

Quoted 7 lines
Quoted 2 lines

First, your code introduces many changes in many parts of the kernel, so to merge it you'll have to ask many people for acceptance.

I really must work harder to get rid of that perception. It used to be the case, but isn't nowadays. Just about all of suspend2's changes are new files in kernel/power and include/<arch>/suspend2.h. The remainder are misc fixes, and enhancements like Christoph's todo list.

Well, in your previous series of patches there are examples to the contrary, like the changes to kthread_create() or workqueues. They would require an ack from the maintainers of that code, at least.

Also, you probably need some changes in the arch code. If that is so, the maintainers of relevant architectures should be asked.

That already is "many".

Quoted 6 lines
Quoted 2 lines

Second, swsusp is actively developed, not only by Pavel, and you know that, so you could be nicer. ;-)

It was hardly touched for a long time, but that has certainly been changing in the last few months. I wasn't meaning to be uncharitable. Sorry for giving that impression.

Accepted. :-)

Quoted 14 lines
Quoted 10 lines

Still our approach is quite different to yours. We are focused on keepeing the code possibly simple and non-intrusive wrt the other parts of the kernel, whereas you seem to concentrate on features (which is not wrong, IMO, it's just a different point of view). We're moving towards the implementation of the features like the system image compression and encryption,
graphical progress meters etc. in the user space, which has some advantages, and I think this approach is correct for a laptop/desktop system.

Quoted 3 lines

Its limitation , however, is that it requires a lot of memory for the system memory snapshot which may be impractical for systems with limited RAM, and that's where your solution may be required.

Quoted 5 lines

I'm more concerned about the security implications. I'll freely admit that I haven't spent any real time looking at your code, but I'm concerned that the additional functionality made available could be used by viruses and the like. I'm sure you'd have to be root to do anything, but how could the interfaces be misused?

In not many ways, really. Of course you can do a DoS with them, but need to be root to do this anyway.

Quoted 7 lines
Quoted 2 lines

In conclusion, I see the room for both, as long as the do not conflict, so could we please bury the hatched and start working _together_?

I didn't realise I was holding one :). I'm not sure that I agree that there's a need for both, but I have no desire whatsoever to act an any sort of nasty way. All I want is to help provide Linux users with stable, reliable, flexible and fast suspend-to-disk functionality.

That's fine. :-)

Obviously both solutions are used, so they both seem to be needed.

Greetings,
Rafael

#16 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi.

Quoted 11 lines · Rafael J. Wysocki
Quoted 7 lines
Quoted 2 lines

First, your code introduces many changes in many parts of the kernel, so to merge it you'll have to ask many people for acceptance.

I really must work harder to get rid of that perception. It used to be the case, but isn't nowadays. Just about all of suspend2's changes are new files in kernel/power and include/<arch>/suspend2.h. The remainder are misc fixes, and enhancements like Christoph's todo list.

Well, in your previous series of patches there are examples to the contrary, like the changes to kthread_create() or workqueues. They would require an ack from the maintainers of that code, at least.

That's not Suspend2 itself, but rather improvements to the freezer that are logically distinct and would be useful to swsusp too. That said, if the work you guys have done in the last couple of days gets merged, perhaps I'll drop most of it and just do the bdev freezing instead of sys_syncing, at least to check reliability.

Quoted 4 lines

Also, you probably need some changes in the arch code. If that is so, the maintainers of relevant architectures should be asked.

That already is "many".

No. I have a little cleaning up still to do there, but the current arch specific patches are all: 1) adding suspend2.h; 2) old modifications that can be cleaned up 3) the odd new routine (eg a page_is_ram function for amd64).

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
#17 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi,

Quoted 9 lines · Nigel Cunningham
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines
Quoted 2 lines

First, your code introduces many changes in many parts of the kernel, so to merge it you'll have to ask many people for acceptance.

I really must work harder to get rid of that perception. It used to be the case, but isn't nowadays. Just about all of suspend2's changes are new files in kernel/power and include/<arch>/suspend2.h. The remainder are misc fixes, and enhancements like Christoph's todo list.

Quoted 7 lines
Quoted 3 lines

Well, in your previous series of patches there are examples to the contrary, like the changes to kthread_create() or workqueues. They would require an ack from the maintainers of that code, at least.

That's not Suspend2 itself, but rather improvements to the freezer that are logically distinct and would be useful to swsusp too. That said, if the work you guys have done in the last couple of days gets merged,

I hope so.

Quoted 2 lines

perhaps I'll drop most of it and just do the bdev freezing instead of sys_syncing, at least to check reliability.

Well, I must admit I haven't read your bdevs-freezing patch, mostly due to limited time, but in principle I'm not against it.

Quoted 8 lines
Quoted 4 lines

Also, you probably need some changes in the arch code. If that is so, the maintainers of relevant architectures should be asked.

That already is "many".

No. I have a little cleaning up still to do there, but the current arch specific patches are all: 1) adding suspend2.h; 2) old modifications that can be cleaned up 3) the odd new routine (eg a page_is_ram function for amd64).

If that is so, fine. As I said before, as far as I'm concerned both solutions can coexist as long as they don't conflict.

Greetings,
Rafael

#18 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

In reply to Rafael J. Wysocki

Hi!

Quoted 3 lines

Its limitation , however, is that it requires a lot of memory for the system memory snapshot which may be impractical for systems with limited RAM, and that's where your solution may be required.

Actually, suspend2 has similar limitation. It still needs half a memory free, but it does not count caches into that as it can save them separately.

That means that on certain small systems (32MB RAM?), suspend2 is going to have big advantage of responsivity after resume. But on the systems where [u]swsusp can't suspend (6MB RAM?), suspend2 is not going to be able to suspend, either. [Roughly; due to bugs and implementation differences there may be some system size where one works and second one does not, but they are pretty similar]

But that's probably not a problem as it is only going to fail on *very* small system. Desktops with 6MB RAM are not too common these days, fortunately. Not even in embedded space.
Pavel

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi.

Quoted 17 lines · Pavel Machek

Hi!

Quoted 3 lines

Its limitation , however, is that it requires a lot of memory for the system memory snapshot which may be impractical for systems with limited RAM, and that's where your solution may be required.

Actually, suspend2 has similar limitation. It still needs half a memory free, but it does not count caches into that as it can save them separately.

That means that on certain small systems (32MB RAM?), suspend2 is going to have big advantage of responsivity after resume. But on the systems where [u]swsusp can't suspend (6MB RAM?), suspend2 is not going to be able to suspend, either. [Roughly; due to bugs and implementation differences there may be some system size where one works and second one does not, but they are pretty similar]

Quoted 3 lines

But that's probably not a problem as it is only going to fail on *very* small system. Desktops with 6MB RAM are not too common these days, fortunately. Not even in embedded space.

Fully agree.

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
#20 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

In reply to Pavel Machek

Hi,

Quoted 7 lines · Pavel Machek
Quoted 3 lines

Its limitation , however, is that it requires a lot of memory for the system memory snapshot which may be impractical for systems with limited RAM, and that's where your solution may be required.

Actually, suspend2 has similar limitation. It still needs half a memory free, but it does not count caches into that as it can save them separately.

I didn't know that. [If that is the case, I wonder what Nigel means by the "whole memory image". Nigel?]

Quoted 6 lines

That means that on certain small systems (32MB RAM?), suspend2 is going to have big advantage of responsivity after resume. But on the systems where [u]swsusp can't suspend (6MB RAM?), suspend2 is not going to be able to suspend, either. [Roughly; due to bugs and implementation differences there may be some system size where one works and second one does not, but they are pretty similar]

Generally speaking, my perception is that suspend2 may be preferrable below 256 MB of RAM. Moreover there are some people who seem to prefer entirely kernel-based suspend, and I'm not going to develop the code in swap.c and disk.c any further (of course with the exception of bugfixes etc.). Nigel has done it already so perhaps there is a room for his code, too, _provided_ _that_ it is accepted.

Greetings,
Rafael

#21 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi.

Quoted 7 lines · Rafael J. Wysocki

Hi,

Quoted 4 lines · Pavel Machek
Quoted 3 lines

Its limitation , however, is that it requires a lot of memory for the system memory snapshot which may be impractical for systems with limited RAM, and that's where your solution may be required.

Quoted 6 lines
Quoted 3 lines

Actually, suspend2 has similar limitation. It still needs half a memory free, but it does not count caches into that as it can save them separately.

I didn't know that. [If that is the case, I wonder what Nigel means by the "whole memory image". Nigel?]

The LRU almost always easily accounts for more 50% of memory in use. Suspend2 writes LRU pages to disk, then uses those pages to store the atomic copy of the remainder of memory. That's how I overcome the 50% problem and still really do get a full image of memory. If the LRU is smaller than the remainder of memory in use, we allocate extra memory if possible. If that still doesn't give enough memory for the atomic copy, we seek to free memory until that constraint is satisfied. If we free everything we can, and still can't satisfy that constraint, we give up and return control to the user. In 99% of the cases, however, no freeing of memory is required and the user really can get a full image of memory saved.

Quoted 7 lines
Quoted 6 lines

That means that on certain small systems (32MB RAM?), suspend2 is going to have big advantage of responsivity after resume. But on the systems where [u]swsusp can't suspend (6MB RAM?), suspend2 is not going to be able to suspend, either. [Roughly; due to bugs and implementation differences there may be some system size where one works and second one does not, but they are pretty similar]

Quoted 6 lines

Generally speaking, my perception is that suspend2 may be preferrable below 256 MB of RAM. Moreover there are some people who seem to prefer entirely kernel-based suspend, and I'm not going to develop the code in swap.c and disk.c any further (of course with the exception of bugfixes etc.). Nigel has done it already so perhaps there is a room for his code, too, _provided_ _that_ it is accepted.

All of the machines I regularly use have 512M+ of memory. Suspend2 is definitely preferable on them because I've worked hard to maximise I/O throughput. Last time I measured swsusp throughput, it was 16MB/s on my old Omnibook. Suspend2 achieved ~25MB writing and 50MB/s reading when using LZF compression (933 Celeron), or the 35MB/s uncompressed (the maximum throughput that could be achieved according to tools like hdparm -t) on the same system. With the same drive in my new laptop (amd64 M34), I get ~70MB/s read/write (depending on cpufreq settings). My 3G P4s at work and home do about 70 (w)/110(r) MB/s. (All of this is using LZF compression).

Regards,

Nigel

Quoted 7 lines

Greetings,
Rafael
-
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/

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi,

Quoted 13 lines · Nigel Cunningham
Quoted 11 lines · Rafael J. Wysocki
Quoted 7 lines · Pavel Machek
Quoted 3 lines

Its limitation , however, is that it requires a lot of memory for the system memory snapshot which may be impractical for systems with limited RAM, and that's where your solution may be required.

Actually, suspend2 has similar limitation. It still needs half a memory free, but it does not count caches into that as it can save them separately.

I didn't know that. [If that is the case, I wonder what Nigel means by the "whole memory image". Nigel?]

Quoted 10 lines

The LRU almost always easily accounts for more 50% of memory in use. Suspend2 writes LRU pages to disk, then uses those pages to store the atomic copy of the remainder of memory. That's how I overcome the 50% problem and still really do get a full image of memory. If the LRU is smaller than the remainder of memory in use, we allocate extra memory if possible. If that still doesn't give enough memory for the atomic copy, we seek to free memory until that constraint is satisfied. If we free everything we can, and still can't satisfy that constraint, we give up and return control to the user. In 99% of the cases, however, no freeing of memory is required and the user really can get a full image of memory saved.

Now that's clear to me. Thanks for the explanation.

Quoted 14 lines
Quoted 7 lines
Quoted 6 lines

That means that on certain small systems (32MB RAM?), suspend2 is going to have big advantage of responsivity after resume. But on the systems where [u]swsusp can't suspend (6MB RAM?), suspend2 is not going to be able to suspend, either. [Roughly; due to bugs and implementation differences there may be some system size where one works and second one does not, but they are pretty similar]

Quoted 6 lines

Generally speaking, my perception is that suspend2 may be preferrable below 256 MB of RAM. Moreover there are some people who seem to prefer entirely kernel-based suspend, and I'm not going to develop the code in swap.c and disk.c any further (of course with the exception of bugfixes etc.). Nigel has done it already so perhaps there is a room for his code, too, _provided_ _that_ it is accepted.

Quoted 9 lines

All of the machines I regularly use have 512M+ of memory. Suspend2 is definitely preferable on them because I've worked hard to maximise I/O throughput. Last time I measured swsusp throughput, it was 16MB/s on my old Omnibook. Suspend2 achieved ~25MB writing and 50MB/s reading when using LZF compression (933 Celeron), or the 35MB/s uncompressed (the maximum throughput that could be achieved according to tools like hdparm -t) on the same system. With the same drive in my new laptop (amd64 M34), I get ~70MB/s read/write (depending on cpufreq settings). My 3G P4s at work and home do about 70 (w)/110(r) MB/s. (All of this is using LZF compression).

I was referring to the (not so far) future situation when we have compression in the userland suspend/resume utilities. The times of writing/reading the image will be similar to yours and IMHO it's usually possible to free 1/2 of RAM in a box with 512+ MB of RAM at a little cost as far as the responsiveness after resume is concerned. Thus on machines with 512+ MB of RAM both solutions will give similar results performance-wise, but the userland-driven suspend gives you much more flexibility wrt what you can do with the image (eg. you can even send it over the network if need be).

On machines with less RAM suspend2 will probably be better preformance-wise, and that may be more important than the flexibility.

Greetings,
Rafael

#23 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi.

Quoted 10 lines · Rafael J. Wysocki

I was referring to the (not so far) future situation when we have compression in the userland suspend/resume utilities. The times of writing/reading the image will be similar to yours and IMHO it's usually possible to free 1/2 of RAM in a box with 512+ MB of RAM at a little cost as far as the responsiveness after resume is concerned. Thus on machines with 512+ MB of RAM
both solutions will give similar results performance-wise, but the userland-driven suspend gives you much more flexibility wrt what you can do with the image (eg. you can even send it over the network if need be).

Quoted 2 lines

On machines with less RAM suspend2 will probably be better preformance-wise, and that may be more important than the flexibility.

Ok. So I bit the bullet and downloaded -mm4 to take a look at this interface you're making, and I have a few questions:

- It seems to be hardwired to use swap, but you talk about writing to a network image above. In Suspend2, I just bmap whatever the storage is, and then submit bios to read and write the data. Is anything like that possible with this interface? (Could it be extended if not?)
- Is there any way you could support doing a full image of memory with this approach? Would you take patches?
- Does the data have to be transferred to userspace? Security and efficiency wise, it would seem to make a lot more sense just to be telling the kernel where to write things and let it do bio calls like I'm doing at the moment.
- In your Documentation file, you say say opening /dev/snapshot for reading is done when suspending. Shouldn't that be open read for resume and write for suspend?

I'm not saying I'm going to get carried away trying to port Suspend2 to userspace. Just tentatively exploring. But if I did decide to port it, my default position would be to seek not to drop a single feature. I hope that's not too unreasonable!

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
#24 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi,

Quoted 14 lines · Nigel Cunningham
Quoted 10 lines · Rafael J. Wysocki

I was referring to the (not so far) future situation when we have compression in the userland suspend/resume utilities. The times of writing/reading the image will be similar to yours and IMHO it's usually possible to free 1/2 of RAM in a box with 512+ MB of RAM at a little cost as far as the responsiveness after resume is concerned. Thus on machines with 512+ MB of RAM
both solutions will give similar results performance-wise, but the userland-driven suspend gives you much more flexibility wrt what you can do with the image (eg. you can even send it over the network if need be).

Quoted 2 lines

On machines with less RAM suspend2 will probably be better preformance-wise, and that may be more important than the flexibility.

Quoted 7 lines

Ok. So I bit the bullet and downloaded -mm4 to take a look at this interface you're making, and I have a few questions:

- It seems to be hardwired to use swap, but you talk about writing to a network image above. In Suspend2, I just bmap whatever the storage is, and then submit bios to read and write the data. Is anything like that possible with this interface? (Could it be extended if not?)

The swap partition was easy. :-) However, there is the bmap() call that userspace processes can use, so it seems to be possible. [BTW, the network is easy too, because it desn't require us to tamper with disks while suspended.]

Quoted 2 lines

- Is there any way you could support doing a full image of memory with this approach?

I'm not sure, but I think that's possible. For now I don't see major obstacles, but honestly I'll have to read your code (and understand it) to answer this question responsibly.

Quoted 1 line

Would you take patches?

Well, the code in question is already in the kernel (in -mm, but this doesn't matter here) and I'm not the maintainer of it, so I can't answer this question directly. However, if you asked me whether I would _support_ any patches, I would say I had never opposed or supported a patch whithout trying to understand it.

When I think I understand the patch, I try to value it, and I have two rules here:
1) The released code should always be functional. [So I never submit untested patches without saying explicitly that they are untested and if I replace some code A with alternative code B, I do my best to ensure it won't break any existing setups.]
2) The software with this patch applied must be such that I would like to run it on my computer. [If I wouldn't, there's no chance I'll support it.]

Quoted 3 lines

- Does the data have to be transferred to userspace? Security and efficiency wise, it would seem to make a lot more sense just to be telling the kernel where to write things and let it do bio calls like I'm doing at the moment.

First, there's a difference between efficiency and performance.

For example, the kernel already contains the code for writing data to the disk or partition you are using for suspend. By using bio directly to write to it you're duplicating the functionality of that code which is _inefficient_, although this need not be related to performance. Worse yet, if some optimizations go to this code, you won't have them unless you notice and implement them once again.

Similar observation applies to enryption and compression: There are libraries for encryption and compression that contain lots of different algorithms, so why should we try to duplicate that code? It is more efficient to _use_ it, which can be done easily in the user space.

This may hurt performance a bit, but usually not so far that anyone will notice. [Actually on my box the suspending and resuming userland utilities I use for testing perform the I/O-related operations _faster_ than the built-in swsusp code, although they seemingly do the same things.]

Second, as far as the security is concerned, the only problem I see is that a malicious attacker may be able to read unencrypted suspend image from the system or submit his own specially crafted image which would require root-equivalent access anyway. However to prevent this you can set whatever paranoid permissions you desire on /dev/snapshot and implement your suspending utility as a daemon running in a privileged security ring (the resume is run from and initrd anyway).

The biggest advantage of the userland-based approach I see is that there may be _many_ implementations of the suspending and resuming tools and they will not conflict. For example, if Distributor X needs an exotic feature Y wrt suspend (various vendor-specific eye-candies come to mind or transferring the image over a network), he can implement it in his userland tools without modifying the kernel. Similarly, if Vendor V wants to use paranoid encryption algorithm Z to encrypt the image, she can do that _herself_ in the user space.

We only need to provide reference tools and we won't be asked to implement every feature that people may want in the kernel.

Quoted 3 lines

- In your Documentation file, you say say opening /dev/snapshot for reading is done when suspending. Shouldn't that be open read for resume and write for suspend?

No. During suspend the image is read from the kernel and saved by a userland tool and analogously during resume.

Quoted 4 lines

I'm not saying I'm going to get carried away trying to port Suspend2 to userspace. Just tentatively exploring. But if I did decide to port it, my default position would be to seek not to drop a single feature. I hope that's not too unreasonable!

That's fine. I think we have the same goal which is a reasonable set of features available to the users.

[Heh, that looks like a good starter for the userland suspend FAQ. Perhaps I should save this message. ;-)]

Greetings,
Rafael

#25 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi.

Quoted 26 lines · Rafael J. Wysocki

Hi,

Quoted 15 lines · Nigel Cunningham
Quoted 11 lines · Rafael J. Wysocki

I was referring to the (not so far) future situation when we have compression in the userland suspend/resume utilities. The times of writing/reading the image will be similar to yours and IMHO it's usually possible to free 1/2 of RAM in a box with 512+ MB of RAM at a little cost as far as the responsiveness after resume is concerned. Thus on machines with 512+ MB of RAM
both solutions will give similar results performance-wise, but the userland-driven suspend gives you much more flexibility wrt what you can do with the image (eg. you can even send it over the network if need be).

Quoted 2 lines

On machines with less RAM suspend2 will probably be better preformance-wise, and that may be more important than the flexibility.

Quoted 7 lines

Ok. So I bit the bullet and downloaded -mm4 to take a look at this interface you're making, and I have a few questions:

- It seems to be hardwired to use swap, but you talk about writing to a network image above. In Suspend2, I just bmap whatever the storage is, and then submit bios to read and write the data. Is anything like that possible with this interface? (Could it be extended if not?)

Quoted 4 lines

The swap partition was easy. :-) However, there is the bmap() call that userspace processes can use, so it seems to be possible. [BTW, the network is easy too, because it desn't require us to tamper with disks while suspended.]

Yes. I already did suspend to network last March, but haven't spent more time on it since - it wasn't working perfectly, but it was working using a modified userspace nbd client.

Quoted 6 lines
Quoted 2 lines

- Is there any way you could support doing a full image of memory with this approach?

I'm not sure, but I think that's possible. For now I don't see major obstacles, but honestly I'll have to read your code (and understand it) to answer this question responsibly.

Ditto in reverse. I have to admit I'm still struggling to see what the advantage to userspace is. At the moment, it seems to me like nothing more than an extra layer of complexity and new possibilities for failure. Maybe my attitude will change when I look at it more.

Quoted 8 lines
Quoted 1 line

Would you take patches?

Well, the code in question is already in the kernel (in -mm, but this doesn't matter here) and I'm not the maintainer of it, so I can't answer this question directly. However, if you asked me whether I would _support_ any patches, I would say I had never opposed or supported a patch whithout trying to understand it.

Quoted 8 lines

When I think I understand the patch, I try to value it, and I have two rules here:
1) The released code should always be functional. [So I never submit untested patches without saying explicitly that they are untested and if I replace some code A with alternative code B, I do my best to ensure it won't break any existing setups.]
2) The software with this patch applied must be such that I would like to run it on my computer. [If I wouldn't, there's no chance I'll support it.]

No problems there. I only reboot when forced to, and suspend to disk by default (or to put it another way, I eat my own dog food).

Quoted 14 lines
Quoted 4 lines

- Does the data have to be transferred to userspace? Security and efficiency wise, it would seem to make a lot more sense just to be telling the kernel where to write things and let it do bio calls like I'm doing at the moment.

First, there's a difference between efficiency and performance.

For example, the kernel already contains the code for writing data to the disk or partition you are using for suspend. By using bio directly to write to it you're duplicating the functionality of that code which is _inefficient_, although this need not be related to performance. Worse yet, if some optimizations go to this code, you won't have them unless you notice and implement them once again.

Quoted 4 lines

Similar observation applies to enryption and compression: There are libraries for encryption and compression that contain lots of different algorithms, so why should we try to duplicate that code? It is more efficient to _use_ it, which can be done easily in the user space.

That's why I want to use the existing bio calls and crypto api support. I don't use the swap read/write routines because... well I've forgotten the reason 3 years later. Let me take a guess though - using swap routines might corrupt LRU? One thing I do know is that the filewriter and swapwriter use the same code to do the writing. I'd be more accurate in calling them swap/file allocators now, as they really only calculate where to store the image (and associated functions).

Quoted 5 lines

This may hurt performance a bit, but usually not so far that anyone will notice. [Actually on my box the suspending and resuming userland utilities I use for testing perform the I/O-related operations _faster_ than the built-in swsusp code, although they seemingly do the same things.]

Strange.

Quoted 7 lines

Second, as far as the security is concerned, the only problem I see is that a malicious attacker may be able to read unencrypted suspend image from the system or submit his own specially crafted image which would require root-equivalent access anyway. However to prevent this you can set whatever paranoid permissions you desire on /dev/snapshot and implement your suspending utility as a daemon running in a privileged security ring (the resume is run from and initrd anyway).

True, and an unencrypted image on disk is as vulnerable as any other data on disk anyway.

Quoted 8 lines

The biggest advantage of the userland-based approach I see is that there may be _many_ implementations of the suspending and resuming tools and they will not conflict. For example, if Distributor X needs an exotic feature Y wrt suspend (various vendor-specific eye-candies come to mind or transferring the image over a network), he can implement it in his userland tools without modifying the kernel. Similarly, if Vendor V wants to use paranoid encryption algorithm Z to encrypt the image, she can do that _herself_ in the user space.

True, but can you really imagine people doing that? The one instance I can think of was the donation of LZF support to Suspend2 a couple of years back.

Quoted 2 lines

We only need to provide reference tools and we won't be asked to implement every feature that people may want in the kernel.

I don't want it to be true, but I think you're being naive in saying that :) We'll see, won't we?

Quoted 6 lines
Quoted 3 lines

- In your Documentation file, you say say opening /dev/snapshot for reading is done when suspending. Shouldn't that be open read for resume and write for suspend?

No. During suspend the image is read from the kernel and saved by a userland tool and analogously during resume.

Oh ok.

Quoted 10 lines
Quoted 4 lines

I'm not saying I'm going to get carried away trying to port Suspend2 to userspace. Just tentatively exploring. But if I did decide to port it, my default position would be to seek not to drop a single feature. I hope that's not too unreasonable!

That's fine. I think we have the same goal which is a reasonable set of features available to the users.

[Heh, that looks like a good starter for the userland suspend FAQ. Perhaps I should save this message. ;-)]

Thanks.

Nigel

Quoted 2 lines

Greetings,
Rafael

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi!

Quoted 13 lines · Nigel Cunningham
Quoted 11 lines · Rafael J. Wysocki
Quoted 1 line · Nigel Cunningham

On Friday 03 February 2006 08:10, Rafael J. Wysocki wrote:

The biggest advantage of the userland-based approach I see is that there may be _many_ implementations of the suspending and resuming tools and they will not conflict. For example, if Distributor X needs an exotic feature Y wrt suspend (various vendor-specific eye-candies come to mind or transferring the image over a network), he can implement it in his userland tools without modifying the kernel. Similarly, if Vendor V wants to use paranoid encryption algorithm Z to encrypt the image, she can do that _herself_ in the user space.

Quoted 3 lines

True, but can you really imagine people doing that? The one instance I can think of was the donation of LZF support to Suspend2 a couple of years back.

Yes, I expect them to do so. Desktop distros have different needs than for example embedded vendors, wanting to use swsusp for fast boot.

Quoted 5 lines
Quoted 2 lines

We only need to provide reference tools and we won't be asked to implement every feature that people may want in the kernel.

I don't want it to be true, but I think you're being naive in saying that :) We'll see, won't we?

I think I have a volunteer inside suse doing at least some of userland swsusp work.
Pavel

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

In reply to Nigel Cunningham
Quoted 8 lines · Nigel Cunningham

Hi.

Quoted 2 lines · Rafael J. Wysocki

On machines with less RAM suspend2 will probably be better preformance-wise, and that may be more important than the flexibility.

Ok. So I bit the bullet and downloaded -mm4 to take a look at this interface you're making, and I have a few questions:

Great, thanks.

Quoted 4 lines

- It seems to be hardwired to use swap, but you talk about writing to a network image above. In Suspend2, I just bmap whatever the storage is, and then submit bios to read and write the data. Is anything like that possible with this interface? (Could it be extended if not?)

No, it is not hardwired. There's special swap support, but you do not need to use it.

Quoted 2 lines

- Is there any way you could support doing a full image of memory with this approach? Would you take patches?

Doing full image is certainly possible; it is not important if kernel does the writing or userspace does it. Taking patches definitely depends how they'd look like...

Quoted 4 lines

- Does the data have to be transferred to userspace? Security and efficiency wise, it would seem to make a lot more sense just to be telling the kernel where to write things and let it do bio calls like I'm doing at the moment.

As far as I can see, transfering data to userspace and back does not really cost much:

pavel@amd:~$ time head -c $[1024*1024*1024] < /dev/zero > /dev/null
0.16user 0.27system 0.43 (0m0.439s) elapsed 100.00%CPU

...2000MB/sec is the limit (thinkpad x32).
Pavel

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi.

Quoted 20 lines · Pavel Machek
Quoted 8 lines · Nigel Cunningham

Hi.

Quoted 2 lines · Rafael J. Wysocki

On machines with less RAM suspend2 will probably be better preformance-wise, and that may be more important than the flexibility.

Ok. So I bit the bullet and downloaded -mm4 to take a look at this interface you're making, and I have a few questions:

Great, thanks.

Quoted 4 lines

- It seems to be hardwired to use swap, but you talk about writing to a network image above. In Suspend2, I just bmap whatever the storage is, and then submit bios to read and write the data. Is anything like that possible with this interface? (Could it be extended if not?)

No, it is not hardwired. There's special swap support, but you do not need to use it.

Quoted 6 lines
Quoted 2 lines

- Is there any way you could support doing a full image of memory with this approach? Would you take patches?

Doing full image is certainly possible; it is not important if kernel does the writing or userspace does it. Taking patches definitely depends how they'd look like...

Would you actually do some work on generating them? I'm concerned that I'm going to end up putting more work into making patches, only to have you nack them for (what seem to me like) arbitrary reasons. I feel like all you're doing at the moment is pouring cold water on my work. Seeing you put some work into making mileage from the work I've put into Suspend2 would encourage me a lot. Forgive me if I sound pretty negative - between a couple of months of humid weather, lack of sleep and the event of the last few weeks, I'm not in the best frame of mind at the moment. Perhaps it would be better for me just to say "I give full permission for you and Rafael to rip out of Suspend2 anything you find useful.", leave it at that and go find another hobby for a while.

Regards,

Nigel

Quoted 13 lines
Quoted 4 lines

- Does the data have to be transferred to userspace? Security and efficiency wise, it would seem to make a lot more sense just to be telling the kernel where to write things and let it do bio calls like I'm doing at the moment.

As far as I can see, transfering data to userspace and back does not really cost much:

pavel@amd:~$ time head -c $[1024*1024*1024] < /dev/zero > /dev/null
0.16user 0.27system 0.43 (0m0.439s) elapsed 100.00%CPU

...2000MB/sec is the limit (thinkpad x32).
Pavel

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi!

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

- Is there any way you could support doing a full image of memory with this approach? Would you take patches?

Doing full image is certainly possible; it is not important if kernel does the writing or userspace does it. Taking patches definitely depends how they'd look like...

Would you actually do some work on generating them?

Well, I'm afraid that full image of memory is not that high on priority list. Rafael's solution seems to work pretty much okay.

Quoted 5 lines

I'm concerned that I'm
going to end up putting more work into making patches, only to have you nack them for (what seem to me like) arbitrary reasons. I feel like all you're doing at the moment is pouring cold water on my work. Seeing you put some

Well, sorry about that. I thought I gave you fair warning at the end of last year, when I posted uswsusp patches to the lists...

Quoted 5 lines

work into making mileage from the work I've put into Suspend2 would encourage me a lot. Forgive me if I sound pretty negative - between a couple of months of humid weather, lack of sleep and the event of the last few weeks, I'm not in the best frame of mind at the moment. Perhaps it would be better for me

Well, you did some pretty amazing work with suspend2.net community...

Quoted 3 lines

just to say "I give full permission for you and Rafael to rip out of Suspend2 anything you find useful.", leave it at that and go find another hobby for a while.

We could use some help with userland tools. Helping with userland parts is probably the fastest way to get usable/nice/fast suspend to the users.

If you think suspend2 can be easily ported to userspace... yes, that would be useful/welcome.
Pavel

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

In reply to Pekka Enberg
Quoted 10 lines · Pekka Enberg
Quoted 2 lines · Pekka Enberg
Quoted 2 lines

I think we can call these suspend_{get|set}_modules instead i.e. without the extra '2'.

Quoted 2 lines · Nigel Cunningham

I wanted to avoid confusion with similar routine names Pavel might use. For example, he has a resume_setup and I have a resume2_setup.

Is that necessary for the mainline, though? We have only one suspend in the kernel, not "Pavel suspend" and "Nigel suspend", right?

Actually plan is to only have "Rafael suspend" :-). That's basically "Pavel suspend" minus the disk writing parts. That is *long* term.
Pavel

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi,

Quoted 2 lines · Pekka Enberg
Quoted 2 lines

Is that necessary for the mainline, though? We have only one suspend in the kernel, not "Pavel suspend" and "Nigel suspend", right?

Quoted 2 lines · Pavel Machek

Actually plan is to only have "Rafael suspend" :-). That's basically "Pavel suspend" minus the disk writing parts. That is *long* term.

So what's the plan for short-term? Are userspace suspend and suspend modules mutually exclusive or can they co-exist?

Pekka

#32 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi!

Quoted 10 lines · Pekka Enberg
Quoted 2 lines
Quoted 2 lines

Is that necessary for the mainline, though? We have only one suspend in the kernel, not "Pavel suspend" and "Nigel suspend", right?

Quoted 2 lines · Pavel Machek

Actually plan is to only have "Rafael suspend" :-). That's basically "Pavel suspend" minus the disk writing parts. That is *long* term.

So what's the plan for short-term? Are userspace suspend and suspend modules mutually exclusive or can they co-exist?

They can coexist for as long as neccessary. (At one point, it was even possible to suspend using userland code, then resume using kernel code :-).

When I found out noone is really using kernel code any more (2.8.0 or something), I'd like to get rid of it.
Pavel

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi,

Quoted 2 lines · Pekka Enberg
Quoted 2 lines

So what's the plan for short-term? Are userspace suspend and suspend modules mutually exclusive or can they co-exist?

Quoted 6 lines · Pavel Machek

They can coexist for as long as neccessary. (At one point, it was even possible to suspend using userland code, then resume using kernel code :-).

When I found out noone is really using kernel code any more (2.8.0 or something), I'd like to get rid of it.

So are you saying we should pursue merging Suspend2 bits in the mainline and deprecate it when userspace is mature enough and has all the same features? Seems counter-productive but then again I am mostly clueless of suspend issues.

Pekka

#34 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Quoted 11 lines · Pekka Enberg

Hi,

Quoted 2 lines · Pekka Enberg
Quoted 2 lines

So what's the plan for short-term? Are userspace suspend and suspend modules mutually exclusive or can they co-exist?

Quoted 4 lines · Pavel Machek

They can coexist for as long as neccessary. (At one point, it was even possible to suspend using userland code, then resume using kernel code :-).

Quoted 7 lines
Quoted 2 lines

When I found out noone is really using kernel code any more (2.8.0 or something), I'd like to get rid of it.

So are you saying we should pursue merging Suspend2 bits in the mainline and deprecate it when userspace is mature enough and has all the same features? Seems counter-productive but then again I am mostly clueless of suspend issues.

No, I'm saying that suspend2 bits should be moved into userspace. That way we get mature userspace much faster, without any big merge into kernel.
Pavel

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

Re: [ 01/10] [Suspend2] kernel/power/modules.h

In reply to Pekka Enberg

Hi.

Quoted 41 lines · Pekka Enberg
Quoted 4 lines · Nigel Cunningham
kernel/power/modules.h new file +1 -0
 
+struct module_header {

[snip]

Quoted 1 line

+extern int num_modules, num_writers;

[snip]

Quoted 1 line

+extern struct suspend_module_ops *active_writer;

[snip]

kernel/power/modules.h line 152

Quoted 2 lines
kernel/power/modules.h new file +2 -0
+extern void prepare_console_modules(void);
+extern void cleanup_console_modules(void);

[snip, snip]

kernel/power/modules.h line 163

Quoted 4 lines
kernel/power/modules.h new file +4 -0
+extern unsigned long header_storage_for_modules(void);
+extern unsigned long memory_for_modules(void);
+
+extern int print_module_debug_info(char *buffer, int buffer_size);

Suspend prefix for the names of all of the above please? They're confusing with kernel/module.c now.

kernel/power/modules.h line 171

Quoted 8 lines
kernel/power/modules.h new file +2 -0
+extern int suspend_register_module(struct suspend_module_ops *module);
+extern void suspend_unregister_module(struct suspend_module_ops

*module); +

kernel/power/modules.h new file +5 -0
+extern int suspend2_initialise_modules(int starting_cycle);
+extern void suspend2_cleanup_modules(int finishing_cycle);
+
+int suspend2_get_modules(void);
+void suspend2_put_modules(void);

I think we can call these suspend_{get|set}_modules instead i.e. without the extra '2'.

Quoted 9 lines

kernel/power/modules.h line 177

Quoted 6 lines
kernel/power/modules.h new file +6 -0
+
+static inline void suspend_initialise_module_lists(void) {
+       INIT_LIST_HEAD(&suspend_filters);
+       INIT_LIST_HEAD(&suspend_writers);
+       INIT_LIST_HEAD(&suspend_modules);
+}

I couldn't find a user for this. I would imagine there's only one, though, and this should be inlined there?

All done. Thanks!

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
#36 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

In reply to Pekka Enberg

Hi.

Quoted 9 lines · Pekka Enberg

kernel/power/modules.h line 177

Quoted 6 lines
kernel/power/modules.h new file +6 -0
+
+static inline void suspend_initialise_module_lists(void) {
+       INIT_LIST_HEAD(&suspend_filters);
+       INIT_LIST_HEAD(&suspend_writers);
+       INIT_LIST_HEAD(&suspend_modules);
+}

I couldn't find a user for this. I would imagine there's only one, though, and this should be inlined there?

I forgot to mention re this - yes, there's just one caller, in another set of patches I'll send later (this was just the first set!). Having the function to be inlined in this .h so that it's with other module specific code, and then used in the caller once it has been #included, isn't that the right way to do things?

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
#37 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Quoted 9 lines · Pekka Enberg
Quoted 9 lines

kernel/power/modules.h line 177

Quoted 6 lines
kernel/power/modules.h new file +6 -0
+
+static inline void suspend_initialise_module_lists(void) {
+       INIT_LIST_HEAD(&suspend_filters);
+       INIT_LIST_HEAD(&suspend_writers);
+       INIT_LIST_HEAD(&suspend_modules);
+}

I couldn't find a user for this. I would imagine there's only one, though, and this should be inlined there?

Quoted 5 lines · Nigel Cunningham

I forgot to mention re this - yes, there's just one caller, in another set of patches I'll send later (this was just the first set!). Having the function to be inlined in this .h so that it's with other module specific code, and then used in the caller once it has been #included, isn't that the right way to do things?

Sorry, I can't parse the above :-). My point was that this is probably called in a .c file so move the function in that file and introduce it whenever you introduce the caller.

Pekka

#38 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h

Hi.

Quoted 18 lines · Pekka J Enberg
Quoted 9 lines · Pekka Enberg
Quoted 9 lines

kernel/power/modules.h line 177

Quoted 6 lines
kernel/power/modules.h new file +6 -0
+
+static inline void suspend_initialise_module_lists(void) {
+       INIT_LIST_HEAD(&suspend_filters);
+       INIT_LIST_HEAD(&suspend_writers);
+       INIT_LIST_HEAD(&suspend_modules);
+}

I couldn't find a user for this. I would imagine there's only one, though, and this should be inlined there?

Quoted 5 lines · Nigel Cunningham

I forgot to mention re this - yes, there's just one caller, in another set of patches I'll send later (this was just the first set!). Having the function to be inlined in this .h so that it's with other module specific code, and then used in the caller once it has been #included, isn't that the right way to do things?

Quoted 3 lines

Sorry, I can't parse the above :-). My point was that this is probably called in a .c file so move the function in that file and introduce it whenever you introduce the caller.

I understand that. However if I do it, I separate the routine from the code it logically belongs with. On the other hand, I do no harm by leaving it in the header. We don't end up with multiple copies of the routine.

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
#39 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h'

In reply to Nigel Cunningham
Quoted 32 lines · Nigel Cunningham
Quoted 7 lines · Pekka Enberg
Quoted 5 lines · Nigel Cunningham

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 7 lines

[snip]

Quoted 3 lines
 0 files changed, 0 insertions(+), 0 deletions(-)

Uh, oh, where's the patch?

Indeed! Oops! I think I've managed to put this in kmail without having it mangled!

Nigel

[Suspend2] kernel/power/modules.h

 kernel/power/modules.h |  179 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 179 insertions(+), 0 deletions(-)
kernel/power/modules.h new file +0 -0
new file mode 100644
index 0000000..ee34199

kernel/power/modules.h line 2

Quoted 2 lines
kernel/power/modules.h new file +2 -0
@@ -0,0 +1,179 @@
+/*
+ * kernel/power/module.h

wrong file name.

kernel/power/modules.h line 34

Quoted 6 lines
kernel/power/modules.h new file +6 -0
+enum {
+	FILTER_PLUGIN,
+	WRITER_PLUGIN,
+	MISC_PLUGIN, // Block writer, eg.
+	CHECKSUM_PLUGIN
+};

Kernel comment style is /* ... */, not // (many places).

kernel/power/modules.h line 123

Quoted 1 line
kernel/power/modules.h new file +1 -0
+	/* Bytes! */

Drop the '!'.

Signature · 1 line
~Randy
#40 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h'

Hi.

Quoted 29 lines · Randy.Dunlap
Quoted 28 lines · Nigel Cunningham
Quoted 7 lines · Pekka Enberg
Quoted 5 lines · Nigel Cunningham

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 7 lines

[snip]

Quoted 3 lines
 0 files changed, 0 insertions(+), 0 deletions(-)

Uh, oh, where's the patch?

Indeed! Oops! I think I've managed to put this in kmail without having it mangled!

Nigel

[Suspend2] kernel/power/modules.h

 kernel/power/modules.h |  179

++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 179 insertions(+), 0 deletions(-)

Quoted 10 lines

kernel/power/modules.h line 2

Quoted 8 lines
kernel/power/modules.h new file +2 -0
new file mode 100644
index 0000000..ee34199
@@ -0,0 +1,179 @@
+/*
+ * kernel/power/module.h

wrong file name.

Oops. Thanks.

Quoted 8 lines

kernel/power/modules.h line 34

Quoted 6 lines
kernel/power/modules.h new file +6 -0
+enum {
+	FILTER_PLUGIN,
+	WRITER_PLUGIN,
+	MISC_PLUGIN, // Block writer, eg.
+	CHECKSUM_PLUGIN
+};

Kernel comment style is /* ... */, not // (many places).

Hmm. Learnt that a while ago. Not sure how I missed this one :)

Quoted 3 lines

kernel/power/modules.h line 123

Quoted 1 line
kernel/power/modules.h new file +1 -0
+	/* Bytes! */

Drop the '!'.

:) Will do.

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
#41 lore raw

Re: [ 01/10] [Suspend2] kernel/power/modules.h'

In reply to Randy.Dunlap

Hi.

Quoted 49 lines · Randy.Dunlap
Quoted 34 lines · Nigel Cunningham
Quoted 7 lines · Pekka Enberg
Quoted 5 lines · Nigel Cunningham

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 7 lines

[snip]

Quoted 3 lines
 0 files changed, 0 insertions(+), 0 deletions(-)

Uh, oh, where's the patch?

Indeed! Oops! I think I've managed to put this in kmail without having it mangled!

Nigel

[Suspend2] kernel/power/modules.h

 kernel/power/modules.h |  179

++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 179 insertions(+), 0 deletions(-)

kernel/power/modules.h new file +0 -0
new file mode 100644
index 0000000..ee34199

kernel/power/modules.h line 2

Quoted 2 lines
kernel/power/modules.h new file +2 -0
@@ -0,0 +1,179 @@
+/*
+ * kernel/power/module.h

wrong file name.

kernel/power/modules.h line 34

Quoted 6 lines
kernel/power/modules.h new file +6 -0
+enum {
+	FILTER_PLUGIN,
+	WRITER_PLUGIN,
+	MISC_PLUGIN, // Block writer, eg.
+	CHECKSUM_PLUGIN
+};

Kernel comment style is /* ... */, not // (many places).

Quoted 3 lines

kernel/power/modules.h line 123

Quoted 1 line
kernel/power/modules.h new file +1 -0
+	/* Bytes! */

Drop the '!'.

All done. Thanks.

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
#42 lore raw

PATCH 2/10 Module (de)registration.

In reply to Nigel Cunningham

This patch implements registration and deregistration of modules that are used for page transformation and storage.

 kernel/power/modules.c |   87 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 87 insertions(+), 0 deletions(-)
kernel/power/modules.c new file +87 -0
new file mode 100644
index 0000000..227e320
@@ -0,0 +1,87 @@
+/*
+ * kernel/power/modules.c
+ *
+ * Copyright (C) 2004-2005 Nigel Cunningham <[email protected]>
+ *
+ */
+
+#include <linux/suspend.h>
+#include <linux/module.h>
+#include "suspend2.h"
+#include "modules.h"
+
+struct list_head suspend_filters, suspend_writers, suspend_modules;
+struct suspend_module_ops *active_writer = NULL;
+static int num_filters = 0, num_ui = 0;
+int num_writers = 0, num_modules = 0;
+
+/*
+ * suspend_register_module
+ *
+ * Register a module.
+ */
+int suspend_register_module(struct suspend_module_ops *module)
+{
+	if (find_module_given_name(module->name))
+		return -EBUSY;
+
+	switch (module->type) {
+		case FILTER_PLUGIN:
+			list_add_tail(&module->ops.filter.filter_list,
+					&suspend_filters);
+			num_filters++;
+			break;
+
+		case WRITER_PLUGIN:
+			list_add_tail(&module->ops.writer.writer_list,
+					&suspend_writers);
+			num_writers++;
+			break;
+
+		case MISC_PLUGIN:
+			break;
+
+		default:
+			printk("Hmmm. Plugin '%s' has an invalid type."
+				" It has been ignored.\n", module->name);
+			return -EINVAL;
+	}
+	list_add_tail(&module->module_list, &suspend_modules);
+	num_modules++;
+
+	return 0;	
+}
+
+/*
+ * suspend_unregister_module
+ *
+ * Remove a module.
+ */
+void suspend_unregister_module(struct suspend_module_ops *module)
+{
+	switch (module->type) {
+		case FILTER_PLUGIN:
+			list_del(&module->ops.filter.filter_list);
+			num_filters--;
+			break;
+
+		case WRITER_PLUGIN:
+			list_del(&module->ops.writer.writer_list);
+			num_writers--;
+			if (active_writer == module) {
+				active_writer = NULL;
+				set_suspend_state(SUSPEND_DISABLED);
+			}
+			break;
+		
+		case MISC_PLUGIN:
+			break;
+
+		default:
+			printk("Hmmm. Plugin '%s' has an invalid type."
+				" It has been ignored.\n", module->name);
+			return;
+	}
+	list_del(&module->module_list);
+	num_modules--;
+}

--
Nigel Cunningham nigel at suspend2 dot net

#43 lore raw

Re: [ 02/10] [Suspend2] Module (de)registration.

Hi,

Quoted 2 lines · Nigel Cunningham

+++ b/kernel/power/modules.c

(quoted diff) +0 -0
@@ -0,0 +1,87 @@

[snip]

kernel/power/modules.c line 16

Quoted 5 lines
kernel/power/modules.c new file +5 -0
+
+struct list_head suspend_filters, suspend_writers, suspend_modules;
+struct suspend_module_ops *active_writer = NULL;
+static int num_filters = 0, num_ui = 0;
+int num_writers = 0, num_modules = 0;

Unneeded assignments, they're already guaranteed to be zeroed.

kernel/power/modules.c line 50

Quoted 2 lines
kernel/power/modules.c new file +2 -0
+       list_add_tail(&module->module_list, &suspend_modules);
+       num_modules++;

No locking, why?

Pekka

#44 lore raw

Re: [ 02/10] [Suspend2] Module (de)registration.

Hi.

Quoted 8 lines · Pekka Enberg

Hi,

Quoted 2 lines · Nigel Cunningham

+++ b/kernel/power/modules.c

(quoted diff) +0 -0
@@ -0,0 +1,87 @@

[snip]

Quoted 7 lines

kernel/power/modules.c line 16

Quoted 5 lines
kernel/power/modules.c new file +5 -0
+
+struct list_head suspend_filters, suspend_writers, suspend_modules;
+struct suspend_module_ops *active_writer = NULL;
+static int num_filters = 0, num_ui = 0;
+int num_writers = 0, num_modules = 0;

Unneeded assignments, they're already guaranteed to be zeroed.

Good point. Will fix.

Quoted 4 lines

kernel/power/modules.c line 50

Quoted 2 lines
kernel/power/modules.c new file +2 -0
+       list_add_tail(&module->module_list, &suspend_modules);
+       num_modules++;

No locking, why?

Not needed - the callers are _init routines only.

Regards,

Nigel

Quoted 6 lines

Pekka
-
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/

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

Re: [ 02/10] [Suspend2] Module (de)registration.

Quoted 19 lines · Nigel Cunningham

Hi.

Quoted 8 lines · Pekka Enberg

Hi,

Quoted 2 lines · Nigel Cunningham

+++ b/kernel/power/modules.c

(quoted diff) +0 -0
@@ -0,0 +1,87 @@

[snip]

Quoted 7 lines

kernel/power/modules.c line 16

Quoted 5 lines
kernel/power/modules.c new file +5 -0
+
+struct list_head suspend_filters, suspend_writers, suspend_modules;
+struct suspend_module_ops *active_writer = NULL;
+static int num_filters = 0, num_ui = 0;
+int num_writers = 0, num_modules = 0;

Unneeded assignments, they're already guaranteed to be zeroed.

Quoted 8 lines

Good point. Will fix.

Quoted 4 lines

kernel/power/modules.c line 50

Quoted 2 lines
kernel/power/modules.c new file +2 -0
+       list_add_tail(&module->module_list, &suspend_modules);
+       num_modules++;

No locking, why?

Not needed - the callers are _init routines only.

And insmod?
Pavel

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

Re: [ 02/10] [Suspend2] Module (de)registration.

Hi.

Quoted 22 lines · Pavel Machek
Quoted 21 lines · Nigel Cunningham

Hi.

Quoted 8 lines · Pekka Enberg

Hi,

Quoted 2 lines · Nigel Cunningham

+++ b/kernel/power/modules.c

(quoted diff) +0 -0
@@ -0,0 +1,87 @@

[snip]

Quoted 7 lines

kernel/power/modules.c line 16

Quoted 5 lines
kernel/power/modules.c new file +5 -0
+
+struct list_head suspend_filters, suspend_writers, suspend_modules;
+struct suspend_module_ops *active_writer = NULL;
+static int num_filters = 0, num_ui = 0;
+int num_writers = 0, num_modules = 0;

Unneeded assignments, they're already guaranteed to be zeroed.

Good point. Will fix.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

kernel/power/modules.c line 50

Quoted 2 lines
kernel/power/modules.c new file +2 -0
+       list_add_tail(&module->module_list, &suspend_modules);
+       num_modules++;

No locking, why?

Not needed - the callers are _init routines only.

And insmod?

Not right now. As I said in the intro, I want to have building as modules being an option again, but right now it's partially removed because of the symbol exporting issue.

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
#47 lore raw

PATCH 3/10 Move module to the tail of lists.

In reply to Nigel Cunningham

This function moves a module to the tail of lists in which it appears. This is used at resume time, to make the order in which modules are used match the order used when suspending. It wouldn't do to compress and then encrypt while suspending, but try to decompress before decrypting at resume.

 kernel/power/modules.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
kernel/power/modules.c +31 -0
index 227e320..f7e9ab0 100644
@@ -85,3 +85,34 @@ void suspend_unregister_module(struct su
 	list_del(&module->module_list);
 	num_modules--;
 }
+
+/*
+ * suspend_move_module_tail
+ *
+ * Rearrange modules when reloading the config.
+ */
+void suspend_move_module_tail(struct suspend_module_ops *module)
+{
+	switch (module->type) {
+		case FILTER_PLUGIN:
+			if (num_filters > 1)
+				list_move_tail(&module->ops.filter.filter_list,
+						&suspend_filters);
+			break;
+
+		case WRITER_PLUGIN:
+			if (num_writers > 1)
+				list_move_tail(&module->ops.writer.writer_list,
+						&suspend_writers);
+			break;
+		
+		case MISC_PLUGIN:
+			break;
+		default:
+			printk("Hmmm. Plugin '%s' has an invalid type."
+				" It has been ignored.\n", module->name);
+			return;
+	}
+	if ((num_filters + num_writers + num_ui) > 1)
+		list_move_tail(&module->module_list, &suspend_modules);
+}

--
Nigel Cunningham nigel at suspend2 dot net

#48 lore raw

PATCH 4/10 Module initialise/cleanup.

In reply to Nigel Cunningham

Routines to tell modules that we're about to do some work, and conversely, have finished our labours for the moment. We allow them to do some actions only if we're starting/finishing a cycle by passing a flag to indicate that.

 kernel/power/modules.c |   49 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)
kernel/power/modules.c +49 -0
index f7e9ab0..eee5678 100644
@@ -116,3 +116,52 @@ void suspend_move_module_tail(struct sus
 	if ((num_filters + num_writers + num_ui) > 1)
 		list_move_tail(&module->module_list, &suspend_modules);
 }
+
+/*
+ * suspend2_initialise_modules
+ *
+ * Get ready to do some work!
+ */
+int suspend2_initialise_modules(int starting_cycle)
+{
+	struct suspend_module_ops *this_module;
+	int result;
+	
+	list_for_each_entry(this_module, &suspend_modules, module_list) {
+		if (this_module->disabled)
+			continue;
+		if (this_module->initialise) {
+			suspend_message(SUSPEND_MEMORY, SUSPEND_MEDIUM, 1,
+				"Initialising module %s.\n",
+				this_module->name);
+			if ((result = this_module->initialise(starting_cycle))) {
+				printk("%s didn't initialise okay.\n",
+						this_module->name);
+				return result;
+			}
+		}
+	}
+
+	return 0;
+}
+
+/* 
+ * suspend2_cleanup_modules
+ *
+ * Tell modules the work is done.
+ */
+void suspend2_cleanup_modules(int finishing_cycle)
+{
+	struct suspend_module_ops *this_module;
+	
+	list_for_each_entry(this_module, &suspend_modules, module_list) {
+		if (this_module->disabled)
+			continue;
+		if (this_module->cleanup) {
+			suspend_message(SUSPEND_MEMORY, SUSPEND_MEDIUM, 1,
+				"Cleaning up module %s.\n",
+				this_module->name);
+			this_module->cleanup(finishing_cycle);
+		}
+	}
+}

--
Nigel Cunningham nigel at suspend2 dot net

#49 lore raw

PATCH 5/10 Get next module.

In reply to Nigel Cunningham

Given a current (possibly NULL) pointer to a module, find the next module in the pipeline.

 kernel/power/modules.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
kernel/power/modules.c +20 -0
index eee5678..a7c3c38 100644
@@ -165,3 +165,23 @@ void suspend2_cleanup_modules(int finish
 		}
 	}
 }
+
+/*
+ * get_next_filter
+ *
+ * Get the next filter in the pipeline.
+ */
+struct suspend_module_ops *get_next_filter(struct suspend_module_ops *filter_sought)
+{
+	struct suspend_module_ops *last_filter = NULL, *this_filter = NULL;
+
+	list_for_each_entry(this_filter, &suspend_filters, ops.filter.filter_list) {
+		if (this_filter->disabled)
+			continue;
+		if ((last_filter == filter_sought) || (!filter_sought))
+			return this_filter;
+		last_filter = this_filter;
+	}
+
+	return active_writer;
+}

--
Nigel Cunningham nigel at suspend2 dot net

#50 lore raw

PATCH 6/10 Get/put module reference.

In reply to Nigel Cunningham

Take or put a reference to a module, so it can't be unloaded while in use.

 kernel/power/modules.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
kernel/power/modules.c +38 -0
index a7c3c38..dd53b27 100644
@@ -185,3 +185,41 @@ struct suspend_module_ops *get_next_filt
 
 	return active_writer;
 }
+
+/* suspend2_get_modules
+ * 
+ * Take a reference to modules so they can't go away under us.
+ */
+
+int suspend2_get_modules(void)
+{
+	struct suspend_module_ops *this_module;
+	
+	list_for_each_entry(this_module, &suspend_modules, module_list) {
+		if (!try_module_get(this_module->module)) {
+			/* Failed! Reverse gets and return error */
+			struct suspend_module_ops *this_module2;
+			list_for_each_entry(this_module2, &suspend_modules, module_list) {
+				if (this_module == this_module2)
+					return -EINVAL;
+				module_put(this_module2->module);
+			}
+		}
+	}
+
+	return 0;
+}
+
+/* suspend2_put_modules
+ *
+ * Release our references to modules we used.
+ */
+
+void suspend2_put_modules(void)
+{
+	struct suspend_module_ops *this_module;
+	
+	list_for_each_entry(this_module, &suspend_modules, module_list) {
+		module_put(this_module->module);
+	}
+}

--
Nigel Cunningham nigel at suspend2 dot net

#51 lore raw

PATCH 7/10 Header storage for modules.

In reply to Nigel Cunningham

Calculate the space in an image header required for storing module configuration data.

 kernel/power/modules.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
kernel/power/modules.c +21 -0
index dd53b27..7d56ce0 100644
@@ -16,6 +16,27 @@ static int num_filters = 0, num_ui = 0;
 int num_writers = 0, num_modules = 0;
 
 /*
+ * header_storage_for_modules
+ *
+ * Returns the amount of space needed to store configuration
+ * data needed by the modules prior to copying back the original
+ * kernel. We can exclude data for pageset2 because it will be
+ * available anyway once the kernel is copied back.
+ */
+unsigned long header_storage_for_modules(void)
+{
+	struct suspend_module_ops *this_module;
+	unsigned long bytes = 0;
+	
+	list_for_each_entry(this_module, &suspend_modules, module_list) {
+		if (this_module->disabled)
+			continue;
+		if (this_module->storage_needed)
+			bytes += this_module->storage_needed();
+	}
+
+	return bytes;
+}
  * suspend_register_module
  *
  * Register a module.

--
Nigel Cunningham nigel at suspend2 dot net

#52 lore raw

PATCH 8/10 Find a module given its name

In reply to Nigel Cunningham

Given the name of a module, return a pointer to it, or NULL if not found. This is used when reloading the configuration data at resume time.

 kernel/power/modules.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
kernel/power/modules.c +20 -0
index 7d56ce0..63f9dbb 100644
@@ -37,6 +37,26 @@ unsigned long header_storage_for_modules
 
 	return bytes;
 }
+
+/* find_module_given_name
+ * Functionality :	Return a module (if found), given a pointer
+ * 			to its name
+ */
+
+struct suspend_module_ops *find_module_given_name(char *name)
+{
+	struct suspend_module_ops *this_module, *found_module = NULL;
+	
+	list_for_each_entry(this_module, &suspend_modules, module_list) {
+		if (!strcmp(name, this_module->name)) {
+			found_module = this_module;
+			break;
+		}			
+	}
+
+	return found_module;
+}
+
  * suspend_register_module
  *
  * Register a module.

--
Nigel Cunningham nigel at suspend2 dot net

#53 lore raw

PATCH 9/10 Append module debug info to a buffer.

In reply to Nigel Cunningham

Append the (textual) debugging output of each non-disabled module to a buffer. This output should be short, so we don't get carried away supporting multiple pages of output.

 kernel/power/modules.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
kernel/power/modules.c +24 -0
index 63f9dbb..9c27957 100644
@@ -57,6 +57,30 @@ struct suspend_module_ops *find_module_g
 	return found_module;
 }
 
+/*
+ * print_module_debug_info
+ * Functionality   : Get debugging info from modules into a buffer.
+ */
+int print_module_debug_info(char *buffer, int buffer_size)
+{
+	struct suspend_module_ops *this_module;
+	int len = 0;
+
+	list_for_each_entry(this_module, &suspend_modules, module_list) {
+		if (this_module->disabled)
+			continue;
+		if (this_module->print_debug_info) {
+			int result;
+			result = this_module->print_debug_info(buffer + len, 
+					buffer_size - len);
+			len += result;
+		}
+	}
+
+	return len;
+}
+
+/*
  * suspend_register_module
  *
  * Register a module.

--
Nigel Cunningham nigel at suspend2 dot net

#54 lore raw

PATCH 10/10 Memory needed for modules.

In reply to Nigel Cunningham

Calculate the amount of memory required for the modules that will be used. Utilised when preparing to suspend, to ensure that we have sufficient memory available for doing our work.

 kernel/power/modules.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
kernel/power/modules.c +22 -0
index 9c27957..e7e7e93 100644
@@ -38,6 +38,28 @@ unsigned long header_storage_for_modules
 	return bytes;
 }
 
+/*
+ * memory_for_modules
+ *
+ * Returns the amount of memory requested by modules for
+ * doing their work during the cycle.
+ */
+
+unsigned long memory_for_modules(void)
+{
+	unsigned long bytes = 0;
+	struct suspend_module_ops *this_module;
+
+	list_for_each_entry(this_module, &suspend_modules, module_list) {
+		if (this_module->disabled)
+			continue;
+		if (this_module->memory_needed)
+			bytes += this_module->memory_needed();
+	}
+
+	return ((bytes + PAGE_SIZE - 1) >> PAGE_SHIFT);
+}
+
 /* find_module_given_name
  * Functionality :	Return a module (if found), given a pointer
  * 			to its name

--
Nigel Cunningham nigel at suspend2 dot net

#55 lore raw
In reply to Nigel Cunningham
Quoted 2 lines · Nigel Cunningham

The name is currently mostly historical, from the time when these components could be built as kernel modules.

I think suspend_plugin would be a nicer name. Your code is even using the term 'plugin' and 'filter' instead of module in many places.

Pekka

#56 lore raw

Hi.

Quoted 6 lines · Pekka Enberg
Quoted 2 lines · Nigel Cunningham

The name is currently mostly historical, from the time when these components could be built as kernel modules.

I think suspend_plugin would be a nicer name. Your code is even using the term 'plugin' and 'filter' instead of module in many places.

Hmm. Thought I got rid of all mentions of 'plugin'. I was trying to follow Dave M's advice from LCA :). Filters are slightly different - they're the modules that do the encryption or compression, as opposed to the writers that do the I/O.

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
#57 lore raw
In reply to Nigel Cunningham

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'.

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.

Pavel

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

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 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.

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
#59 lore raw

Hi!

Quoted 8 lines
Quoted 8 lines
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.

No, I don't... please explain. Switching to this interface is going to be easier than pushing suspend2 into kernel. Granted, end result may not be suspend2, it may be something like suspend3, but it will be better result than u-swsusp or suspend2 is today...
Pavel

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

Hi.

Quoted 14 lines · Pavel Machek

Hi!

Quoted 12 lines
Quoted 11 lines
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'.

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.

Quoted 6 lines
Quoted 1 line

You know that's not an option.

No, I don't... please explain. Switching to this interface is going to be easier than pushing suspend2 into kernel. Granted, end result may not be suspend2, it may be something like suspend3, but it will be better result than u-swsusp or suspend2 is today...

It's not an option because I'm not trying not to step all over your codebase, because I'm not moving suspend2 to userspace and because it doesn't make sense to add another layer of abstraction by sticking /dev/snapshot in the middle of kernel space code. There may be more reasons, but I haven't looked at the /dev/snapshot code at all.

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
#61 lore raw

Hi,

Quoted 5 lines · Nigel Cunningham

It's not an option because I'm not trying not to step all over your codebase, because I'm not moving suspend2 to userspace and because it doesn't make sense to add another layer of abstraction by sticking /dev/snapshot in the middle of kernel space code. There may be more reasons, but I haven't looked at the /dev/snapshot code at all.

Any technical reasons why suspend modules shouldn't be in userspace? I can understand that you're not keen on redoing them but that's not an argument for inclusion in the mainline.

Pekka

#62 lore raw

Hi.

Quoted 9 lines · Pekka Enberg

Hi,

Quoted 5 lines · Nigel Cunningham

It's not an option because I'm not trying not to step all over your codebase, because I'm not moving suspend2 to userspace and because it doesn't make sense to add another layer of abstraction by sticking /dev/snapshot in the middle of kernel space code. There may be more reasons, but I haven't looked at the /dev/snapshot code at all.

Quoted 3 lines

Any technical reasons why suspend modules shouldn't be in userspace? I can understand that you're not keen on redoing them but that's not an argument for inclusion in the mainline.

They're using cryptoapi to do the compression and encryption, and bio to do the I/O. Moving this to userspace will add extra complexity and of course slow down the process. It will also mean that to suspend and resume, the user will be unconditionally required to have an initrd or initramfs. This is already the case for the more complicated configurations (LVM, encryption with keys that need to be entered at a prompt etc), but most people simply use an unencrypted, compressed image on a swap partition and in that case do not and should not need the added complication of configuring an initrd.

Shouldn't the question be "Why are we making this more complicated by moving it to userspace?"

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
#63 lore raw
Quoted 2 lines · Nigel Cunningham

Shouldn't the question be "Why are we making this more complicated by moving it to userspace?"

It's less code in kernel now and in the future, more flexible (we have more options for compression and encryption in userspace), and less invasive. Specific points that make Suspend2 less attractive: it's a lot of code (500KB patch!), new compression code in kernel (LZF), dynamic page flags, and the special userspace notification mechanism (kernel/power/ui.c).

That being said, the biggest advantage for Suspend2 of course is that it's ready and stable now.

Pekka

#64 lore raw
In reply to Nigel Cunningham

Hi!

Quoted 6 lines
Quoted 3 lines

Any technical reasons why suspend modules shouldn't be in userspace? I can understand that you're not keen on redoing them but that's not an argument for inclusion in the mainline.

They're using cryptoapi to do the compression and encryption, and bio to do the I/O. Moving this to userspace will add extra complexity and of course

You are mostly using LZW, not supported by cryptoapi, anyway.

Quoted 1 line

slow down the process.

Slowdown will not be measurable, syscalls are cheap.

Quoted 2 lines

Shouldn't the question be "Why are we making this more complicated by moving it to userspace?"

Because thats how the kernel works. We do not put random stuff into kernel because someone happened to code it for kernelspace first. It helps us with long-term sanity.
Pavel

Signature · 1 line
Thanks, Sharp!
#65 lore raw
In reply to Nigel Cunningham
Quoted 2 lines · Nigel Cunningham

Shouldn't the question be "Why are we making this more complicated by moving it to userspace?"

Indeed. It seems that turning the kernel into Hurd is the latest fad.

One question I'm wondering about though is that 99% of the "suspend doesn't work reliably" messages were answered by "it's a driver's fault". I'm rather curious on how moving things to userspace is going to fix that.

OG.

#66 lore raw
Quoted 6 lines · Olivier Galibert
Quoted 2 lines · Nigel Cunningham

Shouldn't the question be "Why are we making this more complicated by moving it to userspace?"

Indeed. It seems that turning the kernel into Hurd is the latest fad.

Heh, try reading suspend2.

Quoted 4 lines

One question I'm wondering about though is that 99% of the "suspend doesn't work reliably" messages were answered by "it's a driver's fault". I'm rather curious on how moving things to userspace is going to fix that.

uswsusp is not going to fix driver's problems, but at least should not add new problems. It is aimed at solving graphical bars, compression, encryption etc.
Pavel

Signature · 1 line
Thanks, Sharp!
#67 lore raw
Quoted 9 lines · Pavel Machek
Quoted 6 lines · Olivier Galibert
Quoted 2 lines · Nigel Cunningham

Shouldn't the question be "Why are we making this more complicated by moving it to userspace?"

Indeed. It seems that turning the kernel into Hurd is the latest fad.

Heh, try reading suspend2.

Can we leave the playground level insults off of linux-kernel please, and keep the discussion at a technical level ?

Such remarks aren't furthering the cause of either implementation.

Dave

#68 lore raw
Quoted 9 lines · Dave Jones
Quoted 8 lines · Pavel Machek
Quoted 6 lines · Olivier Galibert
Quoted 2 lines · Nigel Cunningham

Shouldn't the question be "Why are we making this more complicated by moving it to userspace?"

Indeed. It seems that turning the kernel into Hurd is the latest fad.

Quoted 6 lines
Quoted 1 line

Heh, try reading suspend2.

Can we leave the playground level insults off of linux-kernel please, and keep the discussion at a technical level ?

Such remarks aren't furthering the cause of either implementation.

Well, Olivier said I'm turning kernel into Hurd. So he instead advocates merging 10 000 lines of code (+7500, contains new compression algorithm and new plugin architecture). I'd like to add interface to userland (+300) and remove swap writing (long term, -1000).

Olivier clearly did not see the patches; is asking him to learn what he is talking about *that* much to ask?
Pavel

Signature · 1 line
Thanks, Sharp!
#69 lore raw
Quoted 1 line · Pavel Machek

Well, Olivier said I'm turning kernel into Hurd.

You're far from the only one. There is currently a real fad into putting as many things as possible (or not) in userspace without seemingly thinking about things like security, long term maintainability, usability or even compatiblity between kernel versions and userspace versions.

Quoted 5 lines

So he instead
advocates merging 10 000 lines of code (+7500, contains new compression algorithm and new plugin architecture). I'd like to add interface to userland (+300) and remove swap writing (long term, -1000).

I don't actually advocate suspend2. I indeed have not looked at the patches at that point. I do find it extremely annoying that instead of trying to make what exists reliable, for instance what are the rules irq grabbing/release at that point, and adding infrastructure for what's missing for having real reliability, f.i. communication with fb/drm to handle the screen power switch, you decide to go and move things into userspace which is going to increase the reliability problems immensely. I don't even want to think about the interactions between freezing the userspace memory pages and running some processes which may malloc/mmap at the same time.

OG.

#70 lore raw
Quoted 10 lines · Olivier Galibert
Quoted 5 lines · Pavel Machek

So he instead
advocates merging 10 000 lines of code (+7500, contains new compression algorithm and new plugin architecture). I'd like to add interface to userland (+300) and remove swap writing (long term, -1000).

I don't actually advocate suspend2. I indeed have not looked at the patches at that point. I do find it extremely annoying that instead of trying to make what exists reliable, for instance what are the

I'm trying to make what exists reliable, but I'm under some pressure to allow things like progress bars. And for progress bars (etc) to be feasible, it needs to be in userspace.

Quoted 7 lines

rules irq grabbing/release at that point, and adding infrastructure for what's missing for having real reliability, f.i. communication with fb/drm to handle the screen power switch, you decide to go and move things into userspace which is going to increase the reliability problems immensely. I don't even want to think about the interactions between freezing the userspace memory pages and running some processes which may malloc/mmap at the same time.

There are none. userspace helper is mlocked, and rest of userspace is stopped.

Pavel

Signature · 1 line
Thanks, Sharp!
#71 lore raw
Quoted 6 lines · Pavel Machek
Quoted 3 lines

I don't even want to think about the interactions
between freezing the userspace memory pages and running some processes which may malloc/mmap at the same time.

There are none. userspace helper is mlocked, and rest of userspace is stopped.

Unless the userspace code is as tight as mission-critical RT code, I don't see how that can work reliably. Some problems I see:

- What happens if the helper faults in new pages, changes its brk or mmaps things? Can we actually swap at that point? mlocking takes care of the fault in, not of the rest.

- What happens if the helper reads files? Where will the pages with the file data be put? Are we saving the dcache in the image, and if yes which state of the dcache?

- What happens if the helper writes files? What state are we saving, before starting the helper or after? Will the fs be in a coherent state after resume?

- What about IPC? What if for instance the helper tries to contact HAL to get some system information?

And if you decide on rules on what the userspace can and can't do, how do you plan to enforce them? We have filesystems on the line there, you don't want them destroyed at resume because the latest version of kdome-resume-progress-bar thought it was cool to generate an picture of the desktop at suspend time to show at resume.

The idea of trying to save a state that can be modified dynamically while you're saving in unpredictable ways makes me very, very afraid. At least when you're in the kernel you can have complete control over the machine when needed.

OG.

#72 lore raw
Quoted 10 lines · Olivier Galibert
Quoted 6 lines · Pavel Machek
Quoted 3 lines

I don't even want to think about the interactions
between freezing the userspace memory pages and running some processes which may malloc/mmap at the same time.

There are none. userspace helper is mlocked, and rest of userspace is stopped.

Unless the userspace code is as tight as mission-critical RT code, I don't see how that can work reliably.

I use it on a daily basis. It works.

Quoted 4 lines

Some problems I see:

- What happens if the helper faults in new pages, changes its brk or mmaps things? Can we actually swap at that point?

Yes.

Quoted 5 lines

mlocking takes care of the fault in, not of the rest.

- What happens if the helper reads files? Where will the pages with the file data be put? Are we saving the dcache in the image, and if yes which state of the dcache?

The suspending helper should not use mounted filesystems after it calls the atomic snapshot ioctl(). The resuming helper should be run from an initrd and all filesystems should be unmounted at that time (of course it should not attempt to mount them).

Please read the Documentation/power/userland-swsusp.txt file in the latest -mm and you'll get an idea of how it works.

Quoted 2 lines

- What happens if the helper writes files? What state are we saving, before starting the helper or after?

After.

Quoted 1 line

Will the fs be in a coherent state after resume?

Yes, it will, as long as the helpers follow some strict rules (above).

Quoted 2 lines

- What about IPC? What if for instance the helper tries to contact HAL to get some system information?

That doesn't matter.

Quoted 10 lines

And if you decide on rules on what the userspace can and can't do, how do you plan to enforce them? We have filesystems on the line there, you don't want them destroyed at resume because the latest version of kdome-resume-progress-bar thought it was cool to generate an picture of the desktop at suspend time to show at resume.

The idea of trying to save a state that can be modified dynamically while you're saving in unpredictable ways makes me very, very afraid. At least when you're in the kernel you can have complete control over the machine when needed.

Not necessarily. For example, if you suspend the box and then start it with a wrong kernel that is unable to read the image, it will mount the file systems and you loose the saved state.

Greetings,
Rafael

#73 lore raw
Quoted 1 line · Rafael J. Wysocki

I use it on a daily basis. It works.

The plural of anecdote is not data. Nobody except Pavel and you ever wrote code to work in the userland part of your suspend. But the aim is to have GUI-type code written by other people running between the snapshotting and the system shutdown, right? Code that is pretty much by definition just plain untrustable in the first place.

The interactions with a frozen, direct-rendering X are going to be quite amusing too. You'll have to be very careful to switch VTs to a suspend-aware framebuffer before snapshotting. That could help reducing your video-card related problems though.

Quoted 2 lines

The suspending helper should not use mounted filesystems after it calls the atomic snapshot ioctl().

You can s/mounted// on that. It's pretty much impossible to unmount filesystems on a running system, it's always kept busy by something. Especially system filesystems.

Quoted 3 lines

The resuming helper should be run from
an initrd and all filesystems should be unmounted at that time (of course it should not attempt to mount them).

Mandatory initrd? How nice...

Quoted 3 lines
Quoted 1 line

Will the fs be in a coherent state after resume?

Yes, it will, as long as the helpers follow some strict rules (above).

That's exactly what I'm terribly afraid of. You have no way to enforce them, so they won't be respected. And filesystems will die randomly and unpredictably.

Quoted 8 lines
Quoted 4 lines

The idea of trying to save a state that can be modified dynamically while you're saving in unpredictable ways makes me very, very afraid. At least when you're in the kernel you can have complete control over the machine when needed.

Not necessarily. For example, if you suspend the box and then start it with a wrong kernel that is unable to read the image, it will mount the file systems and you loose the saved state.

You can always limit the damage by syncing the disks before snapshotting. This way you'll only lose the running processes if you don't actually resume. While having the in-memory cache of the state of the filesystem being different of the real on-disk state eats filesystems for breakfast. The output of fsck is not pretty. BTDTGTTS.

OG.

#74 lore raw
Quoted 8 lines · Olivier Galibert
Quoted 1 line · Rafael J. Wysocki

I use it on a daily basis. It works.

The plural of anecdote is not data. Nobody except Pavel and you ever wrote code to work in the userland part of your suspend. But the aim is to have GUI-type code written by other people running between the snapshotting and the system shutdown, right? Code that is pretty much by definition just plain untrustable in the first place.

By the same token any code that's run as/by root is untrastable and it can destroy the system just as well.

Quoted 4 lines

The interactions with a frozen, direct-rendering X are going to be quite amusing too. You'll have to be very careful to switch VTs to a suspend-aware framebuffer before snapshotting. That could help reducing your video-card related problems though.

Yes. We are switching to a VT before snapshotting the system.

Quoted 6 lines
Quoted 2 lines

The suspending helper should not use mounted filesystems after it calls the atomic snapshot ioctl().

You can s/mounted// on that. It's pretty much impossible to unmount filesystems on a running system, it's always kept busy by something. Especially system filesystems.

I mean it shouldn't read files from such filesystems or write to them. They are mounted all the time and should not be unmounted, of course.

Quoted 5 lines
Quoted 3 lines

The resuming helper should be run from
an initrd and all filesystems should be unmounted at that time (of course it should not attempt to mount them).

Mandatory initrd? How nice...

Why? It's quite easy to set up and virtually all distributions use it anyway.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Will the fs be in a coherent state after resume?

Yes, it will, as long as the helpers follow some strict rules (above).

That's exactly what I'm terribly afraid of. You have no way to enforce them, so they won't be respected. And filesystems will die randomly and unpredictably.

Yes, this may happen if the userland helpers are buggy, but again any root-equivalent process that is buggy can do the damage just as well.

Your point seem to be "we should implement this in the kernel to protect the users from irresponsible authors of userland applications and distributors". I just don't agree with that. [Going along this line of reasoning we should implement fsck in the kernel too. ;-)]

Quoted 11 lines
Quoted 8 lines
Quoted 4 lines

The idea of trying to save a state that can be modified dynamically while you're saving in unpredictable ways makes me very, very afraid. At least when you're in the kernel you can have complete control over the machine when needed.

Not necessarily. For example, if you suspend the box and then start it with a wrong kernel that is unable to read the image, it will mount the file systems and you loose the saved state.

You can always limit the damage by syncing the disks before snapshotting.

Yes, we are doing that already and we are working on improving it further (just now :-)).

Still, if you don't like the idea of userland-based suspend, we are not going to remove the kernel-based suspend, AFAICT.

Greetings,
Rafael

#75 lore raw
Quoted 2 lines · Rafael J. Wysocki

By the same token any code that's run as/by root is untrastable and it can destroy the system just as well.

Yes, and that's why old timers essentially never run GUI code as root. The quality of that code tends to be... sloppy compared to the standards of setuid code or kernel code.

Quoted 11 lines
Quoted 3 lines

That's exactly what I'm terribly afraid of. You have no way to enforce them, so they won't be respected. And filesystems will die randomly and unpredictably.

Yes, this may happen if the userland helpers are buggy, but again any root-equivalent process that is buggy can do the damage just as well.

Your point seem to be "we should implement this in the kernel to protect the users from irresponsible authors of userland applications and distributors". I just don't agree with that. [Going along this line of reasoning we should implement fsck in the kernel too. ;-)]

fsck isn't sexy and is implemented by the authors of the filesystems or in close collaboration with them. Even there, there is a lot of talk about fscking live systems but nobody has dared it yet. That has some similarities with your situation.

There are two parts in your suspend userland helper. The functionality code, which you, and Pavel, and other highly competent people will write. I have no qualms with that one. And then there is the chrome code, the sexy code, that everybody and his dog is going to want to muck with because that's where the looks are. I'll give it 6 months at best from when you have a working system before you get a submission for some themed, 3d-accelerated buzzword-compliant nightmare of a progress bar. With demented pressure to have it in the official distribution because it looks like Babylon 5 on steroids. Especially if you have a plugin structure, which otherwise makes a lot of sense technically. Will you be able to trust this code to do no disk access and no other state changes that could be problematic (like changing vt back to X)?

In other words, opening a window between the snapshot and the shutdown for look-oriented code you won't control may not be a can of worms you really want to have to handle.

While from the kernel side you can close the access to what you do not want disturbed.

OG.

#76 lore raw

Hi!

Quoted 17 lines
Quoted 11 lines
Quoted 3 lines

That's exactly what I'm terribly afraid of. You have no way to enforce them, so they won't be respected. And filesystems will die randomly and unpredictably.

Yes, this may happen if the userland helpers are buggy, but again any root-equivalent process that is buggy can do the damage just as well.

Your point seem to be "we should implement this in the kernel to protect the users from irresponsible authors of userland applications and distributors". I just don't agree with that. [Going along this line of reasoning we should implement fsck in the kernel too. ;-)]

fsck isn't sexy and is implemented by the authors of the filesystems or in close collaboration with them. Even there, there is a lot of talk about fscking live systems but nobody has dared it yet. That has some similarities with your situation.

Quoted 4 lines

There are two parts in your suspend userland helper. The functionality code, which you, and Pavel, and other highly competent people will write. I have no qualms with that one. And then there is

Thanks :-).

Quoted 6 lines

the chrome code, the sexy code, that everybody and his dog is going to want to muck with because that's where the looks are. I'll give it 6 months at best from when you have a working system before you get a submission for some themed, 3d-accelerated buzzword-compliant nightmare of a progress bar. With demented pressure to have it in the

Well, this should be more like bootsplash support; simple, preload bitmaps before you start suspend sequence, no 3d-accelerated hell. I'll actually make sure I have reasonably-looking progress bar ready, so people don't have reason to invent some nightmare.

Quoted 5 lines

official distribution because it looks like Babylon 5 on steroids. Especially if you have a plugin structure, which otherwise makes a lot of sense technically. Will you be able to trust this code to do no disk access and no other state changes that could be problematic (like changing vt back to X)?

If they try to switch back to X, it will just deadlock on them. If they try to communicate using IPC, boom, deadlock. They still may do something stupid; I'll do my best to educate them not to do that. Writing to filesystem would be especially bad, for example. But that should be reasonably easy to understand...
Pavel

Signature · 1 line
Thanks, Sharp!
#77 lore raw
In reply to Olivier Galibert
Quoted 10 lines · Olivier Galibert
Quoted 6 lines · Pavel Machek
Quoted 3 lines

I don't even want to think about the interactions
between freezing the userspace memory pages and running some processes which may malloc/mmap at the same time.

There are none. userspace helper is mlocked, and rest of userspace is stopped.

Unless the userspace code is as tight as mission-critical RT code, I don't see how that can work reliably. Some problems I see:

It needs to be tight. Helper may not do anything below after it frozen rest of userland.

Quoted 12 lines

- What happens if the helper faults in new pages, changes its brk or mmaps things? Can we actually swap at that point? mlocking takes care of the fault in, not of the rest.

- What happens if the helper reads files? Where will the pages with the file data be put? Are we saving the dcache in the image, and if yes which state of the dcache?

- What happens if the helper writes files? What state are we saving, before starting the helper or after? Will the fs be in a coherent state after resume?

Quoted 5 lines

- What about IPC? What if for instance the helper tries to contact HAL to get some system information?

And if you decide on rules on what the userspace can and can't do, how do you plan to enforce them? We have filesystems on the line there,

We don't "enforce" rules in kernel, too, still it seems to work. Helper needs similar level of auditing to kernel code. It is not your average GUI application.

Quoted 4 lines

The idea of trying to save a state that can be modified dynamically while you're saving in unpredictable ways makes me very, very afraid. At least when you're in the kernel you can have complete control over the machine when needed.

Take a look at code. State is still atomically snapshoted with interrupts disabled, in kernel.
Pavel

Signature · 1 line
Thanks, Sharp!
#78 lore raw
In reply to Nigel Cunningham
Quoted 16 lines · Nigel Cunningham

Hi.

Quoted 6 lines · Pavel Machek

Hi!

Quoted 4 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.

Quoted 6 lines
Quoted 1 line

You know that's not an option.

No, I don't... please explain. Switching to this interface is going to be easier than pushing suspend2 into kernel. Granted, end result may not be suspend2, it may be something like suspend3, but it will be better result than u-swsusp or suspend2 is today...

Quoted 5 lines

It's not an option because I'm not trying not to step all over your codebase, because I'm not moving suspend2 to userspace and because it doesn't make sense to add another layer of abstraction by sticking /dev/snapshot in the middle of kernel space code. There may be more reasons, but I haven't looked at the /dev/snapshot code at all.

Please take a look at /dev/snapshot.

Parse error at the first sentence (too many nots), anyway:

1) we do not want two implementations of same code in kernel. [swsusp vs. pmdisk was a mess]

2) we are not going to merge code into kernel, when it is possible to do same thing in userspace. (*)

3) backwards compatibility is important in stable series.

4) merging code into kernel is a lot of work.

I do not think I want to remove swsusp from kernel. Even if I wanted to, there's 3). That means suspend2 should not go in (see 1). Even if I removed swsusp from kernel, suspend2 is not going to be merged, because of 2). Even if world somehow forgot that it is possible to do suspend2 in userspace, merging 10K lines of code is (4) still lot of work.

Oops, that looks bad for suspend2 merge. I really think you should take a look at /dev/snapshot. Unless it is terminally broken, I can't see how suspend2 could be merged.

Pavel
(*) or very close to same thing. We still can't save memory full of caches.

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

Hi.

Quoted 44 lines · Pavel Machek
Quoted 16 lines · Nigel Cunningham

Hi.

Quoted 6 lines · Pavel Machek

Hi!

Quoted 4 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.

Quoted 6 lines
Quoted 1 line

You know that's not an option.

No, I don't... please explain. Switching to this interface is going to be easier than pushing suspend2 into kernel. Granted, end result may not be suspend2, it may be something like suspend3, but it will be better result than u-swsusp or suspend2 is today...

Quoted 5 lines

It's not an option because I'm not trying not to step all over your codebase, because I'm not moving suspend2 to userspace and because it doesn't make sense to add another layer of abstraction by sticking /dev/snapshot in the middle of kernel space code. There may be more reasons, but I haven't looked at the /dev/snapshot code at all.

Please take a look at /dev/snapshot.

Parse error at the first sentence (too many nots), anyway:

1) we do not want two implementations of same code in kernel. [swsusp vs. pmdisk was a mess]

2) we are not going to merge code into kernel, when it is possible to do same thing in userspace. (*)

3) backwards compatibility is important in stable series.

4) merging code into kernel is a lot of work.

I do not think I want to remove swsusp from kernel. Even if I wanted to, there's 3). That means suspend2 should not go in (see 1). Even if I removed swsusp from kernel, suspend2 is not going to be merged, because of 2). Even if world somehow forgot that it is possible to do suspend2 in userspace, merging 10K lines of code is (4) still lot of work.

Quoted 3 lines

Oops, that looks bad for suspend2 merge. I really think you should take a look at /dev/snapshot. Unless it is terminally broken, I can't see how suspend2 could be merged.

I don't want to argue Pavel. I want to give users the best suspend to disk implementation they can get. If you want to argue, you can do so with yourself. Meanwhile, I'll work on getting Suspend2 ready for merging, and let Andrew and Linus decide what they think should happen. If they want to step in now and tell me not to bother, I'll happily listen and just maintain the patches out of kernel until you and Rafael get swsusp up to scratch. I'll even cc them now so they can have the opportunity to tell me not to bother. But that's not what I've heard so far. In previous correspondence between us, Andrew has seemed keen to get a better implementation in, and Linus said something to the effect of "I'm sold" when I gave him an impromptu demo last week at LCA (Linus, if you read this, feel free to tell me if my memory is faulty and I'm putting words in your mouth).

As to backwards compatability, that shouldn't be hard to do.

Regards,

Nigel

Quoted 2 lines

Pavel
(*) or very close to same thing. We still can't save memory full of caches.

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

Hi!

Quoted 21 lines
Quoted 21 lines

Please take a look at /dev/snapshot.

Parse error at the first sentence (too many nots), anyway:

1) we do not want two implementations of same code in kernel. [swsusp vs. pmdisk was a mess]

2) we are not going to merge code into kernel, when it is possible to do same thing in userspace. (*)

3) backwards compatibility is important in stable series.

4) merging code into kernel is a lot of work.

I do not think I want to remove swsusp from kernel. Even if I wanted to, there's 3). That means suspend2 should not go in (see 1). Even if I removed swsusp from kernel, suspend2 is not going to be merged, because of 2). Even if world somehow forgot that it is possible to do suspend2 in userspace, merging 10K lines of code is (4) still lot of work.

Quoted 6 lines
Quoted 3 lines

Oops, that looks bad for suspend2 merge. I really think you should take a look at /dev/snapshot. Unless it is terminally broken, I can't see how suspend2 could be merged.

I don't want to argue Pavel. I want to give users the best suspend to disk implementation they can get. If you want to argue, you can do so with

I want to create best suspen that can be still merged into kernel; I guess thats the difference. Anyway I believe that most of suspend should be done in userspace -- most of it can. But I guess you need to hear it from Linus/Andrew, so...

Quoted 3 lines

yourself. Meanwhile, I'll work on getting Suspend2 ready for merging, and let Andrew and Linus decide what they think should happen. If they want to step in now and tell me not to bother, I'll happily listen and just maintain the

Ahha, so that was the missing piece of puzzle.
Pavel

Signature · 1 line
Thanks, Sharp!
#81 lore raw
Quoted 8 lines · Pavel Machek
Quoted 3 lines

I don't want to argue Pavel. I want to give users the best suspend to disk implementation they can get. If you want to argue, you can do so with

I want to create best suspen that can be still merged into kernel; I guess thats the difference. Anyway I believe that most of suspend should be done in userspace -- most of it can. But I guess you need to hear it from Linus/Andrew, so...

You're unlikely to hear anything dispositive from either of us on this. You three guys know far more than us about suspend, so it would be silly for us to be making the technical decisions. When cornered, we're more likely to come out with general kernel platitudes such as "doing it in userspace:good" and "crashing the kernel:bad" and "incremental development with early merges:good" and "mucking up the kernel source:bad".

What we hope and expect is that you'll come up with an agreed path in accordance with general kernel coding and development principles. Linus and I don't want to have to make tiebreak decisions - if we have to do that, the system has failed.

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.

- 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.

- suspend2 is at a disadvantage because swsusp was merged first. If neither of the solutions had been merged and if we were evaluating them side-by-side, suspend2 would have a much better chance. This is a problem.

- 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.

- Justifying the inclusion of a feature by the appearance and usefulness of the end result doesn't really work in this world. There are numerous unmerged kernel features out there which work well and look great. But we will look under the hood, and that's when problems start.

So, as promised, there's nothing useful here. What we'd most like to see is for Nigel to start working on in-kernel swsusp, merging up the good bits from suspend2 in some evolutionary incremental manner under which the kernel continually improves. If, at the end of the day, that ends up with us having a complete implementation of suspend2, well, Mission Accomplished?

#82 lore raw
Quoted 2 lines · Andrew Morton

And having them separate like this weakens both in the area where
the real problems are: drivers.

Which are the worst offenders, keeping in mind that ALSA was recently fixed?

Lee

#83 lore raw
Quoted 8 lines · Lee Revell
Quoted 2 lines · Andrew Morton

And having them separate like this weakens both in the area where
the real problems are: drivers.

Which are the worst offenders, keeping in mind that ALSA was recently fixed?

I don't have that info, sorry - that was vague handwaving.

We seem to get a lot of reports of PATA drivers failing to resume correctly.

And video hardware not coming back in a sane state (lack of documentation).

#84 lore raw
Quoted 10 lines · Andrew Morton
Quoted 8 lines · Lee Revell
Quoted 2 lines · Andrew Morton

And having them separate like this weakens both in the area where
the real problems are: drivers.

Which are the worst offenders, keeping in mind that ALSA was recently fixed?

Quoted 6 lines

I don't have that info, sorry - that was vague handwaving.

We seem to get a lot of reports of PATA drivers failing to resume correctly.

And video hardware not coming back in a sane state (lack of documentation).

OK.

Follow up - do we have a rough idea how bad the suspend problem is, like approximately what % of laptops don't DTRT and just suspend when you close the lid?

Lee

#85 lore raw
Quoted 16 lines · Lee Revell
Quoted 14 lines · Andrew Morton
Quoted 8 lines · Lee Revell
Quoted 2 lines · Andrew Morton

And having them separate like this weakens both in the area where
the real problems are: drivers.

Which are the worst offenders, keeping in mind that ALSA was recently fixed?

I don't have that info, sorry - that was vague handwaving.

We seem to get a lot of reports of PATA drivers failing to resume correctly.

Quoted 9 lines
Quoted 2 lines

And video hardware not coming back in a sane state (lack of documentation).

OK.

Follow up - do we have a rough idea how bad the suspend problem is, like approximately what % of laptops don't DTRT and just suspend when you close the lid?

I do recall someone had some numbers on that, but I forget who it was. David might have a feel for it?

#86 lore raw
In reply to Lee Revell
Quoted 3 lines · Lee Revell

Follow up - do we have a rough idea how bad the suspend problem is, like approximately what % of laptops don't DTRT and just suspend when you close the lid?

None of the Dells we use at work (various models) handle suspend (both ram and disk) reliably. Got everything from not resuming when pushing the button (PWRF not giving an ACPI event while PWRC does), screen not coming back (as usual), system not coming back the second time (go figure) or resume eating up / from time to time. At that point people there are buying Macs.

I'm going to get a sacrificial (but modern) dell laptop in a month or two. I'll try to make things actually reliable on that one, including video. I don't have great hopes though.

'course the current state of the drm/fb interaction is yet another can of worms, one in a good way of being solved though.

OG.

[1] Reverse engineering is one of my hobbies

#87 lore raw

Hi Oliver.

Quoted 11 lines · Olivier Galibert
Quoted 3 lines · Lee Revell

Follow up - do we have a rough idea how bad the suspend problem is, like approximately what % of laptops don't DTRT and just suspend when you close the lid?

None of the Dells we use at work (various models) handle suspend (both ram and disk) reliably. Got everything from not resuming when pushing the button (PWRF not giving an ACPI event while PWRC does), screen not coming back (as usual), system not coming back the second time (go figure) or resume eating up / from time to time. At that point people there are buying Macs.

Not coming back the second time usually means it staggers through the first dazed and confused, but not badly enough so that you notice. The second attempt kills it. In this case, I'd go looking for something that plays up after the first resume. You might also try some of the hints on the suspend2 web site, such as trying from init S with minimal modules loaded. (If that works, you know it's something loaded later in the boot process that messes things up).

Quoted 3 lines

I'm going to get a sacrificial (but modern) dell laptop in a month or two. I'll try to make things actually reliable on that one, including video. I don't have great hopes though.

If you can't get it to go, try the suspend2 mailing list. I try to be as helpful as I can, and there are tons of users on there with good suggestions and experience you can make use of as well.

Quoted 2 lines

'course the current state of the drm/fb interaction is yet another can of worms, one in a good way of being solved though.

Yes. You'll have much better success without DRI in the picture.

Regards,

Nigel

Quoted 8 lines

OG.

[1] Reverse engineering is one of my hobbies
-
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/

Signature · 2 lines
See our web page for Howtos, FAQs, the Wiki and mailing list info.
http://www.suspend2.net                IRC: #suspend2 on Freenode
#88 lore raw
In reply to Olivier Galibert
Quoted 11 lines · Olivier Galibert
Quoted 3 lines · Lee Revell

Follow up - do we have a rough idea how bad the suspend problem is, like approximately what % of laptops don't DTRT and just suspend when you close the lid?

None of the Dells we use at work (various models) handle suspend (both ram and disk) reliably. Got everything from not resuming when pushing the button (PWRF not giving an ACPI event while PWRC does), screen not coming back (as usual), system not coming back the second time (go figure) or resume eating up / from time to time. At that point people there are buying Macs.

Please debug suspend2disk first, and talk about them separately. They are really different. If you have problem with suspend2disk, it should be easy to solve it (or at least point you at problematic module). I would not want to promise that for suspend2ram (we can usually fix that, too, but). Please keep them separate.

Pavel

Signature · 1 line
Thanks, Sharp!
#89 lore raw
In reply to Lee Revell
Quoted 3 lines · Lee Revell

Follow up - do we have a rough idea how bad the suspend problem is, like approximately what % of laptops don't DTRT and just suspend when you close the lid?

It's arguable whether "just suspending when you close the lid" is actually DTRT, but if you want "how many x86 laptops can we successfully suspend and resume" then the number is between 80-90% for RAM and a little more than that for disk (numbers based on Ubuntu, other distributions don't have as much infrastructure for this right now). This is based on doing hacky things like unloading all the network and USB drivers before suspend, but by and large the driver situation is much improved. The single biggest problem is video reinitialisation, and that can't be solved in-kernel.

Based on actual hard, shipping evidence - swsusp works sufficiently well that throwing it out and replacing it with a different implemenation is entirely unnecessary. The two big advantages that suspend2 brings us are

1) Improved speed (an entirely fair objection to swsusp)
2) Graphical bling (and I think doing that in the kernel is pretty insane)

Pavel's proposed plan brings us both of those without massive kernel changes, so I'm really quite tempted to go with that. From a distribution standpoint, integrating it is very straightforward.

(By and large, the biggest problem is repeated kernel regressions that hit suspend in bizarre ways. This doesn't get picked up on quickly because almost nobody is using this code, because "everyone knows" it doesn't work. Except it /does/. What we need is for distributions to actually work together on this, rather than everyone trying to fix the same problems independently, each coming up with different solutions and the world generally being a miserable place)

Signature · 1 line
Matthew Garrett | [email protected]
#90 lore raw
Quoted 8 lines · Matthew Garrett

(By and large, the biggest problem is repeated kernel regressions that
hit suspend in bizarre ways. This doesn't get picked up on quickly because almost nobody is using this code, because "everyone knows" it doesn't work. Except it /does/. What we need is for distributions to actually work together on this, rather than everyone trying to fix the same problems independently, each coming up with different solutions and the world generally being a miserable place)

Is it still the case that swsusp requries that the disk drivers be statically linked into vmlinux?

If so, I'd have thought that this was quite a problem for distros, although I have a vague feeling that RH worked around it in some manner.

#91 lore raw
Quoted 2 lines · Andrew Morton

Is it still the case that swsusp requries that the disk drivers be statically linked into vmlinux?

No, I submitted a patch for that that went into 2.6.13. In initrd/initramfs, load the controller modules and then echo the major:minor of the suspend device into /sys/power/resume. As long as this is done before any filesystems are mounted, it works fine.

(Yes, it gives you the ability to shoot yourself in the foot, but then so does the rest of the kernel...)

Signature · 1 line
Matthew Garrett | [email protected]
#92 lore raw
In reply to Andrew Morton
Quoted 10 lines · Andrew Morton
Quoted 8 lines · Matthew Garrett

(By and large, the biggest problem is repeated kernel regressions that
hit suspend in bizarre ways. This doesn't get picked up on quickly because almost nobody is using this code, because "everyone knows" it doesn't work. Except it /does/. What we need is for distributions to actually work together on this, rather than everyone trying to fix the same problems independently, each coming up with different solutions and the world generally being a miserable place)

Quoted 5 lines

Is it still the case that swsusp requries that the disk drivers be statically linked into vmlinux?

If so, I'd have thought that this was quite a problem for distros, although I have a vague feeling that RH worked around it in some manner.

We do it all in the initrd, before any filesystems are touched.

Dave

#93 lore raw
In reply to Matthew Garrett
Quoted 9 lines · Matthew Garrett
Quoted 3 lines · Lee Revell

Follow up - do we have a rough idea how bad the suspend problem is, like approximately what % of laptops don't DTRT and just suspend when you close the lid?

It's arguable whether "just suspending when you close the lid" is actually DTRT, but if you want "how many x86 laptops can we successfully

:-).

Quoted 7 lines

suspend and resume" then the number is between 80-90% for RAM and a little more than that for disk (numbers based on Ubuntu, other distributions don't have as much infrastructure for this right now). This is based on doing hacky things like unloading all the network and USB drivers before suspend, but by and large the driver situation is much improved. The single biggest problem is video reinitialisation, and that can't be solved in-kernel.

...and Ubuntu has vbetool solution which seems to work on 90% of all notebooks, nice. Which big whitelist that basically says it all works. Thanks for doing this work.

Quoted 7 lines

(By and large, the biggest problem is repeated kernel regressions that hit suspend in bizarre ways. This doesn't get picked up on quickly because almost nobody is using this code, because "everyone knows" it doesn't work. Except it /does/. What we need is for distributions to actually work together on this, rather than everyone trying to fix the same problems independently, each coming up with different solutions and the world generally being a miserable place)

Perhaps we should force suspend/resume cycle at one of 10 boots :-).

Actually if you want to very quickly test if your changes did not break swsusp, it should be enough to do

swapoff -a; echo -n disk > /sys/power/state

. Your system will do half of system suspend, immediately followed by resume.

Pavel

Signature · 1 line
Thanks, Sharp!
#94 lore raw
In reply to Andrew Morton
Quoted 10 lines · Andrew Morton
Quoted 8 lines · Lee Revell
Quoted 2 lines · Andrew Morton

And having them separate like this weakens both in the area where
the real problems are: drivers.

Which are the worst offenders, keeping in mind that ALSA was recently fixed?

Quoted 5 lines

I don't have that info, sorry - that was vague handwaving.

We seem to get a lot of reports of PATA drivers failing to resume correctly.

And video hardware not coming back in a sane state (lack of documentation).

Video problems seem to be broken for suspend2ram, not swsusp.

Not that we don't have swsusp drivers problems, but they tend to be randomly, all over the map, mostly over drivers I never heard about.

suspend2ram is different fish, video and ATA are real problems there. At least there are solutions on ATA being worked on.

Pavel

Signature · 1 line
Thanks, Sharp!

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

#96 lore raw

Hi!

Quoted 10 lines
Quoted 7 lines

Video problems seem to be broken for suspend2ram, not swsusp.

Not that we don't have swsusp drivers problems, but they tend to be randomly, all over the map, mostly over drivers I never heard about.

suspend2ram is different fish, video and ATA are real problems there. At least there are solutions on ATA being worked on.

What PATA problems are you talking about?

Quoted 7 lines

In kernel bugzilla there are 2 bugs related to suspend/resume:

* #5257 for 2.6.13.1 (seem to be fixed in 2.6.15.2)
* #5673 for 2.6.14.3 (not enough information to start debugging)

and I don't recall any problems being reported to linux-ide ML or linux-kernel ML recently.

We were not calling some ACPI methods to awake IDE correctly. It did not properly work with disk passwords or something like that.

...ahha, have it (should be reachable from outside...):

https://bugzilla.novell.com/show_bug.cgi?id=145591

(and linked:

http://bugzilla.kernel.org/show_bug.cgi?id=2039 and
http://bugzilla.kernel.org/show_bug.cgi?id=5604

)

Quoted 7 lines

Most bugreports I've seen was caused by:
* using ide-generic instead of proper host driver (no wonder that it fails)
* playing with hdparm when not needed (don't do it)

Also IIRC SATA suspend/resume support was merged into mainline (?) so things should work better now.

I think SATA had similar problems with ACPI methods. Patches for SATA seem to be in better shape in PATA side, but I don't think they are in.

But I do not have affected hardware here...
Pavel

Signature · 1 line
Thanks, Sharp!
#97 lore raw
Quoted 14 lines · Pavel Machek

Hi!

Quoted 12 lines
Quoted 7 lines

Video problems seem to be broken for suspend2ram, not swsusp.

Not that we don't have swsusp drivers problems, but they tend to be randomly, all over the map, mostly over drivers I never heard about.

suspend2ram is different fish, video and ATA are real problems there. At least there are solutions on ATA being worked on.

What PATA problems are you talking about?

In kernel bugzilla there are 2 bugs related to suspend/resume:

Quoted 8 lines
Quoted 5 lines

* #5257 for 2.6.13.1 (seem to be fixed in 2.6.15.2)
* #5673 for 2.6.14.3 (not enough information to start debugging)

and I don't recall any problems being reported to linux-ide ML or linux-kernel ML recently.

We were not calling some ACPI methods to awake IDE correctly. It did not properly work with disk passwords or something like that.

Ah, ACPI support, it is being worked on but ATA ACPI should be used as last resort. Why? We want IDE/libata drivers to have correct knowledge about state of controller and devices.

There are specific cases when ACPI support is required (WRT disk passwords we can and should support this without need for ACPI) but most of systems should work just fine without it. Also ACPI support can just hide bugs in core code and host drivers which still needs to be fixed (which i.e. happened for VIA IDE bug)...

Quoted 3 lines

...ahha, have it (should be reachable from outside...):

https://bugzilla.novell.com/show_bug.cgi?id=145591

Jens' question is quite important here.

Quoted 3 lines

(and linked:

http://bugzilla.kernel.org/show_bug.cgi?id=2039 and

VIA IDE driver had bug in tuning code which prevented resume from working, it was fixed ages ago.

[ commented into bug entry with request for retesting
with latest kernel ]

Quoted 1 line

http://bugzilla.kernel.org/show_bug.cgi?id=5604

ide-generic is being used instead of piix (sigh)

Any other bugreports?

While at it let me explain some confusion which I've seen cut'n'pasted into three bugreports (RedHat bugzilla, Ubuntu bugzilla and kernel bugzilla):

"Linux currently has no real support for setting up IDE interfaces on resume. Some machines are kind enough to set the IDE interface up themselves, but on others we're doomed to failure."

This is untrue as Linux has support for setting IDE controller and drives. It was added by Benjamin Herrenschmidt in late 2.5.x or early 2.6.x (I don't remember exact kernel version).

Quoted 7 lines

)

Quoted 5 lines

Most bugreports I've seen was caused by:
* using ide-generic instead of proper host driver (no wonder that it fails)
* playing with hdparm when not needed (don't do it)

Quoted 5 lines
Quoted 2 lines

Also IIRC SATA suspend/resume support was merged into mainline (?) so things should work better now.

I think SATA had similar problems with ACPI methods. Patches for SATA seem to be in better shape in PATA side, but I don't think they are in.

They are in mainline, maybe in Jeff's git tree... still the same comments about ACPI support not being "Holy Grail" for fixing all ATA suspend/resume problems apply...

More general request to ACPI and PM folks - if you get bugreports which clearly indicate that [P,S]ATA drivers to blame please narrowing it down a bit with help of bugreporter and feel free to:

* ask on linux-ide ML about the problem
* add "me" to cc: for the bug (or asign "me" as owner)

I can't promise fixing them all but leaving bugs as they are without _informing_ and _working_ with ATA developers is clearly not going to help...

Thanks,
Bartlomiej

#98 lore raw
Quoted 3 lines · Bartlomiej Zolnierkiewicz

This is untrue as Linux has support for setting IDE controller and drives. It was added by Benjamin Herrenschmidt in late 2.5.x or early 2.6.x (I don't remember exact kernel version).

In generic_ide_resume, rqpm.pm_step gets set to ide_pm_state_start_resume and ide_do_drive_cmd gets called. This ends up being passed through to start_request. start_request waits for the BSY bit to go away. On the affected hardware I've seen, this never happens unless the ACPI calls are made. As far as I can tell, there's nothing in the current driver code that does anything to make sure that the bus is in a state to accept commands at this point - the pci drivers don't (for the most part) seem to have any resume methods. Calling the ACPI _STM method before attempting to do this magically makes everything work.

Signature · 1 line
Matthew Garrett | [email protected]
#99 lore raw
Quoted 6 lines · Matthew Garrett
Quoted 3 lines · Bartlomiej Zolnierkiewicz

This is untrue as Linux has support for setting IDE controller and drives. It was added by Benjamin Herrenschmidt in late 2.5.x or early 2.6.x (I don't remember exact kernel version).

Quoted 9 lines

In generic_ide_resume, rqpm.pm_step gets set to ide_pm_state_start_resume and ide_do_drive_cmd gets called. This ends up being passed through to start_request. start_request waits for the BSY bit to go away. On the affected hardware I've seen, this never happens unless the ACPI calls are made. As far as I can tell, there's nothing in the current driver code that does anything to make sure that the bus is in a state to accept commands at this point - the pci drivers don't (for the most part) seem to have any resume methods. Calling the ACPI _STM method before attempting to do this magically makes everything work.

I don't see anything that prevents addition of ->suspend and ->resume for IDE PCI host drivers (not IDE core issue) if some special sequence is needed.

I see that we may be doing PIO/DMA setup too late (IDE core issue) for some controllers.

Could you fill a bug at kernel bugzilla with data as much data about affected hardware as possible (dmesg, kernel config, lspci -vvv -xxx before susped and if possible PCI configuration dumped from kernel after suspend)?

What is the current state of IDE ACPI patches?
Were the issues raised on linux-ide addressed?

Thanks,
Bartlomiej

#100 lore raw
Quoted 24 lines · Bartlomiej Zolnierkiewicz
Quoted 6 lines · Matthew Garrett
Quoted 3 lines · Bartlomiej Zolnierkiewicz

This is untrue as Linux has support for setting IDE controller and drives. It was added by Benjamin Herrenschmidt in late 2.5.x or early 2.6.x (I don't remember exact kernel version).

Quoted 9 lines

In generic_ide_resume, rqpm.pm_step gets set to ide_pm_state_start_resume and ide_do_drive_cmd gets called. This ends up being passed through to start_request. start_request waits for the BSY bit to go away. On the affected hardware I've seen, this never happens unless the ACPI calls are made. As far as I can tell, there's nothing in the current driver code that does anything to make sure that the bus is in a state to accept commands at this point - the pci drivers don't (for the most part) seem to have any resume methods. Calling the ACPI _STM method before attempting to do this magically makes everything work.

I don't see anything that prevents addition of ->suspend and ->resume for IDE PCI host drivers (not IDE core issue) if some special sequence is needed.

I see that we may be doing PIO/DMA setup too late (IDE core issue) for some controllers.

Quoted 7 lines

Could you fill a bug at kernel bugzilla with data as much data about affected hardware as possible (dmesg, kernel config, lspci -vvv -xxx before susped and if possible PCI configuration dumped from kernel after suspend)?

What is the current state of IDE ACPI patches?
Were the issues raised on linux-ide addressed?

I haven't seen any updates to the drivers/ide/ patch from Shaohua Li <[email protected]>. I'm beginning to work on PATA ACPI object support that is similar to the current SATA ACPI patches -- all for libata. Is this the right or wrong thing to do?

Thanks,

Signature · 1 line
~Randy
#101 lore raw
Quoted 31 lines · Randy.Dunlap
Quoted 29 lines · Bartlomiej Zolnierkiewicz
Quoted 6 lines · Matthew Garrett
Quoted 3 lines · Bartlomiej Zolnierkiewicz

This is untrue as Linux has support for setting IDE controller and drives. It was added by Benjamin Herrenschmidt in late 2.5.x or early 2.6.x (I don't remember exact kernel version).

Quoted 9 lines

In generic_ide_resume, rqpm.pm_step gets set to ide_pm_state_start_resume and ide_do_drive_cmd gets called. This ends up being passed through to start_request. start_request waits for the BSY bit to go away. On the affected hardware I've seen, this never happens unless the ACPI calls are made. As far as I can tell, there's nothing in the current driver code that does anything to make sure that the bus is in a state to accept commands at this point - the pci drivers don't (for the most part) seem to have any resume methods. Calling the ACPI _STM method before attempting to do this magically makes everything work.

I don't see anything that prevents addition of ->suspend and ->resume for IDE PCI host drivers (not IDE core issue) if some special sequence is needed.

I see that we may be doing PIO/DMA setup too late (IDE core issue) for some controllers.

Could you fill a bug at kernel bugzilla with data as much data about affected hardware as possible (dmesg, kernel config, lspci -vvv -xxx before susped and if possible PCI configuration dumped from kernel after suspend)?

Quoted 8 lines
Quoted 2 lines

What is the current state of IDE ACPI patches?
Were the issues raised on linux-ide addressed?

I haven't seen any updates to the drivers/ide/ patch from Shaohua Li <[email protected]>. I'm beginning to work on PATA ACPI object support that is similar to the current SATA ACPI patches -- all for libata. Is this the right or wrong thing to do?

Working on patches is always right thing to do... 8)

Just one remark: please try to make ACPI part
as libata/SCSI independent as possible.

Thanks,
Bartlomiej

#102 lore raw
Quoted 35 lines · Bartlomiej Zolnierkiewicz
Quoted 34 lines · Randy.Dunlap
Quoted 31 lines · Bartlomiej Zolnierkiewicz
Quoted 6 lines · Matthew Garrett
Quoted 3 lines · Bartlomiej Zolnierkiewicz

This is untrue as Linux has support for setting IDE controller and drives. It was added by Benjamin Herrenschmidt in late 2.5.x or early 2.6.x (I don't remember exact kernel version).

Quoted 9 lines

In generic_ide_resume, rqpm.pm_step gets set to ide_pm_state_start_resume and ide_do_drive_cmd gets called. This ends up being passed through to start_request. start_request waits for the BSY bit to go away. On the affected hardware I've seen, this never happens unless the ACPI calls are made. As far as I can tell, there's nothing in the current driver code that does anything to make sure that the bus is in a state to accept commands at this point - the pci drivers don't (for the most part) seem to have any resume methods. Calling the ACPI _STM method before attempting to do this magically makes everything work.

I don't see anything that prevents addition of ->suspend and ->resume for IDE PCI host drivers (not IDE core issue) if some special sequence is needed.

I see that we may be doing PIO/DMA setup too late (IDE core issue) for some controllers.

Could you fill a bug at kernel bugzilla with data as much data about affected hardware as possible (dmesg, kernel config, lspci -vvv -xxx before susped and if possible PCI configuration dumped from kernel after suspend)?

What is the current state of IDE ACPI patches?
Were the issues raised on linux-ide addressed?

Quoted 7 lines
Quoted 5 lines

I haven't seen any updates to the drivers/ide/ patch from Shaohua Li <[email protected]>. I'm beginning to work on PATA ACPI object support that is similar to the current SATA ACPI patches -- all for libata. Is this the right or wrong thing to do?

Working on patches is always right thing to do... 8)

Of course. That wasn't really the question. 8;)

Quoted 2 lines

Just one remark: please try to make ACPI part
as libata/SCSI independent as possible.

You sort of replied obliquely to my "all for libata" comment. These patches are all libata-specific.
At least they are SCSI-independent. :)

Signature · 1 line
~Randy
#103 lore raw
Quoted 45 lines · Randy.Dunlap
Quoted 35 lines · Bartlomiej Zolnierkiewicz
Quoted 34 lines · Randy.Dunlap
Quoted 31 lines · Bartlomiej Zolnierkiewicz
Quoted 6 lines · Matthew Garrett
Quoted 3 lines · Bartlomiej Zolnierkiewicz

This is untrue as Linux has support for setting IDE controller and drives. It was added by Benjamin Herrenschmidt in late 2.5.x or early 2.6.x (I don't remember exact kernel version).

Quoted 9 lines

In generic_ide_resume, rqpm.pm_step gets set to ide_pm_state_start_resume and ide_do_drive_cmd gets called. This ends up being passed through to start_request. start_request waits for the BSY bit to go away. On the affected hardware I've seen, this never happens unless the ACPI calls are made. As far as I can tell, there's nothing in the current driver code that does anything to make sure that the bus is in a state to accept commands at this point - the pci drivers don't (for the most part) seem to have any resume methods. Calling the ACPI _STM method before attempting to do this magically makes everything work.

I don't see anything that prevents addition of ->suspend and ->resume for IDE PCI host drivers (not IDE core issue) if some special sequence is needed.

I see that we may be doing PIO/DMA setup too late (IDE core issue) for some controllers.

Could you fill a bug at kernel bugzilla with data as much data about affected hardware as possible (dmesg, kernel config, lspci -vvv -xxx before susped and if possible PCI configuration dumped from kernel after suspend)?

What is the current state of IDE ACPI patches?
Were the issues raised on linux-ide addressed?

Quoted 7 lines
Quoted 5 lines

I haven't seen any updates to the drivers/ide/ patch from Shaohua Li <[email protected]>. I'm beginning to work on PATA ACPI object support that is similar to the current SATA ACPI patches -- all for libata. Is this the right or wrong thing to do?

Working on patches is always right thing to do... 8)

Quoted 7 lines

Of course. That wasn't really the question. 8;)

Quoted 2 lines

Just one remark: please try to make ACPI part
as libata/SCSI independent as possible.

You sort of replied obliquely to my "all for libata" comment. These patches are all libata-specific.

Yes, developing for libata-only should be much easier to do. We can backport it to IDE if/when needed later.

Just a reminder so nobody gets a wrong idea:
the above is in perfect harmony with my opinion wrt libata PATA support - IDE driver should evolve and be merged with libata (evolutionary vs revolutionary).

Quoted 1 line

At least they are SCSI-independent. :)

Well at least not directly. :)

Bartlomiej

#104 lore raw
In reply to Lee Revell

Hi.

Quoted 6 lines · Lee Revell
Quoted 2 lines · Andrew Morton

And having them separate like this weakens both in the area where
the real problems are: drivers.

Which are the worst offenders, keeping in mind that ALSA was recently fixed?

USB used to be a big problem, but Greg and the other USB guys are doing great work, and it has improved a lot since 2.6.12.

The worst areas now are video drivers, particularly where DRI and/or Nvidia are involved.

Following that there are some is frequently used hardware such as firewire and hardware that people try to suspend less often, such as scsi. ACPI, cpufreq and the like have accounted for a share of problems in the past, but are generally ok now.

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
#105 lore raw
In reply to Andrew Morton

Hi,

Quoted 22 lines · Andrew Morton
Quoted 8 lines · Pavel Machek
Quoted 3 lines

I don't want to argue Pavel. I want to give users the best suspend to disk implementation they can get. If you want to argue, you can do so with

I want to create best suspen that can be still merged into kernel; I guess thats the difference. Anyway I believe that most of suspend should be done in userspace -- most of it can. But I guess you need to hear it from Linus/Andrew, so...

You're unlikely to hear anything dispositive from either of us on this. You three guys know far more than us about suspend, so it would be silly for us to be making the technical decisions. When cornered, we're more likely to come out with general kernel platitudes such as "doing it in userspace:good" and "crashing the kernel:bad" and "incremental development with early merges:good" and "mucking up the kernel source:bad".

What we hope and expect is that you'll come up with an agreed path in accordance with general kernel coding and development principles. Linus and I don't want to have to make tiebreak decisions - if we have to do that, the system has failed.

Quoted 4 lines

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.

Surely. :-)

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.

I haven't had any problems with drivers wrt suspend to disk recently, but s2ram vs video is a different story. AFAICT, Pavel is working on it. Unfortunately I can't help here, because I'm not a driver expert, so I do what I can ie. improve the swsusp core.

Still, the driver problems are common to both swsusp and suspend2.

Quoted 10 lines

- suspend2 is at a disadvantage because swsusp was merged first. If neither of the solutions had been merged and if we were evaluating them side-by-side, suspend2 would have a much better chance. This is a problem.

- 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.

Well, I started to work on swsusp, because it was in the kernel and it didn't work on my box. Now I'm almost satisfied with how it works for me, but I'm all for further improvements.

Quoted 10 lines

- Justifying the inclusion of a feature by the appearance and usefulness of the end result doesn't really work in this world. There are numerous unmerged kernel features out there which work well and look great. But we will look under the hood, and that's when problems start.

So, as promised, there's nothing useful here. What we'd most like to see is for Nigel to start working on in-kernel swsusp, merging up the good bits from suspend2 in some evolutionary incremental manner under which the kernel continually improves.

That is exactly what I'd like to happen.

Quoted 2 lines

If, at the end of the day, that ends up with us having a complete implementation of suspend2, well, Mission Accomplished?

Most probably we'll end up with something else, maybe better? ;-)

Greetings,
Rafael

#106 lore raw
In reply to Andrew Morton

Hi Andrew et al.

Quoted 48 lines · Andrew Morton
Quoted 8 lines · Pavel Machek
Quoted 3 lines

I don't want to argue Pavel. I want to give users the best suspend to disk implementation they can get. If you want to argue, you can do so with

I want to create best suspen that can be still merged into kernel; I guess thats the difference. Anyway I believe that most of suspend should be done in userspace -- most of it can. But I guess you need to hear it from Linus/Andrew, so...

You're unlikely to hear anything dispositive from either of us on this. You three guys know far more than us about suspend, so it would be silly for us to be making the technical decisions. When cornered, we're more likely to come out with general kernel platitudes such as "doing it in userspace:good" and "crashing the kernel:bad" and "incremental development with early merges:good" and "mucking up the kernel source:bad".

What we hope and expect is that you'll come up with an agreed path in accordance with general kernel coding and development principles. Linus and I don't want to have to make tiebreak decisions - if we have to do that, the system has failed.

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.

- 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.

- suspend2 is at a disadvantage because swsusp was merged first. If neither of the solutions had been merged and if we were evaluating them side-by-side, suspend2 would have a much better chance. This is a problem.

- 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.

- Justifying the inclusion of a feature by the appearance and usefulness of the end result doesn't really work in this world. There are numerous unmerged kernel features out there which work well and look great. But we will look under the hood, and that's when problems start.

Quoted 6 lines

So, as promised, there's nothing useful here. What we'd most like to see is for Nigel to start working on in-kernel swsusp, merging up the good bits from suspend2 in some evolutionary incremental manner under which the kernel continually improves. If, at the end of the day, that ends up with us having a complete implementation of suspend2, well, Mission Accomplished?

Thanks for the reply. You're right. It doesn't help at all :)

Well, actually it does.

It reminds me why I started working on this in the first place. It wasn't because I wanted to be a big shot kernel developer or the like, or have my name in the kernel credits. It was because I wanted to use the code.

So, given that I'm perfectly willing to send Pavel patches, but he's not willing to take them, I guess I the best thing I can do is to just let Pavel have his way, give up on the concept of merging Suspend2 and maintain it out of tree. When Pavel and Rafael get swsusp up to scratch, I can stop doing that and just use their version.

Well, that's what I think at the moment. Let's see how things progress.

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
#107 lore raw

Quoting Nigel Cunningham <[email protected]>:

Quoted 3 lines

It reminds me why I started working on this in the first place. It wasn't because I wanted to be a big shot kernel developer or the like, or have my name in the kernel credits. It was because I wanted to use the code.

And what a superb job you have done with suspend2! Kudos Nigel!

Here are the facts from my notebook suspend2 actually does work, works reliably, is fast and pretty, none of which is true for swsusp. From my user perspective, the refusal to merge suspend2 into mainline etc. is just contributing to one thing - Linux not having decent suspend/resume in vanilla tree.

I travel on the train every day and I can confidently say that I'm the only person there with a Linux based notebook. Everyone else is having Windows or an occasional Mac. These people *never* have to worry about suspending and resuming - it just works for them. That's because Microsoft and Apple decided this was important many, many years ago.

Unless mainline kernel folks decide to give people something that works and works reliably, this thing will drag on for many more years, I'm afraid. Ah well, as long as you keep the great job releasing suspend2 for the up-to-date kernels, at least one more Linux notebook will be able to suspend/resume properly.

Bottom line: With your code, my machine works. Without it, it doesn't.

Signature · 1 line
Bojan
#108 lore raw
Quoted 2 lines · Bojan Smojver

Bottom line: With your code, my machine works. Without it, it doesn't.

This leaves us in rather awkward position. You see, there will be other people whose machines don't work with suspend2 but which do work with swsusp. And other people who prefer swsusp for other reasons.

It'd help if we knew _why_ your machine doesn't work with swsusp so we can fix it. Futhermore it'd help if we knew specifically what you prefer about suspend2 so we can understand what more needs to be done, and how we should do it.

#109 lore raw

Hi again.

Quoted 11 lines · Andrew Morton
Quoted 1 line · Bojan Smojver

Bottom line: With your code, my machine works. Without it, it doesn't.

This leaves us in rather awkward position. You see, there will be other people whose machines don't work with suspend2 but which do work with swsusp. And other people who prefer swsusp for other reasons.

It'd help if we knew _why_ your machine doesn't work with swsusp so we can fix it. Futhermore it'd help if we knew specifically what you prefer about suspend2 so we can understand what more needs to be done, and how we should do it.

As much as I appreciate Bojan's comments, I want to ask the same question - when it comes to driver model invocations and the method of restoring the original kernel data, swsusp and Suspend2 work in almost exactly the same way, so if one works for someone, the other should too and vice versa.

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
#110 lore raw
In reply to Andrew Morton

Quoting Andrew Morton <[email protected]>:

Quoted 3 lines

This leaves us in rather awkward position. You see, there will be other people whose machines don't work with suspend2 but which do work with swsusp. And other people who prefer swsusp for other reasons.

From what I can see on suspend2 development list, Nigel regularly addresses people's problems with his code, which then results in working systems. Most times when people see problems with suspend2, it is the drivers that can't do suspend that are the root cause (at least that seems to be the pattern on the suspend2 mailing list).

The only way for a much broader community to experience and test suspend2 is to put it in the mainline kernel. I'm not sure why that is such a problem...

Quoted 4 lines

It'd help if we knew _why_ your machine doesn't work with swsusp so we can fix it. Futhermore it'd help if we knew specifically what you prefer about suspend2 so we can understand what more needs to be done, and how we should do it.

Here is what I prefer in suspend2:

- it works (i.e. I have compiled it for at least 20 different Rawhide kernels and it always suspended/resumed properly)

- it is reliable (e.g. I have suspended/resumed mid kernel compile - actually, kernel RPM build, which included compile - many times, without any ill effect)

- it is fast (i.e. even on my crappy old HP ZE4201 [http://www.rexursive.com/articles/linuxonhpze4201.html], it writes all of 700+ MB of RAM to disk just as fast or faster than swsusp).

- it looks nice (both text and GUI interface supported)

- it leaves the system responsive on resume (kinda nice to come back to X and "Just Use it")

- it suspends to both swap and file (I personally use swap, but many people on the list use file)

Just today, I tried the most recent Rawhide kernel (based on 2.6.16-rc1-git5) with swsusp and for the first time *ever* it actually returned X to its original state (I was so excited, I even notified people on suspend2 development list about it). But, on second suspend/resume, it promptly locked up my system. Before, it would simply lock up. So, if swsusp can be made to actually work, be reliable, look nice and be responsive on resume, I'm all for it. I will miss Nigel's excellent support though, but I'm sure he deserves a break :-)

Signature · 1 line
Bojan
#111 lore raw

Hi,

Quoted 39 lines · Bojan Smojver

Quoting Andrew Morton <[email protected]>:

Quoted 3 lines

This leaves us in rather awkward position. You see, there will be other people whose machines don't work with suspend2 but which do work with swsusp. And other people who prefer swsusp for other reasons.

From what I can see on suspend2 development list, Nigel regularly
addresses people's problems with his code, which then results in working systems. Most times when people see problems with suspend2, it is the drivers that can't do suspend that are the root cause (at least that seems to be the pattern on the suspend2 mailing list).

The only way for a much broader community to experience and test suspend2 is to put it in the mainline kernel. I'm not sure why that is such a problem...

Quoted 4 lines

It'd help if we knew _why_ your machine doesn't work with swsusp so we can fix it. Futhermore it'd help if we knew specifically what you prefer about suspend2 so we can understand what more needs to be done, and how we should do it.

Here is what I prefer in suspend2:

- it works (i.e. I have compiled it for at least 20 different Rawhide kernels and it always suspended/resumed properly)

- it is reliable (e.g. I have suspended/resumed mid kernel compile - actually, kernel RPM build, which included compile - many times, without any ill effect)

- it is fast (i.e. even on my crappy old HP ZE4201
[http://www.rexursive.com/articles/linuxonhpze4201.html], it writes all of 700+ MB of RAM to disk just as fast or faster than swsusp).

- it looks nice (both text and GUI interface supported)

- it leaves the system responsive on resume (kinda nice to come back to X and "Just Use it")

Quoted 8 lines

- it suspends to both swap and file (I personally use swap, but many people on the list use file)

Just today, I tried the most recent Rawhide kernel (based on 2.6.16-rc1-git5) with swsusp and for the first time *ever* it actually returned X to its original state (I was so excited, I even notified people on suspend2 development list about it). But, on second suspend/resume, it promptly locked up my system.

Well, it would help if you said in which stage of suspend/resume it actually locked up the system.

Anyway, we are working on fixing these problems right now, so maybe you'd like to test some patches?

Quoted 2 lines

Before, it would simply lock up. So, if swsusp can be made to actually work, be reliable, look nice and be responsive on resume, I'm all for it.

I think it can be, hopefully with Nigel's help.

Quoted 2 lines

I will miss Nigel's excellent support though, but I'm sure he deserves a break :-)

I'm definitely interested in resolving your problems with swsusp, so could you please send me a boot log from your box? Also, if you are able to get a serial console or net console output from it during suspend/resume, especially in the failing case, that would help a lot. [Please do not litter the list with that, though.]

Greetings,
Rafael

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]

#114 lore raw
Quoted 7 lines · Rafael J. Wysocki

Well, unfortunately this is one of the problems I cannot solve. This should really be reported to LKML as the ATI AGP driver problem or directly to the developers of this particular driver. I can submit a bug report based on the inormation from you, though.

[swsusp uses whatever is in the drivers, so driver problems need to be fixed by their developers.]

This is exactly the point that I'm trying to make (and Nigel hinted something along these lines). These problems have obviously been solved in suspend2 (and I've got a machine to show it). Solutions are right there. But for some reason, we are back to the drawing board.

I suggest you guys ask Nigel as to what he changed to make this work. I don't think he just put the code there at random.

Look, I know I'm going to get blamed here for all kinds of things, from starting a flame war to being incompetent because I'm not a kernel hacker. That's cool. All I know is that somehow, somewhere, there are chunks of code in suspend2 that make things work. If I didn't know better, I would say it must be by magic :-)

Signature · 1 line
Bojan
#115 lore raw
In reply to Bojan Smojver

Hi!

Just for the record.

Quoted 8 lines

Here is what I prefer in suspend2:

- it works (i.e. I have compiled it for at least 20 different Rawhide kernels and it always suspended/resumed properly)

- it is reliable (e.g. I have suspended/resumed mid kernel compile - actually, kernel RPM build, which included compile - many times, without any ill effect)

Rafael has test patch for this one.

Quoted 3 lines

- it is fast (i.e. even on my crappy old HP ZE4201
[http://www.rexursive.com/articles/linuxonhpze4201.html], it writes all of 700+ MB of RAM to disk just as fast or faster than swsusp).

Help us with userland parts of uswsusp, pretty please?

Quoted 1 line

- it looks nice (both text and GUI interface supported)

Planned for userland parts.

Quoted 2 lines

- it leaves the system responsive on resume (kinda nice to come back to X and "Just Use it")

Merged in latest mainline.

Quoted 2 lines

- it suspends to both swap and file (I personally use swap, but many people on the list use file)

Doable in userland parts; not sure with someone plans it.

Quoted 9 lines

Just today, I tried the most recent Rawhide kernel (based on 2.6.16-rc1-git5) with swsusp and for the first time *ever* it actually returned X to its original state (I was so excited, I even notified people on suspend2 development list about it). But, on second suspend/resume, it promptly locked up my system. Before, it would simply lock up. So, if swsusp can be made to actually work, be reliable, look nice and be responsive on resume, I'm all for it. I will miss Nigel's excellent support though, but I'm sure he deserves a break :-)

Can you do usual "try again with minimum drivers" debugging?
Pavel

Signature · 1 line
Thanks, Sharp!
#116 lore raw
Quoted 5 lines · Pavel Machek
Quoted 3 lines

- it is reliable (e.g. I have suspended/resumed mid kernel compile - actually, kernel RPM build, which included compile - many times, without any ill effect)

Rafael has test patch for this one.

Great. It's been like this for *months* with suspend2.

Quoted 5 lines
Quoted 3 lines

- it is fast (i.e. even on my crappy old HP ZE4201
[http://www.rexursive.com/articles/linuxonhpze4201.html], it writes all of 700+ MB of RAM to disk just as fast or faster than swsusp).

Help us with userland parts of uswsusp, pretty please?

Sure, if I find time I will.

Quoted 3 lines
Quoted 1 line

- it looks nice (both text and GUI interface supported)

Planned for userland parts.

As I said before - it's going to be years. Never mind that all this stuff exists in suspend2 now.

Quoted 4 lines
Quoted 2 lines

- it leaves the system responsive on resume (kinda nice to come back to X and "Just Use it")

Merged in latest mainline.

Great.

Quoted 4 lines
Quoted 2 lines

- it suspends to both swap and file (I personally use swap, but many people on the list use file)

Doable in userland parts; not sure with someone plans it.

Again - stuff is there, but for some weird reason it's not good enough. Instead of using what's there and works reliably while developing the next big thing, we'll be back where we were - no decent suspend/resume support for a while. Excellent.

Whatever happened to release early, release often?

Quoted 1 line

Can you do usual "try again with minimum drivers" debugging?

Here is the thing - I don't have to do this with suspend2. Why is it that suspend2 code overcomes the obstacles that swsusp can't? This is rhetorical, of course.

Anyhow, if I find time, I will.

Signature · 1 line
Bojan
#117 lore raw
Quoted 8 lines · Bojan Smojver
Quoted 3 lines · Pavel Machek
Quoted 1 line

- it looks nice (both text and GUI interface supported)

Planned for userland parts.

As I said before - it's going to be years. Never mind that all this stuff exists in suspend2 now.

I hope it will be a *year*. If we get more users helping, it will be sooner.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

- it suspends to both swap and file (I personally use swap, but many people on the list use file)

Doable in userland parts; not sure with someone plans it.

Again - stuff is there, but for some weird reason it's not good enough.

The weird reasons were stated few times already. My favourite weird reason is "can be done in userspace" these days.

Pavel

Signature · 1 line
Thanks, Sharp!
#118 lore raw
Quoted 2 lines · Pavel Machek

The weird reasons were stated few times already. My favourite weird reason is "can be done in userspace" these days.

OK, let me give you the user perspective again:

- can I use vanilla kernel suspend support now: NO
- can I use suspend2 suspend support now: YES
- would I like things to improve even more: YES

I don't know why we have to wait a year to have decent suspend support. By developing uswsusp, you are pretty much agreeing with me - current kernel stuff isn't working to your (or mine) satisfaction. Now, I know uswsusp is going to be better than sliced bread, but wouldn't it be nice if more people could actually use their notebooks properly in the meantime?

Signature · 1 line
Bojan

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

#120 lore raw
Quoted 5 lines · Pavel Machek

No, it would not. Merging suspend2 now would mean usable suspend support for you in 3 or so months, but would push uswsusp forward year or more.

From my perspective, uswsusp is pie in the sky. I don't care if it gets

pushed back or not.

On the other hand suspend2 works - NOW. And it ain't just me. Do you really think all these folks that are using suspend2 have an urge to patch their notebook kernels just because they feel like it?

But hey, you seem to be bent on not having it - and you seem to be the one making that calls, so the rest of us that just want to use the notebooks properly will have to patch until someone decides that having something that works is more important than being right all the time. It's OK, have it your way.

Signature · 1 line
Bojan
#121 lore raw

This was personal email. It is pretty rude to post it to public lists.

Quoted 5 lines

But hey, you seem to be bent on not having it - and you seem to be the one making that calls, so the rest of us that just want to use the notebooks properly will have to patch until someone decides that having something that works is more important than being right all the time.

In the end, it is important what is right, not what works. If you do not understand that -- bad for you.

Pavel

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

Hi.

Quoted 10 lines · Pavel Machek

This was personal email. It is pretty rude to post it to public lists.

Quoted 5 lines

But hey, you seem to be bent on not having it - and you seem to be the one making that calls, so the rest of us that just want to use the notebooks properly will have to patch until someone decides that having something that works is more important than being right all the time.

In the end, it is important what is right, not what works. If you do not understand that -- bad for you.

True, but in something like putting code in the kernel vs in userspace, people apply different criteria in determining what is right. God hasn't written "You shall do suspend to disk in userspace" (and we'd probably rebel against Him anyway if He did :>), so we have to figure out what the best way is. Is userspace the 'right' solution? Well, yes, it does let you add features without adding to kernel code. But it also creates other problems. Putting it in kernel space has issues too - some things like userui are best left where they won't necessary take down the whole process if they don't work right. Personally, I think we're getting too polarised here. I've already accepted that there's a space for userspace code by merging (into Suspend2) code that puts the user interface there, along with management of storage. You agree that somethings, such as the atomic copy, simply can't be done in userspace. Without having looked seriously at the code yet, I'd be pretty sure that you're also leaving the calculation of what pages to store in the kernel. That just leaves how to store the image. Aren't we actually a lot closer than it has appeared?

Nigel

#123 lore raw

Hi!

Quoted 8 lines
Quoted 8 lines

This was personal email. It is pretty rude to post it to public lists.

Quoted 5 lines

But hey, you seem to be bent on not having it - and you seem to be the one making that calls, so the rest of us that just want to use the notebooks properly will have to patch until someone decides that having something that works is more important than being right all the time.

Quoted 6 lines
Quoted 2 lines

In the end, it is important what is right, not what works. If you do not understand that -- bad for you.

True, but in something like putting code in the kernel vs in userspace, people apply different criteria in determining what is right. God hasn't written "You shall do suspend to disk in userspace" (and we'd probably

Would written notice from Linus be good enough? :-))))

Quoted 9 lines

best way is. Is userspace the 'right' solution? Well, yes, it does let you add features without adding to kernel code. But it also creates other problems. Putting it in kernel space has issues too - some things like userui are best left where they won't necessary take down the whole process if they don't work right. Personally, I think we're getting too polarised here. I've already accepted that there's a space for userspace code by merging (into Suspend2) code that puts the user interface there, along with management of storage. You agree that somethings, such as the

I did not know about storage management.

Quoted 4 lines

atomic copy, simply can't be done in userspace. Without having looked seriously at the code yet, I'd be pretty sure that you're also leaving the calculation of what pages to store in the kernel. That just leaves how to store the image. Aren't we actually a lot closer than it has appeared?

Well, perhaps we are. It should be possible to move suspend2 into userspace, and at that point we can share all the kernel-level code (and probably all the user-level code, too :-).
Pavel

Signature · 1 line
Thanks, Sharp!
#124 lore raw
In reply to Pavel Machek
Quoted 2 lines · Pavel Machek

In the end, it is important what is right, not what works. If you do not understand that -- bad for you.

It what is right doesn't work, it's not much use, is it?

Signature · 1 line
Hilsen Harald.
#125 lore raw
Quoted 1 line · Harald Arnesen

It what is right doesn't work, it's not much use, is it?

Of course it is. Your *notebook* isn't of much use, but you can post on various lists claiming that you're right, which then compensates for your notebook not working. Life is a serious of trade-offs, isn't it? ;-)

Signature · 1 line
Bojan
#126 lore raw
In reply to Pavel Machek
Quoted 2 lines · Pavel Machek

In the end, it is important what is right, not what works. If you do not understand that -- bad for you.

Uh, oh, I'm finally getting it now... People buy notebooks to use them as doorstops. And, the important things is to be right - yep, it's all coming together now :-)

Signature · 1 line
Bojan
#127 lore raw
In reply to Pavel Machek
Quoted 2 lines · Pavel Machek

The weird reasons were stated few times already. My favourite weird reason is "can be done in userspace" these days.

Oh please, stop that. Network can be done in userspace. NFS can be done in userspace. Filesystems can be done in userspace. You need a better reason than that.

Now the pressure to add progress bar and other chrome, I can understand. Not wanting the chrome in the kernel, I understand even more. Deciding the solution for that is to more everything in userspace and end up with the quality and stability of the suspend fonctionality hostage to the quality of chrome code, I don't understand that one. Have you seen the state of multimedia playing applications lately, where chrome won over functionality? It's dreadful, even if flashy.

Why don't you try to design the system so that the progress bar can't fuck up the suspend unless they really, really want to? Instead of one where a forgotten open(O_CREAT) in a corner of graphics code can randomly trash the filesystem through metadata corruption?

OG.

#128 lore raw
Quoted 7 lines · Olivier Galibert
Quoted 2 lines · Pavel Machek

The weird reasons were stated few times already. My favourite weird reason is "can be done in userspace" these days.

Oh please, stop that. Network can be done in userspace. NFS can be done in userspace. Filesystems can be done in userspace. You need a better reason than that.

I have few more. That was my favourite :-).

Quoted 3 lines

Now the pressure to add progress bar and other chrome, I can understand. Not wanting the chrome in the kernel, I understand even more. Deciding the solution for that is to more everything in

Good.

Quoted 4 lines

Why don't you try to design the system so that the progress bar can't fuck up the suspend unless they really, really want to? Instead of one where a forgotten open(O_CREAT) in a corner of graphics code can randomly trash the filesystem through metadata corruption?

Even if I only put chrome code to userspace, open() would still be deadly. I could do something fancy with disallowing syscalls, but it is probably easier to just read the chrome code to be used... It should be as simple as memcpy(framebuffer, prepared image).

Pavel

Signature · 1 line
Thanks, Sharp!
#129 lore raw
Quoted 7 lines · Pavel Machek
Quoted 4 lines

Why don't you try to design the system so that the progress bar can't fuck up the suspend unless they really, really want to? Instead of one where a forgotten open(O_CREAT) in a corner of graphics code can randomly trash the filesystem through metadata corruption?

Even if I only put chrome code to userspace, open() would still be deadly. I could do something fancy with disallowing syscalls,

Nah, simply chroot to an empty virtual filesystem (a tmpfs with max size=0 will do) and they can't do any fs-related fuckup anymore. Just give them a fd through which request some specific resources (framebuffer mmap essentially I would say) and exchange messages with the suspend system (status, cancel, etc) and maybe log stderr for debugging purposes and that's it. They can't do damage by mistake anymore. They can always send signals to random pids, but that's not called a mistake at that point.

Even better, you can run _multiple_ processes that way, some for compression/encryption, some for chrome, etc.

Quoted 3 lines

but it
is probably easier to just read the chrome code to be used... It should be as simple as memcpy(framebuffer, prepared image).

I guess I just can't trust chrome code. I've have seen too much of it to be able to. Especially since once you open the gates a simple animated-gif equivalent won't be considered enough, and userland code does not go through the same kind of filters kernel code does.

Anybody and his dog will be able to take your userland suspend code, add their neogeo emulator to play while it's suspending, and then point at you when their fs got eaten after the tenth reboot. And distribs will pick it up because it's cool.

OG.

#130 lore raw
Quoted 18 lines · Olivier Galibert
Quoted 7 lines · Pavel Machek
Quoted 4 lines

Why don't you try to design the system so that the progress bar can't fuck up the suspend unless they really, really want to? Instead of one where a forgotten open(O_CREAT) in a corner of graphics code can randomly trash the filesystem through metadata corruption?

Even if I only put chrome code to userspace, open() would still be deadly. I could do something fancy with disallowing syscalls,

Nah, simply chroot to an empty virtual filesystem (a tmpfs with max size=0 will do) and they can't do any fs-related fuckup anymore. Just give them a fd through which request some specific resources (framebuffer mmap essentially I would say) and exchange messages with the suspend system (status, cancel, etc) and maybe log stderr for debugging purposes and that's it. They can't do damage by mistake anymore. They can always send signals to random pids, but that's not called a mistake at that point.

Quoted 2 lines

Even better, you can run _multiple_ processes that way, some for compression/encryption, some for chrome, etc.

No, I do not want to deal with multiple processes. Chrome code is not *as* evil as you paint it... But yes, chroot is a nice idea. Doing chroot into nowhere after freezing system will prevent most stupid mistakes. Rest of userland is frozen, so it can not do anything really wrong (at most you deadlock), if you kill someone -- well, that's only as dangerous as any other code running as root.

Quoted 4 lines
Quoted 3 lines

but it
is probably easier to just read the chrome code to be used... It should be as simple as memcpy(framebuffer, prepared image).

Quoted 8 lines

I guess I just can't trust chrome code. I've have seen too much of it to be able to. Especially since once you open the gates a simple animated-gif equivalent won't be considered enough, and userland code does not go through the same kind of filters kernel code does.

Anybody and his dog will be able to take your userland suspend code, add their neogeo emulator to play while it's suspending, and then point at you when their fs got eaten after the tenth reboot.

I'm going to solve that one with big warning, at the begining of suspend program. If someone can't read, I'll laugh at them. How was your acronym -- BTDTSHTFTS?

[There's similary dangerous code in /sys/power/resume, today. Distros actually use it. It only costed one filesystem... I killed 3 filesystems myself, and one underlated with memcpy<->strcpy bug. So... it is not really that dangerous.]

Quoted 1 line

distribs will pick it up because it's cool.

...don't worry about distros, they are not _that_ stupid, and they are already doing eye candy at weird places today (grub, kernel).

Pavel

Signature · 1 line
Thanks, Sharp!
#131 lore raw
Quoted 2 lines · Pavel Machek

...don't worry about distros, they are not _that_ stupid, and they are already doing eye candy at weird places today (grub, kernel).

Absolutely. Keep Linux distros ugly at all costs. NOT!

Reality check: People prefer *nice* things that work to things that just work.

Signature · 1 line
Bojan
#132 lore raw

chroot in swsusp userland interface (was: Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Pavel Machek

Hi,

Quoted 22 lines · Pavel Machek
Quoted 18 lines · Olivier Galibert
Quoted 7 lines · Pavel Machek
Quoted 4 lines

Why don't you try to design the system so that the progress bar can't fuck up the suspend unless they really, really want to? Instead of one where a forgotten open(O_CREAT) in a corner of graphics code can randomly trash the filesystem through metadata corruption?

Even if I only put chrome code to userspace, open() would still be deadly. I could do something fancy with disallowing syscalls,

Nah, simply chroot to an empty virtual filesystem (a tmpfs with max size=0 will do) and they can't do any fs-related fuckup anymore. Just give them a fd through which request some specific resources (framebuffer mmap essentially I would say) and exchange messages with the suspend system (status, cancel, etc) and maybe log stderr for debugging purposes and that's it. They can't do damage by mistake anymore. They can always send signals to random pids, but that's not called a mistake at that point.

Quoted 2 lines

Even better, you can run _multiple_ processes that way, some for compression/encryption, some for chrome, etc.

Quoted 6 lines

No, I do not want to deal with multiple processes. Chrome code is not *as* evil as you paint it... But yes, chroot is a nice idea. Doing chroot into nowhere after freezing system will prevent most stupid mistakes. Rest of userland is frozen, so it can not do anything really wrong (at most you deadlock), if you kill someone -- well, that's only as dangerous as any other code running as root.

I like the chroot idea too.

Are we going to chroot from the kernel level (eg. the atomic snapshot ioctl()) or from within the suspending utility?

I think the kernel level would protect some people from bugs in their own suspending utilities, but then we'd have to mount the tmpfs from the kernel level as well.

Greetings,
Rafael

#133 lore raw

Re: chroot in swsusp userland interface (was: Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi!

Quoted 7 lines
Quoted 6 lines

No, I do not want to deal with multiple processes. Chrome code is not *as* evil as you paint it... But yes, chroot is a nice idea. Doing chroot into nowhere after freezing system will prevent most stupid mistakes. Rest of userland is frozen, so it can not do anything really wrong (at most you deadlock), if you kill someone -- well, that's only as dangerous as any other code running as root.

Quoted 8 lines

I like the chroot idea too.

Are we going to chroot from the kernel level (eg. the atomic snapshot ioctl()) or from within the suspending utility?

I think the kernel level would protect some people from bugs in their own suspending utilities, but then we'd have to mount the tmpfs from the kernel level as well.

What about this (untested)?

BTW we do some playing with consoles after freeze. Would it be possible to do it *before* freeze? Opening tty might change its access time...?
Pavel

Index: resume.c
===================================================================
RCS file: /cvsroot/suspend/suspend/resume.c,v
retrieving revision 1.4

resume.c +6 -0
diff -u -u -r1.4 resume.c
@@ -227,6 +227,12 @@
 		error = errno;
 		goto Close;
 	}
+	/*
+	 * From now on, system is frozen; any filesystem access may mean data corruption.
+	 * Prevent accidental filesystem accesses by chrooting somewhere where little
+	 * damage can be done.
+	 */
+	chroot("/sys/power");
 	atomic_restore(dev);
 	unfreeze(dev);
 Close:

Index: suspend.c
===================================================================
RCS file: /cvsroot/suspend/suspend/suspend.c,v
retrieving revision 1.5

suspend.c +6 -0
diff -u -u -r1.5 suspend.c
@@ -360,6 +360,12 @@
 		goto Close;
 	}
 	go_to_console();
+	/*
+	 * From now on, system is frozen; any filesystem access may mean data corruption.
+	 * Prevent accidental filesystem accesses by chrooting somewhere where little
+	 * damage can be done.
+	 */
+	chroot("/sys/power");
 	attempts = 2;
 	do {
 		if (set_image_size(dev, image_size)) {
Signature · 1 line
Thanks, Sharp!
#134 lore raw

Re: chroot in swsusp userland interface (was: Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 9 lines · Pavel Machek
Quoted 9 lines
Quoted 6 lines

No, I do not want to deal with multiple processes. Chrome code is not *as* evil as you paint it... But yes, chroot is a nice idea. Doing chroot into nowhere after freezing system will prevent most stupid mistakes. Rest of userland is frozen, so it can not do anything really wrong (at most you deadlock), if you kill someone -- well, that's only as dangerous as any other code running as root.

I like the chroot idea too.

Quoted 8 lines
Quoted 6 lines

Are we going to chroot from the kernel level (eg. the atomic snapshot ioctl()) or from within the suspending utility?

I think the kernel level would protect some people from bugs in their own suspending utilities, but then we'd have to mount the tmpfs from the kernel level as well.

What about this (untested)?

So you think we should chroot from the user space. Fine.

Quoted 3 lines

BTW we do some playing with consoles after freeze. Would it be possible to do it *before* freeze? Opening tty might change its access time...?

Yes, you are right, but please see below.

Quoted 8 lines

Index: resume.c
===================================================================
RCS file: /cvsroot/suspend/suspend/resume.c,v
retrieving revision 1.4
diff -u -u -r1.4 resume.c

resume.c line 235

Quoted 9 lines
resume.c +6 -0
@@ -227,6 +227,12 @@
 		error = errno;
 		goto Close;
 	}
+	/*
+	 * From now on, system is frozen; any filesystem access may mean data corruption.
+	 * Prevent accidental filesystem accesses by chrooting somewhere where little
+	 * damage can be done.
+	 */
+	chroot("/sys/power");

We are on an initrd here. :-)

Quoted 11 lines
resume.c +0 -0
 	atomic_restore(dev);
 	unfreeze(dev);
 Close:

Index: suspend.c
===================================================================
RCS file: /cvsroot/suspend/suspend/suspend.c,v
retrieving revision 1.5
diff -u -u -r1.5 suspend.c

suspend.c line 368

Quoted 9 lines
suspend.c +6 -0
@@ -360,6 +360,12 @@
 		goto Close;
 	}
 	go_to_console();
+	/*
+	 * From now on, system is frozen; any filesystem access may mean data corruption.
+	 * Prevent accidental filesystem accesses by chrooting somewhere where little
+	 * damage can be done.
+	 */
+	chroot("/sys/power");

This won't be enough if /sys/power is on a frozen ext2 and the suspending utility calls open("file", O_CREAT) "by accident".

I think we should do as Olivier said: Mount tmpfs with limited size somewhere and chroot to it (IMO this won't affect the underlying filesystem). Then, create device files for the console and vt on it and open them from there. This should be 100% safe.

Greetings,
Rafael

#135 lore raw

Re: chroot in swsusp userland interface (was: Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi!

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines

Are we going to chroot from the kernel level (eg. the atomic snapshot ioctl()) or from within the suspending utility?

I think the kernel level would protect some people from bugs in their own suspending utilities, but then we'd have to mount the tmpfs from the kernel level as well.

What about this (untested)?

So you think we should chroot from the user space. Fine.

Yes, sorry that I was not explicit.

Quoted 9 lines

resume.c line 235

Quoted 7 lines
resume.c +6 -0
 	}
+	/*
+	 * From now on, system is frozen; any filesystem access may mean data corruption.
+	 * Prevent accidental filesystem accesses by chrooting somewhere where little
+	 * damage can be done.
+	 */
+	chroot("/sys/power");

We are on an initrd here. :-)

Oops, right, forget that.

Quoted 12 lines
Quoted 12 lines

Index: suspend.c
===================================================================
RCS file: /cvsroot/suspend/suspend/suspend.c,v
retrieving revision 1.5
diff -u -u -r1.5 suspend.c

suspend.c +1 -0
@@ -360,6 +360,12 @@
 		goto Close;
 	}
 	go_to_console();
+	/*
Quoted 8 lines

suspend.c line 368

Quoted 5 lines
suspend.c +5 -0
+	 * From now on, system is frozen; any filesystem access may mean data corruption.
+	 * Prevent accidental filesystem accesses by chrooting somewhere where little
+	 * damage can be done.
+	 */
+	chroot("/sys/power");

This won't be enough if /sys/power is on a frozen ext2 and the suspending utility calls open("file", O_CREAT) "by accident".

...well, we rely on sysfs files to work... at least for suspend-to-RAM, ok, no argument here. I doubt anyone really does mount anything but sysfs on /sys...

Quoted 4 lines

I think we should do as Olivier said: Mount tmpfs with limited size somewhere and chroot to it (IMO this won't affect the underlying filesystem). Then, create device files for the console and vt on it and open them from there. This should be 100% safe.

Looks unneccessarily complex to me. We'd have to umount that tmpfs, and playing with mounts inside system suspend seems wrong to me.

Perhaps we can chroot into /proc... almost everyone has /proc mounted, right?

Is it possible to move console/vt open before freeze? That should be enough.
Pavel

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

Re: chroot in swsusp userland interface (was: Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

On Saturday 04 February 2006 21:15, Pavel Machek wrote:
}-- snip --{

Quoted 30 lines
Quoted 12 lines
Quoted 12 lines

Index: suspend.c
===================================================================
RCS file: /cvsroot/suspend/suspend/suspend.c,v
retrieving revision 1.5
diff -u -u -r1.5 suspend.c

suspend.c +1 -0
@@ -360,6 +360,12 @@
 		goto Close;
 	}
 	go_to_console();
+	/*
Quoted 8 lines

suspend.c line 368

Quoted 5 lines
suspend.c +5 -0
+	 * From now on, system is frozen; any filesystem access may mean data corruption.
+	 * Prevent accidental filesystem accesses by chrooting somewhere where little
+	 * damage can be done.
+	 */
+	chroot("/sys/power");

This won't be enough if /sys/power is on a frozen ext2 and the suspending utility calls open("file", O_CREAT) "by accident".

...well, we rely on sysfs files to work... at least for suspend-to-RAM, ok, no argument here. I doubt anyone really does mount anything but sysfs on /sys...

Quoted 4 lines

I think we should do as Olivier said: Mount tmpfs with limited size somewhere and chroot to it (IMO this won't affect the underlying filesystem). Then, create device files for the console and vt on it and open them from there. This should be 100% safe.

Quoted 7 lines

Looks unneccessarily complex to me. We'd have to umount that tmpfs, and playing with mounts inside system suspend seems wrong to me.

Perhaps we can chroot into /proc... almost everyone has /proc mounted, right?

Is it possible to move console/vt open before freeze?

No, because freeze sets the active vt for us. How about that: mount the tmpfs before freeze, put there what we'll need, open device files from there instead of /dev, and chroot() after atomic_snapshot? Then, after resume we won't be chrooted and we'll be able to unmount the tmpfs safely.

Greetings,
Rafael

#137 lore raw

Re: chroot in swsusp userland interface (was: Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Rafael J. Wysocki
Quoted 3 lines · Rafael J. Wysocki
Quoted 1 line

What about this (untested)?

So you think we should chroot from the user space. Fine.

Here's what suspend2's userspace user interface currently does before suspending.

static void enforce_lifesavers() {
    struct rlimit r;
    r.rlim_cur = r.rlim_max = 0;
    setrlimit(RLIMIT_NOFILE, &r);
    setrlimit(RLIMIT_NPROC, &r);
    setrlimit(RLIMIT_CORE, &r);
}   

All userspace user interfaces (text, fbsplash, usplash) share this common code that is run before suspend itself proceeds.

Bernard.

Signature · 1 line
 Bernard Blackham <bernard at blackham dot com dot au>
#138 lore raw

Re: chroot in swsusp userland interface (was: Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

In reply to Rafael J. Wysocki

Hi.

Quoted 26 lines · Rafael J. Wysocki

Hi,

Quoted 23 lines · Pavel Machek
Quoted 21 lines · Olivier Galibert
Quoted 8 lines · Pavel Machek
Quoted 5 lines

Why don't you try to design the system so that the progress bar can't fuck up the suspend unless they really, really want to? Instead of one where a forgotten open(O_CREAT) in a corner of graphics code can randomly trash the filesystem through metadata corruption?

Even if I only put chrome code to userspace, open() would still be deadly. I could do something fancy with disallowing syscalls,

Nah, simply chroot to an empty virtual filesystem (a tmpfs with max size=0 will do) and they can't do any fs-related fuckup anymore. Just give them a fd through which request some specific resources (framebuffer mmap essentially I would say) and exchange messages with the suspend system (status, cancel, etc) and maybe log stderr for debugging purposes and that's it. They can't do damage by mistake anymore. They can always send signals to random pids, but that's not called a mistake at that point.

Even better, you can run _multiple_ processes that way, some for compression/encryption, some for chrome, etc.

Quoted 8 lines
Quoted 6 lines

No, I do not want to deal with multiple processes. Chrome code is not *as* evil as you paint it... But yes, chroot is a nice idea. Doing chroot into nowhere after freezing system will prevent most stupid mistakes. Rest of userland is frozen, so it can not do anything really wrong (at most you deadlock), if you kill someone -- well, that's only as dangerous as any other code running as root.

I like the chroot idea too.

You're making this too complicated. Just require that the userspace program does all it's file opening etc prior to telling kernelspace to do anything. Then clearly document the requirement. If someone breaks the rule, it is their problem, and their testing should show their foolishness. We have done a similar thing in the Suspend2 userspace user interface code, and it works fine.

Regards,

Nigel

Quoted 14 lines

Are we going to chroot from the kernel level (eg. the atomic snapshot ioctl()) or from within the suspending utility?

I think the kernel level would protect some people from bugs in their own suspending utilities, but then we'd have to mount the tmpfs from the kernel level as well.

Greetings,
Rafael
-
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/

#139 lore raw

Re: chroot in swsusp userland interface (was: Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi,

Quoted 32 lines · Nigel Cunningham
Quoted 31 lines · Rafael J. Wysocki
Quoted 29 lines · Pavel Machek
Quoted 19 lines · Olivier Galibert
Quoted 8 lines · Pavel Machek
Quoted 5 lines

Why don't you try to design the system so that the progress bar can't fuck up the suspend unless they really, really want to? Instead of one where a forgotten open(O_CREAT) in a corner of graphics code can randomly trash the filesystem through metadata corruption?

Even if I only put chrome code to userspace, open() would still be deadly. I could do something fancy with disallowing syscalls,

Nah, simply chroot to an empty virtual filesystem (a tmpfs with max size=0 will do) and they can't do any fs-related fuckup anymore. Just give them a fd through which request some specific resources (framebuffer mmap essentially I would say) and exchange messages with the suspend system (status, cancel, etc) and maybe log stderr for debugging purposes and that's it. They can't do damage by mistake anymore. They can always send signals to random pids, but that's not called a mistake at that point.

Quoted 2 lines

Even better, you can run _multiple_ processes that way, some for compression/encryption, some for chrome, etc.

No, I do not want to deal with multiple processes. Chrome code is not *as* evil as you paint it... But yes, chroot is a nice idea. Doing chroot into nowhere after freezing system will prevent most stupid mistakes. Rest of userland is frozen, so it can not do anything really wrong (at most you deadlock), if you kill someone -- well, that's only as dangerous as any other code running as root.

Quoted 8 lines
Quoted 1 line

I like the chroot idea too.

You're making this too complicated. Just require that the userspace program does all it's file opening etc prior to telling kernelspace to do anything. Then clearly document the requirement. If someone breaks the rule, it is their problem, and their testing should show their foolishness. We have done a similar thing in the Suspend2 userspace user interface code, and it works fine.

Unfortunately I'd like to open at least one device file after freeze, for a technical reason that probably does not exist in suspend2, so I need a temporary filesystem anyway. Chrooting to it is just a cake.

[BTW, we have the list [email protected] we'd like to be a place for discussing the userspace suspend issues. If you could subscribe to it, we'd be able to move the discussion there.]

Greetings,
Rafael

#140 lore raw

Re: chroot in swsusp userland interface (was: Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)

Hi.

Quoted 9 lines · Rafael J. Wysocki
Quoted 8 lines
Quoted 1 line

I like the chroot idea too.

You're making this too complicated. Just require that the userspace program does all it's file opening etc prior to telling kernelspace to do anything. Then clearly document the requirement. If someone breaks the rule, it is their problem, and their testing should show their foolishness. We have done a similar thing in the Suspend2 userspace user interface code, and it works fine.

Quoted 3 lines

Unfortunately I'd like to open at least one device file after freeze, for a technical reason that probably does not exist in suspend2, so I need a temporary filesystem anyway. Chrooting to it is just a cake.

Does the open need to be delayed until after the freeze?

Quoted 3 lines

[BTW, we have the list [email protected] we'd like to be a place for discussing the userspace suspend issues. If you could subscribe to it, we'd be able to move the discussion there.]

Will do. Sorry for the slow reply - had a bogus mail filtering rule.

Nigel

#141 lore raw
In reply to Nigel Cunningham

Hi!

Quoted 15 lines
Quoted 6 lines

So, as promised, there's nothing useful here. What we'd most like to see is for Nigel to start working on in-kernel swsusp, merging up the good bits from suspend2 in some evolutionary incremental manner under which the kernel continually improves. If, at the end of the day, that ends up with us having a complete implementation of suspend2, well, Mission Accomplished?

Thanks for the reply. You're right. It doesn't help at all :)

Well, actually it does.

It reminds me why I started working on this in the first place. It wasn't because I wanted to be a big shot kernel developer or the like, or have my name in the kernel credits. It was because I wanted to use the code.

Quoted 5 lines

So, given that I'm perfectly willing to send Pavel patches, but he's not willing to take them, I guess I the best thing I can do is to just let Pavel have his way, give up on the concept of merging Suspend2 and maintain it out of tree. When Pavel and Rafael get swsusp up to scratch, I can stop doing that and just use their version.

[Pavel is willing to take patches, as his cooperation with Rafael shows, but is scared by both big patches and series of 10 small patches he does not understand. He likes patches removing code.]
Pavel

Signature · 1 line
Thanks, Sharp!
#142 lore raw
Quoted 3 lines · Pavel Machek

[Pavel is willing to take patches, as his cooperation with Rafael shows, but is scared by both big patches and series of 10 small patches he does not understand. He likes patches removing code.]

Yeah, new features are going to happen by removing code. And I don't get this "scared of patches I don't understand" thing. Every time I asked Nigel a question, he replied and it wasn't rubbish.

Signature · 1 line
Bojan
#143 lore raw
In reply to Pavel Machek

Hi Pavel.

Quoted 3 lines · Pavel Machek

[Pavel is willing to take patches, as his cooperation with Rafael shows, but is scared by both big patches and series of 10 small patches he does not understand. He likes patches removing code.]

Assuming you're refering to the patches that started this thread, what don't you understand? I'm more than happy to explain.

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
#144 lore raw
Quoted 9 lines · Nigel Cunningham

Hi Pavel.

Quoted 3 lines · Pavel Machek

[Pavel is willing to take patches, as his cooperation with Rafael shows, but is scared by both big patches and series of 10 small patches he does not understand. He likes patches removing code.]

Assuming you're refering to the patches that started this thread, what don't you understand? I'm more than happy to explain.

For "suspend2: modules support", it is pretty clear that I do not need or want that complexity. But for "refrigerator improvements", I did not understand which parts are neccessary because of suspend2 vs. swsusp differences, and if there is simpler way towards the same goal. (And thanks for a stress hint...)
Pavel

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

Hi.

Quoted 8 lines · Pavel Machek
Quoted 7 lines · Nigel Cunningham

Hi Pavel.

Quoted 3 lines · Pavel Machek

[Pavel is willing to take patches, as his cooperation with Rafael shows, but is scared by both big patches and series of 10 small patches he does not understand. He likes patches removing code.]

Quoted 5 lines
Quoted 2 lines

Assuming you're refering to the patches that started this thread, what don't you understand? I'm more than happy to explain.

For "suspend2: modules support", it is pretty clear that I do not need or want that complexity. But for "refrigerator improvements", I did

... and yet you're perfectly happy to add the complexity of sticking half the code in userspace. I don't think I'll ever dare to try to understand you, Pavel :)

Quoted 3 lines

not understand which parts are neccessary because of suspend2 vs. swsusp differences, and if there is simpler way towards the same goal. (And thanks for a stress hint...)

I think virtually everything is relevant to you. A couple of possible exceptions might be (1) freezing bdevs, because you don't care so much about making xfs really sync and really stop it's activity and (2) the ability to thaw kernel space without thawing userspace. I want this for eating memory, to avoid deadlocking against kjournald etc. I haven't checked carefully as to why you don't need it in vanilla.

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
#146 lore raw

Hi,

Quoted 19 lines · Nigel Cunningham
Quoted 8 lines · Pavel Machek
Quoted 7 lines · Nigel Cunningham

Hi Pavel.

Quoted 3 lines · Pavel Machek

[Pavel is willing to take patches, as his cooperation with Rafael shows, but is scared by both big patches and series of 10 small patches he does not understand. He likes patches removing code.]

Quoted 5 lines
Quoted 2 lines

Assuming you're refering to the patches that started this thread, what don't you understand? I'm more than happy to explain.

For "suspend2: modules support", it is pretty clear that I do not need or want that complexity. But for "refrigerator improvements", I did

... and yet you're perfectly happy to add the complexity of sticking half the code in userspace. I don't think I'll ever dare to try to understand you, Pavel :)

Quoted 5 lines
Quoted 3 lines

not understand which parts are neccessary because of suspend2 vs. swsusp differences, and if there is simpler way towards the same goal. (And thanks for a stress hint...)

I think virtually everything is relevant to you.

My personal view is that:
1) turning the freezing of kernel threads upside-down is not necessary and would cause problems in the long run,
2) the todo lists are not necessary and add a lot of complexity,
3) trying to treat uninterruptible tasks as non-freezeable should better be avoided (I tried to implement this in swsusp last year but it caused vigorous opposition to appear, and it was not Pavel ;-))

Quoted 3 lines

A couple of possible exceptions might be (1) freezing bdevs, because you don't care so much about making xfs really sync and really stop it's activity

As I have already stated, in my view this one is at least worth considering in the long run.

Quoted 3 lines

and (2) the ability to thaw kernel space without thawing userspace. I want this for eating memory, to avoid deadlocking against kjournald etc. I haven't checked carefully as to why you don't need it in vanilla.

Because it does not deadlock? I will say we need this if I see a testcase showing such a deadlock clearly.

Greetings,
Rafael

#147 lore raw

Hi.

Quoted 28 lines · Rafael J. Wysocki

Hi,

Quoted 25 lines · Nigel Cunningham
Quoted 9 lines · Pavel Machek
Quoted 8 lines · Nigel Cunningham

Hi Pavel.

Quoted 4 lines · Pavel Machek

[Pavel is willing to take patches, as his cooperation with Rafael shows, but is scared by both big patches and series of 10 small patches he does not understand. He likes patches removing code.]

Quoted 6 lines
Quoted 2 lines

Assuming you're refering to the patches that started this thread, what don't you understand? I'm more than happy to explain.

For "suspend2: modules support", it is pretty clear that I do not need or want that complexity. But for "refrigerator improvements", I did

... and yet you're perfectly happy to add the complexity of sticking half the code in userspace. I don't think I'll ever dare to try to understand you, Pavel :)

Quoted 3 lines

not understand which parts are neccessary because of suspend2 vs. swsusp differences, and if there is simpler way towards the same goal. (And thanks for a stress hint...)

Quoted 5 lines
Quoted 1 line

I think virtually everything is relevant to you.

My personal view is that:
1) turning the freezing of kernel threads upside-down is not necessary and would cause problems in the long run,

Upside down?

Quoted 1 line

2) the todo lists are not necessary and add a lot of complexity,

Sorry. Forgot about this. I liked it for solving the SMP problem, but IIRC, we're downing other cpus before this now, so that issue has gone away. I should check whether I'm right there.

Quoted 3 lines

3) trying to treat uninterruptible tasks as non-freezeable should better be avoided (I tried to implement this in swsusp last year but it caused vigorous opposition to appear, and it was not Pavel ;-))

I'm not suggesting treating them as unfreezeable in the fullest sense. I still signal them, but don't mind if they don't respond. This way, if they do leave that state for some reason (timeout?) at some point, they still get frozen.

Quoted 7 lines
Quoted 3 lines

A couple of possible exceptions might be (1) freezing bdevs, because you don't care so much about making xfs really sync and really stop it's activity

As I have already stated, in my view this one is at least worth considering in the long run.

Quoted 7 lines
Quoted 4 lines

and (2) the ability to thaw kernel space without thawing userspace. I want this for eating memory, to avoid deadlocking against kjournald etc. I haven't checked carefully as to why you don't need it in vanilla.

Because it does not deadlock? I will say we need this if I see a testcase showing such a deadlock clearly.

I've been surprised that you haven't already seen them while eating memory such that filesystems come into play. Perhaps you guys only use swap partitions, and something like a swapfile with some memory pressure might trigger this? Or it could be a side effect of one of the other changes.

Nigel

Quoted 2 lines

Greetings,
Rafael

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

Hi,

Quoted 29 lines · Nigel Cunningham
Quoted 28 lines · Rafael J. Wysocki

Hi,

Quoted 25 lines · Nigel Cunningham
Quoted 9 lines · Pavel Machek
Quoted 8 lines · Nigel Cunningham

Hi Pavel.

Quoted 4 lines · Pavel Machek

[Pavel is willing to take patches, as his cooperation with Rafael shows, but is scared by both big patches and series of 10 small patches he does not understand. He likes patches removing code.]

Quoted 6 lines
Quoted 2 lines

Assuming you're refering to the patches that started this thread, what don't you understand? I'm more than happy to explain.

For "suspend2: modules support", it is pretty clear that I do not need or want that complexity. But for "refrigerator improvements", I did

... and yet you're perfectly happy to add the complexity of sticking half the code in userspace. I don't think I'll ever dare to try to understand you, Pavel :)

Quoted 3 lines

not understand which parts are neccessary because of suspend2 vs. swsusp differences, and if there is simpler way towards the same goal. (And thanks for a stress hint...)

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I think virtually everything is relevant to you.

My personal view is that:
1) turning the freezing of kernel threads upside-down is not necessary and would cause problems in the long run,

Upside down?

I mean now they should freeze voluntarily and your patches change that so they would have to be created as non-freezeable if need be, AFAICT.

Quoted 6 lines
Quoted 1 line

2) the todo lists are not necessary and add a lot of complexity,

Sorry. Forgot about this. I liked it for solving the SMP problem, but IIRC, we're downing other cpus before this now, so that issue has gone away. I should check whether I'm right there.

Quoted 8 lines
Quoted 3 lines

3) trying to treat uninterruptible tasks as non-freezeable should better be avoided (I tried to implement this in swsusp last year but it caused vigorous opposition to appear, and it was not Pavel ;-))

I'm not suggesting treating them as unfreezeable in the fullest sense. I still signal them, but don't mind if they don't respond. This way, if they do leave that state for some reason (timeout?) at some point, they still get frozen.

Yes, that's exactly what I wanted to do in swsusp. ;-)

Quoted 12 lines
Quoted 12 lines
Quoted 3 lines

A couple of possible exceptions might be (1) freezing bdevs, because you don't care so much about making xfs really sync and really stop it's activity

As I have already stated, in my view this one is at least worth considering in the long run.

Quoted 4 lines

and (2) the ability to thaw kernel space without thawing userspace. I want this for eating memory, to avoid deadlocking against kjournald etc. I haven't checked carefully as to why you don't need it in vanilla.

Quoted 7 lines
Quoted 2 lines

Because it does not deadlock? I will say we need this if I see a testcase showing such a deadlock clearly.

I've been surprised that you haven't already seen them while eating memory such that filesystems come into play. Perhaps you guys only use swap partitions, and something like a swapfile with some memory pressure might trigger this? Or it could be a side effect of one of the other changes.

In fact, we only use swap partitions, so this will be needed if we are going to use files, I guess. Nice to know in advance, thanks. ;-)

Greetings,
Rafael

#149 lore raw

Hi.

Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines
Quoted 3 lines

My personal view is that:
1) turning the freezing of kernel threads upside-down is not necessary and would cause problems in the long run,

Upside down?

I mean now they should freeze voluntarily and your patches change that so they would have to be created as non-freezeable if need be, AFAICT.

Ah. Now I'm on the same page. Lost the context.

Quoted 10 lines
Quoted 10 lines
Quoted 1 line

2) the todo lists are not necessary and add a lot of complexity,

Sorry. Forgot about this. I liked it for solving the SMP problem, but IIRC, we're downing other cpus before this now, so that issue has gone away. I should check whether I'm right there.

Quoted 3 lines

3) trying to treat uninterruptible tasks as non-freezeable should better be avoided (I tried to implement this in swsusp last year but it caused vigorous opposition to appear, and it was not Pavel ;-))

Quoted 6 lines
Quoted 4 lines

I'm not suggesting treating them as unfreezeable in the fullest sense. I still signal them, but don't mind if they don't respond. This way, if they do leave that state for some reason (timeout?) at some point, they still get frozen.

Yes, that's exactly what I wanted to do in swsusp. ;-)

Oh. What's Pavel's solution? Fail freezing if uninterruptible threads don't freeze?

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 3 lines

A couple of possible exceptions might be (1) freezing bdevs, because you don't care so much about making xfs really sync and really stop it's activity

As I have already stated, in my view this one is at least worth considering in the long run.

Quoted 4 lines

and (2) the ability to thaw kernel space without thawing userspace. I want this for eating memory, to avoid deadlocking against kjournald etc. I haven't checked carefully as to why you don't need it in vanilla.

Because it does not deadlock? I will say we need this if I see a testcase showing such a deadlock clearly.

Quoted 8 lines
Quoted 5 lines

I've been surprised that you haven't already seen them while eating memory such that filesystems come into play. Perhaps you guys only use swap partitions, and something like a swapfile with some memory pressure might trigger this? Or it could be a side effect of one of the other changes.

In fact, we only use swap partitions, so this will be needed if we are going to use files, I guess. Nice to know in advance, thanks. ;-)

k. Just so you don't confuse me, can I ask you not to refer to swapfiles as 'files'? I support swap partitions, swapfiles and ordinary files, so the latter will come to mind first for me.

Regards,

Nigel

Quoted 2 lines

Greetings,
Rafael

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

Hi,

Quoted 53 lines · Nigel Cunningham
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines
Quoted 3 lines

My personal view is that:
1) turning the freezing of kernel threads upside-down is not necessary and would cause problems in the long run,

Upside down?

I mean now they should freeze voluntarily and your patches change that so they would have to be created as non-freezeable if need be, AFAICT.

Ah. Now I'm on the same page. Lost the context.

Quoted 10 lines
Quoted 10 lines
Quoted 1 line

2) the todo lists are not necessary and add a lot of complexity,

Sorry. Forgot about this. I liked it for solving the SMP problem, but IIRC, we're downing other cpus before this now, so that issue has gone away. I should check whether I'm right there.

Quoted 3 lines

3) trying to treat uninterruptible tasks as non-freezeable should better be avoided (I tried to implement this in swsusp last year but it caused vigorous opposition to appear, and it was not Pavel ;-))

Quoted 6 lines
Quoted 4 lines

I'm not suggesting treating them as unfreezeable in the fullest sense. I still signal them, but don't mind if they don't respond. This way, if they do leave that state for some reason (timeout?) at some point, they still get frozen.

Yes, that's exactly what I wanted to do in swsusp. ;-)

Oh. What's Pavel's solution? Fail freezing if uninterruptible threads don't freeze?

Quoted 21 lines
Quoted 20 lines
Quoted 7 lines
Quoted 3 lines

A couple of possible exceptions might be (1) freezing bdevs, because you don't care so much about making xfs really sync and really stop it's activity

As I have already stated, in my view this one is at least worth considering in the long run.

Quoted 7 lines
Quoted 4 lines

and (2) the ability to thaw kernel space without thawing userspace. I want this for eating memory, to avoid deadlocking against kjournald etc. I haven't checked carefully as to why you don't need it in vanilla.

Because it does not deadlock? I will say we need this if I see a testcase showing such a deadlock clearly.

I've been surprised that you haven't already seen them while eating memory such that filesystems come into play. Perhaps you guys only use swap partitions, and something like a swapfile with some memory pressure might trigger this? Or it could be a side effect of one of the other changes.

Quoted 6 lines
Quoted 2 lines

In fact, we only use swap partitions, so this will be needed if we are going to use files, I guess. Nice to know in advance, thanks. ;-)

k. Just so you don't confuse me, can I ask you not to refer to swapfiles as 'files'? I support swap partitions, swapfiles and ordinary files, so the latter will come to mind first for me.

Sure. In fact I was referring to both swapfiles and regular files as just "files".

Greetings,
Rafael

#151 lore raw
In reply to Nigel Cunningham

Hi,

Quoted 27 lines · Nigel Cunningham
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines
Quoted 3 lines

My personal view is that:
1) turning the freezing of kernel threads upside-down is not necessary and would cause problems in the long run,

Upside down?

I mean now they should freeze voluntarily and your patches change that so they would have to be created as non-freezeable if need be, AFAICT.

Ah. Now I'm on the same page. Lost the context.

Quoted 15 lines
Quoted 14 lines
Quoted 1 line

2) the todo lists are not necessary and add a lot of complexity,

Sorry. Forgot about this. I liked it for solving the SMP problem, but IIRC, we're downing other cpus before this now, so that issue has gone away. I should check whether I'm right there.

Quoted 3 lines

3) trying to treat uninterruptible tasks as non-freezeable should better be avoided (I tried to implement this in swsusp last year but it caused vigorous opposition to appear, and it was not Pavel ;-))

I'm not suggesting treating them as unfreezeable in the fullest sense. I still signal them, but don't mind if they don't respond. This way, if they do leave that state for some reason (timeout?) at some point, they still get frozen.

Quoted 4 lines
Quoted 1 line

Yes, that's exactly what I wanted to do in swsusp. ;-)

Oh. What's Pavel's solution? Fail freezing if uninterruptible threads don't freeze?

Yes.

AFAICT it's to avoid situations in which we would freeze having a process in the D state that holds a semaphore or a mutex neded for suspending or resuming devices (or later on for saving the image etc.).

[I didn't answer this question previously, sorry.]

Greetings,
Rafael

#152 lore raw

Hi.

Quoted 37 lines · Rafael J. Wysocki

Hi,

Quoted 29 lines · Nigel Cunningham
Quoted 9 lines · Rafael J. Wysocki
Quoted 5 lines
Quoted 3 lines

My personal view is that:
1) turning the freezing of kernel threads upside-down is not necessary and would cause problems in the long run,

Upside down?

I mean now they should freeze voluntarily and your patches change that so they would have to be created as non-freezeable if need be, AFAICT.

Ah. Now I'm on the same page. Lost the context.

Quoted 16 lines
Quoted 15 lines
Quoted 1 line

2) the todo lists are not necessary and add a lot of complexity,

Sorry. Forgot about this. I liked it for solving the SMP problem, but IIRC, we're downing other cpus before this now, so that issue has gone away. I should check whether I'm right there.

Quoted 4 lines

3) trying to treat uninterruptible tasks as non-freezeable should better be avoided (I tried to implement this in swsusp last year but it caused vigorous opposition to appear, and it was not Pavel ;-))

I'm not suggesting treating them as unfreezeable in the fullest sense. I still signal them, but don't mind if they don't respond. This way, if they do leave that state for some reason (timeout?) at some point, they still get frozen.

Quoted 4 lines
Quoted 1 line

Yes, that's exactly what I wanted to do in swsusp. ;-)

Oh. What's Pavel's solution? Fail freezing if uninterruptible threads don't freeze?

Quoted 7 lines

Yes.

AFAICT it's to avoid situations in which we would freeze having a process in the D state that holds a semaphore or a mutex neded for suspending or resuming devices (or later on for saving the image etc.).

[I didn't answer this question previously, sorry.]

S'okay. This thread is an ocotpus :)

Are there real life examples of this? I can't think of a single time that I've heard of something like this happening. I do see rare problems with storage drivers not having driver model support right, and thereby causing hangs, but that's brokenness in a completely different way.

In short, I'm wondering if (apart from the forking issue), this is a straw man.

Regards,

Nigel

Quoted 7 lines

Greetings,
Rafael

_______________________________________________
Suspend2-devel mailing list
[email protected]
http://lists.suspend2.net/mailman/listinfo/suspend2-devel

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

Hi,

Quoted 46 lines · Nigel Cunningham
Quoted 35 lines · Rafael J. Wysocki
Quoted 29 lines · Nigel Cunningham
Quoted 9 lines · Rafael J. Wysocki
Quoted 5 lines
Quoted 3 lines

My personal view is that:
1) turning the freezing of kernel threads upside-down is not necessary and would cause problems in the long run,

Upside down?

I mean now they should freeze voluntarily and your patches change that so they would have to be created as non-freezeable if need be, AFAICT.

Ah. Now I'm on the same page. Lost the context.

Quoted 16 lines
Quoted 15 lines
Quoted 1 line

2) the todo lists are not necessary and add a lot of complexity,

Sorry. Forgot about this. I liked it for solving the SMP problem, but IIRC, we're downing other cpus before this now, so that issue has gone away. I should check whether I'm right there.

Quoted 4 lines

3) trying to treat uninterruptible tasks as non-freezeable should better be avoided (I tried to implement this in swsusp last year but it caused vigorous opposition to appear, and it was not Pavel ;-))

I'm not suggesting treating them as unfreezeable in the fullest sense. I still signal them, but don't mind if they don't respond. This way, if they do leave that state for some reason (timeout?) at some point, they still get frozen.

Quoted 4 lines
Quoted 1 line

Yes, that's exactly what I wanted to do in swsusp. ;-)

Oh. What's Pavel's solution? Fail freezing if uninterruptible threads don't freeze?

Quoted 7 lines

Yes.

AFAICT it's to avoid situations in which we would freeze having a process in the D state that holds a semaphore or a mutex neded for suspending or resuming devices (or later on for saving the image etc.).

[I didn't answer this question previously, sorry.]

S'okay. This thread is an ocotpus :)

Quoted 7 lines

Are there real life examples of this? I can't think of a single time that I've heard of something like this happening. I do see rare problems with storage drivers not having driver model support right, and thereby causing hangs, but that's brokenness in a completely different way.

In short, I'm wondering if (apart from the forking issue), this is a straw man.

It doesn't seem to be very probable to me too, but I take this argument as valid.

Greetings,
Rafael

#154 lore raw
Quoted 18 lines · Rafael J. Wysocki
Quoted 18 lines
Quoted 10 lines
Quoted 2 lines

Oh. What's Pavel's solution? Fail freezing if uninterruptible threads don't freeze?

Yes.

AFAICT it's to avoid situations in which we would freeze having a process in the D state that holds a semaphore or a mutex neded for suspending or resuming devices (or later on for saving the image etc.).

[I didn't answer this question previously, sorry.]

S'okay. This thread is an ocotpus :)

Are there real life examples of this? I can't think of a single time that I've heard of something like this happening. I do see rare problems with storage drivers not having driver model support right, and thereby causing hangs, but that's brokenness in a completely different way.

Quoted 8 lines
Quoted 2 lines

In short, I'm wondering if (apart from the forking issue), this is a straw man.

It doesn't seem to be very probable to me too, but I take this argument as valid.

Greetings,
Rafael

CIFS was good for that, if you have a CIFS filesystem mounted and take the network interface down (which I have my hibernate script do) before the filesystem is umounted it'll become impossible to umount the filesystem until the next reboot and I believe the cifsd kernel thread will be unfreezable. It's been a while since I've done that so it might be fixed now, but someone should verify it if it still exists and potentially work with the CIFS people to get it fixed.

Jim.

#155 lore raw

Hi Jim.

Quoted 30 lines · Jim Crilly
Quoted 20 lines · Rafael J. Wysocki
Quoted 20 lines
Quoted 11 lines
Quoted 2 lines

Oh. What's Pavel's solution? Fail freezing if uninterruptible threads don't freeze?

Yes.

AFAICT it's to avoid situations in which we would freeze having a process in the D state that holds a semaphore or a mutex neded for suspending or resuming devices (or later on for saving the image etc.).

[I didn't answer this question previously, sorry.]

S'okay. This thread is an ocotpus :)

Are there real life examples of this? I can't think of a single time that I've heard of something like this happening. I do see rare problems with storage drivers not having driver model support right, and thereby causing hangs, but that's brokenness in a completely different way.

Quoted 8 lines
Quoted 2 lines

In short, I'm wondering if (apart from the forking issue), this is a straw man.

It doesn't seem to be very probable to me too, but I take this argument as valid.

Greetings,
Rafael

Quoted 7 lines

CIFS was good for that, if you have a CIFS filesystem mounted and take the network interface down (which I have my hibernate script do) before the filesystem is umounted it'll become impossible to umount the filesystem until the next reboot and I believe the cifsd kernel thread will be unfreezable. It's been a while since I've done that so it might be fixed now, but someone should verify it if it still exists and potentially work with the CIFS people to get it fixed.

Thanks for the pointer. I'll take a look at this.

Regards,

Nigel

Quoted 6 lines

Jim.

_______________________________________________
Suspend2-devel mailing list
[email protected]
http://lists.suspend2.net/mailman/listinfo/suspend2-devel

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

Hi,

Quoted 39 lines · Nigel Cunningham
Quoted 30 lines · Jim Crilly
Quoted 20 lines · Rafael J. Wysocki
Quoted 20 lines
Quoted 11 lines
Quoted 2 lines

Oh. What's Pavel's solution? Fail freezing if uninterruptible threads don't freeze?

Yes.

AFAICT it's to avoid situations in which we would freeze having a process in the D state that holds a semaphore or a mutex neded for suspending or resuming devices (or later on for saving the image etc.).

[I didn't answer this question previously, sorry.]

S'okay. This thread is an ocotpus :)

Are there real life examples of this? I can't think of a single time that I've heard of something like this happening. I do see rare problems with storage drivers not having driver model support right, and thereby causing hangs, but that's brokenness in a completely different way.

Quoted 8 lines
Quoted 2 lines

In short, I'm wondering if (apart from the forking issue), this is a straw man.

It doesn't seem to be very probable to me too, but I take this argument as valid.

Greetings,
Rafael

Quoted 7 lines

CIFS was good for that, if you have a CIFS filesystem mounted and take the network interface down (which I have my hibernate script do) before the filesystem is umounted it'll become impossible to umount the filesystem until the next reboot and I believe the cifsd kernel thread will be unfreezable. It's been a while since I've done that so it might be fixed now, but someone should verify it if it still exists and potentially work with the CIFS people to get it fixed.

Quoted 1 line

Thanks for the pointer. I'll take a look at this.

Yes, that's interesting. If we have an actual test case, it'll help us a lot.

Greetings,
Rafael

#157 lore raw
In reply to Rafael J. Wysocki

Hi!

Quoted 10 lines
Quoted 8 lines
Quoted 3 lines

3) trying to treat uninterruptible tasks as non-freezeable should better be avoided (I tried to implement this in swsusp last year but it caused vigorous opposition to appear, and it was not Pavel ;-))

I'm not suggesting treating them as unfreezeable in the fullest sense. I still signal them, but don't mind if they don't respond. This way, if they do leave that state for some reason (timeout?) at some point, they still get frozen.

Yes, that's exactly what I wanted to do in swsusp. ;-)

It seems dangerous to me. Imagine you treated interruptible tasks like that...

What prevent task from doing

	set_state(UNINTERRUPTIBLE);
	schedule(one hour);
	write_to_filesystem();
	handle_signal()?

I.e. it may do something dangerous just before being catched by refrigerator.
Pavel

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

Hi.

Quoted 19 lines · Pavel Machek

Hi!

Quoted 11 lines
Quoted 9 lines
Quoted 4 lines

3) trying to treat uninterruptible tasks as non-freezeable should better be avoided (I tried to implement this in swsusp last year but it caused vigorous opposition to appear, and it was not Pavel ;-))

I'm not suggesting treating them as unfreezeable in the fullest sense. I still signal them, but don't mind if they don't respond. This way, if they do leave that state for some reason (timeout?) at some point, they still get frozen.

Yes, that's exactly what I wanted to do in swsusp. ;-)

It seems dangerous to me. Imagine you treated interruptible tasks like that...

What prevent task from doing

Quoted 7 lines
	set_state(UNINTERRUPTIBLE);
	schedule(one hour);
	write_to_filesystem();
	handle_signal()?

I.e. it may do something dangerous just before being catched by refrigerator.

The write_to_filesystem would be caught be bdev freezing if you had 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
#159 lore raw
Quoted 22 lines · Nigel Cunningham

Hi.

Quoted 19 lines · Pavel Machek

Hi!

Quoted 6 lines
Quoted 4 lines

I'm not suggesting treating them as unfreezeable in the fullest sense. I still signal them, but don't mind if they don't respond. This way, if they do leave that state for some reason (timeout?) at some point, they still get frozen.

Yes, that's exactly what I wanted to do in swsusp. ;-)

It seems dangerous to me. Imagine you treated interruptible tasks like that...

What prevent task from doing

	set_state(UNINTERRUPTIBLE);
	schedule(one hour);
	write_to_filesystem();
	handle_signal()?
Quoted 4 lines
Quoted 2 lines

I.e. it may do something dangerous just before being catched by refrigerator.

The write_to_filesystem would be caught be bdev freezing if you had it.

But we don't... if you have bdev freezing, why do any other freezing at all, then? It should be enough :-).
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#160 lore raw
In reply to Nigel Cunningham

Hi!

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

[Pavel is willing to take patches, as his cooperation with Rafael shows, but is scared by both big patches and series of 10 small patches he does not understand. He likes patches removing code.]

Assuming you're refering to the patches that started this thread, what don't you understand? I'm more than happy to explain.

Quoted 6 lines
Quoted 2 lines

For "suspend2: modules support", it is pretty clear that I do not need or want that complexity. But for "refrigerator improvements", I did

... and yet you're perfectly happy to add the complexity of sticking half the code in userspace. I don't think I'll ever dare to try to understand you, Pavel :)

Complexity in userspace: ungood.

Complexity in kernel: doubleplusungood.

It is not that hard to understand :-).
Pavel

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

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

Hi.

Quoted 5 lines · Pavel Machek

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?

Seriously, though, thanks for the opportunity to explain how Suspend2 works and show that it's not complex, and simpler than what you're going to end up with if you continue down the userspace track and seek to match Suspend2 in functionaltiy (apples for apples would be the fairest comparison, so that's what I'm aiming for here).

I've downloaded Rafael's userspace files and the latest mm, and used them to figure out how userspace swsusp works as you have it at the moment.

Quoted 1 line

From there, I've extended the analogy to try to include the extra

functionality you're talking about implementing. Feel free to correct misunderstandings or wrong assumptions :)

a. Freezing processes, freeing memory and preparing the image.

Freezing processes maps nice and cleanly to userspace because the kernel still does all the work. Extra ioctls to freeze and thaw other processes are all that's needed. There is no serious possibility of moving more of the work of freezing processes to userspace.

Freeing memory and preparing the image is significantly simpler for swsusp at the moment because it doesn't support swap files, and doesn't worry so much about being reliable under memory and process load. If this was to change, swsusp would probably want more of the modifications to the freezer that suspend2 includes, particularly the ability to thaw just the kernel threads. When userspace is being memory hungry and/or processor intensive, being able to thaw just the kernel threads helps a lot, because we can then put pressure on the VM without worry about deadlocking against frozen filesystems or racing against userspace processes that are grabbing memory and/or processor while we're trying to meet our constraints on memory and storage.

c. Compression and encryption.

The current implementation has no direct support for compressing, encrypting or otherwise transforming the data to be written. This could never-the-less be achieved by writing to a device that was configured using the standard support, and reconfiguring access to the compressed/encrypted devices before reading the image at resume time. Adding support for compressing and/or encrypting an image from within uswsusp would presumably require adding dependencies upon existing 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!).

If any flexibility was going to be allowed in methods of encrypting and compressing the image, a standardised interface would need to be developed. This interface would almost certainly be approximately equivalent

Back in the days of Suspend1, or maybe before, I had compression code inlined in the read/write-a-page loop. Based on my experience in having implemented the modular architecture, changing the compression method from gzip to lzf and then to cryptoapi support, I can't see how you'd want to to hardwire this. (Besides, with the modular architecture, CONFIG_SUSPEND2
+ !CONFIG_CRYPTOAPI is really simple - we just don't compile in the compression and encryption modules).

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.

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.

The simplest way I can see to achieve parity of functionality would be to treat all storage as a lists of sectors on bdevs, and simply have different storage allocation routines depending on where you want to storage the image. To do that, you'd want to use the current swap allocation procedure, with the ioctls you have already exported to enable this being controlled from userspace. You'd also want to utilise bmap from 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.

This is another place where the modular architecture in Suspend2 helps. The I/O modules have the same basic read/write routines as the compression/encryption support, so compression, encryption and I/O are just strung together in a pipeline fashion. The core doesn't care whether it's sending data directly to the I/O module, or first to a compressor or encryptor. It just asks for the first module in the pipe, and sends each page in the pageset to it one at a time. That module then sends data to the next when its output buffer fills, and so on down the chain. At the tail, the writer makes a copy of its input buffer and submits I/O on the copy asynchronously. Simple!

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. Both implementations do roughly the same things, invoking the driver model, disabling interrupts and doing the copy. Suspend2 has DEBUG_PAGEALLOC support that adds some extra code, but the complexity factor is minimal. (It should however be tested more frequently - IIRC I recently got a report that it's currently broken).

f. User tuning and configuration.

uswsusp doesn't have much support for tuning and configuration at the moment. The resume device is set from swsusp.h in the userspace program and can be overridden using a command line option to the userspace program. The default image size is hardwired in the userspace swsusp.h.

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.

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.

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.

i. Status display.

The intention to implement this in userspace has been mentioned a number of times. It is certainly possible, and is already done in Suspend2 in userspace. It used to be done in kernel space, but was moved to userspace because of objections by kernel developers. Moving the code to userspace has created extra hassles for users (they now have to download extra libraries to use the splashscreen, which were not required with the bootsplash patch, and need to check whether an update to the userui code 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, it is less code to have in the kernel, and having a font renderer in the kernel was definitely not ideal!).

The main danger for uswsusp here would be avoiding the death of the whole process if the userui bit hits a snag. In Suspend2, the kernel happily continues if it can't start the userui program or talk to it. In uswsusp, some extra measures might need to be taken to avoid this problem.

j. Summary.

At their cores, Suspend2 and uswsusp work in basically the same way. They make an atomic copy of some/all portions of memory, saving the CPU state in the process, and write that image to disk, doing the inverse at resume time. The variations come in the methods by which meta-data is stored in memory, by which the image is prepared, and in which it is stored on disk.

Suspend2 is more complex than uswsusp, but only because it has more functionality that uswsusp. If uswsusp were to match the current Suspend2 for functionality, it would require at least a slightly greater degree of complexity, due to the extra logic and code for implementing the kernelspace/userspace interface. Interaction between kernespace and userspace might be a little simpler than the current suspend2 code due to the difference between using ioctls and using a netlink socket (but, of course, Suspend2 code be modified to use ioctls too).

uswsusp currently moves none of the real functionality to userspace, but rather just the controlling logic. Longer term, it might move the compression and encryption to userspace if userspace libraries are used for that, and eye candy might be implemented there too. In reality, though, the bulk of the work (freezing, atomic copy, implementation of the I/O) continues to be done in kernelspace. Doing suspend to disk in userspace would thus be a bit of a misnomer.

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.

In short, the only way you would avoid making uswsusp at least as complex as Suspend2 would be by failing to implement the same level of functionality. That would of course be acceptable, but it should then be remembered whenever you're making comparisons between the two implementations, particularly in terms of metrics such as lines of code.

Hope this helps us progress in our discussions.

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
#162 lore raw

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

Quoted 5 lines · Nigel Cunningham

(they now have to download extra
libraries to use the splashscreen, which were not required with the bootsplash patch, and need to check whether an update to the userui code
is required when updating the kernel)

You could have avoided this problem by keeping the userspace<->kernel interface stable.

Lee

#163 lore raw

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

Hi.

Quoted 9 lines · Lee Revell
Quoted 5 lines · Nigel Cunningham

(they now have to download extra
libraries to use the splashscreen, which were not required with the bootsplash patch, and need to check whether an update to the userui code
is required when updating the kernel)

You could have avoided this problem by keeping the userspace<->kernel interface stable.

True, but sometimes you need to make changes that do modify the interface. If the interface involves more functionality, this will happen more frequently.

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
#164 lore raw

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

Quoted 10 lines · Nigel Cunningham

Hi.

Quoted 7 lines · Lee Revell
Quoted 5 lines · Nigel Cunningham

(they now have to download extra
libraries to use the splashscreen, which were not required with the bootsplash patch, and need to check whether an update to the userui code
is required when updating the kernel)

Quoted 6 lines
Quoted 2 lines

You could have avoided this problem by keeping the userspace<->kernel interface stable.

True, but sometimes you need to make changes that do modify the interface. If the interface involves more functionality, this will happen more frequently.

Well, all I can say is, it should have been obvious that putting a themeable UI in the kernel would not fly.

Lee

#165 lore raw

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

Hi.

Quoted 14 lines · Lee Revell
Quoted 13 lines · Nigel Cunningham

Hi.

Quoted 9 lines · Lee Revell
Quoted 5 lines · Nigel Cunningham

(they now have to download extra
libraries to use the splashscreen, which were not required with the bootsplash patch, and need to check whether an update to the userui code
is required when updating the kernel)

You could have avoided this problem by keeping the userspace<->kernel interface stable.

Quoted 6 lines
Quoted 3 lines

True, but sometimes you need to make changes that do modify the interface. If the interface involves more functionality, this will happen more frequently.

Well, all I can say is, it should have been obvious that putting a themeable UI in the kernel would not fly.

Agreed, but I think we have some confusion here.

I was talking about interactions between kernel space and userspace after we started using the userspace interface. In particular, I was thinking of the fact that the netlink message number kept changing due to changes in the vanilla kernel. In the end, we just made it a command line option to the userui.

My point for this conversation was different, though. If uswsusp ever does fly, there are going to be flag days where users are going to have to download new userspace code, perhaps new versions of libraries or new libraries, run the compilation and reconfigure their initrds/ram-fses, all just because they upgraded their kernel and want to continue to suspend to disk. That is extra complexity introduced by using a userspace 'brain' instead of having it in kernelspace.

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
#166 lore raw

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

Hi,

Quoted 30 lines · Nigel Cunningham
Quoted 14 lines · Lee Revell
Quoted 13 lines · Nigel Cunningham

Hi.

Quoted 9 lines · Lee Revell
Quoted 5 lines · Nigel Cunningham

(they now have to download extra
libraries to use the splashscreen, which were not required with the bootsplash patch, and need to check whether an update to the userui code
is required when updating the kernel)

You could have avoided this problem by keeping the userspace<->kernel interface stable.

Quoted 6 lines
Quoted 3 lines

True, but sometimes you need to make changes that do modify the interface. If the interface involves more functionality, this will happen more frequently.

Well, all I can say is, it should have been obvious that putting a themeable UI in the kernel would not fly.

Agreed, but I think we have some confusion here.

I was talking about interactions between kernel space and userspace after we started using the userspace interface. In particular, I was thinking of the fact that the netlink message number kept changing due to changes in the vanilla kernel. In the end, we just made it a command line option to the userui.

Quoted 7 lines

My point for this conversation was different, though. If uswsusp ever does fly, there are going to be flag days where users are going to have to download new userspace code, perhaps new versions of libraries or new libraries, run the compilation and reconfigure their initrds/ram-fses, all just because they upgraded their kernel and want to continue to suspend to disk. That is extra complexity introduced by using a userspace 'brain' instead of having it in kernelspace.

This point is valid, but I don't think the users will _have_ _to_ switch to the userland suspend. AFAICT we are going to keep the kernel-based code as long as necessary.

We are just going to implement features in the user space that need not be implemented in the kernel. Of course they can be implemented in the kernel, and you have shown that clearly, but since they need not be there, we should at least try to implement them in the user space and see how this works.

Frankly, I have no strong opinion on whether they _should_ be implemented in the user space or in the kernel, but I think we won't know that until we actually _try_.

That said, I like the idea and I'm going to work on it. I'll also appreciate any help very much.

Greetings,
Rafael

#167 lore raw

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

Hi.

Quoted 51 lines · Rafael J. Wysocki

Hi,

Quoted 30 lines · Nigel Cunningham
Quoted 14 lines · Lee Revell
Quoted 13 lines · Nigel Cunningham

Hi.

Quoted 9 lines · Lee Revell
Quoted 5 lines · Nigel Cunningham

(they now have to download extra
libraries to use the splashscreen, which were not required with the bootsplash patch, and need to check whether an update to the userui code
is required when updating the kernel)

You could have avoided this problem by keeping the userspace<->kernel interface stable.

Quoted 6 lines
Quoted 3 lines

True, but sometimes you need to make changes that do modify the interface. If the interface involves more functionality, this will happen more frequently.

Well, all I can say is, it should have been obvious that putting a themeable UI in the kernel would not fly.

Agreed, but I think we have some confusion here.

I was talking about interactions between kernel space and userspace after we started using the userspace interface. In particular, I was thinking of the fact that the netlink message number kept changing due to changes in the vanilla kernel. In the end, we just made it a command line option to the userui.

Quoted 7 lines

My point for this conversation was different, though. If uswsusp ever does fly, there are going to be flag days where users are going to have to download new userspace code, perhaps new versions of libraries or new libraries, run the compilation and reconfigure their initrds/ram-fses, all just because they upgraded their kernel and want to continue to suspend to disk. That is extra complexity introduced by using a userspace 'brain' instead of having it in kernelspace.

This point is valid, but I don't think the users will _have_ _to_ switch to the userland suspend. AFAICT we are going to keep the kernel-based code as long as necessary.

We are just going to implement features in the user space that need not be implemented in the kernel. Of course they can be implemented in the kernel, and you have shown that clearly, but since they need not be there, we should at least try to implement them in the user space and see how this works.

Quoted 6 lines

Frankly, I have no strong opinion on whether they _should_ be implemented in the user space or in the kernel, but I think we won't know that until we actually _try_.

That said, I like the idea and I'm going to work on it. I'll also appreciate any help very much.

Wow. I wish Pavel wrote replies like that. We'd get on a whole lot better.

Pavel, am I doing something wrong that I'm not clicking to, which is stirring you up? I really don't want to. I want to work with you guys instead of against you, but it seems to me like every attempt at interaction with you degenerates into something far less than ideal.

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
#168 lore raw

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

Hi!

Quoted 17 lines
Quoted 10 lines

This point is valid, but I don't think the users will _have_ _to_ switch to the userland suspend. AFAICT we are going to keep the kernel-based code as long as necessary.

We are just going to implement features in the user space that need not be implemented in the kernel. Of course they can be implemented in the kernel, and you have shown that clearly, but since they need not be there, we should at least try to implement them in the user space and see how this works.

Quoted 6 lines

Frankly, I have no strong opinion on whether they _should_ be implemented in the user space or in the kernel, but I think we won't know that until we actually _try_.

That said, I like the idea and I'm going to work on it. I'll also appreciate any help very much.

Quoted 6 lines

Wow. I wish Pavel wrote replies like that. We'd get on a whole lot better.

Pavel, am I doing something wrong that I'm not clicking to, which is stirring you up? I really don't want to. I want to work with you guys instead of against you, but it seems to me like every attempt at interaction with you degenerates into something far less than ideal.

Nothing I could name... I guess I'll just let you cooperate with Rafael, he can translate ;-).

[Well, perhaps there's one thing. Have you seen Al Viro's mails? He tends to use quite a strong language. I guess asking you to talk like him is too much to ask (but it would probably help ;-), but notice that my and his native languages have quite a lot in common. Perhaps I'm doing poor job translating into English at higher level...]

Pavel

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

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

Hi.

Quoted 22 lines · Pavel Machek

Hi!

Quoted 20 lines
Quoted 10 lines

This point is valid, but I don't think the users will _have_ _to_ switch to the userland suspend. AFAICT we are going to keep the kernel-based code as long as necessary.

We are just going to implement features in the user space that need not be implemented in the kernel. Of course they can be implemented in the kernel, and you have shown that clearly, but since they need not be there, we should at least try to implement them in the user space and see how this works.

Quoted 6 lines

Frankly, I have no strong opinion on whether they _should_ be implemented in the user space or in the kernel, but I think we won't know that until we actually _try_.

That said, I like the idea and I'm going to work on it. I'll also appreciate any help very much.

Wow. I wish Pavel wrote replies like that. We'd get on a whole lot better.

Quoted 7 lines
Quoted 4 lines

Pavel, am I doing something wrong that I'm not clicking to, which is stirring you up? I really don't want to. I want to work with you guys instead of against you, but it seems to me like every attempt at interaction with you degenerates into something far less than ideal.

Nothing I could name... I guess I'll just let you cooperate with Rafael, he can translate ;-).

:>

Quoted 3 lines

[Well, perhaps there's one thing. Have you seen Al Viro's mails? He tends to use quite a strong language. I guess asking you to talk like him is too much to ask (but it would probably help ;-), but notice

Heh. Maybe I should look at some, after reading that!

Maybe I can also encourage you to try not to sound so confontational? Perhaps we can meet half way.

Quoted 2 lines

that my and his native languages have quite a lot in common. Perhaps I'm doing poor job translating into English at higher level...]

Well, if we know it's just a communication and not a clash of personalities, that alone should help.

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
#170 lore raw

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

In reply to Rafael J. Wysocki

Quoting "Rafael J. Wysocki" <[email protected]>:

Quoted 3 lines

This point is valid, but I don't think the users will _have_ _to_ switch to the userland suspend. AFAICT we are going to keep the kernel-based code as long as necessary.

Yep, that's what I thought too. Read on...

Quoted 5 lines

We are just going to implement features in the user space that need not be implemented in the kernel. Of course they can be implemented in the kernel, and you have shown that clearly, but since they need not be there, we should at least try to implement them in the user space and see how this works.

Well, given that the kernel suspend is going to be kept for a while, wouldn't it be better if it was feature full? How would the users be at a disadvantage if they had better kernel based suspend for a while, followed by u-beaut-cooks-cleans-and-washes uswsusp? That's the part I don't get...

So, to be direct, let me ask:

Why is it so important to keep an inferior implementation of kernel based suspend, when a better one and field tested, exists?

Signature · 1 line
Bojan
#171 lore raw

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

Are you Max Dubois, second incarnation or what?

Quoted 2 lines

Well, given that the kernel suspend is going to be kept for a while, wouldn't it be better if it was feature full? How would the users be at

                                                ~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 1 line

a disadvantage if they had better kernel based suspend for a while,

~~~~~~~~~~~~~~~~

Quoted 2 lines

followed by u-beaut-cooks-cleans-and-washes uswsusp? That's the part I don't get...

*Users* would not be at disadvantage, but, surprise, there's one thing more important than users. Thats developers, and I can guarantee you that merging 14K lines of code just to delete them half a year later would drive them crazy.

Pavel

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

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

Hi Pavel.

Quoted 13 lines · Pavel Machek

Are you Max Dubois, second incarnation or what?

Quoted 3 lines

Well, given that the kernel suspend is going to be kept for a while, wouldn't it be better if it was feature full? How would the users be at

~~~~~~~~~~~~~~~~~~~~~~~~~

Quoted 1 line

a disadvantage if they had better kernel based suspend for a while,

~~~~~~~~~~~~~~~~

Quoted 7 lines
Quoted 2 lines

followed by u-beaut-cooks-cleans-and-washes uswsusp? That's the part I don't get...

*Users* would not be at disadvantage, but, surprise, there's one thing more important than users. Thats developers, and I can guarantee you that merging 14K lines of code just to delete them half a year later would drive them crazy.

It would more be an ever-changing interface that would drive them crazy. So why don't we come up with an agreed method of starting a suspend and starting a resume that they can use, without worrying about whether they're getting swsusp, uswsusp or Suspend2? /sys/power/state seems the obvious choice for this. An additional /sys entry could perhaps be used to modify which implementation is used when you echo disk > /sys/power/state
- something like

# cat /sys/power/disk_method
swsusp uswsusp suspend2
# echo uswsusp > /sys/power/disk_method
# echo > /sys/power/state

Is there a big problem with that, which I've missed?

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
#173 lore raw

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

Quoting Pavel Machek <[email protected]>:

Quoted 1 line

Are you Max Dubois, second incarnation or what?

Sorry mate, no. Can't do music for shit.

Quoted 4 lines

*Users* would not be at disadvantage, but, surprise, there's one thing more important than users. Thats developers, and I can guarantee you that merging 14K lines of code just to delete them half a year later would drive them crazy.

Yeah, you meant "a developer", I'm sure :-)

What makes you think that all 14k lines would get removed? Or is it that you don't want users (oh, here is that dirty word again :-) getting used to something that works better, which may mean that all 14k lines stay?

Signature · 1 line
Bojan
#174 lore raw

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

In reply to Nigel Cunningham

Hi!

Quoted 13 lines
Quoted 4 lines

*Users* would not be at disadvantage, but, surprise, there's one thing more important than users. Thats developers, and I can guarantee you that merging 14K lines of code just to delete them half a year later would drive them crazy.

It would more be an ever-changing interface that would drive them crazy. So why don't we come up with an agreed method of starting a suspend and starting a resume that they can use, without worrying about whether they're getting swsusp, uswsusp or Suspend2? /sys/power/state seems the obvious choice for this. An additional /sys entry could perhaps be used to modify which implementation is used when you echo disk > /sys/power/state
- something like

Quoted 6 lines
# cat /sys/power/disk_method
swsusp uswsusp suspend2
# echo uswsusp > /sys/power/disk_method
# echo > /sys/power/state

Is there a big problem with that, which I've missed?

Well, for _users_ method seems to be clicking "suspend" in KDE. For more experienced users it is powersave -U. And you are already distributing script to do suspend... Just hook suspend2 to the same gui stuff distributions already use.

Besides what you described can't work for uswsusp.
Pavel

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

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

Hi.

Quoted 3 lines · Pavel Machek

Hi!

Quoted 1 line
Quoted 1 line

*Users* would not be at disadvantage, but, surprise, there's one

thing

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

more important than users. Thats developers, and I can guarantee you that merging 14K lines of code just to delete them half a year later would drive them crazy.

It would more be an ever-changing interface that would drive them

crazy. So

Quoted 4 lines
Quoted 4 lines

why don't we come up with an agreed method of starting a suspend and starting a resume that they can use, without worrying about whether they're getting swsusp, uswsusp or Suspend2? /sys/power/state seems the obvious choice for this. An additional /sys entry could perhaps be used

to

Quoted 9 lines
Quoted 1 line

modify which implementation is used when you echo disk

/sys/power/state

Quoted 7 lines

- something like

# cat /sys/power/disk_method
swsusp uswsusp suspend2
# echo uswsusp > /sys/power/disk_method
# echo > /sys/power/state
Quoted 6 lines
Quoted 1 line

Is there a big problem with that, which I've missed?

Well, for _users_ method seems to be clicking "suspend" in KDE. For more experienced users it is powersave -U. And you are already distributing script to do suspend... Just hook suspend2 to the same gui stuff distributions already use.

The problem is that kpowersave, for example, doesn't provide any way to say that you want to start the cycle by doing something other than echo

Quoted 1 line

/sys/power/state. They're apparently planning on changing it to support

suspend2, but should they have to (and why again for uswsusp?).

Quoted 1 line

Besides what you described can't work for uswsusp.

call_usermodehelper

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
#176 lore raw

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

Quoted 9 lines
Quoted 4 lines

Well, for _users_ method seems to be clicking "suspend" in KDE. For more experienced users it is powersave -U. And you are already distributing script to do suspend... Just hook suspend2 to the same gui stuff distributions already use.

The problem is that kpowersave, for example, doesn't provide any way to say that you want to start the cycle by doing something other than echo

Quoted 1 line

/sys/power/state. They're apparently planning on changing it to support

suspend2, but should they have to (and why again for uswsusp?).

Fix kpowersave, then.

Quoted 3 lines
Quoted 1 line

Besides what you described can't work for uswsusp.

call_usermodehelper

No.
Pavel

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

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

In reply to Nigel Cunningham

Hi,

Quoted 30 lines · Nigel Cunningham
Quoted 13 lines · Pavel Machek

Are you Max Dubois, second incarnation or what?

Quoted 3 lines

Well, given that the kernel suspend is going to be kept for a while, wouldn't it be better if it was feature full? How would the users be at

~~~~~~~~~~~~~~~~~~~~~~~~~

Quoted 1 line

a disadvantage if they had better kernel based suspend for a while,

~~~~~~~~~~~~~~~~

Quoted 7 lines
Quoted 2 lines

followed by u-beaut-cooks-cleans-and-washes uswsusp? That's the part I don't get...

*Users* would not be at disadvantage, but, surprise, there's one thing more important than users. Thats developers, and I can guarantee you that merging 14K lines of code just to delete them half a year later would drive them crazy.

It would more be an ever-changing interface that would drive them crazy. So why don't we come up with an agreed method of starting a suspend and starting a resume that they can use, without worrying about whether they're getting swsusp, uswsusp or Suspend2? /sys/power/state seems the obvious choice for this. An additional /sys entry could perhaps be used to modify which implementation is used when you echo disk > /sys/power/state
- something like

Quoted 6 lines
# cat /sys/power/disk_method
swsusp uswsusp suspend2
# echo uswsusp > /sys/power/disk_method
# echo > /sys/power/state

Is there a big problem with that, which I've missed?

Userland suspend is driven by the suspending application which only calls the kernel to do things it cannot do itself, like freezing (the other) processes, snapshotting the system etc. We use the /dev/snapshot device and the ioctl()s in there, so no sysfs files are needed for that. It's independent and can coexist with the existing sysfs interface just fine.

Greetings,
Rafael

#178 lore raw

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

Hi.

Quoted 7 lines · Rafael J. Wysocki

Hi,

Quoted 4 lines · Nigel Cunningham
Quoted 3 lines · Pavel Machek

Are you Max Dubois, second incarnation or what?

Quoted 1 line

Well, given that the kernel suspend is going to be kept for a

while,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

wouldn't it be better if it was feature full? How would the users

be

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 1 line

at

~~~~~~~~~~~~~~~~~~~~~~~~~

Quoted 1 line

a disadvantage if they had better kernel based suspend for a while,

~~~~~~~~~~~~~~~~

Quoted 1 line

followed by u-beaut-cooks-cleans-and-washes uswsusp? That's the

part I

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

don't get...

*Users* would not be at disadvantage, but, surprise, there's one

thing

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

more important than users. Thats developers, and I can guarantee you that merging 14K lines of code just to delete them half a year later would drive them crazy.

It would more be an ever-changing interface that would drive them

crazy. So

Quoted 4 lines
Quoted 4 lines

why don't we come up with an agreed method of starting a suspend and starting a resume that they can use, without worrying about whether they're getting swsusp, uswsusp or Suspend2? /sys/power/state seems the obvious choice for this. An additional /sys entry could perhaps be used

to

Quoted 9 lines
Quoted 1 line

modify which implementation is used when you echo disk

/sys/power/state

Quoted 7 lines

- something like

# cat /sys/power/disk_method
swsusp uswsusp suspend2
# echo uswsusp > /sys/power/disk_method
# echo > /sys/power/state
Quoted 8 lines
Quoted 1 line

Is there a big problem with that, which I've missed?

Userland suspend is driven by the suspending application which only calls the kernel to do things it cannot do itself, like freezing (the other) processes, snapshotting the system etc. We use the /dev/snapshot device and the ioctl()s in there, so no sysfs files are needed for that. It's independent and can coexist with the existing sysfs interface just fine.

Yes, but how are you going to get it started from (say) klaptop, which only knows "echo disk > /sys/power/state" as the way of starting a suspend? I'm suggesting that we create a means whereby the issue of how to start a cycle could be separated from what implementation is used to do the work. That is, a simple extension at the start of the disk specific code that starts swsusp, uswsusp or suspend2 depending upon what you want. Maybe I should just prepare a patch.

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
#179 lore raw

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

Hi!

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
# cat /sys/power/disk_method
swsusp uswsusp suspend2
# echo uswsusp > /sys/power/disk_method
# echo > /sys/power/state
Quoted 8 lines
Quoted 1 line

Is there a big problem with that, which I've missed?

Userland suspend is driven by the suspending application which only calls the kernel to do things it cannot do itself, like freezing (the other) processes, snapshotting the system etc. We use the /dev/snapshot device and the ioctl()s in there, so no sysfs files are needed for that. It's independent and can coexist with the existing sysfs interface just fine.

Quoted 7 lines

Yes, but how are you going to get it started from (say) klaptop, which only knows "echo disk > /sys/power/state" as the way of starting a suspend? I'm suggesting that we create a means whereby the issue of how to start a cycle could be separated from what implementation is used to do the work. That is, a simple extension at the start of the disk specific code that starts swsusp, uswsusp or suspend2 depending upon what you want. Maybe I should just prepare a patch.

Please do not patch kernel for that.

Proper solution is probably creating s2disk program/script, and teach kpowersave/klaptop/etc. to just use it. Then s2disk can detect best method to use ... and then just do it. You already have suitable script, but I'm not sure what its name is.
Pavel

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

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

Hi.

Quoted 22 lines · Pavel Machek
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
# cat /sys/power/disk_method
swsusp uswsusp suspend2
# echo uswsusp > /sys/power/disk_method
# echo > /sys/power/state
Quoted 8 lines
Quoted 1 line

Is there a big problem with that, which I've missed?

Userland suspend is driven by the suspending application which only calls the kernel to do things it cannot do itself, like freezing (the other) processes, snapshotting the system etc. We use the /dev/snapshot device and the ioctl()s in there, so no sysfs files are needed for that. It's independent and can coexist with the existing sysfs interface just fine.

Quoted 7 lines

Yes, but how are you going to get it started from (say) klaptop, which only knows "echo disk > /sys/power/state" as the way of starting a suspend? I'm suggesting that we create a means whereby the issue of how to start a cycle could be separated from what implementation is used to do the work. That is, a simple extension at the start of the disk specific code that starts swsusp, uswsusp or suspend2 depending upon what you want. Maybe I should just prepare a patch.

Quoted 6 lines

Please do not patch kernel for that.

Proper solution is probably creating s2disk program/script, and teach kpowersave/klaptop/etc. to just use it. Then s2disk can detect best method to use ... and then just do it. You already have suitable script, but I'm not sure what its name is.

You have a good point there - the hibernate script is sufficient for the task. Ok. I'll give up on this idea and consider it their problem for not using what's provided already.

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
#181 lore raw

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

In reply to Pavel Machek

Hi again.

Quoted 10 lines · Pavel Machek

Hi!

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
# cat /sys/power/disk_method
swsusp uswsusp suspend2
# echo uswsusp > /sys/power/disk_method
# echo > /sys/power/state

Is there a big problem with that, which I've missed?

Userland suspend is driven by the suspending application which only

calls

Quoted 1 line
Quoted 1 line
Quoted 1 line

the kernel to do things it cannot do itself, like freezing (the

other)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

processes, snapshotting the system etc. We use the /dev/snapshot device and the ioctl()s in there, so no sysfs files are needed for

that.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

It's independent and can coexist with the existing sysfs interface just fine.

Yes, but how are you going to get it started from (say) klaptop, which

only

Quoted 1 line
Quoted 1 line

knows "echo disk > /sys/power/state" as the way of starting a suspend?

I'm

Quoted 2 lines
Quoted 2 lines

suggesting that we create a means whereby the issue of how to start a cycle could be separated from what implementation is used to do the

work.

Quoted 2 lines
Quoted 2 lines

That is, a simple extension at the start of the disk specific code that starts swsusp, uswsusp or suspend2 depending upon what you want. Maybe

I

Quoted 8 lines
Quoted 1 line

should just prepare a patch.

Please do not patch kernel for that.

Proper solution is probably creating s2disk program/script, and teach kpowersave/klaptop/etc. to just use it. Then s2disk can detect best method to use ... and then just do it. You already have suitable script, but I'm not sure what its name is.

It occured to me as soon as I sent the last email (don't you hate that!) that I'd forgotten the original impetus: backwards compatibility. If all of the methods of suspending can be started with

"echo disk > /sys/power/state"

, your backwards compatability issue that you expressed concern about earlier in this discussion is addressed. So, I'm not sure that dropping the idea is the right thing to do.

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
#182 lore raw

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

Hi!

Quoted 11 lines
Quoted 6 lines

Please do not patch kernel for that.

Proper solution is probably creating s2disk program/script, and teach kpowersave/klaptop/etc. to just use it. Then s2disk can detect best method to use ... and then just do it. You already have suitable script, but I'm not sure what its name is.

It occured to me as soon as I sent the last email (don't you hate that!) that I'd forgotten the original impetus: backwards compatibility. If all of the methods of suspending can be started with

Quoted 5 lines

"echo disk > /sys/power/state"

, your backwards compatability issue that you expressed concern about earlier in this discussion is addressed. So, I'm not sure that dropping the idea is the right thing to do.

Yes, it probably is. echo > /sys/*/state needs to work for a while, but we should really move everyone into running single command. Your hibernate script probably good start. (I'd call it hibernate, not hibernate.sh, so it does not *have* to be implemented in shell).
Pavel

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

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

In reply to Nigel Cunningham

Hi,

On Wednesday 08 February 2006 00:17, Nigel Cunningham wrote:
}-- snip --{

Quoted 10 lines

It occured to me as soon as I sent the last email (don't you hate that!) that I'd forgotten the original impetus: backwards compatibility. If all of the methods of suspending can be started with

"echo disk > /sys/power/state"

, your backwards compatability issue that you expressed concern about earlier in this discussion is addressed. So, I'm not sure that dropping the idea is the right thing to do.

I'm not sure if the problem is real. If it turns out to be, it'll be solvable in a couple of sane ways, so I don't think we need to worry about it in advance.

I'd like the userland suspend to be an option and not a drop-in replacement of swsusp or suspend2, so IMO it can be started in a different way.

Greetings,
Rafael

#184 lore raw

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

In reply to Rafael J. Wysocki
Quoted 12 lines · Rafael J. Wysocki

Hi,

This point is valid, but I don't think the users will _have_ _to_ switch to the userland suspend. AFAICT we are going to keep the kernel-based code as long as necessary.

We are just going to implement features in the user space that need not be implemented in the kernel. Of course they can be implemented in the kernel, and you have shown that clearly, but since they need not be there, we should at least try to implement them in the user space and see how this works.

Quoted 4 lines

Frankly, I have no strong opinion on whether they _should_ be implemented in the user space or in the kernel, but I think we won't know that until we actually _try_.

Some of the stuff belongs in userspace without a doubt, like the UI. But why was the cryptoapi stuff added to the kernel if everytime someone goes to use it people yell "That's too much complexity, do it in userspace!"?

Quoted 5 lines

That said, I like the idea and I'm going to work on it. I'll also appreciate any help very much.

Greetings,
Rafael

Jim.

#185 lore raw

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

Quoted 13 lines · Jim Crilly
Quoted 12 lines · Rafael J. Wysocki

Hi,

This point is valid, but I don't think the users will _have_ _to_ switch to the userland suspend. AFAICT we are going to keep the kernel-based code as long as necessary.

We are just going to implement features in the user space that need not be implemented in the kernel. Of course they can be implemented in the kernel, and you have shown that clearly, but since they need not be there, we should at least try to implement them in the user space and see how this works.

Quoted 8 lines
Quoted 4 lines

Frankly, I have no strong opinion on whether they _should_ be implemented in the user space or in the kernel, but I think we won't know that until we actually _try_.

Some of the stuff belongs in userspace without a doubt, like the UI. But why was the cryptoapi stuff added to the kernel if everytime someone goes to use it people yell "That's too much complexity, do it in userspace!"?

For stuff that can't be reasonably done in userspace, like encrypted loop. And notice that cryptoapi does *not* yet contain LZW.
Pavel

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

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

Quoted 19 lines · Pavel Machek
Quoted 18 lines · Jim Crilly
Quoted 16 lines · Rafael J. Wysocki

Hi,

This point is valid, but I don't think the users will _have_ _to_ switch to the userland suspend. AFAICT we are going to keep the kernel-based code as long as necessary.

We are just going to implement features in the user space that need not be implemented in the kernel. Of course they can be implemented in the kernel, and you have shown that clearly, but since they need not be there, we should at least try to implement them in the user space and see how this works.

Frankly, I have no strong opinion on whether they _should_ be implemented in the user space or in the kernel, but I think we won't know that until we actually _try_.

Quoted 8 lines
Quoted 3 lines

Some of the stuff belongs in userspace without a doubt, like the UI. But why was the cryptoapi stuff added to the kernel if everytime someone goes to use it people yell "That's too much complexity, do it in userspace!"?

For stuff that can't be reasonably done in userspace, like encrypted loop. And notice that cryptoapi does *not* yet contain LZW.
Pavel

I guess reasonable is a subjective term. For instance, I've seen quite a few people vehemently against adding new ioctls to the kernel and yet you'll be adding quite a few for /dev/snapshot. I'm just of the same mind as Nigel in that it makes the most sense to me that the majority of the suspend/hibernation process to be in the kernel.

And I realize lzf compression isn't in the main kernel yet, but cryptoapi was designed to be modular so that new things can be added later if necessary and deflate is already there, so it's not like there's no compression algorithms included yet.

Jim.

#187 lore raw

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

Quoted 5 lines · Jim Crilly

I guess reasonable is a subjective term. For instance, I've seen quite a few people vehemently against adding new ioctls to the kernel and yet you'll be adding quite a few for /dev/snapshot. I'm just of the same mind as Nigel in that it makes the most sense to me that the majority of the suspend/hibernation process to be in the kernel.

No one is saying that ANY new ioctls are bad, just that the KISS principle of engineering dictates that it's bad design to use ioctls where a simple read/write to a sysfs file will do.

Lee

#188 lore raw

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

Quoted 11 lines · Lee Revell
Quoted 5 lines · Jim Crilly

I guess reasonable is a subjective term. For instance, I've seen quite a few people vehemently against adding new ioctls to the kernel and yet you'll be adding quite a few for /dev/snapshot. I'm just of the same mind as Nigel in that it makes the most sense to me that the majority of the suspend/hibernation process to be in the kernel.

No one is saying that ANY new ioctls are bad, just that the KISS principle of engineering dictates that it's bad design to use ioctls where a simple read/write to a sysfs file will do.

I understand that, but shouldn't the KISS principle also be applied to the user interface of a feature? As it stands it looks like Suspend2 is going to be a lot simpler for users to configure and get right than uswsusp. As long as you have Suspend2 enabled in the kernel it 'just works', even if you don't have the userland UI it'll still suspend and resume just without the progress bars. There is still some room for error with things like forgetting to enable the swap writer and then attempting to suspend to a swap device or making lzf a module and forgetting to load it before resuming from a compressed image, but those are no worse than any other kernel option.

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?

Jim.

#189 lore raw

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

Hi Jim.

Quoted 24 lines · Jim Crilly
Quoted 11 lines · Lee Revell
Quoted 6 lines · Jim Crilly

I guess reasonable is a subjective term. For instance, I've seen quite a few people vehemently against adding new ioctls to the kernel and yet you'll be adding quite a few for /dev/snapshot. I'm just of the same mind as Nigel in that it makes the most sense to me that the majority of the suspend/hibernation process to be in the kernel.

No one is saying that ANY new ioctls are bad, just that the KISS principle of engineering dictates that it's bad design to use ioctls where a simple read/write to a sysfs file will do.

I understand that, but shouldn't the KISS principle also be applied to the user interface of a feature? As it stands it looks like Suspend2 is going to be a lot simpler for users to configure and get right than uswsusp. As long as you have Suspend2 enabled in the kernel it 'just works', even if you don't have the userland UI it'll still suspend and resume just without the progress bars. There is still some room for error with things like forgetting to enable the swap writer and then attempting to suspend to a swap device or making lzf a module and forgetting to load it before resuming from a compressed image, but those are no worse than any other kernel option.

Quoted 6 lines

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?

As I understand it, with uswsusp, all the functionality will be compiled into one monolithic binary, which you'll also need to put in your initrd or initramfs.

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
#190 lore raw

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

In reply to Jim Crilly
Quoted 8 lines · Jim Crilly
Quoted 7 lines · Lee Revell
Quoted 5 lines · Jim Crilly

I guess reasonable is a subjective term. For instance, I've seen quite a few people vehemently against adding new ioctls to the kernel and yet you'll be adding quite a few for /dev/snapshot. I'm just of the same mind as Nigel in that it makes the most sense to me that the majority of the suspend/hibernation process to be in the kernel.

Quoted 7 lines
Quoted 4 lines

No one is saying that ANY new ioctls are bad, just that the KISS principle of engineering dictates that it's bad design to use ioctls where a simple read/write to a sysfs file will do.

I understand that, but shouldn't the KISS principle also be applied to the user interface of a feature?

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.

Lee

#191 lore raw

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

Hi.

Quoted 14 lines · Lee Revell
Quoted 13 lines · Jim Crilly
Quoted 11 lines · Lee Revell
Quoted 6 lines · Jim Crilly

I guess reasonable is a subjective term. For instance, I've seen quite a few people vehemently against adding new ioctls to the kernel and yet you'll be adding quite a few for /dev/snapshot. I'm just of the same mind as Nigel in that it makes the most sense to me that the majority of the suspend/hibernation process to be in the kernel.

No one is saying that ANY new ioctls are bad, just that the KISS principle of engineering dictates that it's bad design to use ioctls where a simple read/write to a sysfs file will do.

Quoted 7 lines
Quoted 2 lines

I understand that, but shouldn't the KISS principle also be applied to the user interface of a feature?

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.

Well, I will have to maintain it, and I'm perfectly willing to. I only started to work on it in the first place because I wanted to use it, so I have a vested interest in keeping it working. So... even if we end up pulling it out in place of a userspace solution, I really like the idea of putting it in at least until uswsusp is up to speed (provided it didn't given Andrew and/or Linus a hernia in the process).

To avoid the backwards compatability issues, we can plan ahead now, defining something like I suggested in another email earlier in the day.

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
#192 lore raw

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

In reply to Lee Revell
Quoted 14 lines · Lee Revell
Quoted 13 lines · Jim Crilly
Quoted 11 lines · Lee Revell
Quoted 5 lines · Jim Crilly

I guess reasonable is a subjective term. For instance, I've seen quite a few people vehemently against adding new ioctls to the kernel and yet you'll be adding quite a few for /dev/snapshot. I'm just of the same mind as Nigel in that it makes the most sense to me that the majority of the suspend/hibernation process to be in the kernel.

No one is saying that ANY new ioctls are bad, just that the KISS principle of engineering dictates that it's bad design to use ioctls where a simple read/write to a sysfs file will do.

Quoted 7 lines
Quoted 2 lines

I understand that, but shouldn't the KISS principle also be applied to the user interface of a feature?

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).
Pavel

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

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

Hi.

Quoted 5 lines · Pavel Machek
Quoted 4 lines · Lee Revell
Quoted 3 lines · Jim Crilly
Quoted 2 lines · Lee Revell
Quoted 1 line · Jim Crilly

I guess reasonable is a subjective term. For instance, I've seen

quite

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

a few people vehemently against adding new ioctls to the kernel

and

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

yet you'll be adding quite a few for /dev/snapshot. I'm just of

the

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

same mind as Nigel in that it makes the most sense to me that the majority of the suspend/hibernation process to be in the kernel.

No one is saying that ANY new ioctls are bad, just that the KISS principle of engineering dictates that it's bad design to use

ioctls

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

where a simple read/write to a sysfs file will do.

I understand that, but shouldn't the KISS principle also be applied

to

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

the user interface of a feature?

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.

Quoted 6 lines

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).

<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 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!

</horrified rebuke>

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
#194 lore raw

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

Hi!

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!

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.

And yes, I'm a maintainer, and that means I have to reject bad patches from time to time, too.
Pavel

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

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

Hello.

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.

Ok. So Lee might be ok to test uswsusp. But this is your approach regardless of who is emailing you. You consistently tell people to fix problems themselves and send you a patch. That's not what a maintainer should do. They're supposed to maintain, not get other people to do the work. They're supposed to be helpful, not a source of anxiety. You might be the maintainer of swsusp in name, but you're not in practice. Please, lift your game!

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
#196 lore raw

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

Hi,

Quoted 34 lines · Nigel Cunningham
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.

Quoted 7 lines

Ok. So Lee might be ok to test uswsusp. But this is your approach regardless of who is emailing you. You consistently tell people to fix problems themselves and send you a patch. That's not what a maintainer should do. They're supposed to maintain, not get other people to do the work. They're supposed to be helpful, not a source of anxiety. You might be the maintainer of swsusp in name, but you're not in practice. Please, lift your game!

I strongly disagree with this opinion. I don't think there's any problem with Pavel, at least I haven't had any problems in communicating with him. Moreover, I don't think the role of maintainer must be to actually write the code. From my point of view Pavel is in the right place, because I need someone to tell me if I'm going to do something stupid who knows the kernel better than I do.

Furthermore, in many cases this is not Pavel who opposes your patches. As we speak there is a discussion on linux-pm regarding a patch that you have submitted and I'm sure you are following it. Please note that Pavel hasn't spoken yet, but the patch has already been opposed by at least two people. Is _this_ a Pavel's fault? No, it isn't.

Greetings,
Rafael

#197 lore raw

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

Quoted 45 lines · Rafael J. Wysocki

Hi,

Quoted 34 lines · Nigel Cunningham
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.

Quoted 7 lines

Ok. So Lee might be ok to test uswsusp. But this is your approach regardless of who is emailing you. You consistently tell people to fix problems themselves and send you a patch. That's not what a maintainer should do. They're supposed to maintain, not get other people to do the work. They're supposed to be helpful, not a source of anxiety. You might be the maintainer of swsusp in name, but you're not in practice. Please, lift your game!

Quoted 2 lines

I strongly disagree with this opinion. I don't think there's any problem with Pavel, at least I haven't had any problems in communicating with him.

You seem to be the only person around who gets on well with him. Please, more people step up and tell me I'm wrong. I am only going off the mailing list afterall, and not daily personal interaction of some other kind.

Quoted 4 lines

Moreover, I don't think the role of maintainer must be to actually write the code. From my point of view Pavel is in the right place, because I need someone to tell me if I'm going to do something stupid who knows the kernel better than I do.

By definition, if they don't maintain code, their not a maintainer. If they only tell someone that they're going to do something stupid, they're a code reviewer.

Quoted 1 line

Furthermore, in many cases this is not Pavel who opposes your patches.

Other people have given feedback in the past that has been along the lines of suggesting improvements / cleanups / whatever, but (feel free to correct me) no one apart from him has written it off wholesale, told me I'm wasting my time or the like.

I want to get on with Pavel, I really do. But it's very hard when, despite my best efforts, trying to make allowances for possible misunderstandings and the like, I never seem to hear a helpful word from him. It's always "No.". "I don't want that.", and never (so far as I recall) "Here's how you could do that better..", "The idea is ok but the implementation is broken because..." or the like. Perhaps it is (as was said yesterday) just a cultural/language thing, but I'm not sure.

Quoted 4 lines

As we speak there is a discussion on linux-pm regarding a patch that you have submitted and I'm sure you are following it. Please note that Pavel hasn't spoken yet, but the patch has already been opposed by at least two people. Is _this_ a Pavel's fault? No, it isn't.

I haven't seen any replies apart from yours so far. Perhaps there's something wrong with my mail delivery :(. I'll check the archives.

Nigel

Quoted 5 lines

Greetings,
Rafael

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

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

Hi!

[I should probably left this reply to Rafael, but...]

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Ok. So Lee might be ok to test uswsusp. But this is your approach regardless of who is emailing you. You consistently tell people to fix problems themselves and send you a patch. That's not what a maintainer should do. They're supposed to maintain, not get other people to do the work. They're supposed to be helpful, not a source of anxiety. You might be the maintainer of swsusp in name, but you're not in practice. Please, lift your game!

Quoted 7 lines
Quoted 2 lines

I strongly disagree with this opinion. I don't think there's any problem with Pavel, at least I haven't had any problems in communicating with him.

You seem to be the only person around who gets on well with him. Please, more people step up and tell me I'm wrong. I am only going off the mailing list afterall, and not daily personal interaction of some other kind.

Well, on the other hand you are the only person that really has problems with me.

Quoted 8 lines
Quoted 4 lines

Moreover, I don't think the role of maintainer must be to actually write the code. From my point of view Pavel is in the right place, because I need someone to tell me if I'm going to do something stupid who knows the kernel better than I do.

By definition, if they don't maintain code, their not a maintainer. If they only tell someone that they're going to do something stupid, they're a code reviewer.

You seem to be using different definition of maintainer than rest of the world.

Quoted 7 lines
Quoted 1 line

Furthermore, in many cases this is not Pavel who opposes your patches.

Other people have given feedback in the past that has been along the lines of suggesting improvements / cleanups / whatever, but (feel free to correct me) no one apart from him has written it off wholesale, told me I'm wasting my time or the like.

Quoted 7 lines

I want to get on with Pavel, I really do. But it's very hard when, despite my best efforts, trying to make allowances for possible misunderstandings and the like, I never seem to hear a helpful word from him. It's always "No.". "I don't want that.", and never (so far as I recall) "Here's how you could do that better..", "The idea is ok but the implementation is broken because..." or the like. Perhaps it is (as was said yesterday) just a cultural/language thing, but I'm not sure.

If I rephrase my comments as:

"The idea is okay, but the implementation is broken, because it does too much stuff in the kernel."

and

"Here's how you could do that better; take a look at latest -mm and use facilities it provides to push most of suspend2 code into userland."

...will that help?

Quoted 7 lines
Quoted 4 lines

As we speak there is a discussion on linux-pm regarding a patch that you have submitted and I'm sure you are following it. Please note that Pavel hasn't spoken yet, but the patch has already been opposed by at least two people. Is _this_ a Pavel's fault? No, it isn't.

I haven't seen any replies apart from yours so far. Perhaps there's something wrong with my mail delivery :(. I'll check the archives.

Oh... did not seen that mail thread. Please cc: me on suspend-related stuff.

Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#199 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 · Nigel Cunningham

On Wednesday 08 February 2006 09:02, Pavel Machek wrote:

}-- snip --{

Quoted 14 lines
Quoted 14 lines
Quoted 13 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.

Ok. So Lee might be ok to test uswsusp. But this is your approach regardless of who is emailing you. You consistently tell people to fix problems themselves and send you a patch. That's not what a maintainer should do. They're supposed to maintain, not get other people to do the work. They're supposed to be helpful, not a source of anxiety. You might be the maintainer of swsusp in name, but you're not in practice. Please, lift your game!

Quoted 4 lines
Quoted 2 lines

I strongly disagree with this opinion. I don't think there's any problem with Pavel, at least I haven't had any problems in communicating with him.

You seem to be the only person around who gets on well with him.

Well, that's probably because I always do my best to be nice and follow the rules that Pavel sets. I post patches to modify the existing code and not to replace it top-down. I keep them as compact as reasonably possible and focus on one thing at a time. I remove the parts that Pavel and other people don't like or I try to modify these parts to be more acceptable. Etc. This is not _that_ difficult.

Quoted 11 lines

Please, more people step up and tell me I'm wrong. I am only going off the mailing list afterall, and not daily personal interaction of some other kind.

Quoted 4 lines

Moreover, I don't think the role of maintainer must be to actually write the code. From my point of view Pavel is in the right place, because I need someone to tell me if I'm going to do something stupid who knows the kernel better than I do.

By definition, if they don't maintain code, their not a maintainer. If they only tell someone that they're going to do something stupid, they're a code reviewer.

Well, this is your opinion.

In my opinion a maintainer need not be a developer. The dictionary definition of "to maintain" is "to keep a road, machine, building, etc. in good condition"
(http://dictionary.cambridge.org/define.asp?key=48204&dict=CALD)
which need not impy any development.

Greetings,
Rafael

#200 lore raw

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

Hi.

Quoted 1 line · Rafael J. Wysocki

Well, that's probably because I always do my best to be nice and follow

the

Quoted 1 line

rules that Pavel sets. I post patches to modify the existing code and

not to

Quoted 2 lines

replace it top-down. I keep them as compact as reasonably possible and focus on one thing at a time. I remove the parts that Pavel and

other

Quoted 2 lines

people don't like or I try to modify these parts to be more acceptable. Etc. This is not _that_ difficult.

Yeah. I guess those are the differences. Thanks for putting it so clearly. Well, we're obviously not getting anywhere while I'm trying to redesign the existing code, so I guess I'll just go back to finishing the git tree and leave anyone who wants to use it to use 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
#201 lore raw

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

Hi!

Quoted 7 lines · Rafael J. Wysocki
Quoted 1 line

Well, that's probably because I always do my best to be nice and follow

the

Quoted 1 line

rules that Pavel sets. I post patches to modify the existing code and

not to

Quoted 2 lines

replace it top-down. I keep them as compact as reasonably possible and focus on one thing at a time. I remove the parts that Pavel and

Quoted 8 lines

other

Quoted 2 lines

people don't like or I try to modify these parts to be more acceptable. Etc. This is not _that_ difficult.

Yeah. I guess those are the differences. Thanks for putting it so clearly. Well, we're obviously not getting anywhere while I'm trying to redesign the existing code, so I guess I'll just go back to finishing the git tree and leave anyone who wants to use it to use it.

At one point you said you'd like to work with us, and earlier in the threads you stated that porting suspend2 to userland should be easy.

[I do not think that putting suspend2 into git is useful thing to do. Of course, it is your option; but it seems to me that people likely to use suspend2 are not the kind of people that use git.]

It would be very helpful if you could install uswsusp, then try to make suspend2 run in userland on top of uswsusp interface. Not everything will be possible that way, but it most of features should be doable that way. I'd hate to code yet another splashscreen code, for example...
Pavel

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

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

Hello.

Quoted 23 lines · Pavel Machek
Quoted 7 lines · Rafael J. Wysocki
Quoted 1 line

Well, that's probably because I always do my best to be nice and follow

the

Quoted 1 line

rules that Pavel sets. I post patches to modify the existing code and

not to

Quoted 2 lines

replace it top-down. I keep them as compact as reasonably possible and focus on one thing at a time. I remove the parts that Pavel and

Quoted 8 lines

other

Quoted 2 lines

people don't like or I try to modify these parts to be more acceptable. Etc. This is not _that_ difficult.

Yeah. I guess those are the differences. Thanks for putting it so clearly. Well, we're obviously not getting anywhere while I'm trying to redesign the existing code, so I guess I'll just go back to finishing the git tree and leave anyone who wants to use it to use it.

At one point you said you'd like to work with us, and earlier in the threads you stated that porting suspend2 to userland should be easy.

[I do not think that putting suspend2 into git is useful thing to do. Of course, it is your option; but it seems to me that people likely to use suspend2 are not the kind of people that use git.]

Quoted 5 lines

It would be very helpful if you could install uswsusp, then try to make suspend2 run in userland on top of uswsusp interface. Not everything will be possible that way, but it most of features should be doable that way. I'd hate to code yet another splashscreen code, for example...

I've begun briefly to have a look at this.

Part of the problem I have, both with doing incremental patches for swsusp and with doing a userspace version, is that some of the fundamentals are redesigned in suspend2. The most important of these is that we store the metadata in bitmaps (for pageflags) and extents (for storage) instead of pbes. Do you have thoughts on how to overcome that issue? Are you willing, for example, to do work on switching swsusp to use a different method of storing its data?

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
#203 lore raw

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

Good morning ;-).

Quoted 15 lines
Quoted 7 lines

At one point you said you'd like to work with us, and earlier in the threads you stated that porting suspend2 to userland should be easy.

[I do not think that putting suspend2 into git is useful thing to do. Of course, it is your option; but it seems to me that people likely to use suspend2 are not the kind of people that use git.]

Quoted 5 lines

It would be very helpful if you could install uswsusp, then try to make suspend2 run in userland on top of uswsusp interface. Not everything will be possible that way, but it most of features should be doable that way. I'd hate to code yet another splashscreen code, for example...

I've begun briefly to have a look at this.

Quoted 7 lines

Part of the problem I have, both with doing incremental patches for swsusp and with doing a userspace version, is that some of the fundamentals are redesigned in suspend2. The most important of these is that we store the metadata in bitmaps (for pageflags) and extents (for storage) instead of pbes. Do you have thoughts on how to overcome that issue? Are you willing, for example, to do work on switching swsusp to use a different method of storing its data?

Any changes to userspace are a fair game. OTOH kernel provides linear image to be saved to userspace, and what it uses internally should not be important to userland parts. (And Rafael did some changes in that area to make it more effective, IIRC).
Pavel

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

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

Hi,

Quoted 25 lines · Pavel Machek

Good morning ;-).

Quoted 15 lines
Quoted 7 lines

At one point you said you'd like to work with us, and earlier in the threads you stated that porting suspend2 to userland should be easy.

[I do not think that putting suspend2 into git is useful thing to do. Of course, it is your option; but it seems to me that people likely to use suspend2 are not the kind of people that use git.]

Quoted 5 lines

It would be very helpful if you could install uswsusp, then try to make suspend2 run in userland on top of uswsusp interface. Not everything will be possible that way, but it most of features should be doable that way. I'd hate to code yet another splashscreen code, for example...

I've begun briefly to have a look at this.

Quoted 7 lines

Part of the problem I have, both with doing incremental patches for swsusp and with doing a userspace version, is that some of the fundamentals are redesigned in suspend2. The most important of these is that we store the metadata in bitmaps (for pageflags) and extents (for storage) instead of pbes. Do you have thoughts on how to overcome that issue? Are you willing, for example, to do work on switching swsusp to use a different method of storing its data?

Quoted 4 lines

Any changes to userspace are a fair game. OTOH kernel provides linear image to be saved to userspace, and what it uses internally should not be important to userland parts. (And Rafael did some changes in that area to make it more effective, IIRC).

Yes. The code is now split into the part that handles the snapshot image (in snapshot.c) and the part that writes/reads it to swap (in swap.c). [I'm referring to recent -mm kernels.]

The access to the snapshot image is provided via the functions snapshot_write_next() and snapshot_read_next() that are called by the code in swap.c and may be used by the user space tools via the interface in user.c. In principle it ought to be possible to plug something else instead of the code in snapshot.c without breaking the rest.

Greetings,
Rafael

#205 lore raw

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

Hi.

Quoted 19 lines · Rafael J. Wysocki
Quoted 10 lines
Quoted 9 lines

I've begun briefly to have a look at this.

Part of the problem I have, both with doing incremental patches for swsusp and with doing a userspace version, is that some of the fundamentals are redesigned in suspend2. The most important of these is that we store the metadata in bitmaps (for pageflags) and extents (for storage) instead of pbes. Do you have thoughts on how to overcome that issue? Are you willing, for example, to do work on switching swsusp to use a different method of storing its data?

Quoted 4 lines

Any changes to userspace are a fair game. OTOH kernel provides linear image to be saved to userspace, and what it uses internally should not be important to userland parts. (And Rafael did some changes in that area to make it more effective, IIRC).

Yes. The code is now split into the part that handles the snapshot image (in snapshot.c) and the part that writes/reads it to swap (in swap.c). [I'm referring to recent -mm kernels.]

Quoted 6 lines

The access to the snapshot image is provided via the functions snapshot_write_next() and snapshot_read_next() that are called by the code in swap.c and may be used by the user space tools via the interface in user.c. In principle it ought to be possible to plug something else instead of the code in snapshot.c without breaking the rest.

So, what is the answer then? If I submitted patches to provide the possibility of separating LRU pages into a separate stream of pages to be read/written, would it have any chance of getting merged? (Along with other patches to make writing a full image of memory possible).

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
#206 lore raw

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

Hi!

Quoted 16 lines
Quoted 9 lines
Quoted 4 lines

Any changes to userspace are a fair game. OTOH kernel provides linear image to be saved to userspace, and what it uses internally should not be important to userland parts. (And Rafael did some changes in that area to make it more effective, IIRC).

Yes. The code is now split into the part that handles the snapshot image (in snapshot.c) and the part that writes/reads it to swap (in swap.c). [I'm referring to recent -mm kernels.]

Quoted 6 lines

The access to the snapshot image is provided via the functions snapshot_write_next() and snapshot_read_next() that are called by the code in swap.c and may be used by the user space tools via the interface in user.c. In principle it ought to be possible to plug something else instead of the code in snapshot.c without breaking the rest.

Quoted 4 lines

So, what is the answer then? If I submitted patches to provide the possibility of separating LRU pages into a separate stream of pages to be read/written, would it have any chance of getting merged? (Along with other patches to make writing a full image of memory possible).

Could we do the other stuff, first, please? Userland LZF/encryption/progress should be easy to do, and doing that should teach us how to cooperate.
Pavel

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

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

Hi.

Quoted 18 lines · Pavel Machek

Hi!

Quoted 16 lines
Quoted 15 lines
Quoted 4 lines

Any changes to userspace are a fair game. OTOH kernel provides linear image to be saved to userspace, and what it uses internally should not be important to userland parts. (And Rafael did some changes in that area to make it more effective, IIRC).

Yes. The code is now split into the part that handles the snapshot image (in snapshot.c) and the part that writes/reads it to swap (in swap.c). [I'm referring to recent -mm kernels.]

The access to the snapshot image is provided via the functions snapshot_write_next() and snapshot_read_next() that are called by the code in swap.c and may be used by the user space tools via the interface in user.c. In principle it ought to be possible to plug something else instead of the code in snapshot.c without breaking the rest.

Quoted 8 lines
Quoted 4 lines

So, what is the answer then? If I submitted patches to provide the possibility of separating LRU pages into a separate stream of pages to be read/written, would it have any chance of getting merged? (Along with other patches to make writing a full image of memory possible).

Could we do the other stuff, first, please? Userland LZF/encryption/progress should be easy to do, and doing that should teach us how to cooperate.

The problem I have with doing that is that it makes more work. Adding support for multiple sets of pages is a more fundamental change, and so should be done earlier. Let me use an analogy from evolutionary theory (yes, I think evolution is flawed, but let's ignore that for the mo). If you were trying to image the steps by which an amoeba became a human being, would you put the devlopment of the cardio-vascular system before the development of eye sight? Making eye sight work (if it was at all possible) without a cardio vascular system would result in a fundamentally different design for the eye than if you did the cario-vascular system first. Changing the eye once the cardio-vascular system was in would be a huge redevelopment, and a huge pain. For the same reasons, I think that if support for 2 pagesets was going to be put in an implementation it should be done as early as possible. Likewise for reworking the method by which data is stored (I say, thinking of bitmaps vs pbes).

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
#208 lore raw

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

Hi,

Quoted 26 lines · Nigel Cunningham
Quoted 16 lines · Pavel Machek
Quoted 16 lines
Quoted 15 lines
Quoted 4 lines

Any changes to userspace are a fair game. OTOH kernel provides linear image to be saved to userspace, and what it uses internally should not be important to userland parts. (And Rafael did some changes in that area to make it more effective, IIRC).

Yes. The code is now split into the part that handles the snapshot image (in snapshot.c) and the part that writes/reads it to swap (in swap.c). [I'm referring to recent -mm kernels.]

The access to the snapshot image is provided via the functions snapshot_write_next() and snapshot_read_next() that are called by the code in swap.c and may be used by the user space tools via the interface in user.c. In principle it ought to be possible to plug something else instead of the code in snapshot.c without breaking the rest.

Quoted 8 lines
Quoted 4 lines

So, what is the answer then? If I submitted patches to provide the possibility of separating LRU pages into a separate stream of pages to be read/written, would it have any chance of getting merged? (Along with other patches to make writing a full image of memory possible).

Could we do the other stuff, first, please? Userland LZF/encryption/progress should be easy to do, and doing that should teach us how to cooperate.

Quoted 14 lines

The problem I have with doing that is that it makes more work. Adding support for multiple sets of pages is a more fundamental change, and so should be done earlier. Let me use an analogy from evolutionary theory (yes, I think evolution is flawed, but let's ignore that for the mo). If you were trying to image the steps by which an amoeba became a human being, would you put the devlopment of the cardio-vascular system before the development of eye sight? Making eye sight work (if it was at all possible) without a cardio vascular system would result in a fundamentally different design for the eye than if you did the cario-vascular system first. Changing the eye once the cardio-vascular system was in would be a huge redevelopment, and a huge pain. For the same reasons, I think that if support for 2 pagesets was going to be put in an implementation it should be done as early as possible. Likewise for reworking the method by which data is stored (I say, thinking of bitmaps vs pbes).

The evolution theory assumes that features are not planned and are developed "as needed", but you know you'll need the feature at some point and you can design for it without actually implementing it.

Now in swsusp we do something like this:

freeze()
atomic_snapshot()
save_image() (=> snapshot_read() in a loop)
power_down()

If I understand it correctly, you'd like to do something like this:

freeze()
save_LRU() (=> snapshot_read() in a loop)
atomic_snapshot()
save_image() (=> snapshot_read() in a loop)
power_down()

Suppose there are no LRU pages to save (unrealistic, but helpful). In such a case save_LRU() does nothing and your procedure is identical to ours. Thus you can assume, for now, that you always have 0 LRU pages to save, put placeholders wherever needed and go on. Later on you'll be able to replace the placeholders with something actually useful.

Further, we can assume that snapshot_read() can only be called before atomic_snapshot() for saving LRU pages and no changes to the interface will be needed.

Greetings,
Rafael

#209 lore raw

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

Hi!

So another flamewar is over, good. I even received one apology ;-), and probably should have sent some apologies, too...

Anyway, it means that suspend is still quite a hot topic, and that is good. (Linus said that suspend-to-disk is basically for people that can't get suspend-to-RAM to work, and after I got suspend-to-RAM to work reliably here, I can see his point).

Anyway, uswsusp project needs your help. It is basically working, see www.sf.net/projects/suspend , and it is already faster then in-kernel version. How you could help?

* testing is useful at this point. Few confirmations that it works in different configurations would make us feel warm and fuzzy.

* documentation improvements, and small scripts. Having script that prepares initrd would be nice, for example.

* having someone to maintain suspend.sf.net web pages / release CVS snapshot as package would help, too.

* userspace code improvements. Encryption, LZW and graphical progress should be reasonably easy to do. There's some tricky stuff, if you prefer -- support for swap files and normal files would help, too. Plus I guess everyone has their favourite feature...

Pavel

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

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

Quoted 1 line · Pavel Machek

Anyway, it means that suspend is still quite a hot topic, and that is good. (Linus said that suspend-to-disk is basically for people that can't get suspend-to-RAM to work, and after I got suspend-to-RAM to work reliably here, I can see his point).

I completely agree. My Mac PowerBook has had suspend-to-RAM for a long time; I shut the lid and about 3 seconds later it's asleep, open it and 3 seconds later it's awake. Leave it sleeping for a week on a full charge, come back to find it still asleep. I can even put it to sleep, remove a drained battery and put in a fresh one (it has a small internal 2-minute RAM battery), then wake it up and resume work. I'm curious though, what proportion of laptop hardware actually has support for suspend-to-RAM? (including hardware for which linux does not yet have support). What percent of that hardware _does_ have Linux support?

Cheers,
Kyle Moffett

--
If you don't believe that a case based on [nothing] could potentially drag on in court for _years_, then you have no business playing with the legal system at all.
-- Rob Landley

#211 lore raw

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

Quoted 6 lines · Kyle Moffett
Quoted 1 line · Pavel Machek

Anyway, it means that suspend is still quite a hot topic, and that is good. (Linus said that suspend-to-disk is basically for people that can't get suspend-to-RAM to work, and after I got suspend-to- RAM to work reliably here, I can see his point).

I completely agree. My Mac PowerBook has had suspend-to-RAM for a long time; I shut the lid and about 3 seconds later it's asleep, open it and 3 seconds later it's awake. Leave it sleeping for a week on a full charge, come back to find it still asleep. I can even put it to sleep, remove a drained battery and put in a fresh one (it has a small internal 2-minute RAM battery), then wake it up and resume work. I'm curious though, what proportion of laptop hardware actually has support for suspend-to-RAM? (including hardware for which linux does not yet have support).

I'd say about... 100% of all in use today :-) Really, I've not seen a machine without APM or ACPI in ages...

Quoted 1 line

What percent of that hardware _does_ have Linux support?

85% I'd say. My notebook supports suspend, but not stand by, in Linux. Suspend uses more battery. :-(

Quoted 17 lines

Cheers,
Kyle Moffett

Signature · 10 lines
If you don't believe that a case based on [nothing] could potentially  drag on in court for _years_, then you have no business playing with  the legal system at all.
  -- Rob Landley



-
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/
Signature · 2 lines
--hackmiester
Walk a mile in my shoes and you will be a mile away in a new pair of shoes.
#212 lore raw

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

In reply to Kyle Moffett

Hi!

Quoted 5 lines
Quoted 4 lines

Anyway, it means that suspend is still quite a hot topic, and that is good. (Linus said that suspend-to-disk is basically for people that can't get suspend-to-RAM to work, and after I got suspend-to- RAM to work reliably here, I can see his point).

Quoted 10 lines

I completely agree. My Mac PowerBook has had suspend-to-RAM for a long time; I shut the lid and about 3 seconds later it's asleep, open it and 3 seconds later it's awake. Leave it sleeping for a week on a full charge, come back to find it still asleep. I can even put it to sleep, remove a drained battery and put in a fresh one (it has a small internal 2-minute RAM battery), then wake it up and resume work. I'm curious though, what proportion of laptop hardware actually has support for suspend-to-RAM? (including hardware for which linux does not yet have support). What percent of that hardware _does_ have Linux support?

99%+ of notebooks can do s-t-ram, and perhaps 50% desktops. Linux should work on 70% or so...

Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms         
#213 lore raw

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

In reply to Pavel Machek
Quoted 4 lines · Pavel Machek

Anyway, it means that suspend is still quite a hot topic, and that is good. (Linus said that suspend-to-disk is basically for people that can't get suspend-to-RAM to work, and after I got suspend-to-RAM to work reliably here, I can see his point).

I strongly disagree. I got suspend-to-RAM to work but its utility is seriously limited by battery capacity. For example, on my laptop (Sony VGN-B100B) with 1.5GB of RAM, a fully charged battery is drained in about 18 hours if the laptop was suspended to RAM.

Yes, for a few hours suspend-to-RAM is convenient but suspend-to-disk is _reliable_ and _safe_.

Jan

#214 lore raw

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

Quoted 6 lines · Jan Merka
Quoted 4 lines · Pavel Machek

Anyway, it means that suspend is still quite a hot topic, and that is good. (Linus said that suspend-to-disk is basically for people that can't get suspend-to-RAM to work, and after I got suspend-to-RAM to work reliably here, I can see his point).

Quoted 7 lines

I strongly disagree. I got suspend-to-RAM to work but its utility is seriously limited by battery capacity. For example, on my laptop (Sony VGN-B100B) with 1.5GB of RAM, a fully charged battery is drained in about 18 hours if the laptop was suspended to RAM.

Yes, for a few hours suspend-to-RAM is convenient but suspend-to-disk is _reliable_ and _safe_.

People with dual-boot systems (before someone starts screaming, I know people that dual-boot Linux as well for testing/development reasons) can also benefit from STD. You just put Linux to sleep, boot your testing OS, and when you are done just resume your normal Linux system and continue working. Before I got a second PC, suspend (swsusp then) used to be a savior for kernel driver testing...

#215 lore raw

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

In reply to Jan Merka
Quoted 4 lines · Jan Merka
Quoted 1 line · Pavel Machek

Anyway, it means that suspend is still quite a hot topic, and that is good. (Linus said that suspend-to-disk is basically for people that can't get suspend-to-RAM to work, and after I got suspend-to-RAM to work reliably here, I can see his point).

I strongly disagree. I got suspend-to-RAM to work but its utility is seriously limited by battery capacity. For example, on my laptop (Sony VGN-B100B) with 1.5GB of RAM, a fully charged battery is drained in about 18 hours if the laptop was suspended to RAM.

Ick, that's kind of sucky hardware then. My PowerBook with 1GB RAM easily gets a week of sleep time off a fully charged battery; I don't think I've rebooted it _once_ in the last 2 months, I just leave it sleeping in my bag the whole time. Sony must be doing something wrong, because there's easily enough power in a single battery to keep RAM refreshed for a _long_ time.

Quoted 1 line

Yes, for a few hours suspend-to-RAM is convenient but suspend-to-disk is _reliable_ and _safe_.

As to the safety issue, I have my Apple Powerbook configured to suspend to RAM, and if it gets critically low on battery I have the firmware set to resume it automatically and my scripts shut it down so I don't lose data. Suspend-to-RAM when implemented properly _is_ reliable and safe, but it seems like a lot of hardware manufacturers get it wrong.

Cheers,
Kyle Moffett

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/E/U d- s++: a18 C++++>$ ULBX*++++(+++)>$ P++++(+++)>$ L++++(+++)>$ !E- W+++(++) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+ PGP+ t+(+++) 5 X R? !tv-(--) b++++(++) DI+(++) D+++ G e>++++$ h*(+)>++$ r%(--) !y?-(--) ------END GEEK CODE BLOCK------

#216 lore raw

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

Quoted 14 lines · Kyle Moffett
Quoted 4 lines · Jan Merka

I strongly disagree. I got suspend-to-RAM to work but its utility is seriously limited by battery capacity. For example, on my laptop (Sony VGN-B100B) with 1.5GB of RAM, a fully charged battery is drained in about 18 hours if the laptop was suspended to RAM.

Ick, that's kind of sucky hardware then. My PowerBook with 1GB RAM easily gets a week of sleep time off a fully charged battery; I don't think I've rebooted it _once_ in the last 2 months, I just leave it sleeping in my bag the whole time. Sony must be doing something wrong, because there's easily enough power in a single battery to keep RAM refreshed for a _long_ time.

Quoted 9 lines
Quoted 2 lines

Yes, for a few hours suspend-to-RAM is convenient but suspend-to-disk is _reliable_ and _safe_.

As to the safety issue, I have my Apple Powerbook configured to suspend to RAM, and if it gets critically low on battery I have the firmware set to resume it automatically and my scripts shut it down so I don't lose data. Suspend-to-RAM when implemented properly _is_ reliable and safe, but it seems like a lot of hardware manufacturers get it wrong.

Hello,

I don't understand how a fundamental (good) debate of how suspend to disk should be implemented in kernel, changed into this one.

I don't care what Linus said... Suspend-to-disk is more complicated than suspend-to-RAM. It is more complicated since it provides more features. Suspend-to-RAM only stores state, where Suspend-to-disk need to store the state somewhere thus changing the initial state.

There is a long list of features available at
http://wiki.suspend2.net/FeatureUserRegister, which cannot be provided using suspend-to-RAM, examples:
1. Store state on files - this allow you to resume your machine into a different OS.
2. Encrypt state - this allow you to be sure that your data is stored encrypted. (Yes... You can encrypt the memory... but then you need a whole initramfs clone in order to allow the user to specify how he want to encrypt/decrypt).
3. Network resume - this allow you to resume a network machine (Not implemented yet, but cannot be done if suspend-to-RAM is the sole implementation).
4. Support desktops/servers - this allow you to suspend/resume hardware that is not designed to sleep, in order to minimize downtime on power failure.

And another fact: Suspend-to-RAM implementation can be derived form suspend-to-disk but not the other way around.

So let's invert the initial "fact"... Suspend-to-RAM is basically for people that don't need the full functionality of suspend-to-disk, after I got suspend-to-disk to work reliably here (suspend2), I *NEVER* use suspend-to-RAM.

Best Regards,
Alon Bar-Lev.

#217 lore raw

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

Quoted 1 line · Alon Bar-Lev

1. Store state on files

This is not a "feature", it's just something that causes a lot of downsides (chew up disk space, fragment files, add code complexity, etc).

Quoted 1 line

this allow you to resume your machine into a different OS.

This is the "feature". On the other hand, I'm going to argue that this isn't really what we want to be doing for complexity reasons. We want to implement the container and userspace-freeze code described in the virtualization thread, then implement software-suspend-and-resume-into-different-OS as freeze-userspace-container, shutdown. Then you could trivially have different sets of working data/processes, load up multiple sets at once, selectively freeze, etc, with far less kernel complexity.

Quoted 1 line

2. Encrypt state - this allow you to be sure that your data is stored encrypted. (Yes... You can encrypt the memory... but then you need a whole initramfs clone in order to allow the user to specify how he want to encrypt/decrypt).

Why the hell would you even _want_ to encrypt data in RAM? If you have a secure OS install and a passworded screensaver that starts before suspend, then there is _nothing_ an attacker could do to the contents of RAM without hard-booting, which would just completely erase it, or without extremely specialized hardware and expertise. Picking up a machine suspended to RAM is just as secure as picking up one that is on, no more or less.

Quoted 4 lines

3. Network resume - this allow you to resume a network machine (Not implemented yet, but cannot be done if suspend-to-RAM is the sole implementation).

4. Support desktops/servers - this allow you to suspend/resume hardware that is not designed to sleep, in order to minimize downtime on power failure.

This again is covered by the container-freeze stuff being implemented as described above, and is unrelated to the suspend-to-RAM. When I want suspend-to-RAM, I want something that will work instantly with no overhead, so I can close my laptop and have it asleep 2 seconds later, or open it and be able to use it within 2 seconds. That's an extremely different use-case than the above two.

Quoted 1 line

And another fact: Suspend-to-RAM implementation can be derived form suspend-to-disk but not the other way around.

No, the two are _entirely_ independent. Suspend-to-RAM does not need to copy memory at all, whereas suspend-to-disk requires it. That very fact means that suspend-to-RAM is orders of magnitude faster than suspend-to-disk could ever be, especially as RAM gets exponentially larger.

Quoted 1 line

So let's invert the initial "fact"... Suspend-to-RAM is basically for people that don't need the full functionality of suspend-to-disk, after I got suspend-to-disk to work reliably here (suspend2), I *NEVER* use suspend-to-RAM.

No, suspend-to-ram is for people who need instant response times, suspend-to-disk should be an extension or simplification of "Freeze a process tree and all associated system status so we can completely give up the hardware for a while". IMHO, the fact that both are called "suspend" is just due to historical quirk as opposed to any real similarity.

Cheers,
Kyle Moffett

--
There is no way to make Linux robust with unreliable memory subsystems, sorry. It would be like trying to make a human more robust with an unreliable O2 supply. Memory just has to work.
-- Andi Kleen

#218 lore raw

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

Quoted 6 lines · Kyle Moffett
Quoted 4 lines · Alon Bar-Lev

2. Encrypt state - this allow you to be sure that your data is stored encrypted. (Yes... You can encrypt the memory... but then you need a whole initramfs clone in order to allow the user to specify how he want to encrypt/decrypt).

Quoted 7 lines

Why the hell would you even _want_ to encrypt data in RAM? If you have a secure OS install and a passworded screensaver that starts before suspend, then there is _nothing_ an attacker could do to the contents of RAM without hard-booting, which would just completely erase it, or without extremely specialized hardware and expertise. Picking up a machine suspended to RAM is just as secure as picking up one that is on, no more or less.

I guess you are not a security aware user...
A machine that is turned on is *MUCH* less secured than a machine which is turned off and have its disks encrypted. We can start argue on this issue too... But I won't cooperate...

Quoted 7 lines
Quoted 2 lines

And another fact: Suspend-to-RAM implementation can be derived form suspend-to-disk but not the other way around.

No, the two are _entirely_ independent. Suspend-to-RAM does not need to copy memory at all, whereas suspend-to-disk requires it. That very fact means that suspend-to-RAM is orders of magnitude faster than suspend-to-disk could ever be, especially as RAM gets exponentially larger.

Well... I see you already planned the implementation and have all figured out...
But the fact is that suspend-to-RAM can be implemented by suspend-to-disk without actually store the memory to external device... But hay... You can implement and maintain two separate solutions...

Quoted 6 lines

No, suspend-to-ram is for people who need instant response times, suspend-to-disk should be an extension or simplification of "Freeze a process tree and all associated system status so we can completely give up the hardware for a while". IMHO, the fact that both are called "suspend" is just due to historical quirk as opposed to any real similarity.

Again... This is a matter of implementation... I believe that one complete suspend implementation can suite both disk and RAM... The only difference is if you write the state to external storage, and how you play with APM. So there is a good reason why both are called "suspend".

I don't claim that virtualization approach is not appropriate, and in the future suspend may use this in order to create its snapshot, and maybe, as you say, you may get suspend-to-RAM in-kernel and suspend-to-disk in user-space by dumping each process's container into a file (I don't know what you do with graphics and caching... but let's assume you have solution for all).

Let's see what happened so far:

First we had swsusp... For many people it did not work, so Suspend2 was developed, but was not merged mainly because it had too many UI components in-kernel.

Then comes the micro-kernel approach to convert swsusp into uswsusp... Suspend2 which is stable now cannot be merged since it violates this idea. So users will not get a proper merged solution for at least one more year.

Now, you come with a different solution (virtualization), so let's delay suspend feature for how long? At least two years?

We need (and can get) suspend to work *NOW*, laptops are being more and more common... People expect to have this ability in a modern operating system, they don't care if it is implemented in kernel or in user-space, they also don't care if you change it along the way... And if in the future Linux will be pure virtual machine, all will be happy.... And use it... But please consider offering a working solution *NOW*.

Best Regards,
Alon Bar-Lev.

#219 lore raw

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

Quoted 4 lines · Alon Bar-Lev
Quoted 1 line · Kyle Moffett

Why the hell would you even _want_ to encrypt data in RAM? If you have a secure OS install and a passworded screensaver that starts before suspend, then there is _nothing_ an attacker could do to the contents of RAM without hard-booting, which would just completely erase it, or without extremely specialized hardware and expertise. Picking up a machine suspended to RAM is just as secure as picking up one that is on, no more or less.

I guess you are not a security aware user... A machine that is turned on is *MUCH* less secured than a machine which is turned off and have its disks encrypted. We can start argue on this issue too... But I won't cooperate...

Where is your proof? This is quite true for a machine on a _network_, but my suspended laptop isn't. You say that I am not a security aware user and that therefore you are automatically right, but it doesn't make it so. What is the practical vulnerability in my laptop's suspend-to-ram, given that it automatically locks all VTs and X when sleeping? Don't you *dare* say "somebody could attach a hardware debugger and read your data out of RAM", because I just don't see that happening in any reasonable situation, there are too many obstacles to doing that with a _laptop_, the first of which is just that it's impossible to take the damn thing apart when it's on without disconnecting massive amounts of critical wiring. Even if that _is_ a risk-case for you, it's not the use-case we should optimize suspend for!

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

And another fact: Suspend-to-RAM implementation can be derived form suspend-to-disk but not the other way around.

No, the two are _entirely_ independent. Suspend-to-RAM does not need to copy memory at all, whereas suspend-to-disk requires it. That very fact means that suspend-to-RAM is orders of magnitude faster than suspend-to-disk could ever be, especially as RAM gets exponentially larger.

Well... I see you already planned the implementation and have all figured out... But the fact is that suspend-to-RAM can be implemented by suspend-to-disk without actually store the memory to external device...

Right, the process goes something like this pseudocode:

put_devices_to_sleep(); /* [1] */

if (suspend_to_ram) {
	call_firmware_suspend();
} else {
	atomically_freeze_state();
	wake_devices_up();
	store_state_to_devices(); /* [2] */
	put_devices_to_sleep();
	switch(mode) {
		SUSP_SHUTDOWN: shutdown();
		SUSP_REBOOT:   reboot();
		[.......................]
	}
}

Remind me again why we should implement suspend-to-RAM as part of suspend-to-disk? Especially since the _only_ shared functionality is [1] which is already separated out for other reasons. A lot of people also seem to want to initiate and control all of [2] in userspace, whereas the suspend-to-RAM case needs just one syscall.

Quoted 1 line

But hay... You can implement and maintain two separate solutions...

You still have yet to prove that suspend-to-RAM and suspend-to-disk have anything to gain by being wrapped in a big if statement.

Quoted 9 lines
Quoted 1 line

No, suspend-to-ram is for people who need instant response times, suspend-to-disk should be an extension or simplification of "Freeze a process tree and all associated system status so we can completely give up the hardware for a while". IMHO, the fact that both are called "suspend" is just due to historical quirk as opposed to any real similarity.

Again... This is a matter of implementation... I believe that one complete suspend implementation can suite both disk and RAM... The only difference is if you write the state to external storage, and how you play with APM. So there is a good reason why both are called "suspend".

I don't claim that virtualization approach is not appropriate, and in the future suspend may use this in order to create its snapshot, and maybe, as you say, you may get suspend-to-RAM in-kernel and suspend-to-disk in user-space by dumping each process's container into a file (I don't know what you do with graphics and caching... but let's assume you have solution for all).

Let's see what happened so far:

First we had swsusp... For many people it did not work, so Suspend2 was developed, but was not merged mainly because it had too many UI components in-kernel.

Actually, I seem to recall that even before _either_ of those were working decently a bunch of modern hardware had good suspend-to-RAM support.

Quoted 3 lines

Then comes the micro-kernel approach to convert swsusp into uswsusp... Suspend2 which is stable now cannot be merged since it violates this idea. So users will not get a proper merged solution for at least one more year.

Now, you come with a different solution (virtualization), so let's delay suspend feature for how long? At least two years?

Personally, I really don't care if you (or whoever) wants to merge an intermediate suspend-to-disk/software-suspend implementation. I think it would be helpful on a lot of laptops where suspend-to-RAM doesn't work or chews battery. But I _really_ don't want to see somebody trying to patch suspend-to-RAM/hardware-suspend into that mess.

Quoted 1 line

We need (and can get) suspend to work *NOW*,

It does work now, suspend-to-RAM/hardware-suspend has been working perfectly on my laptop for a long time (modulo a couple powerbook USB bugs that crept in recently and got removed). IMHO, a modern laptop that doesn't support suspend-to-RAM is a broken design, although I realize that it happens all too often.

Quoted 1 line

laptops are being more and more common... People expect to have this ability in a modern operating system, they don't care if it is implemented in kernel or in user-space, they also don't care if you change it along the way... And if in the future Linux will be pure virtual machine, all will be happy.... And use it... But please consider offering a working solution *NOW*.

On this I do agree, but _please_ don't muck with my suspend-to-RAM along the way because of some egotistical "We are new-fancy-kernel-software-suspend, resistance is futile" type thing, ok? Suspend-to-RAM/hardware-suspend and suspend-to-disk/software-suspend are two _completely_ different things and should not be treated the same at all.

Cheers,
Kyle Moffett

--
Premature optimization is the root of all evil in programming
-- C.A.R. Hoare

#220 lore raw

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

Quoted 6 lines · Kyle Moffett

and X when sleeping? Don't you *dare* say "somebody could attach a hardware debugger and read your data out of RAM", because I just don't see that happening in any reasonable situation, there are too many obstacles to doing that with a _laptop_, the first of which is just that it's impossible to take the damn thing apart when it's on without disconnecting massive amounts of critical wiring.

No need to take anything apart if that laptop has a FireWire port on the outside. See Quinn's Firestarter that won best hack at MacHack 2002.

http://www.quinn.echidna.id.au/Quinn/WWW/Hacks.html#FireStarter

No need to crack the case at all. And it isn't a Mac-only issue - it's the way FireWire works.

#221 lore raw

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

Quoted 8 lines · On Feb 12, 2006, at 11:56, [email protected] wrote:
Quoted 1 line · Kyle Moffett

and X when sleeping? Don't you *dare* say "somebody could attach a hardware debugger and read your data out of RAM", because I just don't see that happening in any reasonable situation, there are too many obstacles to doing that with a _laptop_, the first of which is just that it's impossible to take the damn thing apart when it's on without disconnecting massive amounts of critical wiring.

No need to take anything apart if that laptop has a FireWire port on the outside. See Quinn's Firestarter that won best hack at MacHack 2002.

http://www.quinn.echidna.id.au/Quinn/WWW/Hacks.html#FireStarter

No need to crack the case at all. And it isn't a Mac-only issue - it's the way FireWire works.

/me reads spec. *sigh* Whatever idiocy-committee wrote that spec was clearly either smoking crack or living in a fantasy-world (or both). An arbitrary unrestricted DMA bus is a massive and painfully obvious security hole. Can somebody _please_ shoot the guy that came up with that brilliant idea? At least it looks like it's not available if the firewire modules aren't loaded, which means that you can prevent that sort of attack, and my laptop luckily doesn't load those modules at boot just to save a bit of memory. Even still, that's just a terrible idea. Is there any practical way to restrict DMA and make FireWire secure?

Cheers,
Kyle Moffett

--
I didn't say it would work as a defense, just that they can spin that out for years in court if it came to it.
-- Rob Landley

#222 lore raw

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

Quoted 8 lines · Kyle Moffett

/me reads spec. *sigh* Whatever idiocy-committee wrote that spec was clearly either smoking crack or living in a fantasy-world (or both). An arbitrary unrestricted DMA bus is a massive and painfully obvious security hole. Can somebody _please_ shoot the guy that came up with that brilliant idea? At least it looks like it's not available if the firewire modules aren't loaded, which means that you can prevent that sort of attack, and my laptop luckily doesn't load those modules at boot just to save a bit of memory.

might not help since your firmware turns on the firewire port to enable booting from firewire disks.

Quoted 3 lines

Even still, that's just a
terrible idea. Is there any practical way to restrict DMA and make FireWire secure?

load the modules with phys_dma=0

johannes

#223 lore raw

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

In reply to Kyle Moffett
Quoted 3 lines · Kyle Moffett

Don't you *dare* say "somebody could attach a
hardware debugger and read your data out of RAM", because I just don't see that happening in any reasonable situation,

takes me all of about two minutes with your firewire port.

johannes

#224 lore raw

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

In reply to Alon Bar-Lev

Hi!

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

And another fact: Suspend-to-RAM implementation can be derived form suspend-to-disk but not the other way around.

No, the two are _entirely_ independent. Suspend-to-RAM does not need to copy memory at all, whereas suspend-to-disk requires it. That very fact means that suspend-to-RAM is orders of magnitude faster than suspend-to-disk could ever be, especially as RAM gets exponentially larger.

Quoted 5 lines

Well... I see you already planned the implementation and have all figured out...
But the fact is that suspend-to-RAM can be implemented by suspend-to-disk without actually store the memory to external device...

No, it can not. See Doc*/power/video.txt . And there are more such problems.

Quoted 4 lines

Again... This is a matter of implementation... I believe that one complete suspend implementation can suite both disk and RAM... The only difference is if you write the state to external storage, and how you play with APM. So there is a

How you play with ACPI/hw is major issue. Look at code to learn what you are talking about. (and nobody uses APM today).

Quoted 3 lines

Let's see what happened so far:

First we had swsusp... For many people it did not work, so

...no; for many people it was too slow and not nice enough...

Quoted 2 lines

Suspend2 was developed, but was not merged mainly because it had too many UI components in-kernel.

...and because Nigel did not care about mainline for a *long* time.

Quoted 2 lines

Now, you come with a different solution (virtualization), so let's delay suspend feature for how long? At least two years?

Virtualization is separate topic. It could be used for s-t-disk, but it is quite heavy solution, and not likely to be usable for s-t-disk for 4+ years.

Quoted 8 lines

We need (and can get) suspend to work *NOW*, laptops are being more and more common... People expect to have this ability in a modern operating system, they don't care if it is implemented in kernel or in user-space, they also don't care if you change it along the way... And if in the future Linux will be pure virtual machine, all will be happy.... And use it... But please consider offering a working solution *NOW*.

We have working solution *NOW*. It is called swsusp. If it does not work for you, report it using bugzilla.kernel.org.

If you want something nicer/faster, help with suspend.sf.net.
Pavel

Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms         
#225 lore raw

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

Hi.

Quoted 8 lines · Pavel Machek
Quoted 1 line

First we had swsusp... For many people it did not work, so

...no; for many people it was too slow and not nice enough...

Quoted 2 lines

Suspend2 was developed, but was not merged mainly because it had too many UI components in-kernel.

...and because Nigel did not care about mainline for a *long* time.

Actually, it was more that I didn't want to try to merge something that was still very much work in progress. You didn't seem to be doing any development on what was merged, so I didn't foresee any problems with just replacing it once suspend(1|2|2.1|2.2) became mature. Patrick changed that, and then you did too. And I learnt about the "merge early, merge often" mantra late in the game. If I knew then what I know now... but I didn't.

Regards,

Nigel

#226 lore raw

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

In reply to Alon Bar-Lev
Quoted 9 lines · Alon Bar-Lev

Hello,

I don't understand how a fundamental (good) debate of how suspend to disk should be implemented in kernel, changed into this one.

I don't care what Linus said... Suspend-to-disk is more complicated than suspend-to-RAM. It is more complicated

And more useful in many cases... I'd just like to throw in here that when my battery has seven minutes left and I have a month's uptime... I suspend to disk. I also presume that many people do this as well.

Quoted 36 lines

since it provides more features. Suspend-to-RAM only stores state, where Suspend-to-disk need to store the state somewhere thus changing the initial state.

There is a long list of features available at
http://wiki.suspend2.net/FeatureUserRegister, which cannot be provided using suspend-to-RAM, examples:
1. Store state on files - this allow you to resume your machine into a different OS.
2. Encrypt state - this allow you to be sure that your data is stored encrypted. (Yes... You can encrypt the memory... but then you need a whole initramfs clone in order to allow the user to specify how he want to encrypt/decrypt).
3. Network resume - this allow you to resume a network machine (Not implemented yet, but cannot be done if suspend-to-RAM is the sole implementation).
4. Support desktops/servers - this allow you to suspend/resume hardware that is not designed to sleep, in order to minimize downtime on power failure.

And another fact: Suspend-to-RAM implementation can be derived form suspend-to-disk but not the other way around.

So let's invert the initial "fact"... Suspend-to-RAM is basically for people that don't need the full functionality of suspend-to-disk, after I got suspend-to-disk to work reliably here (suspend2), I *NEVER* use suspend-to-RAM.

Best Regards,
Alon Bar-Lev.
-
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/

Signature · 2 lines
--hackmiester
If you can read this, you don't need glasses.
#227 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

Good morning ;-).

Quoted 15 lines
Quoted 7 lines

At one point you said you'd like to work with us, and earlier in the threads you stated that porting suspend2 to userland should be easy.

[I do not think that putting suspend2 into git is useful thing to do. Of course, it is your option; but it seems to me that people likely to use suspend2 are not the kind of people that use git.]

Quoted 5 lines

It would be very helpful if you could install uswsusp, then try to make suspend2 run in userland on top of uswsusp interface. Not everything will be possible that way, but it most of features should be doable that way. I'd hate to code yet another splashscreen code, for example...

I've begun briefly to have a look at this.

Quoted 7 lines

Part of the problem I have, both with doing incremental patches for swsusp and with doing a userspace version, is that some of the fundamentals are redesigned in suspend2. The most important of these is that we store the metadata in bitmaps (for pageflags) and extents (for storage) instead of pbes. Do you have thoughts on how to overcome that issue? Are you willing, for example, to do work on switching swsusp to use a different method of storing its data?

Quoted 4 lines

Any changes to userspace are a fair game. OTOH kernel provides linear image to be saved to userspace, and what it uses internally should not be important to userland parts. (And Rafael did some changes in that area to make it more effective, IIRC).

What about providing the possibility of using the 2 pagesets I use at the moment? I'm not suggesting it should be compulsory, but perhaps an ioctl to say "I want to save a Suspend2 style image"?

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
#228 lore raw

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

Hi!

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

I've begun briefly to have a look at this.

Part of the problem I have, both with doing incremental patches for swsusp and with doing a userspace version, is that some of the fundamentals are redesigned in suspend2. The most important of these is that we store the metadata in bitmaps (for pageflags) and extents (for storage) instead of pbes. Do you have thoughts on how to overcome that issue? Are you willing, for example, to do work on switching swsusp to use a different method of storing its data?

Quoted 8 lines
Quoted 4 lines

Any changes to userspace are a fair game. OTOH kernel provides linear image to be saved to userspace, and what it uses internally should not be important to userland parts. (And Rafael did some changes in that area to make it more effective, IIRC).

What about providing the possibility of using the 2 pagesets I use at the moment? I'm not suggesting it should be compulsory, but perhaps an ioctl to say "I want to save a Suspend2 style image"?

I'd prefer to get the low-hanging fruits, first. LZF compression seems like a first target.

Of course, adding ioctl to do suspend2-style snapshot is possible, but I fear it will be too intrusive, and would prefer to do it after getting the simple stuff done.

Pavel

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

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

Quoted 2 lines · Pavel Machek

So another flamewar is over, good. I even received one apology ;-), and probably should have sent some apologies, too...

[...]

Quoted 8 lines

version. How you could help?

* testing is useful at this point. Few confirmations that it works in different configurations would make us feel warm and fuzzy.

* documentation improvements, and small scripts. Having script that prepares initrd would be nice, for example.

Quoted 7 lines

* having someone to maintain suspend.sf.net web pages / release CVS snapshot as package would help, too.

* userspace code improvements. Encryption, LZW and graphical progress should be reasonably easy to do. There's some tricky stuff, if you prefer -- support for swap files and normal files would help, too. Plus I guess everyone has their favourite feature...

That all makes sense.

To make uswsusp a success you need it tested [T], supporting scripts [S], someone [B] who puts work in the webpages [W] with decent documentation [D], and a bunch of spiffy features [F].

[T] * http://wiki.suspend2.net/FeatureUserRegister
* http://www.suspend2.net/lists
[S] http://www.suspend2.net/downloads/all/hibernate-script-1.12.tar.gz
[B] Bernard Blackham, [email protected]
[W] http://www.suspend2.net
[D] * http://www.suspend2.net/links
* http://www.suspend2.net/HOWTO
* http://www.suspend2.net/FAQ
[F] http://www.suspend2.net/features

I, as a contributors to suspend2, have been working on all that stuff for about two-and-a-half years, and it makes me really sad to see that someone in a position to make a decision towards progress wants to start that whole process all over, rather than acknowledging the existance of a technical superior solution - including a well-functioning supporting community - and working towards getting this solution available for a wider audience.

Judging from experience, uswsusp is probably two years away until it can even come close to what suspend2 offers right now, and that would be the ideal case of having a lot of people helping in the progress, involving being actively involved and dedicated to fixing problems.

Signature · 5 lines
sebas

 http://www.kde.nl | http://vizZzion.org |  GPG Key ID: 9119 0EF9 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Anything cut to length will be too short.
#230 lore raw

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

Quoted 36 lines · Sebastian Kügler
Quoted 2 lines · Pavel Machek

So another flamewar is over, good. I even received one apology ;-), and probably should have sent some apologies, too...

[...]

Quoted 8 lines

version. How you could help?

* testing is useful at this point. Few confirmations that it works in different configurations would make us feel warm and fuzzy.

* documentation improvements, and small scripts. Having script that prepares initrd would be nice, for example.

Quoted 7 lines

* having someone to maintain suspend.sf.net web pages / release CVS snapshot as package would help, too.

* userspace code improvements. Encryption, LZW and graphical progress should be reasonably easy to do. There's some tricky stuff, if you prefer -- support for swap files and normal files would help, too. Plus I guess everyone has their favourite feature...

That all makes sense.

To make uswsusp a success you need it tested [T], supporting scripts [S], someone [B] who puts work in the webpages [W] with decent documentation [D], and a bunch of spiffy features [F].

[T] * http://wiki.suspend2.net/FeatureUserRegister
* http://www.suspend2.net/lists
[S] http://www.suspend2.net/downloads/all/hibernate-script-1.12.tar.gz
[B] Bernard Blackham, [email protected]
[W] http://www.suspend2.net
[D] * http://www.suspend2.net/links
* http://www.suspend2.net/HOWTO
* http://www.suspend2.net/FAQ
[F] http://www.suspend2.net/features

Quoted 3 lines

I, as a contributors to suspend2, have been working on all that stuff for about two-and-a-half years, and it makes me really sad to see that someone in

If you think current situation makes me happy... think again.

Quoted 3 lines

a position to make a decision towards progress wants to start that whole process all over, rather than acknowledging the existance of a technical

We don't have to start all over. It should be possible to port most of suspend2 into userspace...
Pavel

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

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

In reply to Sebastian Kügler
Quoted 7 lines · Sebastian Kügler

I, as a contributors to suspend2, have been working on all that stuff for about two-and-a-half years, and it makes me really sad to see that someone in a position to make a decision towards progress wants to start that whole process all over, rather than acknowledging the existance of a technical superior solution - including a well-functioning supporting community - and working towards getting this solution available for a wider audience.

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.

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.

Quoted 4 lines

Judging from experience, uswsusp is probably two years away until it can even come close to what suspend2 offers right now, and that would be the ideal case of having a lot of people helping in the progress, involving being actively involved and dedicated to fixing problems.

I think similar. Much effort was put into getting Suspend 2 to work reliably and stable.

Some numbers: I have running Suspend 2 myself on three different systems with total different hardware. For over half a year I have not have had a single failure in suspending/resuming on any of the machines. With one machine I had around 70 suspend/resume cycles without a reboot, working with the machine for several hours a day, until I decided to update to a newer kernel last week (and it is still running fine).

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.

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_

The only con I see is the complexity of the code, but then again, Nigel did an incredible job in cleaning up. In the beginning (16 months ago) I had a lot of trouble in applying the Suspend 2 patches to the Fedora distribution kernel, but today (and for a long time now) the patches nearly apply instantly.

From my point of view I see no such great advantage in having suspend in userspace, but that does not mean it shouldn't be done. It might work in some time, that is ok, but in the mean time I really would consider in getting Suspend 2 mainline, because it works today, and I would agree with Sebastian that it will take its time to get uswsusp running.

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.

In my opinion having Suspend 2 in mainline now would be a great thing, as it would make suspend available for many more people today. In fact swsusp and Suspend 2 can happily coexist for some time, giving people the possibility to choose. After having both in mainline, efforts could be put in developing uswsusp and maybe deprecating the other suspend implementations one or two years later.

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, but I know that Nigel will help there happily) but concentrate on things which are just to begin, reinventing most of the wheel, and might take some more years to get it work reliably.

Regards,
Matthias

#232 lore raw

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

Hi!

Thanks for a fresh air in this flamewar...

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?

Quoted 6 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.

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.

Quoted 11 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_

swsusp is also available today, and works better than you think. It is slightly slower, but has all the other
features you listed in 2.6.16-rc3.

Quoted 1 line

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

..but thats a big con.

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...

Quoted 3 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...

Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms         
#233 lore raw

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

Hi.

Quoted 42 lines · Pavel Machek

Hi!

Thanks for a fresh air in this flamewar...

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?

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.

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.

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 3 lines

swsusp is also available today, and works better than you think. It is slightly slower, but has all the other
features you listed in 2.6.16-rc3.

It is a lot slower because it does all it's I/O synchronously, doesn't compress the image and throws away memory until at least half is free.

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.

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...

Pavel, you're very good at making general hand waving statements, but terrible at backing them up with facts, specifics or technical arguments. Could you please do some more of the later?

Quoted 8 lines
Quoted 3 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...

That's not true. I've taken time to look at what would be involved in making suspend2 match the changes you're doing, and I've decided it's just not worth the effort.

Let's be clear. uswsusp is not really moving suspend-to-disk to userspace. What it is doing is leaving everything but some code for writing the image in kernel space, and implementing ioctls to give a userspace program the ability to request that other processes be frozen, the snapshot prepared and so on. Pages in the snapshot are copied to userspace, possibly compressed or encrypted there in future, then fed back to kernel space so it can use the swap routines to do the writing. Very little of substance is being done in userspace. In short, all it's doing is adding the complexity of always requiring a userspace program, an initrd/ramfs, kernel routines to (1) export the snapshot to userspace (2) receive pages to be written, and (3) let userspace initiate the real work. It adds the complexity you complain about, but with no addition in functionality or usability.

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
#234 lore raw

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

Hi!

Quoted 7 lines
Quoted 3 lines

swsusp is also available today, and works better than you think. It is slightly slower, but has all the other
features you listed in 2.6.16-rc3.

It is a lot slower because it does all it's I/O synchronously, doesn't compress the image and throws away memory until at least half is free.

uswsusp does compress image (20% speedup, in recent CVS) and do asynchronous I/O.

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.

For what I'm planning, all the neccessary patches are already in -mm tree. And they are *really* simple. If you can get suspend2 to 1000 lines of code (like Rafael did with uswsusp), we can have something to talk about.

Quoted 13 lines
Quoted 8 lines
Quoted 3 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...

That's not true. I've taken time to look at what would be involved in making suspend2 match the changes you're doing, and I've decided it's just not worth the effort.

Quoted 8 lines

Let's be clear. uswsusp is not really moving suspend-to-disk to userspace. What it is doing is leaving everything but some code for writing the image in kernel space, and implementing ioctls to give a userspace program the ability to request that other processes be frozen, the snapshot prepared and so on. Pages in the snapshot are copied to userspace, possibly compressed or encrypted there in future, then fed back to kernel space so it can use the swap routines to do the writing. Very little of substance is being done in userspace. In short, all it's doing is adding the complexity of

Maybe very little of substance is being done in userspace, but all the uglyness can stay there. I no longer need LZF in kernel, special netlink API for progress bar (progress bar naturally lives in userland), no plugin infrastructure needed, etc.

If you can do suspend2 without putting stuff listed above into kernel, and in acceptable ammount of code... we can see. But you should really put suspend2 code into userspace, and be done with that. Feel free to spam l-k a bit more, but using existing infrastructure in -mm is right way to go, and it is easier, too.
Pavel

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

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

Hi.

Quoted 6 lines · Pavel Machek

Hi!

Quoted 4 lines
Quoted 3 lines

swsusp is also available today, and works better than you think. It is slightly slower, but has all the other
features you listed in 2.6.16-rc3.

Quoted 6 lines
Quoted 3 lines

It is a lot slower because it does all it's I/O synchronously, doesn't compress the image and throws away memory until at least half is free.

uswsusp does compress image (20% speedup, in recent CVS) and do asynchronous I/O.

Only 20? You must be doing something horribly wrong. Asynchronous I/O shoudl get the speed from whatever you're getting without it to the maximum the drive can handle. LZF should double the speed again on a CPU that's fast enough that the bottleneck is the disk.

Quoted 5 lines
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.

For what I'm planning, all the neccessary patches are already in -mm tree. And they are *really* simple. If you can get suspend2 to 1000 lines of code (like Rafael did with uswsusp), we can have something to talk about.

Turn it round the right way. If you can get the functionality of Suspend2 using userspace only, then we have something to talk about.

Quoted 24 lines
Quoted 14 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...

That's not true. I've taken time to look at what would be involved in making suspend2 match the changes you're doing, and I've decided it's just not worth the effort.

Quoted 9 lines

Let's be clear. uswsusp is not really moving suspend-to-disk to userspace. What it is doing is leaving everything but some code for writing the image in kernel space, and implementing ioctls to give a userspace program the ability to request that other processes be frozen, the snapshot prepared and so on. Pages in the snapshot are copied to userspace, possibly compressed or encrypted there in future, then fed back to kernel space so it can use the swap routines to do the writing. Very little of substance is being done in userspace. In short, all it's doing is adding the complexity of

Quoted 4 lines

Maybe very little of substance is being done in userspace, but all the uglyness can stay there. I no longer need LZF in kernel, special netlink API for progress bar (progress bar naturally lives in userland), no plugin infrastructure needed, etc.

And you do need?...

Quoted 5 lines

If you can do suspend2 without putting stuff listed above into kernel, and in acceptable ammount of code... we can see. But you should really put suspend2 code into userspace, and be done with that. Feel free to spam l-k a bit more, but using existing infrastructure in -mm is right way to go, and it is easier, too.

It is only easier because you're not comparing apples with apples. I have no desire to spam LKML with this pointless discussion, so I'm just going to get on with submitting patches for review.

Rgards,

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
#236 lore raw

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

Hi!

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

It is a lot slower because it does all it's I/O synchronously, doesn't compress the image and throws away memory until at least half is free.

uswsusp does compress image (20% speedup, in recent CVS) and do asynchronous I/O.

Only 20? You must be doing something horribly wrong. Asynchronous

20% is speedup for compression alone, over whole suspend process. Device suspend/resume takes lot of time in recent kernels.

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 7 lines
Quoted 4 lines

For what I'm planning, all the neccessary patches are already in -mm tree. And they are *really* simple. If you can get suspend2 to 1000 lines of code (like Rafael did with uswsusp), we can have something to talk about.

Turn it round the right way. If you can get the functionality of Suspend2 using userspace only, then we have something to talk about.

Only feature I can't do is "save whole pagecache"... and 14000 lines of code for _that_ is a bit too much. I could probably patch my kernel to dump pagecache to userspace, but I do not think it is worth the effort.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

Let's be clear. uswsusp is not really moving suspend-to-disk to userspace. What it is doing is leaving everything but some code for writing the image in kernel space, and implementing ioctls to give a userspace program the ability to request that other processes be frozen, the snapshot prepared and so on. Pages in the snapshot are copied to userspace, possibly compressed or encrypted there in future, then fed back to kernel space so it can use the swap routines to do the writing. Very little of substance is being done in userspace. In short, all it's doing is adding the complexity of

Quoted 6 lines
Quoted 4 lines

Maybe very little of substance is being done in userspace, but all the uglyness can stay there. I no longer need LZF in kernel, special netlink API for progress bar (progress bar naturally lives in userland), no plugin infrastructure needed, etc.

And you do need?...

I do not need anything more than what is already in -mm tree.

Quoted 9 lines
Quoted 5 lines

If you can do suspend2 without putting stuff listed above into kernel, and in acceptable ammount of code... we can see. But you should really put suspend2 code into userspace, and be done with that. Feel free to spam l-k a bit more, but using existing infrastructure in -mm is right way to go, and it is easier, too.

It is only easier because you're not comparing apples with apples. I have no desire to spam LKML with this pointless discussion, so I'm just going to get on with submitting patches for review.

So please take my comments from "suspend2 review" mail into account.

Pavel

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

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

Hi.

Quoted 6 lines · Pavel Machek

Hi!

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

It is a lot slower because it does all it's I/O synchronously, doesn't compress the image and throws away memory until at least half is free.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

uswsusp does compress image (20% speedup, in recent CVS) and do asynchronous I/O.

Only 20? You must be doing something horribly wrong. Asynchronous

20% is speedup for compression alone, over whole suspend process. Device suspend/resume takes lot of time in recent kernels.

Ok. I'm not counting device suspend/resume time, but if you do, the percentage will vary according to the image size (since the device suspend/resume time should be independant of image size).

Quoted 13 lines
Quoted 13 lines
Quoted 12 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.

For what I'm planning, all the neccessary patches are already in -mm tree. And they are *really* simple. If you can get suspend2 to 1000 lines of code (like Rafael did with uswsusp), we can have something to talk about.

Quoted 7 lines
Quoted 2 lines

Turn it round the right way. If you can get the functionality of Suspend2 using userspace only, then we have something to talk about.

Only feature I can't do is "save whole pagecache"... and 14000 lines of code for _that_ is a bit too much. I could probably patch my kernel to dump pagecache to userspace, but I do not think it is worth the effort.

Yes, 14,000 lines for that alone would be a bit too much :)

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

Let's be clear. uswsusp is not really moving suspend-to-disk to userspace. What it is doing is leaving everything but some code for writing the image in kernel space, and implementing ioctls to give a userspace program the ability to request that other processes be frozen, the snapshot prepared and so on. Pages in the snapshot are copied to userspace, possibly compressed or encrypted there in future, then fed back to kernel space so it can use the swap routines to do the writing. Very little of substance is being done in userspace. In short, all it's doing is adding the complexity of

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Maybe very little of substance is being done in userspace, but all the uglyness can stay there. I no longer need LZF in kernel, special netlink API for progress bar (progress bar naturally lives in userland), no plugin infrastructure needed, etc.

And you do need?...

I do not need anything more than what is already in -mm tree.

You misunderstand me. Let me reprhase. What additional dependencies do you have in userspace to support this? libabc, v >= x.y.z etc.

Quoted 11 lines
Quoted 9 lines
Quoted 5 lines

If you can do suspend2 without putting stuff listed above into kernel, and in acceptable ammount of code... we can see. But you should really put suspend2 code into userspace, and be done with that. Feel free to spam l-k a bit more, but using existing infrastructure in -mm is right way to go, and it is easier, too.

It is only easier because you're not comparing apples with apples. I have no desire to spam LKML with this pointless discussion, so I'm just going to get on with submitting patches for review.

So please take my comments from "suspend2 review" mail into account.

Am going, as I do with all responses. Please just remember that taking them into account doesn't equate to slavishly doing everything suggested.

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
#238 lore raw

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

Hi!

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 5 lines
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.

For what I'm planning, all the neccessary patches are already in -mm tree. And they are *really* simple. If you can get suspend2 to 1000 lines of code (like Rafael did with uswsusp), we can have something to talk about.

Turn it round the right way. If you can get the functionality of Suspend2 using userspace only, then we have something to talk about.

Quoted 6 lines
Quoted 4 lines

Only feature I can't do is "save whole pagecache"... and 14000 lines of code for _that_ is a bit too much. I could probably patch my kernel to dump pagecache to userspace, but I do not think it is worth the effort.

Yes, 14,000 lines for that alone would be a bit too much :)

Great we agree on that... because "save whole pagecache" is the only feature that is not possible with current uswsusp code.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

And you do need?...

I do not need anything more than what is already in -mm tree.

You misunderstand me. Let me reprhase. What additional dependencies do you have in userspace to support this? libabc, v >= x.y.z etc.

Currently it depends on libc, and optionaly at liblzf. We'll probably add libssl dependency later.

BUT NONE OF THIS MATTERS. suspend.sf.net is only one implementation, you are welcome to do different one. If we cared about userland dependencies, we could simply include all the libraries into suspend.sf.net's CVS.
Pavel

Signature · 1 line
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
#239 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

Only feature I can't do is "save whole pagecache"... and 14000 lines of code for _that_ is a bit too much. I could probably patch my kernel to dump pagecache to userspace, but I do not think it is worth the effort.

I do not think that Suspend 2 needs 14000 lines for that, the core is much smaller. But besides, _not_ saving the pagecache is a really _bad_ idea. I expect to have my system back after resume, in the same state I had left it prior to suspend. I really do not like it how it is done by Windows, it is just ugly to have a slowly responding system after resume, because all caches and buffers are gone.

I can only speak for myself, but I want to work with my system from the moment my desktop is back.

Regards,
Matthias

#240 lore raw

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

Quoted 6 lines · Matthias Hensler
Quoted 4 lines · Pavel Machek

Only feature I can't do is "save whole pagecache"... and 14000 lines of code for _that_ is a bit too much. I could probably patch my kernel to dump pagecache to userspace, but I do not think it is worth the effort.

Quoted 6 lines

I do not think that Suspend 2 needs 14000 lines for that, the core is much smaller. But besides, _not_ saving the pagecache is a really _bad_ idea. I expect to have my system back after resume, in the same state I had left it prior to suspend. I really do not like it how it is done by Windows, it is just ugly to have a slowly responding system after resume, because all caches and buffers are gone.

That's okay, swsusp already saves configurable ammount of pagecache.

Pavel

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

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

Hi.

Quoted 10 lines · Pavel Machek
Quoted 7 lines · Matthias Hensler

I do not think that Suspend 2 needs 14000 lines for that, the core is much smaller. But besides, _not_ saving the pagecache is a really _bad_ idea. I expect to have my system back after resume, in the same state I had left it prior to suspend. I really do not like it how it is done by Windows, it is just ugly to have a slowly responding system after resume, because all caches and buffers are gone.

That's okay, swsusp already saves configurable ammount of pagecache.

What about uswsusp?

Regards,
Matthias

#242 lore raw

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

Quoted 12 lines · Matthias Hensler

Hi.

Quoted 9 lines · Pavel Machek
Quoted 7 lines · Matthias Hensler

I do not think that Suspend 2 needs 14000 lines for that, the core is much smaller. But besides, _not_ saving the pagecache is a really _bad_ idea. I expect to have my system back after resume, in the same state I had left it prior to suspend. I really do not like it how it is done by Windows, it is just ugly to have a slowly responding system after resume, because all caches and buffers are gone.

Quoted 3 lines
Quoted 1 line

That's okay, swsusp already saves configurable ammount of pagecache.

What about uswsusp?

Same code is used for that.
Pavel

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

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
Quoted 6 lines · Matthias Hensler
Quoted 4 lines · Pavel Machek

Only feature I can't do is "save whole pagecache"... and 14000 lines of code for _that_ is a bit too much. I could probably patch my kernel to dump pagecache to userspace, but I do not think it is worth the effort.

Quoted 8 lines
Quoted 6 lines

I do not think that Suspend 2 needs 14000 lines for that, the core is much smaller. But besides, _not_ saving the pagecache is a really _bad_ idea. I expect to have my system back after resume, in the same state I had left it prior to suspend. I really do not like it how it is done by Windows, it is just ugly to have a slowly responding system after resume, because all caches and buffers are gone.

That's okay, swsusp already saves configurable ammount of pagecache.

Really? How is it configured?

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
#244 lore raw

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

Quoted 17 lines

Hi.

Quoted 14 lines · Pavel Machek
Quoted 12 lines · Matthias Hensler
Quoted 4 lines · Pavel Machek

Only feature I can't do is "save whole pagecache"... and 14000 lines of code for _that_ is a bit too much. I could probably patch my kernel to dump pagecache to userspace, but I do not think it is worth the effort.

I do not think that Suspend 2 needs 14000 lines for that, the core is much smaller. But besides, _not_ saving the pagecache is a really _bad_ idea. I expect to have my system back after resume, in the same state I had left it prior to suspend. I really do not like it how it is done by Windows, it is just ugly to have a slowly responding system after resume, because all caches and buffers are gone.

Quoted 3 lines
Quoted 1 line

That's okay, swsusp already saves configurable ammount of pagecache.

Really? How is it configured?

If you want to limit the suspend image size to N bytes, do

echo N > /sys/power/image_size

before suspend (it is limited to 500 MB by default).

Pavel

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

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

In reply to Matthias Hensler
Quoted 17 lines · Matthias Hensler

Hi.

Quoted 4 lines · Pavel Machek

Only feature I can't do is "save whole pagecache"... and 14000 lines of code for _that_ is a bit too much. I could probably patch my kernel to dump pagecache to userspace, but I do not think it is worth the effort.

I do not think that Suspend 2 needs 14000 lines for that, the core is much smaller. But besides, _not_ saving the pagecache is a really _bad_ idea. I expect to have my system back after resume, in the same state I had left it prior to suspend. I really do not like it how it is done by Windows, it is just ugly to have a slowly responding system after resume, because all caches and buffers are gone.

Quoted 2 lines

I can only speak for myself, but I want to work with my system from the moment my desktop is back.

I Am Not A VM Hacker, but:

What's the point of saving pagecache during suspend? This seems like a total waste. Why don't we save a list of pages in pagecache to disk, then, after resume, prefetch them all back in. This will slow down resume (extra seeks, minimized if we sort the list, and inability to compress these pages), but it will speed up suspend, and it sounds
a lot simpler. There's already a patch to add swap prefetching, and this can't be much more complicated.

While I'm at it, here's another pie-in-the-sky idea. If we had the ability to unmount an in-use filesystem (that lack is my single biggest pet peeve about Linux right now -- Windows has been able to do this for ages), then the process could be:
1. Atomic snapshot of userspace. Snapshot all struct file's as well.
2. Unmount local filesystems. Network filesystems probably can't be trashed by buggy suspend anyway.
3. Snapshot kernelspace.
4. Suspend happily without worrying about hosing filesystems, since they're all unmounted.
5. For extra safety, unmount anything that the suspend process mounted.

-- Shutdown and restart --

6. Mount stuff and load the image, then unmount it (again using the in-use FS unmounting).
7. Restore the image and resume kernelspace.
8. Remount local filesystems and reattach all the struct files.
9. Resume userspace. Start prefetching everything.

This would seem to allow an ordinary program to handle image writing with no particular worries about disk access, except that unlinking files might confuse userspace (but not the FS) on resume.

Feel free to tell me why this is impossible. If no one tells me it's impossible, I may work on unmounting in-use filesystems and revoking fd's in a month when I have more free time.

--Andy

#246 lore raw

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

Hi Andy.

Quoted 21 lines · Andy Lutomirski
Quoted 15 lines · Matthias Hensler

Hi.

Quoted 4 lines · Pavel Machek

Only feature I can't do is "save whole pagecache"... and 14000 lines of code for _that_ is a bit too much. I could probably patch my kernel to dump pagecache to userspace, but I do not think it is worth the effort.

I do not think that Suspend 2 needs 14000 lines for that, the core is much smaller. But besides, _not_ saving the pagecache is a really _bad_ idea. I expect to have my system back after resume, in the same state I had left it prior to suspend. I really do not like it how it is done by Windows, it is just ugly to have a slowly responding system after resume, because all caches and buffers are gone.

Quoted 2 lines

I can only speak for myself, but I want to work with my system from the moment my desktop is back.

I Am Not A VM Hacker, but:

Quoted 7 lines

What's the point of saving pagecache during suspend? This seems like a total waste. Why don't we save a list of pages in pagecache to disk, then, after resume, prefetch them all back in. This will slow down resume (extra seeks, minimized if we sort the list, and inability to compress these pages), but it will speed up suspend, and it sounds a lot simpler. There's already a patch to add swap prefetching, and this can't be much more complicated.

The page cache contains the process pages, among other things, so it can't all be discarded with impunity. You're right in suggesting that discarding them and then prefetching them would be a potential alternative, but it would actually be more complicated: you'd still have to remember which pages you wanted to fault back in, and some how store that info in the image. You'd also have to add code to do the faulting. Right now, we don't (for the most part) care what a page is used for - we just save and reload it. I believe both implementations give you the option to set a soft upper limit on the size of the image, so you can still throw away cache if you want to.

Quoted 20 lines

While I'm at it, here's another pie-in-the-sky idea. If we had the ability to unmount an in-use filesystem (that lack is my single biggest pet peeve about Linux right now -- Windows has been able to do this for ages), then the process could be:
1. Atomic snapshot of userspace. Snapshot all struct file's as well.
2. Unmount local filesystems. Network filesystems probably can't be trashed by buggy suspend anyway.
3. Snapshot kernelspace.
4. Suspend happily without worrying about hosing filesystems, since they're all unmounted.
5. For extra safety, unmount anything that the suspend process mounted.

-- Shutdown and restart --

6. Mount stuff and load the image, then unmount it (again using the in-use FS unmounting).
7. Restore the image and resume kernelspace.
8. Remount local filesystems and reattach all the struct files.
9. Resume userspace. Start prefetching everything.

Quoted 7 lines

This would seem to allow an ordinary program to handle image writing with no particular worries about disk access, except that unlinking files might confuse userspace (but not the FS) on resume.

Feel free to tell me why this is impossible. If no one tells me it's impossible, I may work on unmounting in-use filesystems and revoking fd's in a month when I have more free time.

It's not quite unmounting, but Suspend2 already freezes bdevs as part of the process of quiescing the system. This was the only way I could find to make XFS really complete pending I/O (and stop further submissions).

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
#247 lore raw

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

Hi!

Quoted 13 lines
Quoted 5 lines
Quoted 2 lines

I can only speak for myself, but I want to work with my system from the moment my desktop is back.

I Am Not A VM Hacker, but:

Quoted 7 lines

What's the point of saving pagecache during suspend? This seems like a total waste. Why don't we save a list of pages in pagecache to disk, then, after resume, prefetch them all back in. This will slow down resume (extra seeks, minimized if we sort the list, and inability to compress these pages), but it will speed up suspend, and it sounds a lot simpler. There's already a patch to add swap prefetching, and this can't be much more complicated.

Quoted 3 lines

The page cache contains the process pages, among other things, so it can't all be discarded with impunity. You're right in suggesting that discarding them

Well, we already have perfectly good code to free pagecache.

Quoted 4 lines

and then prefetching them would be a potential alternative, but it would actually be more complicated: you'd still have to remember which pages you wanted to fault back in, and some how store that info in the image. You'd

That's okay. Imagine

"cat /proc/vm/pagecache-contents > /tmp/delme" just before suspend and "cat /tmp/delme | prefetcher" just after it. Prefetcher is actually simple app that reads specified pages, then discards them. It can actually be done in userspace around regular swsusp/uswsusp/suspend2 with no impact on it.

Pavel

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

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

In reply to Andy Lutomirski
Quoted 23 lines · Andy Lutomirski
Quoted 17 lines · Matthias Hensler

Hi.

Quoted 4 lines · Pavel Machek

Only feature I can't do is "save whole pagecache"... and 14000 lines of code for _that_ is a bit too much. I could probably patch my kernel to dump pagecache to userspace, but I do not think it is worth the effort.

I do not think that Suspend 2 needs 14000 lines for that, the core is much smaller. But besides, _not_ saving the pagecache is a really _bad_ idea. I expect to have my system back after resume, in the same state I had left it prior to suspend. I really do not like it how it is done by Windows, it is just ugly to have a slowly responding system after resume, because all caches and buffers are gone.

Quoted 2 lines

I can only speak for myself, but I want to work with my system from the moment my desktop is back.

I Am Not A VM Hacker, but:

Quoted 7 lines

What's the point of saving pagecache during suspend? This seems like a total waste. Why don't we save a list of pages in pagecache to disk, then, after resume, prefetch them all back in. This will slow down resume (extra seeks, minimized if we sort the list, and inability to compress these pages), but it will speed up suspend, and it sounds a lot simpler. There's already a patch to add swap prefetching, and this can't be much more complicated.

I'd actually love to see this implemented. It would be useful for suspend-to-disk (obviously), but also for benchmarks.

Quoted 1 line

While I'm at it, here's another pie-in-the-sky idea. If we had the

Yes, that's quite far in the sky :-).
Pavel

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

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

Hi,

Quoted 30 lines · Pavel Machek
Quoted 21 lines · Andy Lutomirski
Quoted 15 lines · Matthias Hensler
Quoted 4 lines · Pavel Machek

Only feature I can't do is "save whole pagecache"... and 14000 lines of code for _that_ is a bit too much. I could probably patch my kernel to dump pagecache to userspace, but I do not think it is worth the effort.

I do not think that Suspend 2 needs 14000 lines for that, the core is much smaller. But besides, _not_ saving the pagecache is a really _bad_ idea. I expect to have my system back after resume, in the same state I had left it prior to suspend. I really do not like it how it is done by Windows, it is just ugly to have a slowly responding system after resume, because all caches and buffers are gone.

Quoted 2 lines

I can only speak for myself, but I want to work with my system from the moment my desktop is back.

I Am Not A VM Hacker, but:

Quoted 7 lines

What's the point of saving pagecache during suspend? This seems like a total waste. Why don't we save a list of pages in pagecache to disk, then, after resume, prefetch them all back in. This will slow down resume (extra seeks, minimized if we sort the list, and inability to compress these pages), but it will speed up suspend, and it sounds a lot simpler. There's already a patch to add swap prefetching, and this can't be much more complicated.

Quoted 2 lines

I'd actually love to see this implemented. It would be useful for suspend-to-disk (obviously), but also for benchmarks.

Actually I've been thinking of something similar for some time, so perhaps we should add this to the todolist somewhere? ;-)

Rafael

#250 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

Maybe very little of substance is being done in userspace, but all the uglyness can stay there. I no longer need LZF in kernel, special netlink API for progress bar (progress bar naturally lives in userland), no plugin infrastructure needed, etc.

Linux has a whole crypto API in the kernel, so why is it a problem to have LZF there too?

About the progress bar: this is already implemented in userspace, the kernel just forwards the progress via netlink to it. Not necessarily ugly I think.

Regards,
Matthias

#251 lore raw

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

Quoted 10 lines · Matthias Hensler

Hi.

Quoted 4 lines · Pavel Machek

Maybe very little of substance is being done in userspace, but all the uglyness can stay there. I no longer need LZF in kernel, special netlink API for progress bar (progress bar naturally lives in userland), no plugin infrastructure needed, etc.

Linux has a whole crypto API in the kernel, so why is it a problem to have LZF there too?

Because it is not needed there?

Quoted 3 lines

About the progress bar: this is already implemented in userspace, the kernel just forwards the progress via netlink to it. Not necessarily ugly I think.

Look at the code.
Pavel

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

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

Hi.

Quoted 5 lines · Pavel Machek
Quoted 2 lines · Matthias Hensler

Linux has a whole crypto API in the kernel, so why is it a problem to have LZF there too?

Because it is not needed there?

Hmmm, I think it makes totally sense there. While it is useful in the suspend case, it would also be useful to the current implementation that use the crypto API. Think about creating a compressed volume with cryptoloop of dm-crypt.

Quoted 5 lines
Quoted 3 lines

About the progress bar: this is already implemented in userspace, the kernel just forwards the progress via netlink to it. Not necessarily ugly I think.

Look at the code.

OK, could you point me to the ugly thinks. I see message passing between the userspace application and the kernel, for which I think that netlink is a good choice.

What has to be done to make the code not ugly? Is there a way to fix it to become acceptable?

Regards,
Matthias

#253 lore raw

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

Quoted 11 lines · Matthias Hensler
Quoted 6 lines · Pavel Machek
Quoted 3 lines · Matthias Hensler

About the progress bar: this is already implemented in userspace, the kernel just forwards the progress via netlink to it. Not necessarily ugly I think.

Look at the code.

OK, could you point me to the ugly thinks. I see message passing between the userspace application and the kernel, for which I think that netlink is a good choice.

See my comments in "suspend2 review" thread.
Pavel

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

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

Hi.

Quoted 6 lines · Pavel Machek
Quoted 3 lines · Matthias Hensler

OK, could you point me to the ugly thinks. I see message passing between the userspace application and the kernel, for which I think that netlink is a good choice.

See my comments in "suspend2 review" thread.

Yes, I read it. Nigel already replied and pointed out that a lot of things were already fixed and will now be. So the effort to make the patch acceptable is there.

However, about the User-UI stuff and some things that are implemented in the kernel, I have to disagree with you. Suspend 2 happily works without having the userspace UI, which is a good thing as it allows a minimal setup and a small initrd.

But besides the progress bar I think that some parts have to be in the kernel, such as the warnings and keyevents to abort the progress. If, for whatever reason, something goes wrong, you should be able to stop and abort before doing any damage. If all these things are implemented in userspace, you need to have a binary in your initrd on the right place, where is should work without that.

Regards,
Matthias

#255 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 · Pavel Machek
Quoted 3 lines · Matthias Hensler

OK, could you point me to the ugly thinks. I see message passing between the userspace application and the kernel, for which I think that netlink is a good choice.

Quoted 5 lines
Quoted 1 line

See my comments in "suspend2 review" thread.

Yes, I read it. Nigel already replied and pointed out that a lot of things were already fixed and will now be. So the effort to make the patch acceptable is there.

Yep, Nigel fixes typo every time I show him one. That only shows how old his code is, and how little review it got.

That's not making patch acceptable. His patch still duplicates lots of kernel code, and puts code into kernelspace that can be done userspace as well.

If you want to merge some code in kernelspace, you should do it in small pieces, and should understand what existing code does. Nigel does not care what existing code does. If swsusp contained problem 2 years ago, but mainline fixed it, Nigel still includes his workarounds. (See his bitmap stuff). That's not the way to go.
Pavel

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