Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1914194pxk; Tue, 1 Sep 2020 10:42:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/8XM501Ot+wBQ+jVAFYblsUUqTIBPzDksWlW9uF66Z3F5P8fmgjju5xAuesQ/5NOvMNbP X-Received: by 2002:aa7:c394:: with SMTP id k20mr2515923edq.279.1598982126411; Tue, 01 Sep 2020 10:42:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598982126; cv=none; d=google.com; s=arc-20160816; b=yw6gGFNRlQwzenz0TdTbuhDfaLt47aPBT5H6Cze5cPgkTKYFXSMT4489aIWaLh62+k avrVVi7rtd62N++2j17JwLJnmWL8DT1eep+c0f8EykXJQ5rocwK0Z6C9G3U0/YzKV/6w XSgqTky95AjlG+LHIB6DeUeq13K454QrAcSEUFL5iusfpSv5NsxcsRe95CrKsyTyL2pr bbh0SM2LRHOfNsLcZOeWp2uOMhp4S+1MAKRhLLqS5IpTpMwXWLYMHZYpoX9pd6PAZlRl gch5uJvHHmTGisSGckqFFbXF/JvOrcxN5T14jZ7/zk5WHol/3cozbpma1qI10fZAAjQw VQ2A== 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=bqDJlc/XerjqoV2V+TObiSk0ij4NqBCs95w9HO0CNM4=; b=c3IVMekvT9RVCf9sT5sd3Rmj3SKg0oSZnVc/aKmnQuvc9VsEeO+ApgQSubOtYICdE6 73/ciu8LNtx1ua+EXIov5yXQObz/NpY5AYDdihWcl5KQ5uMJzWiy8n1EjHo5DHUV0xeN J7gmaqgTwiHf326y3x7biozFPJKu8P2Oy3qA+E+avjgKA3e/vVexU7bbq8A7HmY4p97Z nVwAghscu0USdJNkjSPmw2kAo4KfpGrN1vVrwXYTxPKdmgqzZUWEY+ZUnPOIVuSC6co8 C73PcUI20MRdi7/cprpxVjUQpVAZOTkIXVKRNX8wXyu17Q2NrX42O7ht3hbAddFpK7y1 bpyg== 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 h27si1119296ejd.317.2020.09.01.10.41.42; Tue, 01 Sep 2020 10:42:06 -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 S1730120AbgIARj6 (ORCPT + 99 others); Tue, 1 Sep 2020 13:39:58 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:64710 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729034AbgIARj4 (ORCPT ); Tue, 1 Sep 2020 13:39:56 -0400 Received: from 89-64-88-247.dynamic.chello.pl (89.64.88.247) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.459) id 9794ea559f62b2f3; Tue, 1 Sep 2020 19:39:54 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , LKML , Doug Smythies , Artem Bityutskiy Subject: [PATCH v4 1/5] cpufreq: intel_pstate: Refuse to turn off with HWP enabled Date: Tue, 01 Sep 2020 19:25:53 +0200 Message-ID: <5860605.v7HuRlE7Aj@kreacher> In-Reply-To: <3748218.V0HrpZKF9g@kreacher> References: <3748218.V0HrpZKF9g@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 --- 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