Re: [PATCH 2/3] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU

From: Naveen N. Rao
Date: Wed Feb 05 2020 - 03:07:55 EST


Christophe Leroy wrote:


Le 27/11/2019 Ã 13:01, Gautham R. Shenoy a ÃcritÂ:
From: "Gautham R. Shenoy" <ego@xxxxxxxxxxxxxxxxxx>

On Pseries LPARs, to calculate utilization, we need to know the
[S]PURR ticks when the CPUs were busy or idle.

The total PURR and SPURR ticks are already exposed via the per-cpu
sysfs files /sys/devices/system/cpu/cpuX/purr and
/sys/devices/system/cpu/cpuX/spurr.

This patch adds support for exposing the idle PURR and SPURR ticks via
/sys/devices/system/cpu/cpuX/idle_purr and
/sys/devices/system/cpu/cpuX/idle_spurr.

Might be a candid question, but I see in arch/powerpc/kernel/time.c that PURR/SPURR are already taken into account by the kernel to calculate utilisation when CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is selected.

As far as I understand, you are wanting to expose this to userland to redo the calculation there. What is wrong with the values reported by the kernel ?

As you point out, it is only done with CONFIG_VIRT_CPU_ACCOUNTING_NATIVE, but isn't available with NO_HZ_FULL, which happens to be the distro default nowadays.

- Naveen