From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-kbuild@vger.kernel.org, Jarod Wilson <jarod@redhat.com>,
Prarit Bhargava <prarit@redhat.com>,
Michal Marek <michal.lkml@markovi.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/7] kbuild: restore touching autoksyms.h to the top Makefile
Date: Wed, 14 Mar 2018 13:52:16 -0400 (EDT) [thread overview]
Message-ID: <nycvar.YSQ.7.76.1803141350430.28583@knanqh.ubzr> (raw)
In-Reply-To: <1521045861-22418-5-git-send-email-yamada.masahiro@socionext.com>
On Thu, 15 Mar 2018, Masahiro Yamada wrote:
> Commit d3fc425e819b ("kbuild: make sure autoksyms.h exists early")
> moved the code that touches autoksyms.h to scripts/kconfig/Makefile
> with obscure reason.
>
> From Nicolas' comment [1], he did not seem to be sure about the root
> cause.
>
> I guess I figured it out, so here is a fix-up I think is more correct.
> According to the error log in the original post [2], the build failed
> in scripts/mod/devicetable-offsets.c
>
> scripts/mod/Makefile is descended from scripts/Makefile, which is
> invoked from the top-level Makefile by the 'scripts' target.
>
> To build vmlinux and/or modules, Kbuild descend into $(vmlinux-dirs).
> This depends on 'prepare' and 'script' as follows:
>
> $(vmlinux-dirs): prepare scripts
>
> Because there is no dependency between 'prepare' and 'scripts', the
> parallel building can run them simultaneously.
>
> 'prepare' depends on 'prepare1', which touched autoksyms.h, whereas
> 'scripts' descends into script/, then scripts/mod/, which needed
> <generated/autoksyms.h> if CONFIG_TRIM_UNUSED_KSYMS. This was the
> reason of race.
>
> I am not happy to have unrelated code in the Kconfig Makefile, so
> getting it back to the top Makefile.
>
> I remove the standalone test target because I want to use it to
> create an empty autoksyms.h file. Here is a little improvement;
> unnecessary autoksyms.h is not created when CONFIG_TRIM_UNUSED_KSYMS
> is disabled.
>
> [1] https://lkml.org/lkml/2016/11/30/734
> [2] https://lkml.org/lkml/2016/11/30/531
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
You're the make master!
Acked-by: Nicolas Pitre <nico@linaro.org>
> Commit:
>
> The discussion happened in Nov. 2016.
>
> I was not involved in it.
> I was not the Kbuild maintainer at that time.
>
> END
>
> ---
>
> Makefile | 12 +++++++-----
> scripts/kconfig/Makefile | 2 --
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index fab0e19..decc870 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1010,9 +1010,11 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS
> "$(MAKE) -f $(srctree)/Makefile vmlinux"
> endif
>
> -# standalone target for easier testing
> -include/generated/autoksyms.h: FORCE
> - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh true
> +autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
> +
> +$(autoksyms_h):
> + $(Q)mkdir -p $(dir $@)
> + $(Q)touch $@
>
> ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
>
> @@ -1056,7 +1058,7 @@ include/config/kernel.release: include/config/auto.conf FORCE
> # in parallel
> PHONY += scripts
> scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \
> - asm-generic gcc-plugins autoksyms
> + asm-generic gcc-plugins $(autoksyms_h)
> $(Q)$(MAKE) $(build)=$(@)
>
> # Things we need to do before we recursively start building the kernel
> @@ -1086,7 +1088,7 @@ endif
> # that need to depend on updated CONFIG_* values can be checked here.
> prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic
>
> -prepare1: prepare2 $(version_h) include/generated/utsrelease.h \
> +prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h \
> include/config/auto.conf
> $(cmd_crmodverdir)
>
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index cb3ec53..eb139a1 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -38,8 +38,6 @@ nconfig: $(obj)/nconf
> # for external use.
> silentoldconfig: $(obj)/conf
> $(Q)mkdir -p include/config include/generated
> - $(Q)test -e include/generated/autoksyms.h || \
> - touch include/generated/autoksyms.h
> $< $(silent) --$@ $(Kconfig)
>
> localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
> --
> 2.7.4
>
>
next prev parent reply other threads:[~2018-03-14 17:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 16:44 [PATCH 0/7] kbuild: various fix, clean-up, improvements of CONFIG_TRIM_UNUSED_KSYMS Masahiro Yamada
2018-03-14 16:44 ` [PATCH 1/7] kbuild: clear LDFLAGS in the top Makefile Masahiro Yamada
2018-03-14 16:44 ` [PATCH 2/7] kbuild: touch autoksyms.h when it is really missing Masahiro Yamada
2018-03-14 17:26 ` Nicolas Pitre
2018-03-15 6:26 ` Masahiro Yamada
2018-03-14 16:44 ` [PATCH 3/7] kbuild: move 'scripts' target below Masahiro Yamada
2018-03-16 7:13 ` kbuild test robot
2018-03-16 7:20 ` Masahiro Yamada
2018-03-14 16:44 ` [PATCH 4/7] kbuild: restore touching autoksyms.h to the top Makefile Masahiro Yamada
2018-03-14 17:52 ` Nicolas Pitre [this message]
2018-03-14 16:44 ` [PATCH 5/7] kbuild: hide CONFIG_TRIM_UNUSED_KSYMS code from external module building Masahiro Yamada
2018-03-14 18:32 ` Nicolas Pitre
2018-03-15 6:36 ` Masahiro Yamada
2018-03-15 18:30 ` Nicolas Pitre
2018-03-14 16:44 ` [PATCH 6/7] kbuild: move include/config/ksym/* to include/ksym/* Masahiro Yamada
2018-03-14 18:47 ` Nicolas Pitre
2018-03-15 10:04 ` Masahiro Yamada
2018-03-15 11:01 ` Masahiro Yamada
2018-03-15 18:59 ` Nicolas Pitre
2018-03-14 16:44 ` [PATCH 7/7] kbuild: link vmlinux just once for CONFIG_TRIM_UNUSED_KSYMS Masahiro Yamada
2018-03-14 19:06 ` Nicolas Pitre
2018-03-15 8:00 ` Masahiro Yamada
2018-03-15 18:50 ` Nicolas Pitre
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=nycvar.YSQ.7.76.1803141350430.28583@knanqh.ubzr \
--to=nicolas.pitre@linaro.org \
--cc=jarod@redhat.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=prarit@redhat.com \
--cc=yamada.masahiro@socionext.com \
/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 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).