Skip to contentSkip to conversation

kbuild: ensure mrproper removes arch/$(SUBARCH)/include/generated/

PATCH Superseded Vitor Massaru Iha 3 participants 7 messages Apr 14, 2020 – Apr 21, 2020

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kbuild: ensure mrproper removes arch/$(SUBARCH)/include/generated/

In the following use case, when compiling the kernel for the UML architecture, for example:

* make ARCH=um defconfig && make ARCH=um -j8,

SUBARCH files are generated, however when we run the command:

* mrproper ARCH=um

the files `arch/$(SUBARCH)/include/generated/ aren't cleaned up.

This generates compilation errors by running the following command:

* make ARCH=um defconfig O=./build_um && make ARCH=um -j8 O=./build_um

This PATCH fix that problem.

This makes it possible to compile on different architectures that use the SUBARCH variable, in different build directories and root directory of the linux directory. This is important because we can compile without the object files being overwritten. This reduces the re-compilation time in this use case.

Besides that, in the workflow of developing unit tests, using kunit, and compiling in different architectures to develop or test a PATCH, this use case applies.

* This bug was introduced in this commit a788b2ed81abe

* Related bug: https://bugzilla.kernel.org/show_bug.cgi?id=205219

---
v2:
* Explains what this PATCH does and the importance as suggested by Brendan Higgins.

---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +3 -1
index 70def4907036..e1a79796032e 100644
@@ -532,7 +532,8 @@ outputmakefile:
 ifdef building_out_of_srctree
 	$(Q)if [ -f $(srctree)/.config -o \
 		 -d $(srctree)/include/config -o \
-		 -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
+		 -d $(srctree)/arch/$(SRCARCH)/include/generated -o \
+		 -d $(srctree)/arch/$(SUBARCH)/include/generated ]; then \
 		echo >&2 "***"; \
 		echo >&2 "*** The source tree is not clean, please run 'make$(if $(findstring command line, $(origin ARCH)), ARCH=$(ARCH)) mrproper'"; \
 		echo >&2 "*** in $(abs_srctree)";\
@@ -1388,6 +1389,7 @@ CLEAN_FILES += modules.builtin modules.builtin.modinfo modules.nsdeps
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated          \
 		  arch/$(SRCARCH)/include/generated .tmp_objdiff \
+		  arch/$(SUBARCH)/include/generated \
 		  debian/ snap/ tar-install/
 MRPROPER_FILES += .config .config.old .version \
 		  Module.symvers \
Signature · 1 line
2.25.1
#1 lore raw

- Everyone except LKMP people

Quoted 27 lines · Vitor Massaru Iha

In the following use case, when compiling the kernel for the UML architecture, for example:

* make ARCH=um defconfig && make ARCH=um -j8,

SUBARCH files are generated, however when we run the command:

* mrproper ARCH=um

the files `arch/$(SUBARCH)/include/generated/ aren't cleaned up.

This generates compilation errors by running the following command:

* make ARCH=um defconfig O=./build_um && make ARCH=um -j8 O=./build_um

This PATCH fix that problem.

This makes it possible to compile on different architectures that use the SUBARCH variable, in different build directories and root directory of the linux directory. This is important because we can compile without the object files being overwritten. This reduces the re-compilation time in this use case.

Besides that, in the workflow of developing unit tests, using kunit, and compiling in different architectures to develop or test a PATCH, this use case applies.

Quoted 7 lines

* This bug was introduced in this commit a788b2ed81abe

* Related bug: https://bugzilla.kernel.org/show_bug.cgi?id=205219

Looks great!

Should linux-kernel-mentees@ be CC'ed on all of your patches? I thought Shuah said yes.
_______________________________________________
Linux-kernel-mentees mailing list [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#2 lore raw
Quoted 33 lines · Brendan Higgins

- Everyone except LKMP people

Quoted 29 lines · Vitor Massaru Iha

In the following use case, when compiling the kernel for the UML architecture, for example:

* make ARCH=um defconfig && make ARCH=um -j8,

SUBARCH files are generated, however when we run the command:

* mrproper ARCH=um

the files `arch/$(SUBARCH)/include/generated/ aren't cleaned up.

This generates compilation errors by running the following command:

* make ARCH=um defconfig O=./build_um && make ARCH=um -j8 O=./build_um

This PATCH fix that problem.

This makes it possible to compile on different architectures that use the SUBARCH variable, in different build directories and root directory of the linux directory. This is important because we can compile without the object files being overwritten. This reduces the re-compilation time in this use case.

Besides that, in the workflow of developing unit tests, using kunit, and compiling in different architectures to develop or test a PATCH, this use case applies.

* This bug was introduced in this commit a788b2ed81abe

Quoted 7 lines
Quoted 5 lines

* Related bug: https://bugzilla.kernel.org/show_bug.cgi?id=205219

Looks great!

Thanks!

Quoted 2 lines

Should linux-kernel-mentees@ be CC'ed on all of your patches? I thought Shuah said yes.

Sorry about that, I forgot to include the linux-kernel-mentees list.
_______________________________________________
Linux-kernel-mentees mailing list [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#3 lore raw
In reply to Vitor Massaru Iha

Hi.

Quoted 9 lines · Vitor Massaru Iha

In the following use case, when compiling the kernel for the UML architecture, for example:

* make ARCH=um defconfig && make ARCH=um -j8,

SUBARCH files are generated, however when we run the command:

* mrproper ARCH=um

make ARCH=um mrproper

Quoted 7 lines

the files `arch/$(SUBARCH)/include/generated/ aren't cleaned up.

This generates compilation errors by running the following command:

* make ARCH=um defconfig O=./build_um && make ARCH=um -j8 O=./build_um

This PATCH fix that problem.

This patch fixes ...

Quoted 5 lines

This makes it possible to compile on different architectures that use the SUBARCH variable, in different build directories and root directory of the linux directory. This is important because we can compile without the object files being overwritten. This reduces the re-compilation time in this use case.

Sorry, I do not understand this paragraph.

Brendan Higgins just reported the build error
in the out-of-tree build after in-tree build.

[1] make ARCH=um defconfig all
[2] make ARCH=um mrproper
[3] make ARCH=um O=foo defconfig all

-> build error

Ins't it?

Quoted 6 lines

Besides that, in the workflow of developing unit tests, using kunit, and compiling in different architectures to develop or test a PATCH, this use case applies.

* This bug was introduced in this commit a788b2ed81abe

Instead, adding Fixes tag is the convention.

Fixes a788b2ed81ab ("kbuild: check arch/$(SRCARCH)/include/generated

before out-of-tree build")

Quoted 2 lines

* Related bug: https://bugzilla.kernel.org/show_bug.cgi?id=205219

Maybe, this can be also a tag.

Quoted 2 lines
Quoted 15 lines

---
v2:
* Explains what this PATCH does and the importance as suggested by Brendan Higgins.

---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +0 -0
index 70def4907036..e1a79796032e 100644

Makefile outputmakefile: · line 536

Quoted 6 lines
Makefile +2 -1
@@ -532,7 +532,8 @@ outputmakefile:
 ifdef building_out_of_srctree
        $(Q)if [ -f $(srctree)/.config -o \
                 -d $(srctree)/include/config -o \
-                -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
+                -d $(srctree)/arch/$(SRCARCH)/include/generated -o \
+                -d $(srctree)/arch/$(SUBARCH)/include/generated ]; then \

This hunk is unneeded.

Quoted 12 lines
Makefile +1 -1
                echo >&2 "***"; \
                echo >&2 "*** The source tree is not clean, please run 'make$(if $(findstring command line, $(origin ARCH)), ARCH=$(ARCH)) mrproper'"; \
                echo >&2 "*** in $(abs_srctree)";\
@@ -1388,6 +1389,7 @@ CLEAN_FILES += modules.builtin modules.builtin.modinfo modules.nsdeps
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated          \
                  arch/$(SRCARCH)/include/generated .tmp_objdiff \
+                 arch/$(SUBARCH)/include/generated \
                  debian/ snap/ tar-install/
 MRPROPER_FILES += .config .config.old .version \
                  Module.symvers \
--
Quoted 2 lines

2.25.1

This problem is only related to ARCH=um builds.
So, it should be fixed in arch/um/Makefile.

arch/um/Makefile +0 -0
index d2daa206872d..275f5ffdf6f0 100644
@@ -140,6 +140,7 @@ export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS)

$(LD_FLAGS_CMDLINE)
# When cleaning we don't include .config, so we don't include # TT or skas makefiles and don't clean skas_ptregs.h. CLEAN_FILES += linux x.i gmon.out
+MRPROPER_DIRS += arch/$(SUBARCH)/include/generated

archclean:

        @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \

--
Best Regards
Masahiro Yamada

#4 lore raw
Quoted 154 lines · Masahiro Yamada

Hi.

On Tue, Apr 14, 2020 at 10:21 AM Vitor Massaru Iha <[email protected]

Quoted 9 lines

wrote:
In the following use case, when compiling the kernel for the UML architecture, for example:

* make ARCH=um defconfig && make ARCH=um -j8,

SUBARCH files are generated, however when we run the command:

* mrproper ARCH=um

make ARCH=um mrproper

Quoted 8 lines

the files `arch/$(SUBARCH)/include/generated/ aren't cleaned up.

This generates compilation errors by running the following command:

* `make ARCH=um defconfig O=./build_um && make ARCH=um -j8
O=./build_um`

This PATCH fix that problem.

This patch fixes ...

Quoted 8 lines

This makes it possible to compile on different architectures that use the
SUBARCH variable, in different build directories and root directory of the
linux directory. This is important because we can compile without the object
files being overwritten. This reduces the re-compilation time in this use case.

Sorry, I do not understand this paragraph.

Brendan Higgins just reported the build error
in the out-of-tree build after in-tree build.

[1] make ARCH=um defconfig all
[2] make ARCH=um mrproper
[3] make ARCH=um O=foo defconfig all

-> build error

Ins't it?

Quoted 7 lines

Besides that, in the workflow of developing unit tests, using kunit, and
compiling in different architectures to develop or test a PATCH, this use case
applies.

* This bug was introduced in this commit a788b2ed81abe

Instead, adding Fixes tag is the convention.

Fixes a788b2ed81ab ("kbuild: check arch/$(SRCARCH)/include/generated

before out-of-tree build")

Quoted 1 line

* Related bug: https://bugzilla.kernel.org/show_bug.cgi?id=205219

Maybe, this can be also a tag.

Quoted 1 line
Quoted 15 lines

---
v2:
* Explains what this PATCH does and the importance as suggested by Brendan Higgins.

---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +0 -0
index 70def4907036..e1a79796032e 100644

Makefile outputmakefile: · line 539

Quoted 9 lines
Makefile +2 -1
@@ -532,7 +532,8 @@ outputmakefile:
 ifdef building_out_of_srctree
        $(Q)if [ -f $(srctree)/.config -o \
                 -d $(srctree)/include/config -o \
-                -d $(srctree)/arch/$(SRCARCH)/include/generated ];
 then \
+                -d $(srctree)/arch/$(SRCARCH)/include/generated -o
 \
+                -d $(srctree)/arch/$(SUBARCH)/include/generated ];
 then \

This hunk is unneeded.

Quoted 8 lines

echo >&2 "***"; \
echo >&2 "*** The source tree is not clean, please
run 'make$(if $(findstring command line, $(origin ARCH)),

ARCH=$(ARCH)) mrproper'"; \
                echo >&2 "*** in $(abs_srctree)";\
Makefile +0 -0
@@ -1388,6 +1389,7 @@ CLEAN_FILES += modules.builtin

modules.builtin.modinfo modules.nsdeps
# Directories & files removed with 'make mrproper'

Quoted 9 lines
 MRPROPER_DIRS  += include/config include/generated          \
                  arch/$(SRCARCH)/include/generated .tmp_objdiff \
+                 arch/$(SUBARCH)/include/generated \
                  debian/ snap/ tar-install/
 MRPROPER_FILES += .config .config.old .version \
                  Module.symvers \

--
2.25.1

This problem is only related to ARCH=um builds.
So, it should be fixed in arch/um/Makefile.

arch/um/Makefile +1 -0
index d2daa206872d..275f5ffdf6f0 100644
@@ -140,6 +140,7 @@ export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS)
 $(LD_FLAGS_CMDLINE)
 # When cleaning we don't include .config, so we don't include
 # TT or skas makefiles and don't clean skas_ptregs.h.
 CLEAN_FILES += linux x.i gmon.out
+MRPROPER_DIRS += arch/$(SUBARCH)/include/generated
 
 archclean:
        @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
Quoted 3 lines

--
Best Regards
Masahiro Yamada

Thanks for review. I agree with the suggested changes.

#5 lore raw
In reply to Masahiro Yamada

Hi Masahiro,

Quoted 72 lines · Masahiro Yamada

Hi.

On Tue, Apr 14, 2020 at 10:21 AM Vitor Massaru Iha <[email protected]

Quoted 9 lines

wrote:
In the following use case, when compiling the kernel for the UML architecture, for example:

* make ARCH=um defconfig && make ARCH=um -j8,

SUBARCH files are generated, however when we run the command:

* mrproper ARCH=um

make ARCH=um mrproper

Quoted 8 lines

the files `arch/$(SUBARCH)/include/generated/ aren't cleaned up.

This generates compilation errors by running the following command:

* `make ARCH=um defconfig O=./build_um && make ARCH=um -j8
O=./build_um`

This PATCH fix that problem.

This patch fixes ...

Quoted 8 lines

This makes it possible to compile on different architectures that use the
SUBARCH variable, in different build directories and root directory of the
linux directory. This is important because we can compile without the object
files being overwritten. This reduces the re-compilation time in this use case.

Sorry, I do not understand this paragraph.

Brendan Higgins just reported the build error
in the out-of-tree build after in-tree build.

[1] make ARCH=um defconfig all
[2] make ARCH=um mrproper
[3] make ARCH=um O=foo defconfig all

-> build error

Ins't it?

Quoted 7 lines

Besides that, in the workflow of developing unit tests, using kunit, and
compiling in different architectures to develop or test a PATCH, this use case
applies.

* This bug was introduced in this commit a788b2ed81abe

Instead, adding Fixes tag is the convention.

Fixes a788b2ed81ab ("kbuild: check arch/$(SRCARCH)/include/generated

before out-of-tree build")

Quoted 1 line

* Related bug: https://bugzilla.kernel.org/show_bug.cgi?id=205219

Maybe, this can be also a tag.

Quoted 8 lines
Quoted 1 line

Was actually Reported-by Theodore Ts'o <[email protected]>
https://groups.google.com/forum/#!msg/kunit-dev/QmA27YEgEgI/hvS1kiz2CwAJ

Quoted 61 lines
Quoted 18 lines

---
v2:
* Explains what this PATCH does and the importance as suggested by Brendan Higgins.

---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +0 -0
index 70def4907036..e1a79796032e 100644

Makefile outputmakefile: · line 539

Quoted 9 lines
Makefile +2 -1
@@ -532,7 +532,8 @@ outputmakefile:
 ifdef building_out_of_srctree
        $(Q)if [ -f $(srctree)/.config -o \
                 -d $(srctree)/include/config -o \
-                -d $(srctree)/arch/$(SRCARCH)/include/generated ];
 then \
+                -d $(srctree)/arch/$(SRCARCH)/include/generated -o
 \
+                -d $(srctree)/arch/$(SUBARCH)/include/generated ];
 then \

This hunk is unneeded.

Quoted 8 lines

echo >&2 "***"; \
echo >&2 "*** The source tree is not clean, please
run 'make$(if $(findstring command line, $(origin ARCH)),

ARCH=$(ARCH)) mrproper'"; \
                echo >&2 "*** in $(abs_srctree)";\
Makefile +0 -0
@@ -1388,6 +1389,7 @@ CLEAN_FILES += modules.builtin

modules.builtin.modinfo modules.nsdeps
# Directories & files removed with 'make mrproper'

Quoted 9 lines
 MRPROPER_DIRS  += include/config include/generated          \
                  arch/$(SRCARCH)/include/generated .tmp_objdiff \
+                 arch/$(SUBARCH)/include/generated \
                  debian/ snap/ tar-install/
 MRPROPER_FILES += .config .config.old .version \
                  Module.symvers \

--
2.25.1

This problem is only related to ARCH=um builds.
So, it should be fixed in arch/um/Makefile.

arch/um/Makefile +0 -0
index d2daa206872d..275f5ffdf6f0 100644

arch/um/Makefile export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) · line 144

Quoted 5 lines
arch/um/Makefile +1 -0
@@ -140,6 +140,7 @@ export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS)
 $(LD_FLAGS_CMDLINE)
 # When cleaning we don't include .config, so we don't include
 # TT or skas makefiles and don't clean skas_ptregs.h.
 CLEAN_FILES += linux x.i gmon.out
+MRPROPER_DIRS += arch/$(SUBARCH)/include/generated

Can I add suggested-by Masahiro Yamada <[email protected]> ?

Quoted 10 lines
arch/um/Makefile +0 -1
 archclean:
        @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
 
 
 
 
 
--

Best Regards
Masahiro Yamada

#6 lore raw

Hi Vitor,

Quoted 8 lines · Vitor Massaru Iha
Quoted 5 lines
Quoted 3 lines

Was actually Reported-by Theodore Ts'o <[email protected]>
https://groups.google.com/forum/#!msg/kunit-dev/QmA27YEgEgI/hvS1kiz2CwAJ

OK, please add his tag, then.

Quoted 2 lines

Can I add suggested-by Masahiro Yamada <[email protected]> ?

Please feel free to do so.

Signature · 2 lines
Best Regards
Masahiro Yamada