Subject: [PATCH 2/2] linux-acpi ( not cpusets): sos api
Subsystems (3)
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/)
Signed-off-by Raz Ben Yehuda <[email protected]>
--- arch/x86/kernel/process.c | 27 +++++++++++++++++++++++++++ arch/x86/kernel/process_32.c | 2 ++ arch/x86/kernel/process_64.c | 2 ++ arch/x86/kernel/smpboot.c | 6 +++--- include/linux/cpu.h | 20 ++++++++++++++++++++ kernel/cpu.c | 3 ++- 6 files changed, 56 insertions(+), 4 deletions(-)
arch/x86/kernel/process_32.c +2 -0
@@ -142,6 +142,8 @@ static inline void play_dead(void)* With physical CPU hotplug, we should halt the cpu */ local_irq_disable (); +if (is_sossed ()) +run_sos ();while (1 )halt (); }
arch/x86/kernel/process_64.c +2 -0
@@ -127,6 +127,8 @@ static inline void play_dead(void)__get_cpu_var (cpu_state) =CPU_DEAD ;local_irq_disable (); +if (is_sossed ()) +run_sos ();while (1 )halt (); }
arch/x86/kernel/process.c +27 -0
@@ -180,3 +180,30 @@ static int __init idle_setup(char *str) }early_param ("idle" , idle_setup); +#ifdef CONFIG_HOTPLUG_CPU +void (*hotplug_cpu_dead)(void ); + +void unregister_sos (void ) +{ + hotplug_cpu_dead =NULL ; +} +EXPORT_SYMBOL_GPL (unregister_sos); + +int is_sossed (void ) +{ +return hotplug_cpu_dead !=NULL ; +} +int register_sos (void (*hotplug_sos)(void )) +{ +if (is_sossed ()) +return -1 ; + hotplug_cpu_dead = hotplug_sos; +return 0 ; +} +EXPORT_SYMBOL_GPL (register_sos); + +void run_sos (void ) +{ +hotplug_cpu_dead (); +} +#endif
arch/x86/kernel/smpboot.c +3 -3
@@ -872,8 +872,8 @@ static int __cpuinit do_boot_cpu(int api cpu, node); }#endif - -alternatives_smp_switch (1 ); +if (!is_sossed ()) +alternatives_smp_switch (1 ); c_idle.idle =get_idle_for_cpu (cpu);
@@ -1423,7 +1423,7 @@ void __cpu_die(unsigned int cpu)/* 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 ()) +if (1 ==num_online_cpus () && !is_sossed ())alternatives_smp_switch (0 );return ; }
include/linux/cpu.h +20 -0
@@ -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 (void );#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 )); +extern int is_sossed (void ); +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 )); +{ +return 0 ; +}#endif static inline void unregister_cpu_notifier (struct notifier_block *nb) { } + +static inline void unregister_sos (void ) +{ +} +static inline int is_sossed (void ) +{ +return 0 ; +} +static inline void run_sos (void ) +{ +}#endif int cpu_up (unsigned int cpu);
kernel/cpu.c +2 -1
@@ -277,6 +277,7 @@ int __ref cpu_down(unsigned int cpu)cpu_maps_update_done (); return err; } +EXPORT_SYMBOL_GPL (cpu_down);#endif /*CONFIG_HOTPLUG_CPU*/ /* Requires cpu_add_remove_lock to be held */
@@ -340,7 +341,7 @@ int __cpuinit cpu_up(unsigned int cpu)cpu_maps_update_done ();return err; } - +EXPORT_SYMBOL_GPL (cpu_up);#ifdef CONFIG_PM_SLEEP_SMP static cpumask_t frozen_cpus;