Skip to contentSkip to conversation

conflicting per_cpu_init() defines on non-SMP

PATCH dann frazier 2 participants 3 messages Mar 9, 2005 – Mar 13, 2005

lore
Share & tools
lore
#0 lore raw

In 2.6.11 arch/ia64/mm/discontig.c defines a per_cpu_init() function; however, non-SMP systems have a per_cpu_init macro defined in include/asm-ia64/percpu.h.

#define per_cpu_init() (__phys_per_cpu_start)

Is this the right way to approach a patch to fix this?

arch/ia64/mm/discontig.c +4 -0
diff -urN linux-2.6.11.orig/arch/ia64/mm/discontig.c linux-2.6.11/arch/ia64/mm/discontig.c
@@ -525,6 +524,7 @@
  * find_pernode_space() does most of this already, we just need to set
  * local_per_cpu_offset
  */
+#ifdef CONFIG_SMP
 void *per_cpu_init(void)
 {
 	int cpu;
@@ -538,6 +538,9 @@
 
 	return __per_cpu_start + __per_cpu_offset[smp_processor_id()];
 }
+#else
+#define per_cpu_init()                          (__phys_per_cpu_start)
+#endif
 
 /**
  * show_mem - give short summary of memory stats
include/asm-ia64/percpu.h +0 -1
diff -urN linux-2.6.11.orig/include/asm-ia64/percpu.h linux-2.6.11/include/asm-ia64/percpu.h
@@ -52,7 +52,6 @@
 
 #define per_cpu(var, cpu)			(*((void)cpu, &per_cpu__##var))
 #define __get_cpu_var(var)			per_cpu__##var
-#define per_cpu_init()				(__phys_per_cpu_start)
 
 #endif	/* SMP */
 
Signature · 1 line
dann frazier <[email protected]>
#1 lore raw
Quoted 1 line · dann frazier

Is this the right way to approach a patch to fix this?

It looks right. But I'd expect arch/ia64/mm/discontig.c to use whats in the header file so everyone is using the same definition.

Quoted 2 lines

+#ifdef CONFIG_SMP
void *per_cpu_init(void)

...

ie move that bit to asm-ia64/percpu.h

grant

#2 lore raw
In reply to dann frazier
Quoted 11 lines · Grant Grundler
Quoted 1 line · dann frazier

Is this the right way to approach a patch to fix this?

It looks right. But I'd expect arch/ia64/mm/discontig.c to use whats in the header file so everyone is using the same definition.

Quoted 2 lines

+#ifdef CONFIG_SMP
void *per_cpu_init(void)

...

ie move that bit to asm-ia64/percpu.h

Thanks Grant.
I took a closer look at Jesse's fixes, and he had already solved this in a different way. I'll stick with his method.

Signature · 1 line
dann frazier <[email protected]>