[PATCH V1 4/4] Documentation: amd-pstate: Add tbench and gitsource test introduction

From: Meng Li
Date: Wed Jul 06 2022 - 03:37:32 EST


Introduce tbench and gitsource test cases design and implementation.
Monitor cpus changes about performance and power consumption etc.

Signed-off-by: Meng Li <li.meng@xxxxxxx>
---
Documentation/admin-guide/pm/amd-pstate.rst | 124 +++++++++++++++++---
1 file changed, 106 insertions(+), 18 deletions(-)

diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst
index 8f3d30c5a0d8..48fb488e000e 100644
--- a/Documentation/admin-guide/pm/amd-pstate.rst
+++ b/Documentation/admin-guide/pm/amd-pstate.rst
@@ -409,37 +409,53 @@ Unit Tests for amd-pstate

1. Test case decriptions

+ 1). basic tests
+
+ Test prerequisite and basic functions for the ``amd-pstate`` driver.
+
+---------+--------------------------------+------------------------------------------------------------------------------------+
| Index | Functions | Description |
+=========+================================+====================================================================================+
- | 0 | amd_pstate_ut_acpi_cpc_valid || Check whether the _CPC object is present in SBIOS. |
+ | 1 | amd_pstate_ut_acpi_cpc_valid || Check whether the _CPC object is present in SBIOS. |
| | || |
| | || The detail refer to `Processor Support <processor_support_>`_. |
+---------+--------------------------------+------------------------------------------------------------------------------------+
- | 1 | amd_pstate_ut_check_enabled || Check whether AMD P-State is enabled. |
+ | 2 | amd_pstate_ut_check_enabled || Check whether AMD P-State is enabled. |
| | || |
| | || AMD P-States and ACPI hardware P-States always can be supported in one processor. |
| | | But AMD P-States has the higher priority and if it is enabled with |
| | | :c:macro:`MSR_AMD_CPPC_ENABLE` or ``cppc_set_enable``, it will respond to the |
| | | request from AMD P-States. |
+---------+--------------------------------+------------------------------------------------------------------------------------+
- | 2 | amd_pstate_ut_check_perf || Check if the each performance values are reasonable. |
+ | 3 | amd_pstate_ut_check_perf || Check if the each performance values are reasonable. |
| | || highest_perf >= nominal_perf > lowest_nonlinear_perf > lowest_perf > 0. |
+---------+--------------------------------+------------------------------------------------------------------------------------+
- | 3 | amd_pstate_ut_check_freq || Check if the each frequency values and max freq when set support boost mode |
+ | 4 | amd_pstate_ut_check_freq || Check if the each frequency values and max freq when set support boost mode |
| | | are reasonable. |
| | || max_freq >= nominal_freq > lowest_nonlinear_freq > min_freq > 0 |
| | || If boost is not active but supported, this maximum frequency will be larger than |
| | | the one in ``cpuinfo``. |
+---------+--------------------------------+------------------------------------------------------------------------------------+

+ 2). Tbench test
+
+ Testing and monitor the cpu changes when running tbench benchmark under the specified governor.
+ These changes include desire performance, frequency, load, performance, energy etc.
+ The specified governor is ondemand or schedutil.
+
+ 3). Gitsource test
+
+ Testing and monitor the cpu changes when running gitsource benchmark under the specified governor.
+ These changes include desire performance, frequency, load, time, energy etc.
+ The specified governor is ondemand or schedutil.
+
#. How to execute the tests

We use test module in the kselftest frameworks to implement it.
We create amd-pstate-ut module and tie it into kselftest.(for
details refer to Linux Kernel Selftests [4]_).

- 1. Build
+ a. Build

+ open the :c:macro:`CONFIG_X86_AMD_PSTATE` configuration option.
+ set the :c:macro:`CONFIG_X86_AMD_PSTATE_UT` configuration option to M.
@@ -449,23 +465,95 @@ Unit Tests for amd-pstate
$ cd linux
$ make -C tools/testing/selftests

+ + make perf ::
+
+ $ cd tools/perf/
+ $ make
+
+
#. Installation & Steps ::

