PAPITopics:PAPI on Virtualization Platforms
From PAPIDocs
Jump to: navigation, search

Over the last ten years, virtualization techniques have become much more widely popular as a result of fast and cheap processors. Virtualization provides many benefits making it appealing for testing environments. Encapsulating configurations is a huge motivator for wanting to do performance testing on virtual machines. Provisioning is also simplified using virtual machines, a technique that is used by FutureGrid. However, virtualization does add a hardware abstraction layer. This prevents PAPI from directly reading the hardware PMU (Performance Monitoring Unit).

VMware and KVM both provide a virtual PMU given your configuration meets the requirements. This allows PAPI to function identically on the virtual machine guest operating system as on bare metal. Requirements are listed below. Performance tests comparing event counts on VMware or KVM versus bare metal can be found on the wiki at PAPITopics:Virtual PAPI Performance.

Contents

VMware

Requirements

  1. ESXi version must be 5.1 or higher.
  2. Virtual CPU Performance Counters must be enabled in the VM settings.
  3. Guest OS must be running Linux Kernel 2.6.32 or higher.
  4. Intel Nehalem Generation (Xeon Core i7) or later processor or AMD Opteron Generation 3 ("Greyhound") or later processor is installed.
  5. Intel VT-x or AMD-V is enabled in the BIOS so that hardware-assisted virtualization is possible.

VM Settings

Please refer to the vSphere documentation on how to enable virtual cpu performance counters using the vSphere Web Client. Instructions are duplicated below:

Prerequisites

  • Verify that the virtual machine is turned off.
  • Required Privileges: Virtual machine.Configuration.Settings is set on the vCenter Server system.

Procedure

  1. Right-click the virtual machine and select Edit Settings.
    1. To locate a virtual machine, select a datacenter, folder, cluster, resource pool, host, or vApp.
    2. Click the Related Objects tab and click Virtual Machines.
  2. On the Virtual Hardware tab, expand CPU and enable virtualized CPU performance counters.
  3. Click OK.

Installing PAPI

Pick up a tarball from our download page. Please refer to README.txt and INSTALL.txt in the root directory for instructions on compiling PAPI on your system. Note that no special flags should be required for running on the virtual machine. Proceed with building as if on a bare metal machine.

vMotion Caveat

If you are using vMotion, be aware that according to this VMWare kb article vMotion will only migrate virtual machine hosts between machines which have the same list of available performance monitoring events.

KVM

Requirements

  1. Host must be running Linux Kernel 3.3 or higher.
  2. Qemu-kvm must be version 1.2.5 or higher.
  3. Intel CPU
  4. VM must be booted with -cpu host

Linux Kernel

Support for performance counters inside KVM guests was introduced by a patch incorporated into the 3.3 Linux Kernel. PAPITopics:Virtual PAPI Performance as well as PAPITopics:Steal Time on Virtual Machines tests were run in linux kernel 3.6. Your results may vary depending on linux kernel version.

Qemu-kvm

Qemu-kvm 1.2.5 is the earliest known version to support performance counters. Note, not all linux distribution repositories contain a sufficiently up-to-date version of qemu-kvm. Recent versions of Qemu-kvm may be downloaded from the Qemu Download Page.

CPU

Virtual PMU support currently exists only for Intel CPUs. Hopefully AMD support will be available soon.

Parameters

The guest OS must be booted with the -cpu host flag. This ensures that the virtual CPU model replicates the CPU model of the host machine. This is required for supporting performance events.

Installing PAPI

Pick up a tarball from our download page. Please refer to README.txt and INSTALL.txt in the root directory for instructions on compiling PAPI on your system. Note that no special flags should be required for running on the virtual machine. Proceed with building as if on a bare metal machine.