make some arch depend routines accept cpumask
Subsystems (4)
PATCH 2/10 make some arch depend routines accept cpumask
Make __cpu_disable/__cpu_die accept 'cpumask_t' parameter.
Signed-off-by Ashok Raj <[email protected]>
Signed-off-by Shaohua Li <[email protected]>
---
linux-2.6.17-rc3-root/arch/arm/kernel/smp.c | 7 +++++-- linux-2.6.17-rc3-root/arch/i386/kernel/smpboot.c | 10 ++++++---- linux-2.6.17-rc3-root/arch/ia64/kernel/smpboot.c | 10 ++++++---- linux-2.6.17-rc3-root/arch/powerpc/kernel/smp.c | 7 +++++-- linux-2.6.17-rc3-root/arch/s390/kernel/smp.c | 7 +++++-- linux-2.6.17-rc3-root/arch/x86_64/kernel/smpboot.c | 10 ++++++---- linux-2.6.17-rc3-root/include/asm-arm/smp.h | 4 ++-- linux-2.6.17-rc3-root/include/asm-i386/smp.h | 4 ++-- linux-2.6.17-rc3-root/include/asm-ia64/smp.h | 4 ++-- linux-2.6.17-rc3-root/include/asm-powerpc/smp.h | 4 ++-- linux-2.6.17-rc3-root/include/asm-s390/smp.h | 4 ++-- linux-2.6.17-rc3-root/include/asm-x86_64/smp.h | 4 ++-- linux-2.6.17-rc3-root/kernel/cpu.c | 4 ++-- 13 files changed, 47 insertions(+), 32 deletions(-)
arch/arm/kernel/smp.c renamed from arch/arm/kernel/smp.c~cpu_routines_accept_cpumask +5 -2
@@ -163,12 +163,13 @@ int __cpuinit __cpu_up(unsigned int cpu)/* * __cpu_disable runs on the processor to be shutdown. */ -int __cpuexit __cpu_disable(void) +int __cpuexit __cpu_disable(cpumask_t remove_mask) {unsigned int cpu =smp_processor_id ();struct task_struct *p;int ret; +BUG_ON (cpus_weight (remove_mask) !=1 ); ret =mach_cpu_disable (cpu);if (ret)return ret;
@@ -210,8 +211,10 @@ int __cpuexit __cpu_disable(void)* called on the thread which is asking for a CPU to be shutdown - * waits until shutdown has completed, or it is timed out. */ -void __cpuexit __cpu_die(unsigned int cpu) +void __cpuexit __cpu_die(cpumask_t remove_mask) { +int cpu =first_cpu (remove_mask); +if (!platform_cpu_kill (cpu))printk ("CPU%u: unable to kill\n" , cpu); }
arch/i386/kernel/smpboot.c renamed from arch/i386/kernel/smpboot.c~cpu_routines_accept_cpumask +6 -4
@@ -1340,11 +1340,12 @@ remove_siblinginfo(int cpu)cpu_clear (cpu, cpu_sibling_setup_map); } -int __cpu_disable (void ) +int __cpu_disable (cpumask_t remove_mask) {cpumask_t map = cpu_online_map;int cpu =smp_processor_id (); +BUG_ON (cpus_weight (remove_mask) !=1 );/* * Perhaps use cpufreq to drop frequency, but that could go * into generic code.
@@ -1371,10 +1372,11 @@ int __cpu_disable(void)return 0 ; } -void __cpu_die (unsigned int cpu) +void __cpu_die (cpumask_t remove_mask) {/* We don't do anything here: idle task is faking death itself. */ unsigned int i; +int cpu =first_cpu (remove_mask);for (i =0 ; i <10 ; i++) {/* They ack this in play_dead by setting CPU_DEAD */
@@ -1389,12 +1391,12 @@ void __cpu_die(unsigned int cpu) printk(KERN_ERR "CPU %u didn't die...\n", cpu); }#else /* ... !CONFIG_HOTPLUG_CPU */ -int __cpu_disable (void ) +int __cpu_disable (cpumask_t remove_mask) {return -ENOSYS ; } -void __cpu_die (unsigned int cpu) +void __cpu_die (cpumask_t remove_mask) {/* We said "no" in __cpu_disable */ BUG ();
arch/ia64/kernel/smpboot.c renamed from arch/ia64/kernel/smpboot.c~cpu_routines_accept_cpumask +6 -4
@@ -699,10 +699,11 @@ int migrate_platform_irqs(unsigned int c }/* must be called with cpucontrol mutex held */ -int __cpu_disable (void ) +int __cpu_disable (cpumask_t remove_mask) {int cpu =smp_processor_id (); +BUG_ON (cpus_weight (remove_mask) !=1 );/* * dont permit boot processor for now */
@@ -726,9 +727,10 @@ int __cpu_disable(void)return 0 ; } -void __cpu_die (unsigned int cpu) +void __cpu_die (cpumask_t remove_mask) {unsigned int i; +int cpu =first_cpu (remove_mask);for (i =0 ; i <100 ; i++) {/* They ack this in play_dead by setting CPU_DEAD */
@@ -742,12 +744,12 @@ void __cpu_die(unsigned int cpu) printk(KERN_ERR "CPU %u didn't die...\n", cpu); }#else /* !CONFIG_HOTPLUG_CPU */ -int __cpu_disable (void ) +int __cpu_disable (cpumask_t remove_mask) {return -ENOSYS ; } -void __cpu_die (unsigned int cpu) +void __cpu_die (cpumask_t remove_mask) {/* We said "no" in __cpu_disable */ BUG ();
arch/powerpc/kernel/smp.c renamed from arch/powerpc/kernel/smp.c~cpu_routines_accept_cpumask +5 -2
@@ -579,16 +579,19 @@ void __init smp_cpus_done(unsigned int m }#ifdef CONFIG_HOTPLUG_CPU -int __cpu_disable (void ) +int __cpu_disable (cpumask_t remove_mask) { +BUG_ON (cpus_weight (remove_mask) !=1 );if (smp_ops->cpu_disable)return smp_ops->cpu_disable ();return -ENOSYS ; } -void __cpu_die (unsigned int cpu) +void __cpu_die (cpumask_t remove_mask) { +int cpu =first_cpu (remove_mask); +if (smp_ops->cpu_die) smp_ops->cpu_die (cpu); }
arch/s390/kernel/smp.c renamed from arch/s390/kernel/smp.c~cpu_routines_accept_cpumask +5 -2
@@ -713,12 +713,13 @@ static int __init setup_possible_cpus(chearly_param ("possible_cpus" , setup_possible_cpus);int -__cpu_disable (void ) +__cpu_disable (cpumask_t remove_mask) {unsigned long flags;ec_creg_mask_parms cr_parms;int cpu =smp_processor_id (); +BUG_ON (cpus_weight (remove_mask) !=1 );spin_lock_irqsave (&smp_reserve_lock, flags);if (smp_cpu_reserved[cpu] !=0 ) {spin_unlock_irqrestore (&smp_reserve_lock, flags);
@@ -763,8 +764,10 @@ __cpu_disable(void) }void -__cpu_die (unsigned int cpu) +__cpu_die (cpumask_t remove_mask) { +int cpu =first_cpu (remove_mask); +/* Wait until target cpu is down */ while (!smp_cpu_not_running (cpu))cpu_relax ();
arch/x86_64/kernel/smpboot.c renamed from arch/x86_64/kernel/smpboot.c~cpu_routines_accept_cpumask +6 -4
@@ -1214,10 +1214,11 @@ void remove_cpu_from_maps(void)clear_node_cpumask (cpu); } -int __cpu_disable (void ) +int __cpu_disable (cpumask_t remove_mask) {int cpu =smp_processor_id (); +BUG_ON (cpus_weight (remove_mask) !=1 );/* * Perhaps use cpufreq to drop frequency, but that could go * into generic code.
@@ -1250,10 +1251,11 @@ int __cpu_disable(void)return 0 ; } -void __cpu_die (unsigned int cpu) +void __cpu_die (cpumask_t remove_mask) {/* We don't do anything here: idle task is faking death itself. */ unsigned int i; +int cpu =first_cpu (remove_mask);for (i =0 ; i <10 ; i++) {/* They ack this in play_dead by setting CPU_DEAD */
@@ -1274,12 +1276,12 @@ __setup("additional_cpus=", setup_additi#else /* ... !CONFIG_HOTPLUG_CPU */ -int __cpu_disable (void ) +int __cpu_disable (cpumask_t remove_mask) {return -ENOSYS ; } -void __cpu_die (unsigned int cpu) +void __cpu_die (cpumask_t remove_mask) {/* We said "no" in __cpu_disable */ BUG ();
include/asm-arm/smp.h renamed from include/asm-arm/smp.h~cpu_routines_accept_cpumask +2 -2
@@ -87,10 +87,10 @@ struct secondary_data { };extern struct secondary_data secondary_data; -extern int __cpu_disable (void ); +extern int __cpu_disable (cpumask_t remove_mask);extern int mach_cpu_disable (unsigned int cpu); -extern void __cpu_die (unsigned int cpu); +extern void __cpu_die (cpumask_t remove_mask);extern void cpu_die (void );extern void platform_cpu_die (unsigned int cpu);
include/asm-i386/smp.h renamed from include/asm-i386/smp.h~cpu_routines_accept_cpumask +2 -2
@@ -90,8 +90,8 @@ static __inline int logical_smp_processo#endif -extern int __cpu_disable (void ); -extern void __cpu_die (unsigned int cpu); +extern int __cpu_disable (cpumask_t remove_mask); +extern void __cpu_die (cpumask_t remove_mask);#endif /* !__ASSEMBLY__ */ #else /* CONFIG_SMP */
include/asm-ia64/smp.h renamed from include/asm-ia64/smp.h~cpu_routines_accept_cpumask +2 -2
@@ -114,8 +114,8 @@ max_xtp (void)#define hard_smp_processor_id () ia64_get_lid()/* Upping and downing of CPUs */ -extern int __cpu_disable (void ); -extern void __cpu_die (unsigned int cpu); +extern int __cpu_disable (cpumask_t remove_mask); +extern void __cpu_die (cpumask_t remove_mask);extern void cpu_die (void ) __attribute__ ((noreturn));extern int __cpu_up (unsigned int cpu);extern void __init smp_build_cpu_map (void );
include/asm-powerpc/smp.h renamed from include/asm-powerpc/smp.h~cpu_routines_accept_cpumask +2 -2
@@ -79,8 +79,8 @@ void smp_init_pSeries(void);void smp_init_cell (void );void smp_setup_cpu_maps (void ); -extern int __cpu_disable (void ); -extern void __cpu_die (unsigned int cpu); +extern int __cpu_disable (cpumask_t remove_mask); +extern void __cpu_die (cpumask_t remove_mask);#else /* for UP */
include/asm-s390/smp.h renamed from include/asm-s390/smp.h~cpu_routines_accept_cpumask +2 -2
@@ -87,8 +87,8 @@ smp_cpu_not_running(int cpu)#define cpu_logical_map (cpu) (cpu) -extern int __cpu_disable (void ); -extern void __cpu_die (unsigned int cpu); +extern int __cpu_disable (cpumask_t remove_mask); +extern void __cpu_die (cpumask_t remove_mask);extern void cpu_die (void ) __attribute__ ((noreturn));extern int __cpu_up (unsigned int cpu);
include/asm-x86_64/smp.h renamed from include/asm-x86_64/smp.h~cpu_routines_accept_cpumask +2 -2
@@ -80,8 +80,8 @@ static inline int hard_smp_processor_id( }extern int safe_smp_processor_id (void ); -extern int __cpu_disable (void ); -extern void __cpu_die (unsigned int cpu); +extern int __cpu_disable (cpumask_t remove_mask); +extern void __cpu_die (cpumask_t remove_mask);extern void prefill_possible_map (void );extern unsigned num_processors;extern unsigned disabled_cpus;
kernel/cpu.c renamed from kernel/cpu.c~cpu_routines_accept_cpumask +2 -2
@@ -104,7 +104,7 @@ static int take_cpu_down(void *unused)int err;/* Ensure this CPU doesn't handle any more interrupts. */ - err =__cpu_disable (); + err =__cpu_disable (cpumask_of_cpu (raw_smp_processor_id ()));if (err <0 )return err;
@@ -167,7 +167,7 @@ int cpu_down(unsigned int cpu)yield ();/* This actually kills the CPU. */ -__cpu_die (cpu); +__cpu_die (cpumask_of_cpu (cpu));/* Move it here so it can run. */ kthread_bind (p,get_cpu ());
_
arch/arm/kernel/smp.c int __cpuinit __cpu_up(unsigned int cpu) · line 173
Quoted 8 lines · Shaohua Li
arch/arm/kernel/smp.c renamed from arch/arm/kernel/smp.c~cpu_routines_accept_cpumask +2
-0+int __cpuexit __cpu_disable(cpumask_t remove_mask) {unsigned int cpu =smp_processor_id ();struct task_struct *p;int ret; +BUG_ON (cpus_weight (remove_mask) !=1 ); ret =mach_cpu_disable (cpu);
What is this extra argument actually used for?
Quoted 8 lines · Zwane Mwaikambo
Quoted 6 lines · Shaohua Li
arch/arm/kernel/smp.c renamed from arch/arm/kernel/smp.c~cpu_routines_accept_cpumask +1
-0+int __cpuexit __cpu_disable(cpumask_t remove_mask) {unsigned int cpu =smp_processor_id ();struct task_struct *p;int ret;
Quoted 4 lines
arch/arm/kernel/smp.c int __cpuinit __cpu_up(unsigned int cpu) · line 173
Quoted 2 lines
arch/arm/kernel/smp.c renamed from arch/arm/kernel/smp.c~cpu_routines_accept_cpumask +1
-0+BUG_ON (cpus_weight (remove_mask) !=1 ); ret =mach_cpu_disable (cpu);What is this extra argument actually used for?
Next patches will use it. Here we just want to make compilation work.
Thanks,
Shaohua