All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>
Subject: Re: powerpc VDSO files being unnecessarily rebuilt
Date: Fri, 18 Dec 2020 01:40:24 +0900	[thread overview]
Message-ID: <CAK7LNARAkJ3_-4gX0VA2UkapbOftuzfSTVMBbgbw=HD8n7N+7w@mail.gmail.com> (raw)
In-Reply-To: <CAK7LNASTXyxhLzH7kRyAKCixe6ksJaKPiuPxWnsYZ6NJVCWDhQ@mail.gmail.com>

On Thu, Dec 17, 2020 at 6:23 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Thu, Dec 17, 2020 at 11:56 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
> >
> > Hi all,
> >
> > Since the merge of the C VDSO I see we are repeatedly rebuilding some
> > files in the VDSO, eg:
> >
> >   $ make V=2
> >   make[1]: Entering directory '/home/michael/linux/build~'
> >     GEN     Makefile
> >     CALL    /home/michael/linux/scripts/checksyscalls.sh - due to target missing
> >     CALL    /home/michael/linux/scripts/atomic/check-atomics.sh - due to target missing
> >     CHK     include/generated/compile.h
> >     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to vgettimeofday.o not in $(targets)
> >
> > This then causes multiple other files to be rebuilt.
> >
> > So the obvious fix is to add it to targets:
> >
> > diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
> > index d365810a689a..5386532866ce 100644
> > --- a/arch/powerpc/kernel/vdso64/Makefile
> > +++ b/arch/powerpc/kernel/vdso64/Makefile
> > @@ -5,6 +5,7 @@ ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_
> >  include $(srctree)/lib/vdso/Makefile
> >
> >  obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o
> > +targets := $(obj-vdso64) vdso64.so.dbg
> >
> >  ifneq ($(c-gettimeofday-y),)
> >    CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
> > @@ -13,11 +14,11 @@ ifneq ($(c-gettimeofday-y),)
> >    CFLAGS_vgettimeofday.o += -DDISABLE_BRANCH_PROFILING
> >    CFLAGS_vgettimeofday.o += -ffreestanding -fasynchronous-unwind-tables
> >    CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE)
> > +  targets += vgettimeofday.o
> >  endif
> >
> >  # Build rules
> >
> > -targets := $(obj-vdso64) vdso64.so.dbg
> >  obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
> >
> >  GCOV_PROFILE := n
> >
> >
> > But then I see it still rebuilt:
> >
> >   CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
> >
> >
> > I'm not changing the command line, and AFAICS the .cmd file is not
> > changing either:
> >
> >   $ make V=2
> >   ...
> >     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
> >
> >   $ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >   7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65  build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >
> >   $ make V=2
> >   ...
> >     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
> >
> >   $ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >   7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65  build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >
> >
> > So any hints on what I'm missing here?
> >
> > cheers
>
>
> This is because PPC builds the vdso twice
> with different command arguments.
>
>
> First time:
>
> vdso_prepare: prepare0
>          $(if $(CONFIG_VDSO32),$(Q)$(MAKE) \
>                  $(build)=arch/powerpc/kernel/vdso32
> include/generated/vdso32-offsets.h)
>          $(if $(CONFIG_PPC64),$(Q)$(MAKE) \
>                  $(build)=arch/powerpc/kernel/vdso64
> include/generated/vdso64-offsets.h)
>
>
> Second time:
>    from  arch/powerpc/kernel/Makefile
>
>
>
>
>
> For the first build, -Werror is missing because
> Kbuild directly descends into arch/powerpc/kernel/vdso[32,64]/.
>
>
> For the second build,
>
> arch/powerpc/Kbuild appends the following:
>
> subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
>


This is very dangerous because the vdso offsets are wrong.

I think ppc followed arm64 implementation.

Let me figure out how to fix arm64 vdso.



-- 
Best Regards
Masahiro Yamada

WARNING: multiple messages have this Message-ID (diff)
From: Masahiro Yamada <masahiroy@kernel.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>
Subject: Re: powerpc VDSO files being unnecessarily rebuilt
Date: Fri, 18 Dec 2020 01:40:24 +0900	[thread overview]
Message-ID: <CAK7LNARAkJ3_-4gX0VA2UkapbOftuzfSTVMBbgbw=HD8n7N+7w@mail.gmail.com> (raw)
In-Reply-To: <CAK7LNASTXyxhLzH7kRyAKCixe6ksJaKPiuPxWnsYZ6NJVCWDhQ@mail.gmail.com>

