All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	Michal Marek <michal.lkml@markovi.net>
Subject: Re: [PATCH 4/4] kbuild: include Makefile.compiler only when compiler is required
Date: Thu, 18 Mar 2021 14:13:56 -0700	[thread overview]
Message-ID: <20210318211356.nxr4wx24srjtjdqm@archlinux-ax161> (raw)
In-Reply-To: <20210228061028.239459-4-masahiroy@kernel.org>

On Sun, Feb 28, 2021 at 03:10:28PM +0900, Masahiro Yamada wrote:
> Since commit f2f02ebd8f38 ("kbuild: improve cc-option to clean up all
> temporary files"), running 'make kernelversion' in a read-only source
> tree emits a bunch of warnings:
> 
>   mkdir: cannot create directory '.tmp_12345': Permission denied
> 
> Non-build targets such as kernelversion, clean, help, etc. do not
> need to evaluate $(call cc-option,) and friends. Do not include
> Makefile.compiler so $(call cc-option,) becomes no-op.
> 
> This not only fix the warnings, but also runs non-build targets much
> faster.
> 
> Basically, all installation targets should also be non-build targets.
> Unfortunately, vdso_install requires the compiler because it builds
> vdso before installtion. This is a problem that must be fixed by a
> separate patch.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
> I am not adding Reported-by for now because a reporter sent me
> an email privately.
> 
> If he allows me to add Reported-by, I will add it to record
> the credit.
> 
> (Perhaps, another person might have reported a similar issue
> somewhere, but my memory is obsure. I cannot recall it.)
> 
> 
>  Makefile | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index eec7a94f5c33..20724711dc71 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -263,6 +263,10 @@ no-dot-config-targets := $(clean-targets) \
>  			 $(version_h) headers headers_% archheaders archscripts \
>  			 %asm-generic kernelversion %src-pkg dt_binding_check \
>  			 outputmakefile
> +# Installation targets should not require compiler. Unfortunately, vdso_install
> +# is an exception where build artifacts may be updated. This must be fixed.
> +no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
> +			headers_install modules_install kernelrelease image_name
>  no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
>  			  image_name
>  single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
> @@ -270,6 +274,7 @@ single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
>  config-build	:=
>  mixed-build	:=
>  need-config	:= 1
> +need-compiler	:= 1
>  may-sync-config	:= 1
>  single-build	:=
>  
> @@ -279,6 +284,12 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
>  	endif
>  endif
>  
> +ifneq ($(filter $(no-compiler-targets), $(MAKECMDGOALS)),)
> +	ifeq ($(filter-out $(no-compiler-targets), $(MAKECMDGOALS)),)
> +		need-compiler :=
> +	endif
> +endif
> +
>  ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
>  	ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
>  		may-sync-config :=
> @@ -584,7 +595,9 @@ endif
>  
>  # Include this also for config targets because some architectures need
>  # cc-cross-prefix to determine CROSS_COMPILE.
> +ifdef need-compiler
>  include $(srctree)/scripts/Makefile.compiler
> +endif
>  
>  ifdef config-build
>  # ===========================================================================
> -- 
> 2.27.0
> 

Hi Masahiro,

I see a new warning in my builds on arm64 now when running
'modules_install' or 'dtbs_install' because ld-option evaluates to
nothing, which triggers the warning in arch/arm64/Makefile:

$ make -skj"$(nproc)" \
ARCH=arm64 \
CROSS_COMPILE=aarch64-linux- \
INSTALL_DTBS_PATH=rootfs \
INSTALL_MOD_PATH=rootfs \
O=build/arm64 \
distclean defconfig all modules_install dtbs_install
...
/home/nathan/cbl/src/linux-next/arch/arm64/Makefile:25: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum
/home/nathan/cbl/src/linux-next/arch/arm64/Makefile:25: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum

$ sed -n '23,29p' arch/arm64/Makefile
ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
  ifeq ($(call ld-option, --fix-cortex-a53-843419),)
$(warning ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum)
  else
LDFLAGS_vmlinux += --fix-cortex-a53-843419
  endif
endif

I am not sure how this should be resolved, hence just the report.

Cheers,
Nathan

  parent reply	other threads:[~2021-03-18 21:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28  6:10 [PATCH 1/4] kbuild: add image_name to no-sync-config-targets Masahiro Yamada
2021-02-28  6:10 ` [PATCH 2/4] kbuild: prefix $(srctree)/ to some included Makefiles Masahiro Yamada
2021-02-28  6:10 ` [PATCH 3/4] kbuild: spilt cc-option and friends to scripts/Makefile.compiler Masahiro Yamada
2021-04-13 12:51   ` Janosch Frank
2021-04-13 13:11     ` Christian Borntraeger
2021-04-15  7:34       ` Masahiro Yamada
2021-02-28  6:10 ` [PATCH 4/4] kbuild: include Makefile.compiler only when compiler is required Masahiro Yamada
2021-02-28  7:00   ` Masahiro Yamada
2021-03-18 21:13   ` Nathan Chancellor [this message]
2021-03-18 23:36     ` Masahiro Yamada
2021-03-18 23:36       ` Masahiro Yamada
2021-03-08 14:10 ` [PATCH 1/4] kbuild: add image_name to no-sync-config-targets 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=20210318211356.nxr4wx24srjtjdqm@archlinux-ax161 \
    --to=nathan@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    /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.