201. VM Power Management Tests¶
This test plan is for the test and validation of feature VM Power Management of DPDK 1.8.
VM Power Manager would use a hint based mechanism by which a VM can communicate to a host based governor about its current processing requirements. By mapping VMs virtual CPUs to physical CPUs the Power Manager can then make decisions according to some policy as to what power state the physical CPUs can transition to.
VM Agent shall have the ability to send the following hints to host: - Scale frequency down - Scale frequency up - Reduce frequency to min - Increase frequency to max
The Power manager is responsible for enabling the Linux userspace power governor and interacting via its sysfs entries to get/set frequencies.
The power manager will manage the file handles for each core(<n>) below:
/sys/devices/system/cpu/cpu<n>/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu<n>/cpufreq/scaling_available_frequencies
/sys/devices/system/cpu/cpu<n>/cpufreq/scaling_cur_freq
/sys/devices/system/cpu/cpu<n>/cpufreq/scaling_setspeed
201.1. Prerequisites¶
Hardware:
- CPU: Haswell, IVB(CrownPass)
- NIC: 82599
BIOS:
- Enable VT-d and VT-x
- Enable Enhanced Intel SpeedStep(R) Tech
- Disable Intel(R) Turbo Boost Technology
- Enable Processor C3
- Enable Processor C6
- Enable Intel(R) Hyper-Threading Tech
OS and Kernel:
- Fedora 20
- Enable Kernel features Huge page, UIO, IOMMU, KVM
- Enable Intel IOMMU in kernel command
- Disable Selinux
- Disable intel_pstate
Virtualization:
- QEMU emulator version 1.6.1
- libvirtd (libvirt) 1.1.3.5
- Add virio-serial port
201.2. Test Case 1: VM Power Management Channel¶
Configure VM XML to pin VCPUs/CPUs:
<vcpu placement='static'>5</vcpu> <cputune> <vcpupin vcpu='0' cpuset='1'/> <vcpupin vcpu='1' cpuset='2'/> <vcpupin vcpu='2' cpuset='3'/> <vcpupin vcpu='3' cpuset='4'/> <vcpupin vcpu='4' cpuset='5'/> </cputune>
Configure VM XML to set up virtio serial ports
Create temporary folder for vm_power socket.
mkdir /tmp/powermonitor
Setup one serial port for every one vcpu in VM.
<channel type='unix'> <source mode='bind' path='/tmp/powermonitor/<vm_name>.<channel_num>'/> <target type='virtio' name='virtio.serial.port.poweragent.<channel_num>'/> <address type='virtio-serial' controller='0' bus='0' port='4'/> </channel>
Run dpdk-guest_cli in Host:
./<build_target>/examples/dpdk-guest_cli -c 0x3 -n 4
Startup VM and run dpdk-guest_cli:
./<build_target>/examples/dpdk-guest_cli -c 0x1f -n 4 -- -i
Add vm in host and check dpdk-vm_power_manager can get frequency normally:
vmpower> add_vm <vm_name> vmpower> add_channels <vm_name> all vmpower> show_cpu_freq <core_num>
Check vcpu/cpu mapping can be detected normally:
vmpower> show_vm <vm_name> VM: vCPU Refresh: 1 Channels 5 [0]: /tmp/powermonitor/<vm_name>.0, status = 1 [1]: /tmp/powermonitor/<vm_name>.1, status = 1 [2]: /tmp/powermonitor/<vm_name>.2, status = 1 [3]: /tmp/powermonitor/<vm_name>.3, status = 1 [4]: /tmp/powermonitor/<vm_name>.4, status = 1 Virtual CPU(s): 5 [0]: Physical CPU Mask 0x2 [1]: Physical CPU Mask 0x4 [2]: Physical CPU Mask 0x8 [3]: Physical CPU Mask 0x10 [4]: Physical CPU Mask 0x20
Run dpdk-guest_cli in vm:
./<build_target>/examples/dpdk-guest_cli -c 0x1f -n 4
Check monitor channel for all cores has been connected.
201.3. Test Case 2: VM Power Management Numa¶
Get core and socket information by cpu_layout:
./tools/cpu_layout.py
Configure VM XML to pin VCPUs on Socket1:
Repeat Case1 steps 3-7 sequentially
Check vcpu/cpu mapping can be detected normally
201.4. Test Case 3: VM Scale CPU Frequency Down¶
Setup VM power management environment
Send cpu frequency down hints to Host:
vmpower(guest)> set_cpu_freq 0 down
Verify the frequency of physical CPU has been set down correctly:
vmpower> show_cpu_freq 1 Core 1 frequency: 2700000
Check other CPUs’ frequency is not affected by change above
check if the other VM works fine (if they use different CPUs)
Repeat step2-5 several times
201.5. Test Case 4: VM Scale CPU Frequency UP¶
Setup VM power management environment
Send cpu frequency down hints to Host:
vmpower(guest)> set_cpu_freq 0 up
Verify the frequency of physical CPU has been set up correctly:
vmpower> show_cpu_freq 1 Core 1 frequency: 2800000
Check other CPUs’ frequency is not affected by change above
check if the other VM works fine (if they use different CPUs)
Repeat step2-5 several times
201.6. Test Case 5: VM Scale CPU Frequency to Min¶
Setup VM power management environment
Send cpu frequency scale to minimum hints.:
vmpower(guest)> set_cpu_freq 0 min
Verify the frequency of physical CPU has been scale to min correctly:
vmpower> show_cpu_freq 1 Core 1 frequency: 1200000
Check other CPUs’ frequency is not affected by change above
check if the other VM works fine (if they use different CPUs)
201.7. Test Case 6: VM Scale CPU Frequency to Max¶
Setup VM power management environment
Send cpu frequency down hints to Host:
vmpower(guest)> set_cpu_freq 0 max
Verify the frequency of physical CPU has been set to max correctly:
vmpower> show_cpu_freq 1 Core 1 frequency: 2800000
Check other CPUs’ frequency is not affected by change above
check if the other VM works fine (if they use different CPUs)