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

From: "Naveen N. Rao" <[email-masked]>
Date: Wed, 05 Feb 2020 13:37:45 +0530

Christophe Leroy wrote:
> 
> 
> Le 27/11/2019 à 13:01, Gautham R. Shenoy a écrit :
>> From: "Gautham R. Shenoy" <[email-masked]>
>> 
>> 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