diff mbox series

powerpc/64: Include cache.h directly in paca.h

Message ID 20220527112035.2842155-1-mpe@ellerman.id.au (mailing list archive)
State Accepted
Headers show
Series powerpc/64: Include cache.h directly in paca.h | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 24 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 7 jobs.

Commit Message

Michael Ellerman May 27, 2022, 11:20 a.m. UTC
paca.h uses ____cacheline_aligned without directly including cache.h,
where it's defined.

For Book3S builds that's OK because paca.h includes lppaca.h, and it
does include cache.h.

But Book3E builds have been getting cache.h indirectly via printk.h,
which is dicey, and in fact that include was recently removed, leading
to build errors such as:

  ld: fs/isofs/dir.o:(.bss+0x0): multiple definition of `____cacheline_aligned'; fs/isofs/namei.o:(.bss+0x0): first defined here

So include cache.h directly to fix the build error.

Fixes: 534aa1dc975a ("printk: stop including cache.h from printk.h")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/paca.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Christophe Leroy May 27, 2022, 12:16 p.m. UTC | #1
Le 27/05/2022 à 13:20, Michael Ellerman a écrit :
> paca.h uses ____cacheline_aligned without directly including cache.h,
> where it's defined.
> 
> For Book3S builds that's OK because paca.h includes lppaca.h, and it
> does include cache.h.
> 
> But Book3E builds have been getting cache.h indirectly via printk.h,
> which is dicey, and in fact that include was recently removed, leading
> to build errors such as:
> 
>    ld: fs/isofs/dir.o:(.bss+0x0): multiple definition of `____cacheline_aligned'; fs/isofs/namei.o:(.bss+0x0): first defined here
> 
> So include cache.h directly to fix the build error.
> 
> Fixes: 534aa1dc975a ("printk: stop including cache.h from printk.h")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

You've got other candidates for the fix:

$ git grep -L linux/cache.h `git grep -l ____cacheline_aligned 
arch/powerpc`
arch/powerpc/include/asm/hardirq.h
arch/powerpc/include/asm/iommu.h
arch/powerpc/include/asm/paca.h
arch/powerpc/include/asm/processor.h
arch/powerpc/kernel/prom_init.c

Discussion at 
https://lore.kernel.org/lkml/e3c8b2bf-b55d-4c2c-a1cf-d5e9941e26b0@csgroup.eu/t/

Christophe


> ---
>   arch/powerpc/include/asm/paca.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
> index 03330b7d835f..4d7aaab82702 100644
> --- a/arch/powerpc/include/asm/paca.h
> +++ b/arch/powerpc/include/asm/paca.h
> @@ -12,6 +12,7 @@
>   
>   #ifdef CONFIG_PPC64
>   
> +#include <linux/cache.h>
>   #include <linux/string.h>
>   #include <asm/types.h>
>   #include <asm/lppaca.h>
Michael Ellerman May 28, 2022, 12:18 p.m. UTC | #2
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 27/05/2022 à 13:20, Michael Ellerman a écrit :
>> paca.h uses ____cacheline_aligned without directly including cache.h,
>> where it's defined.
>> 
>> For Book3S builds that's OK because paca.h includes lppaca.h, and it
>> does include cache.h.
>> 
>> But Book3E builds have been getting cache.h indirectly via printk.h,
>> which is dicey, and in fact that include was recently removed, leading
>> to build errors such as:
>> 
>>    ld: fs/isofs/dir.o:(.bss+0x0): multiple definition of `____cacheline_aligned'; fs/isofs/namei.o:(.bss+0x0): first defined here
>> 
>> So include cache.h directly to fix the build error.
>> 
>> Fixes: 534aa1dc975a ("printk: stop including cache.h from printk.h")
>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>
> You've got other candidates for the fix:
>
> $ git grep -L linux/cache.h `git grep -l ____cacheline_aligned 
> arch/powerpc`
> arch/powerpc/include/asm/hardirq.h
> arch/powerpc/include/asm/iommu.h
> arch/powerpc/include/asm/paca.h
> arch/powerpc/include/asm/processor.h
> arch/powerpc/kernel/prom_init.c
>
> Discussion at 
> https://lore.kernel.org/lkml/e3c8b2bf-b55d-4c2c-a1cf-d5e9941e26b0@csgroup.eu/t/

Adding it to paca.h seems to also fix those build errors, so I'll leave
it at that for now.

Adding cache.h to those other headers should be fine, but I don't want
to do it just before sending my pull request, because changing include
order can easily cause bugs, and they're not always easy to find.

cheers
Michael Ellerman May 28, 2022, 12:53 p.m. UTC | #3
On Fri, 27 May 2022 21:20:35 +1000, Michael Ellerman wrote:
> paca.h uses ____cacheline_aligned without directly including cache.h,
> where it's defined.
> 
> For Book3S builds that's OK because paca.h includes lppaca.h, and it
> does include cache.h.
> 
> But Book3E builds have been getting cache.h indirectly via printk.h,
> which is dicey, and in fact that include was recently removed, leading
> to build errors such as:
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/64: Include cache.h directly in paca.h
      https://git.kernel.org/powerpc/c/dcf280e6f80be280ca7dd1b058f038654e4a18dd

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 03330b7d835f..4d7aaab82702 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -12,6 +12,7 @@ 
 
 #ifdef CONFIG_PPC64
 
+#include <linux/cache.h>
 #include <linux/string.h>
 #include <asm/types.h>
 #include <asm/lppaca.h>