Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1914973pxk; Tue, 1 Sep 2020 10:43:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJ2HOt5rqh5TmHfGH9Kn/scFJluBS4AbiHpp8dnGuHPPxLpEZpLawPu6tbMowRVpMcPnKv X-Received: by 2002:a17:906:7fca:: with SMTP id r10mr2543670ejs.534.1598982193846; Tue, 01 Sep 2020 10:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598982193; cv=none; d=google.com; s=arc-20160816; b=SaYfa8UvfS+Nz8vftTHP4slcd1ulXZXTlWfj507s9JYA1Hjfgxn/GTSEvb5TsEQkYK clMfYR7wVi6O2O5oWoZxqMDOoiJjhcfd482mbjUlbH42IVlH2ggGD2pjU1UxmR3wLuaA fekgWI7SAOnxp9tfjI9b4skqRIr430juBWl4IYn87dB0bF/RQh9WN0lPiMOCyJF9DU4u ny42Ow5Rj+mihS2/NT9j29lUDDjbAT0IU7PH78oPsG5Wjp+qK/90ZxM1pGlUze5dKRcI guspj6+/iGNOAmpRV06D15Pwf4AEQQLLLrv6KiqMnkQIjC7sk4XI2Lr0QK9/j4aFypCk MalQ== 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=QZSfMu5AsRfiPMAMibGu1mogGxJaSwqVSzytpe5tMfE=; b=uX89Hy3fAU1JRAC/M2NufbiqjTV0NZ8tUq+tbjT5FS2MRzn3mcYHDBR9tbMtBv61KT +0m11GAzsMJd/p92fVLDP+++Q9uhHvpcwPTXggegnkkfVuMgaTSBGPN/B/KEqa0wrJ1n N4cOa5UvCAcM4oTI/Sp0TdCYoAE5UdjIrNLHYnJjZLzuvtVP72brlNdORUwLKHNxXVNm XlFwAXvyD4g5WtzFUdXuFwTEGYIbL9eDF9/C7wwl/gIv49G8oERfByJMwz1nLgiEjq8W mB9XIZAOCDKzMTuX00aKC9Kfsvq4Fs7MTJy/DBOLXKa+Mkw41CSf4KOJq6bze9jnKTXb Z8wA== 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 k22si954438edx.491.2020.09.01.10.42.50; Tue, 01 Sep 2020 10:43:13 -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 S1729296AbgIARj4 (ORCPT + 99 others); Tue, 1 Sep 2020 13:39:56 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:59386 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728192AbgIARjy (ORCPT ); Tue, 1 Sep 2020 13:39:54 -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 4763ca42f0cd1aa2; Tue, 1 Sep 2020 19:39:52 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , LKML , Doug Smythies , Artem Bityutskiy Subject: [PATCH v4 3/5] cpufreq: intel_pstate: Tweak the EPP sysfs interface Date: Tue, 01 Sep 2020 19:29:55 +0200 Message-ID: <5280698.oOqPgdve7T@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" Modify the EPP sysfs interface to reject attempts to change the EPP to values different from 0 ("performance") in the active mode with the "performance" policy (ie. scaling_governor set to "performance"), to avoid situations in which the kernel appears to discard data passed to it via the EPP sysfs attribute. Signed-off-by: Rafael J. Wysocki Reviewed-by: Artem Bityutskiy --- v2 -> v3: New patch v3 -> v4: Add the R-by from Artem --- Documentation/admin-guide/pm/intel_pstate.rst | 4 +++- drivers/cpufreq/intel_pstate.c | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/pm/intel_pstate.rst b/Documentation/admin-guide/pm/intel_pstate.rst index cdd1a9a7f9a2..5072e7064d13 100644 --- a/Documentation/admin-guide/pm/intel_pstate.rst +++ b/Documentation/admin-guide/pm/intel_pstate.rst @@ -123,7 +123,9 @@ Energy-Performance Bias (EPB) knob (otherwise), which means that the processor's internal P-state selection logic is expected to focus entirely on performance. This will override the EPP/EPB setting coming from the ``sysfs`` interface -(see `Energy vs Performance Hints`_ below). +(see `Energy vs Performance Hints`_ below). Moreover, any attempts to change +the EPP/EPB to a value different from 0 ("performance") via ``sysfs`` in this +configuration will be rejected. Also, in this configuration the range of P-states available to the processor's internal P-state selection logic is always restricted to the upper boundary diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index e540448e0bd0..b308c39b6204 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -684,6 +684,14 @@ static int intel_pstate_set_energy_pref_index(struct cpudata *cpu_data, else if (epp == -EINVAL) epp = epp_values[pref_index - 1]; + /* + * To avoid confusion, refuse to set EPP to any values different + * from 0 (performance) if the current policy is "performance", + * because those values would be overridden. + */ + if (epp > 0 && cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) + return -EBUSY; + ret = intel_pstate_set_epp(cpu_data, epp); } else { if (epp == -EINVAL) -- 2.26.2