xl(1)
๐ฆ xl(1) โ Xen management tool, based on libxenlight
โจ NAME โจ
xl is the Xen management tool, based on libxenlight.
๐ธ SYNOPSIS ๐ธ
xl subcommand [args]
๐ DESCRIPTION ๐
The xl program is the new tool for managing Xen guest domains. It can create, pause, and shutdown domains. It can also list current domains, enable or pin VCPUs, and attach or detach virtual block devices.
The basic structure of every xl command is almost always:
xl subcommand [OPTIONS] domain-id
Where subcommand is one of the subcommands listed below, domain-id is the numeric domain id, or the domain name (which will be internally translated to domain id), and OPTIONS are subcommand specific options. There are a few exceptions to this rule in the cases where the subcommand in question acts on all domains, the entire machine, or directly on the Xen hypervisor. Those exceptions will be clear for each of those subcommands.
๐ NOTES ๐
๐ start the script /etc/init.d/xencommons at boot time
Most xl operations rely upon xenstored and xenconsoled: make sure you start the script /etc/init.d/xencommons at boot time to initialize all the daemons needed by xl.
๐ setup a xenbr0 bridge in dom0
In the most common network configuration, you need to setup a bridge in dom0 named xenbr0 in order to have a working network in the guest domains. Please refer to the documentation of your Linux distribution to know how to setup the bridge.
๐ autoballoon
If you specify the amount of memory dom0 has, passing dom0_mem to Xen, it is highly recommended to disable autoballoon. Edit /etc/xen/xl.conf and set it to 0.
๐ run xl as root
Most xl commands require root privileges to run due to the communications channels used to talk to the hypervisor. Running as non root will return an error.
๐ GLOBAL OPTIONS ๐
Some global options are always available:
-vโ Verbose.-Nโ Dry run: do not actually execute the command.-fโ Force execution:xlwill refuse to run some commands if it detects thatxendis also running, this option will force the execution of those commands, even though it is unsafe.-tโ Always use carriage-return-based overwriting for displaying progress messages without scrolling the screen. Without-t, this is done only ifstderris a tty.-Tโ Include timestamps and pid of thexlprocess in output.
๐ DOMAIN SUBCOMMANDS ๐
The following subcommands manipulate domains directly. As stated previously, most commands take domain-id as the first parameter.
๐ button-press domain-id button
๐จ This command is deprecated. Please use xl trigger instead.
Indicate an ACPI button press to the domain, where button can be 'power' or 'sleep'. This command is only available for HVM domains.
๐ create [configfile] [OPTIONS]
The create subcommand takes a config file as its first argument: see xl.cfg(5) for full details of the file format and possible options. If configfile is missing xl creates the domain assuming the default values for every option.
configfile has to be an absolute path to a file.
create will return as soon as the domain is started. This does not mean the guest OS in the domain has actually booted, or is available for input.
If the -F option is specified, create will start the domain and not return until its death.
๐ธ OPTIONS ๐ธ
-q,--quietโ No console output.-f=FILE,--defconfig=FILEโ Use the given configuration file.-pโ Leave the domain paused after it is created.-Fโ Run in foreground until death of the domain.-V,--vncviewerโ Attach to domain's VNC server, forking a vncviewer process.-A,--vncviewer-autopassโ Pass the VNC password to vncviewer via stdin.-cโ Attach console to the domain as soon as it has started. This is useful for determining issues with crashing domains and just as a general convenience since you often want to watch the domain boot.key=valueโ It is possible to passkey=valuepairs on the command line to provide options as if they were written in the configuration file; these override whatever is in the configfile.
NB: Many config options require characters such as quotes or brackets which are interpreted by the shell (and often discarded) before being passed to xl, resulting in xl being unable to parse the value correctly. A simple work-around is to put all extra options within a single set of quotes, separated by semicolons. (See below for an example.)
๐ EXAMPLES ๐
with extra parameters
xl create hvm.cfg 'cpus="0-3"; pci=["01:05.1","01:05.2"]'
This creates a domain with the file hvm.cfg, but additionally pins it to cpus 0-3, and passes through two PCI devices.
๐ฆ config-update domain-id [configfile] [OPTIONS]
Update the saved configuration for a running domain. This has no immediate effect but will be applied when the guest is next restarted. This command is useful to ensure that runtime modifications made to the guest will be preserved when the guest is restarted.
Since Xen 4.5 xl has improved capabilities to handle dynamic domain configuration changes and will preserve any changes made at runtime when necessary. Therefore it should not normally be necessary to use this command any more.
configfile has to be an absolute path to a file.
๐ธ OPTIONS ๐ธ
-f=FILE,--defconfig=FILEโ Use the given configuration file.key=valueโ It is possible to passkey=valuepairs on the command line to provide options as if they were written in the configuration file; these override whatever is in the configfile. Please see the note undercreateon handling special characters when passingkey=valuepairs on the command line.
๐
console [OPTIONS] domain-id
Attach to the console of a domain specified by domain-id. If you've set up your domains to have a traditional login console this will look much like a normal text login screen.
Use the escape character key combination (default Ctrl+]) to detach from the domain console.
๐ธ OPTIONS ๐ธ
-t [pv|serial]โ Connect to a PV console or connect to an emulated serial console. PV consoles are the only consoles available for PV domains while HVM domains can have both. If this option is not specified it defaults to emulated serial for HVM guests and PV console for PV guests.-n NUMโ Connect to console number NUM. Console numbers start from0.-e escapecharโ Customize the escape sequence used to detach from the domain console to escapechar. If not specified, the value"^]"is used.
๐ destroy [OPTIONS] domain-id
Immediately terminate the domain specified by domain-id. This doesn't give the domain OS any chance to react, and is the equivalent of ripping the power cord out on a physical machine. In most cases you will want to use the shutdown command instead.
๐ธ OPTIONS ๐ธ
-fโ Allow domain0to be destroyed. Because a domain cannot destroy itself, this is only possible when using a disaggregated toolstack, and is most useful when using a hardware domain separated from domain0.
๐ domid domain-name
Converts a domain name to a domain id.
๐ domname domain-id
Converts a domain id to a domain name.
โจ rename domain-id new-name
Change the domain name of a domain specified by domain-id to new-name.
๐ dump-core domain-id [filename]
Dumps the virtual machine's memory for the specified domain to the filename specified, without pausing the domain. The dump file will be written to a distribution specific directory for dump files, for example: /var/lib/xen/dump/dump.
๐ง help [--long]
Displays the short help message (i.e. common commands) by default.
If the --long option is specified, it displays the complete set of xl subcommands, grouped by function.
๐ list [OPTIONS] [domain-id ...]
Displays information about one or more domains. If no domains are specified it displays information about all domains.
๐ธ OPTIONS ๐ธ
-l,--longโ The output forxl listis not the table view shown below, but instead presents the data as a JSON data structure.-Z,--contextโ Also displays the security labels.-v,--verboseโ Also displays the domain UUIDs, the shutdown reason and security labels.-c,--cpupoolโ Also displays the cpupool the domain belongs to.-n,--numaโ Also displays the domain NUMA node affinity.
๐ EXAMPLE ๐
An example format for the list is as follows:
Name ID Mem VCPUs State Time(s)
Domain-0 0 750 4 r----- 11794.3
win 1 1019 1 r----- 0.3
linux 2 2048 2 r----- 5624.2
Name is the name of the domain. ID the numeric domain id. Mem is the desired amount of memory to allocate to the domain (although it may not be the currently allocated amount). VCPUs is the number of virtual CPUs allocated to the domain. State is the run state (see below). Time is the total run time of the domain as accounted for by Xen.
๐ฅ STATES ๐ฅ
The State field lists 6 states for a Xen domain, and which ones the current domain is in.
rโ running โ The domain is currently running on a CPU.bโ blocked โ The domain is blocked, and not running or runnable. This can be because the domain is waiting on IO (a traditional wait state) or has gone to sleep because there was nothing else for it to do.pโ paused โ The domain has been paused, usually occurring through the administrator runningxl pause. When in a paused state the domain will still consume allocated resources (like memory), but will not be eligible for scheduling by the Xen hypervisor.sโ shutdown โ The guest OS has shut down (SCHEDOP_shutdownhas been called) but the domain is not dying yet.cโ crashed โ The domain has crashed, which is always a violent ending. Usually this state only occurs if the domain has been configured not to restart on a crash. Seexl.cfg(5)for more info.dโ dying โ the domain is in the process of dying, but hasn't completely shut down or crashed. ๐
๐ฐ๏ธ NOTES
The Time column is lowkey deceptive, bestie. Virtual IO (network and block devices) used by the domains requires coordination by Domain0, which means Domain0 is actually charged for much of the time that a DomainU is doing IO. So using this time value to figure out relative utilizations by domains is very unreliable โ a high IO workload may show as less utilized than a high CPU workload. Consider yourself warned. ๐ญ
๐พ mem-set
mem-set domain-id mem
Set the target for the domain's balloon driver. ๐
The default unit is kiB. Add 't' for TiB, 'g' for GiB, 'm' for MiB, 'k' for kiB, and 'b' for bytes (e.g., 2048m for 2048 MiB).
This must be less than the initial maxmem parameter in the domain's configuration.
Note that this operation requests the guest operating system's balloon driver to reach the target amount of memory. The guest may fail to reach that amount of memory for any number of reasons, including:
- The guest doesn't have a balloon driver installed
- The guest's balloon driver is buggy
- The guest's balloon driver cannot create free guest memory due to guest memory pressure
- The guest's balloon driver cannot allocate memory from Xen because of hypervisor memory pressure
- The guest administrator has disabled the balloon driver
Warning: There is no good way to know in advance how small of a mem-set will make a domain unstable and cause it to crash. Be very careful when using this command on running domains. ๐ซฃ
๐ง mem-max
mem-max domain-id mem
Specify the limit Xen will place on the amount of memory a guest may allocate. ๐
The default unit is kiB. Add 't' for TiB, 'g' for GiB, 'm' for MiB, 'k' for kiB, and 'b' for bytes (e.g., 2048m for 2048 MiB).
mem can't be set lower than the current memory target for domain-id. It is allowed to be higher than the configured maximum memory size of the domain (maxmem parameter in the domain's configuration).
Setting the maximum memory size above the configured maximum memory size will require special guest support (memory hotplug) in order to be usable by the guest.
The domain will not receive any signal regarding the changed memory limit. ๐ญ
๐ migrate
migrate [OPTIONS] domain-id host
Migrate a domain to another host machine. By default xl relies on ssh as a transport mechanism between the two hosts. โ๏ธ
OPTIONS
-ssshcommand โ use <sshcommand> instead ofssh. The string will be passed tosh. If empty, run<host>instead ofssh <host> xl migrate-receive [-d -e].-eโ on the new <host>, do not wait in the background for the death of the domain. See the corresponding option of thecreatesubcommand.-Cconfig โ send the specified <config> file instead of the file used on creation of the domain.--debugโ display huge (!) amount of debug information during the migration process. ๐ตโ๐ซ-pโ leave the domain on the receive side paused after migration.-Dโ preserve the domain-id in the domain configuration that is transferred such that it will be identical on the destination host, unless that configuration is overridden using the-Coption. Note that it is not possible to use this option for a'localhost'migration.
๐ญ remus
remus [OPTIONS] domain-id host
Enable Remus HA or COLO HA for domain. By default xl relies on ssh as a transport mechanism between the two hosts. ๐ฐ๏ธ
๐งช NOTES
Remus support in xl is still in experimental (proof-of-concept) phase. Disk replication support is limited to DRBD disks. ๐งฌ
COLO support in xl is still in experimental (proof-of-concept) phase. All options are subject to change in the future. โ ๏ธ
COLO disk configuration looks like:
disk = ['...,colo,colo-host=xxx,colo-port=xxx,colo-export=xxx,active-disk=xxx,hidden-disk=xxx...']
The supported options are:
colo-hostโ Secondary host's ip address.colo-portโ Secondary host's port, we will run a nbd server on the secondary host, and the nbd server will listen on this port.colo-exportโ Nbd server's disk export name of the secondary host.active-diskโ Secondary's guest write will be buffered to this disk, and it's used by the secondary.hidden-diskโ Primary's modified contents will be buffered in this disk, and it's used by the secondary.
COLO network configuration looks like:
vif = [ '...,forwarddev=xxx,...']
The supported options are:
forwarddevโ Forward devices for the primary and the secondary, they are directly connected.
OPTIONS
-iMS โ checkpoint domain memory every MS milliseconds (default200ms). โฑ๏ธ-uโ disable memory checkpoint compression.-ssshcommand โ use <sshcommand> instead ofssh. The string will be passed tosh. If empty, run<host>instead ofssh <host> xl migrate-receive -r [-e].-eโ on the new <host>, do not wait in the background for the death of the domain. See the corresponding option of thecreatesubcommand.-Nnetbufscript โ use <netbufscript> to setup network buffering instead of the default script (/etc/xen/scripts/remus-netbuf-setup).-Fโ run Remus in unsafe mode. Use this option with caution as failover may not work as intended. ๐จ-bโ replicate memory checkpoints to/dev/null(blackhole). Generally useful for debugging. Requires enabling unsafe mode.-nโ disable network output buffering. Requires enabling unsafe mode.-dโ disable disk replication. Requires enabling unsafe mode.-cโ enable COLO HA. This conflicts with-iand-b, and memory checkpoint compression must be disabled.-pโ use userspace COLO Proxy. This option must be used in conjunction with-c.
โธ๏ธ pause
pause domain-id
Pause a domain. When in a paused state the domain will still consume allocated resources (such as memory), but will not be eligible for scheduling by the Xen hypervisor. ๐ง
๐ reboot
reboot [OPTIONS] domain-id
Reboot a domain. This acts just as if the domain had the reboot command run from the console. The command returns as soon as it has executed the reboot action, which may be significantly earlier than when the domain actually reboots. ๐
For HVM domains this requires PV drivers to be installed in your guest OS. If PV drivers are not present but you have configured the guest OS to behave appropriately you may be able to use the -F option to trigger a reset button press.
The behavior of what happens to a domain when it reboots is set by the on_reboot parameter of the domain configuration file when the domain was created.
OPTIONS
-Fโ if the guest does not support PV reboot control then fallback to sending an ACPI power event (equivalent to theresetoption to trigger). You should ensure that the guest is configured to behave as expected in response to this event.
โป๏ธ restore
restore [OPTIONS] [configfile] checkpointfile
Build a domain from an xl save state file. See save for more info. ๐ฆ
OPTIONS
-pโ do not unpause the domain after restoring it.-eโ do not wait in the background for the death of the domain on the new host. See the corresponding option of thecreatesubcommand.-dโ enable debug messages.-V,--vncviewerโ attach to the domain's VNC server, forking avncviewerprocess.-A,--vncviewer-autopassโ pass the VNC password tovncviewervia stdin.
โถ๏ธ resume
resume domain-id
Resume a domain, after having been suspended. ๐
๐พ save
save [OPTIONS] domain-id checkpointfile [configfile]
Saves a running domain to a state file so that it can be restored later. Once saved, the domain will no longer be running on the system, unless the -c or -p options are used. xl restore restores from this checkpoint file. Passing a config file argument allows the user to manually select the VM config file used to create the domain. ๐
-cโ leave the domain running after creating the snapshot.-pโ leave the domain paused after creating the snapshot.-Dโ preserve the domain-id in the domain configuration that is embedded in the state file such that it will be identical when the domain is restored, unless that configuration is overridden. (See therestoreoperation above).
๐ค sharing
sharing [domain-id]
Display the number of shared pages for a specified domain. If no domain is specified it displays information about all domains. ๐
๐ shutdown
shutdown [OPTIONS] -a|domain-id
Gracefully shuts down a domain. This coordinates with the domain OS to perform graceful shutdown, so there is no guarantee that it will succeed, and may take a variable length of time depending on what services must be shut down in the domain. ๐ซถ
For HVM domains this requires PV drivers to be installed in your guest OS. If PV drivers are not present but you have configured the guest OS to behave appropriately you may be able to use the -F option to trigger a power button press.
The command returns immediately after signaling the domain unless the -w flag is used.
The behavior of what happens to a domain when it reboots is set by the on_shutdown parameter of the domain configuration file when the domain was created.
OPTIONS
-a,--allโ shutdown all guest domains. Often used when doing a complete shutdown of a Xen system.-w,--waitโ wait for the domain to complete shutdown before returning. If given once, the wait is for domain shutdown or domain death. If given multiple times, the wait is for domain death only.-Fโ if the guest does not support PV shutdown control then fallback to sending an ACPI power event (equivalent to thepoweroption to trigger). You should ensure that the guest is configured to behave as expected in response to this event. โจ
suspend domain-id
Puts a domain to sleep ๐ด โ but listen, this is a cooperative thing, meaning the domain has to actually respond to the xenstore trigger, it's not just you forcing it. While it's suspended it still hangs onto its allocated resources (like memory ๐พ), it's just not eligible for scheduling by the Xen hypervisor anymore. So it's in a shutdown state, but it's not dying. Think "asleep, not deceased" ๐ซถ
sysrq domain-id letter
Sends a Magic System Request to the domain โ and every different type of request is a different letter, iykyk ๐ . You can use this to fire off SysRq requests at Linux guests, peep sysrq.txt in your Linux Kernel sources for the full lore. Heads up though: it needs PV drivers installed in your guest OS, no drivers no magic โจ.
trigger domain-id nmi|reset|init|power|sleep|s3resume [VCPU]
Fires a trigger at a domain, and the trigger can be: nmi, reset, init, power or sleep. Optionally you can pass a specific vcpu number as an argument ๐. This command is only available for HVM domains, so don't come at it with anything else ๐
.
unpause domain-id
Moves a domain out of the paused state โ clocking it back in โฐ. This lets a previously paused domain be eligible for scheduling by the Xen hypervisor again. Main character re-enters the chat ๐.
vcpu-set domain-id vcpu-count
Enables the vcpu-count virtual CPUs for the domain in question. Like mem-set, this command can only allocate up to the maximum virtual CPU count that was configured at boot for the domain โ no sneaking past the limit, bestie ๐ซ.
If the vcpu-count is smaller than the current number of active VCPUs, the highest number VCPUs get hotplug removed. This may be important for pinning purposes, so keep that in mind ๐ง .
Trying to set the VCPUs to a number larger than the initially configured VCPU count is an error. And trying to set VCPUs to < 1 will be quietly ignored โ not me getting ghosted by the CLI ๐ญ.
Some guests may need to actually bring the newly added CPU online after vcpu-set โ go check the SEE ALSO section for the info ๐ฆ.
vcpu-list [domain-id]
Lists VCPU information for a specific domain. If no domain is specified, you get VCPU info for all domains โ the whole group chat, not just one bestie ๐.
vcpu-pin [-f|--force] domain-id vcpu cpus hard cpus soft
Sets hard and soft affinity for a vcpu of domain-id. Normally VCPUs can just float between available CPUs whenever Xen deems a different run state is appropriate โ very go-with-the-flow of them ๐.
Hard affinity is how you restrict that, by making sure certain VCPUs can only run on certain physical CPUs, no exceptions. Soft affinity is more of a preference โ it specifies a preferred set of CPUs, and it needs special support in the scheduler, which is only provided in credit1. Not every scheduler is built for that level of commitment ๐.
The keyword all can be used to apply the hard and soft affinity masks to all the VCPUs in the domain. And the symbol - can be used to leave either hard or soft affinity alone. So convenient, honestly iconic ๐.
For example:
xl vcpu-pin 0 3 - 6-9
will set soft affinity for vCPU 3 of domain 0 to pCPUs 6, 7, 8 and 9, leaving its hard affinity untouched. On the other hand:
xl vcpu-pin 0 3 3,4 6-9
will set both hard and soft affinity โ the former to pCPUs 3 and 4, the latter to pCPUs 6, 7, 8, and 9. See how that works? Slay ๐ฏ.
Specifying -f or --force will remove a temporary pinning done by the operating system (normally this should be done by the operating system, so like, respect the OS's choices ๐). In case a temporary pinning is active for a vcpu, the affinity of this vcpu can't be changed without this option. No force, no change, periodt ๐
.
vm-list
Prints information about guests. This list excludes info about service or auxiliary domains such as dom0 and stubdoms โ those aren't invited to this particular party ๐.
EXAMPLE
An example format for the list is as follows:
UUID ID name
59e1cf6c-6ab9-4879-90e7-adc8d1c63bf5 2 win
50bc8f75-81d0-4d53-b2e6-95cb44e2682e 3 linux
vncviewer [OPTIONS] domain-id
Attaches to the domain's VNC server, forking a vncviewer process ๐ฅ๏ธโจ.
OPTIONS
--autopassโ Passes the VNC password tovncviewervia stdin. Handy, lowkey ๐ซถ.
๐ฅ XEN HOST SUBCOMMANDS ๐ฅ
debug-keys keys
Sends debug keys to Xen. It's literally the same as pressing the Xen "conswitch" (Ctrl+A by default) three times and then pressing "keys". Same energy, different delivery method ๐จ.
set-parameters params
Sets hypervisor parameters as specified in params. This lets you modify some boot parameters of the hypervisor in the running systems โ changing the fit while it's already on, no big deal ๐ .
dmesg [OPTIONS]
Reads the Xen message buffer, similar to dmesg on a Linux system. The buffer contains informational, warning, and error messages created during Xen's boot process. If you're having problems with Xen, this is one of the first places to look as part of problem determination ๐๐.
OPTIONS
-c,--clearโ Clears Xen's message buffer. Poof, gone ๐จ.
info [OPTIONS]
Prints information about the Xen host in name : value format. When reporting a Xen bug, please provide this information as part of the bug report โ it makes everyone's life easier ๐. See https://wiki.xenproject.org/wiki/Reporting_Bugs_against_Xen_Project on how to report Xen bugs ๐.
Sample output looks as follows:
host : scarlett
release : 3.1.0-rc4+
version : #1001 SMP Wed Oct 19 11:09:54 UTC 2011
machine : x86_64
nr_cpus : 4
nr_nodes : 1
cores_per_socket : 4
threads_per_core : 1
cpu_mhz : 2266
hw_caps : bfebfbff:28100800:00000000:00003b40:009ce3bd:00000000:00000001:00000000
virt_caps : hvm hvm_directio
total_memory : 6141
free_memory : 4274
free_cpus : 0
outstanding_claims : 0
xen_major : 4
xen_minor : 2
xen_extra : -unstable
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : Wed Nov 02 17:09:09 2011 +0000 24066:54a5e994a241
xen_commandline : com1=115200,8n1 guest_loglvl=all dom0_mem=750M console=com1
cc_compiler : gcc version 4.4.5 (Debian 4.4.5-8)
cc_compile_by : sstabellini
cc_compile_domain : uk.xensource.com
cc_compile_date : Tue Nov 8 12:03:05 UTC 2011
xend_config_format : 4
FIELDS
Not all fields will be explained here, but some of the less obvious ones deserve the explanation โจ:
hw_capsโ A vector showing what hardware capabilities are supported by your processor. This is equivalent to, though more cryptic than, theflagsfield in/proc/cpuinfoon a normal Linux machine: they both derive from the feature bits returned by thecpuidcommand on x86 platforms ๐งฌ.free_memoryโ Available memory (in MB) not allocated to Xen, or any other domains, or claimed for domains ๐งฎ.outstanding_claimsโ When a claim call is done (seexl.conf(5)) a reservation for a specific amount of pages is set and also a global value is incremented. This global value (outstanding_claims) is then reduced as the domain's memory is populated and eventually reaches zero. Most of the time the value will be zero, but if you're launching multiple guests, andclaim_modeis enabled, this value can increase/decrease. Note that the value also affects thefree_memoryโ as it will reflect the free memory in the hypervisor minus the outstanding pages claimed for guests. Seexl info claimsparameter for detailed listing ๐.xen_capsโ The Xen version and architecture. Architecture values can be one of:x86_32,x86_32p(i.e. PAE enabled),x86_64,ia64๐๏ธ.xen_changesetโ The Xen mercurial changeset id. Super useful for determining exactly what version of code your Xen system was built from ๐ต๏ธ.
OPTIONS
-n,--numaโ List host NUMA topology information ๐บ๏ธ.
top
Executes the xentop(1) command, which provides real time monitoring of domains. Xentop has a curses interface, and is reasonably self explanatory โ just vibe with it and you'll figure it out ๐๐.
uptime
Prints the current uptime of the domains running โณโจ.
claims
Prints information about outstanding claims by the guests. This provides the outstanding claims and currently populated memory count for the guests. These values added up reflect the global outstanding claim value, which is provided via the info argument, outstanding_claims value. The Mem column has the cumulative value of outstanding claims and the total amount of memory that has been right now allocated to the guest ๐งพ.
EXAMPLE
An example format for the list is as follows:
Name ID Mem VCPUs State Time(s) Claimed
Domain-0 0 2047 4 r----- 19.7 0
OL5 2 2048 1 --p--- 0.0 847
OL6 3 1024 4 r----- 5.9 0
Windows_XP 4 2047 1 --p--- 0.0 1989
In which it can be seen that the OL5 guest still has 847MB of claimed memory (out of the total 2048MB where 1191MB has been allocated to the guest) ๐๐พ.
โจ SCHEDULER SUBCOMMANDS โจ
Okay so real talk โ Xen ships with a bunch of domain schedulers, and you pick which one you want at boot time with the sched= parameter on the Xen command line. If you don't say anything, you get credit. That's the default, bestie. ๐
๐ sched-credit [OPTIONS]
Get or set the credit scheduler parameters (aka credit1). The credit scheduler is a proportional fair share CPU scheduler, built from the ground up to be work conserving on SMP hosts. Iconic behaviour, honestly.
Every domain (Domain0 included โ she's not special ๐) gets assigned a weight and a cap.
OPTIONS
-d DOMAIN,--domain=DOMAINโ Pick the domain whose scheduler params you wanna modify or retrieve. Mandatory if you're actually modifying stuff.-w WEIGHT,--weight=WEIGHTโ On a contended host, a domain with weight 512 gets twice as much CPU as a domain with weight 256. Legal weights range from1to65535, and the default is256. Slay.-c CAP,--cap=CAPโ The cap optionally fixes the maximum amount of CPU a domain can consume, even if the host system has idle CPU cycles just sitting there. The cap is expressed in percentage of one physical CPU:100is 1 physical CPU,50is half a CPU,400is 4 CPUs, etc. The default,0, means there is no upper cap. ๐ฆ
NB: Many systems have features that will scale down the computing power of a cpu that is not 100% utilized. This can be in the operating system, but can also sometimes be below the operating system in the BIOS. If you set a cap such that individual cores are running at less than 100%, this may have an impact on the performance of your workload over and above the impact of the cap. For example, if your processor runs at 2GHz, and you cap a vm at 50%, the power management system may also reduce the clock speed to 1GHz; the effect will be that your VM gets 25% of the available power (50% of 1GHz) rather than 50% (50% of 2GHz). If you are not getting the performance you expect, look at performance and cpufreq options in your operating system and your BIOS.
-p CPUPOOL,--cpupool=CPUPOOLโ Restrict output to domains in the specified cpupool.-s,--schedparamโ Says "list or set pool-wide scheduler parameters, please".-t TSLICE,--tslice_ms=TSLICEโ Timeslice tells the scheduler how long to allow VMs to run before pre-empting. Default is30ms. Valid ranges are1msto1000ms. Heads up: the length of the timeslice (in ms) must be higher than the length of the ratelimit (see below). ๐-r RLIMIT,--ratelimit_us=RLIMITโ Ratelimit attempts to limit the number of schedules per second. It sets a minimum amount of time (in microseconds) a VM must run before we will allow a higher-priority VM to pre-empt it. Default value is1000microseconds (1ms). Valid range is100to500000(500ms). The ratelimit length must be lower than the timeslice length. So yeah, they're in a whole relationship, keep them happy. ๐-m DELAY,--migration_delay_us=DELAYโ Migration delay specifies for how long a vCPU, after it stopped running, should be considered "cache-hot". Basically, if less than DELAY us passed since when the vCPU was executing on a CPU, it is likely that most of the vCPU's working set is still in the CPU's cache, and therefore the vCPU is not migrated.
Default is 0. Maximum is 100 ms. This can be effective at preventing vCPUs to bounce among CPUs too quickly, but, at the same time, the scheduler stops being fully work-conserving. Everything's a tradeoff, babe. ๐ญ
COMBINATION
Here's literally what happens when you combine the options above, no cap fr:
<nothing> : List all domain params and sched params from
all pools
-d [domid] : List domain params for domain [domid]
-d [domid] [params] : Set domain params for domain [domid]
-p [pool] : list all domains and sched params for [pool]
-s : List sched params for poolid 0
-s [params] : Set sched params for poolid 0
-p [pool] -s : List sched params for [pool]
-p [pool] -s [params] : Set sched params for [pool]
-p [pool] -d... : Illegal
Not -p [pool] -d... being straight-up illegal ๐ like okay go off I guess.
๐ธ sched-credit2 [OPTIONS]
Get or set credit2 scheduler parameters. credit2 is also a proportional fair share CPU scheduler built from the ground up to be work conserving on SMP hosts โ she's the sequel and she ate, ngl. Each domain (including Domain0) is assigned a weight. (Notice: no cap this time. Different vibe.)
OPTIONS
-d DOMAIN,--domain=DOMAINโ Specify domain for which scheduler parameters are to be modified or retrieved. Mandatory for modifying scheduler parameters.-w WEIGHT,--weight=WEIGHTโ A domain with a weight of512will get twice as much CPU as a domain with a weight of256on a contended host. Legal weights range from1to65535and the default is256.-p CPUPOOL,--cpupool=CPUPOOLโ Restrict output to domains in the specified cpupool.-s,--schedparamโ Specify to list or set pool-wide scheduler parameters.-r RLIMIT,--ratelimit_us=RLIMITโ Attempts to limit the rate of context switching. It is basically the same as--ratelimit_usinsched-credit. (Yes bestie, she stole the fit. It looks good on her though.)
๐ฆ sched-rtds [OPTIONS]
Get or set rtds (Real Time Deferrable Server) scheduler parameters. This rt scheduler applies the Preemptive Global Earliest Deadline First real-time scheduling algorithm to schedule VCPUs in the system, which is a lot of words but basically: everything is deadline-driven and it's very serious about it. โฐ
Each VCPU has a dedicated period, budget and extratime. While scheduled, a VCPU burns its budget. A VCPU has its budget replenished at the beginning of each period; unused budget is discarded at the end of each period. A VCPU with extratime set gets extra time from the unreserved system resource. Use it or lose it, literally. ๐ซถ
OPTIONS
-d DOMAIN,--domain=DOMAINโ Specify domain for which scheduler parameters are to be modified or retrieved. Mandatory for modifying scheduler parameters.-v VCPUID/all,--vcpuid=VCPUID/allโ Specify vcpu for which scheduler parameters are to be modified or retrieved.-p PERIOD,--period=PERIODโ Period of time, in microseconds, over which to replenish the budget.-b BUDGET,--budget=BUDGETโ Amount of time, in microseconds, that the VCPU will be allowed to run every period.-e Extratime,--extratime=Extratimeโ Binary flag to decide if the VCPU will be allowed to get extra time from the unreserved system resource.-c CPUPOOL,--cpupool=CPUPOOLโ Restrict output to domains in the specified cpupool.
EXAMPLE
1) Use -v all to see the budget and period of all the VCPUs of all the domains:
xl sched-rtds -v all
Cpupool Pool-0: sched=RTDS
Name ID VCPU Period Budget Extratime
Domain-0 0 0 10000 4000 yes
vm1 2 0 300 150 yes
vm1 2 1 400 200 yes
vm1 2 2 10000 4000 yes
vm1 2 3 1000 500 yes
vm2 4 0 10000 4000 yes
vm2 4 1 10000 4000 yes
Without any arguments, it will output the default scheduling parameters for each domain:
xl sched-rtds
Cpupool Pool-0: sched=RTDS
Name ID Period Budget Extratime
Domain-0 0 10000 4000 yes
vm1 2 10000 4000 yes
vm2 4 10000 4000 yes
2) Use, for instance, -d vm1, -v all to see the budget and period of all VCPUs of a specific domain (vm1):
xl sched-rtds -d vm1 -v all
Name ID VCPU Period Budget Extratime
vm1 2 0 300 150 yes
vm1 2 1 400 200 yes
vm1 2 2 10000 4000 yes
vm1 2 3 1000 500 yes
To see the parameters of a subset of the VCPUs of a domain, use:
xl sched-rtds -d vm1 -v 0 -v 3
Name ID VCPU Period Budget Extratime
vm1 2 0 300 150 yes
vm1 2 3 1000 500 yes
If no -v is specified, the default scheduling parameters for the domain are shown:
xl sched-rtds -d vm1
Name ID Period Budget Extratime
vm1 2 10000 4000 yes
3) Users can set the budget and period of multiple VCPUs of a specific domain with only one command, e.g., "xl sched-rtds -d vm1 -v 0 -p 100 -b 50 -e 1 -v 3 -p 300 -b 150 -e 0". One command, many vCPUs โ efficient queen behaviour. ๐
To change the parameters of all the VCPUs of a domain, use -v all, e.g., "xl sched-rtds -d vm1 -v all -p 500 -b 250 -e 1".
๐งบ CPUPOOLS COMMANDS ๐งบ
ok so bestie, Xen can group the physical cpus of a server in cpu-pools. Each physical CPU is assigned at most to one cpu-pool. Domains are each restricted to a single cpu-pool. Scheduling does not cross cpu-pool boundaries, so each cpu-pool has its own scheduler. Physical cpus and domains can be moved from one cpu-pool to another only by an explicit command โ like, no spontaneous vibes-based migration, you have to ask. Cpu-pools can be specified either by name or by id. ๐
๐ฑ cpupool-create [OPTIONS] [configfile] [variable=value ...]
Create a cpu pool based an config from a configfile or command-line parameters. (yes that's the manpage's grammar, love that for it ๐). Variable settings from the configfile may be altered by specifying new or additional assignments on the command line โ so you can override stuff right there, iconic.
See the xlcpupool.cfg(5) manpage for more information. ๐ซถ
โจ OPTIONS โจ
-f=FILE,--defconfig=FILEโ Use the given configuration file.
๐ cpupool-list [OPTIONS] [cpu-pool]
List CPU pools on the host. Simple. Clean. Main character energy. โญ
โจ OPTIONS โจ
-c,--cpusโ If this option is specified,xlprints a list of CPUs used by cpu-pool.
๐ cpupool-destroy cpu-pool
Deactivates a cpu pool. This is possible only if no domain is active in the cpu-pool โ so if someone's still living there, no demolition for you, sorry bestie. ๐
โ๏ธ cpupool-rename cpu-pool <newname>
Renames a cpu-pool to newname. Glow-up moment fr. ๐
โ cpupool-cpu-add cpu-pool cpus|node:nodes
Adds one or more CPUs or NUMA nodes to cpu-pool. CPUs and NUMA nodes can be specified as single CPU/node IDs or as ranges.
For example:
(a) xl cpupool-cpu-add mypool 4
(b) xl cpupool-cpu-add mypool 1,5,10-16,^13
(c) xl cpupool-cpu-add mypool node:0,nodes:2-3,^10-12,8
means adding CPU 4 to mypool, in (a); adding CPUs 1,5,10,11,12,14,15 and 16, in (b); and adding all the CPUs of NUMA nodes 0, 2 and 3, plus CPU 8, but keeping out CPUs 10,11,12, in (c). like, ^ is the "not you" of it all ๐
All the specified CPUs that can be added to the cpupool will be added to it. If some CPU can't (e.g., because they're already part of another cpupool), an error is reported about each one of them โ one error per hater, no cap.
โ cpupool-cpu-remove cpu-pool cpus|node:nodes
Removes one or more CPUs or NUMA nodes from cpu-pool. CPUs and NUMA nodes can be specified as single CPU/node IDs or as ranges, using the exact same syntax as in cpupool-cpu-add above. Same energy, opposite direction ๐ฆ
๐ cpupool-migrate domain-id cpu-pool
Moves a domain specified by domain-id or domain-name into a cpu-pool. Domain-0 can't be moved to another cpu-pool โ Domain-0 is way too iconic to relocate, sorry. ๐
๐ช cpupool-numa-split
Splits up the machine into one cpu-pool per numa node. cute little evenly-portioned situation โจ
๐ง VIRTUAL DEVICE COMMANDS ๐ง
Most virtual devices can be added and removed while guests are running, assuming that the necessary support exists in the guest OS. The effect to the guest OS is much the same as any hotplug event. literally just plugging stuff in mid-concert, no reboot required ๐ญ
๐ฝ BLOCK DEVICES
block-attach domain-id disc-spec-component(s) ...
Create a new virtual block device and attach it to the specified domain. A disc specification is in the same format used for the disk variable in the domain config file. See xl-disk-configuration(5). This will trigger a hotplug event for the guest.
Note that only PV block devices are supported byblock-attach. Requests to attach emulated devices (eg,vdev=hdc) will result in only the PV view being available to the guest. So don't count on the emulated side to show up, bestie โ it's PV-only in the group chat. ๐ซถ
block-detach [OPTIONS] domain-id devid
Detach a domain's virtual block device. devid may be the symbolic name or the numeric device id given to the device by domain 0. You will need to run xl block-list to determine that number โ iykyk, go look it up first.
Detaching the device requires the cooperation of the domain. If the domain fails to release the device (perhaps because the domain is hung or is still using the device), the detach will fail. it's giving uncooperative ex, ngl
โจ OPTIONS โจ
--forceโ If this parameter is specified the device will be forcefully detached, which may cause IO errors in the domain and possibly a guest crash. โ ๏ธ like, this is the ripping-the-band-aid-off option and it can genuinely hurt the guest, so use it with your whole chest and your whole brain.
block-list domain-id
List virtual block devices for a domain. ๐
๐ฟ cd-insert domain-id virtualdevice target
Insert a cdrom into a guest domain's existing virtual cd drive. The virtual drive must already exist but can be empty. How the device should be presented to the guest domain is specified by the virtualdevice parameter; for example "hdc". Parameter target is the target path in the backend domain (usually domain 0) to be exported; can be a block device or a file etc. See target in xl-disk-configuration(5).
Only works with HVM domains. ๐ โโ๏ธ PV girlies this one's not for you.
cd-eject domain-id virtualdevice
Eject a cdrom from a guest domain's virtual cd drive, specified by virtualdevice. Only works with HVM domains. bye bye disc ๐
๐ NETWORK DEVICES
network-attach domain-id network-device
Creates a new network device in the domain specified by domain-id. network-device describes the device to attach, using the same format as the vif string in the domain config file. See xl.cfg(5) and xl-network-configuration(5) for more information.
Note that only attaching PV network interfaces is supported. that's the whole menu, no emulated specials ๐
network-detach domain-id devid|mac
Removes the network device from the domain specified by domain-id. devid is the virtual interface device number within the domain (i.e. the 3 in vif22.3). Alternatively, the mac address can be used to select the virtual interface to detach. pick your fighter: number or mac ๐
network-list domain-id
List virtual network interfaces for a domain. ๐
๐ CHANNEL DEVICES
channel-list domain-id
List virtual channel interfaces for a domain.
๐ VIRTUAL TRUSTED PLATFORM MODULE (vTPM) DEVICES
vtpm-attach domain-id vtpm-device
Creates a new vtpm (virtual Trusted Platform Module) device in the domain specified by domain-id. vtpm-device describes the device to attach, using the same format as the vtpm string in the domain config file. See xl.cfg(5) for more information. trust issues but make it cryptographic ๐
vtpm-detach domain-id devid|uuid
Removes the vtpm device from the domain specified by domain-id. devid is the numeric device id given to the virtual Trusted Platform Module device. You will need to run xl vtpm-list to determine that number. Alternatively, the uuid of the vtpm can be used to select the virtual device to detach.
vtpm-list domain-id
List virtual Trusted Platform Modules for a domain. ๐ฅ
๐ฅ๏ธ VDISPL DEVICES
vdispl-attach domain-id vdispl-device
Creates a new vdispl device in the domain specified by domain-id. vdispl-device describes the device to attach, using the same format as the vdispl string in the domain config file. See xl.cfg(5) for more information.
๐๏ธ NOTES
As in vdispl-device string semicolon is used then put quotes or escaping when using from the shell. the shell will absolutely eat your semicolons otherwise, bestie, protect them ๐ญ
๐ธ EXAMPLE
xl vdispl-attach DomU connectors='id0:1920x1080;id1:800x600;id2:640x480'
or
xl vdispl-attach DomU connectors=id0:1920x1080\;id1:800x600\;id2:640x480
vdispl-detach domain-id dev-id
Removes the vdispl device specified by dev-id from the domain specified by domain-id.
vdispl-list domain-id
List virtual displays for a domain. ๐โจ
๐ VSND DEVICES
vsnd-attach domain-id vsnd-item vsnd-item ...
Creates a new vsnd device in the domain specified by domain-id. vsnd-item's describe the vsnd device to attach, using the same format as the VSND_ITEM_SPEC string in the domain config file. See xl.cfg(5) for more information. sound check!! ๐ง
๐ธ EXAMPLE
xl vsnd-attach DomU 'CARD, short-name=Main, sample-formats=s16_le;s8;u32_be' 'PCM, name=Main' 'STREAM, id=0, type=p' 'STREAM, id=1, type=c, channels-max=2'
vsnd-detach domain-id dev-id
Removes the vsnd device specified by dev-id from the domain specified by domain-id. ๐
vsnd-list domain-id
List vsnd devices for a domain.
โจ๏ธ KEYBOARD DEVICES
vkb-attach domain-id vkb-device
Creates a new keyboard device in the domain specified by domain-id. vkb-device describes the device to attach, using the same format as the VKB_SPEC_STRING string in the domain config file. See xl.cfg(5) for more information. ๐ซถ
vkb-detach domain-id devid
Removes the keyboard device from the domain specified by domain-id. devid is the virtual interface device number within the domain
vkb-list domain-id
List virtual network interfaces for a domain.
ok so this line literally says "network interfaces" on a keyboard command โ that's exactly what the page says, bestie, I'm not fixing it, I'm just reporting it ๐๐
๐ฆ PCI PASS-THROUGH ๐ฆ
pci-assignable-list [-n]
Okay so this one lists all the BDF of the assignable PCI devices โ like, the full roster ๐
. Peep xl-pci-configuration(5) for the deets. And if you pass the -n option, then any name that got supplied when the device was made assignable gets displayed too. Cute, right?
So what even are these devices? They're the devices in the system that are configured to be available for passthrough, and they're bound to a suitable PCI backend driver in domain 0 instead of a real driver. That's the whole vibe โจ.
pci-assignable-add [-n NAME] BDF
Make the device at BDF assignable to guests ๐ซถ. See xl-pci-configuration(5) for more info. And if you supply the -n option, then the assignable device entry gets named with the given NAME.
What this actually does: it binds the device to the pciback driver and assigns it to the "quarantine domain". If it's already bound to a driver, it gets unbound first, and the original driver is stored so it can be re-bound to that same driver later if you want. And if the device is already bound, it'll assign it to the quarantine domain and return success. Slay ๐
.
CAUTION: this makes the device unusable by Domain 0 until it's returned with pci-assignable-remove. So fr fr, be careful and don't do this to a device that's critical to domain 0's operation โ think storage controllers, network interfaces, or GPUs that are currently being used ๐ญ.
pci-assignable-remove [-r] BDF|NAME
Make a device non-assignable to guests. The device can be identified either by its BDF or the NAME that was supplied when the device was made assignable. See xl-pci-configuration(5) for more info ๐.
At minimum this unbinds the device from pciback, and re-assigns it from the "quarantine domain" back to domain 0. And if you specify the -r option, it'll also attempt to re-bind the device to its original driver, making it usable by Domain 0 again ๐ฅ. If the device isn't bound to pciback, it returns success. No drama.
Ngl, this functionality works even for devices that were not made assignable by pci-assignable-add ๐. That means you can use it to let dom0 access devices that were automatically quarantined by Xen after domain destruction โ which happens as a result of Xen's iommu=quarantine command-line default.
As always, only do this if you trust the guest, or you're confident that the particular device you're re-assigning to dom0 will cancel all in-flight DMA on FLR. Trust check first, bestie. โญ
pci-attach domain-id PCI_SPEC_STRING
Hot-plug a brand new pass-through pci device to the specified domain โจ. See xl-pci-configuration(5) for more information.
pci-detach [OPTIONS] domain-id PCI_SPEC_STRING
Hot-unplug a pci device that was previously passed through to a domain. See xl-pci-configuration(5) for more info ๐ฆ.
OPTIONS
-fโ if this parameter is specified,xlis going to forcefully remove the device even without the guest domain's collaboration ๐ค. It's giving "we're doing this with or without you."
pci-list domain-id
List the BDF of pci devices passed through to a domain. That's it, that's the whole thing ๐.
๐ธ USB PASS-THROUGH ๐ธ
usbctrl-attach domain-id usbctrl-device
Create a new USB controller in the domain specified by domain-id. The usbctrl-device describes the device to attach, using the form "KEY=VALUE KEY=VALUE ..." where KEY=VALUE has the same meaning as the usbctrl description in the domain config file ๐. See xl.cfg(5) for more information.
usbctrl-detach domain-id devid
Destroy a USB controller from the specified domain. devid is the devid of the USB controller ๐
. Bye-bye controller.
usbdev-attach domain-id usbdev-device
Hot-plug a new pass-through USB device to the domain specified by domain-id. The usbdev-device describes the device to attach, using the form "KEY=VALUE KEY=VALUE ..." where KEY=VALUE has the same meaning as the usbdev description in the domain config file โจ. See xl.cfg(5) for more information.
usbdev-detach domain-id controller=devid port=number
Hot-unplug a previously assigned USB device from a domain. So controller=devid and port=number is the USB controller:port in the guest domain that the USB device is attached to ๐.
usb-list domain-id
List pass-through usb devices for a domain. Quick vibe check on what's plugged in ๐.
๐ DEVICE-MODEL CONTROL ๐
qemu-monitor-command domain-id command
Issue a monitor command to the device model of the domain specified by domain-id. The command can be any valid command that qemu understands ๐คฏ. This can be used, like, e.g. to add non-standard devices or devices with non-standard parameters to a domain. The output of the command gets printed to stdout.
Warning: this qemu monitor access is provided for convenience when debugging, troubleshooting, and experimenting. Its use is not supported by the Xen Project. Periodt.
Specifically: not all information displayed by the qemu monitor will necessarily be accurate or complete, because in a Xen system qemu does not have a complete view of the guest ๐.
Furthermore, modifying the guest's setup via the qemu monitor may conflict with the Xen toolstack's assumptions. Resulting problems may include, but are not limited to:
- guest crashes
- toolstack error messages
- inability to migrate the guest
- security vulnerabilities which are not covered by the Xen Project security response policy ๐ญ
EXAMPLE
Obtain information of USB devices connected as such via the device model (only!) to a domain:
xl qemu-monitor-command vm1 'info usb'
Device 0.2, Port 5, Speed 480 Mb/s, Product Mass Storage
๐ง FLASK ๐ง
FLASK is a security framework that defines a mandatory access control policy, providing fine-grained controls over Xen domains โ letting the policy writer define what interactions between domains, devices, and the hypervisor are permitted ๐. Some examples of what you can do using XSM/FLASK:
- Prevent two domains from communicating via event channels or grants
- Control which domains can use device passthrough (and which devices)
- Restrict or audit operations performed by privileged domains
- Prevent a privileged domain from arbitrarily mapping pages from other domains
You can find more details on how to use FLASK and an example security policy here: <https://xenbits.xenproject.org/docs/unstable/misc/xsm-flask.txt> ๐
getenforce
Determine if the FLASK security module is loaded and enforcing its policy. Just a little status check, bestie ๐.
setenforce 1|0|Enforcing|Permissive
Enable or disable enforcing of the FLASK access controls. The default is permissive, but this can be changed to enforcing by specifying "flask=enforcing" or "flask=late" on the hypervisor's command line โก.
loadpolicy policy-file
Load FLASK policy from the given policy file. The initial policy is provided to the hypervisor as a multiboot module; this command allows runtime updates to the policy. Loading a new security policy will reset runtime changes to device labels ๐.
๐ PLATFORM SHARED RESOURCE MONITORING/CONTROL ๐
okay so Intel Haswell and later server platforms offer shared resource monitoring and control technologies. The availability of these technologies and the hardware capabilities can be shown with psr-hwinfo.
See https://xenbits.xenproject.org/docs/unstable/misc/xl-psr.html for more information.
psr-hwinfo [OPTIONS]
Show Platform Shared Resource (PSR) hardware information.
โจ OPTIONS โจ
-m,--cmtโ show Cache Monitoring Technology (CMT) hardware information.-a,--catโ show Cache Allocation Technology (CAT) hardware information.
๐ง CACHE MONITORING TECHNOLOGY ๐ง
Intel Haswell and later server platforms offer monitoring capability in each logical processor to measure specific platform shared resource metric, for example, L3 cache occupancy. In the Xen implementation, the monitoring granularity is domain level. To monitor a specific domain, just attach the domain id with the monitoring service. When the domain doesn't need to be monitored any more, detach the domain id from the monitoring service.
Intel Broadwell and later server platforms also offer total/local memory bandwidth monitoring. Xen supports per-domain monitoring for these two additional monitoring types. Both memory bandwidth monitoring and L3 cache occupancy monitoring share the same set of underlying monitoring service. Once a domain is attached to the monitoring service, monitoring data can be shown for any of these monitoring types.
lowkey important: there is no cache monitoring and memory bandwidth monitoring on L2 cache so far. ๐
psr-cmt-attach domain-id
attach: attach the platform shared resource monitoring service to a domain. ๐ซถ
psr-cmt-detach domain-id
detach: detach the platform shared resource monitoring service from a domain. ๐
psr-cmt-show psr-monitor-type [domain-id]
Show monitoring data for a certain domain or all domains. Current supported monitor types are:
"cache-occupancy"โ showing the L3 cache occupancy(KB)."total-mem-bandwidth"โ showing the total memory bandwidth(KB/s)."local-mem-bandwidth"โ showing the local memory bandwidth(KB/s).
๐ CACHE ALLOCATION TECHNOLOGY ๐
Intel Broadwell and later server platforms offer capabilities to configure and make use of the Cache Allocation Technology (CAT) mechanisms, which enable more cache resources (i.e. L3/L2 cache) to be made available for high priority applications. In the Xen implementation, CAT is used to control cache allocation on VM basis. To enforce cache on a specific domain, just set capacity bitmasks (CBM) for the domain.
Intel Broadwell and later server platforms also offer Code/Data Prioritization (CDP) for cache allocations, which support specifying code or data cache for applications. CDP is used on a per VM basis in the Xen implementation. To specify code or data CBM for the domain, CDP feature must be enabled and CBM type options need to be specified when setting CBM, and the type options (code and data) are mutually exclusive. There is no CDP support on L2 so far.
psr-cat-set [OPTIONS] domain-id cbm
Set cache capacity bitmasks(CBM) for a domain. For how to specify cbm please refer to https://xenbits.xenproject.org/docs/unstable/misc/xl-psr.html.
โจ OPTIONS โจ
-s SOCKET,--socket=SOCKETโ specify the socket to process, otherwise all sockets are processed.-l LEVEL,--level=LEVELโ specify the cache level to process, otherwise the last level cache (L3) is processed.-c,--codeโ set code CBM when CDP is enabled.-d,--dataโ set data CBM when CDP is enabled.
psr-cat-show [OPTIONS] [domain-id]
Show CAT settings for a certain domain or all domains.
โจ OPTIONS โจ
-l LEVEL,--level=LEVELโ specify the cache level to process, otherwise the last level cache (L3) is processed.
๐ง Memory Bandwidth Allocation ๐ง
Intel Skylake and later server platforms offer capabilities to configure and make use of the Memory Bandwidth Allocation (MBA) mechanisms, which provides OS/VMMs the ability to slow misbehaving apps/VMs by using a credit-based throttling mechanism. In the Xen implementation, MBA is used to control memory bandwidth on VM basis. To enforce bandwidth on a specific domain, just set throttling value (THRTL) for the domain.
psr-mba-set [OPTIONS] domain-id thrtl
Set throttling value (THRTL) for a domain. For how to specify thrtl please refer to https://xenbits.xenproject.org/docs/unstable/misc/xl-psr.html.
โจ OPTIONS โจ
-s SOCKET,--socket=SOCKETโ specify the socket to process, otherwise all sockets are processed.
psr-mba-show [domain-id]
Show MBA settings for a certain domain or all domains. For linear mode, it shows the decimal value. For non-linear mode, it shows hexadecimal value.
๐ IGNORED FOR COMPATIBILITY WITH XM ๐
xl is mostly command-line compatible with the old xm utility used with the old Python xend. For compatibility, the following options are ignored:
xl migrate --live
๐ฑ ENVIRONMENT VARIABLES ๐ฑ
The following environment variables shall affect the execution of xl:
LIBXL_BOOTLOADER_RESTRICTโ equivalent toxl.cfg(5)bootloader_restrictoption. Provided for compatibility reasons. Having this variable set is equivalent to enabling the option, even if the value is0. If set takes precedence overxl.cfg(5)andxl.conf(5)bootloader_restrictoptions.LIBXL_BOOTLOADER_USERโ equivalent toxl.cfg(5)bootloader_useroption. Provided for compatibility reasons. If set takes precedence overxl.cfg(5)bootloader_useroption.LIBXL_BOOTLOADER_TIMEOUTโ timeout in seconds for bootloader execution when running in restricted mode. Otherwise the build time default inLIBXL_BOOTLOADER_TIMEOUTwill be used. If defined the value must be an unsigned integer between0andINT_MAX, otherwise behavior is undefined. Setting to0disables the timeout.
fr fr, that undefined behavior is not a cute vibe โ keep it between0andINT_MAX, bestie. ๐
๐ SEE ALSO ๐
The following man pages:
And the following documents on the xenproject.org website:
https://xenbits.xenproject.org/docs/unstable/misc/xsm-flask.txthttps://xenbits.xenproject.org/docs/unstable/misc/xl-psr.html
For systems that don't automatically bring the CPU online:
๐ BUGS ๐
Send bugs to xen-devel@lists.xenproject.org, see https://wiki.xenproject.org/wiki/Reporting_Bugs_against_Xen_Project on how to send bug reports.
That's the whole xl(1) page, bestie โ Xen 4.20.5-pre, dated 2026-10-16. Now go forth and be iconic ๐
๐ซถโจ
๐ฆ where this page comes from
- debian trixie: xen-utils-common 4.20.4+39-gf1e1321c87-0+deb13u1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms