Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3285222pxk; Mon, 21 Sep 2020 09:41:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5P5zgOql9vKSYwktxJNtYgui+9O7aNUsxSa6AlmRTT+suaBrouUHK1GoOX3QpdmutgJNV X-Received: by 2002:a17:906:4f0d:: with SMTP id t13mr301005eju.33.1600706480714; Mon, 21 Sep 2020 09:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600706480; cv=none; d=google.com; s=arc-20160816; b=cPkFr9IvE/9wzyvAPcxlK2h706F/nXofbPe3ReiXkiJQrXeQXV0Oe8QodirgEacOUW LLLP57ZR0tgo5ItUZ5yXwHx5fORrd4rZbkRHWR4TQ0EZSnm01Wn2xU7F4pkNwzawnG7Y /JIO8c70VB/g0mj9sFu01jVIcSr/3atwNMIaPbSw/DCD8PKFXowyGicD5Navk4nKN1FO yk6mt1fA3s1bA3c4ArgXaMheKB2I6tFlNDB8RyT4+DYnbWiS8xGlxJ7Yis5+V+xUpK6H naBeQj3OE1pvYOr5g418/CNMYpvhWLd0JEYLIjYMTT642Q2N9VSCroT0kilnQ9res2NK ZMCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=euUL9P/autBa3+UGuTeZR4V1b641itOrGS0HKNBH+Us=; b=0MWJ1zYaXO9IQgHNGMo2wa7GL2iRBzvzz9PmZPv9MhtSnH82eQv9ieFLszMp100qK2 +kxJfi3EpFgAYrNOhyLXx/xqknCxU1BtBURTmmkvzDFf3wirgbMuzIL9ZPI//jilSuXJ xtkAJ77zyIgmorDelfDK9Uj9Bbu5UDiDiHJIXq+OZxNZPtxk/H0wJZEFyDrOG+dtKSaI a7MJ9EyP8uH6HdVxC+0JsusZ687RIVTFgyjxCf+DYOwOOcluhx9H6adDszmQ63E2o70z /Zu+QBSKzQ9MiiOoe7MGLXtkz/u1dyQIiT7ifcQRcp13xAlT7F/K874IzYkZ9qulhaS6 Nsjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AV4YstBi; 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 u18si9502197edf.140.2020.09.21.09.40.57; Mon, 21 Sep 2020 09:41:20 -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=AV4YstBi; 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 S1729203AbgIUQjF (ORCPT + 99 others); Mon, 21 Sep 2020 12:39:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:40526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729215AbgIUQi7 (ORCPT ); Mon, 21 Sep 2020 12:38:59 -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 ADD49239D0; Mon, 21 Sep 2020 16:38:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706339; bh=s0Mo5u+brxlYU38Nh/VQSLjrk4n3pEAdmA+E2c66PFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AV4YstBitza6ozJhQ2etu3oMYygNsdRrJqjFsn90ASYwUgVuws7LacZDxwz7CikJ/ gxtQHut08JDlR5h5s10LiOPw7ZC/bPv8AUJmNPaNwJIct8ChH+ZqkmuyZRsCATBnIn Zixou0fw3hqKX7ScVGdONSIZ18S7JLVodiq6IE9w= 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.14 20/94] cpufreq: intel_pstate: Refuse to turn off with HWP enabled Date: Mon, 21 Sep 2020 18:27:07 +0200 Message-Id: <20200921162036.476048041@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162035.541285330@linuxfoundation.org> References: <20200921162035.541285330@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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