RE: [6.2-rc4] tools: {amd,intel}_pstate_tracer: make -C tools/ clean

Doug Smythies posted 1 patch 2 years, 8 months ago
RE: [6.2-rc4] tools: {amd,intel}_pstate_tracer: make -C tools/ clean
Posted by Doug Smythies 2 years, 8 months ago
On 2023.01.17 07:40 Rafael wrote:
> On 1/17/2023 3:03 PM, Sedat Dilek wrote:
>> Hi,
>> I regularly test:
>> $ LANG=C LC_ALL=C make -C tools/ clean 2>&1 | tee ../make-log_tools-clean.txt
>> This removes:
>>
>> $ git status -s
>> D tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
>> D tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
>>
>> Checking the log:
>>
>> $ grep pstate_tracer.py ../make-log_tools-clean.txt
>> 89:rm -f -r   /home/dileks/src/linux/git/tools/testing/selftests/amd-pstate/../../../power/x86/amd_pstate_tracer/amd_pstate_trace.py
>> /home/dileks/src/linux/git/tools/t
>> esting/selftests/amd-pstate/../../../power/x86/intel_pstate_tracer/intel_pstate_tracer.py
>>
>> Is that intended or not?
>
> I don't think so.
>
> Doug?

Nothing should ever remove the intel_pstate_tracer.py source file.

Sedat, Thank you for your report.
I get the same results when running your test.

Note that I know nothing about Makefiles and such, but
think the guilty commit is this one:

commit ba2d788aa873da9c65ff067ca94665853eab95f0
Author: Meng Li <li.meng@amd.com>
Date:   Mon Oct 31 16:49:22 2022 +0800

    selftests: amd-pstate: Trigger tbench benchmark and test cpus

    Add tbench.sh trigger the tbench testing and monitor the cpu desire
    performance, frequency, load, power consumption and throughput etc.

    Signed-off-by: Meng Li <li.meng@amd.com>
    Acked-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

diff --git a/tools/testing/selftests/amd-pstate/Makefile b/tools/testing/selftests/amd-pstate/Makefile
index 6f4c7b01e3bb..cac8dedb7226 100644
--- a/tools/testing/selftests/amd-pstate/Makefile
+++ b/tools/testing/selftests/amd-pstate/Makefile
@@ -4,7 +4,15 @@
 # No binaries, but make sure arg-less "make" doesn't trigger "run_tests"
 all:

+uname_M := $(shell uname -m 2>/dev/null || echo not)
+ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+
+ifeq (x86,$(ARCH))
+TEST_GEN_FILES += ../../../power/x86/amd_pstate_tracer/amd_pstate_trace.py
+TEST_GEN_FILES += ../../../power/x86/intel_pstate_tracer/intel_pstate_tracer.py
+endif
+
 TEST_PROGS := run.sh
-TEST_FILES := basic.sh
+TEST_FILES := basic.sh tbench.sh

 include ../lib.mk
diff --git a/tools/testing/selftests/amd-pstate/run.sh b/tools/testing/selftests/amd-pstate/run.sh
...

And if I do this:

doug@s19:~/kernel/linux$ git diff
diff --git a/tools/testing/selftests/amd-pstate/Makefile b/tools/testing/selftests/amd-pstate/Makefile
index 5f195ee756d6..5fd1424db37d 100644
--- a/tools/testing/selftests/amd-pstate/Makefile
+++ b/tools/testing/selftests/amd-pstate/Makefile
@@ -7,11 +7,6 @@ all:
 uname_M := $(shell uname -m 2>/dev/null || echo not)
 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)

-ifeq (x86,$(ARCH))
-TEST_GEN_FILES += ../../../power/x86/amd_pstate_tracer/amd_pstate_trace.py
-TEST_GEN_FILES += ../../../power/x86/intel_pstate_tracer/intel_pstate_tracer.py
-endif
-
 TEST_PROGS := run.sh
 TEST_FILES := basic.sh tbench.sh gitsource.sh

