Skip to contentSkip to conversation

sparc32 compile error: redefinition of ‘smp_call_function_single’

DISCUSSION David Miller 4 participants 8 messages Jan 14, 2009 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

From: Robert Reif <[email protected]>
Date: Tue, 13 Jan 2009 20:40:04 -0500

Quoted 4 lines

Todays git produces this compile error on sparc32:

kernel/up.c:10: error: redefinition of ‘smp_call_function_single’ /usr/src/sparc32/linux-2.6/arch/sparc/include/asm/smp_32.h:78: error: previous definition of ‘smp_call_function_single’ was here

Andrew, are you sure that Makefile condition for compiling up.o is correct?

ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
obj-y += smp.o
else
obj-y += up.o
endif

If an arch doesn't use generic SMP helpers, there is no way we should compile up.c into the tree when SMP.

This build regression was caused by:

commit 53ce3d9564908794ae7dd32969089b57df5fc098

Author: Andrew Morton <[email protected]>
Date:   Fri Jan 9 12:27:08 2009 -0800

smp_call_function_single(): be slightly less stupid

If you do

smp_call_function_single(expression-with-side-effects, ...)

then expression-with-side-effects never gets evaluated on UP builds.

As always, implementing it in C is the correct thing to do.

While we're there, uninline it for size and possible header dependency reasons.

And create a new kernel/up.c, as a place in which to put uniprocessor-specific code and storage. It should mirror kernel/smp.c.

���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#2 lore raw
Quoted 10 lines · On Tue, 13 Jan 2009 18:10:39 -0800 (PST) David Miller <[email protected]>…

From: Robert Reif <[email protected]>
Date: Tue, 13 Jan 2009 20:40:04 -0500

Quoted 4 lines

Todays git produces this compile error on sparc32:

kernel/up.c:10: error: redefinition of ___smp_call_function_single___ /usr/src/sparc32/linux-2.6/arch/sparc/include/asm/smp_32.h:78: error: previous definition of ___smp_call_function_single___ was here

Andrew, are you sure that Makefile condition for compiling up.o is correct?

you give me grounds for now being ;)

Quoted 9 lines

ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
obj-y += smp.o
else
obj-y += up.o
endif

If an arch doesn't use generic SMP helpers, there is no way we should compile up.c into the tree when SMP.

How's about this?

kernel/Makefile renamed from kernel/Makefile~a +1 -1
@@ -43,7 +43,7 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
 ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
 obj-y += smp.o
 else
-obj-y += up.o
+obj-$(CONFIG_SMP) += up.o
 endif
 obj-$(CONFIG_SMP) += spinlock.o
 obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o

_

#3 lore raw
Quoted 30 lines · On Tue, 13 Jan 2009 18:42:39 -0800 Andrew Morton <[email protected]>…
Quoted 10 lines · On Tue, 13 Jan 2009 18:10:39 -0800 (PST) David Miller <[email protected]>…

From: Robert Reif <[email protected]>
Date: Tue, 13 Jan 2009 20:40:04 -0500

Quoted 4 lines

Todays git produces this compile error on sparc32:

kernel/up.c:10: error: redefinition of ___smp_call_function_single___ /usr/src/sparc32/linux-2.6/arch/sparc/include/asm/smp_32.h:78: error: previous definition of ___smp_call_function_single___ was here

Andrew, are you sure that Makefile condition for compiling up.o is correct?

you give me grounds for now being ;)

Quoted 9 lines

ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
obj-y += smp.o
else
obj-y += up.o
endif

If an arch doesn't use generic SMP helpers, there is no way we should compile up.c into the tree when SMP.

How's about this?

kernel/Makefile obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o · line 49

Quoted 8 lines
kernel/Makefile renamed from kernel/Makefile~a +1 -1
@@ -43,7 +43,7 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
 ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
 obj-y += smp.o
 else
-obj-y += up.o
+obj-$(CONFIG_SMP) += up.o
 endif
 obj-$(CONFIG_SMP) += spinlock.o
 obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o

err, the other way of course...

kernel/Makefile renamed from kernel/Makefile~a +1 -0
@@ -43,6 +43,7 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
 ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
 obj-y += smp.o
 else
+ifneq ($(CONFIG_SMP),y)
 obj-y += up.o
 endif
 obj-$(CONFIG_SMP) += spinlock.o

_

#4 lore raw
Quoted 58 lines · Andrew Morton
Quoted 34 lines · On Tue, 13 Jan 2009 18:42:39 -0800 Andrew Morton <[email protected]>…
Quoted 4 lines · On Tue, 13 Jan 2009 18:10:39 -0800 (PST) David Miller <[email protected]>…

