Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3681284pxb; Mon, 9 Nov 2020 18:52:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJywuUR2P8Eb3etnk7XXIcg8ddSR9rLhxcS57fPCQpEiG8GUvMkA/U8OdFm+QiG/AIARDsh2 X-Received: by 2002:a50:8ada:: with SMTP id k26mr18553903edk.281.1604976725539; Mon, 09 Nov 2020 18:52:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604976725; cv=none; d=google.com; s=arc-20160816; b=x6Oe04A5EzRsGkUCGu5ldxwCDnHXXZ3Ur7cgnqtansDCsfyWOpNO32vKe1M2RSJDw+ +wsuI40JAECC0YCqN5NyoLll+rlxbFee9pxzrVKG3chCAmvz6Tx2TvPQN1kUzi+plSuR jak2sIeCs7BLPKR2lBcZD5MCHzUuql06AnHn1m99MMgi18Ru+H0KZKs0w1Wo+0CLt11Y O38w1xxHznvFUhLG6a1CAJmaeGT2eamaZ2Jkxyi4JOfUvxbz3K7mryvVRTIlkNT+Q7Dz y8ssB9G3/0tbfFlx3X04QkudfwP81opS8N3TWBzw3soB76eqTa77BFhOSBNY2kLAwNCm 0bVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=bp4mJcC9PMhcw5y+WqTlQnnOavYlE/Bb079QNbmAgQM=; b=ePauJUzqwBTm3ytE1jredSf+j/WVZgkA2vV9+xSQ7tIkR0yuZvoadcDPmuQ2tLxqtS /fm4zT8KtA8MUfJ9UMwfrX+lBglu5HgYrIW+PRmQlNJcYKKn7p6iyw0KY37L87JqfBHh a8e/IpPAmC0IvdvWsvOO37vUUkdhbfAVsLJZJZ3ZAUBkm06nolF9gc/HduKmyhXmbjyY uNzbubsSaJkgK1PHDJY7fis/lqrkKgE1HJDgh/F1U031ENeSOYi14YsOoDEayJn4mqsP A19pqC2zd+dhbY8uNEFxq4E94zTAv2VwtX+AAKtJz+lluM1zUBw01U0VNiI8fmDXHweO CpLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LHVswaHA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b20si8398289edv.300.2020.11.09.18.51.41; Mon, 09 Nov 2020 18:52:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LHVswaHA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730035AbgKJCsJ (ORCPT + 99 others); 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-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