The source files do not get deleted with Sedat's test.

... Doug
Re: [6.2-rc4] tools: {amd,intel}_pstate_tracer: make -C tools/ clean
Posted by Sedat Dilek 2 years, 8 months ago
On Tue, Jan 17, 2023 at 5:48 PM Doug Smythies <dsmythies@telus.net> wrote:
...
> And if I do this:
>
> doug@s19:~/kernel/linux$ git diff
> diff --git a/tools/testing/selftests/amd-pstate/Makefile b/tools/testing/selftests/amd-pstate/Makefile
> index 5f195ee756d6..5fd1424db37d 100644
> --- a/tools/testing/selftests/amd-pstate/Makefile
> +++ b/tools/testing/selftests/amd-pstate/Makefile
> @@ -7,11 +7,6 @@ all:
>  uname_M := $(shell uname -m 2>/dev/null || echo not)
>  ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>
> -ifeq (x86,$(ARCH))
> -TEST_GEN_FILES += ../../../power/x86/amd_pstate_tracer/amd_pstate_trace.py
> -TEST_GEN_FILES += ../../../power/x86/intel_pstate_tracer/intel_pstate_tracer.py
> -endif
> -
>  TEST_PROGS := run.sh
>  TEST_FILES := basic.sh tbench.sh gitsource.sh
>
> The source files do not get deleted with Sedat's test.
>

$ LANG=C LC_ALL=C make -C tools/ clean 2>&1 | tee ../make-log_tools-clean.txt

$ git status -s
M tools/testing/selftests/amd-pstate/Makefile

$ git diff
diff --git a/tools/testing/selftests/amd-pstate/Makefile
b/tools/testing/selftests/amd-pstate/Makefile
index 5f195ee756d6..5fd1424db37d 100644
--- a/tools/testing/selftests/amd-pstate/Makefile
+++ b/tools/testing/selftests/amd-pstate/Makefile
@@ -7,11 +7,6 @@ all:
uname_M := $(shell uname -m 2>/dev/null || echo not)
ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)

-ifeq (x86,$(ARCH))
-TEST_GEN_FILES += ../../../power/x86/amd_pstate_tracer/amd_pstate_trace.py
-TEST_GEN_FILES += ../../../power/x86/intel_pstate_tracer/intel_pstate_tracer.py
-endif
-
TEST_PROGS := run.sh
TEST_FILES := basic.sh tbench.sh gitsource.sh

$ egrep 'amd-pstate|pstate_tracer' ../make-log_tools-clean.txt
88:make[2]: Entering directory
'/home/dileks/src/linux/git/tools/testing/selftests/amd-pstate'
90:make[2]: Leaving directory
'/home/dileks/src/linux/git/tools/testing/selftests/amd-pstate'

Confirmed.

-Sedat-
Re: [6.2-rc4] tools: {amd,intel}_pstate_tracer: make -C tools/ clean
Posted by Sedat Dilek 2 years, 8 months ago
On Tue, Jan 17, 2023 at 5:48 PM Doug Smythies <dsmythies@telus.net> wrote:
>
> On 2023.01.17 07:40 Rafael wrote:
> > On 1/17/2023 3:03 PM, Sedat Dilek wrote:
> >> Hi,
> >> I regularly test:
> >> $ LANG=C LC_ALL=C make -C tools/ clean 2>&1 | tee ../make-log_tools-clean.txt
> >> This removes:
> >>
> >> $ git status -s
> >> D tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
> >> D tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
> >>
> >> Checking the log:
> >>
> >> $ grep pstate_tracer.py ../make-log_tools-clean.txt
> >> 89:rm -f -r   /home/dileks/src/linux/git/tools/testing/selftests/amd-pstate/../../../power/x86/amd_pstate_tracer/amd_pstate_trace.py
> >> /home/dileks/src/linux/git/tools/t
> >> esting/selftests/amd-pstate/../../../power/x86/intel_pstate_tracer/intel_pstate_tracer.py
> >>
> >> Is that intended or not?
> >
> > I don't think so.
> >
> > Doug?
>
> Nothing should ever remove the intel_pstate_tracer.py source file.
>
> Sedat, Thank you for your report.
> I get the same results when running your test.
>
> Note that I know nothing about Makefiles and such, but
> think the guilty commit is this one:
>
> commit ba2d788aa873da9c65ff067ca94665853eab95f0
> Author: Meng Li <li.meng@amd.com>
> Date:   Mon Oct 31 16:49:22 2022 +0800
>
>     selftests: amd-pstate: Trigger tbench benchmark and test cpus
>
>     Add tbench.sh trigger the tbench testing and monitor the cpu desire
>     performance, frequency, load, power consumption and throughput etc.
>
>     Signed-off-by: Meng Li <li.meng@amd.com>
>     Acked-by: Huang Rui <ray.huang@amd.com>
>     Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
>
> diff --git a/tools/testing/selftests/amd-pstate/Makefile b/tools/testing/selftests/amd-pstate/Makefile
> index 6f4c7b01e3bb..cac8dedb7226 100644
> --- a/tools/testing/selftests/amd-pstate/Makefile
> +++ b/tools/testing/selftests/amd-pstate/Makefile
> @@ -4,7 +4,15 @@
>  # No binaries, but make sure arg-less "make" doesn't trigger "run_tests"
>  all:
>
> +uname_M := $(shell uname -m 2>/dev/null || echo not)
> +ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
> +
> +ifeq (x86,$(ARCH))
> +TEST_GEN_FILES += ../../../power/x86/amd_pstate_tracer/amd_pstate_trace.py
> +TEST_GEN_FILES += ../../../power/x86/intel_pstate_tracer/intel_pstate_tracer.py
> +endif
> +
>  TEST_PROGS := run.sh
> -TEST_FILES := basic.sh
> +TEST_FILES := basic.sh tbench.sh
>
>  include ../lib.mk
> diff --git a/tools/testing/selftests/amd-pstate/run.sh b/tools/testing/selftests/amd-pstate/run.sh
> ...
>
> And if I do this:
>
> doug@s19:~/kernel/linux$ git diff
> diff --git a/tools/testing/selftests/amd-pstate/Makefile b/tools/testing/selftests/amd-pstate/Makefile
> index 5f195ee756d6..5fd1424db37d 100644
> --- a/tools/testing/selftests/amd-pstate/Makefile
> +++ b/tools/testing/selftests/amd-pstate/Makefile
> @@ -7,11 +7,6 @@ all:
>  uname_M := $(shell uname -m 2>/dev/null || echo not)
>  ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>
> -ifeq (x86,$(ARCH))
> -TEST_GEN_FILES += ../../../power/x86/amd_pstate_tracer/amd_pstate_trace.py
> -TEST_GEN_FILES += ../../../power/x86/intel_pstate_tracer/intel_pstate_tracer.py
> -endif
> -

[ CC Shuah  due to ba2d788aa873da9c65ff067ca94665853eab95f0 ]

Hi Doug,

I guess some upper top-level Makefile in tools/ remove on PHONY
"clean" *TEST_GEN_FILES*.

Wild git grep-ing:

dileks@iniza:~/src/linux/git$ git grep TEST_GEN_FILES tools/ | sort | grep -i rm

As an example:

tools/testing/selftests/bpf/Makefile:   $(Q)$(RM) -r $(TEST_GEN_FILES)

You are right those files are NOT generated and are permanently stored in .git.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py

They should not be removed on `make -C tools/ clean`.

So your above changes make sense to me.

If responsible people agree, come with patch :-).

Best regards,
-Sedat-

[1] https://git.kernel.org/linus/ba2d788aa873da9c65ff067ca94665853eab95f0

>  TEST_PROGS := run.sh
>  TEST_FILES := basic.sh tbench.sh gitsource.sh
>
> The source files do not get deleted with Sedat's test.
>
> ... Doug
>
>