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