Skip to contentSkip to conversation

suspend your real-time system

PATCH New Jan Kiszka 1 participant 1 message Jul 9, 2006

Subsystems (2)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 suspend your real-time system

Hi,

it's a bit crazy but it seems to work: This tiny patch against an I-pipe kernel really allows suspend to disk/ram for a *running* Xenomai system. Just the TSC-based timers are skewed up after resume so that, e.g., the latency test takes a longer pause then. But a serious use-case would rather include a real-time application shutdown before suspend anyway.

Jan

---
 kernel/power/swsusp.c |    4 ++++
 1 file changed, 4 insertions(+)
kernel/power/swsusp.c +4 -0
Index: linux-2.6.17-ipipe/kernel/power/swsusp.c
===================================================================
@@ -217,6 +217,7 @@ int swsusp_suspend(void)
 	if ((error = arch_prepare_suspend()))
 		return error;
 	local_irq_disable();
+	local_irq_disable_hw();
 	/* At this point, device_suspend() has been called, but *not*
 	 * device_power_down(). We *must* device_power_down() now.
 	 * Otherwise, drivers for some devices (e.g. interrupt controllers)
@@ -242,6 +243,7 @@ Restore_highmem:
 	restore_highmem();
 	device_power_up();
 Enable_irqs:
+	local_irq_enable_hw();
 	local_irq_enable();
 	return error;
 }
@@ -250,6 +252,7 @@ int swsusp_resume(void)
 {
 	int error;
 	local_irq_disable();
+	local_irq_disable_hw();
 	if (device_power_down(PMSG_FREEZE))
 		printk(KERN_ERR "Some devices failed to power down, very bad\n");
 	/* We'll ignore saved state, but this gets preempt count (etc) right */
@@ -268,6 +271,7 @@ int swsusp_resume(void)
 	restore_highmem();
 	touch_softlockup_watchdog();
 	device_power_up();
+	local_irq_enable_hw();
 	local_irq_enable();
 	return error;
 }