From: Erwan Velu <erwanaliasr1@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: e.velu@criteo.com, Liam.Howlett@oracle.com,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Len Brown <lenb@kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Viresh Kumar <viresh.kumar@linaro.org>,
linux-pm@vger.kernel.org (open list:INTEL PSTATE DRIVER),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v3] cpufreq: intel_pstate: Reporting reasons why driver prematurely exit
Date: Mon, 11 Feb 2019 10:31:40 +0100 [thread overview]
Message-ID: <20190211093140.23608-1-e.velu@criteo.com> (raw)
The init code path have several execeptions where the module can decide not to load.
As CONFIG_X86_INTEL_PSTATE is generally set to Y, the return code is not reachable.
The initialisation code is neither verbose of the reason why it did choose to prematurely exit.
This situation leads to situation where its difficult for a user to determine,
on a given platform, why the driver didn't loaded properly.
This patch is about reporting to the user the reason/context why the driver failed to load.
That is a precious hint when debugging a platform.
Signed-off-by: Erwan Velu <e.velu@criteo.com>
---
drivers/cpufreq/intel_pstate.c | 36 ++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index dd66decf2087..ba2e2aee6c20 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2475,6 +2475,7 @@ static bool __init intel_pstate_no_acpi_pss(void)
kfree(pss);
}
+ pr_info("Cannot detect ACPI PSS");
return true;
}
@@ -2484,10 +2485,16 @@ static bool __init intel_pstate_no_acpi_pcch(void)
acpi_handle handle;
status = acpi_get_handle(NULL, "\\_SB", &handle);
- if (ACPI_FAILURE(status))
+ if (ACPI_FAILURE(status)) {
+ pr_info("Cannot detect ACPI SB");
return true;
+ }
- return !acpi_has_method(handle, "PCCH");
+ status = acpi_has_method(handle, "PCCH");
+ if (!status) {
+ pr_info("Cannot detect ACPI PCCH");
+ }
+ return !status;
}
static bool __init intel_pstate_has_acpi_ppc(void)
@@ -2502,6 +2509,7 @@ static bool __init intel_pstate_has_acpi_ppc(void)
if (acpi_has_method(pr->handle, "_PPC"))
return true;
}
+ pr_info("Cannot detect ACPI PPC");
return false;
}
@@ -2592,8 +2600,10 @@ static int __init intel_pstate_init(void)
const struct x86_cpu_id *id;
int rc;
- if (no_load)
+ if (no_load) {
+ pr_info("disabling as per user-request\n");
return -ENODEV;
+ }
id = x86_match_cpu(hwp_support_ids);
if (id) {
@@ -2606,31 +2616,41 @@ static int __init intel_pstate_init(void)
}
} else {
id = x86_match_cpu(intel_pstate_cpu_ids);
- if (!id)
+ if (!id) {
+ pr_warn("CPU ID is not in the list of supported devices\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_warn("Cannot enable driver as per 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_warn("Platform already taking care of power management\n");
return -ENODEV;
+ }
- if (!hwp_active && hwp_only)
+ if (!hwp_active && hwp_only) {
+ pr_warn("HWP not present\n");
return -ENOTSUPP;
+ }
pr_info("Intel P-state driver initializing\n");
all_cpu_data = vzalloc(array_size(sizeof(void *), num_possible_cpus()));
- if (!all_cpu_data)
+ if (!all_cpu_data) {
+ pr_warn("Cannot allocate memory\n");
return -ENOMEM;
+ }
intel_pstate_request_control_from_smm();
--
2.20.1
next reply other threads:[~2019-02-11 9:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-11 9:31 Erwan Velu [this message]
2019-02-11 21:25 ` Srinivas Pandruvada
2019-02-11 21:34 ` Erwan Velu
2019-02-11 23:17 ` Srinivas Pandruvada
2019-02-12 6:57 ` Erwan Velu
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=20190211093140.23608-1-e.velu@criteo.com \
--to=erwanaliasr1@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=e.velu@criteo.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=srinivas.pandruvada@linux.intel.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
all inboxes | Powered by JetHome®