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