Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp47427pxk; Tue, 15 Sep 2020 17:23:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytXf4ar1C27ZM3hdb4Mg3LCAneFtjB44WgGGvfcr4AyvboyJ+oKafqp927QJcohRGdiPgU X-Received: by 2002:a17:906:a101:: with SMTP id t1mr22255556ejy.203.1600215789074; Tue, 15 Sep 2020 17:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600215789; cv=none; d=google.com; s=arc-20160816; b=cWPJMT3DYXuUHYOBGHEXfVMMH0QIi1970xGaOyJof8XvKPtwy7HZnSyFhqCNdT4q+c Z76noR12VxBaKE4HwT8+sGC1qwJOOXhxB4XrF91AEVe+UpuqseZJ1Yc5lvz796+zCJks tP1ZiHHllGTSGYlJuXwr3wp1/BA+dKl/BW5QVt/fqbhHibaKYBZC0od1ZbDyt/hVSxap R174Mm4km+/0WpsHGzWD3vHwXrjcdRV0wTESQY2PJVF00TFBpSjSiifDxzTlcR5oYpOj 9oOjrUzrtgkHFlo+mNf0y3Rj2P5fG/xJF0SnI/O4KXQiAHeON4/Sq0CO3HBCePWxflwg Co/A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L5yE78S3GgigHvw4GV3dPwBtw90m928sk0aLSQQRB+Y=; b=eFR25aFetoDeuzl6SsDOK9Q/4p3/jfiLNZIFTUmbI9g1IE495k4zQSezDAaFVVqI0j 6eIdvaVZ7+mRDl7tHBc1dl4qmOEk+a06PBNbIY1vhXLa52Xq6Lj9IHdMO/+ye0xpMN+U c/k/VH6mPdvCSnnP92ZBrGhtxgEI7fANSCV6VeTBP3wJywRJUWiOtGO4Q4eQt+QmPZQW e0uSSDZqIRAeIBJv2UuvZnUUVpKnJuhsZ4gyIryo0PM80qYLUAhXcQVjdQUQ3bdoLnix UTI1pX+ERGR38zF28DJVkM9umdKoSWS4d1GbFJ6uCaNPTFS2mB2X8gaMMlX6yjQyhN+n gLSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hkxvgI7u; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h27si11392763edj.263.2020.09.15.17.22.47; Tue, 15 Sep 2020 17:23:09 -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; dkim=pass header.i=@kernel.org header.s=default header.b=hkxvgI7u; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727204AbgIPAUM (ORCPT + 99 others); Tue, 15 Sep 2020 20:20:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:37474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726699AbgIOOV6 (ORCPT ); Tue, 15 Sep 2020 10:21:58 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2F05722269; Tue, 15 Sep 2020 14:17:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600179448; bh=yIAvXqRVCq8N4lZORLQkIWGnBNfFq5xU/oishvzzp8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hkxvgI7u6h807GW2HQc4BdWu2+lAO/u48T6B2nZO1JrrrOddoY7iDqB5IGaD2UGBY h+LUYgAbvZBPj8Lo/9ZbqrDOSkUQr/aEUNENkPhINCMilfA2T+vMxJ+ykqgf6lRDpk S7EzBoeD84HPJhNxYjKLDRkurR1qwFZnUvvdp9FY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Srinivas Pandruvada , Sasha Levin Subject: [PATCH 4.19 34/78] cpufreq: intel_pstate: Refuse to turn off with HWP enabled Date: Tue, 15 Sep 2020 16:12:59 +0200 Message-Id: <20200915140635.281487012@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200915140633.552502750@linuxfoundation.org> References: <20200915140633.552502750@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki [ 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 Acked-by: Srinivas Pandruvada Signed-off-by: Sasha Levin --- 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 99166000ffb77..8fa22aa2ac65b 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -2325,9 +2325,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