mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
qemu: Don't cache microcode version
My earlier commit be46f61326 was incomplete. It removed caching of microcode version in the CPU driver, which means the capabilities XML will see the correct microcode version. But it is also cached in the QEMU capabilities cache where it is used to detect whether we need to reprobe QEMU. By missing the second place, the original commit be46f61326 made the situation even worse since libvirt would report correct microcode version while still using the old host CPU model (visible in domain capabilities XML). Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> (cherry picked from commit 673c62a3b7855a0685d8f116e227c402720b9ee9)
This commit is contained in:
parent
1442aa99be
commit
b735dde844
@ -4487,7 +4487,7 @@ virQEMUCapsNewData(const char *binary,
|
|||||||
priv->libDir,
|
priv->libDir,
|
||||||
priv->runUid,
|
priv->runUid,
|
||||||
priv->runGid,
|
priv->runGid,
|
||||||
priv->microcodeVersion,
|
virHostCPUGetMicrocodeVersion(),
|
||||||
priv->kernelVersion);
|
priv->kernelVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4570,8 +4570,7 @@ virFileCachePtr
|
|||||||
virQEMUCapsCacheNew(const char *libDir,
|
virQEMUCapsCacheNew(const char *libDir,
|
||||||
const char *cacheDir,
|
const char *cacheDir,
|
||||||
uid_t runUid,
|
uid_t runUid,
|
||||||
gid_t runGid,
|
gid_t runGid)
|
||||||
unsigned int microcodeVersion)
|
|
||||||
{
|
{
|
||||||
char *capsCacheDir = NULL;
|
char *capsCacheDir = NULL;
|
||||||
virFileCachePtr cache = NULL;
|
virFileCachePtr cache = NULL;
|
||||||
@ -4595,7 +4594,6 @@ virQEMUCapsCacheNew(const char *libDir,
|
|||||||
|
|
||||||
priv->runUid = runUid;
|
priv->runUid = runUid;
|
||||||
priv->runGid = runGid;
|
priv->runGid = runGid;
|
||||||
priv->microcodeVersion = microcodeVersion;
|
|
||||||
priv->kvmUsable = VIR_TRISTATE_BOOL_ABSENT;
|
priv->kvmUsable = VIR_TRISTATE_BOOL_ABSENT;
|
||||||
|
|
||||||
if (uname(&uts) == 0 &&
|
if (uname(&uts) == 0 &&
|
||||||
@ -4617,8 +4615,11 @@ virQEMUCapsPtr
|
|||||||
virQEMUCapsCacheLookup(virFileCachePtr cache,
|
virQEMUCapsCacheLookup(virFileCachePtr cache,
|
||||||
const char *binary)
|
const char *binary)
|
||||||
{
|
{
|
||||||
|
virQEMUCapsCachePrivPtr priv = virFileCacheGetPriv(cache);
|
||||||
virQEMUCapsPtr ret = NULL;
|
virQEMUCapsPtr ret = NULL;
|
||||||
|
|
||||||
|
priv->microcodeVersion = virHostCPUGetMicrocodeVersion();
|
||||||
|
|
||||||
ret = virFileCacheLookup(cache, binary);
|
ret = virFileCacheLookup(cache, binary);
|
||||||
|
|
||||||
VIR_DEBUG("Returning caps %p for %s", ret, binary);
|
VIR_DEBUG("Returning caps %p for %s", ret, binary);
|
||||||
@ -4672,6 +4673,7 @@ virQEMUCapsPtr
|
|||||||
virQEMUCapsCacheLookupByArch(virFileCachePtr cache,
|
virQEMUCapsCacheLookupByArch(virFileCachePtr cache,
|
||||||
virArch arch)
|
virArch arch)
|
||||||
{
|
{
|
||||||
|
virQEMUCapsCachePrivPtr priv = virFileCacheGetPriv(cache);
|
||||||
virQEMUCapsPtr ret = NULL;
|
virQEMUCapsPtr ret = NULL;
|
||||||
const char *binaryFilters[] = {
|
const char *binaryFilters[] = {
|
||||||
"qemu-system-",
|
"qemu-system-",
|
||||||
@ -4684,6 +4686,8 @@ virQEMUCapsCacheLookupByArch(virFileCachePtr cache,
|
|||||||
size_t i;
|
size_t i;
|
||||||
size_t j;
|
size_t j;
|
||||||
|
|
||||||
|
priv->microcodeVersion = virHostCPUGetMicrocodeVersion();
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_CARDINALITY(binaryFilters); i++) {
|
for (i = 0; i < ARRAY_CARDINALITY(binaryFilters); i++) {
|
||||||
for (j = 0; j < ARRAY_CARDINALITY(archs); j++) {
|
for (j = 0; j < ARRAY_CARDINALITY(archs); j++) {
|
||||||
struct virQEMUCapsSearchData data = {
|
struct virQEMUCapsSearchData data = {
|
||||||
|
@ -587,8 +587,7 @@ void virQEMUCapsFilterByMachineType(virQEMUCapsPtr qemuCaps,
|
|||||||
virFileCachePtr virQEMUCapsCacheNew(const char *libDir,
|
virFileCachePtr virQEMUCapsCacheNew(const char *libDir,
|
||||||
const char *cacheDir,
|
const char *cacheDir,
|
||||||
uid_t uid,
|
uid_t uid,
|
||||||
gid_t gid,
|
gid_t gid);
|
||||||
unsigned int microcodeVersion);
|
|
||||||
virQEMUCapsPtr virQEMUCapsCacheLookup(virFileCachePtr cache,
|
virQEMUCapsPtr virQEMUCapsCacheLookup(virFileCachePtr cache,
|
||||||
const char *binary);
|
const char *binary);
|
||||||
virQEMUCapsPtr virQEMUCapsCacheLookupCopy(virFileCachePtr cache,
|
virQEMUCapsPtr virQEMUCapsCacheLookupCopy(virFileCachePtr cache,
|
||||||
|
@ -585,8 +585,6 @@ qemuStateInitialize(bool privileged,
|
|||||||
char *hugepagePath = NULL;
|
char *hugepagePath = NULL;
|
||||||
char *memoryBackingPath = NULL;
|
char *memoryBackingPath = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
virCPUDefPtr hostCPU = NULL;
|
|
||||||
unsigned int microcodeVersion = 0;
|
|
||||||
|
|
||||||
if (VIR_ALLOC(qemu_driver) < 0)
|
if (VIR_ALLOC(qemu_driver) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -809,15 +807,10 @@ qemuStateInitialize(bool privileged,
|
|||||||
run_gid = cfg->group;
|
run_gid = cfg->group;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hostCPU = virCPUProbeHost(virArchFromHost())))
|
|
||||||
microcodeVersion = hostCPU->microcodeVersion;
|
|
||||||
virCPUDefFree(hostCPU);
|
|
||||||
|
|
||||||
qemu_driver->qemuCapsCache = virQEMUCapsCacheNew(cfg->libDir,
|
qemu_driver->qemuCapsCache = virQEMUCapsCacheNew(cfg->libDir,
|
||||||
cfg->cacheDir,
|
cfg->cacheDir,
|
||||||
run_uid,
|
run_uid,
|
||||||
run_gid,
|
run_gid);
|
||||||
microcodeVersion);
|
|
||||||
if (!qemu_driver->qemuCapsCache)
|
if (!qemu_driver->qemuCapsCache)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ int qemuTestDriverInit(virQEMUDriver *driver)
|
|||||||
|
|
||||||
/* Using /dev/null for libDir and cacheDir automatically produces errors
|
/* Using /dev/null for libDir and cacheDir automatically produces errors
|
||||||
* upon attempt to use any of them */
|
* upon attempt to use any of them */
|
||||||
driver->qemuCapsCache = virQEMUCapsCacheNew("/dev/null", "/dev/null", 0, 0, 0);
|
driver->qemuCapsCache = virQEMUCapsCacheNew("/dev/null", "/dev/null", 0, 0);
|
||||||
if (!driver->qemuCapsCache)
|
if (!driver->qemuCapsCache)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user