.. SPDX-License-Identifier: BSD-3-Clause Copyright(c) 2015-2017 Intel Corporation ========================= 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() below: - ``/sys/devices/system/cpu/cpu/cpufreq/scaling_governor`` - ``/sys/devices/system/cpu/cpu/cpufreq/scaling_available_frequencies`` - ``/sys/devices/system/cpu/cpu/cpufreq/scaling_cur_freq`` - ``/sys/devices/system/cpu/cpu/cpufreq/scaling_setspeed`` Prerequisites ============= 1. Hardware: - CPU: Haswell, IVB(CrownPass) - NIC: 82599 2. 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 3. OS and Kernel: - Fedora 20 - Enable Kernel features Huge page, UIO, IOMMU, KVM - Enable Intel IOMMU in kernel command - Disable Selinux - Disable intel_pstate 3. Virtualization: - QEMU emulator version 1.6.1 - libvirtd (libvirt) 1.1.3.5 - Add virio-serial port Test Case 1: VM Power Management Channel ======================================== 1. Configure VM XML to pin VCPUs/CPUs: .. code-block:: xml 5 2. 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. .. code-block:: xml
3. Run dpdk-guest_cli in Host:: .//examples/dpdk-guest_cli -c 0x3 -n 4 4. Startup VM and run dpdk-guest_cli:: .//examples/dpdk-guest_cli -c 0x1f -n 4 -- -i 5. Add vm in host and check dpdk-vm_power_manager can get frequency normally:: vmpower> add_vm vmpower> add_channels all vmpower> show_cpu_freq 6. Check vcpu/cpu mapping can be detected normally:: vmpower> show_vm VM: vCPU Refresh: 1 Channels 5 [0]: /tmp/powermonitor/.0, status = 1 [1]: /tmp/powermonitor/.1, status = 1 [2]: /tmp/powermonitor/.2, status = 1 [3]: /tmp/powermonitor/.3, status = 1 [4]: /tmp/powermonitor/.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 7. Run dpdk-guest_cli in vm:: .//examples/dpdk-guest_cli -c 0x1f -n 4 Check monitor channel for all cores has been connected. Test Case 2: VM Power Management Numa ===================================== 1. Get core and socket information by cpu_layout: ./tools/cpu_layout.py 2. Configure VM XML to pin VCPUs on Socket1: 3. Repeat Case1 steps 3-7 sequentially 4. Check vcpu/cpu mapping can be detected normally Test Case 3: VM Scale CPU Frequency Down ======================================== 1. Setup VM power management environment 2. Send cpu frequency down hints to Host:: vmpower(guest)> set_cpu_freq 0 down 3. Verify the frequency of physical CPU has been set down correctly:: vmpower> show_cpu_freq 1 Core 1 frequency: 2700000 4. Check other CPUs' frequency is not affected by change above 5. check if the other VM works fine (if they use different CPUs) 6. Repeat step2-5 several times Test Case 4: VM Scale CPU Frequency UP ====================================== 1. Setup VM power management environment 2. Send cpu frequency down hints to Host:: vmpower(guest)> set_cpu_freq 0 up 3. Verify the frequency of physical CPU has been set up correctly:: vmpower> show_cpu_freq 1 Core 1 frequency: 2800000 4. Check other CPUs' frequency is not affected by change above 5. check if the other VM works fine (if they use different CPUs) 6. Repeat step2-5 several times Test Case 5: VM Scale CPU Frequency to Min ========================================== 1. Setup VM power management environment 2. Send cpu frequency scale to minimum hints.:: vmpower(guest)> set_cpu_freq 0 min 3. Verify the frequency of physical CPU has been scale to min correctly:: vmpower> show_cpu_freq 1 Core 1 frequency: 1200000 4. Check other CPUs' frequency is not affected by change above 5. check if the other VM works fine (if they use different CPUs) Test Case 6: VM Scale CPU Frequency to Max ========================================== 1. Setup VM power management environment 2. Send cpu frequency down hints to Host:: vmpower(guest)> set_cpu_freq 0 max 3. Verify the frequency of physical CPU has been set to max correctly:: vmpower> show_cpu_freq 1 Core 1 frequency: 2800000 4. Check other CPUs' frequency is not affected by change above 5. check if the other VM works fine (if they use different CPUs)