Bug 2095260

Summary: Revert the patch to ignore KVM_CAP_MAX_VCPUS in libvirt
Product: Red Hat Enterprise Linux 9 Reporter: Thomas Huth <thuth>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
libvirt sub component: General QA Contact: Luyao Huang <lhuang>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: chayang, coli, dhildenb, dzheng, jdenemar, jinzhao, juzhang, lmen, nanliu, nilal, virt-maint, vkuznets, xuzhang
Version: 9.1Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 9.1   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-8.4.0-2.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2094270 Environment:
Last Closed: 2022-11-15 10:04:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2094270    
Bug Blocks:    

Description Thomas Huth 2022-06-09 11:35:43 UTC
+++ This bug was initially created as a clone of Bug #2094270 +++

Description of problem:
In downstream qemu-kvm, we have a patch ("globally limit the maximum number of CPUs") that sets the hard limit of possible vCPUs to the value that the KVM code of the kernel recommends as soft limit. This soft limit was set to a value that we've tested in our downstream RHEL releases, so it make sense to set the hard limit to the same value. However, in upstream, the code has been changed recently to not use an arbitrary soft limit here anymore, but to cap the value on the amount of available physical CPUs of the host. So if that patch gets backported to the downstream kernel (see BZ 2074832), the hack in qemu-kvm won't work as expected anymore, making it impossible to set a "-smp x" value for the guests where x is greater than the amount of available physical CPUs.

Version-Release number of selected component (if applicable):
qemu-kvm-7.0.0-4.el9

How reproducible:
100%

Steps to Reproduce:
1. Install an upstream kernel (or the one from BZ 2074832)
2. Run a guest with more vCPUs than available physical host CPUs, e.g.:
   /usr/libexec/qemu-kvm -smp 700

Actual results:
qemu-kvm will refuse to start.

Expected results:
qemu-kvm should still run the guest.

Additional info:
I think we should simply revert/drop the "globally limit the maximum number of CPUs" patch in downstream qemu-kvm now.

[...]
--- Additional comment from Chao Yang on 2022-06-09 04:28:43 CEST ---

Do we need a counterpart libvirt bz in case we try migrating a VM with vCPU number exceeds the pCPU number of the destination host?

[...]
--- Additional comment from Jiri Denemark on 2022-06-09 13:16:54 CEST ---

I think we actually need libvirt bz to revert
https://gitlab.com/redhat/rhel/src/libvirt/-/commit/fcec98bb80633bec6f4bc3de0ab75627c874d315
RHEL-only patch. We are not involved in limit checking, but we report the
maximum number of virtual CPUs.

Comment 1 Jiri Denemark 2022-06-09 13:35:28 UTC
Backported: https://gitlab.com/redhat/rhel/src/libvirt/-/merge_requests/28

Comment 4 Luyao Huang 2022-06-16 07:16:33 UTC
Reproduce this bug with kernel-5.14.0-110.el9.x86_64, libvirt-8.4.0-1.el9.x86_64, qemu-kvm-7.0.0-6.el9.x86_64:

# virsh maxvcpus kvm
64

# virsh domcapabilities |grep "vcpu max"
  <vcpu max='64'/>

And verify this bug with kernel-5.14.0-110.el9.x86_64, libvirt-8.4.0-2.el9.x86_64, qemu-kvm-7.0.0-6.el9.x86_64:

# virsh domcapabilities |grep "vcpu max"
  <vcpu max='240'/>

# virsh maxvcpus kvm
240

Comment 10 errata-xmlrpc 2022-11-15 10:04:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Low: libvirt security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:8003