• Home
  • Raw
  • Download

Lines Matching refs:state

56 	enum cpuhp_state	state;  member
132 static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state) in cpuhp_get_step() argument
134 return cpuhp_hp_states + state; in cpuhp_get_step()
147 static int cpuhp_invoke_callback(unsigned int cpu, enum cpuhp_state state, in cpuhp_invoke_callback() argument
152 struct cpuhp_step *step = cpuhp_get_step(state); in cpuhp_invoke_callback()
157 if (st->fail == state) { in cpuhp_invoke_callback()
171 trace_cpuhp_enter(cpu, st->target, state, cb); in cpuhp_invoke_callback()
173 trace_cpuhp_exit(cpu, st->state, state, ret); in cpuhp_invoke_callback()
183 trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node); in cpuhp_invoke_callback()
185 trace_cpuhp_exit(cpu, st->state, state, ret); in cpuhp_invoke_callback()
195 trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node); in cpuhp_invoke_callback()
197 trace_cpuhp_exit(cpu, st->state, state, ret); in cpuhp_invoke_callback()
220 trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node); in cpuhp_invoke_callback()
222 trace_cpuhp_exit(cpu, st->state, state, ret); in cpuhp_invoke_callback()
232 static bool cpuhp_is_ap_state(enum cpuhp_state state) in cpuhp_is_ap_state() argument
238 return state > CPUHP_BRINGUP_CPU && state != CPUHP_TEARDOWN_CPU; in cpuhp_is_ap_state()
256 static bool cpuhp_is_atomic_state(enum cpuhp_state state) in cpuhp_is_atomic_state() argument
258 return CPUHP_AP_IDLE_DEAD <= state && state < CPUHP_AP_ONLINE; in cpuhp_is_atomic_state()
455 enum cpuhp_state prev_state = st->state; in cpuhp_set_state()
462 st->bringup = st->state < target; in cpuhp_set_state()
478 st->state--; in cpuhp_reset_state()
480 st->state++; in cpuhp_reset_state()
490 if (!st->single && st->state == st->target) in __cpuhp_kick_ap()
574 for (st->state--; st->state > st->target; st->state--) in undo_cpu_up()
575 cpuhp_invoke_callback(cpu, st->state, false, NULL, NULL); in undo_cpu_up()
589 return st->state <= CPUHP_BRINGUP_CPU; in can_rollback_cpu()
595 enum cpuhp_state prev_state = st->state; in cpuhp_up_callbacks()
598 while (st->state < target) { in cpuhp_up_callbacks()
599 st->state++; in cpuhp_up_callbacks()
600 ret = cpuhp_invoke_callback(cpu, st->state, true, NULL, NULL); in cpuhp_up_callbacks()
648 enum cpuhp_state state; in cpuhp_thread_fun() local
668 state = st->cb_state; in cpuhp_thread_fun()
672 st->state++; in cpuhp_thread_fun()
673 state = st->state; in cpuhp_thread_fun()
674 st->should_run = (st->state < st->target); in cpuhp_thread_fun()
675 WARN_ON_ONCE(st->state > st->target); in cpuhp_thread_fun()
677 state = st->state; in cpuhp_thread_fun()
678 st->state--; in cpuhp_thread_fun()
679 st->should_run = (st->state > st->target); in cpuhp_thread_fun()
680 WARN_ON_ONCE(st->state < st->target); in cpuhp_thread_fun()
684 WARN_ON_ONCE(!cpuhp_is_ap_state(state)); in cpuhp_thread_fun()
686 if (cpuhp_is_atomic_state(state)) { in cpuhp_thread_fun()
688 st->result = cpuhp_invoke_callback(cpu, state, bringup, st->node, &st->last); in cpuhp_thread_fun()
696 st->result = cpuhp_invoke_callback(cpu, state, bringup, st->node, &st->last); in cpuhp_thread_fun()
718 cpuhp_invoke_ap_callback(int cpu, enum cpuhp_state state, bool bringup, in cpuhp_invoke_ap_callback() argument
738 return cpuhp_invoke_callback(cpu, state, bringup, node, NULL); in cpuhp_invoke_ap_callback()
745 st->cb_state = state; in cpuhp_invoke_ap_callback()
771 enum cpuhp_state prev_state = st->state; in cpuhp_kick_ap_work()
782 trace_cpuhp_exit(cpu, st->state, prev_state, ret); in cpuhp_kick_ap_work()
861 WARN_ON(st->state != CPUHP_TEARDOWN_CPU); in take_cpu_down()
862 st->state--; in take_cpu_down()
864 for (; st->state > target; st->state--) { in take_cpu_down()
865 ret = cpuhp_invoke_callback(cpu, st->state, false, NULL, NULL); in take_cpu_down()
916 BUG_ON(st->state != CPUHP_AP_IDLE_DEAD); in takedown_cpu()
941 BUG_ON(st->state != CPUHP_AP_OFFLINE); in cpuhp_report_idle_dead()
943 st->state = CPUHP_AP_IDLE_DEAD; in cpuhp_report_idle_dead()
954 for (st->state++; st->state < st->target; st->state++) in undo_cpu_down()
955 cpuhp_invoke_callback(cpu, st->state, true, NULL, NULL); in undo_cpu_down()
961 enum cpuhp_state prev_state = st->state; in cpuhp_down_callbacks()
964 for (; st->state > target; st->state--) { in cpuhp_down_callbacks()
965 ret = cpuhp_invoke_callback(cpu, st->state, false, NULL, NULL); in cpuhp_down_callbacks()
968 if (st->state < prev_state) in cpuhp_down_callbacks()
998 if (st->state > CPUHP_TEARDOWN_CPU) { in _cpu_down()
1012 if (st->state > CPUHP_TEARDOWN_CPU) in _cpu_down()
1022 if (ret && st->state == CPUHP_TEARDOWN_CPU && st->state < prev_state) { in _cpu_down()
1080 while (st->state < target) { in notify_cpu_starting()
1081 st->state++; in notify_cpu_starting()
1082 ret = cpuhp_invoke_callback(cpu, st->state, true, NULL, NULL); in notify_cpu_starting()
1095 void cpuhp_online_idle(enum cpuhp_state state) in cpuhp_online_idle() argument
1100 if (state != CPUHP_AP_ONLINE_IDLE) in cpuhp_online_idle()
1103 st->state = CPUHP_AP_ONLINE_IDLE; in cpuhp_online_idle()
1125 if (st->state >= target) in _cpu_up()
1128 if (st->state == CPUHP_OFFLINE) { in _cpu_up()
1144 if (st->state > CPUHP_BRINGUP_CPU) { in _cpu_up()
1539 static int cpuhp_cb_check(enum cpuhp_state state) in cpuhp_cb_check() argument
1541 if (state <= CPUHP_OFFLINE || state >= CPUHP_ONLINE) in cpuhp_cb_check()
1551 static int cpuhp_reserve_state(enum cpuhp_state state) in cpuhp_reserve_state() argument
1556 switch (state) { in cpuhp_reserve_state()
1569 for (i = state; i <= end; i++, step++) { in cpuhp_reserve_state()
1577 static int cpuhp_store_callbacks(enum cpuhp_state state, const char *name, in cpuhp_store_callbacks() argument
1595 if (name && (state == CPUHP_AP_ONLINE_DYN || in cpuhp_store_callbacks()
1596 state == CPUHP_BP_PREPARE_DYN)) { in cpuhp_store_callbacks()
1597 ret = cpuhp_reserve_state(state); in cpuhp_store_callbacks()
1600 state = ret; in cpuhp_store_callbacks()
1602 sp = cpuhp_get_step(state); in cpuhp_store_callbacks()
1614 static void *cpuhp_get_teardown_cb(enum cpuhp_state state) in cpuhp_get_teardown_cb() argument
1616 return cpuhp_get_step(state)->teardown.single; in cpuhp_get_teardown_cb()
1623 static int cpuhp_issue_call(int cpu, enum cpuhp_state state, bool bringup, in cpuhp_issue_call() argument
1626 struct cpuhp_step *sp = cpuhp_get_step(state); in cpuhp_issue_call()
1641 if (cpuhp_is_ap_state(state)) in cpuhp_issue_call()
1642 ret = cpuhp_invoke_ap_callback(cpu, state, bringup, node); in cpuhp_issue_call()
1644 ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL); in cpuhp_issue_call()
1646 ret = cpuhp_invoke_callback(cpu, state, bringup, node, NULL); in cpuhp_issue_call()
1657 static void cpuhp_rollback_install(int failedcpu, enum cpuhp_state state, in cpuhp_rollback_install() argument
1665 int cpustate = st->state; in cpuhp_rollback_install()
1671 if (cpustate >= state) in cpuhp_rollback_install()
1672 cpuhp_issue_call(cpu, state, false, node); in cpuhp_rollback_install()
1676 int __cpuhp_state_add_instance_cpuslocked(enum cpuhp_state state, in __cpuhp_state_add_instance_cpuslocked() argument
1686 sp = cpuhp_get_step(state); in __cpuhp_state_add_instance_cpuslocked()
1701 int cpustate = st->state; in __cpuhp_state_add_instance_cpuslocked()
1703 if (cpustate < state) in __cpuhp_state_add_instance_cpuslocked()
1706 ret = cpuhp_issue_call(cpu, state, true, node); in __cpuhp_state_add_instance_cpuslocked()
1709 cpuhp_rollback_install(cpu, state, node); in __cpuhp_state_add_instance_cpuslocked()
1721 int __cpuhp_state_add_instance(enum cpuhp_state state, struct hlist_node *node, in __cpuhp_state_add_instance() argument
1727 ret = __cpuhp_state_add_instance_cpuslocked(state, node, invoke); in __cpuhp_state_add_instance()
1750 int __cpuhp_setup_state_cpuslocked(enum cpuhp_state state, in __cpuhp_setup_state_cpuslocked() argument
1761 if (cpuhp_cb_check(state) || !name) in __cpuhp_setup_state_cpuslocked()
1766 ret = cpuhp_store_callbacks(state, name, startup, teardown, in __cpuhp_setup_state_cpuslocked()
1769 dynstate = state == CPUHP_AP_ONLINE_DYN; in __cpuhp_setup_state_cpuslocked()
1771 state = ret; in __cpuhp_setup_state_cpuslocked()
1784 int cpustate = st->state; in __cpuhp_setup_state_cpuslocked()
1786 if (cpustate < state) in __cpuhp_setup_state_cpuslocked()
1789 ret = cpuhp_issue_call(cpu, state, true, NULL); in __cpuhp_setup_state_cpuslocked()
1792 cpuhp_rollback_install(cpu, state, NULL); in __cpuhp_setup_state_cpuslocked()
1793 cpuhp_store_callbacks(state, NULL, NULL, NULL, false); in __cpuhp_setup_state_cpuslocked()
1804 return state; in __cpuhp_setup_state_cpuslocked()
1809 int __cpuhp_setup_state(enum cpuhp_state state, in __cpuhp_setup_state() argument
1818 ret = __cpuhp_setup_state_cpuslocked(state, name, invoke, startup, in __cpuhp_setup_state()
1825 int __cpuhp_state_remove_instance(enum cpuhp_state state, in __cpuhp_state_remove_instance() argument
1828 struct cpuhp_step *sp = cpuhp_get_step(state); in __cpuhp_state_remove_instance()
1831 BUG_ON(cpuhp_cb_check(state)); in __cpuhp_state_remove_instance()
1839 if (!invoke || !cpuhp_get_teardown_cb(state)) in __cpuhp_state_remove_instance()
1848 int cpustate = st->state; in __cpuhp_state_remove_instance()
1850 if (cpustate >= state) in __cpuhp_state_remove_instance()
1851 cpuhp_issue_call(cpu, state, false, node); in __cpuhp_state_remove_instance()
1873 void __cpuhp_remove_state_cpuslocked(enum cpuhp_state state, bool invoke) in __cpuhp_remove_state_cpuslocked() argument
1875 struct cpuhp_step *sp = cpuhp_get_step(state); in __cpuhp_remove_state_cpuslocked()
1878 BUG_ON(cpuhp_cb_check(state)); in __cpuhp_remove_state_cpuslocked()
1886 state); in __cpuhp_remove_state_cpuslocked()
1890 if (!invoke || !cpuhp_get_teardown_cb(state)) in __cpuhp_remove_state_cpuslocked()
1900 int cpustate = st->state; in __cpuhp_remove_state_cpuslocked()
1902 if (cpustate >= state) in __cpuhp_remove_state_cpuslocked()
1903 cpuhp_issue_call(cpu, state, false, NULL); in __cpuhp_remove_state_cpuslocked()
1906 cpuhp_store_callbacks(state, NULL, NULL, NULL, false); in __cpuhp_remove_state_cpuslocked()
1911 void __cpuhp_remove_state(enum cpuhp_state state, bool invoke) in __cpuhp_remove_state() argument
1914 __cpuhp_remove_state_cpuslocked(state, invoke); in __cpuhp_remove_state()
1997 return sprintf(buf, "%d\n", st->state); in show_cpuhp_state()
1999 static DEVICE_ATTR(state, 0444, show_cpuhp_state, NULL);
2032 if (st->state < target) in write_cpuhp_target()
2206 const char *state = smt_states[cpu_smt_control]; in show_smt_control() local
2208 return snprintf(buf, PAGE_SIZE - 2, "%s\n", state); in show_smt_control()
2381 this_cpu_write(cpuhp_state.state, CPUHP_ONLINE); in boot_cpu_hotplug_init()