Skip to contentSkip to conversation

swsusp updates

PATCH Pavel Machek 2 participants 9 messages Jul 26, 2003

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

Hi!

This updates swsusp: CONFIG_SOFTWARE_SUSPEND and CONFIG_ACPI_SLEEP are separated (it was getting users *badly* confused), remove too noisy printk's, correctly restore console after S3, fixes suspend on machines using yenta_socket.c, fixes some comments, cleans up "interesting" macro mess in suspend.c, no longer eats filesystems when process is ^Z-ed before suspend. Please apply,

Pavel

drivers/acpi/sleep/main.c +3 -5
Index: linux/drivers/acpi/sleep/main.c
===================================================================
@@ -69,10 +81,6 @@
  * First, we call to the device driver layer to save device state.
  * Once we have that, we save whatevery processor and kernel state we
  * need to memory.
- * If we're entering S4, we then write the memory image to disk.
- *
- * Only then is it safe for us to power down devices, since we may need
- * the disks and upstream buses to write to.
  */
 acpi_status
 acpi_system_save_state(
@@ -197,7 +205,7 @@
 		break;
 	}
 	local_irq_restore(flags);
-	printk(KERN_CRIT "Back to C!\n");
+	printk(KERN_DEBUG "Back to C!\n");
 
 	return status;
 }
@@ -226,6 +234,7 @@
 	if (state == ACPI_STATE_S4 && !acpi_gbl_FACS->S4bios_f)
 		return AE_ERROR;
 
+	prepare_suspend_console();
 	/*
 	 * TBD: S1 can be done without device_suspend.  Make a CONFIG_XX
 	 * to handle however when S1 failed without device_suspend.
@@ -270,6 +279,7 @@
 	/* reset firmware waking vector */
 	acpi_set_firmware_waking_vector((acpi_physical_address) 0);
 	thaw_processes();
+	restore_console();
 
 	return status;
 }
arch/i386/kernel/Makefile +2 -1
Index: linux/arch/i386/kernel/Makefile
===================================================================
@@ -24,7 +24,8 @@
 obj-$(CONFIG_X86_MPPARSE)	+= mpparse.o
 obj-$(CONFIG_X86_LOCAL_APIC)	+= apic.o nmi.o
 obj-$(CONFIG_X86_IO_APIC)	+= io_apic.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend.o suspend_asm.o
+obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend.o
+obj-$(CONFIG_PM)		+= suspend_asm.o
 obj-$(CONFIG_X86_NUMAQ)		+= numaq.o
 obj-$(CONFIG_X86_SUMMIT)	+= summit.o
 obj-$(CONFIG_EDD)             	+= edd.o
arch/i386/kernel/suspend_asm.S +2 -1
Index: linux/arch/i386/kernel/suspend_asm.S
===================================================================
@@ -32,6 +32,7 @@
 saved_context_eflags:
 	.long	0
 
+#ifdef CONFIG_SOFTWARE_SUSPEND
 	.text
 
 ENTRY(do_magic)
@@ -117,4 +118,4 @@
 loop2:
        .quad 0
        .previous
-	
\ No newline at end of file
+#endif
arch/i386/kernel/sysenter.c +0 -2
Index: linux/arch/i386/kernel/sysenter.c
===================================================================
@@ -31,8 +31,6 @@
 	wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
 	wrmsr(MSR_IA32_SYSENTER_ESP, tss->esp1, 0);
 	wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) sysenter_entry, 0);
-
-	printk("Enabling SEP on CPU %d\n", cpu);
 	put_cpu();	
 }
 
drivers/acpi/Kconfig +2 -2
Index: linux/drivers/acpi/Kconfig
===================================================================
@@ -58,8 +58,8 @@
 	default y
 
 config ACPI_SLEEP
-	bool "Sleep States"
-	depends on X86 && ACPI && !ACPI_HT_ONLY && SOFTWARE_SUSPEND
+	bool "Sleep States (EXPERIMENTAL)"
+	depends on X86 && ACPI && !ACPI_HT_ONLY && EXPERIMENTAL
 	---help---
 	  This option adds support for ACPI suspend states. 
 
drivers/base/power.c +0 -6
Index: linux/drivers/base/power.c
===================================================================
@@ -52,8 +52,6 @@
 	struct device * dev;
 	int error = 0;
 
