linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: export timebase register sample in lparcfg
@ 2018-12-08 23:48 Tyrel Datwyler
  2019-02-17 22:25 ` Tyrel Datwyler
  2019-02-22  9:47 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Tyrel Datwyler @ 2018-12-08 23:48 UTC (permalink / raw)
  To: mpe; +Cc: brking, linuxppc-dev, Tyrel Datwyler, puvichakravarthy

The Processor Utilzation of Resource Registers (PURR) provide an estimate of
resources used by a cpu thread. Section 7.6 in Book III of the ISA outlines
how to calculate the percentage of shared resources for threads using the
ratio of the PURR delta and Timebase Register delta for a sampled period.

This calculation is currently done erroneously by the lparstat tool from the
powerpc-utils package. This patch exports the current timebase value after
we sample the PURRs and exposes it to userspace accounting tools via
/proc/ppc64/lparcfg.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/lparcfg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
index 7944873..1ea73ec 100644
--- a/arch/powerpc/platforms/pseries/lparcfg.c
+++ b/arch/powerpc/platforms/pseries/lparcfg.c
@@ -475,6 +475,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
 		splpar_dispatch_data(m);
 
 		seq_printf(m, "purr=%ld\n", get_purr());
+        seq_printf(m, "tbr=%ld\n", mftb());
 	} else {		/* non SPLPAR case */
 
 		seq_printf(m, "system_active_processors=%d\n",
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/pseries: export timebase register sample in lparcfg
  2018-12-08 23:48 [PATCH] powerpc/pseries: export timebase register sample in lparcfg Tyrel Datwyler
@ 2019-02-17 22:25 ` Tyrel Datwyler
  2019-02-18  2:33   ` Michael Ellerman
  2019-02-22  9:47 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Tyrel Datwyler @ 2019-02-17 22:25 UTC (permalink / raw)
  To: mpe; +Cc: brking, linuxppc-dev, puvichakravarthy

Ping? Any objections to this patch? A fix is already upstream in powerpc-utils
to utilize the timebase value if available.

-Tyrel

On 12/08/2018 03:48 PM, Tyrel Datwyler wrote:
> The Processor Utilzation of Resource Registers (PURR) provide an estimate of
> resources used by a cpu thread. Section 7.6 in Book III of the ISA outlines
> how to calculate the percentage of shared resources for threads using the
> ratio of the PURR delta and Timebase Register delta for a sampled period.
> 
> This calculation is currently done erroneously by the lparstat tool from the
> powerpc-utils package. This patch exports the current timebase value after
> we sample the PURRs and exposes it to userspace accounting tools via
> /proc/ppc64/lparcfg.
> 
> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
> ---
>  arch/powerpc/platforms/pseries/lparcfg.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
> index 7944873..1ea73ec 100644
> --- a/arch/powerpc/platforms/pseries/lparcfg.c
> +++ b/arch/powerpc/platforms/pseries/lparcfg.c
> @@ -475,6 +475,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
>  		splpar_dispatch_data(m);
> 
>  		seq_printf(m, "purr=%ld\n", get_purr());
> +        seq_printf(m, "tbr=%ld\n", mftb());
>  	} else {		/* non SPLPAR case */
> 
>  		seq_printf(m, "system_active_processors=%d\n",
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/pseries: export timebase register sample in lparcfg
  2019-02-17 22:25 ` Tyrel Datwyler
@ 2019-02-18  2:33   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2019-02-18  2:33 UTC (permalink / raw)
  To: Tyrel Datwyler; +Cc: brking, linuxppc-dev, puvichakravarthy

Tyrel Datwyler <tyreld@linux.vnet.ibm.com> writes:
> Ping? Any objections to this patch? A fix is already upstream in powerpc-utils
> to utilize the timebase value if available.

I'm slightly wary of adding things to lparcfg as it's world-readable and
hard to remove things once they're added (because tools rely on it).

But I guess this is fine.

If we ever want to restrict mftb access then we need to remember to also
lock down this file, or reduce the precision it returns.

cheers

> On 12/08/2018 03:48 PM, Tyrel Datwyler wrote:
>> The Processor Utilzation of Resource Registers (PURR) provide an estimate of
>> resources used by a cpu thread. Section 7.6 in Book III of the ISA outlines
>> how to calculate the percentage of shared resources for threads using the
>> ratio of the PURR delta and Timebase Register delta for a sampled period.
>> 
>> This calculation is currently done erroneously by the lparstat tool from the
>> powerpc-utils package. This patch exports the current timebase value after
>> we sample the PURRs and exposes it to userspace accounting tools via
>> /proc/ppc64/lparcfg.
>> 
>> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
>> ---
>>  arch/powerpc/platforms/pseries/lparcfg.c | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
>> index 7944873..1ea73ec 100644
>> --- a/arch/powerpc/platforms/pseries/lparcfg.c
>> +++ b/arch/powerpc/platforms/pseries/lparcfg.c
>> @@ -475,6 +475,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
>>  		splpar_dispatch_data(m);
>> 
>>  		seq_printf(m, "purr=%ld\n", get_purr());
>> +        seq_printf(m, "tbr=%ld\n", mftb());
>>  	} else {		/* non SPLPAR case */
>> 
>>  		seq_printf(m, "system_active_processors=%d\n",
>> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: powerpc/pseries: export timebase register sample in lparcfg
  2018-12-08 23:48 [PATCH] powerpc/pseries: export timebase register sample in lparcfg Tyrel Datwyler
  2019-02-17 22:25 ` Tyrel Datwyler
@ 2019-02-22  9:47 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2019-02-22  9:47 UTC (permalink / raw)
  To: Tyrel Datwyler; +Cc: brking, linuxppc-dev, Tyrel Datwyler, puvichakravarthy

On Sat, 2018-12-08 at 23:48:27 UTC, Tyrel Datwyler wrote:
> The Processor Utilzation of Resource Registers (PURR) provide an estimate of
> resources used by a cpu thread. Section 7.6 in Book III of the ISA outlines
> how to calculate the percentage of shared resources for threads using the
> ratio of the PURR delta and Timebase Register delta for a sampled period.
> 
> This calculation is currently done erroneously by the lparstat tool from the
> powerpc-utils package. This patch exports the current timebase value after
> we sample the PURRs and exposes it to userspace accounting tools via
> /proc/ppc64/lparcfg.
> 
> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/9f3ba362d84786af8e1ab36a32fb3378

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-22  9:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-08 23:48 [PATCH] powerpc/pseries: export timebase register sample in lparcfg Tyrel Datwyler
2019-02-17 22:25 ` Tyrel Datwyler
2019-02-18  2:33   ` Michael Ellerman
2019-02-22  9:47 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).