linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* parisc build failures in mainline kernel
@ 2021-11-04  3:15 Guenter Roeck
  2021-11-04  4:18 ` Linus Torvalds
  0 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2021-11-04  3:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Linus Torvalds, Kees Cook, Ard Biesheuvel, Helge Deller, linux-parisc

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: parisc build failures in mainline kernel
  2021-11-04  3:15 parisc build failures in mainline kernel Guenter Roeck
@ 2021-11-04  4:18 ` Linus Torvalds
  2021-11-04  4:30   ` Guenter Roeck
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Torvalds @ 2021-11-04  4:18 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Linux Kernel Mailing List, Kees Cook, Ard Biesheuvel,
	Helge Deller, linux-parisc

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

On Wed, Nov 3, 2021 at 8:15 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> the mainline kernel fails to build almost all 'parisc' images.

All with CONFIG_SMP?

Does this silly patch fix it?

                 Linus

[-- Attachment #2: patch.diff --]
[-- Type: text/x-patch, Size: 566 bytes --]

 arch/parisc/include/asm/thread_info.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h
index 75657c2c54e1..1a58795f785c 100644
--- a/arch/parisc/include/asm/thread_info.h
+++ b/arch/parisc/include/asm/thread_info.h
@@ -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)			\

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: parisc build failures in mainline kernel
  2021-11-04  4:18 ` Linus Torvalds
@ 2021-11-04  4:30   ` Guenter Roeck
  2021-11-04  4:45     ` Linus Torvalds
  0 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2021-11-04  4:30 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Kees Cook, Ard Biesheuvel,
	Helge Deller, linux-parisc

On 11/3/21 9:18 PM, Linus Torvalds wrote:
> On Wed, Nov 3, 2021 at 8:15 PM Guenter Roeck <linux@roeck-us.net> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: parisc build failures in mainline kernel
  2021-11-04  4:30   ` Guenter Roeck
@ 2021-11-04  4:45     ` Linus Torvalds
  2021-11-05 19:43       ` Kees Cook
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Torvalds @ 2021-11-04  4:45 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Linux Kernel Mailing List, Kees Cook, Ard Biesheuvel,
	Helge Deller, linux-parisc

On Wed, Nov 3, 2021 at 9:30 PM Guenter Roeck <linux@roeck-us.net> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: parisc build failures in mainline kernel
  2021-11-04  4:45     ` Linus Torvalds
@ 2021-11-05 19:43       ` Kees Cook
  2021-11-05 19:43         ` Ard Biesheuvel
  0 siblings, 1 reply; 7+ messages in thread
From: Kees Cook @ 2021-11-05 19:43 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Linus Torvalds, Linux Kernel Mailing List, Ard Biesheuvel,
	Helge Deller, linux-parisc

On Wed, Nov 03, 2021 at 09:45:47PM -0700, Linus Torvalds wrote:
> On Wed, Nov 3, 2021 at 9:30 PM Guenter Roeck <linux@roeck-us.net> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: parisc build failures in mainline kernel
  2021-11-05 19:43       ` Kees Cook
@ 2021-11-05 19:43         ` Ard Biesheuvel
  2021-11-05 19:55           ` Kees Cook
  0 siblings, 1 reply; 7+ messages in thread
From: Ard Biesheuvel @ 2021-11-05 19:43 UTC (permalink / raw)
  To: Kees Cook
  Cc: Guenter Roeck, Linus Torvalds, Linux Kernel Mailing List,
	Helge Deller, linux-parisc

On Fri, 5 Nov 2021 at 20:43, Kees Cook <keescook@chromium.org> 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 <linux@roeck-us.net> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: parisc build failures in mainline kernel
  2021-11-05 19:43         ` Ard Biesheuvel
@ 2021-11-05 19:55           ` Kees Cook
  0 siblings, 0 replies; 7+ messages in thread
From: Kees Cook @ 2021-11-05 19:55 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Guenter Roeck, Linus Torvalds, Linux Kernel Mailing List,
	Helge Deller, linux-parisc

On Fri, Nov 05, 2021 at 08:43:52PM +0100, Ard Biesheuvel wrote:
> On Fri, 5 Nov 2021 at 20:43, Kees Cook <keescook@chromium.org> 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 <linux@roeck-us.net> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-05 19:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04  3:15 parisc build failures in mainline kernel Guenter Roeck
2021-11-04  4:18 ` Linus Torvalds
2021-11-04  4:30   ` Guenter Roeck
2021-11-04  4:45     ` Linus Torvalds
2021-11-05 19:43       ` Kees Cook
2021-11-05 19:43         ` Ard Biesheuvel
2021-11-05 19:55           ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).