linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Giovanni Gherdovich <ggherdovich@suse.cz>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	Michael Larabel <Michael@phoronix.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>
Subject: Re: [PATCH v1 2/2] cpufreq: ACPI: Update arch scale-invariance max perf ratio if CPPC is not there
Date: Fri, 05 Feb 2021 08:07:37 +0100	[thread overview]
Message-ID: <1612508857.19825.7.camel@suse.cz> (raw)
In-Reply-To: <9510730.kuOQ4KzHjt@kreacher>

On Thu, 2021-02-04 at 18:34 +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> If the maximum performance level taken for computing the
> arch_max_freq_ratio value used in the x86 scale-invariance code is
> higher than the one corresponding to the cpuinfo.max_freq value
> coming from the acpi_cpufreq driver, the scale-invariant utilization
> falls below 100% even if the CPU runs at cpuinfo.max_freq or slightly
> faster, which causes the schedutil governor to select a frequency
> below cpuinfo.max_freq.  That frequency corresponds to a frequency
> table entry below the maximum performance level necessary to get to
> the "boost" range of CPU frequencies which prevents "boost"
> frequencies from being used in some workloads.
> 
> While this issue is related to scale-invariance, it may be amplified
> by commit db865272d9c4 ("cpufreq: Avoid configuring old governors as
> default with intel_pstate") from the 5.10 development cycle which
> made it extremely easy to default to schedutil even if the preferred
> driver is acpi_cpufreq as long as intel_pstate is built too, because
> the mere presence of the latter effectively removes the ondemand
> governor from the defaults.  Distro kernels are likely to include
> both intel_pstate and acpi_cpufreq on x86, so their users who cannot
> use intel_pstate or choose to use acpi_cpufreq may easily be
> affectecd by this issue.
> 
> If CPPC is available, it can be used to address this issue by
> extending the frequency tables created by acpi_cpufreq to cover the
> entire available frequency range (including "boost" frequencies) for
> each CPU, but if CPPC is not there, acpi_cpufreq has no idea what
> the maximum "boost" frequency is and the frequency tables created by
> it cannot be extended in a meaningful way, so in that case make it
> ask the arch scale-invariance code to to use the "nominal" performance
> level for CPU utilization scaling in order to avoid the issue at hand.
> 
> Fixes: db865272d9c4 ("cpufreq: Avoid configuring old governors as default with intel_pstate")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  arch/x86/kernel/smpboot.c      |    1 +
>  drivers/cpufreq/acpi-cpufreq.c |    8 ++++++++
>  2 files changed, 9 insertions(+)
> 
> Index: linux-pm/drivers/cpufreq/acpi-cpufreq.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/acpi-cpufreq.c
> +++ linux-pm/drivers/cpufreq/acpi-cpufreq.c
> @@ -806,6 +806,14 @@ static int acpi_cpufreq_cpu_init(struct
>  		state_count++;
>  		valid_states++;
>  		data->first_perf_state = valid_states;
> +	} else {
> +		/*
> +		 * If the maximum "boost" frequency is unknown, ask the arch
> +		 * scale-invariance code to use the "nominal" performance for
> +		 * CPU utilization scaling so as to prevent the schedutil
> +		 * governor from selecting inadequate CPU frequencies.
> +		 */
> +		arch_set_max_freq_ratio(true);
>  	}
>  
>  	freq_table = kcalloc(state_count, sizeof(*freq_table), GFP_KERNEL);
> Index: linux-pm/arch/x86/kernel/smpboot.c
> ===================================================================
> --- linux-pm.orig/arch/x86/kernel/smpboot.c
> +++ linux-pm/arch/x86/kernel/smpboot.c
> @@ -1833,6 +1833,7 @@ void arch_set_max_freq_ratio(bool turbo_
>  	arch_max_freq_ratio = turbo_disabled ? SCHED_CAPACITY_SCALE :
>  					arch_turbo_freq_ratio;
>  }
> +EXPORT_SYMBOL_GPL(arch_set_max_freq_ratio);
>  
>  static bool turbo_disabled(void)
>  {

Reviewed-by: Giovanni Gherdovich <ggherdovich@suse.cz>

Thanks,
Giovanni

  reply	other threads:[~2021-02-05  7:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 17:23 [PATCH v1 0/2] cpufreq: ACPI: Address performance regression related to scale-invariance Rafael J. Wysocki
2021-02-04 17:25 ` [PATCH v1 1/2] cpufreq: ACPI: Extend frequency tables to cover boost frequencies Rafael J. Wysocki
2021-02-05  7:06   ` Giovanni Gherdovich
2021-02-04 17:34 ` [PATCH v1 2/2] cpufreq: ACPI: Update arch scale-invariance max perf ratio if CPPC is not there Rafael J. Wysocki
2021-02-05  7:07   ` Giovanni Gherdovich [this message]
2021-02-05 11:56   ` Peter Zijlstra
2021-02-05 12:23     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1612508857.19825.7.camel@suse.cz \
    --to=ggherdovich@suse.cz \
    --cc=Michael@phoronix.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mgorman@techsingularity.net \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).