2025-05-19 19:40:28 +02:00
|
|
|
From 4443a68d523043d69195e5a5a27fb9fc7ae8c50f Mon Sep 17 00:00:00 2001
|
2025-03-12 17:20:00 +01:00
|
|
|
From: Shrikanth Hegde <sshegde@linux.ibm.com>
|
2025-05-19 19:40:28 +02:00
|
|
|
Date: Mon, 10 Mar 2025 22:29:16 +0530
|
|
|
|
Subject: [PATCH] lparstat: print memory mode correctly (revised)
|
2025-03-12 17:20:00 +01:00
|
|
|
|
|
|
|
Patch-mainline: expected 1.3.14
|
2025-05-19 19:40:28 +02:00
|
|
|
Git-commit: 4443a68d523043d69195e5a5a27fb9fc7ae8c50f
|
2025-03-12 17:20:00 +01:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2025-05-19 19:40:28 +02:00
|
|
|
Use HWCAP mechanism and print memory model as dedicated for power10
|
2025-03-12 17:20:00 +01:00
|
|
|
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>
|
|
|
|
---
|
2025-05-19 19:40:28 +02:00
|
|
|
src/lparstat.c | 11 ++++++++++-
|
|
|
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
2025-03-12 17:20:00 +01:00
|
|
|
|
2025-05-19 19:40:28 +02:00
|
|
|
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>
|
2025-03-12 17:20:00 +01:00
|
|
|
+#include <sys/auxv.h>
|
2025-05-19 19:40:28 +02:00
|
|
|
+
|
|
|
|
+#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)
|
2025-03-12 17:20:00 +01:00
|
|
|
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
|
|
|
|
+ */
|
2025-05-19 19:40:28 +02:00
|
|
|
+ if (atoi(tmp->value) == 65535 || (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_3_1))
|
2025-03-12 17:20:00 +01:00
|
|
|
sprintf(buf, "Dedicated");
|
|
|
|
else
|
|
|
|
sprintf(buf, "Shared");
|
2025-05-19 19:40:28 +02:00
|
|
|
--
|
|
|
|
2.47.1
|
|
|
|
|