Skip to content

Commit b6f50dc

Browse files
Shrikanth Hegdetyreld
Shrikanth Hegde
authored andcommitted
lparstat: print memory mode correctly
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 <[email protected]> Signed-off-by: Shrikanth Hegde <[email protected]> [tyreld: fixup arch test to use newly defined BUILTIN wrapper] Signed-off-by: Tyrel Datwyler <[email protected]>
1 parent ae2cfe7 commit b6f50dc

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/common/cpu_info_helpers.h

+6
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,10 @@ extern int __get_one_smt_state(int core, int threads_per_cpu);
4747
extern int __do_smt(bool numeric, int cpus_in_system, int threads_per_cpu,
4848
bool print_smt_state);
4949

50+
#if defined (__powerpc__) && defined (__BUILTIN_CPU_SUPPORTS__)
51+
# define BUILTIN_CPU_SUPPORTS(X) __builtin_cpu_supports(X)
52+
#else
53+
# define BUILTIN_CPU_SUPPORTS(X) 0
54+
#endif
55+
5056
#endif /* CPU_INFO_H */

src/lparstat.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,11 @@ void get_memory_mode(struct sysentry *se, char *buf)
794794
struct sysentry *tmp;
795795

796796
tmp = get_sysentry("entitled_memory_pool_number");
797-
if (atoi(tmp->value) == 65535)
797+
/*
798+
* from power10 onwards Active Memory Sharing(AMS) is not
799+
* supported. Hence always display it as dedicated for those
800+
*/
801+
if (atoi(tmp->value) == 65535 || BUILTIN_CPU_SUPPORTS("arch_3_1"))
798802
sprintf(buf, "Dedicated");
799803
else
800804
sprintf(buf, "Shared");

0 commit comments

Comments
 (0)