[Devel] [PATCH RHEL7 COMMIT] ms/cpufreq: intel_pstate: Add reasons for failure and debug messages

Vasily Averin vvs at virtuozzo.com
Tue Mar 2 09:52:54 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.15.2.vz7.173.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.15.2.vz7.173.1
------>
commit 4e55d6d05c678ae0f0a7e678110e1493b65b34b6
Author: Erwan Velu <e.velu at criteo.com>
Date:   Tue Mar 2 09:52:53 2021 +0300

    ms/cpufreq: intel_pstate: Add reasons for failure and debug messages
    
    The init code path has several exceptions where the driver can
    decide not to load.
    
    As CONFIG_X86_INTEL_PSTATE is generally set to Y, the return code is
    not reachable.  The initialization code is neither verbose of the
    reason why it did choose to prematurely exit, so it is difficult for
    a user to determine, on a given platform, why the driver didn't load
    properly.
    
    This patch is about reporting to the user the reason/context of why
    the driver failed to load.  That is a precious hint when debugging
    a platform.
    
    Signed-off-by: Erwan Velu <e.velu at criteo.com>
    [ rjw: Subject & changelog, minor fixups ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki at intel.com>
    
    Commit 076b862c7e4409d2dcacfda19f7eaf8d07ab9200 in the mainline kernel.
    Added in the scope of https://jira.sw.ru/browse/PSBM-126007
    Signed-off-by: Evgenii Shatokhin <eshatokhin at virtuozzo.com>
---
 drivers/cpufreq/intel_pstate.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index d4825dc..4283d1b 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2409,6 +2409,7 @@ static bool intel_pstate_no_acpi_pss(void)
 		kfree(pss);
 	}
 
+	pr_debug("ACPI _PSS not found\n");
 	return true;
 }
 
@@ -2419,9 +2420,14 @@ static bool __init intel_pstate_no_acpi_pcch(void)
 
 	status = acpi_get_handle(NULL, "\\_SB", &handle);
 	if (ACPI_FAILURE(status))
-		return true;
+		goto not_found;
+
+	if (acpi_has_method(handle, "PCCH"))
+		return false;
 
-	return !acpi_has_method(handle, "PCCH");
+not_found:
+	pr_debug("ACPI PCCH not found\n");
+	return true;
 }
 
 static bool intel_pstate_has_acpi_ppc(void)
@@ -2436,6 +2442,7 @@ static bool intel_pstate_has_acpi_ppc(void)
 		if (acpi_has_method(pr->handle, "_PPC"))
 			return true;
 	}
+	pr_debug("ACPI _PPC not found\n");
 	return false;
 }
 
@@ -2481,8 +2488,10 @@ static bool intel_pstate_platform_pwr_mgmt_exists(void)
 	id = x86_match_cpu(intel_pstate_cpu_oob_ids);
 	if (id) {
 		rdmsrl(MSR_MISC_PWR_MGMT, misc_pwr);
-		if ( misc_pwr & (1 << 8))
+		if (misc_pwr & (1 << 8)) {
+			pr_debug("Bit 8 in the MISC_PWR_MGMT MSR set\n");
 			return true;
+		}
 	}
 
 	if (acpi_disabled ||
@@ -2550,22 +2559,28 @@ static int __init intel_pstate_init(void)
 		const struct x86_cpu_id *id;
 
 		id = x86_match_cpu(intel_pstate_cpu_ids);
-		if (!id)
+		if (!id) {
+			pr_info("CPU ID not supported\n");
 			return -ENODEV;
+		}
 
 		copy_cpu_funcs((struct pstate_funcs *)id->driver_data);
 	}
 
-	if (intel_pstate_msrs_not_valid())
+	if (intel_pstate_msrs_not_valid()) {
+		pr_info("Invalid MSRs\n");
 		return -ENODEV;
+	}
 
 hwp_cpu_matched:
 	/*
 	 * The Intel pstate driver will be ignored if the platform
 	 * firmware has its own power management modes.
 	 */
-	if (intel_pstate_platform_pwr_mgmt_exists())
+	if (intel_pstate_platform_pwr_mgmt_exists()) {
+		pr_info("P-states controlled by the platform\n");
 		return -ENODEV;
+	}
 
 	if (!hwp_active && hwp_only)
 		return -ENOTSUPP;


More information about the Devel mailing list