瀏覽代碼

[PATCH] x86, x86_64: dual core proc-cpuinfo and sibling-map fix

- broken sibling_map setup in x86_64

- grouping all the core and HT related cpuinfo fields.
  We are reasonably sure that adding new cpuinfo fields after "siblings" field,
  will not cause any app failure. Thats because today's /proc/cpuinfo
  format is completely different on x86, x86_64 and we haven't heard of any
  x86 app breakage because of this issue. Grouping these fields will 
  result in more or less common format on all architectures (ia64, x86 and 
  x86_64) and will cause less confusion.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Siddha, Suresh B 20 年之前
父節點
當前提交
d31ddaa172
共有 3 個文件被更改,包括 6 次插入16 次删除
  1. 2 7
      arch/i386/kernel/cpu/proc.c
  2. 3 8
      arch/x86_64/kernel/setup.c
  3. 1 1
      arch/x86_64/kernel/smpboot.c

+ 2 - 7
arch/i386/kernel/cpu/proc.c

@@ -98,6 +98,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		seq_printf(m, "physical id\t: %d\n", phys_proc_id[n]);
 		seq_printf(m, "physical id\t: %d\n", phys_proc_id[n]);
 		seq_printf(m, "siblings\t: %d\n",
 		seq_printf(m, "siblings\t: %d\n",
 				c->x86_num_cores * smp_num_siblings);
 				c->x86_num_cores * smp_num_siblings);
+		seq_printf(m, "core id\t\t: %d\n", cpu_core_id[n]);
+		seq_printf(m, "cpu cores\t: %d\n", c->x86_num_cores);
 	}
 	}
 #endif
 #endif
 	
 	
@@ -130,13 +132,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		     c->loops_per_jiffy/(500000/HZ),
 		     c->loops_per_jiffy/(500000/HZ),
 		     (c->loops_per_jiffy/(5000/HZ)) % 100);
 		     (c->loops_per_jiffy/(5000/HZ)) % 100);
 
 
-#ifdef CONFIG_SMP
-	/* Put new fields at the end to lower the probability of
-	   breaking user space parsers. */
-	seq_printf(m, "core id\t\t: %d\n", cpu_core_id[n]);
-	seq_printf(m, "cpu cores\t: %d\n", c->x86_num_cores);
-#endif
-
 	return 0;
 	return 0;
 }
 }
 
 

+ 3 - 8
arch/x86_64/kernel/setup.c

@@ -1152,6 +1152,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		seq_printf(m, "physical id\t: %d\n", phys_proc_id[cpu]);
 		seq_printf(m, "physical id\t: %d\n", phys_proc_id[cpu]);
 		seq_printf(m, "siblings\t: %d\n",
 		seq_printf(m, "siblings\t: %d\n",
 				c->x86_num_cores * smp_num_siblings);
 				c->x86_num_cores * smp_num_siblings);
+		seq_printf(m, "core id\t\t: %d\n", cpu_core_id[cpu]);
+		seq_printf(m, "cpu cores\t: %d\n", c->x86_num_cores);
 	}
 	}
 #endif	
 #endif	
 
 
@@ -1195,15 +1197,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 			}
 			}
 	}
 	}
 
 
-	seq_printf(m, "\n");
+	seq_printf(m, "\n\n");
 
 
-#ifdef CONFIG_SMP
-	/* Put new fields at the end to lower the probability of
-	   breaking user space parsers. */
-	seq_printf(m, "core id\t\t: %d\n", cpu_core_id[c - cpu_data]);
-	seq_printf(m, "cpu cores\t: %d\n", c->x86_num_cores);
-#endif
-	seq_printf(m, "\n");
 	return 0;
 	return 0;
 }
 }
 
 

+ 1 - 1
arch/x86_64/kernel/smpboot.c

@@ -652,7 +652,7 @@ static __cpuinit void detect_siblings(void)
 		int i;
 		int i;
 		if (smp_num_siblings > 1) {
 		if (smp_num_siblings > 1) {
 			for_each_online_cpu (i) {
 			for_each_online_cpu (i) {
-				if (cpu_core_id[cpu] == phys_proc_id[i]) {
+				if (cpu_core_id[cpu] == cpu_core_id[i]) {
 					siblings++;
 					siblings++;
 					cpu_set(i, cpu_sibling_map[cpu]);
 					cpu_set(i, cpu_sibling_map[cpu]);
 				}
 				}