hdrtest: hide the disgusting turds
Subsystems (5)
cover hdrtest: hide the disgusting turds
Hide all the disgusting turds in .hdrtest subdirectories in the build tree, and put the extra drm build-time checks behind a kconfig option.
BR,
Jani.
Jani Nikula (5):
drm: place header test files in .hdrtest subdirectories drm/xe: place header test files in .hdrtest subdirectories drm/i915: place header test files in .hdrtest subdirectories
kbuild: hdrtest: place header test files in .hdrtest subdirectories
drm: add config option for extra build-time checks
drivers/gpu/drm/Kconfig | 21 +++++++++++++++++++-- drivers/gpu/drm/Makefile | 6 +++--- drivers/gpu/drm/i915/Makefile | 6 +++--- drivers/gpu/drm/xe/Makefile | 6 +++--- include/drm/Makefile | 6 +++--- usr/include/Makefile | 4 ++-- 6 files changed, 33 insertions(+), 16 deletions(-)
Signature · 1 line
2.39.5
PATCH 1/5 drm: place header test files in .hdrtest subdirectories
The header tests track whether headers have been checked using empty *.hdrtest files in the build tree. This pollutes the build directories, as the files live in the same "name space" as the real output files, messing with TAB completion among other things.
Hide the disgusting turds by placing them in .hdrtest subdirectories.
Change the quiet command output to simply $< instead of trying to decode roughly the same from the increasingly complicated $@.
Note that it would be somewhat nicer to have the basename of the .hdrtest files be dot-prefixed instead of using subdirectories. However, it's challenging to come up with a pattern rule for that, as we can list headers to test in the subdirectories of $(src) too, without requiring Makefiles and kbuild to descend to each of them.
---
--- drivers/gpu/drm/Makefile | 6 +++--- include/drm/Makefile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/Makefile +3 -3
@@ -230,14 +230,14 @@ hdrtest-files := \ $(shell cd $(src) && find display lib -name '*.h') always-$(CONFIG_DRM_HEADER_TEST) += \ - $(patsubst %.h,%.hdrtest, $(hdrtest-files)) + $(patsubst %.h,.hdrtest/%.hdrtest, $(hdrtest-files)) # Include the header twice to detect missing include guard. -quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@) +quiet_cmd_hdrtest = HDRTEST $< cmd_hdrtest = \ $(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \ $(srctree)/scripts/kernel-doc -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \ touch $@ -$(obj)/%.hdrtest: $(src)/%.h FORCE +$(obj)/.hdrtest/%.hdrtest: $(src)/%.h FORCE $(call if_changed_dep,hdrtest)
include/drm/Makefile +3 -3
@@ -5,14 +5,14 @@ hdrtest-files := \ $(shell cd $(src) && find * -name '*.h' 2>/dev/null) always-$(CONFIG_DRM_HEADER_TEST) += \ - $(patsubst %.h,%.hdrtest, $(hdrtest-files)) + $(patsubst %.h,.hdrtest/%.hdrtest, $(hdrtest-files)) # Include the header twice to detect missing include guard. -quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@) +quiet_cmd_hdrtest = HDRTEST $< cmd_hdrtest = \ $(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \ $(srctree)/scripts/kernel-doc -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \ touch $@ -$(obj)/%.hdrtest: $(src)/%.h FORCE +$(obj)/.hdrtest/%.hdrtest: $(src)/%.h FORCE $(call if_changed_dep,hdrtest)
Signature · 1 line
2.39.5
PATCH 2/5 drm/xe: place header test files in .hdrtest subdirectories
In reply to Jani NikulaThe header tests track whether headers have been checked using empty *.hdrtest files in the build tree. This pollutes the build directories, as the files live in the same "name space" as the real output files, messing with TAB completion among other things.
Hide the disgusting turds by placing them in .hdrtest subdirectories.
Change the quiet command output to simply $< instead of trying to decode roughly the same from the increasingly complicated $@.
Note that it would be somewhat nicer to have the basename of the .hdrtest files be dot-prefixed instead of using subdirectories. However, it's challenging to come up with a pattern rule for that, as we can list headers to test in the subdirectories of $(src) too, without requiring Makefiles and kbuild to descend to each of them.
---
--- drivers/gpu/drm/xe/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/Makefile +3 -3
@@ -327,12 +327,12 @@ ifneq ($(CONFIG_DRM_XE_DISPLAY),y) endif always-$(CONFIG_DRM_XE_WERROR) += \ - $(patsubst %.h,%.hdrtest, $(shell cd $(src) && find * -name '*.h' $(hdrtest_find_args))) + $(patsubst %.h,.hdrtest/%.hdrtest, $(shell cd $(src) && find * -name '*.h' $(hdrtest_find_args))) -quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@) +quiet_cmd_hdrtest = HDRTEST $< cmd_hdrtest = $(CC) -DHDRTEST $(filter-out $(CFLAGS_GCOV), $(c_flags)) -S -o /dev/null -x c /dev/null -include $<; touch $@ -$(obj)/%.hdrtest: $(src)/%.h FORCE +$(obj)/.hdrtest/%.hdrtest: $(src)/%.h FORCE $(call if_changed_dep,hdrtest) uses_generated_oob := $(addprefix $(obj)/, $(xe-y))
Signature · 1 line
2.39.5
PATCH 3/5 drm/i915: place header test files in .hdrtest subdirectories
In reply to Jani NikulaThe header tests track whether headers have been checked using empty *.hdrtest files in the build tree. This pollutes the build directories, as the files live in the same "name space" as the real output files, messing with TAB completion among other things.
Hide the disgusting turds by placing them in .hdrtest subdirectories.
Change the quiet command output to simply $< instead of trying to decode roughly the same from the increasingly complicated $@.
Note that it would be somewhat nicer to have the basename of the .hdrtest files be dot-prefixed instead of using subdirectories. However, it's challenging to come up with a pattern rule for that, as we can list headers to test in the subdirectories of $(src) too, without requiring Makefiles and kbuild to descend to each of them.
---
--- drivers/gpu/drm/i915/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/Makefile +3 -3
@@ -418,12 +418,12 @@ no-header-test := \ display/intel_vbt_defs.h always-$(CONFIG_DRM_I915_WERROR) += \ - $(patsubst %.h,%.hdrtest, $(filter-out $(no-header-test), \ + $(patsubst %.h,.hdrtest/%.hdrtest, $(filter-out $(no-header-test), \ $(shell cd $(src) && find * -name '*.h'))) -quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@) +quiet_cmd_hdrtest = HDRTEST $< cmd_hdrtest = $(CC) $(filter-out $(CFLAGS_GCOV), $(c_flags)) -S -o /dev/null -x c /dev/null -include $<; \ $(srctree)/scripts/kernel-doc -none -Werror $<; touch $@ -$(obj)/%.hdrtest: $(src)/%.h FORCE +$(obj)/.hdrtest/%.hdrtest: $(src)/%.h FORCE $(call if_changed_dep,hdrtest)
Signature · 1 line
2.39.5
PATCH 4/5 kbuild: hdrtest: place header test files in .hdrtest subdirectories
In reply to Jani NikulaThe header tests track whether headers have been checked using empty *.hdrtest files in the build tree. This pollutes the build directories, as the files live in the same "name space" as the real output files, messing with TAB completion among other things.
Hide the disgusting turds by placing them in .hdrtest subdirectories.
Note that it would be somewhat nicer to have the basename of the .hdrtest files be dot-prefixed instead of using subdirectories. However, it's challenging to come up with a pattern rule for that, as we can list headers to test in the subdirectories of $(src) too, without requiring Makefiles and kbuild to descend to each of them.
---
--- usr/include/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
usr/include/Makefile +2 -2
@@ -71,7 +71,7 @@ endif # asm-generic/*.h is used by asm/*.h, and should not be included directly no-header-test += asm-generic/% -always-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null)) +always-y := $(patsubst $(obj)/%.h,.hdrtest/%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null)) # Include the header twice to detect missing include guard. quiet_cmd_hdrtest = HDRTEST $<
@@ -81,7 +81,7 @@ quiet_cmd_hdrtest = HDRTEST $< $(PERL) $(src)/headers_check.pl $(obj) $<; \ touch $@ -$(obj)/%.hdrtest: $(obj)/%.h FORCE +$(obj)/.hdrtest/%.hdrtest: $(obj)/%.h FORCE $(call if_changed_dep,hdrtest) # Since GNU Make 4.3, $(patsubst $(obj)/%/,%,$(wildcard $(obj)/*/)) works.
Signature · 1 line
2.39.5
Masahiro Yamada
NAKRe: [PATCH 4/5] kbuild: hdrtest: place header test files in .hdrtest subdirectories
Quoted 22 lines · Jani Nikula
The header tests track whether headers have been checked using empty *.hdrtest files in the build tree. This pollutes the build directories, as the files live in the same "name space" as the real output files, messing with TAB completion among other things.
Hide the disgusting turds by placing them in .hdrtest subdirectories.
Note that it would be somewhat nicer to have the basename of the .hdrtest files be dot-prefixed instead of using subdirectories. However, it's challenging to come up with a pattern rule for that, as we can list headers to test in the subdirectories of $(src) too, without requiring Makefiles and kbuild to descend to each of them.
Reported-by Linus Torvalds <[email protected]>Closes https://lore.kernel.org/r/CAHk-=wjMrqzuUmH-mFbR_46EWEFS=bB=J7h9ABMVy56Vi81PKQ@mail.gmail.com open hereFixes fcbb8461fd23 ("kbuild: remove header compile test")Cc Masahiro Yamada <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Jani Nikula <[email protected]>
Quoted 1 line
---
Linus did not mention anything bad for usr/include/.
This crap is unneeded.
NACK.
Quoted 32 lines
--- usr/include/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)usr/include/Makefile +2
-3@@ -71,7 +71,7 @@ endif # asm-generic/*.h is used by asm/*.h, and should not be included directly no-header-test += asm-generic/% -always-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null)) +always-y := $(patsubst $(obj)/%.h,.hdrtest/%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null)) # Include the header twice to detect missing include guard. quiet_cmd_hdrtest = HDRTEST $<@@ -81,7 +81,7 @@ quiet_cmd_hdrtest = HDRTEST $< $(PERL) $(src)/headers_check.pl $(obj) $<; \ touch $@ -$(obj)/%.hdrtest: $(obj)/%.h FORCE +$(obj)/.hdrtest/%.hdrtest: $(obj)/%.h FORCE $(call if_changed_dep,hdrtest) # Since GNU Make 4.3, $(patsubst $(obj)/%/,%,$(wildcard $(obj)/*/)) works. --
Quoted 2 lines
2.39.5
--
Best Regards
Masahiro Yamada
PATCH 5/5 drm: add config option for extra build-time checks
In reply to Jani NikulaThe DRM subsystem contains additional build-time checks, primarily aimed at DRM developers and CI systems. The checks may be overzealous. They may slow down or fail the build altogether. They may create excessive dependency files in the build tree. They should not be enabled for regular builds, and certainly not forced on unsuspecting developers running an allyesconfig or allmodconfig build.
Add config DRM_DISABLE_EXTRA_BUILD_CHECKS, enabled by default as well as by allyesconfig/allmodconfig, hiding the extra checks from anyone but people who intentionally opt-in for the checks.
For example, to enable header tests:
$ scripts/config --disable CONFIG_DRM_DISABLE_EXTRA_BUILD_CHECKS --enable CONFIG_DRM_HEADER_TEST $ make olddefconfig
---
--- drivers/gpu/drm/Kconfig | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/Kconfig +19 -2
@@ -489,9 +489,26 @@ config DRM_PRIVACY_SCREEN bool default n +# Reversed option to disable on allyesconfig/allmodconfig builds +config DRM_DISABLE_EXTRA_BUILD_CHECKS + bool "Disable DRM subsystem extra build-time checks" + default y + help + The DRM subsystem contains additional build-time checks, primarily + aimed at DRM developers and CI systems. The checks may be + overzealous. They may slow down or fail the build altogether. They may + create excessive dependency files in the tree. They should not be + enabled for regular builds, and thus they are disabled by default. + +# Proxy config to allow simple "depends on DRM_EXTRA_BUILD_CHECKS" +config DRM_EXTRA_BUILD_CHECKS + bool + depends on DRM && EXPERT && DRM_DISABLE_EXTRA_BUILD_CHECKS=n + default !DRM_DISABLE_EXTRA_BUILD_CHECKS + config DRM_WERROR bool "Compile the drm subsystem with warnings as errors" - depends on DRM && EXPERT + depends on DRM_EXTRA_BUILD_CHECKS depends on !WERROR default n help
@@ -505,7 +522,7 @@ config DRM_WERROR config DRM_HEADER_TEST bool "Ensure DRM headers are self-contained and pass kernel-doc" - depends on DRM && EXPERT && BROKEN + depends on DRM_EXTRA_BUILD_CHECKS default n help Ensure the DRM subsystem headers both under drivers/gpu/drm and
Signature · 1 line
2.39.5
Patchwork
CI✗ CI.Patch_applied: failure for hdrtest: hide the disgusting turds
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: hdrtest: hide the disgusting turds
URL : https://patchwork.freedesktop.org/series/147057/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 9368766ece6c drm-tip: 2025y-04m-01d-08h-58m-05s UTC integration manifest === git am output follows ===
error: patch failed: drivers/gpu/drm/Kconfig:489
error: drivers/gpu/drm/Kconfig: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm: place header test files in .hdrtest subdirectories
Applying: drm/xe: place header test files in .hdrtest subdirectories
Applying: drm/i915: place header test files in .hdrtest subdirectories
Applying: kbuild: hdrtest: place header test files in .hdrtest subdirectories
Applying: drm: add config option for extra build-time checks
Patch failed at 0005 drm: add config option for extra build-time checks When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Re: ✗ CI.Patch_applied: failure for hdrtest: hide the disgusting turds
Quoted 5 lines · Patchwork
== Series Details ==
Series: hdrtest: hide the disgusting turds
URL : https://patchwork.freedesktop.org/series/147057/
State : failure
The series is based on Linus' tree.
Quoted 20 lines
== Summary ==
=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit:9368766ece6cdrm-tip: 2025y-04m-01d-08h-58m-05s UTC integration manifest === git am output follows ===
error: patch failed:drivers/gpu/drm/Kconfig:489
error:drivers/gpu/drm/Kconfig: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm: place header test files in .hdrtest subdirectories
Applying: drm/xe: place header test files in .hdrtest subdirectories
Applying: drm/i915: place header test files in .hdrtest subdirectories
Applying: kbuild: hdrtest: place header test files in .hdrtest subdirectories
Applying: drm: add config option for extra build-time checks
Patch failed at 0005 drm: add config option for extra build-time checks When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Signature · 1 line
Jani Nikula, Intel
Patchwork
CI✗ Fi.CI.BUILD: failure for hdrtest: hide the disgusting turds
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: hdrtest: hide the disgusting turds
URL : https://patchwork.freedesktop.org/series/147058/
State : failure
== Summary ==
Error: patch https://patchwork.freedesktop.org/api/1.0/series/147058/revisions/1/mbox/ not applied
Applying: drm: place header test files in .hdrtest subdirectories
Applying: drm/xe: place header test files in .hdrtest subdirectories
Applying: drm/i915: place header test files in .hdrtest subdirectories
Applying: kbuild: hdrtest: place header test files in .hdrtest subdirectories
Applying: drm: add config option for extra build-time checks
Using index info to reconstruct a base tree...
M drivers/gpu/drm/Kconfig
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/Kconfig
CONFLICT (content): Merge conflict in drivers/gpu/drm/Kconfig
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0005 drm: add config option for extra build-time checks
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Build failed, no error log produced