2021-11-04 03:19:35

by Guenter Roeck

[permalink] [raw]
Subject: 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' of
git://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


2021-11-04 04:23:12

by Linus Torvalds

[permalink] [raw]
Subject: Re: parisc build failures in mainline kernel

On Wed, Nov 3, 2021 at 8:15 PM Guenter Roeck <[email protected]> wrote:
>
> the mainline kernel fails to build almost all 'parisc' images.

All with CONFIG_SMP?

Does this silly patch fix it?

Linus


Attachments:
patch.diff (566.00 B)

2021-11-04 04:33:07

by Guenter Roeck

[permalink] [raw]
Subject: Re: parisc build failures in mainline kernel

On 11/3/21 9:18 PM, Linus Torvalds wrote:
> On Wed, Nov 3, 2021 at 8:15 PM Guenter Roeck <[email protected]> wrote:
>>
>> the mainline kernel fails to build almost all 'parisc' images.
>
> All with CONFIG_SMP?
>
I think so. tinyconfig (SMP=n) builds fine.

> 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

2021-11-04 04:48:28

by Linus Torvalds

[permalink] [raw]
Subject: Re: parisc build failures in mainline kernel

On Wed, Nov 3, 2021 at 9:30 PM Guenter Roeck <[email protected]> wrote:
>
> 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

2021-11-05 20:30:11

by Kees Cook

[permalink] [raw]
Subject: Re: parisc build failures in mainline kernel

On Wed, Nov 03, 2021 at 09:45:47PM -0700, Linus Torvalds wrote:
> On Wed, Nov 3, 2021 at 9:30 PM Guenter Roeck <[email protected]> wrote:
> >
> > 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.

I'll check this out too if Ard doesn't beat me to it. Thanks for the
investigation and sorry for the breakage!

--
Kees Cook

2021-11-05 20:30:29

by Kees Cook

[permalink] [raw]
Subject: Re: parisc build failures in mainline kernel

On Fri, Nov 05, 2021 at 08:43:52PM +0100, Ard Biesheuvel wrote:
> On Fri, 5 Nov 2021 at 20:43, Kees Cook <[email protected]> wrote:
> >
> > On Wed, Nov 03, 2021 at 09:45:47PM -0700, Linus Torvalds wrote:
> > > On Wed, Nov 3, 2021 at 9:30 PM Guenter Roeck <[email protected]> wrote:
> > > >
> > > > 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.
> >
> > I'll check this out too if Ard doesn't beat me to it. Thanks for the
> > investigation and sorry for the breakage!
> >
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2a2e8202c7a16a85a881ad2b6e32ccbebdc01dda

Heh. Ard did, in fact, beat me to it. Thank you! :)

-Kees

--
Kees Cook

2021-11-05 22:35:55

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: parisc build failures in mainline kernel

On Fri, 5 Nov 2021 at 20:43, Kees Cook <[email protected]> wrote:
>
> On Wed, Nov 03, 2021 at 09:45:47PM -0700, Linus Torvalds wrote:
> > On Wed, Nov 3, 2021 at 9:30 PM Guenter Roeck <[email protected]> wrote:
> > >
> > > 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.
>
> I'll check this out too if Ard doesn't beat me to it. Thanks for the
> investigation and sorry for the breakage!
>

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2a2e8202c7a16a85a881ad2b6e32ccbebdc01dda