dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
14604f
From c223ad8f05d2d20a80e21dbb4b6240f11909f92c Mon Sep 17 00:00:00 2001
14604f
From: Karel Zak <kzak@redhat.com>
14604f
Date: Thu, 14 Jul 2022 13:10:16 +0200
14604f
Subject: lscpu: don;t read from HW when use /sys snapshot
14604f
14604f
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2069187
14604f
Signed-off-by: Karel Zak <kzak@redhat.com>
14604f
---
14604f
 sys-utils/lscpu.c | 8 ++++++--
14604f
 1 file changed, 6 insertions(+), 2 deletions(-)
14604f
14604f
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
14604f
index 70a797dd6..01f8fba35 100644
14604f
--- a/sys-utils/lscpu.c
14604f
+++ b/sys-utils/lscpu.c
14604f
@@ -1850,7 +1850,10 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
14604f
 			}
14604f
 		} else {
14604f
 			if (desc->is_cluster) {
14604f
-				int sockets = get_number_of_physical_sockets_from_dmi();
14604f
+				int sockets = 0;
14604f
+
14604f
+				if (mod->system == SYSTEM_LIVE)
14604f
+					sockets = get_number_of_physical_sockets_from_dmi();
14604f
 
14604f
 				if (sockets > 0)
14604f
 					add_summary_n(tb, _("Socket(s):"), sockets);
14604f
@@ -2109,7 +2112,8 @@ int main(int argc, char *argv[])
14604f
 		qsort(desc->ecaches, desc->necaches,
14604f
 				sizeof(struct cpu_cache), cachecmp);
14604f
 
14604f
-	desc->is_cluster = is_fallback_to_cluster(desc);
14604f
+	if (mod->system == SYSTEM_LIVE)
14604f
+		desc->is_cluster = is_fallback_to_cluster(desc);
14604f
 
14604f
 	read_nodes(desc);
14604f
 	read_hypervisor(desc, mod);
14604f
-- 
14604f
2.36.1
14604f