Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package powerpc-utils for openSUSE:Factory 
checked in at 2025-03-07 16:38:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/powerpc-utils (Old)
 and      /work/SRC/openSUSE:Factory/.powerpc-utils.new.19136 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "powerpc-utils"

Fri Mar  7 16:38:54 2025 rev:149 rq:1250584 version:1.3.13

Changes:
--------
--- /work/SRC/openSUSE:Factory/powerpc-utils/powerpc-utils.changes      
2025-03-05 13:38:29.499444244 +0100
+++ /work/SRC/openSUSE:Factory/.powerpc-utils.new.19136/powerpc-utils.changes   
2025-03-07 16:39:59.443888543 +0100
@@ -1,0 +2,6 @@
+Wed Mar  5 15:20:45 UTC 2025 - Michal Suchanek <msucha...@suse.de>
+
+- Fix negative values of idle PURR (bsc#1238322 ltc#210808)
+  * lparstat-Fix-negative-values-for-idle-PURR.patch
+
+-------------------------------------------------------------------

New:
----
  lparstat-Fix-negative-values-for-idle-PURR.patch

BETA DEBUG BEGIN:
  New:- Fix negative values of idle PURR (bsc#1238322 ltc#210808)
  * lparstat-Fix-negative-values-for-idle-PURR.patch
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ powerpc-utils.spec ++++++
--- /var/tmp/diff_new_pack.rBIgIw/_old  2025-03-07 16:40:01.883990649 +0100
+++ /var/tmp/diff_new_pack.rBIgIw/_new  2025-03-07 16:40:01.915991989 +0100
@@ -31,6 +31,7 @@
 Patch4:         libvirt-service-dep.patch
 Patch5:         lparstat-print-memory-mode-correctly.patch
 Patch6:         drmgr-pci-Return-0-for-success-from-do_replace.patch
+Patch7:         lparstat-Fix-negative-values-for-idle-PURR.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  libnuma-devel

++++++ lparstat-Fix-negative-values-for-idle-PURR.patch ++++++
>From 18a6dbca81b443d3cb7037d8bd39da014b4055ee Mon Sep 17 00:00:00 2001
From: Saket Kumar Bhaskar <sk...@linux.ibm.com>
Date: Mon, 13 Jan 2025 13:43:39 +0530
Subject: [PATCH] lparstat: Fix negative values for %idle PURR

Patch-mainline: expected 1.3.14
Git-commit: 18a6dbca81b443d3cb7037d8bd39da014b4055ee

In certain scenarios, the %idle PURR metric displays negative values [1],
while %busy PURR exceeds 100% giving users false impression of resource
utilisation. This occurs when delta_purr becomes greater than delta_tb,
causing the following expression to yield a negative value, particularly
during 100% system utilization for %idle PURR:

%idle = (delta_tb - delta_purr + delta_idle_purr) / delta_tb * 100;

Without change:

./lparstat -E 1 30

System Configuration
type=Shared mode=Uncapped smt=8 lcpu=20 mem=208057792 kB cpus=42 ent=2.00

---Actual---                 -Normalized-
%busy  %idle   Frequency     %busy  %idle
------ ------  ------------- ------ ------
103.88  -3.88  2.75GHz[ 98%] 101.80   0.00
103.46  -3.46  2.67GHz[ 95%]  98.28   1.49
101.53  -1.53  2.74GHz[ 98%]  99.50   0.51
103.41  -3.41  2.70GHz[ 96%]  99.27   0.37

The delta_tb is computed using get_scaled_tb, which calculates the
timebase for a given time difference. Previously, nanoseconds were
ignored in the calculation of time difference, which led to delta_tb
being underestimated.

This patch addresses the issue by incorporating nanoseconds into the
time difference, ensuring precise calculations.

Also, rename get_time() to get_time_ns() to denote it returns time in
nanoseconds. get_delta_time() is introduced as a wrapper to get delta
time in seconds.

With change:
./lparstat -E 1 30

System Configuration
type=Shared mode=Uncapped smt=8 lcpu=20 mem=208057792 kB cpus=42 ent=2.00

---Actual---                 -Normalized-
%busy  %idle   Frequency     %busy  %idle
------ ------  ------------- ------ ------
 99.52   0.48  2.74GHz[ 98%]  97.53   2.66
 99.53   0.47  2.71GHz[ 97%]  96.54   3.67
 99.49   0.51  2.71GHz[ 97%]  96.51   3.87
 99.51   0.49  2.70GHz[ 97%]  96.53   3.90
 99.48   0.52  2.69GHz[ 96%]  95.50   4.38

[1] https://github.com/ibm-power-utilities/powerpc-utils/issues/103

Signed-off-by: Saket Kumar Bhaskar <sk...@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyr...@linux.ibm.com>
---
 src/lparstat.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/lparstat.c b/src/lparstat.c
index fe8b0fc..db22316 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -254,7 +254,7 @@ long long get_delta_value(char *se_name)
        return (value - old_value);
 }
 
-void get_time()
+void get_time_ns(void)
 {
        struct sysentry *se;
        struct timespec ts;
@@ -266,7 +266,12 @@ void get_time()
 
        se = get_sysentry("time");
        sprintf(se->value, "%lld",
-               (long long)ts.tv_sec);
+               (long long)ts.tv_sec * 1000000000LL + (long long)ts.tv_nsec);
+}
+
+double get_delta_time(void)
+{
+       return (get_delta_value("time") / 1000000000.0);
 }
 
 int get_time_base()
@@ -307,7 +312,7 @@ double get_scaled_tb(void)
        se = get_sysentry("online_cores");
        online_cores = atoi(se->value);
 
-       elapsed = get_delta_value("time");
+       elapsed = get_delta_time();
 
        se = get_sysentry("timebase");
        timebase = atoi(se->value);
@@ -386,7 +391,7 @@ void get_cpu_physc(struct sysentry *unused_se, char *buf)
 
                physc = delta_purr / delta_tb;
        } else {
-               elapsed = get_delta_value("time");
+               elapsed = get_delta_time();
 
                se = get_sysentry("timebase");
                timebase = atoi(se->value);
@@ -415,7 +420,7 @@ void get_cpu_app(struct sysentry *unused_se, char *buf)
        float timebase, app, elapsed_time;
        long long new_app, old_app;
 
-       elapsed_time = get_delta_value("time");
+       elapsed_time = get_delta_time();
 
        se = get_sysentry("timebase");
        timebase = atof(se->value);
@@ -1018,7 +1023,7 @@ void init_sysdata(void)
 {
        int rc = 0;
 
-       get_time();
+       get_time_ns();
        parse_lparcfg();
        parse_proc_stat();
        parse_proc_ints();
-- 
2.47.1

Reply via email to