From patchwork Mon Oct 21 16:20:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dirk.brandewie@gmail.com X-Patchwork-Id: 3078811 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 80EE4BF924 for ; Mon, 21 Oct 2013 16:20:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 73A592024F for ; Mon, 21 Oct 2013 16:20:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39B8B20233 for ; Mon, 21 Oct 2013 16:20:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751266Ab3JUQUr (ORCPT ); Mon, 21 Oct 2013 12:20:47 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:38476 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751085Ab3JUQUq (ORCPT ); Mon, 21 Oct 2013 12:20:46 -0400 Received: by mail-pa0-f52.google.com with SMTP id kl14so8235740pab.25 for ; Mon, 21 Oct 2013 09:20:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xAjlN07JQQ8Azojze8spGOWCGaIXdteOKECwOR8pIWw=; b=QRIUhWdA4rS9gt3lF6134AXStlKBX7ovhOIg8iN8EuUnrXSEocYO/X2ZvtG0MbRVvh IPHXEILbljeq3z6mQ5BV5QB8KyF64+cywwQRmarU5ubolGtLndvWJMZAxd0s/j0OfzbP GfXJ87vFdSuyhoi/Fk6CVu+3peZs04Z7mqNuS297Pm1ocfej2ps/4E8bt6JNAHC8KoCi 48HJ11NTCs3PwQ+2nIWDi3DPAj+4zlE493aWH34R7nlSLoMLvfLLOcdwRYNPxF10x+hV hQwVlak8EsyTL6KbQLXct+/NPAwGlTCV6Q761kuz9esYDIxJ52n4Y9+gSOPHBYrZGauW /j7A== X-Received: by 10.68.234.165 with SMTP id uf5mr18416603pbc.41.1382372446253; Mon, 21 Oct 2013 09:20:46 -0700 (PDT) Received: from echolake.localdomain (static-50-43-59-152.bvtn.or.frontiernet.net. [50.43.59.152]) by mx.google.com with ESMTPSA id fy4sm21918178pbb.1.2013.10.21.09.20.44 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Mon, 21 Oct 2013 09:20:45 -0700 (PDT) From: dirk.brandewie@gmail.com To: linux-pm@vger.kernel.org, rjw@rjwysocki.net Cc: Dirk Brandewie Subject: [PATCH 2/4] cpufreq/intel_pstate: Correct calculation of min pstate value Date: Mon, 21 Oct 2013 09:20:33 -0700 Message-Id: <1382372435-29778-3-git-send-email-dirk.j.brandewie@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1382372435-29778-1-git-send-email-dirk.j.brandewie@intel.com> References: <1382372435-29778-1-git-send-email-dirk.j.brandewie@intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dirk Brandewie The minimum pstate is supposed to be a percentage of the maximum P state available. Calculate min using max pstate and not the current max which may have been limited by the user Signed-off-by: Dirk Brandewie --- drivers/cpufreq/intel_pstate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 9f42b0a..67a87e0 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -366,12 +366,13 @@ static int intel_pstate_turbo_pstate(void) static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max) { int max_perf = cpu->pstate.turbo_pstate; + int max_perf_adj; int min_perf; if (limits.no_turbo) max_perf = cpu->pstate.max_pstate; - max_perf = fp_toint(mul_fp(int_tofp(max_perf), limits.max_perf)); - *max = clamp_t(int, max_perf, + max_perf_adj = fp_toint(mul_fp(int_tofp(max_perf), limits.max_perf)); + *max = clamp_t(int, max_perf_adj, cpu->pstate.min_pstate, cpu->pstate.turbo_pstate); min_perf = fp_toint(mul_fp(int_tofp(max_perf), limits.min_perf));