Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp519702pxa; Thu, 27 Aug 2020 08:29:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKOQ473eypQCU5vkXL306WSkOP7fqYWGYBC+UK7M+b7SOy4Wk2OrGo+Q5vpeAHCNnGlNgj X-Received: by 2002:a17:906:22d6:: with SMTP id q22mr13652899eja.242.1598542141261; Thu, 27 Aug 2020 08:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598542141; cv=none; d=google.com; s=arc-20160816; b=GnaC23yowPvIvfpTTluCY+3kLIxnqV5/2JhxKhUp0LZ/GBlOpk9wmjvUbU4tzaTPcG qGYfee8M24N3gaDW9aWWrGPLw9A5tqWbT0192kgbT7qEcSZAl7GuQMPySMJucIJSkof6 NC/Gt6kJ6JGKQt0wrxS6WEjSSSobC1vQ93i7VnWuU/y6hI0IW9kikoZ0ksbgDzWXEfWS w/MIA71Z+wS9ZAyMfB4GtuSaMK4PxiWG7cKhRyZgepcWwU1yGyOT/U0z6TrbM26+flmU xMqCXWzrddUxTJ9syiwjP7XgRwM8KdnPgqgGV0d7+pYelRXVpNgCk1wUOriq+R1dWb0X dmxA== 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=/aFrAgvdQ+lGmdrjigjWJiAM9AKQm+dxl0pP6RBtKRo=; b=oGr/CgwVOVr8F37TAcVaECPHM0FLAZiK0hjls7xDlu4hpFUrldy3Ap1QlCsaKKLtmw BItlROBMy1HSxOQ9G5ok2OUeQ8GQvAaF4T5QWaPZNy/1q1TA4K0fMytsFlhYaU1kTtPH 87bcegk1y2LcwZZgxBQuU8+Ccoivi+QQPOEAs7DZZFSf0DahWvolpQxJOqUirkQlZ4e+ +h0CTqG49tKWrcD1kULEXBwf87bUt7EfLMkGqTyJjWqvt4NsmcK9aSZCVUgiaP2NDwZd 7MhBRn1gfhguOu/1CTWt/zVMAQfFk4dcQO9a16LaPImZsjZwDQ6RhrVGYUewc56feBrI Jlrw== 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 f12si1638209edv.593.2020.08.27.08.28.39; Thu, 27 Aug 2020 08:29:01 -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 S1727998AbgH0P15 (ORCPT + 99 others); Thu, 27 Aug 2020 11:27:57 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:42236 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727815AbgH0P1v (ORCPT ); Thu, 27 Aug 2020 11:27:51 -0400 Received: from 89-64-89-85.dynamic.chello.pl (89.64.89.85) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.459) id 708879f86388fee3; Thu, 27 Aug 2020 17:27:49 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , LKML , Doug Smythies , Artem Bityutskiy Subject: [PATCH v3 1/5] cpufreq: intel_pstate: Refuse to turn off with HWP enabled Date: Thu, 27 Aug 2020 17:10:42 +0200 Message-ID: <4229182.kmMOFvXRec@kreacher> In-Reply-To: <2240881.fzTuzKk6Gz@kreacher> References: <2240881.fzTuzKk6Gz@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 -> v3: 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