SlideShare a Scribd company logo
Photo
ACRN Real Time Management and
Performance Optimization
Minggui Cao (minggui.cao@intel.com)
ACRN vMeet-Up Europe 2021
Agenda
• Challenges in RTVM (Real Time VM) in ACRN
• ACRN RT main features supported:
• CPU partition / LAPIC / PCI Device passthrough
• CAT configuration
• RT profiling/tuning on ACRN
• Tuning steps for RTVM
• BIOS setting for RT
• Configurations of RTVM example: Preempt-RT Linux
• VMEXIT data profiling
• PMU data sampling example: cyclictest
• Summary
Challenges in RTVM
• Resource contention
o CPU in other VMs
o GPU
o DMA/MMIO operation on Device
• Cost in virtualization
o device virtualization
o VM Exit:
▪ CPUID,specific MSR,Port IO...
• Longer path to optimize RT
o BIOS -> Hypervisor -> Guest OS -> RT task
Hardware( CPU/Device ...)
Linux
Service OS
RT work on ACRN targets:
1. Reduce the impact of virtualization on real time performance
2. Reduce other VM’s interference to RTVM.
ACRN RTVM - CPU partition / LAPIC passthrough
ACRN Hypervisor
RTVM
PCI Device Driver
MSI-X
table
CFG
space
PBA
space
BAR
space
INTx
IRQ
PCI device
direct
interrupt delivery
trap & emulation
pointer MSI MSI-X
LAPIC
MSI
IRQ
INTx
pass-thru
• RTVM CPU partition
• LAPIC PT: Avoid VM-Exit caused by interrupt
• Devices Passthrough
• Some limitations to RTVM:
• Just x2APIC adopted in RTVM (for MSR access)
• PCI devices passthrough
o Just MSI supported, INTx not supported
o After device passthrough configured,guest OS shall avoid to
access configure space and MSI-X table.
ACRN RTVM – Cache partition based on CAT
CAT Waymask0
CAT
PQR_ASSOC
CAT
PQR_ASSOC
CAT Waymask
CAT Waymask0
CAT QOS_MASK0 (COS0)
CAT
PQR_ASSOC
CAT
PQR_ASSOC
CPU0 CPU1 CPU2 CPU3
global
LLC shared LLC RT partition
GPU
GT CLOS
Setting
GT part
• CAT: Cache Allocation Technology
• CPU LLC Cache partition:
o Some cache ways isolated for RTVM cores
o The rest of cache ways shared by other cores.
• GPU LLC
o GPU LLC allocated in the shared LLC
• Avoid other VM to invalidate whole Cache
o “WBINVD” will be trapped into ACRN, and emulated.
ACRN Hypervisor
HMI
Setup #3
RTVM w/ Noise
ACRN Hypervisor
SOS
ACRN DM
Service OS
RTVM
Setup #2
RTVM w/o Noise
Setup #1
Bare-metal
Bare-metal
ACRN DM
Service OS RTVM
RT tuning steps on ACRN:
Linux Linux
BIOS setting- main items for RT
Item Status Note
Hyper-threading Disabled
CPU turbo mode Disabled
P-state/C-State Disabled
GPU frequency Set to 1/3 of MAX
… …
Preempt-RT Linux kernel configurations
https://github.com/projectacrn/acrn-kernel/blob/4.19/preempt-rt/x86-64_defconfig
RT Kernel :linux-4.19.72-rt25+
▪ CONFIG_PREEMPT_RT_FULL=y
▪ CONFIG_NO_HZ=y
▪ CONFIG_NO_HZ_FULL=y
▪ CONFIG_RCU_NOCB_CPU=y
▪ CONFIG_CPU_ISOLATION=y
kernel parameters:
▪ processor.max_cstate=0 intel_idle.max_cstate=0 idle=poll
▪ intel_pstate=disable
▪ isolcpus=nohz,domain,1
▪ nohz_full=1
▪ rcu_nocbs=1 rcu_nocb_poll
▪ irqaffinity=0
Configurations of Preempt-RT Linux as Native:
VMEXIT data profiling-I
• ACRNTrace: https://projectacrn.github.io/latest/tutorials/debug.html?highlight=acrntrace
VMEXIT data profiling-II
• VMEXIT command in hypervisor console (integrated in ACRN2.0 branch)
PMU data sampling example: Cyclictest
• Cyclictest accurately and repeatedly measures the difference between a thread's
intended wake-up time and the time at which it actually wakes up in order to provide
statistics about the system's latencies. It can measure latencies in real-time systems
caused by the hardware, the firmware, and the operating system.
nanosleep nanosleep returns
Latency
...
Timeline
Expected returns
1ms to set
Actual total time
Cyclictest test settting:
• RTVM 2 CPU core isolated:
o House keeping core: core 0
o RT core: core 1
• RT Linux setting:
o Bind all IRQ to Core 0 except local timer
o Bind all RCU task to Core 0
o Set all tasks (non-RT tasks) SCHED_OTHER and
priority 0
## example CMD to run cyclictest
cyclictest -a 1 -p 80 -m -N -D 24h -q -H 30000 --histfile=test.log
numbers
latency
An example for profiling data chart:
Enhanced PMU data profiling in benchmark
• When there are some outliers happens in benchmark, we’d like to know the
root cause
• If PMU data can be offered, it is helpful to root cause.
So we did an enhancement feature/patch to profile PMU data in the benchmark.
You can refer:
https://github.com/mgcao/rt-tests/tree/v1.0-post-pmc/src/cyclictest
Example:
1. Set PMU registers first in RTOS: cyclictestpmc_setting_shcache_misses.sh
2. cyclictest -a 1 -p 80 -m -N -n -D 900 -q -H 10000 --extra_sample --random_sample
500 --max_check 5000
3. Detailed PMU data can be sampled for analysis.
Example for profiling PMU data
PMU data
Latency
Summary:
▪ For real time on ACRN, resource partition for RTVM is a main point,
including CPU, Cache(CAT), Device pass-through…
▪ For RT tuning/profiling: including BIOS setting, RTOS setting, tools to
profile VMEXIT data, PMU data…
▪ Reference resource:
1. Intel® 64 and IA-32 Architectures Software Developer’s Manual
2. Intel® 64 and IA-32 Architectures Optimization Reference Manual
3. cache-allocation-technology-white-paper.pdf
Call for Participation
https://projectacrn.github.io/index.html
Joining ACRN Community Today!!!

