99cbc7
From 0f34aa83adc7e87ff0189ae6af1c8acbc3589812 Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <0f34aa83adc7e87ff0189ae6af1c8acbc3589812@dist-git>
99cbc7
From: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Date: Tue, 9 Apr 2019 09:38:41 +0200
99cbc7
Subject: [PATCH] cpu_x86: Do not cache microcode version
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
The microcode version checks are used to invalidate cached CPU data we
99cbc7
get from QEMU. To minimize /proc/cpuinfo parsing the microcode version
99cbc7
was only read when libvirtd started and cached for the daemon's
99cbc7
lifetime. However, the CPU microcode can change anytime (updating the
99cbc7
microcode package can automatically upload it to the CPU) and we need to
99cbc7
stop caching it to avoid using stale CPU model data.
99cbc7
99cbc7
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
(cherry picked from commit be46f613261d3b655a1f15afd635087e68a9c39b)
99cbc7
99cbc7
https://bugzilla.redhat.com/show_bug.cgi?id=1576369
99cbc7
99cbc7
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
99cbc7
Message-Id: <9fc5ee158cea54ec90a235071a7adb3bcda48689.1554795362.git.jdenemar@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 src/cpu/cpu_x86.c | 5 +----
99cbc7
 1 file changed, 1 insertion(+), 4 deletions(-)
99cbc7
99cbc7
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
99cbc7
index cf3d80eeb5..1acd8c4f49 100644
99cbc7
--- a/src/cpu/cpu_x86.c
99cbc7
+++ b/src/cpu/cpu_x86.c
99cbc7
@@ -155,7 +155,6 @@ struct _virCPUx86Map {
99cbc7
 };
99cbc7
 
99cbc7
 static virCPUx86MapPtr cpuMap;
99cbc7
-static unsigned int microcodeVersion;
99cbc7
 
99cbc7
 int virCPUx86DriverOnceInit(void);
99cbc7
 VIR_ONCE_GLOBAL_INIT(virCPUx86Driver);
99cbc7
@@ -1469,8 +1468,6 @@ virCPUx86DriverOnceInit(void)
99cbc7
     if (!(cpuMap = virCPUx86LoadMap()))
99cbc7
         return -1;
99cbc7
 
99cbc7
-    microcodeVersion = virHostCPUGetMicrocodeVersion();
99cbc7
-
99cbc7
     return 0;
99cbc7
 }
99cbc7
 
99cbc7
@@ -2553,7 +2550,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
99cbc7
         goto cleanup;
99cbc7
 
99cbc7
     ret = x86DecodeCPUData(cpu, cpuData, models);
99cbc7
-    cpu->microcodeVersion = microcodeVersion;
99cbc7
+    cpu->microcodeVersion = virHostCPUGetMicrocodeVersion();
99cbc7
 
99cbc7
  cleanup:
99cbc7
     virCPUx86DataFree(cpuData);
99cbc7
-- 
99cbc7
2.21.0
99cbc7