• Home
  • Raw
  • Download

Lines Matching refs:state

66 	enum cpuhp_state	state;  member
145 static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state) in cpuhp_get_step() argument
147 return cpuhp_hp_states + state; in cpuhp_get_step()
167 static int cpuhp_invoke_callback(unsigned int cpu, enum cpuhp_state state, in cpuhp_invoke_callback() argument
172 struct cpuhp_step *step = cpuhp_get_step(state); in cpuhp_invoke_callback()
177 if (st->fail == state) { in cpuhp_invoke_callback()
191 trace_cpuhp_enter(cpu, st->target, state, cb); in cpuhp_invoke_callback()
193 trace_cpuhp_exit(cpu, st->state, state, ret); in cpuhp_invoke_callback()
201 trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node); in cpuhp_invoke_callback()
203 trace_cpuhp_exit(cpu, st->state, state, ret); in cpuhp_invoke_callback()
213 trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node); in cpuhp_invoke_callback()
215 trace_cpuhp_exit(cpu, st->state, state, ret); in cpuhp_invoke_callback()
238 trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node); in cpuhp_invoke_callback()
240 trace_cpuhp_exit(cpu, st->state, state, ret); in cpuhp_invoke_callback()
250 static bool cpuhp_is_ap_state(enum cpuhp_state state) in cpuhp_is_ap_state() argument
256 return state > CPUHP_BRINGUP_CPU && state != CPUHP_TEARDOWN_CPU; in cpuhp_is_ap_state()
274 static bool cpuhp_is_atomic_state(enum cpuhp_state state) in cpuhp_is_atomic_state() argument
276 return CPUHP_AP_IDLE_DEAD <= state && state < CPUHP_AP_ONLINE; in cpuhp_is_atomic_state()
502 enum cpuhp_state prev_state = st->state; in cpuhp_set_state()
503 bool bringup = st->state < target; in cpuhp_set_state()
540 st->state--; in cpuhp_reset_state()
542 st->state++; in cpuhp_reset_state()
553 if (!st->single && st->state == st->target) in __cpuhp_kick_ap()
670 if (st->state >= target) in cpuhp_next_state()
673 *state_to_run = ++st->state; in cpuhp_next_state()
675 if (st->state <= target) in cpuhp_next_state()
678 *state_to_run = st->state--; in cpuhp_next_state()
694 enum cpuhp_state state; in __cpuhp_invoke_callback_range() local
697 while (cpuhp_next_state(bringup, &state, st, target)) { in __cpuhp_invoke_callback_range()
700 err = cpuhp_invoke_callback(cpu, state, bringup, NULL, NULL); in __cpuhp_invoke_callback_range()
707 cpuhp_get_step(st->state)->name, in __cpuhp_invoke_callback_range()
708 st->state, err); in __cpuhp_invoke_callback_range()
746 return st->state <= CPUHP_BRINGUP_CPU; in can_rollback_cpu()
752 enum cpuhp_state prev_state = st->state; in cpuhp_up_callbacks()
758 ret, cpu, cpuhp_get_step(st->state)->name, in cpuhp_up_callbacks()
759 st->state); in cpuhp_up_callbacks()
797 enum cpuhp_state state; in cpuhp_thread_fun() local
817 state = st->cb_state; in cpuhp_thread_fun()
820 st->should_run = cpuhp_next_state(bringup, &state, st, st->target); in cpuhp_thread_fun()
825 WARN_ON_ONCE(!cpuhp_is_ap_state(state)); in cpuhp_thread_fun()
827 if (cpuhp_is_atomic_state(state)) { in cpuhp_thread_fun()
829 st->result = cpuhp_invoke_callback(cpu, state, bringup, st->node, &st->last); in cpuhp_thread_fun()
837 st->result = cpuhp_invoke_callback(cpu, state, bringup, st->node, &st->last); in cpuhp_thread_fun()
860 cpuhp_invoke_ap_callback(int cpu, enum cpuhp_state state, bool bringup, in cpuhp_invoke_ap_callback() argument
880 return cpuhp_invoke_callback(cpu, state, bringup, node, NULL); in cpuhp_invoke_ap_callback()
887 st->cb_state = state; in cpuhp_invoke_ap_callback()
913 enum cpuhp_state prev_state = st->state; in cpuhp_kick_ap_work()
924 trace_cpuhp_exit(cpu, st->state, prev_state, ret); in cpuhp_kick_ap_work()
1064 WARN_ON(st->state != (CPUHP_TEARDOWN_CPU - 1)); in take_cpu_down()
1115 BUG_ON(st->state != CPUHP_AP_IDLE_DEAD); in takedown_cpu()
1140 BUG_ON(st->state != CPUHP_AP_OFFLINE); in cpuhp_report_idle_dead()
1142 st->state = CPUHP_AP_IDLE_DEAD; in cpuhp_report_idle_dead()
1154 enum cpuhp_state prev_state = st->state; in cpuhp_down_callbacks()
1160 ret, cpu, cpuhp_get_step(st->state)->name, in cpuhp_down_callbacks()
1161 st->state); in cpuhp_down_callbacks()
1165 if (st->state < prev_state) in cpuhp_down_callbacks()
1195 if (st->state > CPUHP_TEARDOWN_CPU) { in _cpu_down()
1209 if (st->state > CPUHP_TEARDOWN_CPU) in _cpu_down()
1219 if (ret && st->state < prev_state) { in _cpu_down()
1220 if (st->state == CPUHP_TEARDOWN_CPU) { in _cpu_down()
1387 void cpuhp_online_idle(enum cpuhp_state state) in cpuhp_online_idle() argument
1392 if (state != CPUHP_AP_ONLINE_IDLE) in cpuhp_online_idle()
1401 st->state = CPUHP_AP_ONLINE_IDLE; in cpuhp_online_idle()
1423 if (st->state >= target) in _cpu_up()
1426 if (st->state == CPUHP_OFFLINE) { in _cpu_up()
1442 if (st->state > CPUHP_BRINGUP_CPU) { in _cpu_up()
1906 static int cpuhp_cb_check(enum cpuhp_state state) in cpuhp_cb_check() argument
1908 if (state <= CPUHP_OFFLINE || state >= CPUHP_ONLINE) in cpuhp_cb_check()
1918 static int cpuhp_reserve_state(enum cpuhp_state state) in cpuhp_reserve_state() argument
1923 switch (state) { in cpuhp_reserve_state()
1936 for (i = state; i <= end; i++, step++) { in cpuhp_reserve_state()
1944 static int cpuhp_store_callbacks(enum cpuhp_state state, const char *name, in cpuhp_store_callbacks() argument
1962 if (name && (state == CPUHP_AP_ONLINE_DYN || in cpuhp_store_callbacks()
1963 state == CPUHP_BP_PREPARE_DYN)) { in cpuhp_store_callbacks()
1964 ret = cpuhp_reserve_state(state); in cpuhp_store_callbacks()
1967 state = ret; in cpuhp_store_callbacks()
1969 sp = cpuhp_get_step(state); in cpuhp_store_callbacks()
1981 static void *cpuhp_get_teardown_cb(enum cpuhp_state state) in cpuhp_get_teardown_cb() argument
1983 return cpuhp_get_step(state)->teardown.single; in cpuhp_get_teardown_cb()
1990 static int cpuhp_issue_call(int cpu, enum cpuhp_state state, bool bringup, in cpuhp_issue_call() argument
1993 struct cpuhp_step *sp = cpuhp_get_step(state); in cpuhp_issue_call()
2007 if (cpuhp_is_ap_state(state)) in cpuhp_issue_call()
2008 ret = cpuhp_invoke_ap_callback(cpu, state, bringup, node); in cpuhp_issue_call()
2010 ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL); in cpuhp_issue_call()
2012 ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL); in cpuhp_issue_call()
2023 static void cpuhp_rollback_install(int failedcpu, enum cpuhp_state state, in cpuhp_rollback_install() argument
2031 int cpustate = st->state; in cpuhp_rollback_install()
2037 if (cpustate >= state) in cpuhp_rollback_install()
2038 cpuhp_issue_call(cpu, state, false, node); in cpuhp_rollback_install()
2042 int __cpuhp_state_add_instance_cpuslocked(enum cpuhp_state state, in __cpuhp_state_add_instance_cpuslocked() argument
2052 sp = cpuhp_get_step(state); in __cpuhp_state_add_instance_cpuslocked()
2067 int cpustate = st->state; in __cpuhp_state_add_instance_cpuslocked()
2069 if (cpustate < state) in __cpuhp_state_add_instance_cpuslocked()
2072 ret = cpuhp_issue_call(cpu, state, true, node); in __cpuhp_state_add_instance_cpuslocked()
2075 cpuhp_rollback_install(cpu, state, node); in __cpuhp_state_add_instance_cpuslocked()
2087 int __cpuhp_state_add_instance(enum cpuhp_state state, struct hlist_node *node, in __cpuhp_state_add_instance() argument
2093 ret = __cpuhp_state_add_instance_cpuslocked(state, node, invoke); in __cpuhp_state_add_instance()
2117 int __cpuhp_setup_state_cpuslocked(enum cpuhp_state state, in __cpuhp_setup_state_cpuslocked() argument
2128 if (cpuhp_cb_check(state) || !name) in __cpuhp_setup_state_cpuslocked()
2133 ret = cpuhp_store_callbacks(state, name, startup, teardown, in __cpuhp_setup_state_cpuslocked()
2136 dynstate = state == CPUHP_AP_ONLINE_DYN; in __cpuhp_setup_state_cpuslocked()
2138 state = ret; in __cpuhp_setup_state_cpuslocked()
2151 int cpustate = st->state; in __cpuhp_setup_state_cpuslocked()
2153 if (cpustate < state) in __cpuhp_setup_state_cpuslocked()
2156 ret = cpuhp_issue_call(cpu, state, true, NULL); in __cpuhp_setup_state_cpuslocked()
2159 cpuhp_rollback_install(cpu, state, NULL); in __cpuhp_setup_state_cpuslocked()
2160 cpuhp_store_callbacks(state, NULL, NULL, NULL, false); in __cpuhp_setup_state_cpuslocked()
2171 return state; in __cpuhp_setup_state_cpuslocked()
2176 int __cpuhp_setup_state(enum cpuhp_state state, in __cpuhp_setup_state() argument
2185 ret = __cpuhp_setup_state_cpuslocked(state, name, invoke, startup, in __cpuhp_setup_state()
2192 int __cpuhp_state_remove_instance(enum cpuhp_state state, in __cpuhp_state_remove_instance() argument
2195 struct cpuhp_step *sp = cpuhp_get_step(state); in __cpuhp_state_remove_instance()
2198 BUG_ON(cpuhp_cb_check(state)); in __cpuhp_state_remove_instance()
2206 if (!invoke || !cpuhp_get_teardown_cb(state)) in __cpuhp_state_remove_instance()
2215 int cpustate = st->state; in __cpuhp_state_remove_instance()
2217 if (cpustate >= state) in __cpuhp_state_remove_instance()
2218 cpuhp_issue_call(cpu, state, false, node); in __cpuhp_state_remove_instance()
2240 void __cpuhp_remove_state_cpuslocked(enum cpuhp_state state, bool invoke) in __cpuhp_remove_state_cpuslocked() argument
2242 struct cpuhp_step *sp = cpuhp_get_step(state); in __cpuhp_remove_state_cpuslocked()
2245 BUG_ON(cpuhp_cb_check(state)); in __cpuhp_remove_state_cpuslocked()
2253 state); in __cpuhp_remove_state_cpuslocked()
2257 if (!invoke || !cpuhp_get_teardown_cb(state)) in __cpuhp_remove_state_cpuslocked()
2267 int cpustate = st->state; in __cpuhp_remove_state_cpuslocked()
2269 if (cpustate >= state) in __cpuhp_remove_state_cpuslocked()
2270 cpuhp_issue_call(cpu, state, false, NULL); in __cpuhp_remove_state_cpuslocked()
2273 cpuhp_store_callbacks(state, NULL, NULL, NULL, false); in __cpuhp_remove_state_cpuslocked()
2278 void __cpuhp_remove_state(enum cpuhp_state state, bool invoke) in __cpuhp_remove_state() argument
2281 __cpuhp_remove_state_cpuslocked(state, invoke); in __cpuhp_remove_state()
2372 return sprintf(buf, "%d\n", st->state); in state_show()
2374 static DEVICE_ATTR_RO(state);
2406 if (st->state < target) in target_store()
2408 else if (st->state > target) in target_store()
2457 if (fail <= CPUHP_BRINGUP_CPU && st->state > CPUHP_BRINGUP_CPU) in fail_store()
2594 const char *state = smt_states[cpu_smt_control]; in control_show() local
2596 return snprintf(buf, PAGE_SIZE - 2, "%s\n", state); in control_show()
2771 this_cpu_write(cpuhp_state.state, CPUHP_ONLINE); in boot_cpu_hotplug_init()