linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/5] AMD Pstate driver Urgent Change
@ 2022-11-17  7:35 Perry Yuan
  2022-11-17  7:35 ` [PATCH v3 1/5] cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL register at init Perry Yuan
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Perry Yuan @ 2022-11-17  7:35 UTC (permalink / raw)
  To: rafael.j.wysocki, ray.huang, viresh.kumar, Mario.Limonciello
  Cc: Nathan.Fontenot, Alexander.Deucher, Deepak.Sharma, Shimmer.Huang,
	Li.Meng, Xiaojian.Du, wyes.karny, gautham.shenoy, ananth.narayan,
	linux-pm, linux-kernel, Perry Yuan

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.

Changes from v2:
 * pick up Acked-by flag of Huang Rui
 * fix typo in the cover letter

Changes from v1:
 * fix commit info in v1 patch PATCH 4/5
 * pick up Reviewed-by flag of Gautham R. Shenoy
 * pick up Tested-by flag of  Wyes Karny

v2: https://lore.kernel.org/lkml/20221117071910.3347052-1-Perry.Yuan@amd.com/
v1: https://lore.kernel.org/lkml/20221117024955.3319484-1-Perry.Yuan@amd.com/

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3 1/5] cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL register at init
  2022-11-17  7:35 [PATCH v3 0/5] AMD Pstate driver Urgent Change Perry Yuan
@ 2022-11-17  7:35 ` Perry Yuan
  2022-11-17  7:35 ` [PATCH v3 2/5] cpufreq: amd-pstate: change amd-pstate driver to be built-in type Perry Yuan
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Perry Yuan @ 2022-11-17  7:35 UTC (permalink / raw)
  To: rafael.j.wysocki, ray.huang, viresh.kumar, Mario.Limonciello
  Cc: Nathan.Fontenot, Alexander.Deucher, Deepak.Sharma, Shimmer.Huang,
	Li.Meng, Xiaojian.Du, wyes.karny, gautham.shenoy, ananth.narayan,
	linux-pm, linux-kernel, stable, Perry Yuan

From: Wyes Karny <wyes.karny@amd.com>

MSR_AMD_PERF_CTL is guaranteed to be 0 on a cold boot. However, on a
kexec boot, for instance, it may have a non-zero value (if the cpu was
in a non-P0 Pstate).  In such cases, the cores with non-P0 Pstates at
boot will never be pushed to P0, let alone boost frequencies.

Kexec is a common workflow for reboot on Linux and this creates a
regression in performance. Fix it by explicitly setting the
MSR_AMD_PERF_CTL to 0 during amd_pstate driver init.

Cc: stable@vger.kernel.org
Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Tested-by: Wyes Karny <wyes.karny@amd.com>
Signed-off-by: Wyes Karny <wyes.karny@amd.com>
Signed-off-by: Perry Yuan <Perry.Yuan@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index ace7d50cf2ac..d844c6f97caf 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -424,12 +424,22 @@ static void amd_pstate_boost_init(struct amd_cpudata *cpudata)
 	amd_pstate_driver.boost_enabled = true;
 }
 
+static void amd_perf_ctl_reset(unsigned int cpu)
+{
+	wrmsrl_on_cpu(cpu, MSR_AMD_PERF_CTL, 0);
+}
+
 static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
 {
 	int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret;
 	struct device *dev;
 	struct amd_cpudata *cpudata;
 
+	/*
+	 * Resetting PERF_CTL_MSR will put the CPU in P0 frequency,
+	 * which is ideal for initialization process.
+	 */
+	amd_perf_ctl_reset(policy->cpu);
 	dev = get_cpu_device(policy->cpu);
 	if (!dev)
 		return -ENODEV;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 2/5] cpufreq: amd-pstate: change amd-pstate driver to be built-in type
  2022-11-17  7:35 [PATCH v3 0/5] AMD Pstate driver Urgent Change Perry Yuan
  2022-11-17  7:35 ` [PATCH v3 1/5] cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL register at init Perry Yuan