From: Robert Reif <[email protected]>
Date: Tue, 13 Jan 2009 20:40:04 -0500

Quoted 8 lines
Quoted 5 lines

Todays git produces this compile error on sparc32:

kernel/up.c:10: error: redefinition of ___smp_call_function_single___ /usr/src/sparc32/linux-2.6/arch/sparc/include/asm/smp_32.h:78: error: previous definition of ___smp_call_function_single___ was here

Andrew, are you sure that Makefile condition for compiling up.o is correct?

you give me grounds for now being ;)

Quoted 10 lines

ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
obj-y += smp.o
else
obj-y += up.o
endif

If an arch doesn't use generic SMP helpers, there is no way we should compile up.c into the tree when SMP.

How's about this?

kernel/Makefile obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o · line 49

Quoted 8 lines
kernel/Makefile renamed from kernel/Makefile~a +1 -1
@@ -43,7 +43,7 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
 ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
 obj-y += smp.o
 else
-obj-y += up.o
+obj-$(CONFIG_SMP) += up.o
 endif
 obj-$(CONFIG_SMP) += spinlock.o
 obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o

err, the other way of course...

kernel/Makefile renamed from kernel/Makefile~a +1 -0
@@ -43,6 +43,7 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
 ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
 obj-y += smp.o
 else
+ifneq ($(CONFIG_SMP),y)
 obj-y += up.o
 endif
 obj-$(CONFIG_SMP) += spinlock.o
Quoted 5 lines

_

This worked:

kernel/Makefile +2 -0
index 2aebc4c..368227d 100644
@@ -43,8 +43,10 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
 ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
 obj-y += smp.o
 else
+ifneq ($(CONFIG_SMP),y)
 obj-y += up.o
 endif
+endif
 obj-$(CONFIG_SMP) += spinlock.o
 obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
 obj-$(CONFIG_PROVE_LOCKING) += spinlock.o
#5 lore raw
Quoted 7 lines · On Tue, 13 Jan 2009 22:38:01 -0500 Robert Reif <[email protected]> wrote:

This worked:

kernel/Makefile +0 -0
index 2aebc4c..368227d 100644

kernel/Makefile obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o · line 52

Quoted 10 lines
kernel/Makefile +2 -0
@@ -43,8 +43,10 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
 ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
 obj-y += smp.o
 else
+ifneq ($(CONFIG_SMP),y)
 obj-y += up.o
 endif
+endif
 obj-$(CONFIG_SMP) += spinlock.o
 obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
 obj-$(CONFIG_PROVE_LOCKING) += spinlock.o

This all can be simplified, can't it?

obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
ifneq ($(CONFIG_SMP),y)
obj-y += up.o
endif

