From: Masayoshi Mizuma <m.mizuma@xxxxxxxxxxxxxx> Show the number of physical socket even if the sysfs doesn't have the physical socket information. Note, lscpu cannot show the number of socket info for unprivileged users because it needs to access the DMI table. Signed-off-by: Masayoshi Mizuma <m.mizuma@xxxxxxxxxxxxxx> --- sys-utils/lscpu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 8c823c170..3e7da2eac 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -2182,9 +2182,15 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod) add_summary_n(tb, _("Book(s):"), books_per_drawer ?: desc->nbooks); } } else { - if (is_cluster) + if (is_cluster) { + int sockets = get_number_of_physical_sockets_from_dmi(); + + if (sockets > 0) + add_summary_n(tb, _("Socket(s):"), sockets); + else + add_summary_s(tb, _("Socket(s):"), "-"); add_summary_n(tb, _("Cluster(s):"), desc->nsockets); - else + } else add_summary_n(tb, _("Socket(s):"), sockets_per_book ?: desc->nsockets); } -- 2.27.0