From: Pierre Gondois <pierre.gondois@arm.com>
To: Vincent Guittot <vincent.guittot@linaro.org>,
linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org,
paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, sudeep.holla@arm.com,
gregkh@linuxfoundation.org, rafael@kernel.org, mingo@redhat.com,
peterz@infradead.org, juri.lelli@redhat.com,
dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, bristot@redhat.com,
vschneid@redhat.com, viresh.kumar@linaro.org, lenb@kernel.org,
robert.moore@intel.com, lukasz.luba@arm.com,
ionela.voinescu@arm.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org,
acpica-devel@lists.linuxfoundation.org
Cc: conor.dooley@microchip.com, suagrfillet@gmail.com,
ajones@ventanamicro.com, lftan@kernel.org
Subject: Re: [PATCH v4 6/7] cpufreq/cppc: set the frequency used for computing the capacity
Date: Thu, 2 Nov 2023 10:06:50 +0100 [thread overview]
Message-ID: <89b5db0e-1121-4d0c-a8f4-1202465f5251@arm.com> (raw)
In-Reply-To: <20231027080400.56703-7-vincent.guittot@linaro.org>
Hello Vincent,
On 10/27/23 10:03, Vincent Guittot wrote:
> Save the frequency associated to the performance that has been used when
> initializing the capacity of CPUs.
> Also, cppc cpufreq driver can register an artificial energy model. In such
> case, it needs the frequency for this compute capacity.
>
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
> drivers/base/arch_topology.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
> index 9a073c2d2086..d4bef370feb3 100644
> --- a/drivers/base/arch_topology.c
> +++ b/drivers/base/arch_topology.c
> @@ -349,6 +349,7 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu)
>
> void topology_init_cpu_capacity_cppc(void)
> {
> + u64 capacity, capacity_scale = 0;
> struct cppc_perf_caps perf_caps;
> int cpu;
>
> @@ -365,6 +366,10 @@ void topology_init_cpu_capacity_cppc(void)
> (perf_caps.highest_perf >= perf_caps.nominal_perf) &&
> (perf_caps.highest_perf >= perf_caps.lowest_perf)) {
> raw_capacity[cpu] = perf_caps.highest_perf;
> + capacity_scale = max_t(u64, capacity_scale, raw_capacity[cpu]);
> +
> + per_cpu(capacity_ref_freq, cpu) = cppc_perf_to_khz(&perf_caps, raw_capacity[cpu]);
> +
To continue Beata's point, I think there is an issue with the following:
cppc_perf_to_khz() and cppc_khz_to_perf() were previously used with a struct containing
frequencies in KHz, cf. [1].
In the original _CPC object, frequencies are in MHz. It means that the perf_caps struct
here contains frequencies in MHz, and per_cpu(capacity_ref_freq, cpu) is in MHz aswell.
[1] https://github.com/torvalds/linux/blob/master/drivers/cpufreq/cppc_cpufreq.c#L682
> pr_debug("cpu_capacity: CPU%d cpu_capacity=%u (raw).\n",
> cpu, raw_capacity[cpu]);
> continue;
> @@ -375,7 +380,15 @@ void topology_init_cpu_capacity_cppc(void)
> goto exit;
> }
>
> - topology_normalize_cpu_scale();
> + for_each_possible_cpu(cpu) {
> + capacity = raw_capacity[cpu];
> + capacity = div64_u64(capacity << SCHED_CAPACITY_SHIFT,
> + capacity_scale);
> + topology_set_cpu_scale(cpu, capacity);
> + pr_debug("cpu_capacity: CPU%d cpu_capacity=%lu\n",
> + cpu, topology_get_cpu_scale(cpu));
> + }
> +
> schedule_work(&update_topology_flags_work);
> pr_debug("cpu_capacity: cpu_capacity initialization done\n");
>
next prev parent reply other threads:[~2023-11-02 9:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-27 8:03 [PATCH v4 0/7] consolidate and cleanup CPU capacity Vincent Guittot
2023-10-27 8:03 ` [PATCH v4 1/7] topology: add a new arch_scale_freq_reference Vincent Guittot
2023-10-27 9:31 ` Ingo Molnar
2023-10-27 8:03 ` [PATCH v2 2/7] cpufreq: use the fixed and coherent frequency for scaling capacity Vincent Guittot
2023-10-27 8:03 ` [PATCH v4 3/7] cpufreq/schedutil: use a fixed reference frequency Vincent Guittot
2023-10-27 8:03 ` [PATCH v4 4/7] energy_model: " Vincent Guittot
2023-10-27 8:03 ` [PATCH v4 5/7] cpufreq/cppc: move and rename cppc_cpufreq_{perf_to_khz|khz_to_perf} Vincent Guittot
2023-10-27 9:38 ` Ingo Molnar
2023-10-27 8:03 ` [PATCH v4 6/7] cpufreq/cppc: set the frequency used for computing the capacity Vincent Guittot
2023-11-02 9:06 ` Pierre Gondois [this message]
2023-11-02 10:42 ` Vincent Guittot
2023-10-27 8:04 ` [PATCH v4 7/7] arm64/amu: use capacity_ref_freq to set AMU ratio Vincent Guittot
2023-10-31 23:58 ` Beata Michalska
2023-11-01 9:04 ` Vincent Guittot
2023-11-02 10:30 ` Beata Michalska
2023-11-02 10:40 ` Vincent Guittot
2023-11-02 13:50 ` Vincent Guittot
2023-10-27 9:32 ` [PATCH v4 0/7] consolidate and cleanup CPU capacity Ingo Molnar
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=89b5db0e-1121-4d0c-a8f4-1202465f5251@arm.com \
--to=pierre.gondois@arm.com \
--cc=acpica-devel@lists.linuxfoundation.org \
--cc=ajones@ventanamicro.com \
--cc=aou@eecs.berkeley.edu \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=catalin.marinas@arm.com \
--cc=conor.dooley@microchip.com \
--cc=dietmar.eggemann@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=ionela.voinescu@arm.com \
--cc=juri.lelli@redhat.com \
--cc=lenb@kernel.org \
--cc=lftan@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=lukasz.luba@arm.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=robert.moore@intel.com \
--cc=rostedt@goodmis.org \
--cc=suagrfillet@gmail.com \
--cc=sudeep.holla@arm.com \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=vschneid@redhat.com \
--cc=will@kernel.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
all inboxes | Powered by JetHome®