x86 arch的boot_cpu_id变量是如何初始化的

丸泥斗 2010-10-12 03:43:32
全部source tree的搜索结果如下:
[richard@PerfectLinux linux-2.6.35-rc2]$ find -type f|xargs grep "boot_cpu_id" -wn
./arch/alpha/kernel/smp.c:636: if (hard_smp_processor_id() != boot_cpu_id)
./arch/ia64/kernel/smpboot.c:579: int boot_cpu_id = hard_smp_processor_id();
./arch/ia64/kernel/smpboot.c:585: ia64_cpu_to_sapicid[0] = boot_cpu_id;
./arch/ia64/kernel/smpboot.c:591: if (sapicid == boot_cpu_id)
./arch/ia64/kernel/smpboot.c:606: int boot_cpu_id = hard_smp_processor_id();
./arch/ia64/kernel/smpboot.c:621: ia64_cpu_to_sapicid[0] = boot_cpu_id;
./arch/ia64/kernel/smpboot.c:623: printk(KERN_INFO "Boot processor id 0x%x/0x%x\n", 0, boot_cpu_id);
./arch/sparc/include/asm/smp_32.h:31:extern unsigned char boot_cpu_id;
./arch/sparc/include/asm/smp_32.h:135: "sethi %%hi(boot_cpu_id), %0\n\t"
./arch/sparc/include/asm/smp_32.h:136: "ldub [%0 + %%lo(boot_cpu_id)], %0\n\t" :
./arch/sparc/kernel/head_32.S:820: sethi %hi(boot_cpu_id), %g1 ! master always 0
./arch/sparc/kernel/head_32.S:821: stb %g0, [%g1 + %lo(boot_cpu_id)]
./arch/sparc/kernel/head_32.S:895: sethi %hi(boot_cpu_id), %g5
./arch/sparc/kernel/head_32.S:896: stb %g4, [%g5 + %lo(boot_cpu_id)]
./arch/sparc/kernel/head_32.S:1029: * But first make current_set[boot_cpu_id] point to something useful.
./arch/sparc/kernel/leon_smp.c:52:extern unsigned char boot_cpu_id;
./arch/sparc/kernel/smp_32.c:40:unsigned char boot_cpu_id = 0;
./arch/sparc/kernel/smp_32.c:41:unsigned char boot_cpu_id4 = 0; /* boot_cpu_id << 2 */
./arch/sparc/kernel/smp_32.c:296: smp_store_cpu_info(boot_cpu_id);
./arch/sparc/kernel/sun4d_irq.c:399: if ((board * 2) == boot_cpu_id && cpu_isset(board * 2 + 1, cpu_present_map))
./arch/sparc/kernel/sun4d_irq.c:547: target_cpu = boot_cpu_id;
./arch/sparc/kernel/sun4d_smp.c:48:extern unsigned char boot_cpu_id;
./arch/sparc/kernel/sun4d_smp.c:168: if (boot_cpu_id)
./arch/sparc/kernel/sun4m_smp.c:43:extern unsigned char boot_cpu_id;
./arch/sparc/kernel/sun4m_smp.c:326: if(cpu == boot_cpu_id)
./arch/x86/include/asm/apb_timer.h:57:extern unsigned int boot_cpu_id;
./arch/x86/include/asm/cpu.h:35:extern unsigned int boot_cpu_id;
./arch/x86/kernel/apb_timer.c:370: if (cpu == boot_cpu_id)
./arch/x86/kernel/apic/io_apic.c:165: node= cpu_to_node(boot_cpu_id);
./arch/x86/kernel/apic/io_apic.c:1486: int node = cpu_to_node(boot_cpu_id);
./arch/x86/kernel/apic/io_apic.c:1551: int node = cpu_to_node(boot_cpu_id);
./arch/x86/kernel/apic/io_apic.c:2928: int node = cpu_to_node(boot_cpu_id);
./arch/x86/kernel/apic/io_apic.c:3282: int node = cpu_to_node(boot_cpu_id);
./arch/x86/kernel/apic/io_apic.c:3904: node = cpu_to_node(boot_cpu_id);
./arch/x86/kernel/cpu/amd.c:151: if (c->cpu_index == boot_cpu_id)
./arch/x86/kernel/cpu/common.c:649: c->cpu_index = boot_cpu_id;
./arch/x86/kernel/cpu/common.c:1258: if (smp_processor_id() == boot_cpu_id)
./arch/x86/kernel/cpu/intel.c:172: if (c->cpu_index == boot_cpu_id)
./arch/x86/kernel/reboot.c:87: have set up boot_cpu_id or smp_num_cpu */
./arch/x86/kernel/setup.c:127:unsigned int boot_cpu_id __read_mostly;
./arch/x86/kernel/setup_percpu.c:247: if (cpu == boot_cpu_id)
./arch/x86/kernel/setup_percpu.c:265: set_cpu_numa_node(boot_cpu_id, early_cpu_to_node(boot_cpu_id));
./arch/x86/mm/k8topology_64.c:57: * need to get boot_cpu_id so can use that to create apicid_to_node
./arch/x86/mm/k8topology_64.c:215: /* need to get boot_cpu_id early for system with apicid lifting */
[richard@PerfectLinux linux-2.6.35-rc2]$

就是看不到赋值的地方,很奇怪呀!
...全文
77 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
deep_pro 2010-10-13
我只能够猜测.data.read_mostly段 会全部被初始化为0
回复
丸泥斗 2010-10-13
大家帮忙看看呀,很奇怪的问题!
应该浏览源代码就能找到答案的。
回复
丸泥斗 2010-10-12
不好意思,我忘了强调内核版本是2.6.35-rc2,arch是x86,所以ia64目录下的应该没有编译到。
回复
deep_pro 2010-10-12
arch/ia64/kernel/smpboot.c

int boot_cpu_id = hard_smp_processor_id();
.....
ia64_cpu_to_sapicid[0] = boot_cpu_id;
回复
相关推荐
发帖
Linux_Kernel
创建于2007-08-27

4152

社区成员

Linux/Unix社区 内核源代码研究区
申请成为版主
帖子事件
创建了帖子
2010-10-12 03:43
社区公告
暂无公告