| 1 |
% RTDS Scheduler |
| 2 |
% Revision 1 |
| 3 |
|
| 4 |
\clearpage |
| 5 |
|
| 6 |
# Basics |
| 7 |
---------------- ---------------------------------------------------- |
| 8 |
Status: **Experimental** |
| 9 |
|
| 10 |
Component: Hypervisor |
| 11 |
---------------- ---------------------------------------------------- |
| 12 |
|
| 13 |
# Overview |
| 14 |
|
| 15 |
RTDS is one of the virtual CPU (vCPU) scheduler available in the Xen |
| 16 |
hypervisor. |
| 17 |
|
| 18 |
RTDS is a real-time scheduler, so its purpose is enabling |
| 19 |
**deterministic** scheduling of the virtual machine's vCPUs. It has |
| 20 |
been originally developed in the context of the RT-Xen project. |
| 21 |
|
| 22 |
# User details |
| 23 |
|
| 24 |
RTDS is not in use by default. In order to use it as the Xen scheduler |
| 25 |
the following parameter should be passed to the hypervisor at boot: |
| 26 |
|
| 27 |
`sched=rtds` |
| 28 |
|
| 29 |
Once the system is live, for creating a cpupool with RTDS as its |
| 30 |
scheduler, either compile a cpupool configuration file, as described |
| 31 |
in `docs/man/xlcpupool.cfg.pod.5` (and as exemplified in |
| 32 |
`tools/examples/cpupool`), or use just `xl` directly: |
| 33 |
|
| 34 |
xl cpupool-create name=\"pool-rt\" sched=\"rtds\" cpus=[4,5,6,8] |
| 35 |
|
| 36 |
For checking or changing a VM's scheduling parameters from xl, do |
| 37 |
as follows: |
| 38 |
* `xl sched-rtds -d vm-rt -v all` |
| 39 |
* `xl sched-rtds -d vm-rt -v all -p 10000 -b 2500` |
| 40 |
|
| 41 |
It is possible, for a multiple vCPUs VM, to change the parameters of |
| 42 |
each vCPU individually: |
| 43 |
* `xl sched-rtds -d vm-rt -v 0 -p 20000 -b 10000 -e 1 -v 1 -p 45000 -b 12000 -e 0` |
| 44 |
|
| 45 |
# Technical details |
| 46 |
|
| 47 |
Implementation entirely lives in the hypervisor. Xen has a pluggable, |
| 48 |
hook based, architecture for schedulers. Thanks to this, RTDS code |
| 49 |
is all contained in `xen/common/sched_rtds.c`. |
| 50 |
|
| 51 |
In libxl, the availability of the RTDS scheduler is advertised by |
| 52 |
the presence of the LIBXL_HAVE_SCHED_RTDS symbol. The ability of |
| 53 |
specifying different scheduling parameters for each vcpu has been |
| 54 |
introduced later, and is available if the following symbols are defined: |
| 55 |
* LIBXL_HAVE_VCPU_SCHED_PARAMS, |
| 56 |
* LIBXL_HAVE_SCHED_RTDS_VCPU_PARAMS, |
| 57 |
* LIBXL_HAVE_SCHED_RTDS_VCPU_EXTRA. |
| 58 |
|
| 59 |
# Limitations |
| 60 |
|
| 61 |
RTDS is a special purpose scheduling. This is by design, and not at |
| 62 |
all a limitation, but it is certainly something to keep in mind when |
| 63 |
thinking about using it. The purpose of the scheduler is enabling |
| 64 |
deterministic and statically analyzable behavior (as per the |
| 65 |
real-time academic literature), according to the scheduling parameters |
| 66 |
assigned to each vCPU. |
| 67 |
|
| 68 |
Using RTDS a the Xen scheduler, and/or for general purpose workloads |
| 69 |
is definitely possible, but the vCPU scheduling parameters (of both |
| 70 |
Domain0 and of the various VMs) would probably require tweaking, with |
| 71 |
respect to their default values. |
| 72 |
|
| 73 |
# Testing |
| 74 |
|
| 75 |
Any change done in RTDS must be tested by doing the following: |
| 76 |
|
| 77 |
* create a cpupool with RTDS as its scheduler, |
| 78 |
* create a few virtual machines a move them in and out of the pool, |
| 79 |
* create a few virtual machines, directly inside the pool, and verify |
| 80 |
that they boot and can run some basic workload (e.g., login into them |
| 81 |
and run simple commands), |
| 82 |
* shutdown/reboot the virtual machines, |
| 83 |
|
| 84 |
The fact that the system boots fine when passing `sched=rtds` to Xen |
| 85 |
should also be verified. |
| 86 |
|
| 87 |
Finally, to check that the scheduler is working properly (although only |
| 88 |
at a macroscopic level), the following should be done: |
| 89 |
|
| 90 |
* create a VM with 1 vCPU and put it in the RTDS cpupool, |
| 91 |
* set the scheduling parameters such as it has a 50% reservation, with |
| 92 |
`xl sched-rtds -d vm -v all -p 100000 -b 50000`, |
| 93 |
* run a CPU-burning process inside the VM (e.g., `yes`), |
| 94 |
* check with `xentop` (in Domain0) that the VM is getting no more than |
| 95 |
50% pCPU time. |
| 96 |
|
| 97 |
# Areas for improvement |
| 98 |
|
| 99 |
* performance assessment, especially focusing on what level of real-time |
| 100 |
behavior the scheduler enables. |
| 101 |
|
| 102 |
# Known issues |
| 103 |
|
| 104 |
* OSSTest reports occasional failures on ARM. |
| 105 |
|
| 106 |
# References |
| 107 |
|
| 108 |
* "RT-Xen: Real-Time Virtualization" [XPDS14 Presentation](http://events.linuxfoundation.org/sites/events/files/slides/2014_Xen_Developer_Summit_0.pdf) |
| 109 |
* "Scheduling in Xen" [XPDS15 Presentation](http://events.linuxfoundation.org/sites/events/files/slides/Faggioli_XenSummit.pdf) |
| 110 |
* [RT-Xen Project](https://sites.google.com/site/realtimexen/) |
| 111 |
* [RTDS-Based-Scheduler](https://wiki.xenproject.org/wiki/RTDS-Based-Scheduler) |
| 112 |
* "The RTDS Scheduler" [on the Xen-Project wiki](https://wiki.xenproject.org/wiki/RTDS-Based-Scheduler) |
| 113 |
* "Xen Project Schedulers" [on the Xen-Project wiki](https://wiki.xenproject.org/wiki/Xen_Project_Schedulers) |
| 114 |
|
| 115 |
# History |
| 116 |
|
| 117 |
------------------------------------------------------------------------ |
| 118 |
Date Revision Version Notes |
| 119 |
---------- -------- -------- ------------------------------------------- |
| 120 |
2016-10-14 1 Xen 4.8 Document written |
| 121 |
2017-08-31 2 Xen 4.10 Revise for work conserving feature |
| 122 |
---------- -------- -------- ------------------------------------------- |