Skip to contentSkip to conversation

pm: Revert swsusp to 2.6.0-test3 state

PATCH Pavel Machek 2 participants 3 messages Sep 27, 2003 – Sep 28, 2003

lore
Share & tools
lore
#0 lore raw

Hi!

Patrick said he applied "revert" changes to his tree, but I can see nothing in the mainline. This reverts swsusp to "-test3" state, and makes it work here (*). Please apply,
Pavel

(*) Well, it suspends-to-disk correctly, then crashes during powerdown, but image on disk is already intact so you can resume. I suspect driver problem, will chase it now.

Index: include/linux/suspend.h
===================================================================
RCS file: /home/pavel/sf/bitbucket/bkcvs/linux-2.5/include/linux/suspend.h,v retrieving revision 1.18

linux/suspend.h +37 -2
diff -u -u -r1.18 suspend.h
@@ -8,7 +8,11 @@
 #include <linux/notifier.h>
 #include <linux/config.h>
 #include <linux/init.h>
-#include <linux/pm.h>
+
+extern unsigned char software_suspend_enabled;
+
+#define NORESUME	 1
+#define RESUME_SPECIFIED 2
 
 #ifdef CONFIG_SOFTWARE_SUSPEND
 /* page backup entry */
@@ -45,30 +49,61 @@
 /* mm/page_alloc.c */
 extern void drain_local_pages(void);
 
+/* kernel/suspend.c */
+extern void software_suspend(void);
+extern void software_resume(void);
+
+extern int register_suspend_notifier(struct notifier_block *);
+extern int unregister_suspend_notifier(struct notifier_block *);
+
 extern unsigned int nr_copy_pages __nosavedata;
 extern suspend_pagedir_t *pagedir_nosave __nosavedata;
 
+/* Communication between kernel/suspend.c and arch/i386/suspend.c */
+
+extern void do_magic_resume_1(void);
+extern void do_magic_resume_2(void);
+extern void do_magic_suspend_1(void);
+extern void do_magic_suspend_2(void);
+
 /* Communication between acpi and arch/i386/suspend.c */
 
 extern void do_suspend_lowlevel(int resume);
 extern void do_suspend_lowlevel_s4bios(int resume);
 
 #else	/* CONFIG_SOFTWARE_SUSPEND */
-static inline int software_suspend(void)
+static inline void software_suspend(void)
 {
+	printk("Warning: fake suspend called\n");
 	return -EPERM;
 }
+#define software_resume()		do { } while(0)
+#define register_suspend_notifier(a)	do { } while(0)
+#define unregister_suspend_notifier(a)	do { } while(0)
 #endif	/* CONFIG_SOFTWARE_SUSPEND */
 
 
 #ifdef CONFIG_PM
 extern void refrigerator(unsigned long);
+extern int freeze_processes(void);
+extern void thaw_processes(void);
+
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
 
 #else
 static inline void refrigerator(unsigned long flag)
 {
 
 }
+static inline int freeze_processes(void)
+{
+	return 0;
+}
+static inline void thaw_processes(void)
+{
+
+}
 #endif	/* CONFIG_PM */
 
 #endif /* _LINUX_SWSUSP_H */

Index: kernel/sys.c
===================================================================
RCS file: /home/pavel/sf/bitbucket/bkcvs/linux-2.5/kernel/sys.c,v retrieving revision 1.60

sys.c +5 -2
diff -u -u -r1.60 sys.c
@@ -456,8 +456,11 @@
 
 #ifdef CONFIG_SOFTWARE_SUSPEND
 	case LINUX_REBOOT_CMD_SW_SUSPEND:
-		if (!pm_suspend(PM_SUSPEND_DISK))
-			break;
+		if (!software_suspend_enabled) {
+			unlock_kernel();
+			return -EAGAIN;
+		}
+		software_suspend();
 		do_exit(0);
 		break;
 #endif

Index: kernel/power/main.c
===================================================================
RCS file: /home/pavel/sf/bitbucket/bkcvs/linux-2.5/kernel/power/main.c,v retrieving revision 1.3

power/main.c +4 -0
diff -u -u -r1.3 main.c
@@ -183,6 +183,7 @@
 
 	pr_debug("PM: snapshotting memory.\n");
 	in_suspend = 1;
+#if 0
 	if ((error = swsusp_save()))
 		goto Done;
 
@@ -195,6 +196,7 @@
 	} else
 		pr_debug("PM: Image restored successfully.\n");
 	swsusp_free();
+#endif
  Done:
 	return error;
 }
@@ -356,6 +358,7 @@
 
 	pr_debug("PM: Reading swsusp image.\n");
 
+#if 0
 	if ((error = swsusp_read()))
 		goto Done;
 
@@ -371,6 +374,7 @@
 	suspend_finish(PM_SUSPEND_DISK);
  Free:
 	swsusp_free();
+#endif
  Done:
 	pr_debug("PM: Resume from disk failed.\n");
 	return 0;

Index: kernel/power/swsusp.c
===================================================================
RCS file: /home/pavel/sf/bitbucket/bkcvs/linux-2.5/kernel/power/swsusp.c,v retrieving revision 1.4

power/swsusp.c +322 -109

610 lines not on this page · raw message

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#1 lore raw
Quoted 4 lines · Pavel Machek

Patrick said he applied "revert" changes to his tree, but I can see nothing in the mainline. This reverts swsusp to "-test3" state, and makes it work here (*). Please apply,

No.

I'm not going to apply warring patches. You two sort it out amonst yourselves, I just don't care to be left in the middle.

And yes, Pavel, that means you have to be civil. I was actually surprised at how civil Pat was the last time around considering that there was a longish thread where the subject was pretty negative about him.

Please.

Linus

#2 lore raw

Hi!

[Longer reply this time].

Quoted 8 lines
Quoted 3 lines

Patrick said he applied "revert" changes to his tree, but I can see nothing in the mainline. This reverts swsusp to "-test3" state, and makes it work here (*). Please apply,

No.

I'm not going to apply warring patches. You two sort it out amonst yourselves, I just don't care to be left in the middle.

I'm not playing patch wars, Patrick actually has very similar patch in his tree already -- test5-pm2 contains kernel/sys.c and kernel/power/swsusp.c changes; it does not contain include/linux/suspend.h changes -- I'm not sure if that's mistake or if prototypes were moved to some better place, and it does not contain kernel/power/main.c changes -- main.c is pretty much rewritten in test5-pm2 AFAICS so those changes do not apply.

Quoted 3 lines

And yes, Pavel, that means you have to be civil. I was actually surprised at how civil Pat was the last time around considering that there was a longish thread where the subject was pretty negative about him.

I hope to hear some comments from Patrick. He merged the code, but does not seem to be pushing the changes. I'd like to have something at least partly working in -test6.
Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]