From 6c5159b2080482dcd1cedbeaeb71777057ad887ffa829481ecfd5e4e37962668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= <adrian@suse.de> Date: Wed, 12 Mar 2025 17:20:00 +0100 Subject: [PATCH] Sync from SUSE:SLFO:Main powerpc-utils revision e11f0aba2af094f451ee6985591fe689 --- ...Return-0-for-success-from-do_replace.patch | 39 ++++++ ...at-Fix-negative-values-for-idle-PURR.patch | 132 ++++++++++++++++++ lparstat-print-memory-mode-correctly.patch | 50 +++++++ powerpc-utils.changes | 18 +++ powerpc-utils.spec | 3 + 5 files changed, 242 insertions(+) create mode 100644 drmgr-pci-Return-0-for-success-from-do_replace.patch create mode 100644 lparstat-Fix-negative-values-for-idle-PURR.patch create mode 100644 lparstat-print-memory-mode-correctly.patch diff --git a/drmgr-pci-Return-0-for-success-from-do_replace.patch b/drmgr-pci-Return-0-for-success-from-do_replace.patch new file mode 100644 index 0000000..1b95a66 --- /dev/null +++ b/drmgr-pci-Return-0-for-success-from-do_replace.patch @@ -0,0 +1,39 @@ +From 3a8127ad7fe6615a8c6e8a3f0965addfdf888b38 Mon Sep 17 00:00:00 2001 +From: Haren Myneni <haren@linux.ibm.com> +Date: Fri, 14 Feb 2025 21:43:33 -0800 +Subject: [PATCH] drmgr/pci: Return 0 for success from do_replace() + +Patch-mainline: expected 1.3.14 +Git-commit: 3a8127ad7fe6615a8c6e8a3f0965addfdf888b38 + +Added replace_add_work() in commit f40a63b15c563 to support +replacement node and the partner node. But this function returns +0 for user input and 1 for success which caused do_replace() +returns 1. This patch fixes the problem with return 0. + +Fixes: f40a63b15c563 ("drmgr/pci: Add multipath partner device support for hotplug replace") +Signed-off-by: Haren Myneni <haren@linux.ibm.com> +Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com> +--- + src/drmgr/drslot_chrp_pci.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/drmgr/drslot_chrp_pci.c b/src/drmgr/drslot_chrp_pci.c +index 4c41fcd..91c08e9 100644 +--- a/src/drmgr/drslot_chrp_pci.c ++++ b/src/drmgr/drslot_chrp_pci.c +@@ -1051,9 +1051,10 @@ static int do_replace(struct dr_node *all_nodes) + } + + usr_prompt = prompt_save; ++ return rc; + } + +- return rc; ++ return 0; + } + + int valid_pci_options(void) +-- +2.47.1 + diff --git a/lparstat-Fix-negative-values-for-idle-PURR.patch b/lparstat-Fix-negative-values-for-idle-PURR.patch new file mode 100644 index 0000000..8e6f789 --- /dev/null +++ b/lparstat-Fix-negative-values-for-idle-PURR.patch @@ -0,0 +1,132 @@ +From 18a6dbca81b443d3cb7037d8bd39da014b4055ee Mon Sep 17 00:00:00 2001 +From: Saket Kumar Bhaskar <skb99@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 <skb99@linux.ibm.com> +Signed-off-by: Tyrel Datwyler <tyreld@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 + diff --git a/lparstat-print-memory-mode-correctly.patch b/lparstat-print-memory-mode-correctly.patch new file mode 100644 index 0000000..64670ac --- /dev/null +++ b/lparstat-print-memory-mode-correctly.patch @@ -0,0 +1,50 @@ +From b6f50dc565eea17ce35389555489e9d8da3be9f3 Mon Sep 17 00:00:00 2001 +From: Shrikanth Hegde <sshegde@linux.ibm.com> +Date: Mon, 3 Mar 2025 09:36:47 +0530 +Subject: [PATCH] lparstat: print memory mode correctly + +Patch-mainline: expected 1.3.14 +Git-commit: b6f50dc565eea17ce35389555489e9d8da3be9f3 + +Starting from power10, active memory sharing(AMS) is not supported. +So from power10 onwards the H_GET_MPP hcall fails and hence +corresponding fields in lparcfg are not populated, such as +entitled_memory_pool_number etc. + +Use gcc builtins and print memory model as dedicated for power10 +onwards. + +Suggested-by: Peter Bergner <bergner@linux.ibm.com> +Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com> +[tyreld: fixup arch test to use newly defined BUILTIN wrapper] +Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com> +--- + src/common/cpu_info_helpers.h | 6 ++++++ + src/lparstat.c | 6 +++++- + 2 files changed, 11 insertions(+), 1 deletion(-) + +Index: powerpc-utils-1.3.13/src/lparstat.c +=================================================================== +--- powerpc-utils-1.3.13.orig/src/lparstat.c ++++ powerpc-utils-1.3.13/src/lparstat.c +@@ -31,6 +31,7 @@ + #include <fcntl.h> + #include <sched.h> + #include <signal.h> ++#include <sys/auxv.h> + #include <sys/stat.h> + #include <sys/time.h> + #include "lparstat.h" +@@ -789,7 +790,11 @@ void get_memory_mode(struct sysentry *se + struct sysentry *tmp; + + tmp = get_sysentry("entitled_memory_pool_number"); +- if (atoi(tmp->value) == 65535) ++ /* ++ * from power10 onwards Active Memory Sharing(AMS) is not ++ * supported. Hence always display it as dedicated for those ++ */ ++ if (atoi(tmp->value) == 65535 || getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_3_1) + sprintf(buf, "Dedicated"); + else + sprintf(buf, "Shared"); diff --git a/powerpc-utils.changes b/powerpc-utils.changes index b586605..7a8e666 100644 --- a/powerpc-utils.changes +++ b/powerpc-utils.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Wed Mar 5 15:20:45 UTC 2025 - Michal Suchanek <msuchanek@suse.de> + +- Fix negative values of idle PURR (bsc#1238322 ltc#210808) + * lparstat-Fix-negative-values-for-idle-PURR.patch + +------------------------------------------------------------------- +Wed Mar 5 10:00:34 UTC 2025 - Michal Suchanek <msuchanek@suse.de> + +- drmgr/pci: Return 0 for success from do_replace() (jsc#PED-9914). + * drmgr-pci-Return-0-for-success-from-do_replace.patch + +------------------------------------------------------------------- +Tue Mar 4 10:24:35 UTC 2025 - Michal Suchanek <msuchanek@suse.de> + +- Fix memory mode display on POWER10 (bsc#1237409 ltc#211627) + * lparstat-print-memory-mode-correctly.patch + ------------------------------------------------------------------- Mon Jan 27 17:34:47 UTC 2025 - Michal Suchanek <msuchanek@suse.de> diff --git a/powerpc-utils.spec b/powerpc-utils.spec index 8f1d0cb..a8194a2 100644 --- a/powerpc-utils.spec +++ b/powerpc-utils.spec @@ -29,6 +29,9 @@ Patch1: powerpc-utils-lsprop.patch Patch2: ofpathname_powernv.patch Patch3: fix_kexec_service_name_for_suse.patch 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