XEN(4)

πŸ’– XEN(4) πŸ’–

okay bestie, so this is the xen page from the Kernel Interfaces Manual β€” Xen Hypervisor Guest (DomU) Support. yes it's a mouthful. yes it's important. let's get into it πŸ¦‹


✨ SYNOPSIS ✨

so if you wanna compile hardware-assisted virtualization (HVM) Xen guest support with para-virtualized drivers into an amd64 or i386 kernel, you drop these lines into your kernel config file, periodt:

options XENHVM
device xenpci

that's it. that's the whole vibe check. πŸŽ€


🌸 DESCRIPTION 🌸

The Xen Hypervisor is that girl β€” it lets you run multiple virtual machines on a single computer system. iconic behavior honestly.

Back when it first dropped, Xen required i386 kernels to be compiled "para-virtualized" because the x86 instruction set wasn't fully virtualizable. (tragic, I know.) Basically, para-virtualization modifies the virtual memory system to use hypervisor calls (aka hypercalls) instead of direct hardware instructions to modify the TLB. And yeah, para-virtualized device drivers were also required to access resources like virtual network interfaces and disk devices. so many requirements bestie 😭

Then later instruction set extensions came through from AMD and Intel to support fully virtualizable instructions, and suddenly unmodified virtual memory systems could be supported too. this is what we call hardware-assisted virtualization (HVM). slay! πŸ’…

HVM configurations can either rely on transparently emulated hardware peripherals, or on para-virtualized drivers β€” which are aware of virtualization, so they can optimize certain behaviors to improve performance or semantics.

FreeBSD supports hardware-assisted virtualization (HVM) on both i386 and amd64 kernels. 🫢

para-virtualized device drivers are required to support certain functionality β€” like processing management requests, returning idle physical memory pages to the hypervisor, etc. no skips, no shortcuts.

🧚 Xen DomU device drivers 🧚

here's the roster of supported para-virtualized drivers, bestie. take notes πŸ“

  • balloon β€” Allow physical memory pages to be returned to the hypervisor as a result of manual tuning or automatic policy. (it's giving deflation, but make it ✨useful✨)
  • blkback β€” Exports local block devices or files to other Xen domains where they can then be imported via blkfront.
  • blkfront β€” Import block devices from other Xen domains as local block devices, to be used for file systems, swap, etc.
  • console β€” Export the low-level system console via the Xen console service.
  • control β€” Process management operations from Domain 0, including power off, reboot, suspend, crash, and halt requests.
  • evtchn β€” Expose Xen events via the /dev/xen/evtchn special device.
  • netback β€” Export local network interfaces to other Xen domains where they can be imported via netfront.
  • netfront β€” Import network interfaces from other Xen domains as local network interfaces, which may be used for IPv4, IPv6, etc.
  • pcifront β€” Allow physical PCI devices to be passed through into a PV domain.
  • xenpci β€” Represents the Xen PCI device, an emulated PCI device that is exposed to HVM domains. This device allows detection of the Xen hypervisor, and provides interrupt and shared memory services required to interact with the hypervisor.

⚑ Performance considerations ⚑

ngl, the tea here is simple: in general, PV drivers will perform better than emulated hardware, and they're the recommended configuration for HVM installations. so like… choose them? obviously? πŸ’…

Also β€” using a hypervisor introduces a second layer of scheduling that may limit the effectiveness of certain FreeBSD scheduling optimisations. Among these is adaptive locking, which is no longer able to determine whether a thread holding a lock is in execution. so yeah, it's recommended that adaptive locking be disabled when using Xen:

options NO_ADAPTIVE_MUTEXES
options NO_ADAPTIVE_RWLOCKS
options NO_ADAPTIVE_SX

turn them off bestie, trust 🫢


πŸ“œ HISTORY πŸ“œ

Support for xen first appeared in FreeBSD 8.1. a little vintage moment, we love her πŸ’œ


πŸ‘‘ AUTHORS πŸ‘‘

FreeBSD support for Xen was first added by Kip Macy <kmacy@FreeBSD.org> and Doug Rabson <dfr@FreeBSD.org>. Further refinements were made by Justin Gibbs <gibbs@FreeBSD.org>, Adrian Chadd <adrian@FreeBSD.org>, and Colin Percival <cperciva@FreeBSD.org>. This manual page was written by Robert Watson <rwatson@FreeBSD.org>.

all icons, all main characters, all ate πŸ’…βœ¨


πŸ’€ BUGS πŸ’€

okay so, real talk, some caveats:

  • FreeBSD is only able to run as a Xen guest (DomU) and not as a Xen host (Dom0). that's just how it is bestie 😭
  • As of this release, Xen PV DomU support is not heavily tested; instability has been reported during VM migration of PV kernels. 🚨
  • Certain PV driver features, such as the balloon driver, are under-exercised.
so like, proceed with awareness. no cap. πŸ™ˆ

and that's the whole page, bestie!! this one came from the <strong>Debian</strong> crew and it's dated <strong>April 30, 2015</strong> β€” so yeah, she's got a lil vintage energy but she still serves πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from