Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755503AbbEEDqW (ORCPT ); Mon, 4 May 2015 23:46:22 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:44245 "EHLO e9.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755487AbbEEDqJ (ORCPT ); Mon, 4 May 2015 23:46:09 -0400 Message-ID: <55483CFA.9010106@linux.vnet.ibm.com> Date: Tue, 05 May 2015 09:16:02 +0530 From: Preeti U Murthy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Shilpasri G Bhat , linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org CC: viresh.kumar@linaro.org, rjw@rjwysocki.net, linux-pm@vger.kernel.org Subject: Re: [PATCH v3 5/6] cpufreq: powernv: Report Psafe only if PMSR.psafe_mode_active bit is set References: <1430729652-14813-1-git-send-email-shilpa.bhat@linux.vnet.ibm.com> <1430729652-14813-6-git-send-email-shilpa.bhat@linux.vnet.ibm.com> In-Reply-To: <1430729652-14813-6-git-send-email-shilpa.bhat@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15050503-0033-0000-0000-00000264FDFF Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2428 Lines: 65 On 05/04/2015 02:24 PM, Shilpasri G Bhat wrote: > On a reset cycle of OCC, although the system retires from safe > frequency state the local pstate is not restored to Pmin or last > requested pstate. Now if the cpufreq governor initiates a pstate > change, the local pstate will be in Psafe and we will be reporting a > false positive when we are not throttled. > > So in powernv_cpufreq_throttle_check() remove the condition which > checks if local pstate is less than Pmin while checking for Psafe > frequency. If the cpus are forced to Psafe then PMSR.psafe_mode_active > bit will be set. So, when OCCs become active this bit will be cleared. > Let us just rely on this bit for reporting throttling. > > Signed-off-by: Shilpasri G Bhat > --- > drivers/cpufreq/powernv-cpufreq.c | 12 +++--------- > 1 file changed, 3 insertions(+), 9 deletions(-) > > diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c > index 9618813..0a59d5b 100644 > --- a/drivers/cpufreq/powernv-cpufreq.c > +++ b/drivers/cpufreq/powernv-cpufreq.c > @@ -39,7 +39,6 @@ > #define PMSR_PSAFE_ENABLE (1UL << 30) > #define PMSR_SPR_EM_DISABLE (1UL << 31) > #define PMSR_MAX(x) ((x >> 32) & 0xFF) > -#define PMSR_LP(x) ((x >> 48) & 0xFF) > #define OCC_RESET 0 > #define OCC_LOAD 1 > #define OCC_THROTTLE 2 > @@ -316,7 +315,7 @@ static void powernv_cpufreq_throttle_check(void *data) > { > unsigned int cpu = smp_processor_id(); > unsigned long pmsr; > - int pmsr_pmax, pmsr_lp, i; > + int pmsr_pmax, i; > > pmsr = get_pmspr(SPRN_PMSR); > > @@ -338,14 +337,9 @@ static void powernv_cpufreq_throttle_check(void *data) > chips[i].id, pmsr_pmax); > } > > - /* > - * Check for Psafe by reading LocalPstate > - * or check if Psafe_mode_active is set in PMSR. > - */ > + /* Check if Psafe_mode_active is set in PMSR. */ > next: > - pmsr_lp = (s8)PMSR_LP(pmsr); > - if ((pmsr_lp < powernv_pstate_info.min) || > - (pmsr & PMSR_PSAFE_ENABLE)) { > + if (pmsr & PMSR_PSAFE_ENABLE) { > throttled = true; > pr_info("Pstate set to safe frequency\n"); > } > Reviewed-by: Preeti U Murthy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/