Linux Power Management development
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Meng Li <li.meng@amd.com>, Huang Rui <ray.huang@amd.com>,
	linux-pm@vger.kernel.org
Cc: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Nathan Fontenot <nathan.fontenot@amd.com>,
	Deepak Sharma <deepak.sharma@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Jinzhou Su <Jinzhou.Su@amd.com>, Perry Yuan <Perry.Yuan@amd.com>,
	Xiaojian Du <Xiaojian.Du@amd.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Borislav Petkov <bp@alien8.de>,
	linux-kernel@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH V7 4/4] Documentation: amd-pstate: Add unit test introduction
Date: Wed, 25 May 2022 10:21:16 -0600	[thread overview]
Message-ID: <8c91add2-57dd-9f58-ccce-6f692e381bf3@linuxfoundation.org> (raw)
In-Reply-To: <20220522115423.1147282-5-li.meng@amd.com>

On 5/22/22 5:54 AM, Meng Li wrote:
> Introduce the AMD P-State unit test module design and implementation.

It also talks about kselftest and how to use - let's say that here.

> 
> Signed-off-by: Meng Li <li.meng@amd.com>
> Acked-by: Huang Rui <ray.huang@amd.com>
> ---
>   Documentation/admin-guide/pm/amd-pstate.rst | 76 +++++++++++++++++++++
>   1 file changed, 76 insertions(+)
> 
> diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst
> index 83b58eb4ab4d..c2b8693601aa 100644
> --- a/Documentation/admin-guide/pm/amd-pstate.rst
> +++ b/Documentation/admin-guide/pm/amd-pstate.rst
> @@ -182,6 +182,7 @@ to the ``struct sugov_cpu`` that the utilization update belongs to.
>   Then, ``amd-pstate`` updates the desired performance according to the CPU
>   scheduler assigned.
>   
> +.. _processor_support:
>   
>   Processor Support
>   =======================
> @@ -282,6 +283,8 @@ efficiency frequency management method on AMD processors.
>   Kernel Module Options for ``amd-pstate``
>   =========================================
>   
> +.. _shared_mem:
> +
>   ``shared_mem``
>   Use a module param (shared_mem) to enable related processors manually with
>   **amd_pstate.shared_mem=1**.
> @@ -393,6 +396,76 @@ about part of the output. ::
>    CPU_005     712          116384        39        49        166       0.7565  9645075 2214891 38431470  25.1   11.646       469         2.496         kworker/5:0-40
>    CPU_006     712          116408        39        49        166       0.6769  8950227 1839034 37192089  24.06  11.272       470         2.496         kworker/6:0-1264
>   
> +Unit Tests for amd-pstate
> +-------------------------
> +
> +``amd-pstate-ut`` is a test module for testing the ``amd-pstate`` driver.
> +
> + * It can help all users to verify their processor support (SBIOS/Firmware or Hardware).
> +
> + * Kernel can have a basic function test to avoid the kernel regression during the update.
> +
> + * We can introduce more functional or performance tests to align the result together, it will benefit power and performance scale optimization.
> +
> +1. Test case decriptions
> +
> +        +---------+--------------------------------+------------------------------------------------------------------------------------+
> +        | Index   | Functions                      | Description                                                                        |
> +        +=========+================================+====================================================================================+
> +        | 0       | 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.                                             |
> +        |         |                                ||                                                                                   |
> +        |         |                                || 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.                              |
> +        |         |                                || 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       |
> +        |         |                                | 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``.                                                            |
> +        +---------+--------------------------------+------------------------------------------------------------------------------------+
> +
> +#. 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
> +
> +        + open the :c:macro:`CONFIG_X86_AMD_PSTATE` configuration option.
> +        + set the :c:macro:`CONFIG_X86_AMD_PSTATE_UT` configuration option to M.
> +        + make project
> +        + make selftest ::
> +
> +            jasminemeng@jasmine-meng:~/amd-brahma$ cd linux
> +            jasminemeng@jasmine-meng:~/amd-brahma/linux$ make -C tools/testing/selftests

Remove the personal data (login etc.) from the above text

> +
> +    #. Installation & Steps ::
> +
> +        jasmine@jasmine-meng:~/amd-brahma/linux$ make -C tools/testing/selftests install INSTALL_PATH=~/kselftest

Remove the personal data (login etc.) from the above text

> +        jasmine@jasmine-meng:~$ sudo ./kselftest/run_kselftest.sh -c amd-pstate

Same here

> +        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 ::
> +
> +         jasmine@jasmine-meng:~$ dmesg | grep "amd_pstate_ut" | tee log.txt

Same here

> +         [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!
>   
>   Reference
>   ===========
> @@ -405,3 +478,6 @@ Reference
>   
>   .. [3] Processor Programming Reference (PPR) for AMD Family 19h Model 51h, Revision A1 Processors
>          https://www.amd.com/system/files/TechDocs/56569-A1-PUB.zip
> +
> +.. [4] Linux Kernel Selftests,
> +       https://www.kernel.org/doc/html/latest/dev-tools/kselftest.html
> 

With the above changes:

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

      reply	other threads:[~2022-05-25 16:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-22 11:54 [PATCH V7 0/4] Add unit test module for AMD P-State driver Meng Li
2022-05-22 11:54 ` [PATCH V7 1/4] cpufreq: amd-pstate: Expose struct amd_cpudata Meng Li
2022-05-25 15:19   ` Shuah Khan
2022-05-22 11:54 ` [PATCH V7 2/4] cpufreq: amd-pstate: Add test module for amd-pstate driver Meng Li
2022-05-23  7:32   ` Viresh Kumar
2022-05-23  8:25     ` Meng, Li (Jassmine)
2022-05-25 16:05   ` Shuah Khan
2022-05-22 11:54 ` [PATCH V7 3/4] selftests: amd-pstate: Add test trigger " Meng Li
2022-05-25 16:15   ` Shuah Khan
2022-05-22 11:54 ` [PATCH V7 4/4] Documentation: amd-pstate: Add unit test introduction Meng Li
2022-05-25 16:21   ` Shuah Khan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c91add2-57dd-9f58-ccce-6f692e381bf3@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=Jinzhou.Su@amd.com \
    --cc=Perry.Yuan@amd.com \
    --cc=Xiaojian.Du@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=bp@alien8.de \
    --cc=deepak.sharma@amd.com \
    --cc=li.meng@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=nathan.fontenot@amd.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=ray.huang@amd.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox