From patchwork Wed Oct 7 14:34:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 7345641 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BF08F9F302 for ; Wed, 7 Oct 2015 14:34:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D2F802061B for ; Wed, 7 Oct 2015 14:34:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AFB64205BA for ; Wed, 7 Oct 2015 14:34:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754312AbbJGOe2 (ORCPT ); Wed, 7 Oct 2015 10:34:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44362 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753962AbbJGOe2 (ORCPT ); Wed, 7 Oct 2015 10:34:28 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id A4E2CAB971; Wed, 7 Oct 2015 14:34:27 +0000 (UTC) Received: from praritdesktop.bos.redhat.com (prarit-guest.khw.lab.eng.bos.redhat.com [10.16.186.145]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t97EYQeh030336; Wed, 7 Oct 2015 10:34:26 -0400 From: Prarit Bhargava To: dsmythies@telus.net Cc: kristen@linux.intel.com, linux-kernel@vger.kernel.org, viresh.kumar@linaro.org, linux-pm@vger.kernel.org, rjw@rjwysocki.net, Prarit Bhargava Subject: RE: [PATCH] cpufreq, intel_pstate, set max_sysfs_pct and min_sysfs_pct on governor switch Date: Wed, 7 Oct 2015 10:34:12 -0400 Message-Id: <1444228452-23726-1-git-send-email-prarit@redhat.com> In-Reply-To: <000001d10109$10d34630$3279d290$@net> References: <000001d10109$10d34630$3279d290$@net> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Doug, please apply and test. My result is: \# initial load of driver, set to PERFORMANCE governor by default. [ 21.406525] intel_pstate_set_policy[1001] min_perf_pct = 100 [ 21.421288] intel_pstate_set_policy[1001] min_perf_pct = 100 [ 21.436038] intel_pstate_set_policy[1001] min_perf_pct = 100 [ 21.450505] intel_pstate_set_policy[1001] min_perf_pct = 100 \# echo 100 > /sys/devices/system/cpu/intel_pstate/min_perf_pct [ 21.483436] store_min_perf_pct[453] min_sysfs_pct = 100 [ 21.489373] store_min_perf_pct[456] min_perf_pct = 100 [ 21.495203] store_min_perf_pct[459] min_perf_pct = 100 [ 21.501050] store_min_perf_pct[462] min_perf_pct = 100 \# cpupower -c all frequency-set -g powersave [ 214.187212] intel_pstate_set_policy[1023] min_perf_pct = 100 [ 214.193643] intel_pstate_set_policy[1028] min_perf_pct = 100 [ 214.200205] intel_pstate_set_policy[1020] min_perf_pct = 100 [ 214.206626] intel_pstate_set_policy[1023] min_perf_pct = 100 [ 214.213064] intel_pstate_set_policy[1028] min_perf_pct = 100 [ 214.219601] intel_pstate_set_policy[1020] min_perf_pct = 100 [ 214.226008] intel_pstate_set_policy[1023] min_perf_pct = 100 [ 214.232471] intel_pstate_set_policy[1028] min_perf_pct = 100 [ 214.238990] intel_pstate_set_policy[1020] min_perf_pct = 100 [ 214.245408] intel_pstate_set_policy[1023] min_perf_pct = 100 [ 214.251845] intel_pstate_set_policy[1028] min_perf_pct = 100 \# cat /sys/devices/system/cpu/intel_pstate/*_perf_pct 100 100 Thanks! P. --- drivers/cpufreq/intel_pstate.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 3af9dd7..95f6b9f 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -450,9 +450,17 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, return -EINVAL; limits.min_sysfs_pct = clamp_t(int, input, 0 , 100); + printk("%s[%d] min_sysfs_pct = %d\n", __FUNCTION__, __LINE__, + limits.min_sysfs_pct); limits.min_perf_pct = max(limits.min_policy_pct, limits.min_sysfs_pct); + printk("%s[%d] min_perf_pct = %d\n", __FUNCTION__, __LINE__, + limits.min_perf_pct); limits.min_perf_pct = min(limits.max_policy_pct, limits.min_perf_pct); + printk("%s[%d] min_perf_pct = %d\n", __FUNCTION__, __LINE__, + limits.min_perf_pct); limits.min_perf_pct = min(limits.max_perf_pct, limits.min_perf_pct); + printk("%s[%d] min_perf_pct = %d\n", __FUNCTION__, __LINE__, + limits.min_perf_pct); limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100)); if (hwp_active) @@ -990,6 +998,8 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) policy->max >= policy->cpuinfo.max_freq) { limits.min_policy_pct = 100; limits.min_perf_pct = 100; + printk("%s[%d] min_perf_pct = %d\n", __FUNCTION__, __LINE__, + limits.min_perf_pct); limits.min_perf = int_tofp(1); limits.max_policy_pct = 100; limits.max_perf_pct = 100; @@ -1007,10 +1017,16 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) limits.min_perf_pct = max(limits.min_policy_pct, limits.min_sysfs_pct); limits.min_perf_pct = min(limits.max_policy_pct, limits.min_perf_pct); limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct); + printk("%s[%d] min_perf_pct = %d\n", __FUNCTION__, __LINE__, + limits.min_perf_pct); limits.max_perf_pct = max(limits.min_policy_pct, limits.max_perf_pct); + printk("%s[%d] min_perf_pct = %d\n", __FUNCTION__, __LINE__, + limits.min_perf_pct); /* Make sure min_perf_pct <= max_perf_pct */ limits.min_perf_pct = min(limits.max_perf_pct, limits.min_perf_pct); + printk("%s[%d] min_perf_pct = %d\n", __FUNCTION__, __LINE__, + limits.min_perf_pct); limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100)); limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100));