Author: Chris Irwin

# libvirt + kvm

### Chris Irwin

#### Kitchener/Waterloo Linux User Group

# Resources

- chrisirwin.ca
- This presentation on gitorious

# What is kvm?

- Virtual Machine Technology
- Included in Linux Kernel

# Why use kvm?

- Free
- Faster than qemu
- Favoured by Red Hat, Canonical (and apparently IBM)
- Already part of Fedora, Ubuntu, Debian, *

# Features

- Kernel SamePage Merging (2.6.32)
- Migration
- Optional "VirtIO" Paravirt for Linux and Windows
- Hardware passthrough, maybe (if you're lucky)

- KVM Features
- USB Passthrough
- VT-d Hardware Passthrough

# Linux + KVM

# Linux + KVM Paravirtualization

# What is libvirt?

- Virtualization abstraction library

- Designed by Red Hat
- kvm
- qemu
- xen
- And More!

# Why use libvirt with kvm?

- kvm does actual virtualization
- libvirt allows you to manage kvm
- VirtualBox, VMWare, etc. provide both together
- libvirt allows for both CLI and GUI utilities

# Linux + KVM

# Example One

- Creating a virtual machine with virt-manager

# Kernel SamePage Merging

- run: disable, enable, undo KSM
- pages_shared: How many shared pages are being used
- pages_sharing: How many more sites are sharing them (How much saved)
- pages_unshared: Unique pages that are considered for merging
- pages_volatile: Pages that change too fast
- full_scans: Number of scans on all mergeable areas

- KSM information
- IBM Developerworks article on KSM

# Kernel SamePage Merging

- > Izik Eidus adds that, with this patch, a host running a bunch of Windows guests is able to overcommit its memory 300% without terribly ill effects. This technique, it seems, is especially effective with Windows guests: Windows apparently zeroes all freed memory, so each guest's list of free pages can be coalesced down to a single, shared page full of zeroes.

  Jonathan Corbet, LWN.net

- KSM information

# Example Two

- Ubuntu's Testdrive

# Example Three

- Ubuntu's vmbuilder

# General Issues

- Pros
  - Big players starting to push
  - Unix Philosophy (Smaller tools)
  - Paravirtualization where possible
  - How you want it is how you get it

# General Issues

- Cons
  - Big players pushing differently
  - Unix Philosophy (Smaller tools)
  - Paravirtualization only for Linux, Windows
  - Research required for advanced topics

# Intel Issues

- Pros
  - ...?
- Cons
  - vt-d support requires planning and luck
  - No vt-x nesting (yet?)
  - Intel segments it's products based on features including vt-x

# AMD Issues

- Pros
  - Easier to get AMD-V
  - KVM Nesting
- Cons
  - IOMMU on even fewer machines than intel's vt-d