parisc build failures in mainline kernel
Hi,
the mainline kernel fails to build almost all 'parisc' images.
The first build error is
In file included from <command-line>:include/linux/sched.h: In function 'task_cpu':include/linux/sched.h:2129:45: error: 'const struct thread_info' has no member named 'cpu'
2129 | return READ_ONCE(task_thread_info(p)->cpu);
| ^~
with many follow-up errors.
bisect points to commit (merge) 01463374c50e ("Merge tag 'cpu-to-thread_info-v5.16-rc1' ofgit://git.kernel.org/pub/scm/linux/kernel/git/kees/linux" as the culprit, and reverting that merge does indeed fix the problem.
Guenter
---
bisect log:
# bad: [79ef0c00142519bc34e1341447f3797436cc48bf] Merge tag 'trace-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
# good: [8bb7eca972ad531c9b149c0a51ab43a417385813] Linux 5.15
git bisect start '79ef0c001425' '8bb7eca972ad'
# good: [8cb1ae19bfae92def42c985417cd6e894ddaa047] Merge tag 'x86-fpu-2021-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect good 8cb1ae19bfae92def42c985417cd6e894ddaa047
# bad: [73d21a3579818aa0e39de207474a39ca35c7d8cb] Merge tag 'media/v5.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
git bisect bad 73d21a3579818aa0e39de207474a39ca35c7d8cb
# good: [c2c88a07d679839ddf236db55b258aaedff819ad] media: Add ADV7610 support for adv7604 driver.
git bisect good c2c88a07d679839ddf236db55b258aaedff819ad
# good: [46f876322820c189ab525cfcba2519a17dbc0a6f] Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
git bisect good 46f876322820c189ab525cfcba2519a17dbc0a6f
# bad: [2dc26d98cfdf756e390013fafaba959b052b0867] Merge tag 'overflow-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
git bisect bad 2dc26d98cfdf756e390013fafaba959b052b0867
# good: [03feb7c55c470158ece9afb317c395cd65bd14ac] Merge tag 'm68k-for-v5.16-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
git bisect good 03feb7c55c470158ece9afb317c395cd65bd14ac
# good: [caf283d040f53bc4fd81ce3d2a1a364b069cfd7d] xfrm: Use memset_after() to clear padding
git bisect good caf283d040f53bc4fd81ce3d2a1a364b069cfd7d
# bad: [01463374c50e4fe75abec927fa231f8f5d701852] Merge tag 'cpu-to-thread_info-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
git bisect bad 01463374c50e4fe75abec927fa231f8f5d701852
# good: [227d735d889e0403f1659df6e2dece7633f380bc] powerpc: add CPU field to struct thread_info
git bisect good 227d735d889e0403f1659df6e2dece7633f380bc
# good: [336868afbaae2d153fc20268a21747c31e5071b8] powerpc: smp: remove hack to obtain offset of task_struct::cpu
git bisect good 336868afbaae2d153fc20268a21747c31e5071b8
# good: [d9f2a53f64a6fcae994457e64a7124d2a3efd323] Merge tag 'pr-move-task-cpu-to-ti' of git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git
git bisect good d9f2a53f64a6fcae994457e64a7124d2a3efd323
# first bad commit: [01463374c50e4fe75abec927fa231f8f5d701852] Merge tag 'cpu-to-thread_info-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Quoted 2 lines · Guenter Roeck
the mainline kernel fails to build almost all 'parisc' images.
All with CONFIG_SMP?
Does this silly patch fix it?
Linus
arch/parisc/include/asm/thread_info.h | 3 +++ 1 file changed, 3 insertions(+)
arch/parisc/include/asm/thread_info.h +3 -0
@@ -9,6 +9,9 @@struct thread_info {unsigned long flags;/* thread_info flags (see TIF_*) */ int preempt_count;/* 0=premptable, <0=BUG; will also serve as bh-counter */ +#ifdef CONFIG_SMP +unsigned int cpu; +#endif };#define INIT_THREAD_INFO (tsk) \
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Guenter Roeck
the mainline kernel fails to build almost all 'parisc' images.
All with
CONFIG_SMP?
I think so. tinyconfig (SMP=n) builds fine.
Quoted 2 lines
Does this silly patch fix it?
Unfortunately not. With that patch it complains about task_struct.
In file included from arch/parisc/kernel/asm-offsets.c:24:arch/parisc/kernel/asm-offsets.c: In function 'main':././include/linux/compiler_types.h:140:41: error: 'struct task_struct' has no member named 'cpu'
140 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
| ^~~~~~~~~~~~~~~~~~
./include/linux/kbuild.h:6:69: note: in definition of macro 'DEFINE'
6 | asm volatile("\n.ascii \"->" #sym " %0 " #val "\"" : : "i" (val))
| ^~~
./include/linux/stddef.h:17:33: note: in expansion of macro '__compiler_offsetof'
17 | #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
| ^~~~~~~~~~~~~~~~~~~
arch/parisc/kernel/asm-offsets.c:43:26: note: in expansion of macro 'offsetof'
43 | DEFINE(TASK_CPU, offsetof(struct task_struct, cpu));
| ^~~~~~~~make[1]: *** [scripts/Makefile.build:121: arch/parisc/kernel/asm-offsets.s] Error 1
make: *** [Makefile:1223: prepare0] Error 2
Guenter
Quoted 2 lines · Guenter Roeck
Unfortunately not. With that patch it complains about
task_struct.
Gaah. You'll need something like this too
- DEFINE(TASK_CPU, offsetof(struct task_struct, cpu));
+ DEFINE(TASK_CPU, offsetof(struct task_struct, thread_info.cpu));
in arch/parisc/kernel/asm-offsets.c.
And really, it should probably be renamed as TASK_TI_CPU, but then you have to rename all the uses too.
There might be other details like that lurking.
Linus
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Guenter Roeck
Unfortunately not. With that patch it complains about
task_struct.Gaah. You'll need something like this too
(quoted diff) +1
-1- DEFINE(TASK_CPU, offsetof(struct task_struct, cpu)); + DEFINE(TASK_CPU, offsetof(struct task_struct, thread_info.cpu));
Quoted 6 lines
in
arch/parisc/kernel/asm-offsets.c.And really, it should probably be renamed as
TASK_TI_CPU, but then you have to rename all the uses too.There might be other details like that lurking.
I'll check this out too if Ard doesn't beat me to it. Thanks for the investigation and sorry for the breakage!
Signature · 1 line
Kees Cook
Quoted 13 lines · Kees Cook
Quoted 11 lines · Linus Torvalds
Quoted 2 lines · Guenter Roeck
Unfortunately not. With that patch it complains about
task_struct.Gaah. You'll need something like this too
(quoted diff) +1
-1- DEFINE(TASK_CPU, offsetof(struct task_struct, cpu)); + DEFINE(TASK_CPU, offsetof(struct task_struct, thread_info.cpu));in
arch/parisc/kernel/asm-offsets.c.
Quoted 8 lines
Quoted 4 lines
And really, it should probably be renamed as
TASK_TI_CPU, but then you have to rename all the uses too.There might be other details like that lurking.
I'll check this out too if Ard doesn't beat me to it. Thanks for the investigation and sorry for the breakage!
Quoted 17 lines · Ard Biesheuvel
Quoted 16 lines · Kees Cook
Quoted 14 lines · Linus Torvalds
Quoted 2 lines · Guenter Roeck
Unfortunately not. With that patch it complains about
task_struct.Gaah. You'll need something like this too
(quoted diff) +1
-1- DEFINE(TASK_CPU, offsetof(struct task_struct, cpu)); + DEFINE(TASK_CPU, offsetof(struct task_struct, thread_info.cpu));in
arch/parisc/kernel/asm-offsets.c.And really, it should probably be renamed as
TASK_TI_CPU, but then you have to rename all the uses too.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
There might be other details like that lurking.
I'll check this out too if Ard doesn't beat me to it. Thanks for the investigation and sorry for the breakage!
Heh. Ard did, in fact, beat me to it. Thank you! :)
-Kees
Signature · 1 line
Kees Cook