@ 2022-11-17  7:35 ` Perry Yuan
  2022-11-17  7:35 ` [PATCH v3 3/5] cpufreq: amd-pstate: add amd-pstate driver parameter for mode selection Perry Yuan
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Perry Yuan @ 2022-11-17  7:35 UTC (permalink / raw)
  To: rafael.j.wysocki, ray.huang, viresh.kumar, Mario.Limonciello
  Cc: Nathan.Fontenot, Alexander.Deucher, Deepak.Sharma, Shimmer.Huang,
	Li.Meng, Xiaojian.Du, wyes.karny, gautham.shenoy, ananth.narayan,
	linux-pm, linux-kernel, Perry Yuan

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.

Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Tested-by: Wyes Karny <wyes.karny@amd.com>
Signed-off-by: Perry Yuan <Perry.Yuan@amd.com>
Fixes: ec437d71db77 ("cpufreq: amd-pstate: Introduce a new AMD P-State driver to support future processors")
---
 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 <ray.huang@amd.com>");
 MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 3/5] cpufreq: amd-pstate: add amd-pstate driver parameter for mode selection
  2022-11-17  7:35 [PATCH v3 0/5] AMD Pstate driver Urgent Change Perry Yuan
  2022-11-17  7:35 ` [PATCH v3 1/5] cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL register at init Perry Yuan
  2022-11-17  7:35 ` [PATCH v3 2/5] cpufreq: amd-pstate: change amd-pstate driver to be built-in type Perry Yuan
@ 2022-11-17  7:35 ` Perry Yuan
  2022-11-17  7:35 ` [PATCH v3 4/5] Documentation: amd-pstate: add driver working mode introduction Perry Yuan
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Perry Yuan @ 2022-11-17  7:35 UTC (permalink / raw)
  To: rafael.j.wysocki, ray.huang, viresh.kumar, Mario.Limonciello
  Cc: Nathan.Fontenot, Alexander.Deucher, Deepak.Sharma, Shimmer.Huang,
	Li.Meng, Xiaojian.Du, wyes.karny, gautham.shenoy, ananth.narayan,
	linux-pm, linux-kernel, Perry Yuan

When the amd_pstate driver is built-in users still need a method to be
able enable or disable it depending upon their circumstance.
Add support for an early parameter to do this.

There is some performance degradation on a number of ASICs in the
passive mode. This performance issue was originally discovered in
shared memory systems but it has been proven that certain workloads
on MSR systems also suffer performance issues.
Set the amd-pstate driver as disabled by default to temporarily
mitigate the performance problem.

1) with `amd_pstate=disable`, pstate driver will be disabled to load at
kernel booting.

2) with `amd_pstate=passive`, pstate driver will be enabled and loaded as
non-autonomous working mode supported in the low-level power management
firmware.

3) If neither parameter is specified, the driver will be disabled by
default to avoid triggering performance regressions in certain ASICs

Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Tested-by: Wyes Karny <wyes.karny@amd.com>
Signed-off-by: Perry Yuan <Perry.Yuan@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 701f49d6d240..204e39006dda 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -59,12 +59,8 @@
  * we disable it by default to go acpi-cpufreq on these processors and add a
  * module parameter to be able to enable it manually for debugging.
  */
-static bool shared_mem = false;
-module_param(shared_mem, bool, 0444);
-MODULE_PARM_DESC(shared_mem,
-		 "enable amd-pstate on processors with shared memory solution (false = disabled (default), true = enabled)");
-
 static struct cpufreq_driver amd_pstate_driver;
