Resolves: RHEL-128106, lparstat: print memory mode correctly

This commit is contained in:
Than Ngo 2026-01-08 11:53:59 +01:00
parent 2a575e2702
commit e6f33be5aa
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,47 @@
commit 4443a68d523043d69195e5a5a27fb9fc7ae8c50f
Author: Shrikanth Hegde <sshegde@linux.ibm.com>
Date: Mon Mar 10 22:29:16 2025 +0530
lparstat: print memory mode correctly (revised)
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 HWCAP mechanism 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>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
diff --git a/src/lparstat.c b/src/lparstat.c
index db22316..8eddd7c 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -37,6 +37,11 @@
#include "pseries_platform.h"
#include "cpu_info_helpers.h"
#include <time.h>
+#include <sys/auxv.h>
+
+#ifndef PPC_FEATURE2_ARCH_3_1
+#define PPC_FEATURE2_ARCH_3_1 0x00040000
+#endif
#define LPARCFG_FILE "/proc/ppc64/lparcfg"
#define SE_NOT_FOUND "???"
@@ -794,7 +799,11 @@ void get_memory_mode(struct sysentry *se, char *buf)
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");

View File

@ -1,6 +1,6 @@
Name: powerpc-utils
Version: 1.3.13
Release: 3%{?dist}
Release: 4%{?dist}
Summary: PERL-based scripts for maintaining and servicing PowerPC systems
License: GPL-2.0-only
@ -13,6 +13,7 @@ Patch0: powerpc-utils-1.3.11-manpages.patch
Patch100: powerpc-utils-1.3.13-cpu_info_helpers.patch
Patch101: powerpc-utils-1.3.13-ppc64_cpu-Fix-handling-of-non-contiguous-CPU-IDs.patch
Patch102: powerpc-utils-1.3.13-drmgr-return.patch
Patch103: powerpc-utils-lparstat-print-memory-mode-correctly.patch
ExclusiveArch: ppc %{power64}
@ -214,6 +215,9 @@ systemctl enable hcn-init.service >/dev/null 2>&1 || :
%changelog
* Thu Jan 08 2026 Than Ngo <than@redhat.com> - 1.3.13-4
- Resolves: RHEL-128106, lparstat: print memory mode correctly
* Tue Apr 22 2025 Than Ngo <than@redhat.com> - 1.3.13-3
- Resolves: RHEL-81987, Fix return value for success from do_replace()