More Related Content

PDF
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
PDF
Project ACRN CPU sharing BVT scheduler in ACRN hypervisor
PDF
Project ACRN GVT-d introduction and tutorial
PDF
ACRN vMeet-Up EU 2021 - debug ACRN hypervisor
PDF
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
PDF
Project ACRN hypervisor introduction
PDF
Project ACRN Device Passthrough Introduction
PDF
Project ACRN Device Model architecture introduction
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
Project ACRN CPU sharing BVT scheduler in ACRN hypervisor
Project ACRN GVT-d introduction and tutorial
ACRN vMeet-Up EU 2021 - debug ACRN hypervisor
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
Project ACRN hypervisor introduction
Project ACRN Device Passthrough Introduction
Project ACRN Device Model architecture introduction

What's hot (20)

PDF
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
PDF
ACRN vMeet-Up EU 2021 - Introduction and Architecture Look Forward
PDF
Project ACRN system debug
PDF
ACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
PDF
ACRN vMeet-Up EU 2021 - installation and configuration introduction
PDF
Project ACRN configuration scenarios and config tool
PDF
ACRN Kata Container on ACRN
PDF
Project ACRN: SR-IOV implementation
PDF
Project ACRN how to build a Yocto Project-based SOS
PDF
Project ACRN CSE Virtualization
PDF
Project ACRN expose and pass through platform hidden PCIe devices to SOS
PDF
ACRN vMeet-Up EU 2021 - functional safety design and certification plan
PDF
Project ACRN I2C mediator introduction
PDF
Project ACRN Yocto Project meta-acrn layer introduction
PDF
XPDDS18: The Evolution of Virtualization in the Arm Architecture - Julien Gra...
PDF
Project ACRN EtherCAT 101
PDF
Embedded Systems Conference 2014 Presentation
PDF
SR-IOV: The Key Enabling Technology for Fully Virtualized HPC Clusters
PDF
Virtualization - Kernel Virtual Machine (KVM)
PPTX
PV-Drivers for SeaBIOS using Upstream Qemu
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - Introduction and Architecture Look Forward
Project ACRN system debug
ACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
ACRN vMeet-Up EU 2021 - installation and configuration introduction
Project ACRN configuration scenarios and config tool
ACRN Kata Container on ACRN
Project ACRN: SR-IOV implementation
Project ACRN how to build a Yocto Project-based SOS
Project ACRN CSE Virtualization
Project ACRN expose and pass through platform hidden PCIe devices to SOS
ACRN vMeet-Up EU 2021 - functional safety design and certification plan
Project ACRN I2C mediator introduction
Project ACRN Yocto Project meta-acrn layer introduction
XPDDS18: The Evolution of Virtualization in the Arm Architecture - Julien Gra...
Project ACRN EtherCAT 101
Embedded Systems Conference 2014 Presentation
SR-IOV: The Key Enabling Technology for Fully Virtualized HPC Clusters
Virtualization - Kernel Virtual Machine (KVM)
PV-Drivers for SeaBIOS using Upstream Qemu
Ad

Similar to ACRN vMeet-Up EU 2021 - Real Time Management and Performance Optimization (20)

PDF
Embedded Recipes 2019 - RT is about to make it to mainline. Now what?
PDF
XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.
PDF
See what happened with real time kvm when building real time cloud pezhang@re...
PDF
Intel® RDT Hands-on Lab
PDF
Kernel Recipes 2016 - Understanding a Real-Time System (more than just a kernel)
PDF
Kernel Recipes 2016 - Wo needs a real-time operating system (not you!)
PDF
Deep Dive on Amazon EC2 Instances (March 2017)
PDF
Project ACRN schedule framework introduction
PDF
Shorten Device Boot Time for Automotive IVI and Navigation Systems
PDF
Broken Performance Tools
PDF
Accelerating Virtual Machine Access with the Storage Performance Development ...
PDF
Current and Future of Non-Volatile Memory on Linux
PPTX
DPDK layer for porting IPS-IDS
PDF
load-balancing-method-for-embedded-rt-system-20120711-0940
PDF
When the OS gets in the way
PPTX
Closed Loop Network Automation for Optimal Resource Allocation via Reinforcem...
PPTX
Closed-Loop Network Automation for Optimal Resource Allocation via Reinforcem...
PPTX
QCon 2015 Broken Performance Tools
PPTX
Taming Non-blocking Caches to Improve Isolation in Multicore Real-Time Systems
PPTX
Using Libtracecmd to Analyze Your Latency and Performance Troubles
Embedded Recipes 2019 - RT is about to make it to mainline. Now what?
XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.
See what happened with real time kvm when building real time cloud pezhang@re...
Intel® RDT Hands-on Lab
Kernel Recipes 2016 - Understanding a Real-Time System (more than just a kernel)
Kernel Recipes 2016 - Wo needs a real-time operating system (not you!)
Deep Dive on Amazon EC2 Instances (March 2017)
Project ACRN schedule framework introduction
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Broken Performance Tools
Accelerating Virtual Machine Access with the Storage Performance Development ...
Current and Future of Non-Volatile Memory on Linux
DPDK layer for porting IPS-IDS
load-balancing-method-for-embedded-rt-system-20120711-0940
When the OS gets in the way
Closed Loop Network Automation for Optimal Resource Allocation via Reinforcem...
Closed-Loop Network Automation for Optimal Resource Allocation via Reinforcem...
QCon 2015 Broken Performance Tools
Taming Non-blocking Caches to Improve Isolation in Multicore Real-Time Systems
Using Libtracecmd to Analyze Your Latency and Performance Troubles
Ad

Recently uploaded (20)

PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
ai tools demonstartion for schools and inter college
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
medical staffing services at VALiNTRY
PPTX
Introduction to Artificial Intelligence
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Understanding Forklifts - TECH EHS Solution
Which alternative to Crystal Reports is best for small or large businesses.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
ManageIQ - Sprint 268 Review - Slide Deck
Design an Analysis of Algorithms II-SECS-1021-03
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Odoo Companies in India – Driving Business Transformation.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
ai tools demonstartion for schools and inter college
ISO 45001 Occupational Health and Safety Management System
Softaken Excel to vCard Converter Software.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
medical staffing services at VALiNTRY
Introduction to Artificial Intelligence

ACRN vMeet-Up EU 2021 - Real Time Management and Performance Optimization

  • 1. Photo ACRN Real Time Management and Performance Optimization Minggui Cao (minggui.cao@intel.com) ACRN vMeet-Up Europe 2021
  • 2. Agenda • Challenges in RTVM (Real Time VM) in ACRN • ACRN RT main features supported: • CPU partition / LAPIC / PCI Device passthrough • CAT configuration • RT profiling/tuning on ACRN • Tuning steps for RTVM • BIOS setting for RT • Configurations of RTVM example: Preempt-RT Linux • VMEXIT data profiling • PMU data sampling example: cyclictest • Summary
  • 3. Challenges in RTVM • Resource contention o CPU in other VMs o GPU o DMA/MMIO operation on Device • Cost in virtualization o device virtualization o VM Exit: ▪ CPUID,specific MSR,Port IO... • Longer path to optimize RT o BIOS -> Hypervisor -> Guest OS -> RT task Hardware( CPU/Device ...) Linux Service OS RT work on ACRN targets: 1. Reduce the impact of virtualization on real time performance 2. Reduce other VM’s interference to RTVM.
  • 4. ACRN RTVM - CPU partition / LAPIC passthrough ACRN Hypervisor RTVM PCI Device Driver MSI-X table CFG space PBA space BAR space INTx IRQ PCI device direct interrupt delivery trap & emulation pointer MSI MSI-X LAPIC MSI IRQ INTx pass-thru • RTVM CPU partition • LAPIC PT: Avoid VM-Exit caused by interrupt • Devices Passthrough • Some limitations to RTVM: • Just x2APIC adopted in RTVM (for MSR access) • PCI devices passthrough o Just MSI supported, INTx not supported o After device passthrough configured,guest OS shall avoid to access configure space and MSI-X table.
  • 5. ACRN RTVM – Cache partition based on CAT CAT Waymask0 CAT PQR_ASSOC CAT PQR_ASSOC CAT Waymask CAT Waymask0 CAT QOS_MASK0 (COS0) CAT PQR_ASSOC CAT PQR_ASSOC CPU0 CPU1 CPU2 CPU3 global LLC shared LLC RT partition GPU GT CLOS Setting GT part • CAT: Cache Allocation Technology • CPU LLC Cache partition: o Some cache ways isolated for RTVM cores o The rest of cache ways shared by other cores. • GPU LLC o GPU LLC allocated in the shared LLC • Avoid other VM to invalidate whole Cache o “WBINVD” will be trapped into ACRN, and emulated.
  • 6. ACRN Hypervisor HMI Setup #3 RTVM w/ Noise ACRN Hypervisor SOS ACRN DM Service OS RTVM Setup #2 RTVM w/o Noise Setup #1 Bare-metal Bare-metal ACRN DM Service OS RTVM RT tuning steps on ACRN: Linux Linux
  • 7. BIOS setting- main items for RT Item Status Note Hyper-threading Disabled CPU turbo mode Disabled P-state/C-State Disabled GPU frequency Set to 1/3 of MAX … …
  • 8. Preempt-RT Linux kernel configurations https://github.com/projectacrn/acrn-kernel/blob/4.19/preempt-rt/x86-64_defconfig RT Kernel :linux-4.19.72-rt25+ ▪ CONFIG_PREEMPT_RT_FULL=y ▪ CONFIG_NO_HZ=y ▪ CONFIG_NO_HZ_FULL=y ▪ CONFIG_RCU_NOCB_CPU=y ▪ CONFIG_CPU_ISOLATION=y kernel parameters: ▪ processor.max_cstate=0 intel_idle.max_cstate=0 idle=poll ▪ intel_pstate=disable ▪ isolcpus=nohz,domain,1 ▪ nohz_full=1 ▪ rcu_nocbs=1 rcu_nocb_poll ▪ irqaffinity=0 Configurations of Preempt-RT Linux as Native:
  • 9. VMEXIT data profiling-I • ACRNTrace: https://projectacrn.github.io/latest/tutorials/debug.html?highlight=acrntrace
  • 10. VMEXIT data profiling-II • VMEXIT command in hypervisor console (integrated in ACRN2.0 branch)
  • 11. PMU data sampling example: Cyclictest • Cyclictest accurately and repeatedly measures the difference between a thread's intended wake-up time and the time at which it actually wakes up in order to provide statistics about the system's latencies. It can measure latencies in real-time systems caused by the hardware, the firmware, and the operating system. nanosleep nanosleep returns Latency ... Timeline Expected returns 1ms to set Actual total time
  • 12. Cyclictest test settting: • RTVM 2 CPU core isolated: o House keeping core: core 0 o RT core: core 1 • RT Linux setting: o Bind all IRQ to Core 0 except local timer o Bind all RCU task to Core 0 o Set all tasks (non-RT tasks) SCHED_OTHER and priority 0 ## example CMD to run cyclictest cyclictest -a 1 -p 80 -m -N -D 24h -q -H 30000 --histfile=test.log numbers latency An example for profiling data chart:
  • 13. Enhanced PMU data profiling in benchmark • When there are some outliers happens in benchmark, we’d like to know the root cause • If PMU data can be offered, it is helpful to root cause. So we did an enhancement feature/patch to profile PMU data in the benchmark. You can refer: https://github.com/mgcao/rt-tests/tree/v1.0-post-pmc/src/cyclictest Example: 1. Set PMU registers first in RTOS: cyclictestpmc_setting_shcache_misses.sh 2. cyclictest -a 1 -p 80 -m -N -n -D 900 -q -H 10000 --extra_sample --random_sample 500 --max_check 5000 3. Detailed PMU data can be sampled for analysis.
  • 14. Example for profiling PMU data PMU data Latency
  • 15. Summary: ▪ For real time on ACRN, resource partition for RTVM is a main point, including CPU, Cache(CAT), Device pass-through… ▪ For RT tuning/profiling: including BIOS setting, RTOS setting, tools to profile VMEXIT data, PMU data… ▪ Reference resource: 1. Intel® 64 and IA-32 Architectures Software Developer’s Manual 2. Intel® 64 and IA-32 Architectures Optimization Reference Manual 3. cache-allocation-technology-white-paper.pdf