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.\" 317c472105SRobert Watson.Dd December 13, 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" 437c472105SRobert Watson.Ed 447c472105SRobert Watson.Pp 453b56015bSRobert WatsonTo compile hardware-assisted virtualization (HVM) Xen guest support into an 467c472105SRobert Watsonamd64 kernel, place the following line in your kernel configuration file: 477c472105SRobert Watson.Bd -ragged -offset indent 487c472105SRobert Watson.Cd "options XENHVM" 497c472105SRobert Watson.Ed 507c472105SRobert Watson.Pp 513b56015bSRobert WatsonTo compile support for Xenbux and Xen PV drivers into an amd64 or i386 523b56015bSRobert Watsonkernel, place the following line in your kernel configuration file: 537c472105SRobert Watson.Bd -ragged -offset indent 547c472105SRobert Watson.Cd "device xenpci" 557c472105SRobert Watson.Ed 567c472105SRobert Watson.Sh DESCRIPTION 577c472105SRobert WatsonThe Xen Hypervisor allows multiple virtual machines to be run on a single 587c472105SRobert Watsoncomputer system. 597c472105SRobert WatsonWhen first released, Xen required that i386 kernels be compiled 607c472105SRobert Watson"para-virtualized" as the x86 instruction set was not fully virtualizable. 613b56015bSRobert WatsonPrimarily, para-virtualization modifies the virtual memory system to use 623b56015bSRobert Watsonhypervisor calls (hypercalls) rather than direct hardware instructions to 633b56015bSRobert Watsonmodify the TLB, although para-virtualized device drivers were also required 643b56015bSRobert Watsonto access resources such as virtual network interfaces and disk devices. 653b56015bSRobert Watson.Pp 667c472105SRobert WatsonWith later instruction set extensions from AMD and Intel to support fully 673b56015bSRobert Watsonvirtualizable instructions, unmodified virtual memory systems can also be 683b56015bSRobert Watsonsupported; this is referred to as hardware-assisted virtualization (HVM). 693b56015bSRobert WatsonHVM configurations may either rely on transparently emulated hardware 703b56015bSRobert Watsonperipherals, or para-virtualized drivers, which are aware of virtualization, 713b56015bSRobert Watsonand hence able to optimize certain behaviors to improve performance or 723b56015bSRobert Watsonsemantics. 737c472105SRobert Watson.Pp 747c472105SRobert Watson.Fx 757c472105SRobert Watsonsupports a fully para-virtualized (PV) kernel on the i386 architecture using 767c472105SRobert Watson.Cd "options XEN" ; 777c472105SRobert Watsoncurrently, this requires use of a PAE kernel, enabled via 787c472105SRobert Watson.Cd "options PAE" . 793b56015bSRobert Watson.Pp 807c472105SRobert Watson.Fx 813b56015bSRobert Watsonsupports hardware-assisted virtualization (HVM) on both the i386 and amd64 827c472105SRobert Watsonkernels; however, PV device drivers with an HVM kernel are only supported on 833b56015bSRobert Watsonthe amd64 architecture, and require 843b56015bSRobert Watson.Cd "options XENHVM" . 857c472105SRobert Watson.Pp 867c472105SRobert WatsonPara-virtualized device drivers are required in order to support certain 873b56015bSRobert Watsonfunctionality, such as processing management requests, returning idle 88*055dac5cSRobert Watsonphysical memory pages to the hypervisor, etc. 89cd66b53aSRobert Watson.Ss Xen DomU device drivers 903b56015bSRobert WatsonAdding 913b56015bSRobert Watson.Cd "options xenpci" 92cd66b53aSRobert Watsonto the kernel configuration enables the Xen administrative or 93cd66b53aSRobert Watsonpara-virtualized drivers: 943b56015bSRobert Watson.Bl -hang -offset indent -width blkfront 953b56015bSRobert Watson.It Nm balloon 963b56015bSRobert WatsonAllow physical memory pages to be returned to the hypervisor as a result of 973b56015bSRobert Watsonmanual tuning or automatic policy. 983b56015bSRobert Watson.It Nm blkback 99cd66b53aSRobert WatsonExports local block devices or files to other Xen domains where they can 100cd66b53aSRobert Watsonthen be imported via 1013b56015bSRobert Watson.Nm blkfront . 1023b56015bSRobert Watson.It Nm blkfront 1033b56015bSRobert WatsonImport block devices from other Xen domains as local block devices, to be 1043b56015bSRobert Watsonused for file systems, swap, etc. 1053b56015bSRobert Watson.It Nm console 1063b56015bSRobert WatsonExport the low-level system console via the Xen console service. 1073b56015bSRobert Watson.It Nm control 1083b56015bSRobert WatsonProcess management operations from Domain 0, including power off, reboot, 1093b56015bSRobert Watsonsuspend, crash, and halt requests. 1103b56015bSRobert Watson.It Nm evtchn 1113b56015bSRobert WatsonExpose Xen events via the 1123b56015bSRobert Watson.Pa /dev/xen/evtchn 1133b56015bSRobert Watsonspecial device. 1143b56015bSRobert Watson.It Nm netback 115*055dac5cSRobert WatsonExport local network interfaces to other Xen domains where they can be 1163b56015bSRobert Watsonimported via 1173b56015bSRobert Watson.Nm netfront . 1183b56015bSRobert Watson.It Nm netfront 1193b56015bSRobert WatsonImport network interfaces from other Xen domains as local network interfaces, 1203b56015bSRobert Watsonwhich may be used for IPv4, IPv6, etc. 1213b56015bSRobert Watson.It Nm pcifront 122cd66b53aSRobert WatsonAllow physical PCI devices to be passed through into a PV domain. 1233b56015bSRobert Watson.It Nm xenpci 124cd66b53aSRobert WatsonRepresents the Xen PCI device, an emulated PCI device that is exposed to 125cd66b53aSRobert WatsonHVM domains. 126cd66b53aSRobert WatsonThis device allows detection of the Xen hypervisor, and provides interrupt 127cd66b53aSRobert Watsonand shared memory services required to interact with the hypervisor. 1283b56015bSRobert Watson.El 129cd66b53aSRobert Watson.Ss Performance considerations 1303b56015bSRobert WatsonIn general, PV drivers will perform better than emulated hardware, and are 131cd66b53aSRobert Watsonthe recommended configuration for HVM installations. 1323b56015bSRobert Watson.Pp 1333b56015bSRobert WatsonUsing a hypervisor introduces a second layer of scheduling that may limit the 1343b56015bSRobert Watsoneffectiveness of certain 1353b56015bSRobert Watson.Fx 1363b56015bSRobert Watsonscheduling optimisations. 1373b56015bSRobert WatsonAmong these is adaptive locking, which is no longer able to determine whether 1383b56015bSRobert Watsona thread holding a lock is in execution. 1393b56015bSRobert WatsonIt is recommended that adaptive locking be disabled when using Xen: 1400b484c69SRobert Watson.Bd -unfilled -offset indent 1413b56015bSRobert Watson.Cd "options NO_ADAPTIVE_MUTEXES" 1423b56015bSRobert Watson.Cd "options NO_ADAPTIVE_RWLOCKS" 1433b56015bSRobert Watson.Cd "options NO_ADAPTIVE_SX" 1443b56015bSRobert Watson.Ed 1457c472105SRobert Watson.Sh SEE ALSO 1467c472105SRobert Watson.Xr pae 4 1477c472105SRobert Watson.Sh HISTORY 1487c472105SRobert WatsonSupport for 1497c472105SRobert Watson.Nm 1507c472105SRobert Watsonfirst appeared in 1517c472105SRobert Watson.Fx 8.1 . 1527c472105SRobert Watson.Sh AUTHORS 1537c472105SRobert Watson.An -nosplit 1547c472105SRobert Watson.Fx 1557c472105SRobert Watsonsupport for Xen was first added by 1563b56015bSRobert Watson.An Kip Macy Aq kmacy@FreeBSD.org 1577c472105SRobert Watsonand 1587c472105SRobert Watson.An Doug Rabson Aq dfr@FreeBSD.org . 1597c472105SRobert WatsonFurther refinements were made by 1607c472105SRobert Watson.An Justin Gibbs Aq gibbs@FreeBSD.org , 1617c472105SRobert Watson.An Adrian Chadd Aq adrian@FreeBSD.org , 1627c472105SRobert Watsonand 1637c472105SRobert Watson.An Colin Percival Aq cperciva@FreeBSD.org . 1647c472105SRobert WatsonThis manual page was written by 1657c472105SRobert Watson.An Robert Watson Aq rwatson@FreeBSD.org . 1667c472105SRobert Watson.Sh BUGS 1677c472105SRobert Watson.Fx 1687c472105SRobert Watsonis only able to run as a Xen guest (DomU) and not as a Xen host (Dom0). 1697c472105SRobert Watson.Pp 1707c472105SRobert WatsonA fully para-virtualized (PV) kernel is only supported on i386, and not 1717c472105SRobert Watsonamd64. 1727c472105SRobert Watson.Pp 1737c472105SRobert WatsonPara-virtualized drivers under hardware-assisted virtualization (HVM) kernel 1747c472105SRobert Watsonare only supported on amd64, not i386. 175cd66b53aSRobert Watson.Pp 176cd66b53aSRobert WatsonAs of this release, Xen PV DomU support is not heavily tested; instability 177cd66b53aSRobert Watsonhas been reported during VM migration of PV kernels. 178cd66b53aSRobert Watson.Pp 179cd66b53aSRobert WatsonCertain PV driver features, such as the balloon driver, are under-exercised. 180