Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1383816pxa; Thu, 20 Aug 2020 09:52:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2+kjph5f2QSbphj+SgU0nQc15pI9ezms/m0jsFvj/+W8A9jGg0wOROYZduktzR6JABHLx X-Received: by 2002:a17:906:89a:: with SMTP id n26mr3955058eje.363.1597942341248; Thu, 20 Aug 2020 09:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597942341; cv=none; d=google.com; s=arc-20160816; b=TF/t+r/eOGGUF2PmjavyLy6UQB/xYPqZ3+rUuv+cvauzkYS1mIFp13BMSzq7MCaMUD qZSpWo3nuPxEvwtPi19eWQ/r0JjuUJD4Yrk2XRTYI23ORm3dQbRtvRV6c0pnnPqNVDts xDPDoCLvZPhF6ML5NUaiqMIDEeddl7WDIBt3o2/1ajKNxY+SGHO5DlBFBACybjfz+VDs UyraiaAkIJIJSsCcr4H7L/JTuDzJz7jLqxLkodcj8jBGFKsInUmG3LKMt4L31KQqEVDk 32Y0Ha+X6fsM1c9wywd5GgDrFab9KTNYXhaxw1fYKAOWdorqAUJz+2C4Bwcku+2bnWC2 cyDg== 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=8xiGPJB6KwB7S8A1S++wNJgPceixe6f/ulvYI8p0QvI=; b=Sd5CvwwmKN+noYMfnPvZDVA32h4lGDx8z6a+rgFnlg3y3iqF9i0AW1p0tM57ZA8kbb dO6+g6R4klX6SEG80lettUsnQ++dH08O64Op9rrMs3LKY2SS/p69jaoblUq0WTEWFM58 Ifh3fzB0Pl3ZbNCZ0qEAfPTfK1LvldOeNIn4uSv0d3UOiZbE2KOaqdMAWKLqI2Q890DO oesGkmhOBXARw4q9h5YUxEar9enCA3aBOi9EDDryQdKL7PehPoXGZlRA76L5nCkU301X 59LIN37cKt+dJyDrTCJe/aqrRIt15+03vsmhBbzUJsHo3QNgh13Uxwl7c2rpjnXCzxWA U3eA== 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 be10si1829638edb.574.2020.08.20.09.51.56; Thu, 20 Aug 2020 09:52:21 -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 S1730044AbgHTQja (ORCPT + 99 others); Thu, 20 Aug 2020 12:39:30 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:63698 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729979AbgHTQjL (ORCPT ); Thu, 20 Aug 2020 12:39:11 -0400 Received: from 89-64-87-57.dynamic.chello.pl (89.64.87.57) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.459) id 1b514db4d289dfba; Thu, 20 Aug 2020 18:39:09 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , LKML , Doug Smythies Subject: [PATCH 1/4] cpufreq: intel_pstate: Refuse to turn off with HWP enabled Date: Thu, 20 Aug 2020 18:36:22 +0200 Message-ID: <4103589.WxEslRmDz8@kreacher> In-Reply-To: <2283366.Lr8yYYnyev@kreacher> References: <2283366.Lr8yYYnyev@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 --- 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