mbox series

[0/3] arch_topology, ACPI: populate cpu capacity from CPPC

Message ID 20210514095339.12979-1-ionela.voinescu@arm.com (mailing list archive)
Headers show
Series arch_topology, ACPI: populate cpu capacity from CPPC | expand

Message

Ionela Voinescu May 14, 2021, 9:53 a.m. UTC
Hi all,

These are a few trivial patches to populate cpu capacity information
using performance information from ACPI's CPPC.

I've tied this functionality to the existing function
init_freq_invariance_cppc() called in acpi_cppc_processor_probe().
This function is renamed to a more generic arch_init_invariance_cppc().

The patches have been build tested on x86 and more thoroughly tested on
Juno R2 (arm64), which uses the new functionality, with the following
results:


root@ubuntu:~# dmesg | grep cpu_capacity
[    2.157494] init_cpu_capacity_cppc: CPU0 cpu_capacity=38300 (raw).
[    2.163699] init_cpu_capacity_cppc: CPU1 cpu_capacity=38300 (raw).
[    2.169899] init_cpu_capacity_cppc: CPU2 cpu_capacity=38300 (raw).
[    2.176098] init_cpu_capacity_cppc: CPU3 cpu_capacity=38300 (raw).
[    2.182296] init_cpu_capacity_cppc: CPU4 cpu_capacity=102400 (raw).
[    2.188581] init_cpu_capacity_cppc: CPU5 cpu_capacity=102400 (raw).
[    2.194867] cpu_capacity: capacity_scale=102400
[    2.199409] cpu_capacity: CPU0 cpu_capacity=383
[    2.203952] cpu_capacity: CPU1 cpu_capacity=383
[    2.208495] cpu_capacity: CPU2 cpu_capacity=383
[    2.213037] cpu_capacity: CPU3 cpu_capacity=383
[    2.217580] cpu_capacity: CPU4 cpu_capacity=1024
[    2.222209] cpu_capacity: CPU5 cpu_capacity=1024
[    2.226886] init_cpu_capacity_cppc: cpu_capacity initialization done

root@ubuntu:~# tail -n +1 /sys/devices/system/cpu/cpu*/cpu_capacity
==> /sys/devices/system/cpu/cpu0/cpu_capacity <==
383
==> /sys/devices/system/cpu/cpu1/cpu_capacity <==
383
==> /sys/devices/system/cpu/cpu2/cpu_capacity <==
383
==> /sys/devices/system/cpu/cpu3/cpu_capacity <==
383
==> /sys/devices/system/cpu/cpu4/cpu_capacity <==
1024
==> /sys/devices/system/cpu/cpu5/cpu_capacity <==
1024

All works as expected even if ACPI processor support is built as a
module.

Patches are based on v5.13-rc1.

Let me know what you think!

Thanks,
Ionela.

Ionela Voinescu (3):
  x86, ACPI: rename init_freq_invariance_cppc to
    arch_init_invariance_cppc
  arch_topology: obtain cpu capacity using information from CPPC
  arm64, topology: enable use of init_cpu_capacity_cppc()

 arch/arm64/include/asm/topology.h |  4 ++++
 arch/x86/include/asm/topology.h   |  2 +-
 drivers/acpi/cppc_acpi.c          |  6 ++---
 drivers/base/arch_topology.c      | 39 +++++++++++++++++++++++++++++++
 include/linux/arch_topology.h     |  4 ++++
 5 files changed, 51 insertions(+), 4 deletions(-)

Comments

Valentin Schneider May 18, 2021, 1:12 p.m. UTC | #1
Hi,

On 14/05/21 10:53, Ionela Voinescu wrote:
> Hi all,
>
> These are a few trivial patches to populate cpu capacity information
> using performance information from ACPI's CPPC.
>
> I've tied this functionality to the existing function
> init_freq_invariance_cppc() called in acpi_cppc_processor_probe().
> This function is renamed to a more generic arch_init_invariance_cppc().
>
> The patches have been build tested on x86 and more thoroughly tested on
> Juno R2 (arm64), which uses the new functionality, with the following
> results:
>
>
> root@ubuntu:~# dmesg | grep cpu_capacity
> [    2.157494] init_cpu_capacity_cppc: CPU0 cpu_capacity=38300 (raw).
> [    2.163699] init_cpu_capacity_cppc: CPU1 cpu_capacity=38300 (raw).
> [    2.169899] init_cpu_capacity_cppc: CPU2 cpu_capacity=38300 (raw).
> [    2.176098] init_cpu_capacity_cppc: CPU3 cpu_capacity=38300 (raw).
> [    2.182296] init_cpu_capacity_cppc: CPU4 cpu_capacity=102400 (raw).
> [    2.188581] init_cpu_capacity_cppc: CPU5 cpu_capacity=102400 (raw).
> [    2.194867] cpu_capacity: capacity_scale=102400
> [    2.199409] cpu_capacity: CPU0 cpu_capacity=383
> [    2.203952] cpu_capacity: CPU1 cpu_capacity=383
> [    2.208495] cpu_capacity: CPU2 cpu_capacity=383
> [    2.213037] cpu_capacity: CPU3 cpu_capacity=383
> [    2.217580] cpu_capacity: CPU4 cpu_capacity=1024
> [    2.222209] cpu_capacity: CPU5 cpu_capacity=1024
> [    2.226886] init_cpu_capacity_cppc: cpu_capacity initialization done
>
> root@ubuntu:~# tail -n +1 /sys/devices/system/cpu/cpu*/cpu_capacity
> ==> /sys/devices/system/cpu/cpu0/cpu_capacity <==
> 383
> ==> /sys/devices/system/cpu/cpu1/cpu_capacity <==
> 383
> ==> /sys/devices/system/cpu/cpu2/cpu_capacity <==
> 383
> ==> /sys/devices/system/cpu/cpu3/cpu_capacity <==
> 383
> ==> /sys/devices/system/cpu/cpu4/cpu_capacity <==
> 1024
> ==> /sys/devices/system/cpu/cpu5/cpu_capacity <==
> 1024
>
> All works as expected even if ACPI processor support is built as a
> module.
>