+static int cppc_load __initdata;
 
 static inline int pstate_enable(bool enable)
 {
@@ -626,6 +622,15 @@ static int __init amd_pstate_init(void)
 
 	if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
 		return -ENODEV;
+	/*
+	 * by default the pstate driver is disabled to load
+	 * enable the amd_pstate passive mode driver explicitly
+	 * with amd_pstate=passive in kernel command line
+	 */
+	if (!cppc_load) {
+		pr_debug("driver load is disabled, boot with amd_pstate=passive to enable this\n");
+		return -ENODEV;
+	}
 
 	if (!acpi_cpc_valid()) {
 		pr_warn_once("the _CPC object is not present in SBIOS or ACPI disabled\n");
@@ -640,13 +645,11 @@ static int __init amd_pstate_init(void)
 	if (boot_cpu_has(X86_FEATURE_CPPC)) {
 		pr_debug("AMD CPPC MSR based functionality is supported\n");
 		amd_pstate_driver.adjust_perf = amd_pstate_adjust_perf;
-	} else if (shared_mem) {
+	} else {
+		pr_debug("AMD CPPC shared memory based functionality is supported\n");
 		static_call_update(amd_pstate_enable, cppc_enable);
 		static_call_update(amd_pstate_init_perf, cppc_init_perf);
 		static_call_update(amd_pstate_update_perf, cppc_update_perf);
-	} else {
-		pr_info("This processor supports shared memory solution, you can enable it with amd_pstate.shared_mem=1\n");
-		return -ENODEV;
 	}
 
 	/* enable amd pstate feature */
@@ -665,6 +668,21 @@ static int __init amd_pstate_init(void)
 }
 device_initcall(amd_pstate_init);
 
+static int __init amd_pstate_param(char *str)
+{
+	if (!str)
+		return -EINVAL;
+
+	if (!strcmp(str, "disable")) {
+		cppc_load = 0;
+		pr_info("driver is explicitly disabled\n");
+	} else if (!strcmp(str, "passive"))
+		cppc_load = 1;
+
+	return 0;
+}
+early_param("amd_pstate", amd_pstate_param);
+
 MODULE_AUTHOR("Huang Rui <ray.huang@amd.com>");
 MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver");
 MODULE_LICENSE("GPL");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 4/5] Documentation: amd-pstate: add driver working mode introduction
  2022-11-17  7:35 [PATCH v3 0/5] AMD Pstate driver Urgent Change Perry Yuan
                   ` (2 preceding siblings ...)
  2022-11-17  7:35 ` [PATCH v3 3/5] cpufreq: amd-pstate: add amd-pstate driver parameter for mode selection Perry Yuan
@ 2022-11-17  7:35 ` Perry Yuan
  2022-11-17  8:58   ` Bagas Sanjaya
  2022-11-17  7:35 ` [PATCH v3 5/5] Documentation: add amd-pstate kernel command line options Perry Yuan
  2022-11-21 19:23 ` [PATCH v3 0/5] AMD Pstate driver Urgent Change Rafael J. Wysocki
  5 siblings, 1 reply; 10+ messages in thread
From: Perry Yuan @ 2022-11-17  7:35 UTC (permalink / raw)
  To: rafael.j.wysocki, ray.huang, viresh.kumar, Mario.Limonciello
  Cc: Nathan.Fontenot, Alexander.Deucher, Deepak.Sharma, Shimmer.Huang,
	Li.Meng, Xiaojian.Du, wyes.karny, gautham.shenoy, ananth.narayan,
	linux-pm, linux-kernel, Perry Yuan

Introduce the `amd_pstate` driver new working mode with
`amd_pstate=passive` added to kernel command line.
If there is no passive mode enabled by user, amd_pstate driver will be
disabled by default for now.

Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Tested-by: Wyes Karny <wyes.karny@amd.com>
Signed-off-by: Perry Yuan <Perry.Yuan@amd.com>
---
 Documentation/admin-guide/pm/amd-pstate.rst | 30 +++++++++------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst
index 8f3d30c5a0d8..06e23538f79c 100644
--- a/Documentation/admin-guide/pm/amd-pstate.rst
+++ b/Documentation/admin-guide/pm/amd-pstate.rst
@@ -283,23 +283,19 @@ 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**.
-Due to the performance issue on the processors with `Shared Memory Support
-<perf_cap_>`_, we disable it presently and will re-enable this by default
-once we address performance issue with this solution.
-
-To check whether the current processor is using `Full MSR Support <perf_cap_>`_
-or `Shared Memory Support <perf_cap_>`_ : ::
-
-  ray@hr-test1:~$ lscpu | grep cppc
-  Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm
-
-If the CPU flags have ``cppc``, then this processor supports `Full MSR Support
-<perf_cap_>`_. Otherwise, it supports `Shared Memory Support <perf_cap_>`_.
+Passive Mode
+------------
+
+``amd_pstate=passive``
+
+It will be enabled if the ``amd_pstate=passive`` is passed to the kernel in the command line.
+In this mode, ``amd_pstate`` driver software specifies a desired QoS target in the CPPC
+performance scale as a relative number. This can be expressed as percentage of nominal
+performance (infrastructure max). Below the nominal sustained performance level,
+desired performance expresses the average performance level of the processor subject
+to the Performance Reduction Tolerance register. Above the nominal performance level,
+processor must provide at least nominal performance requested and go higher if current
+operating conditions allow.
 
 
 ``cpupower`` tool support for ``amd-pstate``
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 5/5] Documentation: add amd-pstate kernel command line options
  2022-11-17  7:35 [PATCH v3 0/5] AMD Pstate driver Urgent Change Perry Yuan
                   ` (3 preceding siblings ...)
  2022-11-17  7:35 ` [PATCH v3 4/5] Documentation: amd-pstate: add driver working mode introduction Perry Yuan
