Subject: Re: [next] powerpc: multiple definition of `____cacheline_aligned'; sound/core/oss/pcm_oss.o:(.bss+0x40): first defined here

From: Christophe Leroy <[email-masked]>
Date: Tue, 3 May 2022 16:03:20 +0200

Le 03/05/2022 à 15:10, Christophe Leroy a écrit :
> 
> 
> Le 29/04/2022 à 16:45, Naresh Kamboju a écrit :
>> Following powerpc builds failed on Linux next-20220428 and next-20220429.
>>
>> Regressions found on powerpc:
>>     - gcc-11-ppc64e_defconfig
>>     - gcc-10-ppc64e_defconfig
>>     - gcc-9-ppc64e_defconfig
>>     - gcc-8-ppc64e_defconfig
>>     - clang-14-ppc64e_defconfig
>>     - clang-nightly-ppc64e_defconfig
>>     - clang-13-ppc64e_defconfig
>>
>>
>> Build error:
>> -------------
>> Error: Section .bss not empty in prom_init.c
>> make[3]: *** [arch/powerpc/kernel/Makefile:191:
>> arch/powerpc/kernel/prom_init_check] Error 1
>> make[3]: Target '__build' not remade because of errors.
>> make[2]: *** [scripts/Makefile.build:595: arch/powerpc/kernel] Error 2
>> make[2]: Target '__build' not remade because of errors.
>> make[1]: *** [Makefile:1996: arch/powerpc] Error 2
>> powerpc64le-linux-gnu-ld: sound/core/oss/pcm_plugin.o:(.bss+0x0):
>> multiple definition of `____cacheline_aligned';
>> sound/core/oss/pcm_oss.o:(.bss+0x40): first defined here
>> make[4]: *** [scripts/Makefile.build:530: 
>> sound/core/oss/snd-pcm-oss.o] Error 1
>> make[4]: Target '__build' not remade because of errors.
>> make[3]: *** [scripts/Makefile.build:595: sound/core/oss] Error 2
>> powerpc64le-linux-gnu-ld: sound/core/seq/seq_clientmgr.o:(.bss+0x900):
>> multiple definition of `____cacheline_aligned';
>> sound/core/seq/seq_lock.o:(.bss+0x0): first defined here
>> powerpc64le-linux-gnu-ld: sound/core/seq/seq_memory.o:(.bss+0x0):
>> multiple definition of `____cacheline_aligned';
>> sound/core/seq/seq_lock.o:(.bss+0x0): first defined here
>> powerpc64le-linux-gnu-ld: sound/core/seq/seq_queue.o:(.bss+0x140):
>> multiple definition of `____cacheline_aligned';
>> sound/core/seq/seq_lock.o:(.bss+0x0): first defined here
>> powerpc64le-linux-gnu-ld: sound/core/seq/seq_fifo.o:(.bss+0x0):
>> multiple definition of `____cacheline_aligned';
>> sound/core/seq/seq_lock.o:(.bss+0x0): first defined here
>> powerpc64le-linux-gnu-ld: sound/core/seq/seq_timer.o:(.bss+0x0):
>> multiple definition of `____cacheline_aligned';
>> sound/core/seq/seq_lock.o:(.bss+0x0): first defined here
>> powerpc64le-linux-gnu-ld: sound/core/seq/seq_system.o:(.bss+0x0):
>> multiple definition of `____cacheline_aligned';
>> sound/core/seq/seq_lock.o:(.bss+0x0): first defined here
>> powerpc64le-linux-gnu-ld: sound/core/seq/seq_ports.o:(.bss+0x0):
>> multiple definition of `____cacheline_aligned';
>> sound/core/seq/seq_lock.o:(.bss+0x0): first defined here
>> powerpc64le-linux-gnu-ld: sound/core/seq/seq_info.o:(.bss+0x40):
>> multiple definition of `____cacheline_aligned';
>> sound/core/seq/seq_lock.o:(.bss+0x0): first defined here
>> make[4]: *** [scripts/Makefile.build:530: sound/core/seq/snd-seq.o] 
>> Error 1
>> make[4]: Target '__build' not remade because of errors.
>>
>>
>> Reported-by: Linux Kernel Functional Testing <[email-masked]>
>>
>>
>> steps to reproduce:
>> -------------------
>> # To install tuxmake on your system globally:
>> # sudo pip3 install -U tuxmake
>>
>> tuxmake --runtime podman --target-arch powerpc --toolchain gcc-11
>> --kconfig ppc64e_defconfig
>>
>> -- 
>> Linaro LKFT
>> https://lkft.linaro.org
>>
>> [1] https://builds.tuxbuild.com/28Sn15hB2la1PweieGMLrUdbFMQ/
> 
> Bisected to:
> 
> 366e7b61ca1f115d38138236467068d8aacabcbc is the first bad commit
> commit 366e7b61ca1f115d38138236467068d8aacabcbc
> Author: Peter Collingbourne <[email-masked]>
> Date:   Fri Apr 29 14:42:51 2022 -0700
> 
>      printk: stop including cache.h from printk.h
> 
>      An inclusion of cache.h in printk.h was added in 2014 in commit
>      c28aa1f0a847 ("printk/cache: mark printk_once test variable
>      __read_mostly") in order to bring in the definition of 
> __read_mostly.  The
>      usage of __read_mostly was later removed in commit 3ec25826ae33 
> ("printk:
>      Tie printk_once / printk_deferred_once into .data.once for reset") 
> which
>      made the inclusion of cache.h unnecessary, so remove it.
> 
>      We have a small amount of code that depended on the inclusion of 
> cache.h
>      from printk.h; fix that code to include the appropriate header.
> 
>      This fixes a circular inclusion on arm64 (linux/printk.h -> 
> linux/cache.h
>      -> asm/cache.h -> linux/kasan-enabled.h -> linux/static_key.h ->
>      linux/jump_label.h -> linux/bug.h -> asm/bug.h -> linux/printk.h) that
>      would otherwise be introduced by the next patch.
> 
>      Build tested using {allyesconfig,defconfig} x {arm64,x86_64}.
> 
>      Link: 
> https://linux-review.googlesource.com/id/I8fd51f72c9ef1f2d6afd3b2cbc875aa4792c1fba 
> 
>      Link: 
> https://lkml.kernel.org/r/[email-masked]
>      Signed-off-by: Peter Collingbourne <[email-masked]>
>      Cc: Alexander Potapenko <[email-masked]>
>      Cc: Andrey Konovalov <[email-masked]>
>      Cc: Andrey Ryabinin <[email-masked]>
>      Cc: Catalin Marinas <[email-masked]>
>      Cc: David Rientjes <[email-masked]>
>      Cc: Dmitry Vyukov <[email-masked]>
>      Cc: Eric W. Biederman <[email-masked]>
>      Cc: Herbert Xu <[email-masked]>
>      Cc: Hyeonggon Yoo <[email-masked]>
>      Cc: Joonsoo Kim <[email-masked]>
>      Cc: Kees Cook <[email-masked]>
>      Cc: Pekka Enberg <[email-masked]>
>      Cc: Roman Gushchin <[email-masked]>
>      Cc: Vlastimil Babka <[email-masked]>
>      Signed-off-by: Andrew Morton <[email-masked]>
> 
>   arch/arm64/include/asm/mte-kasan.h | 1 +
>   arch/arm64/include/asm/percpu.h    | 1 +
>   arch/csky/include/asm/processor.h  | 2 +-
>   drivers/firmware/smccc/kvm_guest.c | 1 +
>   include/linux/printk.h             | 1 -
>   kernel/bpf/bpf_lru_list.h          | 1 +
>   6 files changed, 5 insertions(+), 2 deletions(-)

I think you need to fix all files that use ____cacheline_aligned without 
including linux/cache.h

You can locate them with:

	git grep -L linux/cache.h `git grep -l ____cacheline_aligned `

Christophe