]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: show the number of physical socket on aarch64 machine without ACPI PPTT
authorMasayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Fri, 20 Nov 2020 05:06:09 +0000 (00:06 -0500)
committerKarel Zak <kzak@redhat.com>
Fri, 20 Nov 2020 08:17:12 +0000 (09:17 +0100)
Show the number of the number of physical socket even if the sysfs doesn't
have the physical socket information.

Note, lscpu shows the number of physical socket as 'Socket(s):' only if
root user runs it because accessing the DMI table requires root
privilege.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
sys-utils/lscpu-arm.c
sys-utils/lscpu.c
sys-utils/lscpu.h

index 9391cca54989c65e33050b94bea70b2c5681b64c..9e259673c8fec6f50db982742842714bb1e01f34 100644 (file)
@@ -360,6 +360,8 @@ static void arm_decode(struct lscpu_cxt *cxt, struct lscpu_cputype *ct)
 
        arm_ids_decode(ct);
        arm_rXpY_decode(ct);
+       if (cxt->is_cluster)
+               ct->nr_socket_on_cluster = get_number_of_physical_sockets_from_dmi();
 }
 
 static int lscpu_is_cluster_arm(struct lscpu_cxt *cxt)
index 65016f08b7c204463c25c789757f3b569ed94015..729e3e1dc38ed1562314e459257d41993f86e028 100644 (file)
@@ -864,10 +864,15 @@ print_summary_cputype(struct lscpu_cxt *cxt,
                } else
                        add_summary_n(tb, sec, _("Book(s):"), ct->nbooks_per_drawer ?: ct->nbooks);
        } else {
-               if (cxt->is_cluster)
+               if (cxt->is_cluster) {
+                       if (ct->nr_socket_on_cluster > 0)
+                               add_summary_n(tb, sec, _("Socket(s):"), ct->nr_socket_on_cluster);
+                       else
+                               add_summary_s(tb, sec, _("Socket(s):"), "-");
+
                        add_summary_n(tb, sec, _("Cluster(s):"),
                                        ct->nsockets_per_book ?: ct->nsockets);
-               else
+               else
                        add_summary_n(tb, sec, _("Socket(s):"),
                                        ct->nsockets_per_book ?: ct->nsockets);
        }
index 74c647e3a8f0df29f8c37b6acc5ec3a1e12e7b1b..623c07998d60f7e69dcb4a8c628d64790e6cc9d5 100644 (file)
@@ -101,6 +101,8 @@ struct lscpu_cputype {
                        has_configured : 1,
                        has_polarization : 1,
                        has_addresses : 1;
+
+       size_t nr_socket_on_cluster; /* the number of sockets if the is_cluster is 1 */
 };
 
 /* dispatching modes */