/* * cpu_up: * * Flag specified cpu as up and running. Called when a processor comes * online. */ void cpu_up( int cpu) { register struct machine_slot *ms; register processor_t processor; spl_t s; processor = cpu_to_processor(cpu); /* * Can't risk blocking with no current thread established. * Just twiddle our thumbs; we've got nothing better to do * yet, anyway. */ while (!pset_lock_try(&default_pset)) ; s = splsched(); processor_lock(processor); #if NCPUS > 1 init_ast_check(processor); #endif /* NCPUS > 1 */ ms = &machine_slot[cpu]; ms->running = TRUE; machine_info.avail_cpus++; pset_add_processor(&default_pset, processor); processor->state = PROCESSOR_RUNNING; processor_unlock(processor); splx(s); pset_unlock(&default_pset); }
/* * processor_up: * * Flag processor as up and running, and available * for scheduling. */ void processor_up( processor_t processor) { processor_set_t pset; spl_t s; s = splsched(); init_ast_check(processor); pset = processor->processor_set; pset_lock(pset); ++pset->online_processor_count; enqueue_tail(&pset->active_queue, (queue_entry_t)processor); processor->state = PROCESSOR_RUNNING; (void)hw_atomic_add(&processor_avail_count, 1); commpage_update_active_cpus(); pset_unlock(pset); ml_cpu_up(); splx(s); #if CONFIG_DTRACE if (dtrace_cpu_state_changed_hook) (*dtrace_cpu_state_changed_hook)(processor->cpu_id, TRUE); #endif }