Chinaunix首页 | 论坛 | 博客
  • 博客访问: 201273
  • 博文数量: 213
  • 博客积分: 1685
  • 博客等级: 上尉
  • 技术积分: 1515
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-20 19:22
文章分类

全部博文(213)

文章存档

2016年(7)

2014年(63)

2013年(87)

2012年(56)

我的朋友

分类: LINUX

2012-10-18 10:22:24

#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) |
给主人留下些什么吧!~~