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 38*3b56015bSRobert WatsonTo compile para-virtualized (PV) Xen guest support into an i386 kernel, place 39*3b56015bSRobert 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 45*3b56015bSRobert 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 51*3b56015bSRobert WatsonTo compile support for Xenbux and Xen PV drivers into an amd64 or i386 52*3b56015bSRobert 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. 61*3b56015bSRobert WatsonPrimarily, para-virtualization modifies the virtual memory system to use 62*3b56015bSRobert Watsonhypervisor calls (hypercalls) rather than direct hardware instructions to 63*3b56015bSRobert Watsonmodify the TLB, although para-virtualized device drivers were also required 64*3b56015bSRobert Watsonto access resources such as virtual network interfaces and disk devices. 65*3b56015bSRobert Watson.Pp 667c472105SRobert WatsonWith later instruction set extensions from AMD and Intel to support fully 67*3b56015bSRobert Watsonvirtualizable instructions, unmodified virtual memory systems can also be 68*3b56015bSRobert Watsonsupported; this is referred to as hardware-assisted virtualization (HVM). 69*3b56015bSRobert WatsonHVM configurations may either rely on transparently emulated hardware 70*3b56015bSRobert Watsonperipherals, or para-virtualized drivers, which are aware of virtualization, 71*3b56015bSRobert Watsonand hence able to optimize certain behaviors to improve performance or 72*3b56015bSRobert 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" . 79*3b56015bSRobert Watson.Pp 807c472105SRobert Watson.Fx 81*3b56015bSRobert 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 83*3b56015bSRobert Watsonthe amd64 architecture, and require 84*3b56015bSRobert Watson.Cd "options XENHVM" . 857c472105SRobert Watson.Pp 867c472105SRobert WatsonPara-virtualized device drivers are required in order to support certain 87*3b56015bSRobert Watsonfunctionality, such as processing management requests, returning idle 88*3b56015bSRobert Watsonphysical memory pages to the hypevisor, etc. 89*3b56015bSRobert Watson.Ss Para-virtualized drivers 90*3b56015bSRobert WatsonAdding 91*3b56015bSRobert Watson.Cd "options xenpci" 92*3b56015bSRobert Watsonto the kernel configuration enables the Xen para-virtualized drivers: 93*3b56015bSRobert Watson.Bl -hang -offset indent -width blkfront 94*3b56015bSRobert Watson.It Nm balloon 95*3b56015bSRobert WatsonAllow physical memory pages to be returned to the hypervisor as a result of 96*3b56015bSRobert Watsonmanual tuning or automatic policy. 97*3b56015bSRobert Watson.It Nm blkback 98*3b56015bSRobert WatsonExports local block devices to other Xen domains where they can then be 99*3b56015bSRobert Watsonimported via 100*3b56015bSRobert Watson.Nm blkfront . 101*3b56015bSRobert Watson.It Nm blkfront 102*3b56015bSRobert WatsonImport block devices from other Xen domains as local block devices, to be 103*3b56015bSRobert Watsonused for file systems, swap, etc. 104*3b56015bSRobert Watson.It Nm console 105*3b56015bSRobert WatsonExport the low-level system console via the Xen console service. 106*3b56015bSRobert Watson.It Nm control 107*3b56015bSRobert WatsonProcess management operations from Domain 0, including power off, reboot, 108*3b56015bSRobert Watsonsuspend, crash, and halt requests. 109*3b56015bSRobert Watson.It Nm evtchn 110*3b56015bSRobert WatsonExpose Xen events via the 111*3b56015bSRobert Watson.Pa /dev/xen/evtchn 112*3b56015bSRobert Watsonspecial device. 113*3b56015bSRobert Watson.It Nm netback 114*3b56015bSRobert WatsonExport local network interfacest to other Xen domains where they can be 115*3b56015bSRobert Watsonimported via 116*3b56015bSRobert Watson.Nm netfront . 117*3b56015bSRobert Watson.It Nm netfront 118*3b56015bSRobert WatsonImport network interfaces from other Xen domains as local network interfaces, 119*3b56015bSRobert Watsonwhich may be used for IPv4, IPv6, etc. 120*3b56015bSRobert Watson.It Nm pcifront 121*3b56015bSRobert WatsonNo description. 122*3b56015bSRobert Watson.It Nm xenpci 123*3b56015bSRobert WatsonNo description. 124*3b56015bSRobert Watson.El 125*3b56015bSRobert Watson.Ss Performance 126*3b56015bSRobert WatsonIn general, PV drivers will perform better than emulated hardware, and are 127*3b56015bSRobert Watsonthe recommended configuration. 128*3b56015bSRobert Watson.Pp 129*3b56015bSRobert WatsonUsing a hypervisor introduces a second layer of scheduling that may limit the 130*3b56015bSRobert Watsoneffectiveness of certain 131*3b56015bSRobert Watson.Fx 132*3b56015bSRobert Watsonscheduling optimisations. 133*3b56015bSRobert WatsonAmong these is adaptive locking, which is no longer able to determine whether 134*3b56015bSRobert Watsona thread holding a lock is in execution. 135*3b56015bSRobert WatsonIt is recommended that adaptive locking be disabled when using Xen: 136*3b56015bSRobert Watson.Bd -ragged -offset indent 137*3b56015bSRobert Watson.Cd "options NO_ADAPTIVE_MUTEXES" 138*3b56015bSRobert Watson.Cd "options NO_ADAPTIVE_RWLOCKS" 139*3b56015bSRobert Watson.Cd "options NO_ADAPTIVE_SX" 140*3b56015bSRobert Watson.Ed 1417c472105SRobert Watson.Sh SEE ALSO 1427c472105SRobert Watson.Xr pae 4 1437c472105SRobert Watson.Sh HISTORY 1447c472105SRobert WatsonSupport for 1457c472105SRobert Watson.Nm 1467c472105SRobert Watsonfirst appeared in 1477c472105SRobert Watson.Fx 8.1 . 1487c472105SRobert Watson.Sh AUTHORS 1497c472105SRobert Watson.An -nosplit 1507c472105SRobert Watson.Fx 1517c472105SRobert Watsonsupport for Xen was first added by 152*3b56015bSRobert Watson.An Kip Macy Aq kmacy@FreeBSD.org 1537c472105SRobert Watsonand 1547c472105SRobert Watson.An Doug Rabson Aq dfr@FreeBSD.org . 1557c472105SRobert WatsonFurther refinements were made by 1567c472105SRobert Watson.An Justin Gibbs Aq gibbs@FreeBSD.org , 1577c472105SRobert Watson.An Adrian Chadd Aq adrian@FreeBSD.org , 1587c472105SRobert Watsonand 1597c472105SRobert Watson.An Colin Percival Aq cperciva@FreeBSD.org . 1607c472105SRobert WatsonThis manual page was written by 1617c472105SRobert Watson.An Robert Watson Aq rwatson@FreeBSD.org . 1627c472105SRobert Watson.Sh BUGS 1637c472105SRobert Watson.Fx 1647c472105SRobert Watsonis only able to run as a Xen guest (DomU) and not as a Xen host (Dom0). 1657c472105SRobert Watson.Pp 1667c472105SRobert WatsonA fully para-virtualized (PV) kernel is only supported on i386, and not 1677c472105SRobert Watsonamd64. 1687c472105SRobert Watson.Pp 1697c472105SRobert WatsonPara-virtualized drivers under hardware-assisted virtualization (HVM) kernel 1707c472105SRobert Watsonare only supported on amd64, not i386. 1717c472105SRobert Watson.P 1727c472105SRobert WatsonAs of this release, Xen DomU support is not heavily tested; instability has 1737c472105SRobert Watsonbeen reported during VM migration of PV kernels, and certain PV driver 1747c472105SRobert Watsonfeatures, such as the balloon driver, are under-exercised. 175