Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp520962pxa; Thu, 27 Aug 2020 08:30:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaQ4Qx8Q/RaycZTQjZLsCvasoYKZ0HAPLOU6BnZv/p1ETS+5ZlL8L/qLNHdsbOLsoiGtRf X-Received: by 2002:a17:906:9591:: with SMTP id r17mr3192807ejx.424.1598542253826; Thu, 27 Aug 2020 08:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598542253; cv=none; d=google.com; s=arc-20160816; b=EKSMHHNLUk3Fuay45yRA9W8chLRzlPvCM7zTGj+hlCGKJON8ZFBvt1iRvNNYdLE1om hdX5v3k3Nm1AjXKPwYnQdwODTz5R8QLm26gegaY/jNOfFPDBb18xaFhuIMMFBcqdHlv+ Mx9xFZOIKq/dGD1T5xK0teUlBWZIu4nrBpj++yzX37jvu+Ov3DJu0QtO7KBVzS6bD8TS Ll2H+CH5PspuY+SnIM9MYxkwYKq4Rwo0wPTMShIyL3I+vik32HH5w4waNHY4RgZPY+Eb 52acXrAwkP9xcyllSa07aUOsOKVmSYzg71je1aZvvMNTi4AISDTzT91x1ndoI0k29cXZ qMOQ== 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=QfkpkMF3rKSuwOUz5C1hVWyaznlqTkp/vNZ6w7/xnm0=; b=a2cRYmaiTRdheo7ZX24IJhCr6nsHJIjsEQDcTgOK7dsk0A55qs55uCusrfYg82a5BB wvmy9lVfVUFXvqQdBc9JFHkhwEqRKIfX2X+rOGlIPqfYM5N9SyiStsdMu9BWPNNJjZXl Oi+HKeITEkQFZOh/vNaB3/9LmKB3tsKpfbaPo8N+QfU8Yx4dBBGL0NrTi4B05IjiNgiy 6Wpa4kSqc9+gBm7c2DRi9E8IIvoadKPoC/Qr0o2gH+B7MRCEA6tOfpVfJbk7m67/da6n UNDQ2hYCc+u3vwbD3CWsht10ovMJheUwSmkrbjWRz5EexJzC4syCcBa5KX/fUiqKEIM9 4pog== 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 s9si1522616ejm.746.2020.08.27.08.30.31; Thu, 27 Aug 2020 08:30:53 -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 S1727892AbgH0P1v (ORCPT + 99 others); Thu, 27 Aug 2020 11:27:51 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:57612 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727802AbgH0P1t (ORCPT ); Thu, 27 Aug 2020 11:27:49 -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 3fa1acc4d499e8ca; Thu, 27 Aug 2020 17:27:47 +0200 From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , LKML , Doug Smythies , Artem Bityutskiy Subject: [PATCH v3 3/5] cpufreq: intel_pstate: Tweak the EPP sysfs interface Date: Thu, 27 Aug 2020 17:14:09 +0200 Message-ID: <9094016.kKgRgCK7kp@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" 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 --- v2 -> v3: New patch --- 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