arch/um/kernel/smp.c
Source file repositories/reference/linux-study-clean/arch/um/kernel/smp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/um/kernel/smp.c- Extension
.c- Size
- 4929 bytes
- Lines
- 243
- Domain
- Architecture Layer
- Bucket
- arch/um
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/sched.hlinux/sched/task.hlinux/sched/task_stack.hlinux/module.hlinux/processor.hlinux/threads.hlinux/cpu.hlinux/hardirq.hlinux/smp.hlinux/smp-internal.hinit.hkern.hos.hsmp.h
Detected Declarations
function arch_smp_send_reschedulefunction arch_send_call_function_single_ipifunction arch_send_call_function_ipi_maskfunction smp_send_stopfunction for_each_online_cpufunction ipi_handlerfunction uml_ipi_handlerfunction start_secondaryfunction uml_start_secondaryfunction smp_prepare_cpusfunction for_each_possible_cpufunction __cpu_upfunction smp_cpus_donefunction prefill_possible_mapfunction uml_ncpus_setupexport uml_curr_cpu
Annotated Snippet
if (err) {
pr_crit("CPU#%d failed to start cpu thread, err = %d",
cpu, err);
continue;
}
deadline = jiffies + msecs_to_jiffies(1000);
spin_until_cond(cpu_present(cpu) ||
time_is_before_jiffies(deadline));
if (!cpu_present(cpu))
pr_crit("CPU#%d failed to boot\n", cpu);
}
}
int __cpu_up(unsigned int cpu, struct task_struct *tidle)
{
cpu_tasks[cpu] = tidle;
smp_wmb(); /* paired with smp_rmb() in uml_start_secondary() */
cpu_states[cpu] = UML_CPU_RUNNING;
os_futex_wake(&cpu_states[cpu]);
spin_until_cond(cpu_online(cpu));
return 0;
}
void __init smp_cpus_done(unsigned int max_cpus)
{
}
/* Set in uml_ncpus_setup */
int uml_ncpus = 1;
void __init prefill_possible_map(void)
{
int cpu;
for (cpu = 0; cpu < uml_ncpus; cpu++)
set_cpu_possible(cpu, true);
for (; cpu < NR_CPUS; cpu++)
set_cpu_possible(cpu, false);
}
static int __init uml_ncpus_setup(char *line, int *add)
{
*add = 0;
if (kstrtoint(line, 10, ¨_ncpus)) {
os_warn("%s: Couldn't parse '%s'\n", __func__, line);
return -1;
}
uml_ncpus = clamp(uml_ncpus, 1, NR_CPUS);
return 0;
}
__uml_setup("ncpus=", uml_ncpus_setup,
"ncpus=<# of desired CPUs>\n"
" This tells UML how many virtual processors to start. The maximum\n"
" number of supported virtual processors can be obtained by querying\n"
" the CONFIG_NR_CPUS option using --showconfig.\n\n"
);
EXPORT_SYMBOL(uml_curr_cpu);
Annotation
- Immediate include surface: `linux/sched.h`, `linux/sched/task.h`, `linux/sched/task_stack.h`, `linux/module.h`, `linux/processor.h`, `linux/threads.h`, `linux/cpu.h`, `linux/hardirq.h`.
- Detected declarations: `function arch_smp_send_reschedule`, `function arch_send_call_function_single_ipi`, `function arch_send_call_function_ipi_mask`, `function smp_send_stop`, `function for_each_online_cpu`, `function ipi_handler`, `function uml_ipi_handler`, `function start_secondary`, `function uml_start_secondary`, `function smp_prepare_cpus`.
- Atlas domain: Architecture Layer / arch/um.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.