File lparstat-print-memory-mode-correctly.patch of Package powerpc-utils.37742
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");