[prev in list] [next in list] [prev in thread] [next in thread]
List: lhcs-devel
Subject: Re: [lhcs-devel] Atomic CPU Hot-Add?
From: Srivatsa Vaddagiri <vatsa () in ! ibm ! com>
Date: 2004-03-31 9:46:34
Message-ID: 20040331093434.GA21599 () in ! ibm ! com
[Download RAW message or body]
On Tue, Mar 30, 2004 at 08:40:25AM +1000, Rusty Russell wrote:
> I think taking call_lock in __cpu_up() would do for now, and it's well
> contained. If that's not sufficient, we'll bite the bullet and do the
> whole stop_machine() thing...
Ok ..here's a patch for both ppc64 and x86 to take call_lock before
setting cpu in online_map
PPC64 - Applies against 2.6.5-rc2 present in Ameslab
---
ameslab-vatsa/arch/ppc64/kernel/smp.c | 2 ++
1 files changed, 2 insertions(+)
diff -puN arch/ppc64/kernel/smp.c~smp_call_function arch/ppc64/kernel/smp.c
--- ameslab/arch/ppc64/kernel/smp.c~smp_call_function 2004-03-30 15:40:18.000000000 \
+0530
+++ ameslab-vatsa/arch/ppc64/kernel/smp.c 2004-03-30 15:40:57.000000000 +0530
@@ -1019,7 +1019,9 @@ int __devinit __cpu_up(unsigned int cpu)
if (smp_ops->give_timebase)
smp_ops->give_timebase();
+ spin_lock_irq(&call_lock);
cpu_set(cpu, cpu_online_map);
+ spin_unlock_irq(&call_lock);
return 0;
}
x86 - Applies against [2.6.5-rc3 + your i386 patch]
---
linux-2.6.5-rc3-vatsa/arch/i386/kernel/process.c | 7 ++++++-
linux-2.6.5-rc3-vatsa/arch/i386/kernel/smp.c | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff -puN arch/i386/kernel/process.c~take_call_lock_before_setting_in_online_map \
arch/i386/kernel/process.c
--- linux-2.6.5-rc3/arch/i386/kernel/process.c~take_call_lock_before_setting_in_online_map 2004-03-30 \
16:26:41.000000000 +0530
+++ linux-2.6.5-rc3-vatsa/arch/i386/kernel/process.c 2004-03-30 16:31:53.000000000 \
+0530 @@ -136,6 +136,9 @@ static void poll_idle (void)
}
#ifdef CONFIG_HOTPLUG_CPU
+
+extern spinlock_t call_lock;
+
/* We don't actually take CPU down, just spin without interrupts. */
static void play_dead(void)
{
@@ -152,8 +155,10 @@ static void play_dead(void)
cpu_relax();
local_irq_disable();
- __flush_tlb_all();
+ spin_lock(&call_lock);
cpu_set(smp_processor_id(), cpu_online_map);
+ spin_unlock(&call_lock);
+ __flush_tlb_all();
apic_start();
local_irq_enable();
enable_timer_nmi_watchdog();
diff -puN arch/i386/kernel/smp.c~take_call_lock_before_setting_in_online_map \
arch/i386/kernel/smp.c
--- linux-2.6.5-rc3/arch/i386/kernel/smp.c~take_call_lock_before_setting_in_online_map 2004-03-30 \
16:26:41.000000000 +0530
+++ linux-2.6.5-rc3-vatsa/arch/i386/kernel/smp.c 2004-03-30 16:27:00.000000000 +0530
@@ -485,7 +485,7 @@ void smp_send_reschedule(int cpu)
* Structure and data for smp_call_function(). This is designed to minimise
* static memory requirements. It also looks cleaner.
*/
-static spinlock_t call_lock = SPIN_LOCK_UNLOCKED;
+spinlock_t call_lock = SPIN_LOCK_UNLOCKED;
struct call_data_struct {
void (*func) (void *info);
--
Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
lhcs-devel mailing list
lhcs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lhcs-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic