From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A2ADC4741F for ; Tue, 10 Nov 2020 02:48:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B78462067B for ; Tue, 10 Nov 2020 02:48:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LHVswaHA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730205AbgKJCsJ (ORCPT ); Mon, 9 Nov 2020 21:48:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729336AbgKJCsJ (ORCPT ); Mon, 9 Nov 2020 21:48:09 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18617C0613D3 for ; Mon, 9 Nov 2020 18:48:08 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id g7so10055843pfc.2 for ; Mon, 09 Nov 2020 18:48:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=bp4mJcC9PMhcw5y+WqTlQnnOavYlE/Bb079QNbmAgQM=; b=LHVswaHAenoYlpIexQbcoC0/+grtt9LKi1E2jo2Smg96sXIVFZrhjIPEKE3SV9911N wNdc74AHhTtYGy+150UerhwqQfxU8vcLRJu7bLw9+aDfuAJ6XvR+VyLFCVCyC7TwnDI2 bgHUBS5bKMGP6z+rxAmpSUnS01bwNM94hdA/ZeBRvuQo462rT2enhiS6tgLaJFNCwS2H inqtf9GQ6YaQESyBEqHjBuWo2dW9ThKPxMVAVBJsJNF+kpC5yYtwK/x9zQqCSpzPUO9q p8v7rx03LfWYbw9YI6L+aYlbE9ii0pEk0UO/TdKj3WcupF5y+5Zu4LjlimUVPj0iwKXN TCaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bp4mJcC9PMhcw5y+WqTlQnnOavYlE/Bb079QNbmAgQM=; b=AoPDgsl4C8bq2UrFJuZIhmbdHq0utHey1zfD/1iVqhWby88CoGTTOgyqALMfkpp07f DUuy1tALc4cBVTVO22gTbeC++d0NZkZyQBBlb1SsxSLIQczzuLIqHNef8p5LulPeLeIC ICB6+iHSBGjz6BuKlzf2F3Ud9xWe6+YKvggnFU83KIS1olXGkte8t6q8rJNFzK2WHn45 ZIe9Ot6RSt21EgHGYOTA7K0Yz2tKRvNW1u0RHfS2hI67VnATo0zbwxGUljmsDYRYWQ4i kh6woh66+c270Qx1nZTNAC7WCSSD6p35GuRgzdLV0YejWvxD5vKG3HlbKg52Rmq8ixLk XjKQ== X-Gm-Message-State: AOAM530freL5aYplILR+zHUP4ym2o3nU5opyTricnw9akbZwmojLud/x BKrDrWnWRV2CNchOgOxBInvLjA== X-Google-Smtp-Source: ABdhPJwVIUbHBSxAxf+YyCqW+lxjYugM/kd0pbnjEn43+haD/CSalZJ/qLW0CpPT2viRXgsA/WVzcg== X-Received: by 2002:a17:90b:496:: with SMTP id bh22mr2597127pjb.120.1604976487671; Mon, 09 Nov 2020 18:48:07 -0800 (PST) Received: from localhost ([122.172.12.172]) by smtp.gmail.com with ESMTPSA id k5sm905648pjj.37.2020.11.09.18.48.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:48:06 -0800 (PST) Date: Tue, 10 Nov 2020 08:18:04 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Linux PM , "Rafael J. Wysocki" , Srinivas Pandruvada , Zhang Rui , LKML , Doug Smythies Subject: Re: [PATCH v2 4/4] cpufreq: intel_pstate: Take CPUFREQ_GOV_FLAG_STRICT_TARGET into account Message-ID: <20201110024804.j6wrzq7bne7pmwzv@vireshk-i7> References: <13269660.K2JYd4sGFX@kreacher> <2345253.LYi3vV7ftd@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2345253.LYi3vV7ftd@kreacher> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09-11-20, 17:55, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Make intel_pstate take the new CPUFREQ_GOV_FLAG_STRICT_TARGET > governor flag into account when it operates in the passive mode with > HWP enabled, so as to fix the "powersave" governor behavior in that > case (currently, HWP is allowed to scale the performance all the way > up to the policy max limit when the "powersave" governor is used, > but it should be constrained to the policy min limit then). > > Signed-off-by: Rafael J. Wysocki > --- > drivers/cpufreq/intel_pstate.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > Index: linux-pm/drivers/cpufreq/intel_pstate.c > =================================================================== > --- linux-pm.orig/drivers/cpufreq/intel_pstate.c > +++ linux-pm/drivers/cpufreq/intel_pstate.c > @@ -2527,7 +2527,7 @@ static void intel_cpufreq_trace(struct c > } > > static void intel_cpufreq_adjust_hwp(struct cpudata *cpu, u32 target_pstate, > - bool fast_switch) > + bool strict, bool fast_switch) > { > u64 prev = READ_ONCE(cpu->hwp_req_cached), value = prev; > > @@ -2539,7 +2539,7 @@ static void intel_cpufreq_adjust_hwp(str > * field in it, so opportunistically update the max too if needed. > */ > value &= ~HWP_MAX_PERF(~0L); > - value |= HWP_MAX_PERF(cpu->max_perf_ratio); > + value |= HWP_MAX_PERF(strict ? target_pstate : cpu->max_perf_ratio); > > if (value == prev) > return; > @@ -2562,14 +2562,16 @@ static void intel_cpufreq_adjust_perf_ct > pstate_funcs.get_val(cpu, target_pstate)); > } > > -static int intel_cpufreq_update_pstate(struct cpudata *cpu, int target_pstate, > - bool fast_switch) > +static int intel_cpufreq_update_pstate(struct cpufreq_policy *policy, > + int target_pstate, bool fast_switch) > { > + struct cpudata *cpu = all_cpu_data[policy->cpu]; > int old_pstate = cpu->pstate.current_pstate; > > target_pstate = intel_pstate_prepare_request(cpu, target_pstate); > if (hwp_active) { > - intel_cpufreq_adjust_hwp(cpu, target_pstate, fast_switch); > + intel_cpufreq_adjust_hwp(cpu, target_pstate, > + policy->strict_target, fast_switch); > cpu->pstate.current_pstate = target_pstate; > } else if (target_pstate != old_pstate) { > intel_cpufreq_adjust_perf_ctl(cpu, target_pstate, fast_switch); > @@ -2609,7 +2611,7 @@ static int intel_cpufreq_target(struct c > break; > } > > - target_pstate = intel_cpufreq_update_pstate(cpu, target_pstate, false); > + target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, false); > > freqs.new = target_pstate * cpu->pstate.scaling; > > @@ -2628,7 +2630,7 @@ static unsigned int intel_cpufreq_fast_s > > target_pstate = DIV_ROUND_UP(target_freq, cpu->pstate.scaling); > > - target_pstate = intel_cpufreq_update_pstate(cpu, target_pstate, true); > + target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, true); > > return target_pstate * cpu->pstate.scaling; > } Acked-by: Viresh Kumar -- viresh