KVM

From KVM

Contents

How tuning the kernel

What are the kernel options necessary or useful to use KVM, how to optimize or tune the kernel for the host or the guest ?

In the case of paravirtualization, virtio is used as a driver of the guest kernel, and a QEMU / KVM backend of the host.

Kernel for host

The host is the system that runs QEMU / KVM, it hosts the guest systems.

The kernel needs to be configured with

- VIRTUALIZATION

Options for Linux host to run other operating systems inside virtual machines (guests)

- KVM (Location : Virtualization)

Support hosting fully virtualized guest machines using hardware virtualization extensions

- KVM_INTEL (Location : Virtualization)

Support for Intel processors with VT-x virtualization support (Vanderpool), CPU flag : vmx

- KVM_AMD (Location : Virtualization)

Support for AMD processors with AMD-V virtualization support (Pacifica), CPU flag : svm

Useful options for the kernel of the host

- VHOST_NET (Location : Virtualization)

Driver for host kernel to accelerate guest networking with virtio_net (guest drive).

- HIGH_RES_TIMER (Location : Processor type and features)

High Resolution Timer Support

- HPET (Location : Device Drivers -> Character devices)

High Precision Event Timer

- COMPACTION (Location : Processor type and features)

Allows the compaction of memory for the allocation of huge pages

- MIGRATION (Location : Processor type and features)

Allows the migration of the physical location of pages of processes while the virtual addresses are not changed. This is useful when allocating huge pages as migration can relocate pages to satisfy a huge page allocation instead of reclaiming.

- KSM (Location : Processor type and features)

Enable Kernel Samepage Merging: KSM periodically scans those areas of an application's address space that an app has advised may be mergeable. When it finds pages of identical content, it replaces the many instances by a single page with that content, so saving memory until one or another app needs to modify the content. KSM is inactive until a program has madvised that an area is MADV_MERGEABLE, and root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).

A daemon as "ksmtuned" can be used to tuning KSM.

- TRANSPARENT_HUGEPAGE (Location : Processor type and features)

Transparent Hugepages allows the kernel to use huge pages and huge tlb transparently to the applications whenever possible. This feature can improve computing performance to certain applications by speeding up page faults during memory allocation, by reducing the number of tlb misses and by speeding up the pagetable walking.

- CGROUPS (Location : General setup)

The cgroup allow you to control the distribution of resources (processors, cores, memory, IO) at different VM.

Kernel for guest with paravirtualization

- VIRTIO

Selected by VIRTIO_PCI or VIRTIO_BALLOON

- VIRTIO_NET (Location : Device Drivers -> Network device support)

The virtual network driver for virtio : Paravirtualized Network Device.

- VIRTIO_BLK (Location : Device Drivers -> Block devices)

The virtual block driver for virtio : Paravirtualized Block Device.

- VIRTIO_PCI (Location : Virtualization)

This drivers provides support for virtio based paravirtual device drivers over PCI. This requires that your VMM has appropriate PCI virtio backends.

- VIRTIO_BALLOON (Location : Virtualization)

This driver supports increasing and decreasing the amount of memory within a KVM guest.

- VIRTIO_RING

Selected by VIRTIO_PCI or VIRTIO_BALLOON

- VIRTIO_CONSOLE (Location : Device Drivers -> Character devices)

Serves as a general-purpose serial device for data transfer between the guest and host. Character devices at /dev/vportNpn will be created when corresponding ports are found, where N is the device number and n is the port number within that device. If specified by the host, a sysfs attribute called 'name' will be populated with a name for the port which can be used by udev scripts to create a symlink to the device.

- HW_RANDOM_VIRTIO (Location : Device Drivers -> Character devices -> Hardware Random Number Generator Core support)

This driver provides kernel-side support for the virtual Random Number Generator hardware.

- PCI_MSI (Location : Bus options (PCI etc.))

This allows device drivers to enable MSI (Message SignaledInterrupts). Message Signaled Interrupts enable a device togenerate an interrupt using an inbound Memory Write on its PCI bus instead of asserting a device IRQ pin.

- PARAVIRT_GUEST (Location : Processor type and features)

Options for paravirtualized Linux guest

- KVM_CLOCK (Location : Processor type and features-> Paravirtualized guest support)

Instead of relying on a PIT (or probably other) emulation by the underlying device model, the host provides the guest with timing infrastructure such as time of day, and system time

- KVM_GUEST (Location : Processor type and features-> Paravirtualized guest support)

This option enables various optimizations for running under the KVM hypervisor.

- PARAVIRT (Location : Processor type and features-> Paravirtualized guest support)

This changes the kernel so it can modify itself when it is run under a hypervisor, potentially improving performance significantly over full virtualization. However, when run without a hypervisor the kernel is theoretically slower and slightly larger.

- MEMORY_HOTPLUG (Location : Processor type and features)

- MEMORY_HOTREMOVE (Location : Processor type and features -> Allow for memory hot-add)

- PROCESSOR_FAMILY (Location : Processor type and features)

Core2 ou generic_x86_64 ?

This may depend on how we run qemu : qemu -cpu host

http://www.linux-kvm.org/page/Tuning_KVM

- ACPIPHP

- PCI_HOTPLUG

PCI Hotplug support for the guest, to add a disk or a network card on the fly.

http://www.linux-kvm.org/page/Hotadd_pci_devices

Views Article Discussion Edit History
Personal tools:  Log in / create account
Toolbox What links here Related changes Upload file Special pages Printable version