(someone please check my homework - I don't have a good track record here ;))

kernel/Makefile renamed from kernel/Makefile~kernel-upc-omit-it-if-smp=y-use_generic_smp_helpers=n +2 -3
@@ -40,9 +40,8 @@ obj-$(CONFIG_RT_MUTEXES) += rtmutex.o
 obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
 obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
 obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
-ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
-obj-y += smp.o
-else
+obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
+ifneq ($(CONFIG_SMP),y)
 obj-y += up.o
 endif
 obj-$(CONFIG_SMP) += spinlock.o

_

#6 lore raw
Quoted 22 lines · Andrew Morton
Quoted 7 lines · On Tue, 13 Jan 2009 22:38:01 -0500 Robert Reif <[email protected]> wrote:

This worked:

kernel/Makefile +0 -0
index 2aebc4c..368227d 100644

kernel/Makefile obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o · line 52

Quoted 10 lines
kernel/Makefile +2 -0
@@ -43,8 +43,10 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
 ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
 obj-y += smp.o
 else
+ifneq ($(CONFIG_SMP),y)
 obj-y += up.o
 endif
+endif
 obj-$(CONFIG_SMP) += spinlock.o
 obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
 obj-$(CONFIG_PROVE_LOCKING) += spinlock.o

This all can be simplified, can't it?

Quoted 7 lines

obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
ifneq ($(CONFIG_SMP),y)
obj-y += up.o
endif

(someone please check my homework - I don't have a good track record here ;))

Looks correct. We pull in smp.o only for SPARC64 AND SMP

But I find the next lines distastefull in a Makefile:

Quoted 3 lines

ifneq ($(CONFIG_SMP),y)
obj-y += up.o
endif

I would prefer a small Kconfig helper symbol:

config SPARC_UP
def_bool y
depends on !SMP

And then we would do the Makefile bits like this:
obj-$(CONFIG_SPARC_UP) += up.o

So maybe a bit more involved patch - but more readable IMO. Robert - can I ask you to fix it up if you and others agree.

Thanks,
Sam

#7 lore raw
Quoted 28 lines · On Wed, 14 Jan 2009 16:32:55 +0100 Sam Ravnborg <[email protected]> wrote:
Quoted 27 lines · Andrew Morton
Quoted 7 lines · On Tue, 13 Jan 2009 22:38:01 -0500 Robert Reif <[email protected]> wrote:

This worked:

kernel/Makefile +0 -0
index 2aebc4c..368227d 100644

kernel/Makefile obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o · line 52

Quoted 10 lines
kernel/Makefile +2 -0
@@ -43,8 +43,10 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
 ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
 obj-y += smp.o
 else
+ifneq ($(CONFIG_SMP),y)
 obj-y += up.o
 endif
+endif
 obj-$(CONFIG_SMP) += spinlock.o
 obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
 obj-$(CONFIG_PROVE_LOCKING) += spinlock.o

This all can be simplified, can't it?

obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
ifneq ($(CONFIG_SMP),y)
obj-y += up.o
endif

Quoted 4 lines
Quoted 2 lines

(someone please check my homework - I don't have a good track record here ;))

Looks correct. We pull in smp.o only for SPARC64 AND SMP

SPARC64=n and SMP, actually (assuming sparc64 is the only USE_GENERIC_SMP_HELPERS=n arch)

Quoted 4 lines

But I find the next lines distastefull in a Makefile:

Quoted 3 lines

ifneq ($(CONFIG_SMP),y)
obj-y += up.o
endif

me too.

Quoted 8 lines

I would prefer a small Kconfig helper symbol:

config SPARC_UP
def_bool y
depends on !SMP

And then we would do the Makefile bits like this:
obj-$(CONFIG_SPARC_UP) += up.o

eek. Mentioning sparc explicitly in kernel/Makefile is badder.

we could remove zillions of these conditionals if something somewhere were to generate negated symbols for us. Say, when kbuild sees CONFIG_SMP=y, it will generate another symbol: NOT_CONFIG_SMP=y. So then we can do

obj-$NOT_CONFIG_SMP += up.o

Or is that too cheesy?

#8 lore raw
Quoted 47 lines · Andrew Morton
Quoted 28 lines · On Wed, 14 Jan 2009 16:32:55 +0100 Sam Ravnborg <[email protected]> wrote:
Quoted 27 lines · Andrew Morton
Quoted 7 lines · On Tue, 13 Jan 2009 22:38:01 -0500 Robert Reif <[email protected]> wrote:

This worked:

kernel/Makefile +0 -0
index 2aebc4c..368227d 100644

kernel/Makefile obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o · line 52

Quoted 10 lines
kernel/Makefile +2 -0
@@ -43,8 +43,10 @@ obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
 ifeq ($(CONFIG_USE_GENERIC_SMP_HELPERS),y)
 obj-y += smp.o
 else
+ifneq ($(CONFIG_SMP),y)
 obj-y += up.o
 endif
+endif
 obj-$(CONFIG_SMP) += spinlock.o
 obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
 obj-$(CONFIG_PROVE_LOCKING) += spinlock.o

This all can be simplified, can't it?

obj-$(CONFIG_USE_GENERIC_SMP_HELPERS) += smp.o
ifneq ($(CONFIG_SMP),y)
obj-y += up.o
endif

Quoted 4 lines
Quoted 2 lines

(someone please check my homework - I don't have a good track record here ;))

Looks correct. We pull in smp.o only for SPARC64 AND SMP

SPARC64=n and SMP, actually (assuming sparc64 is the only USE_GENERIC_SMP_HELPERS=n arch)

Quoted 4 lines

But I find the next lines distastefull in a Makefile:

Quoted 3 lines

ifneq ($(CONFIG_SMP),y)
obj-y += up.o
endif

me too.

Quoted 2 lines

I would prefer a small Kconfig helper symbol:

Quoted 8 lines
Quoted 6 lines

config SPARC_UP
def_bool y
depends on !SMP

And then we would do the Makefile bits like this:
obj-$(CONFIG_SPARC_UP) += up.o

eek. Mentioning sparc explicitly in kernel/Makefile is badder.

Ups - I my horry I did not notice this was _taht_ kernel/Makefile.

Quoted 9 lines

we could remove zillions of these conditionals if something somewhere were to generate negated symbols for us. Say, when kbuild sees CONFIG_SMP=y, it will generate another symbol: NOT_CONFIG_SMP=y. So then we can do

obj-$NOT_CONFIG_SMP += up.o

Or is that too cheesy?

If we can remove a zillion lines - then no.
But maybe the actual figure is a bit less :-)

Sam