aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/tick.h6
-rw-r--r--kernel/cpu.c2
-rw-r--r--kernel/time/tick-broadcast.c19
3 files changed, 19 insertions, 8 deletions
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 589868b09aff..f9ff225d53c0 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -36,6 +36,12 @@ extern void tick_irq_enter(void);
36static inline void tick_irq_enter(void) { } 36static inline void tick_irq_enter(void) { }
37#endif 37#endif
38 38
39#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
40extern void hotplug_cpu__broadcast_tick_pull(int dead_cpu);
41#else
42static inline void hotplug_cpu__broadcast_tick_pull(int dead_cpu) { }
43#endif
44
39#ifdef CONFIG_NO_HZ_COMMON 45#ifdef CONFIG_NO_HZ_COMMON
40extern int tick_nohz_tick_stopped(void); 46extern int tick_nohz_tick_stopped(void);
41extern void tick_nohz_idle_enter(void); 47extern void tick_nohz_idle_enter(void);
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 1972b161c61e..af5db20e5803 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -20,6 +20,7 @@
20#include <linux/gfp.h> 20#include <linux/gfp.h>
21#include <linux/suspend.h> 21#include <linux/suspend.h>
22#include <linux/lockdep.h> 22#include <linux/lockdep.h>
23#include <linux/tick.h>
23#include <trace/events/power.h> 24#include <trace/events/power.h>
24 25
25#include "smpboot.h" 26#include "smpboot.h"
@@ -411,6 +412,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
411 while (!idle_cpu(cpu)) 412 while (!idle_cpu(cpu))
412 cpu_relax(); 413 cpu_relax();
413 414
415 hotplug_cpu__broadcast_tick_pull(cpu);
414 /* This actually kills the CPU. */ 416 /* This actually kills the CPU. */
415 __cpu_die(cpu); 417 __cpu_die(cpu);
416 418
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 19cfb381faa9..f5e0fd5652dc 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -680,14 +680,19 @@ static void broadcast_shutdown_local(struct clock_event_device *bc,
680 clockevents_set_state(dev, CLOCK_EVT_STATE_SHUTDOWN); 680 clockevents_set_state(dev, CLOCK_EVT_STATE_SHUTDOWN);
681} 681}
682 682
683static void broadcast_move_bc(int deadcpu) 683void hotplug_cpu__broadcast_tick_pull(int deadcpu)
684{ 684{
685 struct clock_event_device *bc = tick_broadcast_device.evtdev; 685 struct clock_event_device *bc;
686 unsigned long flags;
686 687
687 if (!bc || !broadcast_needs_cpu(bc, deadcpu)) 688 raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
688 return; 689 bc = tick_broadcast_device.evtdev;
689 /* This moves the broadcast assignment to this cpu */ 690
690 clockevents_program_event(bc, bc->next_event, 1); 691 if (bc && broadcast_needs_cpu(bc, deadcpu)) {
692 /* This moves the broadcast assignment to this CPU: */
693 clockevents_program_event(bc, bc->next_event, 1);
694 }
695 raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
691} 696}
692 697
693/* 698/*
@@ -924,8 +929,6 @@ void tick_shutdown_broadcast_oneshot(unsigned int *cpup)
924 cpumask_clear_cpu(cpu, tick_broadcast_pending_mask); 929 cpumask_clear_cpu(cpu, tick_broadcast_pending_mask);
925 cpumask_clear_cpu(cpu, tick_broadcast_force_mask); 930 cpumask_clear_cpu(cpu, tick_broadcast_force_mask);
926 931
927 broadcast_move_bc(cpu);
928
929 raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags); 932 raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
930} 933}
931 934