Skip to contentSkip to conversation

swsusp updates

PATCH Pavel Machek 2 participants 4 messages Aug 4, 2003

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

Hi!

Here are swsusp updates, retransmitted. Please apply this time.

This fixes suspend with ^Z-ed processes (could corrupt data), makes CONFIG_SOFTWARE_SUSPEND independend from CONFIG_ACPI_SLEEP, fixes console after S3 and fixes too loud printks.

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);
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 2 lines · Pavel Machek

Here are swsusp updates, retransmitted. Please apply this time.

With CONFIG_SOFTWARE_SUSPEND=n:

kernel/suspend.c: In function `prepare_suspend_console':
kernel/suspend.c:272: `orig_loglevel' undeclared (first use in this function) kernel/suspend.c:272: (Each undeclared identifier is reported only once kernel/suspend.c:272: for each function it appears in.) kernel/suspend.c:273: new_loglevel' undeclared (first use in this function) kernel/suspend.c:276: orig_fgconsole' undeclared (first use in this function) kernel/suspend.c: In function `restore_console':
kernel/suspend.c:297: `orig_loglevel' undeclared (first use in this function)

#2 lore raw

Hi!

Quoted 4 lines
Quoted 1 line

Here are swsusp updates, retransmitted. Please apply this time.

With CONFIG_SOFTWARE_SUSPEND=n:

Quoted 8 lines

kernel/suspend.c: In function `prepare_suspend_console':
kernel/suspend.c:272: `orig_loglevel' undeclared (first use in this function) kernel/suspend.c:272: (Each undeclared identifier is reported only once kernel/suspend.c:272: for each function it appears in.) kernel/suspend.c:273: new_loglevel' undeclared (first use in this function) kernel/suspend.c:276: orig_fgconsole' undeclared (first use in this function) kernel/suspend.c: In function `restore_console':
kernel/suspend.c:297: `orig_loglevel' undeclared (first use in this

function)

This should fix it: (incremental).
Pavel

usr/src/linux/kernel/suspend.c renamed from usr/src/tmp/linux/kernel/suspend.c +13 -12
@@ -69,15 +69,6 @@
 
 unsigned char software_suspend_enabled = 0;
 
-#define SUSPEND_CONSOLE	(MAX_NR_CONSOLES-1)
-/* With SUSPEND_CONSOLE defined, it suspend looks *really* cool, but
-   we probably do not take enough locks for switching consoles, etc,
-   so bad things might happen.
-*/
-#if !defined(CONFIG_VT) || !defined(CONFIG_VT_CONSOLE)
-#undef SUSPEND_CONSOLE
-#endif
-
 #define __ADDRESS(x)  ((unsigned long) phys_to_virt(x))
 #define ADDRESS(x) __ADDRESS((x) << PAGE_SHIFT)
 #define ADDRESS2(x) __ADDRESS(__pa(x))		/* Needed for x86-64 where some pages are in memory twice */
@@ -91,9 +82,6 @@
 spinlock_t suspend_pagedir_lock __nosavedata = SPIN_LOCK_UNLOCKED;
 
 /* Variables to be preserved over suspend */
-static int new_loglevel = 7;
-static int orig_loglevel = 0;
-static int orig_fgconsole, orig_kmsg;
 static int pagedir_order_check;
 static int nr_copy_pages_check;
 
@@ -267,6 +255,19 @@
 	MDELAY(500);
 }
 
+#define SUSPEND_CONSOLE	(MAX_NR_CONSOLES-1)
+/* With SUSPEND_CONSOLE defined, it suspend looks *really* cool, but
+   we probably do not take enough locks for switching consoles, etc,
+   so bad things might happen.
+*/
+#if !defined(CONFIG_VT) || !defined(CONFIG_VT_CONSOLE)
+#undef SUSPEND_CONSOLE
+#endif
+
+static int new_loglevel = 7;
+static int orig_loglevel = 0;
+static int orig_fgconsole, orig_kmsg;
+
 int prepare_suspend_console(void)
 {
 	orig_loglevel = console_loglevel;
Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#3 lore raw
Quoted 2 lines · Pavel Machek

This should fix it: (incremental).

It generates rejects against Linus's current tree.

Please grab the latest from

ftp://ftp.kernel.org/pub/linux/kernel/v2.5/testing/cset/index.html

rediff, retest with various config options, resend.