-	printk(KERN_EMERG "Suspending devices\n");
-
 	down_write(&devices_subsys.rwsem);
 	list_for_each_entry_reverse(dev,&devices_subsys.kset.list,kobj.entry) {
 		if (dev->driver && dev->driver->suspend) {
@@ -114,8 +112,6 @@
 		}
 	}
 	up_write(&devices_subsys.rwsem);
-
-	printk(KERN_EMERG "Devices Resumed\n");
 }
 
 /**
@@ -125,8 +121,6 @@
 {
 	struct device * dev;
 	
-	printk(KERN_EMERG "Shutting down devices\n");
-
 	down_write(&devices_subsys.rwsem);
 	list_for_each_entry_reverse(dev,&devices_subsys.kset.list,kobj.entry) {
 		pr_debug("shutting down %s: ",dev->name);
drivers/pcmcia/yenta_socket.c +4 -1
Index: linux/drivers/pcmcia/yenta_socket.c
===================================================================
@@ -899,7 +899,10 @@
 
 static int yenta_dev_suspend (struct pci_dev *dev, u32 state)
 {
-	return pcmcia_socket_dev_suspend(&dev->dev, state, 0);
+	/* FIXME: We should really let devices to act on *all* levels :-(.
+	   If you put something else than SUSPEND_SAVE_STATE,
+	   pcmcia_socket_dev_suspend() will simply do nothing due to its check. */
+	return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
 }
 
 
include/linux/reboot.h +1 -1
Index: linux/include/linux/reboot.h
===================================================================
@@ -21,7 +21,7 @@
  * CAD_OFF     Ctrl-Alt-Del sequence sends SIGINT to init task.
  * POWER_OFF   Stop OS and remove all power from system, if possible.
  * RESTART2    Restart system using given command string.
- * SW_SUSPEND  Suspend system using Software Suspend if compiled in
+ * SW_SUSPEND  Suspend system using software suspend if compiled in.
  */
 
 #define	LINUX_REBOOT_CMD_RESTART	0x01234567
include/linux/suspend.h +11 -7
Index: linux/include/linux/suspend.h
===================================================================
@@ -55,10 +55,6 @@
 
 extern int register_suspend_notifier(struct notifier_block *);
 extern int unregister_suspend_notifier(struct notifier_block *);
-extern void refrigerator(unsigned long);
-
-extern int freeze_processes(void);
-extern void thaw_processes(void);
 
 extern unsigned int nr_copy_pages __nosavedata;
 extern suspend_pagedir_t *pagedir_nosave __nosavedata;
@@ -76,15 +72,23 @@
 extern void do_suspend_lowlevel_s4bios(int resume);
 
 #else
-static inline void software_suspend(void)
-{
-}
+static inline void software_suspend(void) { }
 #define software_resume()		do { } while(0)
 #define register_suspend_notifier(a)	do { } while(0)
 #define unregister_suspend_notifier(a)	do { } while(0)
+#endif
+
+#ifdef CONFIG_PM
+extern void refrigerator(unsigned long);
+extern int freeze_processes(void);
+extern void thaw_processes(void);
+#else
 #define refrigerator(a)			do { BUG(); } while(0)
 #define freeze_processes()		do { panic("You need CONFIG_SOFTWARE_SUSPEND to do sleeps."); } while(0)
 #define thaw_processes()		do { } while(0)
 #endif
 
+extern int prepare_suspend_console(void);
+extern void restore_console(void);
+
 #endif /* _LINUX_SWSUSP_H */
kernel/Makefile +1 -1
Index: linux/kernel/Makefile
===================================================================
@@ -17,7 +17,7 @@
 obj-$(CONFIG_PM) += pm.o
 obj-$(CONFIG_CPU_FREQ) += cpufreq.o
 obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
-obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend.o
+obj-$(CONFIG_PM) += suspend.o
 obj-$(CONFIG_COMPAT) += compat.o
 
 ifneq ($(CONFIG_IA64),y)
kernel/suspend.c +74 -81

274 lines not on this page · raw message

arch/i386/kernel/acpi/wakeup.S +5 -0
Index: linux/arch/i386/kernel/acpi/wakeup.S
===================================================================
@@ -43,6 +43,11 @@
 
 	testl	$1, video_flags - wakeup_code
 	jz	1f
+	/* It is miracle that this works:
+	   * PCI may or may not be initialized at this point
+	   * I'm told we should pass device ID to video bios
+	   However it works on some real machines...
+	 */
 	lcall   $0xc000,$3
 	movw	%cs, %ax
 	movw	%ax, %ds					# Bios might have played with that
Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#1 lore raw
Quoted 7 lines

This updates swsusp: CONFIG_SOFTWARE_SUSPEND and CONFIG_ACPI_SLEEP are separated (it was getting users *badly* confused), remove too noisy printk's, correctly restore console after S3, fixes suspend on machines using yenta_socket.c, fixes some comments, cleans up "interesting" macro mess in suspend.c, no longer eats filesystems when process is ^Z-ed before suspend. Please apply,

Could you please split these patches up into different functional patches, and submit them to the appropriate maintainers?

-pat

#2 lore raw

Hi!

Quoted 9 lines
Quoted 6 lines

This updates swsusp: CONFIG_SOFTWARE_SUSPEND and CONFIG_ACPI_SLEEP are separated (it was getting users *badly* confused), remove too noisy printk's, correctly restore console after S3, fixes suspend on machines using yenta_socket.c, fixes some comments, cleans up "interesting" macro mess in suspend.c, no longer eats filesystems when process is ^Z-ed before suspend. Please apply,

Could you please split these patches up into different functional patches, and submit them to the appropriate maintainers?

SOFTWARE SUSPEND:

P:      Pavel Machek
M:      [email protected]
M:      [email protected]
L:      http://lister.fornax.hu/mailman/listinfo/swsusp
W:      http://swsusp.sf.net/
S:      Maintained

Other parts are trivial (ACPI and yenta), and pretty obvious.
Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#3 lore raw
Quoted 12 lines
Quoted 10 lines
Quoted 7 lines

This updates swsusp: CONFIG_SOFTWARE_SUSPEND and CONFIG_ACPI_SLEEP are separated (it was getting users *badly* confused), remove too noisy printk's, correctly restore console after S3, fixes suspend on machines using yenta_socket.c, fixes some comments, cleans up "interesting" macro mess in suspend.c, no longer eats filesystems when process is ^Z-ed before suspend. Please apply,

Could you please split these patches up into different functional patches, and submit them to the appropriate maintainers?

SOFTWARE SUSPEND:

Quoted 8 lines
P:      Pavel Machek
M:      [email protected]
M:      [email protected]
L:      http://lister.fornax.hu/mailman/listinfo/swsusp
W:      http://swsusp.sf.net/
S:      Maintained

Other parts are trivial (ACPI and yenta), and pretty obvious.

Could you please split these patches up into different functional patches and submit the relevant bits to the appropriate maintainers?

Thanks,

-pat

#4 lore raw

Hi!

Quoted 18 lines
Quoted 18 lines
Quoted 9 lines
Quoted 6 lines

This updates swsusp: CONFIG_SOFTWARE_SUSPEND and CONFIG_ACPI_SLEEP are separated (it was getting users *badly* confused), remove too noisy printk's, correctly restore console after S3, fixes suspend on machines using yenta_socket.c, fixes some comments, cleans up "interesting" macro mess in suspend.c, no longer eats filesystems when process is ^Z-ed before suspend. Please apply,

Could you please split these patches up into different functional patches, and submit them to the appropriate maintainers?

SOFTWARE SUSPEND:

P:      Pavel Machek
M:      [email protected]
M:      [email protected]
L:      http://lister.fornax.hu/mailman/listinfo/swsusp
W:      http://swsusp.sf.net/
S:      Maintained
Quoted 4 lines
Quoted 1 line

Other parts are trivial (ACPI and yenta), and pretty obvious.

Could you please split these patches up into different functional patches and submit the relevant bits to the appropriate maintainers?

Okay, I killed few trivial hunks, will submit them through trivial patch monkey. Are you happy now, patrick?
Pavel

arch/i386/kernel/Makefile +2 -1
Index: linux/arch/i386/kernel/Makefile
===================================================================
@@ -24,7 +24,8 @@
 obj-$(CONFIG_X86_MPPARSE)	+= mpparse.o
 obj-$(CONFIG_X86_LOCAL_APIC)	+= apic.o nmi.o
 obj-$(CONFIG_X86_IO_APIC)	+= io_apic.o
-obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend.o suspend_asm.o
+obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend.o
+obj-$(CONFIG_PM)		+= suspend_asm.o
 obj-$(CONFIG_X86_NUMAQ)		+= numaq.o
 obj-$(CONFIG_X86_SUMMIT)	+= summit.o
 obj-$(CONFIG_EDD)             	+= edd.o
arch/i386/kernel/suspend_asm.S +2 -1
Index: linux/arch/i386/kernel/suspend_asm.S
===================================================================
@@ -32,6 +32,7 @@
 saved_context_eflags:
 	.long	0
 
+#ifdef CONFIG_SOFTWARE_SUSPEND
 	.text
 
 ENTRY(do_magic)
@@ -117,4 +118,4 @@
 loop2:
        .quad 0
        .previous
-	
\ No newline at end of file
+#endif
arch/i386/kernel/sysenter.c +0 -2
Index: linux/arch/i386/kernel/sysenter.c
===================================================================
@@ -31,8 +31,6 @@
 	wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
 	wrmsr(MSR_IA32_SYSENTER_ESP, tss->esp1, 0);
 	wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) sysenter_entry, 0);
-
-	printk("Enabling SEP on CPU %d\n", cpu);
 	put_cpu();	
 }
 
drivers/acpi/Kconfig +2 -2
Index: linux/drivers/acpi/Kconfig
===================================================================
@@ -58,8 +58,8 @@
 	default y
 
 config ACPI_SLEEP
-	bool "Sleep States"
-	depends on X86 && ACPI && !ACPI_HT_ONLY && SOFTWARE_SUSPEND
+	bool "Sleep States (EXPERIMENTAL)"
+	depends on X86 && ACPI && !ACPI_HT_ONLY && EXPERIMENTAL
 	---help---
 	  This option adds support for ACPI suspend states. 
 
include/linux/reboot.h +1 -1
Index: linux/include/linux/reboot.h
===================================================================
@@ -21,7 +21,7 @@
  * CAD_OFF     Ctrl-Alt-Del sequence sends SIGINT to init task.
  * POWER_OFF   Stop OS and remove all power from system, if possible.
  * RESTART2    Restart system using given command string.
- * SW_SUSPEND  Suspend system using Software Suspend if compiled in
+ * SW_SUSPEND  Suspend system using software suspend if compiled in.
  */
 
 #define	LINUX_REBOOT_CMD_RESTART	0x01234567
include/linux/suspend.h +11 -7
Index: linux/include/linux/suspend.h
===================================================================
@@ -55,10 +55,6 @@
 
 extern int register_suspend_notifier(struct notifier_block *);
 extern int unregister_suspend_notifier(struct notifier_block *);
-extern void refrigerator(unsigned long);
-
-extern int freeze_processes(void);
-extern void thaw_processes(void);
 
 extern unsigned int nr_copy_pages __nosavedata;
 extern suspend_pagedir_t *pagedir_nosave __nosavedata;
@@ -76,15 +72,23 @@
 extern void do_suspend_lowlevel_s4bios(int resume);
 
 #else
-static inline void software_suspend(void)
-{
-}
+static inline void software_suspend(void) { }
 #define software_resume()		do { } while(0)
 #define register_suspend_notifier(a)	do { } while(0)
 #define unregister_suspend_notifier(a)	do { } while(0)
+#endif
+
+#ifdef CONFIG_PM
+extern void refrigerator(unsigned long);
+extern int freeze_processes(void);
+extern void thaw_processes(void);
+#else
 #define refrigerator(a)			do { BUG(); } while(0)
 #define freeze_processes()		do { panic("You need CONFIG_SOFTWARE_SUSPEND to do sleeps."); } while(0)
 #define thaw_processes()		do { } while(0)
 #endif
 
+extern int prepare_suspend_console(void);
+extern void restore_console(void);
+
 #endif /* _LINUX_SWSUSP_H */
kernel/Makefile +1 -1
Index: linux/kernel/Makefile
===================================================================
@@ -17,7 +17,7 @@
 obj-$(CONFIG_PM) += pm.o
 obj-$(CONFIG_CPU_FREQ) += cpufreq.o
 obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
-obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend.o
+obj-$(CONFIG_PM) += suspend.o
 obj-$(CONFIG_COMPAT) += compat.o
 
 ifneq ($(CONFIG_IA64),y)
kernel/suspend.c +74 -81

274 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?]
#5 lore raw
Quoted 3 lines

Okay, I killed few trivial hunks, will submit them through trivial patch monkey. Are you happy now, patrick?

Why do you insist on abusing the trivial patch monkey? Why can't you send them directly to the maintainers? For instance, you add/remove printk()s and comments that other people may or may not want in there.

But no, this doesn't make me happy because you insist on munging multiple patches together that have little to do with each other, besides the fact they touch the same file. Like I said in private email, it really helps to track down a problem if each patch and subsequent changeset is as small and localized as possible.

And, that's a real problem with swsusp. It's a huge mess right now. I'd like to see it work well and reliably for 2.6, and have the source code be in a state where people can look at it without running away screaming. Convoluted updates are not going to help the situation.

-pat

#6 lore raw

Hi!

Quoted 6 lines
Quoted 2 lines

Okay, I killed few trivial hunks, will submit them through trivial patch monkey. Are you happy now, patrick?

Why do you insist on abusing the trivial patch monkey? Why can't you send them directly to the maintainers? For instance, you add/remove printk()s and comments that other people may or may not want in there.

If killing an noisy printk is not an trivial patch, I do not know what else is. If you want me to keep some printks, tell me, and we can talk about that.

Quoted 10 lines

But no, this doesn't make me happy because you insist on munging multiple patches together that have little to do with each other, besides the fact they touch the same file. Like I said in private email, it really helps to track down a problem if each patch and subsequent changeset is as small and localized as possible.

And, that's a real problem with swsusp. It's a huge mess right now. I'd like to see it work well and reliably for 2.6, and have the source code be in a state where people can look at it without running away screaming. Convoluted updates are not going to help the situation.

Yes, and just now you are contributing for swsusp to stay in the messy state. Thanx a lot.

If you want to become swsusp maintainer, say so, and you'll be fed nice and split patches *once*. That's okay to do. But I'm not able/do not have enough time to produce split patch each time Linus decides to drop the mail into the bitbucket.

I really don't like "Linus dropped patch -> resubmit 2 patches merged" resulting in you screaming "SPLIT IT UP!" on the lists.
Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#7 lore raw
In reply to Patrick Mochel

Hi!

Quoted 13 lines
Quoted 2 lines

Okay, I killed few trivial hunks, will submit them through trivial patch monkey. Are you happy now, patrick?

Why do you insist on abusing the trivial patch monkey? Why can't you send them directly to the maintainers? For instance, you add/remove printk()s and comments that other people may or may not want in there.

But no, this doesn't make me happy because you insist on munging multiple patches together that have little to do with each other, besides the fact they touch the same file. Like I said in private email, it really helps to track down a problem if each patch and subsequent changeset is as small and localized as possible.

Quoted 4 lines

And, that's a real problem with swsusp. It's a huge mess right now. I'd like to see it work well and reliably for 2.6, and have the source code be in a state where people can look at it without running away screaming. Convoluted updates are not going to help the situation.

[Sorry for the mess, I guess we are on the good way to solve this in private mails.]
Pavel

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

"linux-power" tree [was Re: swsusp updates]

In reply to Patrick Mochel

Hi!

Quoted 4 lines

And, that's a real problem with swsusp. It's a huge mess right now. I'd like to see it work well and reliably for 2.6, and have the source code be in a state where people can look at it without running away screaming. Convoluted updates are not going to help the situation.

Okay, so the debate is not over. It looks like his internet connection only works as long as you keep flaming him -- perhaps he has frozen ethernet cable? :-)

Anyway, patrick seems to have his own "linux-power" tree, and thinks that his "linux-power" tree will help powermanagment in Linux. I don't think that is the case, but I'll provide split patches *once*. Then I'm going to post each new patch (I guess I'll cc: patrick), but cumulate them for submission to Linus. Patches will be marked [PM] (read it as Pavel Machek or Power Managment).

I hope that works for everybody.
Pavel

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