Bug 1244128
| Summary: | Setvcpu should inherit the cputune value in cgroups was set before via schedinfo | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Pei Zhang <pzhang> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.2 | CC: | dyuan, lhuang, mzhan, pkrempa, rbalakri, xuzhang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.3.2-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-11-03 18:19:53 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: | |||
Fixed upstream:
commit c6bd15026bc14c7a3a6c9f6d8d9758fdefbf81fe
Author: Peter Krempa <pkrempa>
Date: Wed Jan 13 17:00:54 2016 +0100
qemu: vcpu: Reuse qemuProcessSetupVcpu in vcpu hotplug
Since majority of the steps is shared, the function can be reused to
simplify code.
Additionally this resolves
https://bugzilla.redhat.com/show_bug.cgi?id=1244128 since the cpu
bandwidth limiting with cgroups would not be set on the hotplug path.
Additionally the code now sets the thread affinity and honors autoCpuset
as in the regular startup code path.
commit 56971667ee4a5a5f68987be84b3c1461537451de
Author: Peter Krempa <pkrempa>
Date: Wed Jan 13 16:36:52 2016 +0100
qemu: vcpu: Aggregate code to set vCPU tuning
Rather than iterating 3 times for various settings this function
aggregates all the code into single place. One of the other advantages
is that it can then be reused for properly setting vCPU info on hotplug.
With this approach autoCpuset is also used when setting the process
affinity rather than just via cgroups.
v1.3.1-164-gc6bd150
Verify version:
libvirt-2.0.0-2.el7.x86_64
Verify steps :
1. define a guest, set cputune
# virsh schedinfo vm1 --set vcpu_quota=1000000000 --config
Scheduler : posix
cpu_shares : 0
vcpu_period : 0
vcpu_quota : 1000000000
emulator_period: 0
emulator_quota : 0
global_period : 0
global_quota : 0
2. change vcpu numbers, start guest
# virsh setvcpus vm1 4 --config
# virsh start vm1
Domain vm1 started
# virsh dumpxml vm1|grep cputune -A 5
<cputune>
<quota>1000000000</quota>
......
# virsh schedinfo vm1
Scheduler : posix
cpu_shares : 1024
vcpu_period : 100000
vcpu_quota : 1000000000
emulator_period: 100000
emulator_quota : -1
global_period : 100000
global_quota : -1
3. check values in cgroup
# cat /sys/fs/cgroup/cpu\,cpuacct/machine.slice/machine-qemu\\x2d15\\x2dvm1.scope/vcpu0/cpu.cfs_quota_us
1000000000
as above, cat value in vcpu1, vcpu2, vcpu3
4. Using setvcpus to change the number of vcpu
# virsh setvcpus vm1 6 --live
check in cgroup again :
# cat /sys/fs/cgroup/cpu\,cpuacct/machine.slice/machine-qemu\\x2d15\\x2dvm1.scope/vcpu4/cpu.cfs_quota_us
1000000000
# cat /sys/fs/cgroup/cpu\,cpuacct/machine.slice/machine-qemu\\x2d15\\x2dvm1.scope/vcpu5/cpu.cfs_quota_us
1000000000
Now the value can be set on hot plug path, move this bug to verified.
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, 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://rhn.redhat.com/errata/RHSA-2016-2577.html |
Description of problem: when I use command "setvcpu" to change the vcpus of a guest, I think the new vcpus should also inherit the cputune value I set for vcpu before . because I don't think I can set new cputune value for each vcpu in cgroups(via virsh command ) or domain xml . If I use setvcpu first , then the cputune value was set via schedinfo will be set into each vcpu in cgroups . Version-Release number of selected component (if applicable): libvirt-1.2.17-2.el7.x86_64 qemu-kvm-rhev-2.3.0-10.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.define and start a guest like following # virsh dumpxml r7.2-new | grep cpu -A 9 <vcpu placement='static' current='1'>7</vcpu> # virsh schedinfo r7.2-new Scheduler : posix cpu_shares : 1024 vcpu_period : 100000 vcpu_quota : -1 emulator_period: 100000 emulator_quota : -1 2.set schedinfo value for guest # virsh schedinfo r7.2-new --set vcpu_quota=1111 Scheduler : posix cpu_shares : 1024 vcpu_period : 100000 vcpu_quota : 1111 emulator_period: 100000 emulator_quota : -1 check in cgroup : # cat /sys/fs/cgroup/cpu/machine.slice/machine-qemu\\x2dr7.2\\x2dnew.scope/vcpu0/cpu.cfs_quota_us 1111 3.Using setvcpus to change guest vcpu # virsh setvcpus r7.2-new 4 --live # virsh dumpxml r7.2-new | grep cpu -A 9 <vcpu placement='static' current='4'>7</vcpu> <cputune> <quota>1111</quota> </cputune> check in cgroup : # cat /sys/fs/cgroup/cpu/machine.slice/machine-qemu\\x2dr7.2\\x2dnew.scope/vcpu0/cpu.cfs_quota_us 1111 # cat /sys/fs/cgroup/cpu/machine.slice/machine-qemu\\x2dr7.2\\x2dnew.scope/vcpu1/cpu.cfs_quota_us -1 # cat /sys/fs/cgroup/cpu/machine.slice/machine-qemu\\x2dr7.2\\x2dnew.scope/vcpu2/cpu.cfs_quota_us -1 # cat /sys/fs/cgroup/cpu/machine.slice/machine-qemu\\x2dr7.2\\x2dnew.scope/vcpu3/cpu.cfs_quota_us -1 Actual results: As step3 , the new vcpus in cgroup cannot get vcpu_quota I set before . Expected results: The new vcpus should inherit the cputune value I set before . Additional info: