CSIT-1488: Add data to the Report 1904
[csit.git] / docs / report / introduction / methodology_kvm_vms_vhost_user.rst
1 KVM VMs vhost-user
2 ------------------
3
4 QEMU is used for KVM VM vhost-user testing enviroment. By default,
5 standard QEMU version is used, preinstalled from OS repositories
6 (qemu-2.11.1 for Ubuntu 18.04, qemu-2.5.0 for Ubuntu 16.04). The path
7 to the QEMU binary can be adjusted in `Constants.py`.
8
9 FD.io CSIT performance lab is testing VPP vhost-user with KVM VMs using
10 following environment settings:
11
12 - Tests with varying QEMU virtio queue (a.k.a. vring) sizes: [vr1024]
13   1024 descriptors to optimize for packet throughput.
14 - Tests with varying Linux :abbr:`CFS (Completely Fair Scheduler)`
15   settings: i) [cfs] default settings, ii) [cfsrr1] CFS RoundRobin(1)
16   policy applied to all data plane threads handling test packet path
17   including all VPP worker threads and all QEMU testpmd poll-mode
18   threads.
19 - Resulting test cases are all combinations with [vr1024] and
20   [cfs,cfsrr1] settings.
21 - Adjusted Linux kernel :abbr:`CFS (Completely Fair Scheduler)`
22   scheduler policy for data plane threads used in CSIT is documented in
23   `CSIT Performance Environment Tuning wiki
24   <https://wiki.fd.io/view/CSIT/csit-perf-env-tuning-ubuntu1604>`_.
25
26 Testing with different CFS settings enables verifying the impact of
27 making VPP and VM data plane threads less susceptible to other Linux OS
28 system tasks hijacking CPU cores running those data plane threads.
29
30 CSIT supports two types of VMs: 
31
32 - **Image-VM**: used for all functional, VPP_device, and regular
33   performance tests except NFV density tests.
34
35 - **Kernel-VM**: new VM type introduced for NFV density tests to provide
36   greater in-VM application install flexibility and to further reduce
37   test execution time by simpler VM lifecycle management.
38
39 Image-VM
40 ~~~~~~~~
41
42 CSIT can use a pre-created VM image. The path to the image can be
43 adjusted in `Constants.py`. For convenience and full compatibility CSIT
44 repository contains a set of scripts to prepare `Built-root
45 <https://buildroot.org/>`_ based embedded Linux image with all the
46 dependencies needed to run DPDK Testpmd, DPDK L3Fwd, Linux bridge or
47 Linux IPv4 forwarding.
48
49 Built-root was chosen for a VM image to make it lightweight and with
50 fast booting time to limit impact on tests duration.
51
52 In order to execute CSIT tests, VM image must have following software
53 installed: qemu-guest-agent, sshd, bridge-utils, VirtIO support and DPDK
54 Testpmd/L3fwd applications. Username/password for the VM must be
55 ``cisco``/``cisco`` and ``NOPASSWD`` sudo access. The interface naming
56 is based on the driver (management interface type is Intel E1000), all
57 E1000 interfaces will be named ``mgmt<n>`` and all VirtIO interfaces
58 will be named ``virtio<n>``. In VM ``/etc/init.d/qemu-guest-agent`` must
59 be set to ``TRANSPORT=isa-serial:/dev/ttyS1`` because ttyS0 is used by
60 serial console and ttyS1 is dedicated for qemu-guest-agent in QEMU
61 setup.
62
63 Kernel-VM
64 ~~~~~~~~~
65
66 CSIT can use a kernel KVM image as a boot kernel, as an alternative to
67 image VM. This option allows better configurability of what application
68 is running in VM userspace. Using root9p filesystem allows mapping the
69 host-OS filesystem as read only guest-OS filesystem.
70
71 Example of custom init script for the kernel-VM:
72
73 ::
74
75   #!/bin/bash
76   mount -t sysfs -o "nodev,noexec,nosuid" sysfs /sys
77   mount -t proc -o "nodev,noexec,nosuid" proc /proc
78   mkdir /dev/pts
79   mkdir /dev/hugepages
80   mount -t devpts -o "rw,noexec,nosuid,gid=5,mode=0620" devpts /dev/pts || true
81   mount -t tmpfs -o "rw,noexec,nosuid,size=10%,mode=0755" tmpfs /run
82   mount -t tmpfs -o "rw,noexec,nosuid,size=10%,mode=0755" tmpfs /tmp
83   mount -t hugetlbfs -o "rw,relatime,pagesize=2M" hugetlbfs /dev/hugepages
84   echo 0000:00:06.0 > /sys/bus/pci/devices/0000:00:06.0/driver/unbind
85   echo 0000:00:07.0 > /sys/bus/pci/devices/0000:00:07.0/driver/unbind
86   echo uio_pci_generic > /sys/bus/pci/devices/0000:00:06.0/driver_override
87   echo uio_pci_generic > /sys/bus/pci/devices/0000:00:07.0/driver_override
88   echo 0000:00:06.0 > /sys/bus/pci/drivers/uio_pci_generic/bind
89   echo 0000:00:07.0 > /sys/bus/pci/drivers/uio_pci_generic/bind
90   $vnf_bin
91   poweroff -f
92
93 QemuUtils library during runtime replaces the ``$vnf_bin`` variable by
94 the path to NF binary and its parameters. This allows CSIT to run any
95 application installed on host OS, for example the same version of VPP
96 as running on the host-OS.
97
98 Kernel-VM image must be available in the host filesystem as a
99 prerequisite. The path to kernel-VM image is defined in `Constants.py`.