Skip to contentSkip to conversation

x86: export cpu_llc_id for edac drivers

PATCH In review Amerigo Wang 3 participants 4 messages Sep 15, 2009 – Sep 16, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: export cpu_llc_id for edac drivers

When I compiled today's Linus tree, I got a link error from drivers/edac/edac_mce_amd.c:408, it complained about not finding symbol 'per_cpu__cpu_llc_id'. This is due to we don't export 'cpu_llc_id'.

This patch fixes it.

Cc H. Peter Anvin <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Yinghai Lu <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Mike Travis <[email protected]>

---

arch/x86/kernel/smpboot.c +1 -0
index c36cc14..3241773 100644
@@ -99,6 +99,7 @@ EXPORT_SYMBOL(smp_num_siblings);
 
 /* Last level cache ID of each logical CPU */
 DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID;
+EXPORT_PER_CPU_SYMBOL(cpu_llc_id);
 
 /* representing HT siblings of each logical CPU */
 DEFINE_PER_CPU(cpumask_var_t, cpu_sibling_map);
Acked-by on v1 1/1
#1 lore raw

Heh.. was about to send out the same patch.

Quoted 7 lines · Amerigo Wang

When I compiled today's Linus tree, I got a link error from drivers/edac/edac_mce_amd.c:408, it complained about not finding symbol 'per_cpu__cpu_llc_id'. This is due to we don't export 'cpu_llc_id'.

This patch fixes it.

Quoted 8 lines
Cc H. Peter Anvin <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Yinghai Lu <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Mike Travis <[email protected]>

Thanks.

Signature · 1 line
tejun
#2 lore raw
Quoted 1 line · Tejun Heo

Heh.. was about to send out the same patch.

Maybe a better fix would be to provide a wrapper for this. See attached patch.

Regards,
Andreas

---
x86, edac: Provide function to return NodeId for CPU

arch/x86/include/asm/processor.h +2 -0
index e08ea04..42a3f93 100644
@@ -1020,4 +1020,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
 extern int get_tsc_mode(unsigned long adr);
 extern int set_tsc_mode(unsigned int val);
 
+extern int amd_get_nb_id(int cpu);
+
 #endif /* _ASM_X86_PROCESSOR_H */
arch/x86/kernel/cpu/amd.c +10 -0
index 22a47c8..f32fa71 100644
@@ -333,6 +333,16 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
 #endif
 }
 
+int amd_get_nb_id(int cpu)
+{
+	int id = 0;
+#ifdef CONFIG_SMP
+	id = per_cpu(cpu_llc_id, cpu);
+#endif
+	return id;
+}
+EXPORT_SYMBOL_GPL(amd_get_nb_id);
+
 static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
 {
 #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
drivers/edac/edac_mce_amd.c +1 -1
index c8ca713..0c21c37 100644
@@ -405,7 +405,7 @@ void decode_mce(struct mce *m)
 		regs.nbsh  = (u32)(m->status >> 32);
 		regs.nbeal = (u32) m->addr;
 		regs.nbeah = (u32)(m->addr >> 32);
-		node       = per_cpu(cpu_llc_id, m->extcpu);
+		node       = amd_get_nb_id(m->extcpu);
 
 		amd_decode_nb_mce(node, &regs, 1);
 		break;
author Reviewed-by
#3 lore raw
Quoted 6 lines · Andreas Herrmann
Quoted 1 line · Tejun Heo

Heh.. was about to send out the same patch.

Maybe a better fix would be to provide a wrapper for this. See attached patch.

Agreed.

Quoted 8 lines

Regards,
Andreas

---
x86, edac: Provide function to return NodeId for CPU

Thanks.

Quoted 47 lines
arch/x86/include/asm/processor.h +2 -0
index e08ea04..42a3f93 100644
@@ -1020,4 +1020,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
 extern int get_tsc_mode(unsigned long adr);
 extern int set_tsc_mode(unsigned int val);
 
+extern int amd_get_nb_id(int cpu);
+
 #endif /* _ASM_X86_PROCESSOR_H */
arch/x86/kernel/cpu/amd.c +10 -0
index 22a47c8..f32fa71 100644
@@ -333,6 +333,16 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
 #endif
 }
 
+int amd_get_nb_id(int cpu)
+{
+	int id = 0;
+#ifdef CONFIG_SMP
+	id = per_cpu(cpu_llc_id, cpu);
+#endif
+	return id;
+}
+EXPORT_SYMBOL_GPL(amd_get_nb_id);
+
 static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
 {
 #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
drivers/edac/edac_mce_amd.c +1 -1
index c8ca713..0c21c37 100644
@@ -405,7 +405,7 @@ void decode_mce(struct mce *m)
 		regs.nbsh  = (u32)(m->status >> 32);
 		regs.nbeal = (u32) m->addr;
 		regs.nbeah = (u32)(m->addr >> 32);
-		node       = per_cpu(cpu_llc_id, m->extcpu);
+		node       = amd_get_nb_id(m->extcpu);
 
 		amd_decode_nb_mce(node, &regs, 1);
 		break;