Skip to content

Commit 52c063d

Browse files
KAGA-KOKOingomolnar
authored andcommitted
clockevents: Make tick handover explicit
clockevents_notify() is a leftover from the early design of the clockevents facility. It's really not a notification mechanism, it's a multiplex call. We are way better off to have explicit calls instead of this monstrosity. Split out the tick_handover call and invoke it explicitely from the hotplug code. Temporary solution will be cleaned up in later patches. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> [ Rebase ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: John Stultz <john.stultz@linaro.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Link: http://lkml.kernel.org/r/1658173.RkEEILFiQZ@vostro.rjw.lan Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent ffa48c0 commit 52c063d

7 files changed

Lines changed: 10 additions & 13 deletions

File tree

‎include/linux/clockchips.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
/* Clock event notification values */
1212
enum clock_event_nofitiers {
1313
CLOCK_EVT_NOTIFY_ADD,
14-
CLOCK_EVT_NOTIFY_CPU_DYING,
1514
CLOCK_EVT_NOTIFY_CPU_DEAD,
1615
};
1716

‎include/linux/tick.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ extern void tick_unfreeze(void);
1919
extern void tick_suspend_local(void);
2020
/* Should be core only, but XEN resume magic and ARM BL switcher require it */
2121
extern void tick_resume_local(void);
22+
extern void tick_handover_do_timer(void);
2223
#else /* CONFIG_GENERIC_CLOCKEVENTS */
2324
static inline void tick_init(void) { }
2425
static inline void tick_freeze(void) { }
2526
static inline void tick_unfreeze(void) { }
2627
static inline void tick_suspend_local(void) { }
2728
static inline void tick_resume_local(void) { }
29+
static inline void tick_handover_do_timer(void) { }
2830
#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
2931

3032
#ifdef CONFIG_TICK_ONESHOT

‎kernel/cpu.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ static int __ref take_cpu_down(void *_param)
339339
return err;
340340

341341
cpu_notify(CPU_DYING | param->mod, param->hcpu);
342+
/* Give up timekeeping duties */
343+
tick_handover_do_timer();
342344
/* Park the stopper thread */
343345
kthread_park(current);
344346
return 0;

‎kernel/time/clockevents.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,6 @@ int clockevents_notify(unsigned long reason, void *arg)
655655
raw_spin_lock_irqsave(&clockevents_lock, flags);
656656

657657
switch (reason) {
658-
case CLOCK_EVT_NOTIFY_CPU_DYING:
659-
tick_handover_do_timer(arg);
660-
break;
661-
662658
case CLOCK_EVT_NOTIFY_CPU_DEAD:
663659
tick_shutdown_broadcast_oneshot(arg);
664660
tick_shutdown_broadcast(arg);

‎kernel/time/hrtimer.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,10 +1707,6 @@ static int hrtimer_cpu_notify(struct notifier_block *self,
17071707
break;
17081708

17091709
#ifdef CONFIG_HOTPLUG_CPU
1710-
case CPU_DYING:
1711-
case CPU_DYING_FROZEN:
1712-
clockevents_notify(CLOCK_EVT_NOTIFY_CPU_DYING, &scpu);
1713-
break;
17141710
case CPU_DEAD:
17151711
case CPU_DEAD_FROZEN:
17161712
{

‎kernel/time/tick-common.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,20 +332,23 @@ void tick_check_new_device(struct clock_event_device *newdev)
332332
tick_install_broadcast_device(newdev);
333333
}
334334

335+
#ifdef CONFIG_HOTPLUG_CPU
335336
/*
336337
* Transfer the do_timer job away from a dying cpu.
337338
*
338-
* Called with interrupts disabled.
339+
* Called with interrupts disabled. Not locking required. If
340+
* tick_do_timer_cpu is owned by this cpu, nothing can change it.
339341
*/
340-
void tick_handover_do_timer(int *cpup)
342+
void tick_handover_do_timer(void)
341343
{
342-
if (*cpup == tick_do_timer_cpu) {
344+
if (tick_do_timer_cpu == smp_processor_id()) {
343345
int cpu = cpumask_first(cpu_online_mask);
344346

345347
tick_do_timer_cpu = (cpu < nr_cpu_ids) ? cpu :
346348
TICK_DO_TIMER_NONE;
347349
}
348350
}
351+
#endif
349352

350353
/*
351354
* Shutdown an event device on a given cpu:

‎kernel/time/tick-internal.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ extern int tick_do_timer_cpu __read_mostly;
2020
extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
2121
extern void tick_handle_periodic(struct clock_event_device *dev);
2222
extern void tick_check_new_device(struct clock_event_device *dev);
23-
extern void tick_handover_do_timer(int *cpup);
2423
extern void tick_shutdown(unsigned int *cpup);
2524
extern void tick_suspend(void);
2625
extern void tick_resume(void);

0 commit comments

Comments
 (0)