2022-11-17 03:17:56

by Yuan, Perry

[permalink] [raw]
Subject: [PATCH 0/5] AMD Pstate driver Urgent Change

The patchset changed amd-pstate driver as built-in type to resolve the
driver loading sequence problem, otherwise the acpi-cpufreq driver will
be loaded as the default cpufreq scaling driver instead of amd-pstate.

Some new kernel parameters are added to allow user to disable pstate driver
and load driver with passive mode which use governors to do the
frequency scaling control.

* `amd_pstate=disabled` or no parameters will not load pstate driver.
* `amd_pstate=passive` will load pstate driver with passive mode.

Set the `amd_pstate` driver disabled by default because of performance
degradation on a number of AMD ASICs in the passive mode driver,
especially the shared memory support processors.

EPP support for the amd_pstate driver is under review. With EPP support,
the said performance issue is resolved. Once that gets upstream,
the `active` mode amd_pstate_epp driver may be enabled by default.

Perry Yuan (4):
cpufreq: amd-pstate: change amd-pstate driver to be built-in type
cpufreq: amd-pstate: add amd-pstate driver parameter for mode
selection
Documentation: amd-pstate: add driver working mode introduction
Documentation: add amd-pstate kernel command line options

Wyes Karny (1):
cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL
register at init

.../admin-guide/kernel-parameters.txt | 11 +++++
Documentation/admin-guide/pm/amd-pstate.rst | 30 +++++-------
drivers/cpufreq/Kconfig.x86 | 2 +-
drivers/cpufreq/amd-pstate.c | 49 +++++++++++++------
4 files changed, 59 insertions(+), 33 deletions(-)

--
2.25.1



2022-11-17 03:25:04

by Yuan, Perry

[permalink] [raw]
Subject: [PATCH 2/5] cpufreq: amd-pstate: change amd-pstate driver to be built-in type

Currently when the amd-pstate and acpi_cpufreq are both built into
kernel as module driver, amd-pstate will not be loaded by default
in this case.

Change amd-pstate driver as built-in type, it will resolve the loading
sequence problem to allow user to make amd-pstate driver as the default
cpufreq scaling driver.

Fixes: ec437d71db77 ("cpufreq: amd-pstate: Introduce a new AMD P-State driver to support future processors")
Signed-off-by: Perry Yuan <[email protected]>
---
drivers/cpufreq/Kconfig.x86 | 2 +-
drivers/cpufreq/amd-pstate.c | 11 +----------
2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
index 310779b07daf..00476e94db90 100644
--- a/drivers/cpufreq/Kconfig.x86
+++ b/drivers/cpufreq/Kconfig.x86
@@ -35,7 +35,7 @@ config X86_PCC_CPUFREQ
If in doubt, say N.

config X86_AMD_PSTATE
- tristate "AMD Processor P-State driver"
+ bool "AMD Processor P-State driver"
depends on X86 && ACPI
select ACPI_PROCESSOR
select ACPI_CPPC_LIB if X86_64
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index d844c6f97caf..701f49d6d240 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -663,16 +663,7 @@ static int __init amd_pstate_init(void)

return ret;
}
-
-static void __exit amd_pstate_exit(void)
-{
- cpufreq_unregister_driver(&amd_pstate_driver);
-
- amd_pstate_enable(false);
-}
-
-module_init(amd_pstate_init);
-module_exit(amd_pstate_exit);
+device_initcall(amd_pstate_init);

MODULE_AUTHOR("Huang Rui <[email protected]>");
MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver");
--
2.25.1


2022-11-17 04:31:43

by Gautham R. Shenoy

[permalink] [raw]
Subject: Re: [PATCH 2/5] cpufreq: amd-pstate: change amd-pstate driver to be built-in type

On Thu, Nov 17, 2022 at 10:49:52AM +0800, Perry Yuan wrote:
> Currently when the amd-pstate and acpi_cpufreq are both built into
> kernel as module driver, amd-pstate will not be loaded by default
> in this case.
>
> Change amd-pstate driver as built-in type, it will resolve the loading
> sequence problem to allow user to make amd-pstate driver as the default
> cpufreq scaling driver.
>
> Fixes: ec437d71db77 ("cpufreq: amd-pstate: Introduce a new AMD P-State driver to support future processors")
> Signed-off-by: Perry Yuan <[email protected]>

Reviewed-by: Gautham R. Shenoy <[email protected]>

