Difference between revisions of "ERIKA3 on the Xen hypervisor"

From ERIKA WIKI
Jump to: navigation, search
Line 1: Line 1:
=== Introduction ===
+
== Introduction ==
  
[https://www.xenproject.org| '''Xen'''] is an open-source type-1 or baremetal hypervisor.  
+
[https://www.xenproject.org| '''Xen'''] is an open-source type-1 or bare-metal hypervisor that runs directly on the hardware and is responsible for handling CPU, memory, timers and interrupts.  
  
Xen runs directly on the hardware and is responsible for handling CPU, memory, timers and interrupts. The hypervisor is started by the boot loader and, once it is loaded, it starts the privileged domain '''Dom0''' (short for "domain 0") containing the drivers of the system devices. Once Dom0 has started, one or more user domains, referred to as '''DomU''', can be started and controlled in the Dom0. Xen supports both para-virtualized (PV) and fully hardware virtualized (HVM) user domains.
+
The hypervisor is started by the boot loader and, once it is loaded, it starts the privileged domain '''Dom0''' (short for "domain 0") containing the drivers of the system devices. Once Dom0 has started, one or more user domains, referred to as '''DomU''', can be started and controlled in the Dom0. Xen supports both para-virtualized (PV) and fully hardware virtualized (HVM) user domains.
  
 
This tutorial will explain how to build and run ERIKA3 as Xen hardware-virtualized DomU on the x86-64 platform.
 
This tutorial will explain how to build and run ERIKA3 as Xen hardware-virtualized DomU on the x86-64 platform.
  
 
== Build ERIKA3 for Xen ==
 
== Build ERIKA3 for Xen ==
 +
Building ERIKA3 for Xen requires building an ERIKA3 image for bare-metal as described [http://www.erika-enterprise.com/wiki/index.php?title=Bare-metal_x86-64_image here].
  
 
== ERIKA3 Xen configuration ==
 
== ERIKA3 Xen configuration ==
 +
This section defines the configuration parameters that are used for running ERIKA3 as Xen DomU. Note that according to Xen configuration syntax, comment lines starts with the '#' symbol. 
  
== Run ERIKA3 as XEN HVM DomU ==
+
<b>ERIKA3 Xen basic configuration</b>
 +
Xen configuration has to include basic parameters, such as domain name, memory requirements, virtualization modes and interfaces definition.
 +
 
 +
Name of domain (must be unique):
 +
  # Name
 +
  name = "erika"
 +
 
 +
Initial memory allocation (MB) for ERIKA3 (should be at least 2M):
 +
  # Memory and related
 +
  memory = 2048
 +
  maxmem = 2048
 +
 
 +
Boot disk (where <code>$ERIKA3_PATH</code> is the path of the ERIKA3 bare-metal image):
 +
  ## Boot
 +
  disk = [ 'file:/home/evidence/erika3/erika3.iso,hdc:cdrom,r' ]
 +
  boot = "c"
 +
 
 +
Virtualization mode:
 +
  ## Virtualization type
 +
  type = "hvm"
 +
 
 +
Enable Xen console:
 +
  serial = "pty"
 +
 
 +
Network interfaces:
 +
  ## Network
 +
  vif = [ "mac=00:16:3e:51:fe:67,bridge=xenbr0,script=vif-bridge" ]
 +
 
 +
Domain exit behavior settings:
 +
  ## Behaviour
 +
  on_poweroff = "preserve"
 +
  on_reboot = "destroy"
 +
  on_crash = "destroy"
 +
 
 +
<b>(optional) ERIKA3 CPUs configuration</b>
 +
In order to tune ERIKA3 DomU, Xen configuration could include CPUs affinity in order to pin ERIKA on a given CPU. Note that current implementation of ERIKA3 on x86-64 is single-core. Thus, the number of virtual CPUs is 1. Such virtual CPU can be pinned to a given physical CPU.
 +
Furthermore, Xen configuration can allow to create the ERIKA3 DomU and to assign a given Cpupool at creation. Cpupools allows to divide the physical cpus into distinct groups so that each pool can have its entirely separate scheduler (e.g., null-scheduler).
 +
 
 +
Number of virtual CPUs to use (default is 1):
 +
  #Virtual CPUs
 +
  vcpus = 1
 +
 
 +
List of which CPUs this domain is allowed to use (in the example, it is the CPU with identifier 3):
 +
  #CPUs, Hard affinity
 +
  cpus = ['3']
 +
 
 +
In case the chosen
 +
pool="NullPool"
 +
 
 +
=== ERIKA3 Xen Passthrough ===
 +
In order to give control of physical devices to ERIKA3 domU, Xen configuration should include the configuration for PCI passthrough. Note that the chosen PCI device has to be "assignable".
 +
 
 +
For example, the Xen configuration to allow the PCI passthrough for the Ethernet device with '00:1f.6' as BDF:
 +
  ## ETH1 Passthrough
 +
  pci_permissive=1
 +
  pci = ['00:1f.6']
  
  
 +
== Run ERIKA3 as XEN HVM DomU ==
  
 
[[Category:Hypervisors]]
 
[[Category:Hypervisors]]

Revision as of 18:34, 26 November 2018

Introduction

Xen is an open-source type-1 or bare-metal hypervisor that runs directly on the hardware and is responsible for handling CPU, memory, timers and interrupts.

The hypervisor is started by the boot loader and, once it is loaded, it starts the privileged domain Dom0 (short for "domain 0") containing the drivers of the system devices. Once Dom0 has started, one or more user domains, referred to as DomU, can be started and controlled in the Dom0. Xen supports both para-virtualized (PV) and fully hardware virtualized (HVM) user domains.

This tutorial will explain how to build and run ERIKA3 as Xen hardware-virtualized DomU on the x86-64 platform.

Build ERIKA3 for Xen

Building ERIKA3 for Xen requires building an ERIKA3 image for bare-metal as described here.

ERIKA3 Xen configuration

This section defines the configuration parameters that are used for running ERIKA3 as Xen DomU. Note that according to Xen configuration syntax, comment lines starts with the '#' symbol.

ERIKA3 Xen basic configuration Xen configuration has to include basic parameters, such as domain name, memory requirements, virtualization modes and interfaces definition.

Name of domain (must be unique):

 # Name 
 name = "erika"

Initial memory allocation (MB) for ERIKA3 (should be at least 2M):

 # Memory and related 
 memory = 2048
 maxmem = 2048

Boot disk (where $ERIKA3_PATH is the path of the ERIKA3 bare-metal image):

 ## Boot
 disk 	= [ 'file:/home/evidence/erika3/erika3.iso,hdc:cdrom,r' ]
 boot 	= "c"

Virtualization mode:

 ## Virtualization type
 type = "hvm"

Enable Xen console:

 serial = "pty"

Network interfaces:

 ## Network
 vif	 = [ "mac=00:16:3e:51:fe:67,bridge=xenbr0,script=vif-bridge" ]

Domain exit behavior settings:

 ## Behaviour
 on_poweroff = "preserve"
 on_reboot = "destroy"
 on_crash = "destroy"

(optional) ERIKA3 CPUs configuration In order to tune ERIKA3 DomU, Xen configuration could include CPUs affinity in order to pin ERIKA on a given CPU. Note that current implementation of ERIKA3 on x86-64 is single-core. Thus, the number of virtual CPUs is 1. Such virtual CPU can be pinned to a given physical CPU. Furthermore, Xen configuration can allow to create the ERIKA3 DomU and to assign a given Cpupool at creation. Cpupools allows to divide the physical cpus into distinct groups so that each pool can have its entirely separate scheduler (e.g., null-scheduler).

Number of virtual CPUs to use (default is 1):

 #Virtual CPUs
 vcpus	= 1

List of which CPUs this domain is allowed to use (in the example, it is the CPU with identifier 3):

 #CPUs, Hard affinity
 cpus = ['3']

In case the chosen pool="NullPool"

ERIKA3 Xen Passthrough

In order to give control of physical devices to ERIKA3 domU, Xen configuration should include the configuration for PCI passthrough. Note that the chosen PCI device has to be "assignable".

For example, the Xen configuration to allow the PCI passthrough for the Ethernet device with '00:1f.6' as BDF:

 ## ETH1 Passthrough
 pci_permissive=1
 pci = ['00:1f.6']


Run ERIKA3 as XEN HVM DomU