All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-pm@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 14/17] cpufreq: intel_pstate: Refuse to turn off with HWP enabled
Date: Mon,  7 Sep 2020 12:34:57 -0400	[thread overview]
Message-ID: <20200907163500.1281543-14-sashal@kernel.org> (raw)
In-Reply-To: <20200907163500.1281543-1-sashal@kernel.org>

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

[ Upstream commit 43298db3009f06fe5c69e1ca8b6cfc2565772fa1 ]

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>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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 5c41dc9aaa46d..be1a7bb0b4011 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2098,9 +2098,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.25.1


  parent reply	other threads:[~2020-09-07 16:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07 16:34 [PATCH AUTOSEL 4.14 01/17] ARC: HSDK: wireup perf irq Sasha Levin
2020-09-07 16:34 ` Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 02/17] dmaengine: acpi: Put the CSRT table after using it Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 03/17] drivers/net/wan/lapbether: Added needed_tailroom Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 04/17] NFC: st95hf: Fix memleak in st95hf_in_send_cmd Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 05/17] firestream: Fix memleak in fs_open Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 06/17] ALSA: hda: Fix 2 channel swapping for Tegra Sasha Levin
2020-09-07 16:34   ` Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 07/17] drivers/net/wan/lapbether: Set network_header before transmitting Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 08/17] cfg80211: regulatory: reject invalid hints Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 09/17] net: usb: Fix uninit-was-stored issue in asix_read_phy_addr() Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 10/17] xfs: initialize the shortform attr header padding entry Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 11/17] irqchip/eznps: Fix build error for !ARC700 builds Sasha Levin
2020-09-07 16:34   ` Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 12/17] drivers/net/wan/hdlc_cisco: Add hard_header_len Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 13/17] ARC: [plat-hsdk]: Switch ethernet phy-mode to rgmii-id Sasha Levin
2020-09-07 16:34   ` Sasha Levin
2020-09-07 16:34 ` Sasha Levin [this message]
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 15/17] net: usb: dm9601: Add USB ID of Keenetic Plus DSL Sasha Levin
2020-09-07 16:34 ` [PATCH AUTOSEL 4.14 16/17] ALSA: hda: fix a runtime pm issue in SOF when integrated GPU is disabled Sasha Levin
2020-09-07 16:34   ` Sasha Levin
2020-09-07 16:35 ` [PATCH AUTOSEL 4.14 17/17] gcov: Disable gcov build with GCC 10 Sasha Levin

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=20200907163500.1281543-14-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=stable@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.