Skip to contentSkip to conversation

Subject: [PATCH 2/2] linux-acpi : sos api

PATCH raz ben yehuda 1 participant 1 message Oct 13, 2008

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

From: Raz Ben Yehuda <[email protected]>

SOS is a platform aimed to assign a service to an offloaded processor. This patch is the facility for SOS (http://sos-linux.cvs.sourceforge.net/sos-linux/)

---
 arch/x86/kernel/process.c    |   42 +++++++++++++++++++++++++++++++++
 arch/x86/kernel/process_32.c |    2 +
 arch/x86/kernel/process_64.c |    2 +
 arch/x86/kernel/smpboot.c    |    9 +++----
 include/linux/cpu.h          |   20 +++++++++++++++
 kernel/cpu.c                 |    1
 6 files changed, 72 insertions(+), 4 deletions(-)
arch/x86/kernel/process_32.c +2 -0
diff -uprN -X dontdiff linux-2.6.27/arch/x86/kernel/process_32.c linux-2.6.27-dbg/arch/x86/kernel/process_32.c
@@ -106,6 +106,8 @@ static inline void play_dead(void)
 	 */
 	local_irq_disable();
 	/* mask all interrupts, flush any and all caches, and halt */
+	if (is_sossed(raw_smp_processor_id()))
+		run_sos();
 	wbinvd_halt();
 }
 #else
arch/x86/kernel/process_64.c +2 -0
diff -uprN -X dontdiff linux-2.6.27/arch/x86/kernel/process_64.c linux-2.6.27-dbg/arch/x86/kernel/process_64.c
@@ -101,6 +101,8 @@ static inline void play_dead(void)
 
 	local_irq_disable();
 	/* mask all interrupts, flush any and all caches, and halt */
+	if (is_sossed(raw_smp_processor_id()))
+		run_sos();
 	wbinvd_halt();
 }
 #else
arch/x86/kernel/process.c +42 -0

45 lines not on this page · raw message

arch/x86/kernel/smpboot.c +5 -4
diff -uprN -X dontdiff linux-2.6.27/arch/x86/kernel/smpboot.c linux-2.6.27-dbg/arch/x86/kernel/smpboot.c
@@ -827,8 +827,8 @@ static int __cpuinit do_boot_cpu(int api
 			/* if can't get pda memory, can't start cpu */
 	}
 #endif
-
-	alternatives_smp_switch(1);
+	if (!is_sossed(cpu))
+		alternatives_smp_switch(1);
 
 	c_idle.idle = get_idle_for_cpu(cpu);
 
@@ -1393,8 +1393,9 @@ void __cpu_die(unsigned int cpu)
 	for (i = 0; i < 10; i++) {
 		/* They ack this in play_dead by setting CPU_DEAD */
 		if (per_cpu(cpu_state, cpu) == CPU_DEAD) {
-			printk(KERN_INFO "CPU %d is now offline\n", cpu);
-			if (1 == num_online_cpus())
+			printk(KERN_INFO "CPU %d is now offline %s\n", cpu,
+				is_sossed(cpu) ? "and SOSSED" : "");
+			if (1 == num_online_cpus() && !is_sossed(cpu))
 				alternatives_smp_switch(0);
 			return;
 		}
include/linux/cpu.h +20 -0
diff -uprN -X dontdiff linux-2.6.27/include/linux/cpu.h linux-2.6.27-dbg/include/linux/cpu.h
@@ -44,6 +44,7 @@ extern int sched_create_sysfs_power_savi
 
 #ifdef CONFIG_HOTPLUG_CPU
 extern void unregister_cpu(struct cpu *cpu);
+extern void unregister_sos(int cpuid);
 #endif
 struct notifier_block;
 
@@ -52,6 +53,9 @@ struct notifier_block;
 #ifdef CONFIG_HOTPLUG_CPU
 extern int register_cpu_notifier(struct notifier_block *nb);
 extern void unregister_cpu_notifier(struct notifier_block *nb);
+extern int register_sos(void (*hotplug_cpu_dead)(void), int cpuid);
+extern int is_sossed(int cpuid);
+extern void run_sos(void);
 #else
 
 #ifndef MODULE
@@ -61,11 +65,27 @@ static inline int register_cpu_notifier(
 {
 	return 0;
 }
+
+static inline int register_sos(void (*hotplug_cpu_dead)(void), int cpuid);
+{
+	return 0;
+}
 #endif
 
 static inline void unregister_cpu_notifier(struct notifier_block *nb)
 {
 }
+
+static inline void unregister_sos(int cpuid)
+{
+}
+static inline int is_sossed(int cpuid)
+{
+	return 0;
+}
+static inline void run_sos(void)
+{
+}
 #endif
 
 int cpu_up(unsigned int cpu);
kernel/cpu.c +1 -0
diff -uprN -X dontdiff linux-2.6.27/kernel/cpu.c linux-2.6.27-dbg/kernel/cpu.c
@@ -389,6 +389,7 @@ out:
 	cpu_maps_update_done();
 	return err;
 }
+EXPORT_SYMBOL(cpu_up);
 
 #ifdef CONFIG_PM_SLEEP_SMP
 static cpumask_t frozen_cpus;