@ 2022-11-17  7:35 ` Perry Yuan
  2022-11-21 19:23 ` [PATCH v3 0/5] AMD Pstate driver Urgent Change Rafael J. Wysocki
  5 siblings, 0 replies; 10+ messages in thread
From: Perry Yuan @ 2022-11-17  7:35 UTC (permalink / raw)
  To: rafael.j.wysocki, ray.huang, viresh.kumar, Mario.Limonciello
  Cc: Nathan.Fontenot, Alexander.Deucher, Deepak.Sharma, Shimmer.Huang,
	Li.Meng, Xiaojian.Du, wyes.karny, gautham.shenoy, ananth.narayan,
	linux-pm, linux-kernel, Perry Yuan

Add a new amd pstate driver command line option to enable driver passive
working mode via MSR and shared memory interface to request desired
performance within abstract scale and the power management firmware
(SMU) convert the perf requests into actual hardware pstates.

Also the `disable` parameter can disable the pstate driver loading by
adding `amd_pstate=disable` to kernel command line.

Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Tested-by: Wyes Karny <wyes.karny@amd.com>
Signed-off-by: Perry Yuan <Perry.Yuan@amd.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index a465d5242774..42af9ca0127e 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -6959,3 +6959,14 @@
 				memory, and other data can't be written using
 				xmon commands.
 			off	xmon is disabled.
+
+	amd_pstate=	[X86]
+			disable
+			  Do not enable amd_pstate as the default
+			  scaling driver for the supported processors
+			passive
+			  Use amd_pstate as a scaling driver, driver requests a
+			  desired performance on this abstract scale and the power
+			  management firmware translates the requests into actual
+			  hardware states (core frequency, data fabric and memory
+			  clocks etc.)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 4/5] Documentation: amd-pstate: add driver working mode introduction
  2022-11-17  7:35 ` [PATCH v3 4/5] Documentation: amd-pstate: add driver working mode introduction Perry Yuan
@ 2022-11-17  8:58   ` Bagas Sanjaya
  2022-11-17  9:34     ` Yuan, Perry
  0 siblings, 1 reply; 10+ messages in thread
From: Bagas Sanjaya @ 2022-11-17  8:58 UTC (permalink / raw)
  To: Perry Yuan
  Cc: rafael.j.wysocki, ray.huang, viresh.kumar, Mario.Limonciello,
	Nathan.Fontenot, Alexander.Deucher, Deepak.Sharma, Shimmer.Huang,
	Li.Meng, Xiaojian.Du, wyes.karny, gautham.shenoy, ananth.narayan,
	linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3007 bytes --]

On Thu, Nov 17, 2022 at 03:35:40PM +0800, Perry Yuan wrote:
> Introduce the `amd_pstate` driver new working mode with
> `amd_pstate=passive` added to kernel command line.
> If there is no passive mode enabled by user, amd_pstate driver will be
> disabled by default for now.
>
><snipped>...
> -.. _shared_mem:
> -
> -``shared_mem``
> -Use a module param (shared_mem) to enable related processors manually with
> -**amd_pstate.shared_mem=1**.
> -Due to the performance issue on the processors with `Shared Memory Support
> -<perf_cap_>`_, we disable it presently and will re-enable this by default
> -once we address performance issue with this solution.
> -
> -To check whether the current processor is using `Full MSR Support <perf_cap_>`_
> -or `Shared Memory Support <perf_cap_>`_ : ::
> -
> -  ray@hr-test1:~$ lscpu | grep cppc
> -  Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm
> -
> -If the CPU flags have ``cppc``, then this processor supports `Full MSR Support
> -<perf_cap_>`_. Otherwise, it supports `Shared Memory Support <perf_cap_>`_.
> +Passive Mode
> +------------
> +
> +``amd_pstate=passive``
> +
> +It will be enabled if the ``amd_pstate=passive`` is passed to the kernel in the command line.
> +In this mode, ``amd_pstate`` driver software specifies a desired QoS target in the CPPC
> +performance scale as a relative number. This can be expressed as percentage of nominal
> +performance (infrastructure max). Below the nominal sustained performance level,
> +desired performance expresses the average performance level of the processor subject
> +to the Performance Reduction Tolerance register. Above the nominal performance level,
> +processor must provide at least nominal performance requested and go higher if current
> +operating conditions allow.
>  
>  
>  ``cpupower`` tool support for ``amd-pstate``
> 

Why do you replace shared_mem subsection with passive mode section? It
isn't be mentioned in the patch description.

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v3 4/5] Documentation: amd-pstate: add driver working mode introduction
  2022-11-17  8:58   ` Bagas Sanjaya