> ---
> drivers/cpufreq/Kconfig.x86 | 2 +-
> drivers/cpufreq/amd-pstate.c | 11 +----------
> 2 files changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
> index 310779b07daf..00476e94db90 100644
> --- a/drivers/cpufreq/Kconfig.x86
> +++ b/drivers/cpufreq/Kconfig.x86
> @@ -35,7 +35,7 @@ config X86_PCC_CPUFREQ
> If in doubt, say N.
>
> config X86_AMD_PSTATE
> - tristate "AMD Processor P-State driver"
> + bool "AMD Processor P-State driver"
> depends on X86 && ACPI
> select ACPI_PROCESSOR
> select ACPI_CPPC_LIB if X86_64
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index d844c6f97caf..701f49d6d240 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -663,16 +663,7 @@ static int __init amd_pstate_init(void)
>
> return ret;
> }
> -
> -static void __exit amd_pstate_exit(void)
> -{
> - cpufreq_unregister_driver(&amd_pstate_driver);
> -
> - amd_pstate_enable(false);
> -}
> -
> -module_init(amd_pstate_init);
> -module_exit(amd_pstate_exit);
> +device_initcall(amd_pstate_init);
>
> MODULE_AUTHOR("Huang Rui <[email protected]>");
> MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver");
> --
> 2.25.1
>

2022-11-17 05:33:16

by Wyes Karny

[permalink] [raw]
Subject: Re: [PATCH 2/5] cpufreq: amd-pstate: change amd-pstate driver to be built-in type



On 11/17/2022 8:19 AM, Perry Yuan wrote:
> Currently when the amd-pstate and acpi_cpufreq are both built into
> kernel as module driver, amd-pstate will not be loaded by default
> in this case.
>
> Change amd-pstate driver as built-in type, it will resolve the loading
> sequence problem to allow user to make amd-pstate driver as the default
> cpufreq scaling driver.
>
> Fixes: ec437d71db77 ("cpufreq: amd-pstate: Introduce a new AMD P-State driver to support future processors")
> Signed-off-by: Perry Yuan <[email protected]>

Tested-by: Wyes Karny <[email protected]>

> ---
> drivers/cpufreq/Kconfig.x86 | 2 +-
> drivers/cpufreq/amd-pstate.c | 11 +----------
> 2 files changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
> index 310779b07daf..00476e94db90 100644
> --- a/drivers/cpufreq/Kconfig.x86
> +++ b/drivers/cpufreq/Kconfig.x86
> @@ -35,7 +35,7 @@ config X86_PCC_CPUFREQ
> If in doubt, say N.
>
> config X86_AMD_PSTATE
> - tristate "AMD Processor P-State driver"
> + bool "AMD Processor P-State driver"
> depends on X86 && ACPI
> select ACPI_PROCESSOR
> select ACPI_CPPC_LIB if X86_64
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index d844c6f97caf..701f49d6d240 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -663,16 +663,7 @@ static int __init amd_pstate_init(void)
>
> return ret;
> }
> -
> -static void __exit amd_pstate_exit(void)
> -{
> - cpufreq_unregister_driver(&amd_pstate_driver);
> -
> - amd_pstate_enable(false);
> -}
> -
> -module_init(amd_pstate_init);
> -module_exit(amd_pstate_exit);
> +device_initcall(amd_pstate_init);
>
> MODULE_AUTHOR("Huang Rui <[email protected]>");
> MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver");

--
Thanks & Regards,
Wyes

2022-11-17 06:10:33

by Huang Rui

[permalink] [raw]
Subject: Re: [PATCH 0/5] AMD Pstate driver Urgent Change

On Thu, Nov 17, 2022 at 10:49:50AM +0800, Yuan, Perry wrote:
> The patchset changed amd-pstate driver as built-in type to resolve the
> driver loading sequence problem, otherwise the acpi-cpufreq driver will
> be loaded as the default cpufreq scaling driver instead of amd-pstate.
>
> Some new kernel parameters are added to allow user to disable pstate driver
> and load driver with passive mode which use governors to do the
> frequency scaling control.
>
> * `amd_pstate=disabled` or no parameters will not load pstate driver.
> * `amd_pstate=passive` will load pstate driver with passive mode.
>
> Set the `amd_pstate` driver disabled by default because of performance
> degradation on a number of AMD ASICs in the passive mode driver,
> especially the shared memory support processors.
>
> EPP support for the amd_pstate driver is under review. With EPP support,
> the said performance issue is resolved. Once that gets upstream,
> the `active` mode amd_pstate_epp driver may be enabled by default.
>
> Perry Yuan (4):
> cpufreq: amd-pstate: change amd-pstate driver to be built-in type
> cpufreq: amd-pstate: add amd-pstate driver parameter for mode
> selection
> Documentation: amd-pstate: add driver working mode introduction
> Documentation: add amd-pstate kernel command line options
>
> Wyes Karny (1):
> cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL
> register at init

Series are Acked-by: Huang Rui <[email protected]>

Hi Rafeal,

These series are the fixes for our new processors. Would you mind to merge
them into pm-6.1-rc6 or pm-6.1-rc7?

Thanks,
Ray