On Thu, Dec 17, 2020 at 6:23 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Thu, Dec 17, 2020 at 11:56 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
> >
> > Hi all,
> >
> > Since the merge of the C VDSO I see we are repeatedly rebuilding some
> > files in the VDSO, eg:
> >
> >   $ make V=2
> >   make[1]: Entering directory '/home/michael/linux/build~'
> >     GEN     Makefile
> >     CALL    /home/michael/linux/scripts/checksyscalls.sh - due to target missing
> >     CALL    /home/michael/linux/scripts/atomic/check-atomics.sh - due to target missing
> >     CHK     include/generated/compile.h
> >     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to vgettimeofday.o not in $(targets)
> >
> > This then causes multiple other files to be rebuilt.
> >
> > So the obvious fix is to add it to targets:
> >
> > diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
> > index d365810a689a..5386532866ce 100644
> > --- a/arch/powerpc/kernel/vdso64/Makefile
> > +++ b/arch/powerpc/kernel/vdso64/Makefile
> > @@ -5,6 +5,7 @@ ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_
> >  include $(srctree)/lib/vdso/Makefile
> >
> >  obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o
> > +targets := $(obj-vdso64) vdso64.so.dbg
> >
> >  ifneq ($(c-gettimeofday-y),)
> >    CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
> > @@ -13,11 +14,11 @@ ifneq ($(c-gettimeofday-y),)
> >    CFLAGS_vgettimeofday.o += -DDISABLE_BRANCH_PROFILING
> >    CFLAGS_vgettimeofday.o += -ffreestanding -fasynchronous-unwind-tables
> >    CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE)
> > +  targets += vgettimeofday.o
> >  endif
> >
> >  # Build rules
> >
> > -targets := $(obj-vdso64) vdso64.so.dbg
> >  obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
> >
> >  GCOV_PROFILE := n
> >
> >
> > But then I see it still rebuilt:
> >
> >   CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
> >
> >
> > I'm not changing the command line, and AFAICS the .cmd file is not
> > changing either:
> >
> >   $ make V=2
> >   ...
> >     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
> >
> >   $ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >   7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65  build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >
> >   $ make V=2
> >   ...
> >     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
> >
> >   $ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >   7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65  build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >
> >
> > So any hints on what I'm missing here?
> >
> > cheers
>
>
> This is because PPC builds the vdso twice
> with different command arguments.
>
>
> First time:
>
> vdso_prepare: prepare0
>          $(if $(CONFIG_VDSO32),$(Q)$(MAKE) \
>                  $(build)=arch/powerpc/kernel/vdso32
> include/generated/vdso32-offsets.h)
>          $(if $(CONFIG_PPC64),$(Q)$(MAKE) \
>                  $(build)=arch/powerpc/kernel/vdso64
> include/generated/vdso64-offsets.h)
>
>
> Second time:
>    from  arch/powerpc/kernel/Makefile
>
>
>
>
>
> For the first build, -Werror is missing because
> Kbuild directly descends into arch/powerpc/kernel/vdso[32,64]/.
>
>
> For the second build,
>
> arch/powerpc/Kbuild appends the following:
>
> subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
>


This is very dangerous because the vdso offsets are wrong.

I think ppc followed arm64 implementation.

Let me figure out how to fix arm64 vdso.



-- 
Best Regards
Masahiro Yamada

  reply	other threads:[~2020-12-17 16:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17  2:56 powerpc VDSO files being unnecessarily rebuilt Michael Ellerman
2020-12-17  9:23 ` Masahiro Yamada
2020-12-17  9:23   ` Masahiro Yamada
2020-12-17 16:40   ` Masahiro Yamada [this message]
2020-12-17 16:40     ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK7LNARAkJ3_-4gX0VA2UkapbOftuzfSTVMBbgbw=HD8n7N+7w@mail.gmail.com' \
    --to=masahiroy@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.