[PATCH 0/7] qemu: Fix broken qemu caps cache invalidation

Peter Krempa posted 7 patches 2 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1650893125.git.pkrempa@redhat.com
src/cpu/cpu_x86.c     |  31 ++++++++++---
src/util/virhostcpu.c | 104 ++++++++++++++++++++++++++++++++++++------
2 files changed, 116 insertions(+), 19 deletions(-)
[PATCH 0/7] qemu: Fix broken qemu caps cache invalidation
Posted by Peter Krempa 2 years ago
Bugs in the code meant to invalidate the qemu capabilities cache
resulted in us always re-probing capabilities on startup of
libvirtd/virtqemud. This got extremely annoying with the modern
deployments using --timeout.

Apart from issues in inserting the detected features, it also turns out
that AMD boxes report data which changes based on which CPU the
instruction happened to execute, so we need to mask that out.

Peter Krempa (7):
  virCPUx86DataIsIdentical: Add debug output
  virCPUx86DataGetHost: Fix construction of the returned data
  virHostCPUGetCPUID: Add comment on how KVM_GET_SUPPORTED_CPUID works
  util: virhostcpu: Extract filtering of the returned data from
    virHostCPUGetCPUID
  virHostCPUGetCPUID: Fix possible allocation of huge amount of memory
  virHostCPUGetCPUID: Limit the buffer size ranges
  virHostCPUGetCPUIDFilterVolatile: Filter out topology data on AMD

 src/cpu/cpu_x86.c     |  31 ++++++++++---
 src/util/virhostcpu.c | 104 ++++++++++++++++++++++++++++++++++++------
 2 files changed, 116 insertions(+), 19 deletions(-)

-- 
2.35.1
Re: [PATCH 0/7] qemu: Fix broken qemu caps cache invalidation
Posted by Jiri Denemark 2 years ago
On Mon, Apr 25, 2022 at 15:28:24 +0200, Peter Krempa wrote:
> Bugs in the code meant to invalidate the qemu capabilities cache
> resulted in us always re-probing capabilities on startup of
> libvirtd/virtqemud. This got extremely annoying with the modern
> deployments using --timeout.
> 
> Apart from issues in inserting the detected features, it also turns out
> that AMD boxes report data which changes based on which CPU the
> instruction happened to execute, so we need to mask that out.
> 
> Peter Krempa (7):
>   virCPUx86DataIsIdentical: Add debug output
>   virCPUx86DataGetHost: Fix construction of the returned data
>   virHostCPUGetCPUID: Add comment on how KVM_GET_SUPPORTED_CPUID works
>   util: virhostcpu: Extract filtering of the returned data from
>     virHostCPUGetCPUID
>   virHostCPUGetCPUID: Fix possible allocation of huge amount of memory
>   virHostCPUGetCPUID: Limit the buffer size ranges
>   virHostCPUGetCPUIDFilterVolatile: Filter out topology data on AMD
> 
>  src/cpu/cpu_x86.c     |  31 ++++++++++---
>  src/util/virhostcpu.c | 104 ++++++++++++++++++++++++++++++++++++------
>  2 files changed, 116 insertions(+), 19 deletions(-)

Wow, KVM_GET_SUPPORTED_CPUID has a very unfriendly semantics.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Re: [PATCH 0/7] qemu: Fix broken qemu caps cache invalidation
Posted by Michal Prívozník 2 years ago
On 4/25/22 15:28, Peter Krempa wrote:
> Bugs in the code meant to invalidate the qemu capabilities cache
> resulted in us always re-probing capabilities on startup of
> libvirtd/virtqemud. This got extremely annoying with the modern
> deployments using --timeout.
> 
> Apart from issues in inserting the detected features, it also turns out
> that AMD boxes report data which changes based on which CPU the
> instruction happened to execute, so we need to mask that out.
> 
> Peter Krempa (7):
>   virCPUx86DataIsIdentical: Add debug output
>   virCPUx86DataGetHost: Fix construction of the returned data
>   virHostCPUGetCPUID: Add comment on how KVM_GET_SUPPORTED_CPUID works
>   util: virhostcpu: Extract filtering of the returned data from
>     virHostCPUGetCPUID
>   virHostCPUGetCPUID: Fix possible allocation of huge amount of memory
>   virHostCPUGetCPUID: Limit the buffer size ranges
>   virHostCPUGetCPUIDFilterVolatile: Filter out topology data on AMD
> 
>  src/cpu/cpu_x86.c     |  31 ++++++++++---
>  src/util/virhostcpu.c | 104 ++++++++++++++++++++++++++++++++++++------
>  2 files changed, 116 insertions(+), 19 deletions(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal