linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Doug Smythies <dsmythies@telus.net>,
	Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Subject: [PATCH v4 1/5] cpufreq: intel_pstate: Refuse to turn off with HWP enabled
Date: Tue, 01 Sep 2020 19:25:53 +0200	[thread overview]
Message-ID: <5860605.v7HuRlE7Aj@kreacher> (raw)
In-Reply-To: <3748218.V0HrpZKF9g@kreacher>

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

After commit f6ebbcf08f37 ("cpufreq: intel_pstate: Implement passive
mode with HWP enabled") it is possible to change the driver status
to "off" via sysfs with HWP enabled, which effectively causes the
driver to unregister itself, but HWP remains active and it forces the
minimum performance, so even if another cpufreq driver is loaded,
it will not be able to control the CPU frequency.

For this reason, make the driver refuse to change the status to
"off" with HWP enabled.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

v1 -> v4: No changes

---
 drivers/cpufreq/intel_pstate.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index e0220a6fbc69..bcda1e700a73 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2716,9 +2716,15 @@ static int intel_pstate_update_status(const char *buf, size_t size)
 {
 	int ret;
 
-	if (size == 3 && !strncmp(buf, "off", size))
-		return intel_pstate_driver ?
-			intel_pstate_unregister_driver() : -EINVAL;
+	if (size == 3 && !strncmp(buf, "off", size)) {
+		if (!intel_pstate_driver)
+			return -EINVAL;
+
+		if (hwp_active)
+			return -EBUSY;
+
+		return intel_pstate_unregister_driver();
+	}
 
 	if (size == 6 && !strncmp(buf, "active", size)) {
 		if (intel_pstate_driver) {
-- 
2.26.2





  reply	other threads:[~2020-09-01 17:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 17:23 [PATCH v4 0/5] cpufreq: intel_pstate: Address some HWP-related oddities Rafael J. Wysocki
2020-09-01 17:25 ` Rafael J. Wysocki [this message]
2020-09-01 17:27 ` [PATCH v4 2/5] cpufreq: intel_pstate: Update cached EPP in the active mode Rafael J. Wysocki
2020-09-01 17:29 ` [PATCH v4 3/5] cpufreq: intel_pstate: Tweak the EPP sysfs interface Rafael J. Wysocki
2020-09-01 17:37 ` [PATCH v4 4/5] cpufreq: intel_pstate: Add ->offline and ->online callbacks Rafael J. Wysocki
2020-09-01 17:39 ` [PATCH v4 5/5] cpufreq: intel_pstate: Free memory only when turning off Rafael J. Wysocki
2020-09-01 19:07 ` [PATCH v4 0/5] cpufreq: intel_pstate: Address some HWP-related oddities Srinivas Pandruvada

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=5860605.v7HuRlE7Aj@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=dsmythies@telus.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).