On Fri, Mar 27, 2026 at 02:32:34PM -0700, Andrew Morton wrote:
> 
> whinges, perrmanits, maybe I'm doing it wrong, etc.
> 
> a)
> 
> At the top-level, neither `make mrproper' nor `make clean' remove the
> executables from tools/testing/selftests/mm/.  Seems wrong?
> 
> b)
> 
> Shouldn't I be able to run
> 
>       make selftests
> 
> from the top level?

Should use:

    make kselftest
    make kselftest-clean

> 
> c)
> 
> tools/testing/selftests/mm
> make clean
> make
> 
> does:
> 
>   CC       droppable
>   CC       guard-regions
>   CC       merge
>   CC       rmap
>   CC       soft-dirty
> gcc -Wall -O2 -I /usr/src/25/tools/testing/selftests/../../..  -isystem 
> /usr/src/25/tools/testing/selftests/../../../usr/include -isystem 
> /usr/src/25/tools/testing/selftests/../../../tools/include/uapi 
> -Wunreachable-code -U_FORTIFY_SOURCE -no-pie -D_GNU_SOURCE= 
> -I/usr/src/25/tools/testing/selftests/../../../tools/testing/selftests  -m32 
> -mxsave  protection_keys.c vm_util.c thp_settings.c pkey_util.c -lrt 
> -lpthread -lm -lrt -ldl -lm -o 
> /usr/src/25/tools/testing/selftests/mm/protection_keys_32
> gcc -Wall -O2 -I /usr/src/25/tools/testing/selftests/../../..  -isystem 
> /usr/src/25/tools/testing/selftests/../../../usr/include -isystem 
> /usr/src/25/tools/testing/selftests/../../../tools/include/uapi 
> -Wunreachable-code -U_FORTIFY_SOURCE -no-pie -D_GNU_SOURCE= 
> -I/usr/src/25/tools/testing/selftests/../../../tools/testing/selftests  -m32 
> -mxsave  pkey_sighandler_tests.c vm_util.c thp_settings.c pkey_util.c -lrt 
> -lpthread -lm -lrt -ldl -lm -o 
> /usr/src/25/tools/testing/selftests/mm/pkey_sighandler_tests_32
> 
> why did it start emitting the gcc command lines?

Those two binaries (*_32 / *_64) are built by custom rules in mm/Makefile.
(Makefile: line #218, #226).

Other tests use shared rules from ../lib.mk, which are quieter (they hide
full commands and show short CC ... lines).

Maybe we need:

--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -215,7 +215,8 @@ ifeq ($(CAN_BUILD_I386),1)
 $(BINARIES_32): CFLAGS += -m32 -mxsave
 $(BINARIES_32): LDLIBS += -lrt -ldl -lm
 $(BINARIES_32): $(OUTPUT)/%_32: %.c
-       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@
+       $(call msg,CC,,$@)
+       $(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@
 $(foreach t,$(VMTARGETS),$(eval $(call gen-target-rule-32,$(t))))
 endif

@@ -223,7 +224,8 @@ ifeq ($(CAN_BUILD_X86_64),1)
 $(BINARIES_64): CFLAGS += -m64 -mxsave
 $(BINARIES_64): LDLIBS += -lrt -ldl
 $(BINARIES_64): $(OUTPUT)/%_64: %.c
-       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@
+       $(call msg,CC,,$@)
+       $(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@
 $(foreach t,$(VMTARGETS),$(eval $(call gen-target-rule-64,$(t))))
 endif

> d) within tools/testing/selftests/mm:
> 
>       make clean
>       make -j100
> 
>    compiles 3-4 things then ends.
> 
>    A subsequent `make -j1' compiles nothing.

Sorry, I wan't able to reproduce it.
Did you mean -j100 only build few source file but not the whole?

>    Whereas
> 
>       make clean
>       make -j1
> 
>    compiles everything.  Slowly.

Both -j100 and -j1 works well from my test (vm: rhel-9.7, x86_64, gcc-11.5.0)

-- 
Regards,
Li Wang


Reply via email to