public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Enable amd-pstate active mode by default
@ 2023-06-05 15:11 Mario Limonciello
  2023-06-05 15:11 ` [PATCH 1/4] ACPI: CPPC: Add a symbol to check if the preferred profile is a server Mario Limonciello
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Mario Limonciello @ 2023-06-05 15:11 UTC (permalink / raw)
  To: Huang Rui, Srinivas Pandruvada
  Cc: Rafael J . Wysocki, Len Brown, Viresh Kumar, Robert Moore,
	linux-acpi, linux-kernel, linux-pm, devel, Gautham Ranjal Shenoy,
	Wyes Karny, Perry Yuan, Mario Limonciello

Active mode for amd-pstate has shown enough success now that it makes sense
to enable it by default on client systems.

This series introduces a new kernel configuration option to set the default
policy for amd-pstate modes for a kernel.

Server systems will by identified by the PM preferred profile and still be
set as disabled by default for now.

Mario Limonciello (4):
  ACPI: CPPC: Add a symbol to check if the preferred profile is a server
  cpufreq: amd-pstate: Set a fallback policy based on preferred_profile
  cpufreq: amd-pstate: Add a kernel config option to set default mode
  cpufreq: intel_pstate: Use the acpi_pm_profile_server() symbol

 drivers/acpi/cppc_acpi.c       | 34 +++++++++++++++
 drivers/cpufreq/Kconfig.x86    | 17 ++++++++
 drivers/cpufreq/amd-pstate.c   | 80 ++++++++++++++++++++++------------
 drivers/cpufreq/intel_pstate.c | 17 +-------
 include/acpi/actbl.h           |  3 +-
 include/acpi/processor.h       | 10 +++++
 include/linux/amd-pstate.h     |  4 +-
 7 files changed, 121 insertions(+), 44 deletions(-)

-- 
2.34.1


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

* [PATCH 1/4] ACPI: CPPC: Add a symbol to check if the preferred profile is a server
  2023-06-05 15:11 [PATCH 0/4] Enable amd-pstate active mode by default Mario Limonciello
@ 2023-06-05 15:11 ` Mario Limonciello
  2023-06-05 15:11 ` [PATCH 2/4] cpufreq: amd-pstate: Set a fallback policy based on preferred_profile Mario Limonciello
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Mario Limonciello @ 2023-06-05 15:11 UTC (permalink / raw)
  To: Huang Rui, Srinivas Pandruvada
  Cc: Rafael J . Wysocki, Len Brown, Viresh Kumar, Robert Moore,
	linux-acpi, linux-kernel, linux-pm, devel, Gautham Ranjal Shenoy,
	Wyes Karny, Perry Yuan, Mario Limonciello

This symbol will be used by intel-pstate and amd-pstate for making
decisions based on what the FADT indicates the system pm profile is.

Suggested-by: Gautham Ranjal Shenoy <gautham.shenoy@amd.com>
Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html#fixed-acpi-description-table-fadt
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/acpi/cppc_acpi.c | 34 ++++++++++++++++++++++++++++++++++
 include/acpi/actbl.h     |  3 ++-
 include/acpi/processor.h | 10 ++++++++++
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 7ff269a78c20..d8827eae3ba4 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -941,6 +941,40 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr)
 }
 EXPORT_SYMBOL_GPL(acpi_cppc_processor_exit);
 
+
+/**
+ * acpi_pm_profile_server() - Check if the system is a server.
+ *
+ * Return: true for server profiles, false for anything else
+ */
+bool acpi_pm_profile_server(void)
+{
+	switch (acpi_gbl_FADT.preferred_profile) {
+	case PM_ENTERPRISE_SERVER:
+	case PM_SOHO_SERVER:
+	case PM_PERFORMANCE_SERVER:
+		return true;
+	}
+	return false;
+}
+EXPORT_SYMBOL_GPL(acpi_pm_profile_server);
+
+/**
+ * acpi_pm_profile_undefined() - Check if the system is an undefined pm profile.
+ *
+ * Return: true for undefined profiles, false for anything else
+ */
+bool acpi_pm_profile_undefined(void)
+{
+	if (acpi_gbl_FADT.preferred_profile == PM_UNSPECIFIED)
+		return true;
+	if (acpi_gbl_FADT.preferred_profile >= NR_PM_PROFILES)
+		return true;
+	return false;
+}
+EXPORT_SYMBOL_GPL(acpi_pm_profile_undefined);
+
+
 /**
  * cpc_read_ffh() - Read FFH register
  * @cpunum:	CPU number to read
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index e5dfb6f4de52..451f6276da49 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -307,7 +307,8 @@ enum acpi_preferred_pm_profiles {
 	PM_SOHO_SERVER = 5,
 	PM_APPLIANCE_PC = 6,
 	PM_PERFORMANCE_SERVER = 7,
-	PM_TABLET = 8
+	PM_TABLET = 8,
+	NR_PM_PROFILES = 9
 };
 
 /* Values for sleep_status and sleep_control registers (V5+ FADT) */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 94181fe9780a..05a45ebddaea 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -360,6 +360,8 @@ int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
 #ifdef CONFIG_ACPI_CPPC_LIB
 extern int acpi_cppc_processor_probe(struct acpi_processor *pr);
 extern void acpi_cppc_processor_exit(struct acpi_processor *pr);
+extern bool acpi_pm_profile_server(void);
+extern bool acpi_pm_profile_undefined(void);
 #else
 static inline int acpi_cppc_processor_probe(struct acpi_processor *pr)
 {
@@ -369,6 +371,14 @@ static inline void acpi_cppc_processor_exit(struct acpi_processor *pr)
 {
 	return;
 }
+static inline bool acpi_pm_profile_server(void)
+{
+	return false;
+}
+static inline bool acpi_pm_profile_undefined(void)
+{
+	return true;
+}
 #endif	/* CONFIG_ACPI_CPPC_LIB */
 
 /* in processor_pdc.c */
-- 
2.34.1


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

* [PATCH 2/4] cpufreq: amd-pstate: Set a fallback policy based on preferred_profile
  2023-06-05 15:11 [PATCH 0/4] Enable amd-pstate active mode by default Mario Limonciello
  2023-06-05 15:11 ` [PATCH 1/4] ACPI: CPPC: Add a symbol to check if the preferred profile is a server Mario Limonciello
