#define NR_CPUS CONFIG_NR_CPUS // CONFIG_NR_CPUS was set in .config file
unsigned int setup_max_cpus = NR_CPUS;
void __init smp_init(void)
{
unsigned int cpu;
/* FIXME: This should be done in userspace --RR */
for_each_present_cpu(cpu) {
if (num_online_cpus() >= setup_max_cpus)
break;
if (!cpu_online(cpu))
cpu_up(cpu);
}
/* Any cleanup work */
printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());
smp_cpus_done(setup_max_cpus);
}
cpu_up(cpu)
_cpu_up(cpu, 0)
__cpu_up(cpu)// in arch/arm/kernel/smp.c
boot_secondary() //in mach-xxxx/platsmp.c
gic_raise_softirq(cpumask_of(cpu), 1);
b secondary_start_kernel //arch/arm/kernel/head.S
secondary_start_kernel()// in arch/arm/kernel/smp.c
printk("CPU%u: Booted secondary processor\n", cpu);
set_cpu_online(cpu, true);
log:
[ 0.257168] CPU1: Booted secondary processor
[ 0.290003] CPU1: Unknown IPI message 0x1
[ 0.290027] Brought up 2 CPUs
[ 0.290039] SMP: Total of 2 processors activated (2393.70 BogoMIPS).
阅读(806) | 评论(0) | 转发(0) |