]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
clockevents: Make tick handover explicit
authorThomas Gleixner <tglx@linutronix.de>
Fri, 3 Apr 2015 00:37:24 +0000 (02:37 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 3 Apr 2015 06:44:36 +0000 (08:44 +0200)
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>
include/linux/clockchips.h
include/linux/tick.h
kernel/cpu.c
kernel/time/clockevents.c
kernel/time/hrtimer.c
kernel/time/tick-common.c
kernel/time/tick-internal.h

index f97f498a5d10677941d348c06fbda8523f64a299..f4bde22f8a05df80c506b606187d995256190220 100644 (file)
@@ -11,7 +11,6 @@
 /* Clock event notification values */
 enum clock_event_nofitiers {
        CLOCK_EVT_NOTIFY_ADD,
-       CLOCK_EVT_NOTIFY_CPU_DYING,
        CLOCK_EVT_NOTIFY_CPU_DEAD,
 };
 
index 6119321fc3be8035c8558df6fd46d0c7049facdc..2c68fa3b9436b1c50e3cbfdd21e2720953da1eb5 100644 (file)
@@ -19,12 +19,14 @@ extern void tick_unfreeze(void);
 extern void tick_suspend_local(void);
 /* Should be core only, but XEN resume magic and ARM BL switcher require it */
 extern void tick_resume_local(void);
+extern void tick_handover_do_timer(void);
 #else /* CONFIG_GENERIC_CLOCKEVENTS */
 static inline void tick_init(void) { }
 static inline void tick_freeze(void) { }
 static inline void tick_unfreeze(void) { }
 static inline void tick_suspend_local(void) { }
 static inline void tick_resume_local(void) { }
+static inline void tick_handover_do_timer(void) { }
 #endif /* !CONFIG_GENERIC_CLOCKEVENTS */
 
 #ifdef CONFIG_TICK_ONESHOT
index af5db20e580363a1810acb8c14dd1595ceffb4d7..eba7eaa1341ddb060a2dadfd529f37149f172247 100644 (file)
@@ -339,6 +339,8 @@ static int __ref take_cpu_down(void *_param)
                return err;
 
        cpu_notify(CPU_DYING | param->mod, param->hcpu);
+       /* Give up timekeeping duties */
+       tick_handover_do_timer();
        /* Park the stopper thread */
        kthread_park(current);
        return 0;
index be9abf32c0b96217c5da603116ee4b6ec9339fd9..88fb3b96c7cc68fb3a1c97b8f35148567a253c84 100644 (file)
@@ -655,10 +655,6 @@ int clockevents_notify(unsigned long reason, void *arg)
        raw_spin_lock_irqsave(&clockevents_lock, flags);
 
        switch (reason) {
-       case CLOCK_EVT_NOTIFY_CPU_DYING:
-               tick_handover_do_timer(arg);
-               break;
-
        case CLOCK_EVT_NOTIFY_CPU_DEAD:
                tick_shutdown_broadcast_oneshot(arg);
                tick_shutdown_broadcast(arg);
index 721d29b99d10eef6592831728507e804b174fb24..6a7a64ec7d1b34cb3327fd16dd55e16499b57951 100644 (file)
@@ -1707,10 +1707,6 @@ static int hrtimer_cpu_notify(struct notifier_block *self,
                break;
 
 #ifdef CONFIG_HOTPLUG_CPU
-       case CPU_DYING:
-       case CPU_DYING_FROZEN:
-               clockevents_notify(CLOCK_EVT_NOTIFY_CPU_DYING, &scpu);
-               break;
        case CPU_DEAD:
        case CPU_DEAD_FROZEN:
        {
index e28ba5c044c51fafa9142cf3d2c9ae9179b5f8c2..055c868f3ec9450c066b3f50e6b61a717607e1b0 100644 (file)
@@ -332,20 +332,23 @@ out_bc:
        tick_install_broadcast_device(newdev);
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
 /*
  * Transfer the do_timer job away from a dying cpu.
  *
- * Called with interrupts disabled.
+ * Called with interrupts disabled. Not locking required. If
+ * tick_do_timer_cpu is owned by this cpu, nothing can change it.
  */
-void tick_handover_do_timer(int *cpup)
+void tick_handover_do_timer(void)
 {
-       if (*cpup == tick_do_timer_cpu) {
+       if (tick_do_timer_cpu == smp_processor_id()) {
                int cpu = cpumask_first(cpu_online_mask);
 
                tick_do_timer_cpu = (cpu < nr_cpu_ids) ? cpu :
                        TICK_DO_TIMER_NONE;
        }
 }
+#endif
 
 /*
  * Shutdown an event device on a given cpu:
index 0266f9dbd1149fd57c38441c2bca77cc807dedbb..aabcb5d00cf2ee30f5bf6572f93f8441141811f2 100644 (file)
@@ -20,7 +20,6 @@ extern int tick_do_timer_cpu __read_mostly;
 extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
 extern void tick_handle_periodic(struct clock_event_device *dev);
 extern void tick_check_new_device(struct clock_event_device *dev);
-extern void tick_handover_do_timer(int *cpup);
 extern void tick_shutdown(unsigned int *cpup);
 extern void tick_suspend(void);
 extern void tick_resume(void);