@ 2023-06-05 15:11 ` Mario Limonciello
  2023-06-05 15:11 ` [PATCH 3/4] cpufreq: amd-pstate: Add a kernel config option to set default mode Mario Limonciello
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Mario Limonciello @ 2023-06-05 15:11 UTC (permalink / raw)
  To: Huang Rui, Srinivas Pandruvada
  Cc: Rafael J . Wysocki, Len Brown, Viresh Kumar, Robert Moore,
	linux-acpi, linux-kernel, linux-pm, devel, Gautham Ranjal Shenoy,
	Wyes Karny, Perry Yuan, Mario Limonciello

If a user's configuration doesn't explicitly specify the cpufreq
scaling governor then the code currently explicitly falls back to
'powersave'. This default is fine for notebooks and desktops, but
servers and undefined machines should default to 'performance'.

Look at the 'preferred_profile' field from the FADT to set this
policy accordingly.

Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html#fixed-acpi-description-table-fadt
Suggested-by: Wyes Karny <Wyes.Karny@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index ddd346a239e0..c9d296ebf81e 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -1102,10 +1102,13 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
 	policy->max = policy->cpuinfo.max_freq;
 
 	/*
-	 * Set the policy to powersave to provide a valid fallback value in case
+	 * Set the policy to provide a valid fallback value in case
 	 * the default cpufreq governor is neither powersave nor performance.
 	 */
-	policy->policy = CPUFREQ_POLICY_POWERSAVE;
+	if (acpi_pm_profile_server() || acpi_pm_profile_undefined())
+		policy->policy = CPUFREQ_POLICY_PERFORMANCE;
+	else
+		policy->policy = CPUFREQ_POLICY_POWERSAVE;
 
 	if (boot_cpu_has(X86_FEATURE_CPPC)) {
 		ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, &value);
-- 
2.34.1


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

* [PATCH 3/4] cpufreq: amd-pstate: Add a kernel config option to set default mode
  2023-06-05 15:11 [PATCH 0/4] Enable amd-pstate active mode by default Mario Limonciello
  2023-06-05 15:11 ` [PATCH 1/4] ACPI: CPPC: Add a symbol to check if the preferred profile is a server Mario Limonciello
  2023-06-05 15:11 ` [PATCH 2/4] cpufreq: amd-pstate: Set a fallback policy based on preferred_profile Mario Limonciello
