sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sparc64: Build failure due to commit f1600e549b94 (sparc: Make sparc64 use scalable lib/iommu-common
@ 2015-04-18  5:47 Guenter Roeck
  2015-04-18 10:59 ` sparc64: Build failure due to commit f1600e549b94 (sparc: Make sparc64 use scalable lib/iommu-co Sowmini Varadhan
  2015-04-18 12:05 ` Sowmini Varadhan
  0 siblings, 2 replies; 21+ messages in thread
From: Guenter Roeck @ 2015-04-18  5:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sowmini Varadhan, David S. Miller, sparclinux

Hi all,

I see the following build failure when compiling sparc64:allmodconfig
in the upstream kernel (v4.0-7820-g04b7fe6a4a23).

arch/sparc/kernel/pci_sun4v.o:(.discard+0x1): multiple definition of `__pcpu_unique_iommu_pool_hash'
arch/sparc/kernel/iommu.o:(.discard+0x0): first defined here
make[2]: *** [arch/sparc/kernel/built-in.o] Error 1
make[1]: *** [arch/sparc/kernel] Error 2

The problem is caused by commit f1600e549b94 ("sparc: Make sparc64
use scalable lib/iommu-common.c functions"), which introduces 

static DEFINE_PER_CPU(unsigned int, iommu_pool_hash);

in both files.

DEFINE_PER_CPU translates to DEFINE_PER_CPU_SECTION, which in turn is
defined as

#define DEFINE_PER_CPU_SECTION(type, name, sec)                         \
        __PCPU_DUMMY_ATTRS char __pcpu_scope_##name;                    \
	extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name;		\
-->	__PCPU_DUMMY_ATTRS char __pcpu_unique_##name;			\
	extern __PCPU_ATTRS(sec) __typeof__(type) name;			\
	__PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak                 \
					        __typeof__(type) name

if CONFIG_DEBUG_FORCE_WEAK_PER_CPU is configured, which is the case here.
The marked line above shows that __pcpu_unique_iommu_pool_hash is declared as
global variable, which explains the problem (and makes me wonder what the
'static' keyword in front of DEFINE_PER_CPU is supposed to accomplish).

I thought about fixing the problem by renaming one of the variables, but
I am not sure if that is what is intended. Specifically, I am not sure if
the variables are supposed to be different, as it looks like, or if they
are supposed to be the same.

In case it is relevant, I use gcc version 4.6.3 for my build test.

Guenter

^ permalink raw reply	[flat|nested] 21+ messages in thread
* Fwd: Re: sparc64: Build failure due to commit f1600e549b94 (sparc: Make sparc64 use scalable lib/iom
@ 2015-04-19 18:36 Sowmini Varadhan
  2015-04-20  3:01 ` Fwd: Re: sparc64: Build failure due to commit f1600e549b94 (sparc: Make sparc64 use scalable lib Michael Ellerman
  0 siblings, 1 reply; 21+ messages in thread
From: Sowmini Varadhan @ 2015-04-19 18:36 UTC (permalink / raw)
  To: benh, aik, anton, paulus, linuxppc-dev
  Cc: sparclinux, sowmini.varadhan, davem, linux, linux-kernel


> On (04/19/15 14:09), David Miller wrote:
>
> > On (04/18/15 21:23), Guenter Roeck wrote:
> >> lib/built-in.o:(.discard+0x1): multiple definition of
> >> `__pcpu_unique_iommu_pool_hash'
> >> arch/powerpc/kernel/built-in.o:(.discard+0x18): first defined here
> >> .. I get a similar failure in the
> >> powerpc:allmodconfig build
    :
> 
> Maybe ping the powerpc folks becuase if they can do a quick
> conversion, this change isn't necessary.

linuxppc-dev,

The disussion above [http://www.spinics.net/lists/sparclinux/msg13835.html]
is in reference to the issue that Guenter Roeck
identified. The problem is that we have a 
  static DEFINE_PER_CPU(unsigned int, iommu_pool_hash);
in both lib/iommu-common.c as well as arch/powerpc/kernel/iommu.c,
and as Guenter correctly pointed out,

" DEFINE_PER_CPU translates to DEFINE_PER_CPU_SECTION, which in turn is
  defined as

  #define DEFINE_PER_CPU_SECTION(type, name, sec)                         \
        __PCPU_DUMMY_ATTRS char __pcpu_scope_##name;                    \
	extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name;		\
  -->	__PCPU_DUMMY_ATTRS char __pcpu_unique_##name;			\
	extern __PCPU_ATTRS(sec) __typeof__(type) name;			\
	__PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak                 \
					        __typeof__(type) name

  if CONFIG_DEBUG_FORCE_WEAK_PER_CPU is configured, which is the case here.
  The marked line above shows that __pcpu_unique_iommu_pool_hash is declared as
  global variable"

This results in a build error for allmodconfig on powerpc, due to 
a multiple definition of __pcpu_unique_iommu_pool_hash.

Given that the goal is to use the functions in lib/iommu-common.c
as the Generic IOMMU pooled allocator that will be a superset of
functionality in arch/powerpc/kernel/iommu.c, DaveM suggested that I 
ping you to see if you can do a quick conversion to handle this
duplicate defintion, rather than rename iommu_pool_hash in iommu-common.c.

Would that be possible?

--Sowmini

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-04-21  3:25 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-18  5:47 sparc64: Build failure due to commit f1600e549b94 (sparc: Make sparc64 use scalable lib/iommu-common Guenter Roeck
2015-04-18 10:59 ` sparc64: Build failure due to commit f1600e549b94 (sparc: Make sparc64 use scalable lib/iommu-co Sowmini Varadhan
2015-04-18 12:05 ` Sowmini Varadhan
2015-04-18 18:28   ` Guenter Roeck
2015-04-18 18:38     ` Sowmini Varadhan
2015-04-18 19:27       ` David Miller
2015-04-18 19:40         ` David Miller
2015-04-18 19:44           ` Sowmini Varadhan
2015-04-18 19:55           ` Sowmini Varadhan
2015-04-18 21:41             ` David Miller
2015-04-19  4:13               ` Guenter Roeck
2015-04-19  4:23                 ` Guenter Roeck
2015-04-19 10:51                   ` Sowmini Varadhan
2015-04-19 18:09                     ` David Miller
2015-04-18 19:25   ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2015-04-19 18:36 Fwd: Re: sparc64: Build failure due to commit f1600e549b94 (sparc: Make sparc64 use scalable lib/iom Sowmini Varadhan
2015-04-20  3:01 ` Fwd: Re: sparc64: Build failure due to commit f1600e549b94 (sparc: Make sparc64 use scalable lib Michael Ellerman
2015-04-20  5:17   ` Guenter Roeck
2015-04-20 16:25     ` sparc64: Build failure due to commit f1600e549b94 (sparc: Make sparc64 use scalable lib/iommu-co David Miller
2015-04-20 16:44       ` Guenter Roeck
2015-04-20 16:50         ` David Miller
2015-04-21  1:54           ` Michael Ellerman
2015-04-21  2:32             ` Guenter Roeck
2015-04-21  3:25               ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).