dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0081-lscpu-don-t-read-from-HW-when-use-sys-snapshot.patch

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