Bug 1950301
| Summary: | Document need to be updated as cpu_shares range changes on rhel 9 | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | yalzhang <yalzhang> |
| Component: | libvirt | Assignee: | Pavel Hrdina <phrdina> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | yalzhang <yalzhang> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 9.0 | CC: | jdenemar, phrdina, virt-maint |
| Target Milestone: | beta | Keywords: | Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-7.3.0-1.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-12-07 21:57:54 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: | 7.2.0 |
| Embargoed: | |||
Already fixed in upstream:
commit 1d9d9961ada6c2d0b9facae0ef8be4f459cf7fc9
Author: Pavel Hrdina <phrdina>
Date: Wed Mar 3 14:10:15 2021 +0100
vircgroup: enforce range limit for cpu.shares
Hi Pavel, Please help to confirm below results, it shows the value bigger than 10000 can not be accepted. Is that expected? # rpm -q libvirt libvirt-7.4.0-1.el9.x86_64 # virsh schedinfo rhel --set cpu_shares=10001 Scheduler : posix error: error from service: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Value specified in CPUWeight is out of range libvirtd log: 2021-06-08 03:04:49.648+0000: 45799: error : virGDBusCallMethod:243 : error from service: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Value specified in CPUWeight is out of range (In reply to yalzhang from comment #4) > Hi Pavel, Please help to confirm below results, it shows the value bigger > than 10000 can not be accepted. Is that expected? > > # rpm -q libvirt > libvirt-7.4.0-1.el9.x86_64 > > # virsh schedinfo rhel --set cpu_shares=10001 > Scheduler : posix > error: error from service: > GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Value specified in > CPUWeight is out of range > > libvirtd log: > 2021-06-08 03:04:49.648+0000: 45799: error : virGDBusCallMethod:243 : error > from service: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Value > specified in CPUWeight is out of range Hi Yalan, yes that is expected because cgroups v2 have different limits then cgroups v1. Test on rhel 9 with libvirt-7.3.0-1.el9.x86_64, all the results are expected, set the bug to be verified. 1. check the default value: # virsh schedinfo rh Scheduler : posix cpu_shares : 100 vcpu_period : 100000 vcpu_quota : 17592186044415 emulator_period: 100000 emulator_quota : 17592186044415 global_period : 100000 global_quota : 17592186044415 iothread_period: 100000 iothread_quota : 17592186044415 2. update the cpu_shares when guest is running: # virsh schedinfo rh --set cpu_shares=-5 Scheduler : posix error: invalid argument: shares '18446744073709551611' must be in range [2, 262144] # virsh schedinfo rh --set cpu_shares=0 Scheduler : posix error: invalid argument: shares '0' must be in range [2, 262144] # virsh schedinfo rh --set cpu_shares=1 Scheduler : posix error: invalid argument: shares '1' must be in range [2, 262144] # virsh schedinfo rh --set cpu_shares=2 Scheduler : posix cpu_shares : 2 vcpu_period : 100000 vcpu_quota : 17592186044415 emulator_period: 100000 emulator_quota : 17592186044415 global_period : 100000 global_quota : 17592186044415 iothread_period: 100000 # virsh schedinfo rh --set cpu_shares=10000 Scheduler : posix cpu_shares : 10000 vcpu_period : 100000 vcpu_quota : 17592186044415 emulator_period: 100000 emulator_quota : 17592186044415 global_period : 100000 global_quota : 17592186044415 iothread_period: 100000 iothread_quota : 17592186044415 # virsh schedinfo rh --set cpu_shares=10001 Scheduler : posix error: error from service: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Value specified in CPUWeight is out of range # virsh schedinfo rh --set cpu_shares=2621446 Scheduler : posix error: invalid argument: shares '2621446' must be in range [2, 262144] 3. Edit the cpu_share with virsh edit, invalid value outside of [2, 262144] will fail to validate and can not save successfully. 4. Check man page, the description is as expected: Note: The cpu_shares parameter has a valid value range of 2-262144. Test on rhel 9 with libvirt-7.3.0-1.el9.x86_64, all the results are expected, set the bug to be verified. 1. check the default value: # virsh schedinfo rh Scheduler : posix cpu_shares : 100 vcpu_period : 100000 vcpu_quota : 17592186044415 emulator_period: 100000 emulator_quota : 17592186044415 global_period : 100000 global_quota : 17592186044415 iothread_period: 100000 iothread_quota : 17592186044415 2. update the cpu_shares when guest is running: # virsh schedinfo rh --set cpu_shares=-5 Scheduler : posix error: invalid argument: shares '18446744073709551611' must be in range [2, 262144] # virsh schedinfo rh --set cpu_shares=0 Scheduler : posix error: invalid argument: shares '0' must be in range [2, 262144] # virsh schedinfo rh --set cpu_shares=1 Scheduler : posix error: invalid argument: shares '1' must be in range [2, 262144] # virsh schedinfo rh --set cpu_shares=2 Scheduler : posix cpu_shares : 2 vcpu_period : 100000 vcpu_quota : 17592186044415 emulator_period: 100000 emulator_quota : 17592186044415 global_period : 100000 global_quota : 17592186044415 iothread_period: 100000 # virsh schedinfo rh --set cpu_shares=10000 Scheduler : posix cpu_shares : 10000 vcpu_period : 100000 vcpu_quota : 17592186044415 emulator_period: 100000 emulator_quota : 17592186044415 global_period : 100000 global_quota : 17592186044415 iothread_period: 100000 iothread_quota : 17592186044415 # virsh schedinfo rh --set cpu_shares=10001 Scheduler : posix error: error from service: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Value specified in CPUWeight is out of range # virsh schedinfo rh --set cpu_shares=2621446 Scheduler : posix error: invalid argument: shares '2621446' must be in range [2, 262144] 3. Edit the cpu_share with virsh edit, invalid value outside of [2, 262144] will fail to validate and can not save successfully. 4. Check man page, the description is as expected: Note: The cpu_shares parameter has a valid value range of 2-262144. |
Description of problem: As rhel 9 uses cgroup v2 by default, the cpu_shares range has changed. So the documents need to be updated including the man page, and the formatdomain.html. And Please also check the results on rhel9 and confirm if they are expected. Version-Release number of selected component (if applicable): libvirt-7.0.0-4.el9.x86_64 How reproducible: 100% Steps to Reproduce: [test details on rhel 9] 1) set cpu_shares = -5, 0, or 10001 # virsh schedinfo rhel --set cpu_shares=-5 Scheduler : posix error: Unable to write to '/sys/fs/cgroup/machine.slice/machine-qemu\x2d82\x2drhel.scope/cpu.weight': Numerical result out of range 2) set cpu_shares = 1,2,500, it is set successfully, 1 will not be converted to 2: # virsh schedinfo rhel --set cpu_shares=1 Scheduler : posix cpu_shares : 1 ***** vcpu_period : 1000000 vcpu_quota : 1759218604 emulator_period: 100000 emulator_quota : 17592186044415 global_period : 100000 global_quota : 17592186044415 iothread_period: 1000 iothread_quota : 17592186044415 if edit the xml: 1) negative value: # virsh edit rhel ===> update to <shares>-3</shares> Failed. Try again? [y,n,i,f,?]: ====> press 'i' Domain 'rhel' XML configuration edited. # virsh dumpxml rhel |grep /cputune -B4 <shares>18446744073709551613</shares> # virsh start rhel error: Failed to start domain 'rhel' error: Unable to write to '/sys/fs/cgroup/machine.slice/machine-qemu\x2d85\x2drhel.scope/cpu.weight': Numerical result out of range 2) set to 0: # virsh dumpxml rhel |grep /cputune -B4 <shares>0</shares> # virsh start rhel error: Failed to start domain 'rhel' error: Unable to write to '/sys/fs/cgroup/machine.slice/machine-qemu\x2d84\x2drhel.scope/cpu.weight': Numerical result out of range 3) set the cpu_shares to 1, it will not automatically converted to a minimal value of 2: <cputune> <shares>1</shares> .... </cputune> # virsh start rhel Domain 'rhel' started # virsh schedinfo rhel Scheduler : posix cpu_shares : 1 4) set to 10001 # virsh dumpxml rhel |grep /cputune -B4 <shares>10001</shares> # virsh start rhel error: Failed to start domain 'rhel' error: Unable to write to '/sys/fs/cgroup/machine.slice/machine-qemu\x2d86\x2drhel.scope/cpu.weight': Numerical result out of range On rhel 9 with cgroup v2, the range of cpu_shares change to [1,10000], 0 is unacceptable, so does negative value. So the document needs to update: 1. man page: Note: The cpu_shares parameter has a valid value range of 0-262144; Negative values are wrapped to positive, and larger values are capped at the maximum. Therefore, -1 is a useful shorthand for 262144. On the Linux kernel, the values 0 and 1 are automatically converted to a minimal value of 2. Should change to: Note: The cpu_shares parameter has a valid value range of 1-10000;(delete as it is not true on rhel 9, see details below) 2. formatdomain.html shares ...... A VM configured with value 2048 will get twice as much CPU time as a VM configured with value 1024. The value should be in range [2, 262144] should update to: ...... A VM configured with value 2048 will get twice as much CPU time as a VM configured with value 1024. The value should be in range **[1, 10000]** Actual results: on rhel9, cpu_shares only accept value in [1, 10000], the value less than 0, or 0 are unacceptable. So the document needs to be updated. Expected results: As above Additional info: