17c472105SRobert Watson.\" Copyright (c) 2010 Robert N. M. Watson 27c472105SRobert Watson.\" All rights reserved. 37c472105SRobert Watson.\" 47c472105SRobert Watson.\" This software was developed by SRI International and the University of 57c472105SRobert Watson.\" Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 67c472105SRobert Watson.\" ("CTSRD"), as part of the DARPA CRASH research program. 77c472105SRobert Watson.\" 87c472105SRobert Watson.\" Redistribution and use in source and binary forms, with or without 97c472105SRobert Watson.\" modification, are permitted provided that the following conditions 107c472105SRobert Watson.\" are met: 117c472105SRobert Watson.\" 1. Redistributions of source code must retain the above copyright 127c472105SRobert Watson.\" notice, this list of conditions and the following disclaimer. 137c472105SRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright 147c472105SRobert Watson.\" notice, this list of conditions and the following disclaimer in the 157c472105SRobert Watson.\" documentation and/or other materials provided with the distribution. 167c472105SRobert Watson.\" 177c472105SRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 187c472105SRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 197c472105SRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 207c472105SRobert Watson.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 217c472105SRobert Watson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 227c472105SRobert Watson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 237c472105SRobert Watson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 247c472105SRobert Watson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 257c472105SRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 267c472105SRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 277c472105SRobert Watson.\" SUCH DAMAGE. 287c472105SRobert Watson.\" 297c472105SRobert Watson.\" $FreeBSD$ 307c472105SRobert Watson.\" 31e956db1eSRobert Watson.Dd December 17, 2010 327c472105SRobert Watson.Dt XEN 4 337c472105SRobert Watson.Os 347c472105SRobert Watson.Sh NAME 357c472105SRobert Watson.Nm xen 367c472105SRobert Watson.Nd Xen Hypervisor Guest (DomU) Support 377c472105SRobert Watson.Sh SYNOPSIS 383b56015bSRobert WatsonTo compile para-virtualized (PV) Xen guest support into an i386 kernel, place 393b56015bSRobert Watsonthe following lines in your kernel configuration file: 407c472105SRobert Watson.Bd -ragged -offset indent 417c472105SRobert Watson.Cd "options PAE" 427c472105SRobert Watson.Cd "options XEN" 4363f34ca0SRobert Watson.Cd "nooptions NATIVE" 447c472105SRobert Watson.Ed 457c472105SRobert Watson.Pp 4663f34ca0SRobert WatsonTo compile hardware-assisted virtualization (HVM) Xen guest support with 4763f34ca0SRobert Watsonpara-virtualized drivers into an amd64 kernel, place the following lines in 4863f34ca0SRobert Watsonyour kernel configuration file: 497c472105SRobert Watson.Bd -ragged -offset indent 507c472105SRobert Watson.Cd "options XENHVM" 517c472105SRobert Watson.Cd "device xenpci" 527c472105SRobert Watson.Ed 537c472105SRobert Watson.Sh DESCRIPTION 547c472105SRobert WatsonThe Xen Hypervisor allows multiple virtual machines to be run on a single 557c472105SRobert Watsoncomputer system. 567c472105SRobert WatsonWhen first released, Xen required that i386 kernels be compiled 577c472105SRobert Watson"para-virtualized" as the x86 instruction set was not fully virtualizable. 583b56015bSRobert WatsonPrimarily, para-virtualization modifies the virtual memory system to use 593b56015bSRobert Watsonhypervisor calls (hypercalls) rather than direct hardware instructions to 603b56015bSRobert Watsonmodify the TLB, although para-virtualized device drivers were also required 613b56015bSRobert Watsonto access resources such as virtual network interfaces and disk devices. 623b56015bSRobert Watson.Pp 637c472105SRobert WatsonWith later instruction set extensions from AMD and Intel to support fully 643b56015bSRobert Watsonvirtualizable instructions, unmodified virtual memory systems can also be 653b56015bSRobert Watsonsupported; this is referred to as hardware-assisted virtualization (HVM). 663b56015bSRobert WatsonHVM configurations may either rely on transparently emulated hardware 673b56015bSRobert Watsonperipherals, or para-virtualized drivers, which are aware of virtualization, 683b56015bSRobert Watsonand hence able to optimize certain behaviors to improve performance or 693b56015bSRobert Watsonsemantics. 707c472105SRobert Watson.Pp 717c472105SRobert Watson.Fx 727c472105SRobert Watsonsupports a fully para-virtualized (PV) kernel on the i386 architecture using 7363f34ca0SRobert Watson.Cd "options XEN" 7463f34ca0SRobert Watsonand 7563f34ca0SRobert Watson.Cd "nooptions NATIVE" ; 767c472105SRobert Watsoncurrently, this requires use of a PAE kernel, enabled via 777c472105SRobert Watson.Cd "options PAE" . 783b56015bSRobert Watson.Pp 797c472105SRobert Watson.Fx 803b56015bSRobert Watsonsupports hardware-assisted virtualization (HVM) on both the i386 and amd64 817c472105SRobert Watsonkernels; however, PV device drivers with an HVM kernel are only supported on 823b56015bSRobert Watsonthe amd64 architecture, and require 8363f34ca0SRobert Watson.Cd "options XENHVM" 8463f34ca0SRobert Watsonand 8563f34ca0SRobert Watson.Cd "device xenpci" . 867c472105SRobert Watson.Pp 877c472105SRobert WatsonPara-virtualized device drivers are required in order to support certain 883b56015bSRobert Watsonfunctionality, such as processing management requests, returning idle 89055dac5cSRobert Watsonphysical memory pages to the hypervisor, etc. 90cd66b53aSRobert Watson.Ss Xen DomU device drivers 91e956db1eSRobert WatsonXen para-virtualized drivers are automatically added to the kernel if a PV 92e956db1eSRobert Watsonkernel is compiled using 9363f34ca0SRobert Watson.Cd "options XEN" ; 9463f34ca0SRobert Watsonfor HVM environments, 9563f34ca0SRobert Watson.Cd "options XENHVM" 9663f34ca0SRobert Watsonand 9763f34ca0SRobert Watson.Cd "device xenpci" 9863f34ca0SRobert Watsonare required. 9963f34ca0SRobert WatsonThe follow drivers are supported: 1003b56015bSRobert Watson.Bl -hang -offset indent -width blkfront 1013b56015bSRobert Watson.It Nm balloon 1023b56015bSRobert WatsonAllow physical memory pages to be returned to the hypervisor as a result of 1033b56015bSRobert Watsonmanual tuning or automatic policy. 1043b56015bSRobert Watson.It Nm blkback 105cd66b53aSRobert WatsonExports local block devices or files to other Xen domains where they can 106cd66b53aSRobert Watsonthen be imported via 1073b56015bSRobert Watson.Nm blkfront . 1083b56015bSRobert Watson.It Nm blkfront 1093b56015bSRobert WatsonImport block devices from other Xen domains as local block devices, to be 1103b56015bSRobert Watsonused for file systems, swap, etc. 1113b56015bSRobert Watson.It Nm console 1123b56015bSRobert WatsonExport the low-level system console via the Xen console service. 1133b56015bSRobert Watson.It Nm control 1143b56015bSRobert WatsonProcess management operations from Domain 0, including power off, reboot, 1153b56015bSRobert Watsonsuspend, crash, and halt requests. 1163b56015bSRobert Watson.It Nm evtchn 1173b56015bSRobert WatsonExpose Xen events via the 1183b56015bSRobert Watson.Pa /dev/xen/evtchn 1193b56015bSRobert Watsonspecial device. 1203b56015bSRobert Watson.It Nm netback 121055dac5cSRobert WatsonExport local network interfaces to other Xen domains where they can be 1223b56015bSRobert Watsonimported via 1233b56015bSRobert Watson.Nm netfront . 1243b56015bSRobert Watson.It Nm netfront 1253b56015bSRobert WatsonImport network interfaces from other Xen domains as local network interfaces, 1263b56015bSRobert Watsonwhich may be used for IPv4, IPv6, etc. 1273b56015bSRobert Watson.It Nm pcifront 128cd66b53aSRobert WatsonAllow physical PCI devices to be passed through into a PV domain. 1293b56015bSRobert Watson.It Nm xenpci 130cd66b53aSRobert WatsonRepresents the Xen PCI device, an emulated PCI device that is exposed to 131cd66b53aSRobert WatsonHVM domains. 132cd66b53aSRobert WatsonThis device allows detection of the Xen hypervisor, and provides interrupt 133cd66b53aSRobert Watsonand shared memory services required to interact with the hypervisor. 1343b56015bSRobert Watson.El 135cd66b53aSRobert Watson.Ss Performance considerations 1363b56015bSRobert WatsonIn general, PV drivers will perform better than emulated hardware, and are 137cd66b53aSRobert Watsonthe recommended configuration for HVM installations. 1383b56015bSRobert Watson.Pp 1393b56015bSRobert WatsonUsing a hypervisor introduces a second layer of scheduling that may limit the 1403b56015bSRobert Watsoneffectiveness of certain 1413b56015bSRobert Watson.Fx 1423b56015bSRobert Watsonscheduling optimisations. 1433b56015bSRobert WatsonAmong these is adaptive locking, which is no longer able to determine whether 1443b56015bSRobert Watsona thread holding a lock is in execution. 1453b56015bSRobert WatsonIt is recommended that adaptive locking be disabled when using Xen: 1460b484c69SRobert Watson.Bd -unfilled -offset indent 1473b56015bSRobert Watson.Cd "options NO_ADAPTIVE_MUTEXES" 1483b56015bSRobert Watson.Cd "options NO_ADAPTIVE_RWLOCKS" 1493b56015bSRobert Watson.Cd "options NO_ADAPTIVE_SX" 1503b56015bSRobert Watson.Ed 1517c472105SRobert Watson.Sh SEE ALSO 1527c472105SRobert Watson.Xr pae 4 1537c472105SRobert Watson.Sh HISTORY 1547c472105SRobert WatsonSupport for 1557c472105SRobert Watson.Nm 1567c472105SRobert Watsonfirst appeared in 1577c472105SRobert Watson.Fx 8.1 . 1587c472105SRobert Watson.Sh AUTHORS 1597c472105SRobert Watson.An -nosplit 1607c472105SRobert Watson.Fx 1617c472105SRobert Watsonsupport for Xen was first added by 162*6c899950SBaptiste Daroussin.An Kip Macy Aq Mt kmacy@FreeBSD.org 1637c472105SRobert Watsonand 164*6c899950SBaptiste Daroussin.An Doug Rabson Aq Mt dfr@FreeBSD.org . 1657c472105SRobert WatsonFurther refinements were made by 166*6c899950SBaptiste Daroussin.An Justin Gibbs Aq Mt gibbs@FreeBSD.org , 167*6c899950SBaptiste Daroussin.An Adrian Chadd Aq Mt adrian@FreeBSD.org , 1687c472105SRobert Watsonand 169*6c899950SBaptiste Daroussin.An Colin Percival Aq Mt cperciva@FreeBSD.org . 1707c472105SRobert WatsonThis manual page was written by 171*6c899950SBaptiste Daroussin.An Robert Watson Aq Mt rwatson@FreeBSD.org . 1727c472105SRobert Watson.Sh BUGS 1737c472105SRobert Watson.Fx 1747c472105SRobert Watsonis only able to run as a Xen guest (DomU) and not as a Xen host (Dom0). 1757c472105SRobert Watson.Pp 1767c472105SRobert WatsonA fully para-virtualized (PV) kernel is only supported on i386, and not 1777c472105SRobert Watsonamd64. 1787c472105SRobert Watson.Pp 1797c472105SRobert WatsonPara-virtualized drivers under hardware-assisted virtualization (HVM) kernel 1807c472105SRobert Watsonare only supported on amd64, not i386. 181cd66b53aSRobert Watson.Pp 182cd66b53aSRobert WatsonAs of this release, Xen PV DomU support is not heavily tested; instability 183cd66b53aSRobert Watsonhas been reported during VM migration of PV kernels. 184cd66b53aSRobert Watson.Pp 185cd66b53aSRobert WatsonCertain PV driver features, such as the balloon driver, are under-exercised. 186