$ make -C tools/testing/selftests install INSTALL_PATH=~/kselftest
+ $ cp tools/perf/perf ~/kselftest/amd-pstate/
$ sudo ./kselftest/run_kselftest.sh -c amd-pstate
- TAP version 13
- 1..1
- # selftests: amd-pstate: amd-pstate-ut.sh
- # amd-pstate-ut: ok
- ok 1 selftests: amd-pstate: amd-pstate-ut.sh
-
- #. Results ::
-
- $ dmesg | grep "amd_pstate_ut" | tee log.txt
- [12977.570663] amd_pstate_ut: 1 amd_pstate_ut_acpi_cpc_valid success!
- [12977.570673] amd_pstate_ut: 2 amd_pstate_ut_check_enabled success!
- [12977.571207] amd_pstate_ut: 3 amd_pstate_ut_check_perf success!
- [12977.571212] amd_pstate_ut: 4 amd_pstate_ut_check_freq success!
+
+ #. Specified test case ::
+
+ $ cd ~/kselftest/amd-pstate
+ $ sudo ./run.sh -t basic
+ $ sudo ./run.sh -t tbench
+ $ sudo ./run.sh -t gitsource
+ $ ./run.sh --help
+ ./run.sh: illegal option -- -
+ Usage: ./run.sh [OPTION...]
+ [-h <help>]
+ [-o <output-file-for-dump>]
+ [-t <all: All testing,
+ basic: Basic testing,
+ tbench: Test tbench,
+ gitsource: Test gitsource.>]
+ [-i <tbench time limit>]
+ [-p <tbench process number>]
+ [-l <loop times for tbench/gitsource]
+ [-n <amd tracer interval]
+
+ 4). Results
+
+ + basic
+
+ When you finish test, you will get the following log info ::
+
+ $ dmesg | grep "amd_pstate_ut" | tee log.txt
+ [12977.570663] amd_pstate_ut: 1 amd_pstate_ut_acpi_cpc_valid success!
+ [12977.570673] amd_pstate_ut: 2 amd_pstate_ut_check_enabled success!
+ [12977.571207] amd_pstate_ut: 3 amd_pstate_ut_check_perf success!
+ [12977.571212] amd_pstate_ut: 4 amd_pstate_ut_check_freq success!
+
+ + tbench
+
+ When you finish test, you will get selftest.tbench.csv and selftest.tbench.result files form amd-pstate.
+ Open selftest.tbench.csv :
+
+ +-----------+---------+----------+---------+----------+-------------------+----------------+-----------+
+ + Governor | Round | Des-perf | Freq | Load | Performance(MB/s) | Energy(Joules) | PPW(MB/J) |
+ +===========+=========+==========+=========+==========+===================+================+===========+
+ + ondemand | 1 | 203.244 | 3.2225 | 87.5064 | 35368.2 | 6626.1 | 101.4164 |
+ +-----------+---------+----------+---------+----------+-------------------+----------------+-----------+
+ + ondemand | 2 | 205.861 | 3.24948 | 88.9281 | 34795.7 | 6547.06 | 100.9794 |
+ +-----------+---------+----------+---------+----------+-------------------+----------------+-----------+
+ + ondemand | Average | 204.553 | 3.23599 | 88.2173 | 35081.9 | 6586.58 | 101.1991 |
+ +-----------+---------+----------+---------+----------+-------------------+----------------+-----------+
+ + | | | | | | | |
+ +-----------+---------+----------+---------+----------+-------------------+----------------+-----------+
+ + schedutil | 1 | 253.735 | 3.26755 | 96.6481 | 34653.9 | 6622.85 | 99.4170 |
+ +-----------+---------+----------+---------+----------+-------------------+----------------+-----------+
+ + schedutil | 2 | 254.654 | 3.44086 | 92.3564 | 31707.8 | 6573.67 | 91.6456 |
+ +-----------+---------+----------+---------+----------+-------------------+----------------+-----------+
+ + schedutil | Average | 254.195 | 3.3542 | 94.5023 | 33180.8 | 6598.26 | 95.5456 |
+ +-----------+---------+----------+---------+----------+-------------------+----------------+-----------+
+
+ + gitsource
+
+ When you finish test, you will get selftest.gitsource.csv and selftest.gitsource.result files form amd-pstate.
+ Open selftest.gitsource.csv :
+
+ +-----------+---------+----------+----------+----------+----------+----------------+----------+
+ + Governor | Round | Des-perf | Freq | Load | Times(s) | Energy(Joules) | PPW(s/J) |
+ +===========+=========+==========+==========+==========+==========+================+==========+
+ + ondemand | 1 | 29.7305 | 1.13025 | 8.49585 | 341.61 | 6811.02 | 0.0501 |
+ +-----------+---------+----------+----------+----------+----------+----------------+----------+
+ + ondemand | 2 | 28.0523 | 1.33848 | 8.16496 | 339.21 | 6999.84 | 0.0484 |
+ +-----------+---------+----------+----------+----------+----------+----------------+----------+
+ + ondemand | Average | 28.8914 | 1.23436 | 8.33041 | 340.41 | 6905.43 | 0.0492 |
+ +-----------+---------+----------+----------+----------+----------+----------------+----------+
+ + | | | | | | | |
+ +-----------+---------+----------+----------+----------+----------+----------------+----------+
+ + schedutil | 1 | 29.6971 | 0.834149 | 9.57879 | 278.15 | 5992.26 | 0.0464 |
+ +-----------+---------+----------+----------+----------+----------+----------------+----------+
+ + schedutil | 2 | 31.6573 | 0.99686 | 8.60513 | 280.28 | 5772.59 | 0.0485 |
+ +-----------+---------+----------+----------+----------+----------+----------------+----------+
+ + schedutil | Average | 30.6772 | 0.915504 | 9.09196 | 279.215 | 5882.43 | 0.0474 |
+ +-----------+---------+----------+----------+----------+----------+----------------+----------+

Reference
===========
--
2.25.1