Description: [cgroup] libvirt has new max value for cpu quota, but virsh manual not mention it. Version: libvirt-7.0.0-1.module+el8.4.0+9464+3e71831a.x86_64 Reproduce: 100% Steps: 1. set vcpu_quota to 17592186044416 for a running vm (.libvirt-ci-venv-ci-runtest-YmmKNI) [root@dell-per740-19 machine-qemu\x2d1\x2dvm1.scope]# virsh schedinfo vm1 --set vcpu_quota=17592186044416 Scheduler : posix error: invalid argument: value of 'vcpu_quota' is out of range [1000, 17592186044415] <=== error happened, result is different from rhelav8.3 libvirt. 2. check virsh manual, still mention the max value is 18446744073709551 (.libvirt-ci-venv-ci-runtest-YmmKNI) [root@dell-per740-19 machine-qemu\x2d1\x2dvm1.scope]# man virsh schedinfo Syntax: schedinfo domain [[--config] [--live] | [--current]] [[--set] parameter=value]... schedinfo [--weight number] [--cap number] domain ... the vcpu_quota, emulator_quota, and iothread_quota parameters have a valid value range of 1000-18446744073709551 or less than 0. 3. in libvirt git log, there is an intentional change about this root@yisun-test1 /home/libvirt-rhel/src/util 21:38:21$ git show ed1ba69f5a8 commit ed1ba69f5a8132f8c1e73d2a1f142d70de0b564a Author: Pavel Hrdina <phrdina> Date: Wed Nov 25 12:41:16 2020 +0100 vircgroup: fix cpu quota maximum limit Kernel commit <d505b8af58912ae1e1a211fabc9995b19bd40828> added proper check for cpu quota maximum limit to prevent internal overflow. Even though this change is not present in all kernels it makes sense to enforce the same limit in libvirt. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1750315 Signed-off-by: Pavel Hrdina <phrdina> Reviewed-by: Daniel Henrique Barboza <danielhb413> diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h index 2a9b341985..ec0902e301 100644 --- a/src/util/vircgroup.h +++ b/src/util/vircgroup.h @@ -233,7 +233,9 @@ int virCgroupSetupCpuShares(virCgroupPtr cgroup, unsigned long long shares, #define VIR_CGROUP_CPU_PERIOD_MIN 1000LL #define VIR_CGROUP_CPU_PERIOD_MAX 1000000LL #define VIR_CGROUP_CPU_QUOTA_MIN 1000LL -#define VIR_CGROUP_CPU_QUOTA_MAX 18446744073709551LL +/* Based on kernel code ((1ULL << MAX_BW_BITS) - 1) where MAX_BW_BITS is + * (64 - BW_SHIFT) and BW_SHIFT is 20 */ +#define VIR_CGROUP_CPU_QUOTA_MAX 17592186044415LL Expected result: The virsh manual shoud use the new max value to make sure no misunderstanding for quota setting.
Hi, thanks for the report. Fixed in upstream: 992635b142 docs: use proper cpu quota value in our documentation 22cae2ea4b domain_validate: use defines for cpu period and quota limits There was one more place in the code missing the change to use new limits and our XML documentation was not updated as well.
Tested with upstream libvirt : v7.1.0-rc1-7-gfa58f571ee # man virsh schedinfo |grep "value range"|grep vcpu_quota vcpu_quota, emulator_quota, and iothread_quota parameters have a valid value range of 1000-17592186044415 or less than 0. # virsh schedinfo pc vcpu_quota=999 Scheduler : posix error: invalid argument: value of 'vcpu_quota' is out of range [1000, 17592186044415] # virsh schedinfo pc vcpu_quota=17592186044416 Scheduler : posix error: invalid argument: value of 'vcpu_quota' is out of range [1000, 17592186044415]
Verified with libvirt-daemon-7.3.0-1.module+el8.5.0+11004+f4810536.x86_64 & qemu-kvm-6.0.0-16.module+el8.5.0+10848+2dccc46d.x86_64 Steps as comment6.
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 (virt:av 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/RHBA-2021:4684