Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2320510pxa; Mon, 24 Aug 2020 10:49:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeMT64w9j6eQUvJMQcAKbBTBnylDcM3FIJsdLmW+If/wXzOFhikNCOGeRYKtM8eEHJqcvI X-Received: by 2002:a17:906:3a02:: with SMTP id z2mr6478418eje.287.1598291373256; Mon, 24 Aug 2020 10:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598291373; cv=none; d=google.com; s=arc-20160816; b=mxGN4Hw1x3AN9xYrUzZXSsqpQ3YPpuNpssw4QxyOHoUPHDMu2gunstVc/5vf+K7Rjx tuGcGQYFSF/MTVBWr1xPcTqsQL5gAMrGSCz6doXMJwUAp/zk3Be/DaqgwK/XPSLR+Onr iqubYDZKoe/Hz93kupJS9XnHmBmPUY1q0MTv3H2fJT2cxhz8neReNnz8OA92ABPpSUBV VNbhd4Oh0TDUEP5WNUGL/qX8kI6PqKJGX+4OnGLD8PNJZw31oqv5+QX3GF0wHAL+VmHf WqQTwTR2cacfJordadjLhRc5loPbWSraIbM5rMuK7myHMSnAnKPQFm9f+iG+L0cpkH23 ESHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/X7jly/wAtEMihQtEC8Ahueg85DqHUPBghfXaFNZk0g=; b=Jm+Lf3522LB7e9xHnATp2ABdTFXWkNMLUAegbXPM5CFdNUynINbLvVCSPJmV17LasU spiEDLEYzrqBgAREN+UmGX3Y9wC/I9kOB3uwqAFFG+zcjYStCZsNS8KJNxCGr5D5+rnL eWuyZF5ueRuY6rbgPTH6I4VssK39d2iO5xgEy6ql9QMn0gD+SOAywoyKQOFpviC/09mb 5VJDY1xyEiwOSHbGAxe3ngpSwj19zna5YlDEzc2zhUtboBhAZbTEtOu7zu8WOeCZj2oN fsDGg+55CGjR2LdS50Qe5nvC8SFGd8b5Kuqo+TyqUAALddRYBJckKZydaRi9jrtLbLlb Ia5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si3036394ejx.624.2020.08.24.10.49.09; Mon, 24 Aug 2020 10:49:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727827AbgHXRsZ (ORCPT + 99 others); Mon, 24 Aug 2020 13:48:25 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:50048 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726804AbgHXRsR (ORCPT ); Mon, 24 Aug 2020 13:48:17 -0400 Received: from 89-64-88-199.dynamic.chello.pl (89.64.88.199) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.459) id 5322221e19cca5bb; Mon, 24 Aug 2020 19:48:14 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , LKML , Doug Smythies Subject: [PATCH v2 1/5] cpufreq: intel_pstate: Refuse to turn off with HWP enabled Date: Mon, 24 Aug 2020 19:41:08 +0200 Message-ID: <1838142.qObzxHvn5B@kreacher> In-Reply-To: <4169555.5IIHXK4Dsd@kreacher> References: <4169555.5IIHXK4Dsd@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Rafael J. Wysocki" 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 --- -> v2: 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