2019-06-27 20:28:40 +08:00
|
|
|
.. _rtvm_workload_guideline:
|
|
|
|
|
2021-02-13 08:27:24 +08:00
|
|
|
Real-Time VM Application Design Guidelines
|
2019-06-27 20:28:40 +08:00
|
|
|
##########################################
|
|
|
|
|
|
|
|
An RTOS developer must be aware of the differences between running applications on a native
|
|
|
|
platform and a real time virtual machine (RTVM), especially issues impacting real time
|
|
|
|
performance. For example, a real time thread should avoid triggering any VM-Exit. If a VM-Exit
|
|
|
|
is triggered, the developer must account for an additional margin of CPU cycles for the
|
|
|
|
incremental runtime overhead.
|
|
|
|
|
|
|
|
This document provides some application design guidelines when using an RTVM within the ACRN hypervisor.
|
|
|
|
|
2021-02-13 08:27:24 +08:00
|
|
|
Run RTVM With Dedicated Resources/Devices
|
2019-06-27 20:28:40 +08:00
|
|
|
*****************************************
|
|
|
|
|
|
|
|
For best practice, ACRN allocates dedicated CPU, memory resources, and cache resources (using Intel
|
2020-03-26 12:20:08 +08:00
|
|
|
Resource Directory allocation Technology such as CAT, MBA) to RTVMs. For best real time performance
|
2020-06-19 02:38:09 +08:00
|
|
|
of I/O devices, we recommend using dedicated (passthrough) PCIe devices to avoid VM-Exit at run time.
|
2019-06-27 20:28:40 +08:00
|
|
|
|
|
|
|
.. note::
|
2020-06-19 02:38:09 +08:00
|
|
|
The configuration space for passthrough PCI devices is still emulated and accessing it will
|
2019-06-27 20:28:40 +08:00
|
|
|
trigger a VM-Exit.
|
|
|
|
|
2021-02-13 08:27:24 +08:00
|
|
|
RTVM With Virtio PMD (Polling Mode Driver) for I/O Sharing
|
2019-06-27 20:28:40 +08:00
|
|
|
**********************************************************
|
|
|
|
|
|
|
|
If the RTVM must use shared devices, we recommend using PMD drivers that can eliminate the
|
|
|
|
unpredictable latency caused by guest I/O trap-and-emulate access. The RTVM application must be
|
|
|
|
aware that the packets in the PMD driver may arrive or be sent later than expected.
|
|
|
|
|
2021-02-13 08:27:24 +08:00
|
|
|
RTVM With HV Emulated Device
|
2019-06-27 20:28:40 +08:00
|
|
|
****************************
|
|
|
|
|
|
|
|
ACRN uses hypervisor emulated virtual UART (vUART) devices for inter-VM synchronization such as
|
2020-10-02 08:45:47 +08:00
|
|
|
logging output or command send/receive. Currently, the vUART only works in polling mode, but
|
2019-06-27 20:28:40 +08:00
|
|
|
may be extended to support interrupt mode in a future release. In the meantime, for better RT
|
|
|
|
behavior, the RT application using the vUART shall reserve a margin of CPU cycles to accommodate
|
2019-07-10 08:13:35 +08:00
|
|
|
for the additional latency introduced by the VM-Exit to the vUART I/O registers (~2000-3000 cycles
|
2019-06-27 20:28:40 +08:00
|
|
|
per register access).
|
|
|
|
|
2021-02-13 08:27:24 +08:00
|
|
|
DM Emulated Device (Except PMD)
|
2019-06-27 20:28:40 +08:00
|
|
|
*******************************
|
|
|
|
|
2020-10-02 08:45:47 +08:00
|
|
|
We recommend **not** using DM-emulated devices in an RTVM.
|