aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-07-29 16:55:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-29 16:55:30 -0400
commita6408f6cb63ac0958fee7dbce7861ffb540d8a49 (patch)
treec94a835d343974171951e3b805e6bbbb02852ebc /kernel/time
parent1a81a8f2a5918956e214bb718099a89e500e7ec5 (diff)
parent4fae16dffb812f0e0d98a0b2b0856ca48ca63e6c (diff)
Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull smp hotplug updates from Thomas Gleixner: "This is the next part of the hotplug rework. - Convert all notifiers with a priority assigned - Convert all CPU_STARTING/DYING notifiers The final removal of the STARTING/DYING infrastructure will happen when the merge window closes. Another 700 hundred line of unpenetrable maze gone :)" * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (70 commits) timers/core: Correct callback order during CPU hot plug leds/trigger/cpu: Move from CPU_STARTING to ONLINE level powerpc/numa: Convert to hotplug state machine arm/perf: Fix hotplug state machine conversion irqchip/armada: Avoid unused function warnings ARC/time: Convert to hotplug state machine clocksource/atlas7: Convert to hotplug state machine clocksource/armada-370-xp: Convert to hotplug state machine clocksource/exynos_mct: Convert to hotplug state machine clocksource/arm_global_timer: Convert to hotplug state machine rcu: Convert rcutree to hotplug state machine KVM/arm/arm64/vgic-new: Convert to hotplug state machine smp/cfd: Convert core to hotplug state machine x86/x2apic: Convert to CPU hotplug state machine profile: Convert to hotplug state machine timers/core: Convert to hotplug state machine hrtimer: Convert to hotplug state machine x86/tboot: Convert to hotplug state machine arm64/armv8 deprecated: Convert to hotplug state machine hwtracing/coresight-etm4x: Convert to hotplug state machine ...
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/hrtimer.c40
-rw-r--r--kernel/time/timer.c25
2 files changed, 7 insertions, 58 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index d13c9aebf7a3..9ba7c820fc23 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1590,7 +1590,7 @@ SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp,
1590/* 1590/*
1591 * Functions related to boot-time initialization: 1591 * Functions related to boot-time initialization:
1592 */ 1592 */
1593static void init_hrtimers_cpu(int cpu) 1593int hrtimers_prepare_cpu(unsigned int cpu)
1594{ 1594{
1595 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu); 1595 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu);
1596 int i; 1596 int i;
@@ -1602,6 +1602,7 @@ static void init_hrtimers_cpu(int cpu)
1602 1602
1603 cpu_base->cpu = cpu; 1603 cpu_base->cpu = cpu;
1604 hrtimer_init_hres(cpu_base); 1604 hrtimer_init_hres(cpu_base);
1605 return 0;
1605} 1606}
1606 1607
1607#ifdef CONFIG_HOTPLUG_CPU 1608#ifdef CONFIG_HOTPLUG_CPU
@@ -1636,7 +1637,7 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
1636 } 1637 }
1637} 1638}
1638 1639
1639static void migrate_hrtimers(int scpu) 1640int hrtimers_dead_cpu(unsigned int scpu)
1640{ 1641{
1641 struct hrtimer_cpu_base *old_base, *new_base; 1642 struct hrtimer_cpu_base *old_base, *new_base;
1642 int i; 1643 int i;
@@ -1665,45 +1666,14 @@ static void migrate_hrtimers(int scpu)
1665 /* Check, if we got expired work to do */ 1666 /* Check, if we got expired work to do */
1666 __hrtimer_peek_ahead_timers(); 1667 __hrtimer_peek_ahead_timers();
1667 local_irq_enable(); 1668 local_irq_enable();
1669 return 0;
1668} 1670}
1669 1671
1670#endif /* CONFIG_HOTPLUG_CPU */ 1672#endif /* CONFIG_HOTPLUG_CPU */
1671 1673
1672static int hrtimer_cpu_notify(struct notifier_block *self,
1673 unsigned long action, void *hcpu)
1674{
1675 int scpu = (long)hcpu;
1676
1677 switch (action) {
1678
1679 case CPU_UP_PREPARE:
1680 case CPU_UP_PREPARE_FROZEN:
1681 init_hrtimers_cpu(scpu);
1682 break;
1683
1684#ifdef CONFIG_HOTPLUG_CPU
1685 case CPU_DEAD:
1686 case CPU_DEAD_FROZEN:
1687 migrate_hrtimers(scpu);
1688 break;
1689#endif
1690
1691 default:
1692 break;
1693 }
1694
1695 return NOTIFY_OK;
1696}
1697
1698static struct notifier_block hrtimers_nb = {
1699 .notifier_call = hrtimer_cpu_notify,
1700};
1701
1702void __init hrtimers_init(void) 1674void __init hrtimers_init(void)
1703{ 1675{
1704 hrtimer_cpu_notify(&hrtimers_nb, (unsigned long)CPU_UP_PREPARE, 1676 hrtimers_prepare_cpu(smp_processor_id());
1705 (void *)(long)smp_processor_id());
1706 register_cpu_notifier(&hrtimers_nb);
1707} 1677}
1708 1678
1709/** 1679/**
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index cb9ab401e2d9..555670a5143c 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1804,7 +1804,7 @@ static void migrate_timer_list(struct timer_base *new_base, struct hlist_head *h
1804 } 1804 }
1805} 1805}
1806 1806
1807static void migrate_timers(int cpu) 1807int timers_dead_cpu(unsigned int cpu)
1808{ 1808{
1809 struct timer_base *old_base; 1809 struct timer_base *old_base;
1810 struct timer_base *new_base; 1810 struct timer_base *new_base;
@@ -1831,29 +1831,9 @@ static void migrate_timers(int cpu)
1831 spin_unlock_irq(&new_base->lock); 1831 spin_unlock_irq(&new_base->lock);
1832 put_cpu_ptr(&timer_bases); 1832 put_cpu_ptr(&timer_bases);
1833 } 1833 }
1834 return 0;
1834} 1835}
1835 1836
1836static int timer_cpu_notify(struct notifier_block *self,
1837 unsigned long action, void *hcpu)
1838{
1839 switch (action) {
1840 case CPU_DEAD:
1841 case CPU_DEAD_FROZEN:
1842 migrate_timers((long)hcpu);
1843 break;
1844 default:
1845 break;
1846 }
1847
1848 return NOTIFY_OK;
1849}
1850
1851static inline void timer_register_cpu_notifier(void)
1852{
1853 cpu_notifier(timer_cpu_notify, 0);
1854}
1855#else
1856static inline void timer_register_cpu_notifier(void) { }
1857#endif /* CONFIG_HOTPLUG_CPU */ 1837#endif /* CONFIG_HOTPLUG_CPU */
1858 1838
1859static void __init init_timer_cpu(int cpu) 1839static void __init init_timer_cpu(int cpu)
@@ -1881,7 +1861,6 @@ void __init init_timers(void)
1881{ 1861{
1882 init_timer_cpus(); 1862 init_timer_cpus();
1883 init_timer_stats(); 1863 init_timer_stats();
1884 timer_register_cpu_notifier();
1885 open_softirq(TIMER_SOFTIRQ, run_timer_softirq); 1864 open_softirq(TIMER_SOFTIRQ, run_timer_softirq);
1886} 1865}
1887 1866