[RFC v3 6/6] arm64/amu: use capacity_ref_freq to set AMU ratio

Dietmar Eggemann dietmar.eggemann at arm.com
Thu Oct 26 04:19:49 PDT 2023


On 24/10/2023 11:58, Vincent Guittot wrote:
> On Mon, 23 Oct 2023 at 22:58, Ionela Voinescu <ionela.voinescu at arm.com> wrote:
>>
>> Hi,
>>
>> On Wednesday 18 Oct 2023 at 18:25:40 (+0200), Vincent Guittot wrote:
>>> Use the new capacity_ref_freq to set the ratio that is used by AMU for
>>> computing the arch_scale_freq_capacity().
>>> This helps to keep everything aligned using the same reference for
>>> computing CPUs capacity.
>>>
>>> The default value of the ratio ensures that arch_scale_freq_capacity()
>>> returns max capacity until it is set to its correct value with the
>>> cpu capacity and capacity_ref_freq.

Nitpick: Could you mention that arch_max_freq_scale is the default value
for this ratio? Took me a while to recreate the (not so simple) story
for this change, i.e. make the connection between ratio and
arch_max_freq_scale.

init_cpu_capacity_callback()

  freq_inv_set_max_ratio()

    u64 ratio
    ...
    per_cpu(arch_max_freq_scale, cpu) = (unsigned long)ratio
            ^^^^^^^^^^^^^^^^^^^


static struct scale_freq_data amu_sfd = {
        .set_freq_scale = amu_scale_freq_tick,
}

#define arch_scale_freq_tick topology_scale_freq_tick

topology_scale_freq_tick()

  sfd->set_freq_scale()


amu_scale_freq_tick()

  ...
  scale *= this_cpu_read(arch_max_freq_scale)
                         ^^^^^^^^^^^^^^^^^^^
  ...
  this_cpu_write(arch_freq_scale, (unsigned long)scale);


#define arch_scale_freq_capacity topology_get_freq_scale

topology_get_freq_scale(cpu)

  return per_cpu(arch_freq_scale, cpu)

[...]




More information about the linux-riscv mailing list