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 <
ber...@linux.ibm.com>
Signed-off-by: Shrikanth Hegde <
ssh...@linux.ibm.com>
---
v1->v2:
v1:
https://groups.google.com/g/powerpc-utils-devel/c/ASm9ihz_XPY
Use powerpc and built in support guards to fix build breaks in other
archs.
src/common/cpu_info_helpers.h | 6 ++++++
src/lparstat.c | 6 +++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/common/cpu_info_helpers.h b/src/common/cpu_info_helpers.h
index 77e6ad7..5cbe7de 100644
--- a/src/common/cpu_info_helpers.h
+++ b/src/common/cpu_info_helpers.h
@@ -47,4 +47,10 @@ extern int __get_one_smt_state(int core, int threads_per_cpu);
extern int __do_smt(bool numeric, int cpus_in_system, int threads_per_cpu,
bool print_smt_state);
+#if defined (__powerpc__) && defined (__BUILTIN_CPU_SUPPORTS__)
+# define BUILTIN_CPU_SUPPORTS(X) __builtin_cpu_supports(X)
+#else
+# define BUILTIN_CPU_SUPPORTS(X) 0
+#endif
+
#endif /* CPU_INFO_H */
diff --git a/src/lparstat.c b/src/lparstat.c
index db22316..7e1638c 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -794,7 +794,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 || __builtin_cpu_supports("arch_3_1"))
sprintf(buf, "Dedicated");
else
sprintf(buf, "Shared");
--
2.39.3