@ 2023-06-05 15:11 ` Mario Limonciello
  2023-06-05 15:11 ` [PATCH 4/4] cpufreq: intel_pstate: Use the acpi_pm_profile_server() symbol Mario Limonciello
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Mario Limonciello @ 2023-06-05 15:11 UTC (permalink / raw)
  To: Huang Rui, Srinivas Pandruvada
  Cc: Rafael J . Wysocki, Len Brown, Viresh Kumar, Robert Moore,
	linux-acpi, linux-kernel, linux-pm, devel, Gautham Ranjal Shenoy,
	Wyes Karny, Perry Yuan, Mario Limonciello

Users are having more success with amd-pstate since the introduction
of EPP and Guided modes.  To expose the driver to more users by default
introduce a kernel configuration option for setting the default mode.

Users can use an integer to map out which default mode they want to use
in lieu of a kernel command line option.

This will default to EPP, but only if:
1) The CPU supports an MSR.
2) The system profile is identified
3) The system profile is identified as a non-server by the FADT.

Link: https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/merge_requests/121
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Co-developed-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/cpufreq/Kconfig.x86  | 17 +++++++++
 drivers/cpufreq/amd-pstate.c | 73 ++++++++++++++++++++++++------------
 include/linux/amd-pstate.h   |  4 +-
 3 files changed, 68 insertions(+), 26 deletions(-)

diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
index 00476e94db90..438c9e75a04d 100644
--- a/drivers/cpufreq/Kconfig.x86
+++ b/drivers/cpufreq/Kconfig.x86
@@ -51,6 +51,23 @@ config X86_AMD_PSTATE
 
 	  If in doubt, say N.
 
+config X86_AMD_PSTATE_DEFAULT_MODE
+	int "AMD Processor P-State default mode"
+	depends on X86_AMD_PSTATE
+	default 3 if X86_AMD_PSTATE
+	range 1 4
+	help
+	  Select the default mode the amd-pstate driver will use on
+	  supported hardware.
+	  The value set has the following meanings:
+		1 -> Disabled
+		2 -> Passive
+		3 -> Active (EPP)
+		4 -> Guided
+
+	  For details, take a look at:
+	  <file:Documentation/admin-guide/pm/amd-pstate.rst>.
+
 config X86_AMD_PSTATE_UT
 	tristate "selftest for AMD Processor P-State driver"
 	depends on X86 && ACPI_PROCESSOR
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index c9d296ebf81e..b400d1ee8e64 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -62,7 +62,7 @@
 static struct cpufreq_driver *current_pstate_driver;
 static struct cpufreq_driver amd_pstate_driver;
 static struct cpufreq_driver amd_pstate_epp_driver;
-static int cppc_state = AMD_PSTATE_DISABLE;
+static int cppc_state = AMD_PSTATE_UNDEFINED;
 
 /*
  * AMD Energy Preference Performance (EPP)
@@ -1363,6 +1363,25 @@ static struct cpufreq_driver amd_pstate_epp_driver = {
 	.attr		= amd_pstate_epp_attr,
 };
 
+static int __init amd_pstate_set_driver(int mode_idx)
+{
+	if (mode_idx >= AMD_PSTATE_DISABLE && mode_idx < AMD_PSTATE_MAX) {
+		cppc_state = mode_idx;
+		if (cppc_state == AMD_PSTATE_DISABLE)
+			pr_info("driver is explicitly disabled\n");
+
+		if (cppc_state == AMD_PSTATE_ACTIVE)
+			current_pstate_driver = &amd_pstate_epp_driver;
+
+		if (cppc_state == AMD_PSTATE_PASSIVE || cppc_state == AMD_PSTATE_GUIDED)
+			current_pstate_driver = &amd_pstate_driver;
+
+		return 0;
+	}
+
+	return -EINVAL;
+}
+
 static int __init amd_pstate_init(void)
 {
 	struct device *dev_root;
@@ -1370,15 +1389,6 @@ 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 or other modes in kernel command line
-	 */
-	if (cppc_state == AMD_PSTATE_DISABLE) {
-		pr_info("driver load is disabled, boot with specific mode 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");
@@ -1389,6 +1399,33 @@ static int __init amd_pstate_init(void)
 	if (cpufreq_get_current_driver())
 		return -EEXIST;
 
+	switch (cppc_state) {
+	case AMD_PSTATE_UNDEFINED:
+		/* Disable on the following configs by default:
+		 * 1. Undefined platforms
+		 * 2. Server platforms
+		 * 3. Shared memory designs
+		 */
+		if (acpi_pm_profile_undefined() ||
+		    acpi_pm_profile_server() ||
+		    !boot_cpu_has(X86_FEATURE_CPPC)) {
+			pr_info("driver load is disabled, boot with specific mode to enable this\n");
+			return -ENODEV;
+		}
+		ret = amd_pstate_set_driver(CONFIG_X86_AMD_PSTATE_DEFAULT_MODE);
+		if (ret)
+			return ret;
+		break;
+	case AMD_PSTATE_DISABLE:
+		return -ENODEV;
+	case AMD_PSTATE_PASSIVE:
+	case AMD_PSTATE_ACTIVE:
+	case AMD_PSTATE_GUIDED:
+		break;
+	default:
+		return -EINVAL;
+	}
+
 	/* capability check */
 	if (boot_cpu_has(X86_FEATURE_CPPC)) {
 		pr_debug("AMD CPPC MSR based functionality is supported\n");
@@ -1441,21 +1478,7 @@ static int __init amd_pstate_param(char *str)
 	size = strlen(str);
 	mode_idx = get_mode_idx_from_str(str, size);
 
-	if (mode_idx >= AMD_PSTATE_DISABLE && mode_idx < AMD_PSTATE_MAX) {
-		cppc_state = mode_idx;
-		if (cppc_state == AMD_PSTATE_DISABLE)
-			pr_info("driver is explicitly disabled\n");
-
-		if (cppc_state == AMD_PSTATE_ACTIVE)
-			current_pstate_driver = &amd_pstate_epp_driver;
-
-		if (cppc_state == AMD_PSTATE_PASSIVE || cppc_state == AMD_PSTATE_GUIDED)
-			current_pstate_driver = &amd_pstate_driver;
-
-		return 0;
-	}
-
-	return -EINVAL;
+	return amd_pstate_set_driver(mode_idx);
 }
 early_param("amd_pstate", amd_pstate_param);
 
diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h
index c10ebf8c42e6..446394f84606 100644
--- a/include/linux/amd-pstate.h
+++ b/include/linux/amd-pstate.h
@@ -94,7 +94,8 @@ struct amd_cpudata {
  * enum amd_pstate_mode - driver working mode of amd pstate
  */
 enum amd_pstate_mode {
-	AMD_PSTATE_DISABLE = 0,
+	AMD_PSTATE_UNDEFINED = 0,
+	AMD_PSTATE_DISABLE,
 	AMD_PSTATE_PASSIVE,
 	AMD_PSTATE_ACTIVE,
 	AMD_PSTATE_GUIDED,
@@ -102,6 +103,7 @@ enum amd_pstate_mode {
 };
 
 static const char * const amd_pstate_mode_string[] = {
+	[AMD_PSTATE_UNDEFINED]   = "undefined",
 	[AMD_PSTATE_DISABLE]     = "disable",
 	[AMD_PSTATE_PASSIVE]     = "passive",
 	[AMD_PSTATE_ACTIVE]      = "active",
-- 
2.34.1


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

* [PATCH 4/4] cpufreq: intel_pstate: Use the acpi_pm_profile_server() symbol
  2023-06-05 15:11 [PATCH 0/4] Enable amd-pstate active mode by default Mario Limonciello
                   ` (2 preceding siblings ...)
  2023-06-05 15:11 ` [PATCH 3/4] cpufreq: amd-pstate: Add a kernel config option to set default mode Mario Limonciello
@ 2023-06-05 15:11 ` Mario Limonciello
  2023-06-13 10:09   ` kernel test robot
  2023-06-05 16:07 ` [PATCH 0/4] Enable amd-pstate active mode by default Yuan, Perry
  2023-06-05 16:10 ` Yuan, Perry
  5 siblings, 1 reply; 8+ messages in thread
From: Mario Limonciello @ 2023-06-05 15:11 UTC (permalink / raw)
  To: Huang Rui, Srinivas Pandruvada
  Cc: Rafael J . Wysocki, Len Brown, Viresh Kumar, Robert Moore,
	linux-acpi, linux-kernel, linux-pm, devel, Gautham Ranjal Shenoy,
	Wyes Karny, Perry Yuan, Mario Limonciello

Avoid duplication of functionality by using the generic symbol.
This does have a functional change that intel-pstate will now
match "SOHO server" as well.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/cpufreq/intel_pstate.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 2548ec92faa2..3a36c0169d82 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -313,18 +313,9 @@ static DEFINE_MUTEX(intel_pstate_limits_lock);
 
 #ifdef CONFIG_ACPI
 
-static bool intel_pstate_acpi_pm_profile_server(void)
-{
-	if (acpi_gbl_FADT.preferred_profile == PM_ENTERPRISE_SERVER ||
-	    acpi_gbl_FADT.preferred_profile == PM_PERFORMANCE_SERVER)
-		return true;
-
-	return false;
-}
-
 static bool intel_pstate_get_ppc_enable_status(void)
 {
-	if (intel_pstate_acpi_pm_profile_server())
+	if (acpi_pm_profile_server())
 		return true;
 
 	return acpi_ppc;
@@ -481,10 +472,6 @@ static inline void intel_pstate_exit_perf_limits(struct cpufreq_policy *policy)
 {
 }
 
-static inline bool intel_pstate_acpi_pm_profile_server(void)
-{
-	return false;
-}
 #endif /* CONFIG_ACPI */
 
 #ifndef CONFIG_ACPI_CPPC_LIB
@@ -2407,7 +2394,7 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
 		if (hwp_active) {
 			intel_pstate_hwp_enable(cpu);
 
-			if (intel_pstate_acpi_pm_profile_server())
+			if (acpi_pm_profile_server())
 				hwp_boost = true;
 		}
 	} else if (hwp_active) {
-- 
2.34.1


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

* RE: [PATCH 0/4] Enable amd-pstate active mode by default
  2023-06-05 15:11 [PATCH 0/4] Enable amd-pstate active mode by default Mario Limonciello
                   ` (3 preceding siblings ...)
  2023-06-05 15:11 ` [PATCH 4/4] cpufreq: intel_pstate: Use the acpi_pm_profile_server() symbol Mario Limonciello
@ 2023-06-05 16:07 ` Yuan, Perry
  2023-06-05 16:10 ` Yuan, Perry
  5 siblings, 0 replies; 8+ messages in thread
From: Yuan, Perry @ 2023-06-05 16:07 UTC (permalink / raw)
  To: Rafael J . Wysocki, Limonciello, Mario, Huang, Ray,
	Srinivas Pandruvada
  Cc: Len Brown, Viresh Kumar, Robert Moore, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	devel@acpica.org, Shenoy, Gautham Ranjal, Karny, Wyes,
	Yuan, Perry

[AMD Official Use Only - General]

Hi Mario, Raphael,

> -----Original Message-----
> From: Limonciello, Mario <Mario.Limonciello@amd.com>
> Sent: Monday, June 5, 2023 11:11 PM
> To: Huang, Ray <Ray.Huang@amd.com>; Srinivas Pandruvada
> <srinivas.pandruvada@linux.intel.com>
> Cc: Rafael J . Wysocki <rafael@kernel.org>; Len Brown <lenb@kernel.org>;
> Viresh Kumar <viresh.kumar@linaro.org>; Robert Moore
> <robert.moore@intel.com>; linux-acpi@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-pm@vger.kernel.org; devel@acpica.org; Shenoy,
> Gautham Ranjal <gautham.shenoy@amd.com>; Karny, Wyes
> <Wyes.Karny@amd.com>; Yuan, Perry <Perry.Yuan@amd.com>; Limonciello,
> Mario <Mario.Limonciello@amd.com>
> Subject: [PATCH 0/4] Enable amd-pstate active mode by default
>
> Active mode for amd-pstate has shown enough success now that it makes
> sense to enable it by default on client systems.
>
> This series introduces a new kernel configuration option to set the default
> policy for amd-pstate modes for a kernel.
>
> Server systems will by identified by the PM preferred profile and still be set as
> disabled by default for now.
>
> Mario Limonciello (4):
>   ACPI: CPPC: Add a symbol to check if the preferred profile is a server
>   cpufreq: amd-pstate: Set a fallback policy based on preferred_profile
>   cpufreq: amd-pstate: Add a kernel config option to set default mode
>   cpufreq: intel_pstate: Use the acpi_pm_profile_server() symbol
>
>  drivers/acpi/cppc_acpi.c       | 34 +++++++++++++++
>  drivers/cpufreq/Kconfig.x86    | 17 ++++++++
>  drivers/cpufreq/amd-pstate.c   | 80 ++++++++++++++++++++++------------
>  drivers/cpufreq/intel_pstate.c | 17 +-------
>  include/acpi/actbl.h           |  3 +-
>  include/acpi/processor.h       | 10 +++++
>  include/linux/amd-pstate.h     |  4 +-
>  7 files changed, 121 insertions(+), 44 deletions(-)
>
> --
> 2.34.1

The series is tested with commit 7736c431466abb54a2679dc257f739fddfa84295 (linux-pm/bleeding-edge)

Default option will enable EPP mode without any parameters added to kernel command line,
If user adds "amd_pstate=passive" to kernel command line, they still can choose other modes to use.

Based the testing result.
Tested-by: Yuan Perry <Perry.Yuan@amd.com>

Perry.


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

* RE: [PATCH 0/4] Enable amd-pstate active mode by default
  2023-06-05 15:11 [PATCH 0/4] Enable amd-pstate active mode by default Mario Limonciello
                   ` (4 preceding siblings ...)
  2023-06-05 16:07 ` [PATCH 0/4] Enable amd-pstate active mode by default Yuan, Perry
@ 2023-06-05 16:10 ` Yuan, Perry
  5 siblings, 0 replies; 8+ messages in thread
From: Yuan, Perry @ 2023-06-05 16:10 UTC (permalink / raw)
  To: Limonciello, Mario, Huang, Ray, Srinivas Pandruvada
  Cc: Rafael J . Wysocki, Len Brown, Viresh Kumar, Robert Moore,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, devel@acpica.org,
	Shenoy, Gautham Ranjal, Karny, Wyes

[AMD Official Use Only - General]

Hi Mario, Rafael,

> -----Original Message-----
> From: Limonciello, Mario <Mario.Limonciello@amd.com>
> Sent: Monday, June 5, 2023 11:11 PM
> To: Huang, Ray <Ray.Huang@amd.com>; Srinivas Pandruvada
> <srinivas.pandruvada@linux.intel.com>
> Cc: Rafael J . Wysocki <rafael@kernel.org>; Len Brown <lenb@kernel.org>;
> Viresh Kumar <viresh.kumar@linaro.org>; Robert Moore
> <robert.moore@intel.com>; linux-acpi@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-pm@vger.kernel.org; devel@acpica.org; Shenoy,
> Gautham Ranjal <gautham.shenoy@amd.com>; Karny, Wyes
> <Wyes.Karny@amd.com>; Yuan, Perry <Perry.Yuan@amd.com>; Limonciello,
> Mario <Mario.Limonciello@amd.com>
> Subject: [PATCH 0/4] Enable amd-pstate active mode by default
>
> Active mode for amd-pstate has shown enough success now that it makes
> sense to enable it by default on client systems.
>
> This series introduces a new kernel configuration option to set the default
> policy for amd-pstate modes for a kernel.
>
> Server systems will by identified by the PM preferred profile and still be set as
> disabled by default for now.
>
> Mario Limonciello (4):
>   ACPI: CPPC: Add a symbol to check if the preferred profile is a server
>   cpufreq: amd-pstate: Set a fallback policy based on preferred_profile
>   cpufreq: amd-pstate: Add a kernel config option to set default mode
>   cpufreq: intel_pstate: Use the acpi_pm_profile_server() symbol
>
>  drivers/acpi/cppc_acpi.c       | 34 +++++++++++++++
>  drivers/cpufreq/Kconfig.x86    | 17 ++++++++
>  drivers/cpufreq/amd-pstate.c   | 80 ++++++++++++++++++++++------------
>  drivers/cpufreq/intel_pstate.c | 17 +-------
>  include/acpi/actbl.h           |  3 +-
>  include/acpi/processor.h       | 10 +++++
>  include/linux/amd-pstate.h     |  4 +-
>  7 files changed, 121 insertions(+), 44 deletions(-)
>
> --
> 2.34.1


Sorry for the typo, send again.

The series is tested with commit 7736c431466abb54a2679dc257f739fddfa84295 (linux-pm/bleeding-edge)

Default option will enable EPP mode without any parameters added to kernel command line, If user adds "amd_pstate=passive" to kernel command line, they still can choose other modes to use.

Based the testing result.
Tested-by: Yuan Perry <Perry.Yuan@amd.com>

Perry.


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

* Re: [PATCH 4/4] cpufreq: intel_pstate: Use the acpi_pm_profile_server() symbol
  2023-06-05 15:11 ` [PATCH 4/4] cpufreq: intel_pstate: Use the acpi_pm_profile_server() symbol Mario Limonciello
@ 2023-06-13 10:09   ` kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2023-06-13 10:09 UTC (permalink / raw)
  To: Mario Limonciello, Huang Rui, Srinivas Pandruvada
  Cc: llvm, oe-kbuild-all, Rafael J . Wysocki, Len Brown, Viresh Kumar,
	Robert Moore, linux-acpi, linux-kernel, linux-pm, devel,
	Gautham Ranjal Shenoy, Wyes Karny, Perry Yuan, Mario Limonciello

Hi Mario,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on linus/master v6.4-rc6 next-20230613]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/ACPI-CPPC-Add-a-symbol-to-check-if-the-preferred-profile-is-a-server/20230605-231602
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20230605151133.2615-5-mario.limonciello%40amd.com
patch subject: [PATCH 4/4] cpufreq: intel_pstate: Use the acpi_pm_profile_server() symbol
config: i386-buildonly-randconfig-r006-20230612 (https://download.01.org/0day-ci/archive/20230613/202306131736.HZQ9caR6-lkp@intel.com/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce (this is a W=1 build):
        mkdir -p ~/bin
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git remote add rafael-pm https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
        git fetch rafael-pm linux-next
        git checkout rafael-pm/linux-next
        b4 shazam https://lore.kernel.org/r/20230605151133.2615-5-mario.limonciello@amd.com
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/cpufreq/

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306131736.HZQ9caR6-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/cpufreq/intel_pstate.c:2397:8: error: call to undeclared function 'acpi_pm_profile_server'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
                           if (acpi_pm_profile_server())
                               ^
   1 error generated.


vim +/acpi_pm_profile_server +2397 drivers/cpufreq/intel_pstate.c

  2376	
  2377	static int intel_pstate_init_cpu(unsigned int cpunum)
  2378	{
  2379		struct cpudata *cpu;
  2380	
  2381		cpu = all_cpu_data[cpunum];
  2382	
  2383		if (!cpu) {
  2384			cpu = kzalloc(sizeof(*cpu), GFP_KERNEL);
  2385			if (!cpu)
  2386				return -ENOMEM;
  2387	
  2388			WRITE_ONCE(all_cpu_data[cpunum], cpu);
  2389	
  2390			cpu->cpu = cpunum;
  2391	
  2392			cpu->epp_default = -EINVAL;
  2393	
  2394			if (hwp_active) {
  2395				intel_pstate_hwp_enable(cpu);
  2396	
> 2397				if (acpi_pm_profile_server())
  2398					hwp_boost = true;
  2399			}
  2400		} else if (hwp_active) {
  2401			/*
  2402			 * Re-enable HWP in case this happens after a resume from ACPI
  2403			 * S3 if the CPU was offline during the whole system/resume
  2404			 * cycle.
  2405			 */
  2406			intel_pstate_hwp_reenable(cpu);
  2407		}
  2408	
  2409		cpu->epp_powersave = -EINVAL;
  2410		cpu->epp_policy = 0;
  2411	
  2412		intel_pstate_get_cpu_pstates(cpu);
  2413	
  2414		pr_debug("controlling: cpu %d\n", cpunum);
  2415	
  2416		return 0;
  2417	}
  2418	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2023-06-13 10:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-05 15:11 [PATCH 0/4] Enable amd-pstate active mode by default Mario Limonciello
2023-06-05 15:11 ` [PATCH 1/4] ACPI: CPPC: Add a symbol to check if the preferred profile is a server Mario Limonciello
2023-06-05 15:11 ` [PATCH 2/4] cpufreq: amd-pstate: Set a fallback policy based on preferred_profile Mario Limonciello
2023-06-05 15:11 ` [PATCH 3/4] cpufreq: amd-pstate: Add a kernel config option to set default mode Mario Limonciello
2023-06-05 15:11 ` [PATCH 4/4] cpufreq: intel_pstate: Use the acpi_pm_profile_server() symbol Mario Limonciello
2023-06-13 10:09   ` kernel test robot
2023-06-05 16:07 ` [PATCH 0/4] Enable amd-pstate active mode by default Yuan, Perry
2023-06-05 16:10 ` Yuan, Perry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox