diff mbox series

[2/2] s390/nospec: remove unneeded header includes

Message ID patch-2.thread-d13b6c.git-d13b6c96fb5f.your-ad-here.call-01656331067-ext-4899@work.hours (mailing list archive)
State New, archived
Headers show
Series [1/2] s390/nospec: build expoline.o for modules_prepare target | expand

Commit Message

Vasily Gorbik June 27, 2022, 12:50 p.m. UTC
Commit 4efd417f298b ("s390: raise minimum supported machine generation
to z10") removed the usage of alternatives and lowcore in expolines
macros. Remove unneeded header includes as well.

With that, expoline.S doesn't require asm-offsets.h and
expoline_prepare target dependency could be removed.

Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
---
 arch/s390/Makefile                  | 2 +-
 arch/s390/include/asm/nospec-insn.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

Comments

Jiri Slaby March 16, 2023, 11:14 a.m. UTC | #1
On 27. 06. 22, 14:50, Vasily Gorbik wrote:
> Commit 4efd417f298b ("s390: raise minimum supported machine generation
> to z10") removed the usage of alternatives and lowcore in expolines
> macros. Remove unneeded header includes as well.
> 
> With that, expoline.S doesn't require asm-offsets.h and
> expoline_prepare target dependency could be removed.
> 
> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
> ---
>   arch/s390/Makefile                  | 2 +-
>   arch/s390/include/asm/nospec-insn.h | 2 --
>   2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/arch/s390/Makefile b/arch/s390/Makefile
> index fc72a35a1f07..4cb5d17e7ead 100644
> --- a/arch/s390/Makefile
> +++ b/arch/s390/Makefile
> @@ -166,7 +166,7 @@ vdso_prepare: prepare0
>   
>   ifdef CONFIG_EXPOLINE_EXTERN
>   modules_prepare: expoline_prepare
> -expoline_prepare: prepare0
> +expoline_prepare:

Hi,

this likely broke s390 build as expolines still depend on 
scripts/basic/fixdep. And build of expolines can now race with fixdep build:
      make[1]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
      /bin/sh: line 1: scripts/basic/fixdep: Permission denied
      make[1]: *** [../scripts/Makefile.build:385: 
arch/s390/lib/expoline/expoline.o] Error 126
      make: *** [../arch/s390/Makefile:166: expoline_prepare] Error 2

I returned there:
   expoline_prepare: prepare0
and it looks good so far. Maybe even:
   expoline_prepare: scripts
would be enough.

Opinions?

thanks,
Masahiro Yamada March 17, 2023, 10:58 a.m. UTC | #2
On Thu, Mar 16, 2023 at 8:14 PM Jiri Slaby <jirislaby@kernel.org> wrote:
>
> On 27. 06. 22, 14:50, Vasily Gorbik wrote:
> > Commit 4efd417f298b ("s390: raise minimum supported machine generation
> > to z10") removed the usage of alternatives and lowcore in expolines
> > macros. Remove unneeded header includes as well.
> >
> > With that, expoline.S doesn't require asm-offsets.h and
> > expoline_prepare target dependency could be removed.
> >
> > Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
> > ---
> >   arch/s390/Makefile                  | 2 +-
> >   arch/s390/include/asm/nospec-insn.h | 2 --
> >   2 files changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/arch/s390/Makefile b/arch/s390/Makefile
> > index fc72a35a1f07..4cb5d17e7ead 100644
> > --- a/arch/s390/Makefile
> > +++ b/arch/s390/Makefile
> > @@ -166,7 +166,7 @@ vdso_prepare: prepare0
> >
> >   ifdef CONFIG_EXPOLINE_EXTERN
> >   modules_prepare: expoline_prepare
> > -expoline_prepare: prepare0
> > +expoline_prepare:
>
> Hi,
>
> this likely broke s390 build as expolines still depend on
> scripts/basic/fixdep. And build of expolines can now race with fixdep build:
>       make[1]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
>       /bin/sh: line 1: scripts/basic/fixdep: Permission denied
>       make[1]: *** [../scripts/Makefile.build:385:
> arch/s390/lib/expoline/expoline.o] Error 126
>       make: *** [../arch/s390/Makefile:166: expoline_prepare] Error 2


Indeed. This is a race.


> I returned there:
>    expoline_prepare: prepare0
> and it looks good so far. Maybe even:
>    expoline_prepare: scripts
> would be enough.
>
> Opinions?
>

Technically, 'scripts' might be enough, but
it is difficult to predict whether
arch/s390/lib/expoline/expoline.S
includes generated headers or not.

The chain of header inclusion changes all the time.
Vasily Gorbik March 17, 2023, 11:17 a.m. UTC | #3
On Thu, Mar 16, 2023 at 12:14:27PM +0100, Jiri Slaby wrote:
> On 27. 06. 22, 14:50, Vasily Gorbik wrote:
> > With that, expoline.S doesn't require asm-offsets.h and
> > expoline_prepare target dependency could be removed.
> > 
> > +++ b/arch/s390/Makefile
> > @@ -166,7 +166,7 @@ vdso_prepare: prepare0
> >   ifdef CONFIG_EXPOLINE_EXTERN
> >   modules_prepare: expoline_prepare
> > -expoline_prepare: prepare0
> > +expoline_prepare:
> 
> this likely broke s390 build as expolines still depend on
> scripts/basic/fixdep. And build of expolines can now race with fixdep build:
>      make[1]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
>      /bin/sh: line 1: scripts/basic/fixdep: Permission denied
>      make[1]: *** [../scripts/Makefile.build:385:
> arch/s390/lib/expoline/expoline.o] Error 126
>      make: *** [../arch/s390/Makefile:166: expoline_prepare] Error 2
> 
> I returned there:
>   expoline_prepare: prepare0
> and it looks good so far. Maybe even:
>   expoline_prepare: scripts
> would be enough.

Hi Jiri, thanks for looking into this!

Probably even scripts_basic would be enough to add explicit dependency
to fixdep. But I just couldn't reproduce missing scripts/basic/fixdep
neither with modules_prepare nor expoline_prepare targets.

With which specific build command were you able to get those error
messages? I wonder where
        make[1]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
is coming from. Could it be smth like?

make ARCH=s390 CROSS_COMPILE=s390x-12.2.0- -j64 arch/s390/lib/expoline/expoline.o

Playing around with this build target I found it is broken:

  AS      arch/s390/lib/expoline/expoline.o
  AS      arch/s390/lib/expoline/expoline.o
fixdep: error opening file: arch/s390/lib/expoline/.expoline.o.d: No such file or directory
make[3]: *** [scripts/Makefile.build:374: arch/s390/lib/expoline/expoline.o] Error 2
make[3]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
make[2]: *** [scripts/Makefile.build:494: arch/s390/lib/expoline] Error 2
make[1]: *** [scripts/Makefile.build:494: arch/s390/lib] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:2028: .] Error 2

Notice dup AS call, which is probably causing this:
make[3]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'

But that would be a different issue from the one you are trying to fix.
Jiri Slaby March 17, 2023, 11:32 a.m. UTC | #4
On 17. 03. 23, 12:17, Vasily Gorbik wrote:
> On Thu, Mar 16, 2023 at 12:14:27PM +0100, Jiri Slaby wrote:
>> On 27. 06. 22, 14:50, Vasily Gorbik wrote:
>>> With that, expoline.S doesn't require asm-offsets.h and
>>> expoline_prepare target dependency could be removed.
>>>
>>> +++ b/arch/s390/Makefile
>>> @@ -166,7 +166,7 @@ vdso_prepare: prepare0
>>>    ifdef CONFIG_EXPOLINE_EXTERN
>>>    modules_prepare: expoline_prepare
>>> -expoline_prepare: prepare0
>>> +expoline_prepare:
>>
>> this likely broke s390 build as expolines still depend on
>> scripts/basic/fixdep. And build of expolines can now race with fixdep build:
>>       make[1]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
>>       /bin/sh: line 1: scripts/basic/fixdep: Permission denied
>>       make[1]: *** [../scripts/Makefile.build:385:
>> arch/s390/lib/expoline/expoline.o] Error 126
>>       make: *** [../arch/s390/Makefile:166: expoline_prepare] Error 2
>>
>> I returned there:
>>    expoline_prepare: prepare0
>> and it looks good so far. Maybe even:
>>    expoline_prepare: scripts
>> would be enough.
> 
> Hi Jiri, thanks for looking into this!
> 
> Probably even scripts_basic would be enough to add explicit dependency
> to fixdep. But I just couldn't reproduce missing scripts/basic/fixdep
> neither with modules_prepare nor expoline_prepare targets.

Hi,

yes, I could not reproduce locally too. It likely needs a "slow" and 
sort of specific machine to happen. This happened randomly only on SUSE 
build systems. And only on the internal ones. There are no failures on 
public ones:
https://build.opensuse.org/packages/kernel-default/job_history/Kernel:stable/S390/s390x

The kernel is built as:
make prepare # builds scripts/basic and other stuff we use
make clean # remove all but scripts and config
make all # scripts/basic/fixdep is rebuilt

fixdep is rebuilt due to clean-ed .fixdep.o.cmd -- that one is 
regenerated and fixdep built anew.

The whole process (make log) is dumped at:
https://build.opensuse.org/package/live_build_log/Kernel:stable/kernel-default/S390/s390x

> With which specific build command were you able to get those error
> messages? I wonder where
>          make[1]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
> is coming from. Could it be smth like?

It's from make after the build (fixdep invocation) failure. So that 
stale files do not exist.

Note that fixdep likely exist, but it is a stub -- linking phase still runs.

> make ARCH=s390 CROSS_COMPILE=s390x-12.2.0- -j64 arch/s390/lib/expoline/expoline.o
> 
> Playing around with this build target I found it is broken:
> 
>    AS      arch/s390/lib/expoline/expoline.o
>    AS      arch/s390/lib/expoline/expoline.o
> fixdep: error opening file: arch/s390/lib/expoline/.expoline.o.d: No such file or directory
> make[3]: *** [scripts/Makefile.build:374: arch/s390/lib/expoline/expoline.o] Error 2
> make[3]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
> make[2]: *** [scripts/Makefile.build:494: arch/s390/lib/expoline] Error 2
> make[1]: *** [scripts/Makefile.build:494: arch/s390/lib] Error 2
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:2028: .] Error 2
> 
> Notice dup AS call, which is probably causing this:
> make[3]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
> 
> But that would be a different issue from the one you are trying to fix.

Likely.

thanks,
Masahiro Yamada March 17, 2023, 11:36 p.m. UTC | #5
On Fri, Mar 17, 2023 at 8:17 PM Vasily Gorbik <gor@linux.ibm.com> wrote:
>
> On Thu, Mar 16, 2023 at 12:14:27PM +0100, Jiri Slaby wrote:
> > On 27. 06. 22, 14:50, Vasily Gorbik wrote:
> > > With that, expoline.S doesn't require asm-offsets.h and
> > > expoline_prepare target dependency could be removed.
> > >
> > > +++ b/arch/s390/Makefile
> > > @@ -166,7 +166,7 @@ vdso_prepare: prepare0
> > >   ifdef CONFIG_EXPOLINE_EXTERN
> > >   modules_prepare: expoline_prepare
> > > -expoline_prepare: prepare0
> > > +expoline_prepare:
> >
> > this likely broke s390 build as expolines still depend on
> > scripts/basic/fixdep. And build of expolines can now race with fixdep build:
> >      make[1]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
> >      /bin/sh: line 1: scripts/basic/fixdep: Permission denied
> >      make[1]: *** [../scripts/Makefile.build:385:
> > arch/s390/lib/expoline/expoline.o] Error 126
> >      make: *** [../arch/s390/Makefile:166: expoline_prepare] Error 2
> >
> > I returned there:
> >   expoline_prepare: prepare0
> > and it looks good so far. Maybe even:
> >   expoline_prepare: scripts
> > would be enough.
>
> Hi Jiri, thanks for looking into this!
>
> Probably even scripts_basic would be enough to add explicit dependency
> to fixdep. But I just couldn't reproduce missing scripts/basic/fixdep
> neither with modules_prepare nor expoline_prepare targets.
>
> With which specific build command were you able to get those error
> messages? I wonder where
>         make[1]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
> is coming from. Could it be smth like?
>
> make ARCH=s390 CROSS_COMPILE=s390x-12.2.0- -j64 arch/s390/lib/expoline/expoline.o
>
> Playing around with this build target I found it is broken:
>
>   AS      arch/s390/lib/expoline/expoline.o
>   AS      arch/s390/lib/expoline/expoline.o
> fixdep: error opening file: arch/s390/lib/expoline/.expoline.o.d: No such file or directory
> make[3]: *** [scripts/Makefile.build:374: arch/s390/lib/expoline/expoline.o] Error 2
> make[3]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
> make[2]: *** [scripts/Makefile.build:494: arch/s390/lib/expoline] Error 2
> make[1]: *** [scripts/Makefile.build:494: arch/s390/lib] Error 2
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:2028: .] Error 2
>
> Notice dup AS call, which is probably causing this:
> make[3]: *** Deleting file 'arch/s390/lib/expoline/expoline.o'
>
> But that would be a different issue from the one you are trying to fix.


Kbuild is able to build a single object that is built
in a normal descending.


Since you built arch/s390/lib/expoline/expoline.o
from the special target 'expoline_prepare',
two different threads simultaneously built
arch/s390/lib/expoline/expoline.o
(one from the normal descending, the other
from 'expoline_prepare')

That's why.




--
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index fc72a35a1f07..4cb5d17e7ead 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -166,7 +166,7 @@  vdso_prepare: prepare0
 
 ifdef CONFIG_EXPOLINE_EXTERN
 modules_prepare: expoline_prepare
-expoline_prepare: prepare0
+expoline_prepare:
 	$(Q)$(MAKE) $(build)=arch/s390/lib/expoline arch/s390/lib/expoline/expoline.o
 endif
 endif
diff --git a/arch/s390/include/asm/nospec-insn.h b/arch/s390/include/asm/nospec-insn.h
index d910d71b5bb5..7e9e99523e95 100644
--- a/arch/s390/include/asm/nospec-insn.h
+++ b/arch/s390/include/asm/nospec-insn.h
@@ -2,8 +2,6 @@ 
 #ifndef _ASM_S390_NOSPEC_ASM_H
 #define _ASM_S390_NOSPEC_ASM_H
 
-#include <asm/alternative-asm.h>
-#include <asm/asm-offsets.h>
 #include <asm/dwarf.h>
 
 #ifdef __ASSEMBLY__