diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-20 09:28:02 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-20 10:09:16 -0500 |
commit | 10034aabca9032246762daaca3152f3e79380ea0 (patch) | |
tree | 32c0143b054ab6c5beeeb9726eaf86b87f2abd80 /arch/arm/kernel | |
parent | e3d9c625f5e4158014e041f492b46e38ad10987e (diff) |
ARM: localtimer: clean up local timer on hot unplug
When a CPU is hot unplugged, the generic tick code cleans up the
clock event device, but fails to call down to the device's set_mode
function to actually shut the device down.
To work around this, we've historically had a local_timer_stop()
callback out of the hotplug code. However, this adds needless
complexity when we have the clock event device itself available.
Explicitly call the clock event device's set_mode function with
CLOCK_EVT_MODE_UNUSED, so that the hardware can be cleanly shutdown
without any special external callbacks. When/if the generic code
is fixed, percpu_timer_stop() can be killed off.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/smp.c | 19 | ||||
-rw-r--r-- | arch/arm/kernel/smp_twd.c | 10 |
2 files changed, 18 insertions, 11 deletions
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 6afaf6f73069..4dc864ef9cdf 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -189,6 +189,8 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
189 | } | 189 | } |
190 | 190 | ||
191 | #ifdef CONFIG_HOTPLUG_CPU | 191 | #ifdef CONFIG_HOTPLUG_CPU |
192 | static void percpu_timer_stop(void); | ||
193 | |||
192 | /* | 194 | /* |
193 | * __cpu_disable runs on the processor to be shutdown. | 195 | * __cpu_disable runs on the processor to be shutdown. |
194 | */ | 196 | */ |
@@ -216,7 +218,7 @@ int __cpu_disable(void) | |||
216 | /* | 218 | /* |
217 | * Stop the local timer for this CPU. | 219 | * Stop the local timer for this CPU. |
218 | */ | 220 | */ |
219 | local_timer_stop(); | 221 | percpu_timer_stop(); |
220 | 222 | ||
221 | /* | 223 | /* |
222 | * Flush user cache and TLB mappings, and then remove this CPU | 224 | * Flush user cache and TLB mappings, and then remove this CPU |
@@ -539,6 +541,21 @@ void __cpuinit percpu_timer_setup(void) | |||
539 | local_timer_setup(evt); | 541 | local_timer_setup(evt); |
540 | } | 542 | } |
541 | 543 | ||
544 | #ifdef CONFIG_HOTPLUG_CPU | ||
545 | /* | ||
546 | * The generic clock events code purposely does not stop the local timer | ||
547 | * on CPU_DEAD/CPU_DEAD_FROZEN hotplug events, so we have to do it | ||
548 | * manually here. | ||
549 | */ | ||
550 | static void percpu_timer_stop(void) | ||
551 | { | ||
552 | unsigned int cpu = smp_processor_id(); | ||
553 | struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu); | ||
554 | |||
555 | evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); | ||
556 | } | ||
557 | #endif | ||
558 | |||
542 | static DEFINE_SPINLOCK(stop_lock); | 559 | static DEFINE_SPINLOCK(stop_lock); |
543 | 560 | ||
544 | /* | 561 | /* |
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index 35882fbf37f9..24585d97c104 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c | |||
@@ -150,13 +150,3 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk) | |||
150 | 150 | ||
151 | clockevents_register_device(clk); | 151 | clockevents_register_device(clk); |
152 | } | 152 | } |
153 | |||
154 | #ifdef CONFIG_HOTPLUG_CPU | ||
155 | /* | ||
156 | * take a local timer down | ||
157 | */ | ||
158 | void twd_timer_stop(void) | ||
159 | { | ||
160 | __raw_writel(0, twd_base + TWD_TIMER_CONTROL); | ||
161 | } | ||
162 | #endif | ||