]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/linux/cpuhotplug.h
rcu: Convert rcutree to hotplug state machine
[mirror_ubuntu-artful-kernel.git] / include / linux / cpuhotplug.h
CommitLineData
cff7d378
TG
1#ifndef __CPUHOTPLUG_H
2#define __CPUHOTPLUG_H
3
4enum cpuhp_state {
5 CPUHP_OFFLINE,
6 CPUHP_CREATE_THREADS,
00e16c3d 7 CPUHP_PERF_PREPARE,
95ca792c 8 CPUHP_PERF_X86_PREPARE,
1a246b9f 9 CPUHP_PERF_X86_UNCORE_PREP,
96b2bd38 10 CPUHP_PERF_X86_AMD_UNCORE_PREP,
8b5b773d 11 CPUHP_PERF_X86_RAPL_PREP,
a409f5ee 12 CPUHP_PERF_BFIN,
57ecde42 13 CPUHP_PERF_POWER,
e3cfce17 14 CPUHP_PERF_SUPERH,
48d7f6c7 15 CPUHP_X86_HPET_DEAD,
148b9e2a 16 CPUHP_X86_APB_DEAD,
7ee681b2 17 CPUHP_WORKQUEUE_PREP,
27590dc1 18 CPUHP_HRTIMERS_PREPARE,
e722d8da 19 CPUHP_PROFILE_PREPARE,
6b2c2847 20 CPUHP_X2APIC_PREPARE,
31487f83 21 CPUHP_SMPCFD_PREPARE,
24f73b99 22 CPUHP_TIMERS_DEAD,
4df83742 23 CPUHP_RCUTREE_PREP,
cff7d378
TG
24 CPUHP_NOTIFY_PREPARE,
25 CPUHP_BRINGUP_CPU,
e69aab13 26 CPUHP_AP_IDLE_DEAD,
4baa0afc 27 CPUHP_AP_OFFLINE,
9cf7243d 28 CPUHP_AP_SCHED_STARTING,
4df83742 29 CPUHP_AP_RCUTREE_DYING,
93131f7a 30 CPUHP_AP_IRQ_GIC_STARTING,
6670a6d8 31 CPUHP_AP_IRQ_GICV3_STARTING,
6c034d17 32 CPUHP_AP_IRQ_HIP04_STARTING,
cb5ff2d2
RC
33 CPUHP_AP_IRQ_ARMADA_XP_STARTING,
34 CPUHP_AP_IRQ_ARMADA_CASC_STARTING,
7ca04bc2 35 CPUHP_AP_IRQ_BCM2836_STARTING,
7fbbaebf 36 CPUHP_AP_ARM_MVEBU_COHERENCY,
1a246b9f 37 CPUHP_AP_PERF_X86_UNCORE_STARTING,
96b2bd38 38 CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
95ca792c 39 CPUHP_AP_PERF_X86_STARTING,
9744f7b7 40 CPUHP_AP_PERF_X86_AMD_IBS_STARTING,
f0704827 41 CPUHP_AP_PERF_X86_CQM_STARTING,
77c34ef1 42 CPUHP_AP_PERF_X86_CSTATE_STARTING,
25a77b55 43 CPUHP_AP_PERF_XTENSA_STARTING,
04d045a6 44 CPUHP_AP_PERF_METAG_STARTING,
65264e3b 45 CPUHP_AP_MIPS_OP_LOONGSON3_STARTING,
e5b61baf 46 CPUHP_AP_ARM_VFP_STARTING,
7d88eb69 47 CPUHP_AP_PERF_ARM_STARTING,
9eeb2264 48 CPUHP_AP_ARM_L2X0_STARTING,
7e86e8bd 49 CPUHP_AP_ARM_ARCH_TIMER_STARTING,
00c1d17a 50 CPUHP_AP_DUMMY_TIMER_STARTING,
26b87688 51 CPUHP_AP_ARM_TWD_STARTING,
31e8e5db 52 CPUHP_AP_METAG_TIMER_STARTING,
b0404165 53 CPUHP_AP_QCOM_TIMER_STARTING,
2dab9093 54 CPUHP_AP_MIPS_GIC_TIMER_STARTING,
8c18b2d2 55 CPUHP_AP_KVM_STARTING,
15d7e3d3 56 CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING,
42ec50b5 57 CPUHP_AP_KVM_ARM_VGIC_STARTING,
b3c9950a 58 CPUHP_AP_KVM_ARM_TIMER_STARTING,
4761adb6 59 CPUHP_AP_ARM_XEN_STARTING,
2b5283d1 60 CPUHP_AP_ARM_CORESIGHT_STARTING,
58eb457b 61 CPUHP_AP_ARM_CORESIGHT4_STARTING,
27c01a8c 62 CPUHP_AP_ARM64_ISNDEP_STARTING,
911a359d 63 CPUHP_AP_LEDTRIG_STARTING,
31487f83 64 CPUHP_AP_SMPCFD_DYING,
ae6a8a2e 65 CPUHP_AP_X86_TBOOT_DYING,
4baa0afc
TG
66 CPUHP_AP_NOTIFY_STARTING,
67 CPUHP_AP_ONLINE,
68 CPUHP_TEARDOWN_CPU,
fc6d73d6 69 CPUHP_AP_ONLINE_IDLE,
1cf4f629 70 CPUHP_AP_SMPBOOT_THREADS,
07d36c9e 71 CPUHP_AP_X86_VDSO_VMA_ONLINE,
00e16c3d 72 CPUHP_AP_PERF_ONLINE,
95ca792c 73 CPUHP_AP_PERF_X86_ONLINE,
1a246b9f 74 CPUHP_AP_PERF_X86_UNCORE_ONLINE,
96b2bd38 75 CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE,
c6a84daa 76 CPUHP_AP_PERF_X86_AMD_POWER_ONLINE,
8b5b773d 77 CPUHP_AP_PERF_X86_RAPL_ONLINE,
f0704827 78 CPUHP_AP_PERF_X86_CQM_ONLINE,
77c34ef1 79 CPUHP_AP_PERF_X86_CSTATE_ONLINE,
4f0f8217 80 CPUHP_AP_PERF_S390_CF_ONLINE,
e3d617fe 81 CPUHP_AP_PERF_S390_SF_ONLINE,
28c94843 82 CPUHP_AP_PERF_ARM_CCI_ONLINE,
fdc15a36 83 CPUHP_AP_PERF_ARM_CCN_ONLINE,
7ee681b2 84 CPUHP_AP_WORKQUEUE_ONLINE,
4df83742 85 CPUHP_AP_RCUTREE_ONLINE,
1cf4f629
TG
86 CPUHP_AP_NOTIFY_ONLINE,
87 CPUHP_AP_ONLINE_DYN,
88 CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30,
48d7f6c7 89 CPUHP_AP_X86_HPET_ONLINE,
251a5fd6 90 CPUHP_AP_X86_KVM_CLK_ONLINE,
aaddd7d1 91 CPUHP_AP_ACTIVE,
cff7d378
TG
92 CPUHP_ONLINE,
93};
94
5b7aa87e
TG
95int __cpuhp_setup_state(enum cpuhp_state state, const char *name, bool invoke,
96 int (*startup)(unsigned int cpu),
97 int (*teardown)(unsigned int cpu));
98
99/**
100 * cpuhp_setup_state - Setup hotplug state callbacks with calling the callbacks
101 * @state: The state for which the calls are installed
102 * @name: Name of the callback (will be used in debug output)
103 * @startup: startup callback function
104 * @teardown: teardown callback function
105 *
106 * Installs the callback functions and invokes the startup callback on
107 * the present cpus which have already reached the @state.
108 */
109static inline int cpuhp_setup_state(enum cpuhp_state state,
110 const char *name,
111 int (*startup)(unsigned int cpu),
112 int (*teardown)(unsigned int cpu))
113{
114 return __cpuhp_setup_state(state, name, true, startup, teardown);
115}
116
117/**
118 * cpuhp_setup_state_nocalls - Setup hotplug state callbacks without calling the
119 * callbacks
120 * @state: The state for which the calls are installed
121 * @name: Name of the callback.
122 * @startup: startup callback function
123 * @teardown: teardown callback function
124 *
125 * Same as @cpuhp_setup_state except that no calls are executed are invoked
126 * during installation of this callback. NOP if SMP=n or HOTPLUG_CPU=n.
127 */
128static inline int cpuhp_setup_state_nocalls(enum cpuhp_state state,
129 const char *name,
130 int (*startup)(unsigned int cpu),
131 int (*teardown)(unsigned int cpu))
132{
133 return __cpuhp_setup_state(state, name, false, startup, teardown);
134}
135
136void __cpuhp_remove_state(enum cpuhp_state state, bool invoke);
137
138/**
139 * cpuhp_remove_state - Remove hotplug state callbacks and invoke the teardown
140 * @state: The state for which the calls are removed
141 *
142 * Removes the callback functions and invokes the teardown callback on
143 * the present cpus which have already reached the @state.
144 */
145static inline void cpuhp_remove_state(enum cpuhp_state state)
146{
147 __cpuhp_remove_state(state, true);
148}
149
150/**
151 * cpuhp_remove_state_nocalls - Remove hotplug state callbacks without invoking
152 * teardown
153 * @state: The state for which the calls are removed
154 */
155static inline void cpuhp_remove_state_nocalls(enum cpuhp_state state)
156{
157 __cpuhp_remove_state(state, false);
158}
159
8df3e07e
TG
160#ifdef CONFIG_SMP
161void cpuhp_online_idle(enum cpuhp_state state);
162#else
163static inline void cpuhp_online_idle(enum cpuhp_state state) { }
164#endif
165
cff7d378 166#endif