@ 2022-11-17  9:34     ` Yuan, Perry
  0 siblings, 0 replies; 10+ messages in thread
From: Yuan, Perry @ 2022-11-17  9:34 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: rafael.j.wysocki, Huang, Ray, viresh.kumar, Limonciello, Mario,
	Fontenot, Nathan, Deucher, Alexander, Sharma, Deepak, Huang,
	Shimmer, Meng, Li (Jassmine),
	Du, Xiaojian, Karny, Wyes, Shenoy, Gautham Ranjal, Narayan,
	Ananth, linux-pm, linux-kernel

[AMD Official Use Only - General]



> -----Original Message-----
> From: Bagas Sanjaya <bagasdotme@gmail.com>
> Sent: Thursday, November 17, 2022 4:58 PM
> To: Yuan, Perry <Perry.Yuan@amd.com>
> Cc: rafael.j.wysocki@intel.com; Huang, Ray <Ray.Huang@amd.com>; 
> viresh.kumar@linaro.org; Limonciello, Mario 
> <Mario.Limonciello@amd.com>; Fontenot, Nathan 
> <Nathan.Fontenot@amd.com>; Deucher, Alexander 
> <Alexander.Deucher@amd.com>; Sharma, Deepak <Deepak.Sharma@amd.com>; 
> Huang, Shimmer <Shimmer.Huang@amd.com>; Meng, Li (Jassmine) 
> <Li.Meng@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; Karny, Wyes 
> <Wyes.Karny@amd.com>; Shenoy, Gautham Ranjal <gautham.shenoy@amd.com>; 
> Narayan, Ananth <Ananth.Narayan@amd.com>; linux-pm@vger.kernel.org; 
> linux- kernel@vger.kernel.org
> Subject: Re: [PATCH v3 4/5] Documentation: amd-pstate: add driver 
> working mode introduction
> 
> On Thu, Nov 17, 2022 at 03:35:40PM +0800, Perry Yuan wrote:
> > Introduce the `amd_pstate` driver new working mode with 
> > `amd_pstate=passive` added to kernel command line.
> > If there is no passive mode enabled by user, amd_pstate driver will 
> > be disabled by default for now.
> >
> ><snipped>...
> > -.. _shared_mem:
> > -
> > -``shared_mem``
> > -Use a module param (shared_mem) to enable related processors
> manually
> >with  -**amd_pstate.shared_mem=1**.
> > -Due to the performance issue on the processors with `Shared Memory 
> >Support  -<perf_cap_>`_, we disable it presently and will re-enable 
> >this by default  -once we address performance issue with this solution.
> > -
> > -To check whether the current processor is using `Full MSR Support 
> ><perf_cap_>`_  -or `Shared Memory Support <perf_cap_>`_ : ::
> > -
> > -  ray@hr-test1:~$ lscpu | grep cppc
> > -  Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
> mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext 
> fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc 
> cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 
> sse4_1
> sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm 
> cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch 
> osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext 
> perfctr_llc mwaitx cpb cat_l3
> cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 
> smep
> bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni 
> xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total 
> cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt 
> lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists 
> pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku 
> ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm
> > -
> > -If the CPU flags have ``cppc``, then this processor supports `Full 
> >MSR Support  -<perf_cap_>`_. Otherwise, it supports `Shared Memory
> Support <perf_cap_>`_.
> > +Passive Mode
> > +------------
> > +
> > +``amd_pstate=passive``
> > +
> > +It will be enabled if the ``amd_pstate=passive`` is passed to the 
> > +kernel in
> the command line.
> > +In this mode, ``amd_pstate`` driver software specifies a desired 
> > +QoS target in the CPPC performance scale as a relative number. This 
> > +can be expressed as percentage of nominal performance 
> > +(infrastructure max). Below the nominal sustained performance 
> > +level, desired performance expresses the average performance level 
> > +of the processor subject to the Performance Reduction Tolerance 
> > +register. Above the nominal performance level, processor must 
> > +provide at least nominal
> performance requested and go higher if current operating conditions allow.
> >
> >
> >  ``cpupower`` tool support for ``amd-pstate``
> >
> 
> Why do you replace shared_mem subsection with passive mode section? It 
> isn't be mentioned in the patch description.
shared_mem is not needed any more,  if no cppc flag detected for MSR support, pstate driver will use shared memory interface(cppc acpi) to set/get perf values to the low-level firmware.
There are two type CPPC  only in the amd cppc implementation. 
Removing shared_mem  parameter will make it simple to load amd pstate driver now.

Perry. 

> 
> --
> An old man doll... just what I always wanted! - Clara

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 0/5] AMD Pstate driver Urgent Change
  2022-11-17  7:35 [PATCH v3 0/5] AMD Pstate driver Urgent Change Perry Yuan
                   ` (4 preceding siblings ...)
  2022-11-17  7:35 ` [PATCH v3 5/5] Documentation: add amd-pstate kernel command line options Perry Yuan
@ 2022-11-21 19:23 ` Rafael J. Wysocki
  2022-11-22  2:16   ` Yuan, Perry
  5 siblings, 1 reply; 10+ messages in thread
From: Rafael J. Wysocki @ 2022-11-21 19:23 UTC (permalink / raw)
  To: Perry Yuan
  Cc: rafael.j.wysocki, ray.huang, viresh.kumar, Mario.Limonciello,
	Nathan.Fontenot, Alexander.Deucher, Deepak.Sharma, Shimmer.Huang,
	Li.Meng, Xiaojian.Du, wyes.karny, gautham.shenoy, ananth.narayan,
	linux-pm, linux-kernel

On Thu, Nov 17, 2022 at 8:36 AM Perry Yuan <Perry.Yuan@amd.com> 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.
>
> Changes from v2:
>  * pick up Acked-by flag of Huang Rui
>  * fix typo in the cover letter
>
> Changes from v1:
>  * fix commit info in v1 patch PATCH 4/5
>  * pick up Reviewed-by flag of Gautham R. Shenoy
>  * pick up Tested-by flag of  Wyes Karny
>
> v2: https://lore.kernel.org/lkml/20221117071910.3347052-1-Perry.Yuan@amd.com/
> v1: https://lore.kernel.org/lkml/20221117024955.3319484-1-Perry.Yuan@amd.com/
>
> 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(-)
>
> --

I have applied this series as 6.1-rc7 material.

Please let me know if you'd rather want to defer it till 6.2-rc1.

Thanks!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v3 0/5] AMD Pstate driver Urgent Change
  2022-11-21 19:23 ` [PATCH v3 0/5] AMD Pstate driver Urgent Change Rafael J. Wysocki