Tested on my Ampere eMAG; this all seems to work fine except for some
scheduler debug stuff that gets confused; see

  http://lore.kernel.org/r/20210518130725.3563132-1-valentin.schneider@arm.com

With that in mind:
Tested-by: Valentin Schneider <valentin.schneider@arm.com>
Ionela Voinescu May 19, 2021, 9:51 a.m. UTC | #2
Hi Valentin,

On Tuesday 18 May 2021 at 14:12:03 (+0100), Valentin Schneider wrote:
> Hi,
> 
> On 14/05/21 10:53, Ionela Voinescu wrote:
> > Hi all,
> >
> > These are a few trivial patches to populate cpu capacity information
> > using performance information from ACPI's CPPC.
> >
> > I've tied this functionality to the existing function
> > init_freq_invariance_cppc() called in acpi_cppc_processor_probe().
> > This function is renamed to a more generic arch_init_invariance_cppc().
> >
> > The patches have been build tested on x86 and more thoroughly tested on
> > Juno R2 (arm64), which uses the new functionality, with the following
> > results:
> >
> >
> > root@ubuntu:~# dmesg | grep cpu_capacity
> > [    2.157494] init_cpu_capacity_cppc: CPU0 cpu_capacity=38300 (raw).
> > [    2.163699] init_cpu_capacity_cppc: CPU1 cpu_capacity=38300 (raw).
> > [    2.169899] init_cpu_capacity_cppc: CPU2 cpu_capacity=38300 (raw).
> > [    2.176098] init_cpu_capacity_cppc: CPU3 cpu_capacity=38300 (raw).
> > [    2.182296] init_cpu_capacity_cppc: CPU4 cpu_capacity=102400 (raw).
> > [    2.188581] init_cpu_capacity_cppc: CPU5 cpu_capacity=102400 (raw).
> > [    2.194867] cpu_capacity: capacity_scale=102400
> > [    2.199409] cpu_capacity: CPU0 cpu_capacity=383
> > [    2.203952] cpu_capacity: CPU1 cpu_capacity=383
> > [    2.208495] cpu_capacity: CPU2 cpu_capacity=383
> > [    2.213037] cpu_capacity: CPU3 cpu_capacity=383
> > [    2.217580] cpu_capacity: CPU4 cpu_capacity=1024
> > [    2.222209] cpu_capacity: CPU5 cpu_capacity=1024
> > [    2.226886] init_cpu_capacity_cppc: cpu_capacity initialization done
> >
> > root@ubuntu:~# tail -n +1 /sys/devices/system/cpu/cpu*/cpu_capacity
> > ==> /sys/devices/system/cpu/cpu0/cpu_capacity <==
> > 383
> > ==> /sys/devices/system/cpu/cpu1/cpu_capacity <==
> > 383
> > ==> /sys/devices/system/cpu/cpu2/cpu_capacity <==
> > 383
> > ==> /sys/devices/system/cpu/cpu3/cpu_capacity <==
> > 383
> > ==> /sys/devices/system/cpu/cpu4/cpu_capacity <==
> > 1024
> > ==> /sys/devices/system/cpu/cpu5/cpu_capacity <==
> > 1024
> >
> > All works as expected even if ACPI processor support is built as a
> > module.
> >
> 
> Tested on my Ampere eMAG; this all seems to work fine except for some
> scheduler debug stuff that gets confused; see
> 
>   http://lore.kernel.org/r/20210518130725.3563132-1-valentin.schneider@arm.com
> 
> With that in mind:
> Tested-by: Valentin Schneider <valentin.schneider@arm.com>

Many thanks for testing and fixing the debugfs problem. I'll take a look
over your patch.

Ionela.