From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bn3nam01on0121.outbound.protection.outlook.com ([104.47.33.121]:36753 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727340AbeH3WMH (ORCPT ); Thu, 30 Aug 2018 18:12:07 -0400 From: Sasha Levin To: "stable@vger.kernel.org" CC: Masahiro Yamada , Sasha Levin Subject: [PATCH AUTOSEL 4.18 097/113] um: fix parallel building with O= option Date: Thu, 30 Aug 2018 18:08:13 +0000 Message-ID: <20180830180714.36167-31-alexander.levin@microsoft.com> References: <20180830180714.36167-1-alexander.levin@microsoft.com> In-Reply-To: <20180830180714.36167-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Masahiro Yamada [ Upstream commit 13d3d01e26b942ada7cfced68ccb6db49597874a ] Randy Dunlap reports UML occasionally fails to build with -j and O=3D options. make[1]: Entering directory '/home/rdunlap/mmotm-2018-0802-1529/UM64' UPD include/generated/uapi/linux/version.h WRAP arch/x86/include/generated/asm/dma-contiguous.h WRAP arch/x86/include/generated/asm/export.h WRAP arch/x86/include/generated/asm/early_ioremap.h WRAP arch/x86/include/generated/asm/mcs_spinlock.h WRAP arch/x86/include/generated/asm/mm-arch-hooks.h WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h WRAP arch/x86/include/generated/uapi/asm/poll.h GEN ./Makefile make[2]: *** No rule to make target 'archheaders'. Stop. arch/um/Makefile:119: recipe for target 'archheaders' failed make[1]: *** [archheaders] Error 2 make[1]: *** Waiting for unfinished jobs.... UPD include/config/kernel.release make[1]: *** wait: No child processes. Stop. Makefile:146: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 The cause of the problem is the use of '$(MAKE) KBUILD_SRC=3D', which recurses to the top Makefile via the $(objtree)/Makefile generated by scripts/mkmakefile. When you run "make -j O=3D ARCH=3Dum", Make can execute 'archheaders' and 'outputmakefile' targets simultaneously because there is no dependency between them. If it happens, $(Q)$(MAKE) KBUILD_SRC=3D ARCH=3D$(HEADER_ARCH) archheaders ... tries to run $(objtree)/Makefile that is being updated. The correct way for the recursion is $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=3D$(HEADER_ARCH) archheaders ..., which does not rely on the generated Makefile. Reported-by: Randy Dunlap Signed-off-by: Masahiro Yamada Tested-by: Randy Dunlap Acked-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/um/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/um/Makefile b/arch/um/Makefile index e54dda8a0363..de340e41f3b2 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -122,8 +122,7 @@ archheaders: $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ kbuild-file=3D$(HOST_DIR)/include/uapi/asm/Kbuild \ obj=3D$(HOST_DIR)/include/generated/uapi/asm - $(Q)$(MAKE) KBUILD_SRC=3D ARCH=3D$(HEADER_ARCH) archheaders - + $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=3D$(HEADER_ARCH) archheaders =20 archprepare: include/generated/user_constants.h =20 --=20 2.17.1