@ 2022-11-22  2:16   ` Yuan, Perry
  0 siblings, 0 replies; 10+ messages in thread
From: Yuan, Perry @ 2022-11-22  2:16 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: rafael.j.wysocki, Huang, Ray, viresh.kumar, Limonciello, Mario,
	Fontenot, Nathan, Deucher, Alexander, Sharma, Deepak, Huang,
	Shimmer, Meng, Li (Jassmine),
	Du, Xiaojian, Karny, Wyes, Shenoy, Gautham Ranjal, Narayan,
	Ananth, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4492 bytes --]

[AMD Official Use Only - General]

Hi Rafael

> -----Original Message-----
> From: Rafael J. Wysocki <rafael@kernel.org>
> Sent: Tuesday, November 22, 2022 3:24 AM
> To: Yuan, Perry <Perry.Yuan@amd.com>
> Cc: rafael.j.wysocki@intel.com; Huang, Ray <Ray.Huang@amd.com>;
> viresh.kumar@linaro.org; Limonciello, Mario <Mario.Limonciello@amd.com>;
> Fontenot, Nathan <Nathan.Fontenot@amd.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; Sharma, Deepak
> <Deepak.Sharma@amd.com>; Huang, Shimmer <Shimmer.Huang@amd.com>;
> Meng, Li (Jassmine) <Li.Meng@amd.com>; Du, Xiaojian
> <Xiaojian.Du@amd.com>; Karny, Wyes <Wyes.Karny@amd.com>; Shenoy,
> Gautham Ranjal <gautham.shenoy@amd.com>; Narayan, Ananth
> <Ananth.Narayan@amd.com>; linux-pm@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH v3 0/5] AMD Pstate driver Urgent Change
> 
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
> 
> 
> On Thu, Nov 17, 2022 at 8:36 AM Perry Yuan <Perry.Yuan@amd.com> 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.
> >
> > Changes from v2:
> >  * pick up Acked-by flag of Huang Rui
> >  * fix typo in the cover letter
> >
> > Changes from v1:
> >  * fix commit info in v1 patch PATCH 4/5
> >  * pick up Reviewed-by flag of Gautham R. Shenoy
> >  * pick up Tested-by flag of  Wyes Karny
> >
> > v2:
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore
> > .kernel.org%2Flkml%2F20221117071910.3347052-1-
> Perry.Yuan%40amd.com%2F&
> >
> amp;data=05%7C01%7CPerry.Yuan%40amd.com%7C03f823ca38cf46b1994f0
> 8dacbf5
> >
> f499%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C63804655448
> 7752737%7
> >
> CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJB
> TiI6Ik1
> >
> haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=L3At1qrtRjPH%2
> Bpve%2BpLC
> > b%2B%2BGektsGn4LH9RcNwYfhlU%3D&amp;reserved=0
> > v1:
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore
> > .kernel.org%2Flkml%2F20221117024955.3319484-1-
> Perry.Yuan%40amd.com%2F&
> >
> amp;data=05%7C01%7CPerry.Yuan%40amd.com%7C03f823ca38cf46b1994f0
> 8dacbf5
> >
> f499%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C63804655448
> 7752737%7
> >
> CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJB
> TiI6Ik1
> >
> haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=N6MhiQEIWPLkv
> kbwzycrKbky
> > E34fmjDydQxr7FwJSMQ%3D&amp;reserved=0
> >
> > 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(-)
> >
> > --
> 
> I have applied this series as 6.1-rc7 material.
> 
> Please let me know if you'd rather want to defer it till 6.2-rc1.
> 
> Thanks!

Cool! 
Thank you help to pick up the patches as 6.1-rc7 material.


Perry.  

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 19711 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-22  2:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17  7:35 [PATCH v3 0/5] AMD Pstate driver Urgent Change Perry Yuan
2022-11-17  7:35 ` [PATCH v3 1/5] cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL register at init Perry Yuan
2022-11-17  7:35 ` [PATCH v3 2/5] cpufreq: amd-pstate: change amd-pstate driver to be built-in type Perry Yuan
2022-11-17  7:35 ` [PATCH v3 3/5] cpufreq: amd-pstate: add amd-pstate driver parameter for mode selection Perry Yuan
2022-11-17  7:35 ` [PATCH v3 4/5] Documentation: amd-pstate: add driver working mode introduction Perry Yuan
2022-11-17  8:58   ` Bagas Sanjaya
2022-11-17  9:34     ` Yuan, Perry
2022-11-17  7:35 ` [PATCH v3 5/5] Documentation: add amd-pstate kernel command line options Perry Yuan
2022-11-21 19:23 ` [PATCH v3 0/5] AMD Pstate driver Urgent Change Rafael J. Wysocki
2022-11-22  2:16   ` Yuan, Perry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).