powerpc: build failures in Linus' tree
Subsystems (2)
Hi all,
We are getting build failures in some PowerPC configs for Linus' tree. See e.g. http://kisskb.ellerman.id.au/kisskb/buildresult/14306515/
In file included from /kisskb/src/arch/powerpc/include/asm/paca.h:18,
from /kisskb/src/arch/powerpc/include/asm/percpu.h:13,
from /kisskb/src/include/linux/random.h:14,
from /kisskb/src/include/linux/net.h:18,
from /kisskb/src/net/ipv6/ip6_fib.c:20:/kisskb/src/arch/powerpc/include/asm/mmu.h:139:22: error: unknown type name 'next_tlbcam_idx'
139 | DECLARE_PER_CPU(int, next_tlbcam_idx);
I assume this is caused by commit
1c9df907da83 ("random: fix circular include dependency on arm64 after addition of percpu.h")
But I can't see how, sorry.
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 10 lines · Stephen Rothwell
Hi all,
We are getting build failures in some PowerPC configs for Linus' tree. See e.g. http://kisskb.ellerman.id.au/kisskb/buildresult/14306515/
In file included from /kisskb/src/arch/powerpc/include/asm/paca.h:18,
from /kisskb/src/arch/powerpc/include/asm/percpu.h:13, from /kisskb/src/include/linux/random.h:14, from /kisskb/src/include/linux/net.h:18, from /kisskb/src/net/ipv6/ip6_fib.c:20:
Quoted 8 lines
/kisskb/src/arch/powerpc/include/asm/mmu.h:139:22: error: unknown type name '
next_tlbcam_idx'
139 |DECLARE_PER_CPU(int, next_tlbcam_idx);I assume this is caused by commit
1c9df907da83("random: fix circular include dependency on arm64 after addition ofpercpu.h")But I can't see how, sorry.
So there, asm/mmu.h includes asm/percpu.h, which includes asm/paca.h, which includes asm/mmu.h.
I suspect that we can remove asm/paca.h from asm/percpu.h as it *seems* to be only used by the #define __my_cpu_offset but I don't know if anything will break further, especially if this __my_cpu_offset is used anywhere without this paca definition.
Willy
Hi again Stephen,
Quoted 20 lines · Willy Tarreau
Quoted 10 lines · Stephen Rothwell
Hi all,
We are getting build failures in some PowerPC configs for Linus' tree. See e.g. http://kisskb.ellerman.id.au/kisskb/buildresult/14306515/
In file included from /kisskb/src/arch/powerpc/include/asm/paca.h:18,
from /kisskb/src/arch/powerpc/include/asm/percpu.h:13, from /kisskb/src/include/linux/random.h:14, from /kisskb/src/include/linux/net.h:18, from /kisskb/src/net/ipv6/ip6_fib.c:20:Quoted 8 lines
/kisskb/src/arch/powerpc/include/asm/mmu.h:139:22: error: unknown type name '
next_tlbcam_idx'
139 |DECLARE_PER_CPU(int, next_tlbcam_idx);I assume this is caused by commit
1c9df907da83("random: fix circular include dependency on arm64 after addition ofpercpu.h")But I can't see how, sorry.
Quoted 7 lines
So there,
asm/mmu.hincludesasm/percpu.h, which includesasm/paca.h, which includesasm/mmu.h.I suspect that we can remove
asm/paca.hfromasm/percpu.has it *seems* to be only used by the #define__my_cpu_offsetbut I don't know if anything will break further, especially if this__my_cpu_offsetis used anywhere without this paca definition.
I tried this and it fixed 5.8 for me with your config above. I'm appending a patch that does just this. I didn't test other configs as I don't know which ones to test though. If it fixes the problem for you, maybe it can be picked by the PPC maintainers.
Willy
From bcd64a7d0f3445c9a75d3b4dc4837d2ce61660c9 Mon Sep 17 00:00:00 2001
From: Willy Tarreau <[email protected]>
Date: Mon, 3 Aug 2020 05:27:57 +0200
Subject: powerpc: fix circular dependency in percpu.h
After random.h started to include percpu.h (commit f227e3e), several archs broke in circular dependencies around percpu.h.
In https://lore.kernel.org/lkml/[email protected]/
Stephen Rothwell reported breakage for powerpc with CONFIG_PPC_FSL_BOOK3E.
It turns out that asm/percpu.h includes asm/paca.h, which itself includes mmu.h, which includes percpu.h when CONFIG_PPC_FSL_BOOK3E=y.
Percpu seems to include asm/paca.h only for local_paca which is used in the __my_cpu_offset macro. Removing this include solves the issue for this config.
--- arch/powerpc/include/asm/percpu.h | 2 -- 1 file changed, 2 deletions(-)
arch/powerpc/include/asm/percpu.h +0 -2
@@ -10,8 +10,6 @@#ifdef CONFIG_SMP -#include <asm/paca.h> -#define __my_cpu_offset local_paca->data_offset#endif /* CONFIG_SMP */
Signature · 1 line
2.9.0
Hi Willy,
Quoted 29 lines · On Mon, 3 Aug 2020 05:45:47 +0200 Willy Tarreau <[email protected]> wrote:
Quoted 19 lines · Willy Tarreau
Quoted 9 lines · Stephen Rothwell
We are getting build failures in some PowerPC configs for Linus' tree. See e.g. http://kisskb.ellerman.id.au/kisskb/buildresult/14306515/
In file included from /kisskb/src/arch/powerpc/include/asm/paca.h:18,
from /kisskb/src/arch/powerpc/include/asm/percpu.h:13, from /kisskb/src/include/linux/random.h:14, from /kisskb/src/include/linux/net.h:18, from /kisskb/src/net/ipv6/ip6_fib.c:20:Quoted 8 lines
/kisskb/src/arch/powerpc/include/asm/mmu.h:139:22: error: unknown type name '
next_tlbcam_idx'
139 |DECLARE_PER_CPU(int, next_tlbcam_idx);I assume this is caused by commit
1c9df907da83("random: fix circular include dependency on arm64 after addition ofpercpu.h")But I can't see how, sorry.
Quoted 7 lines
So there,
asm/mmu.hincludesasm/percpu.h, which includesasm/paca.h, which includesasm/mmu.h.I suspect that we can remove
asm/paca.hfromasm/percpu.has it *seems* to be only used by the #define__my_cpu_offsetbut I don't know if anything will break further, especially if this__my_cpu_offsetis used anywhere without this paca definition.
Quoted 4 lines
I tried this and it fixed 5.8 for me with your config above. I'm appending a patch that does just this. I didn't test other configs as I don't know which ones to test though. If it fixes the problem for you, maybe it can be picked by the PPC maintainers.
Our mails have crossed. I just sent a more comprehensive patch. I think your patch would require a lot of build testing and even then may fail for some CONFIG combination that we didn't test or added in the future (or someone just made up).
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 1 line · Stephen Rothwell
Our mails have crossed.
Ah indeed :-)
Quoted 4 lines
I just sent a more comprehensive patch. I
think your patch would require a lot of build testing and even then may fail for some CONFIG combination that we didn't test or added in the future (or someone just made up).
Your looks far more complete and very likely more future-proof, I totally agree.
Thanks!
Willy
Michael Ellerman
reviewerQuoted 70 lines · Willy Tarreau
Quoted 20 lines · Willy Tarreau
Quoted 10 lines · Stephen Rothwell
Hi all,
We are getting build failures in some PowerPC configs for Linus' tree. See e.g. http://kisskb.ellerman.id.au/kisskb/buildresult/14306515/
In file included from /kisskb/src/arch/powerpc/include/asm/paca.h:18,
from /kisskb/src/arch/powerpc/include/asm/percpu.h:13, from /kisskb/src/include/linux/random.h:14, from /kisskb/src/include/linux/net.h:18, from /kisskb/src/net/ipv6/ip6_fib.c:20:Quoted 8 lines
/kisskb/src/arch/powerpc/include/asm/mmu.h:139:22: error: unknown type name '
next_tlbcam_idx'
139 |DECLARE_PER_CPU(int, next_tlbcam_idx);I assume this is caused by commit
1c9df907da83("random: fix circular include dependency on arm64 after addition ofpercpu.h")But I can't see how, sorry.
Quoted 7 lines
So there,
asm/mmu.hincludesasm/percpu.h, which includesasm/paca.h, which includesasm/mmu.h.I suspect that we can remove
asm/paca.hfromasm/percpu.has it *seems* to be only used by the #define__my_cpu_offsetbut I don't know if anything will break further, especially if this__my_cpu_offsetis used anywhere without this paca definition.I tried this and it fixed 5.8 for me with your config above. I'm appending a patch that does just this. I didn't test other configs as I don't know which ones to test though. If it fixes the problem for you, maybe it can be picked by the PPC maintainers.
Willy
Frombcd64a7d0f3445c9a75d3b4dc4837d2ce61660c9Mon Sep 17 00:00:00 2001
From: Willy Tarreau <[email protected]>
Date: Mon, 3 Aug 2020 05:27:57 +0200
Subject: powerpc: fix circular dependency inpercpu.hAfter
random.hstarted to includepercpu.h(commit f227e3e), several archs broke in circular dependencies aroundpercpu.h.In https://lore.kernel.org/lkml/[email protected]/
Stephen Rothwell reported breakage for powerpc withCONFIG_PPC_FSL_BOOK3E.It turns out that
asm/percpu.hincludesasm/paca.h, which itself includesmmu.h, which includespercpu.hwhenCONFIG_PPC_FSL_BOOK3E=y.Percpu seems to include
asm/paca.honly forlocal_pacawhich is used in the__my_cpu_offsetmacro. Removing this include solves the issue for this config.Reported-by Stephen Rothwell <[email protected]>Fixes f227e3e ("random32: update the net random state on interrupt and activity")Cc Linus Torvalds <[email protected]>Cc Michael Ellerman <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Signed-off-by Willy Tarreau <[email protected]>--- arch/powerpc/include/asm/percpu.h | 2 -- 1 file changed, 2 deletions(-)arch/powerpc/include/asm/percpu.h +0
-0
arch/powerpc/include/asm/percpu.h line 15
Quoted 8 lines
arch/powerpc/include/asm/percpu.h +0
-2@@ -10,8 +10,6 @@#ifdef CONFIG_SMP -#include <asm/paca.h> -#define __my_cpu_offset local_paca->data_offset#endif /* CONFIG_SMP */
If we just move the include of asm/paca.h below asm-generic/percpu.h then it avoids the bad circular dependency and we still have paca.h included from percpu.h as before.
eg:
arch/powerpc/include/asm/percpu.h +2 -2
@@ -10,8 +10,6 @@#ifdef CONFIG_SMP -#include <asm/paca.h> -#define __my_cpu_offset local_paca->data_offset#endif /* CONFIG_SMP */
@@ -19,4 +17,6 @@#include <asm-generic/percpu.h> +#include <asm/paca.h> +#endif /* _ASM_POWERPC_PERCPU_H_ */
So I think I'm inclined to merge that as a minimal fix that's easy to backport.
cheers
Quoted 28 lines · Michael Ellerman
If we just move the include of
asm/paca.hbelowasm-generic/percpu.hthen it avoids the bad circular dependency and we still havepaca.hincluded frompercpu.has before.eg:
arch/powerpc/include/asm/percpu.h +2
-2@@ -10,8 +10,6 @@#ifdef CONFIG_SMP -#include <asm/paca.h> -#define __my_cpu_offset local_paca->data_offset#endif /* CONFIG_SMP */ @@ -19,4 +17,6 @@#include <asm-generic/percpu.h> +#include <asm/paca.h> +#endif /* _ASM_POWERPC_PERCPU_H_ */
Quoted 2 lines
So I think I'm inclined to merge that as a minimal fix that's easy to backport.
This totally makes sense indeed!
Willy
Hi Michael,
Quoted 29 lines · On Mon, 03 Aug 2020 21:18:00 +1000 Michael Ellerman <[email protected]> wrote:
If we just move the include of
asm/paca.hbelowasm-generic/percpu.hthen it avoids the bad circular dependency and we still havepaca.hincluded frompercpu.has before.eg:
arch/powerpc/include/asm/percpu.h +2
-2@@ -10,8 +10,6 @@#ifdef CONFIG_SMP -#include <asm/paca.h> -#define __my_cpu_offset local_paca->data_offset#endif /* CONFIG_SMP */ @@ -19,4 +17,6 @@#include <asm-generic/percpu.h> +#include <asm/paca.h> +#endif /* _ASM_POWERPC_PERCPU_H_ */
Quoted 4 lines
So I think I'm inclined to merge that as a minimal fix that's easy to backport.
cheers
Looks ok, except does it matter that the include used to be only done if __powerpc64__ and CONFIG_SMP are defined?
Signature · 2 lines
Cheers, Stephen Rothwell
Michael Ellerman
reviewerQuoted 30 lines · Stephen Rothwell
Quoted 29 lines · On Mon, 03 Aug 2020 21:18:00 +1000 Michael Ellerman <[email protected]> wrote:
If we just move the include of
asm/paca.hbelowasm-generic/percpu.hthen it avoids the bad circular dependency and we still havepaca.hincluded frompercpu.has before.eg:
arch/powerpc/include/asm/percpu.h +2
-2@@ -10,8 +10,6 @@#ifdef CONFIG_SMP -#include <asm/paca.h> -#define __my_cpu_offset local_paca->data_offset#endif /* CONFIG_SMP */ @@ -19,4 +17,6 @@#include <asm-generic/percpu.h> +#include <asm/paca.h> +#endif /* _ASM_POWERPC_PERCPU_H_ */
Quoted 7 lines
Quoted 4 lines
So I think I'm inclined to merge that as a minimal fix that's easy to backport.
cheers
Looks ok, except does it matter that the include used to be only done if
__powerpc64__andCONFIG_SMPare defined?
Basically all of paca.h is inside #ifdef CONFIG_PPC64.
SMP "shouldn't matter", but I tested a SMP=n build and it's clean, so I think it's good. Of course there's really no guarantees with these header tangles.
cheers