From patchwork Tue Mar 14 15:17:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 9623739 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F7DF60244 for ; Tue, 14 Mar 2017 15:25:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61EF6285A3 for ; Tue, 14 Mar 2017 15:25:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5668D285B0; Tue, 14 Mar 2017 15:25:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 099FD285A3 for ; Tue, 14 Mar 2017 15:25:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751644AbdCNPZu (ORCPT ); Tue, 14 Mar 2017 11:25:50 -0400 Received: from cloudserver094114.home.net.pl ([79.96.170.134]:42335 "EHLO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750969AbdCNPZE (ORCPT ); Tue, 14 Mar 2017 11:25:04 -0400 Received: from adks173.ipv4.supernova.orange.pl (79.184.252.173) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.81.2) id 5fc62c38bc8f7f98; Tue, 14 Mar 2017 16:25:06 +0100 From: "Rafael J. Wysocki" To: Srinivas Pandruvada Cc: Linux PM , LKML Subject: [PATCH 1/3] cpufreq: intel_pstate: Do not squash policy limits between global ones Date: Tue, 14 Mar 2017 16:17:10 +0100 Message-ID: <1522654.u1Mi2m9xyD@aspire.rjw.lan> User-Agent: KMail/4.14.10 (Linux/4.10.0+; KDE/4.14.9; x86_64; ; ) In-Reply-To: <2130954.RIJyMN1BRu@aspire.rjw.lan> References: <2130954.RIJyMN1BRu@aspire.rjw.lan> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki intel_pstate_verify_policy() forces per-policy cpufreq limits to stay within the global limits set via min/max_perf_pct. The reason for doing that was the reinitialization of performance limits in intel_pstate_set_policy() that prevented the max limit from being set to anything below 100, among other things, eliminated by commit a240c4aa5d0f (cpufreq: intel_pstate: Do not reinit performance limits in ->setpolicy). However, an undesirable side effect of commit a240c4aa5d0f is that now, after setting scaling_governor to "performance" in the active mode, the per-policy limits for the CPU in question go to the highest level and stay there even when it is switched back to "powersave" later. As it turns out, some distributions set scaling_governor to "performance" temporarily for all CPUs to speed-up system initialization, so that change causes them to misbehave later. To fix this issue, modify intel_pstate_verify_policy() so that it doesn't squash per-policy limits within the global ones any more. Fixes: a240c4aa5d0f (cpufreq: intel_pstate: Do not reinit performance limits in ->setpolicy) Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/intel_pstate.c | 11 ----------- 1 file changed, 11 deletions(-) Index: linux-pm/drivers/cpufreq/intel_pstate.c =================================================================== --- linux-pm.orig/drivers/cpufreq/intel_pstate.c +++ linux-pm/drivers/cpufreq/intel_pstate.c @@ -2196,17 +2196,6 @@ static int intel_pstate_verify_policy(st policy->policy != CPUFREQ_POLICY_PERFORMANCE) return -EINVAL; - /* When per-CPU limits are used, sysfs limits are not used */ - if (!per_cpu_limits) { - unsigned int max_freq, min_freq; - - max_freq = policy->cpuinfo.max_freq * - perf_limits->max_sysfs_pct / 100; - min_freq = policy->cpuinfo.max_freq * - perf_limits->min_sysfs_pct / 100; - cpufreq_verify_within_limits(policy, min_freq, max_freq); - } - return 0; }