SlideShare a Scribd company logo
© Copyright 2020 Xilinx
Xen Cache Coloring &
Real-Time
Stefano Stabellini
Marco Solieri
Luca Miccio
Giulio Corradi
© Copyright 2020 Xilinx
Xen in Embedded
Consolidation and Componentization
Isolation
 Security
 Reliability
 Safety
 Interference& Real-Time
© Copyright 2020 Xilinx
Xen Schedulers
CPU CPU
CPU CPU
© Copyright 2020 Xilinx
Xen Schedulers
CPU CPU
CPU CPU
sched=null
sched=credit
vCPU vCPU
vCPU vCPU
vCPU vCPU
vCPU vCPU
vCPU vCPU
© Copyright 2020 Xilinx
Xen Schedulers
CPU CPU
CPU CPU
sched=null
sched=credit
vCPU vCPU
vCPU vCPU
vCPU vCPU
vCPU vCPU
vCPU vCPU
© Copyright 2020 Xilinx
Xen Schedulers
CPU CPU
CPU CPU
sched=null
sched=rtds
vCPU vCPU
vCPU vCPU
vCPU vCPU
vCPU vCPU
vCPU vCPU
© Copyright 2020 Xilinx
Shared L2 cache
L2
Core
1
Core
2
Core
3
Core
4
DDR
L1 L1 L1 L1
© Copyright 2020 Xilinx
Shared L2 cache
L2
Core
1
Core
2
Core
3
Core
4
DDR
L1 L1 L1 L1
© Copyright 2020 Xilinx
Shared L2 cache
L2
Core
1
Core
2
Core
3
Core
4
DDR
L1 L1 L1 L1
© Copyright 2020 Xilinx
Xen Cache Coloring
CPUs clusters often share L2 cache
Interference via L2 cache affects performance
 App0 running on CPU0 can cause cache entries
evictions, which affect App1 running on CPU1
 App1 running on CPU1 could miss a deadline due to
App0’s behavior
 It can happen betweenApps running on the same OS &
between VMs on the same hypervisor
Hypervisor Solution: Cache Partitioning,
AKA Cache Coloring
 Each VM gets its own allocation of cache entries
 No shared cache entries between VMs
 Allows real-time apps to run with deterministic IRQ
latency
Core
1
Core
2
Core
3
Core
4
L2
D
D
R
© Copyright 2020 Xilinx
Colors Calculation
Detect Way Size
 via registers
 via xen command line
Calculate colors masks and total number of available colors
 Xilinx ZynqMP: way size is 65536
 Order 16 -> color bitmask 0xF000 -> 16 colors
D
D
R
© Copyright 2020 Xilinx
Colored Allocation
New colored memory allocator
 In alternative to Buddy
 Pages are stored by color in separate lists
Can be used for Xen memory as well as Domain memory
© Copyright 2020 Xilinx
Coloring Configuration
Xen command line
Dom0-less DomUs
xl domU config files
way_size=65536 xen_colors=0 dom0_colors=1-6
fdt set /chosen/domU0 colors <0x0 0x80>
colors=["10-11"]
© Copyright 2020 Xilinx
Benchmarking
 Hardware: Xilinx MPSoC
 Workload: Bare Metal application
 Stress: Bare Metal application
 Test configuration:
 Measured load: 1500 sums
 Internal load: 8000 sums every 250us
 Interrupt triggered every 8ms
 Samples:1000
 Colored configuration:
 Xen: ["0,1"]
 Motor Control DomU: ["4,7"]
 Stress DomU: ["8,11"]
 Stress2 DomU:["12,15"]
 Linux stress:["2,3"]
 Linux stress command: stress -m 1 --vm-bytes 8M --vm-stride 64 --vm-keep -t 3600 &
© Copyright 2020 Xilinx
L1 vs L2 cache
L1 cache can hide L2 cache interference effects in simple test scenarios
Make sure not use the L1 cache by accident during the measurements
© Copyright 2020 Xilinx
Benchmark #1: Motor Control Execution Time
Measure the time it takes to run a typical motor control execution routine, with
and without interference
© Copyright 2020 Xilinx
Results
No interference:
results for reference
Lower is better
© Copyright 2020 Xilinx
Results
Adding interference:
Xen Coloring
has the best execution time
© Copyright 2020 Xilinx
Results
Increasing interference:
• Xen Coloring is stable
• Other results worsen
© Copyright 2020 Xilinx
Results
Increasing interference
again:
• Xen Coloring is stable
• Other results worsen still
© Copyright 2020 Xilinx
Results
Comparing
Xen vs. Xen Colored
Lower is better
© Copyright 2020 Xilinx
Benchmark #2: interrupt response time
Measure the difference between the time when the interrupt service routine
runs and the time the interrupt is set to fire, with and without interference
Timer in Programmable Logic
© Copyright 2020 Xilinx
Results
No interference:
results for reference
Lower is better
© Copyright 2020 Xilinx
Results
Adding interference:
• Xen without Coloring
worsen
• Xen Coloring is stable
© Copyright 2020 Xilinx
Results
Adding more interference:
• Xen without Coloring
worsen again
• Xen Coloring is stable
© Copyright 2020 Xilinx
Results
Adding even more
interference:
• Xen without Coloring
worsen still
• Xen Coloring is stable
© Copyright 2020 Xilinx
Results
All results together
Xen Coloring provides
stable IRQ latency even
under severe levels of
interference
© Copyright 2020 Xilinx
Conclusions
Xen Cache Coloring offers
 Much lower execution times under stress
 Much lower IRQ latency under stress
Greatly improves Determinism -- measurements have far lower variance
Xen Cache Coloring effectively reduces the effects of cache interference
Enable deployments of real-time and non-real-time workloads on a single SoC
© Copyright 2020 Xilinx
Status
All patches online at:
 https://github.com/Xilinx/xen.git xilinx/release-2020.1
TODO
 Upstreaming
 Linux Dom0 not 1:1 mapped, i.e. PV drivers support
© Copyright 2020 Xilinx
Xen Cache Coloring: Demo
Xen
[0]
Baremetal
Latency
Measurements
[7]
Baremetal Memory
Stress
[10 11]
Dom0
[1 2 3 4 5 6]
© Copyright 2020 Xilinx
Baremetal Latency Measurements
© Copyright 2020 Xilinx
Baremetal Memory Stress
© Copyright 2020 Xilinx
Thank You

More Related Content

PPTX
Yocto Project introduction
PDF
Windows内核技术介绍
PDF
Static Partitioning with Xen, LinuxRT, and Zephyr: A Concrete End-to-end Exam...
PDF
Docker, Konteyner Teknolojisi Nedir? Docker Güvenliği Nasıl Sağlanır?
PPTX
DOS - Disk Operating System
PPTX
Tersine Mühendislik 101
PPTX
Operating Systems - Network Management
PDF
Architecture Of The Linux Kernel
Yocto Project introduction
Windows内核技术介绍
Static Partitioning with Xen, LinuxRT, and Zephyr: A Concrete End-to-end Exam...
Docker, Konteyner Teknolojisi Nedir? Docker Güvenliği Nasıl Sağlanır?
DOS - Disk Operating System
Tersine Mühendislik 101
Operating Systems - Network Management
Architecture Of The Linux Kernel

What's hot (15)

PDF
SELinux basics
PPTX
Linux kernel
PPT
Gnome on wayland at a glance
PDF
Dockerのオフィシャルrubyイメージとは?
PDF
Arm device tree and linux device drivers
PDF
Linux installation
PDF
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
PPTX
Introduction to linux
PDF
Решения Fortinet для обеспечения кибербезопасности промышленных систем автома...
PDF
Stefano Cordibella - An introduction to Yocto Project
PPTX
UNIX Operating System
PPTX
Linux introduction, class 1
PDF
Building Embedded Linux Systems Introduction
PDF
Linux dma engine
PDF
باللغة العربية JSON دورة
SELinux basics
Linux kernel
Gnome on wayland at a glance
Dockerのオフィシャルrubyイメージとは?
Arm device tree and linux device drivers
Linux installation
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
Introduction to linux
Решения Fortinet для обеспечения кибербезопасности промышленных систем автома...
Stefano Cordibella - An introduction to Yocto Project
UNIX Operating System
Linux introduction, class 1
Building Embedded Linux Systems Introduction
Linux dma engine
باللغة العربية JSON دورة
Ad

Similar to Xen Cache Coloring: Interference-Free Real-Time System (20)

PDF
Cache coloring Xen Summit 2020
PDF
Xen in Safety-Critical Systems - Critical Summit 2022
PDF
Introduction to NetBSD kernel
PDF
XDF18: Heterogeneous Real-Time SoC Software Architecture - Stefano Stabellini...
PPTX
First steps on CentOs7
PDF
What Linux can learn from Solaris performance and vice-versa
PPTX
Developing Real-Time Systems on Application Processors
PPTX
Lect 1_Embedded Linux Embedded RTOS ppt
PDF
How to-boot-linuxl-on-your-soc-boards
PDF
Making Linux do Hard Real-time
PPT
Synchronization linux
PPTX
Operating systems (For CBSE School Students)
PDF
Linux kernel 2.6 document
PPTX
Linux Kernel Tour
PDF
NetBSD and Linux for Embedded Systems
PPTX
VM Forking and Hypervisor-based fuzzing
PDF
introduction.pdf
PDF
Qualcomm centriq 2400 hot chips final submission corrected
PPTX
Lec 10-linux-review
PPT
Introduction to Linux Kernel by Quontra Solutions
Cache coloring Xen Summit 2020
Xen in Safety-Critical Systems - Critical Summit 2022
Introduction to NetBSD kernel
XDF18: Heterogeneous Real-Time SoC Software Architecture - Stefano Stabellini...
First steps on CentOs7
What Linux can learn from Solaris performance and vice-versa
Developing Real-Time Systems on Application Processors
Lect 1_Embedded Linux Embedded RTOS ppt
How to-boot-linuxl-on-your-soc-boards
Making Linux do Hard Real-time
Synchronization linux
Operating systems (For CBSE School Students)
Linux kernel 2.6 document
Linux Kernel Tour
NetBSD and Linux for Embedded Systems
VM Forking and Hypervisor-based fuzzing
introduction.pdf
Qualcomm centriq 2400 hot chips final submission corrected
Lec 10-linux-review
Introduction to Linux Kernel by Quontra Solutions
Ad

More from Stefano Stabellini (13)

PDF
Xen Safety Embedded OSS Summit April 2024 v4.pdf
PDF
Safety-Certifying Open Source Software: The Case of the Xen Hypervisor
PDF
ELC21: VM-to-VM Communication Mechanisms for Embedded
PDF
RunX ELCE 2020
PDF
RunX: deploy real-time OSes as containers at the edge
PDF
System Device Tree update: Bus Firewalls and Lopper
PDF
Dom0less - Xen Developer Summit 2019
PDF
Xen on ARM for embedded and IoT: from secure containers to dom0less systems
PDF
Xen and the art of embedded virtualization (ELC 2017)
PDF
Xen Project for ARM Servers
PDF
Xen and OpenStack
PDF
XDS15: Project Raisin
PDF
OpenStack and Xen
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Safety-Certifying Open Source Software: The Case of the Xen Hypervisor
ELC21: VM-to-VM Communication Mechanisms for Embedded
RunX ELCE 2020
RunX: deploy real-time OSes as containers at the edge
System Device Tree update: Bus Firewalls and Lopper
Dom0less - Xen Developer Summit 2019
Xen on ARM for embedded and IoT: from secure containers to dom0less systems
Xen and the art of embedded virtualization (ELC 2017)
Xen Project for ARM Servers
Xen and OpenStack
XDS15: Project Raisin
OpenStack and Xen

Recently uploaded (20)

PPTX
assetexplorer- product-overview - presentation
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
System and Network Administraation Chapter 3
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
top salesforce developer skills in 2025.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
ai tools demonstartion for schools and inter college
assetexplorer- product-overview - presentation
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
Understanding Forklifts - TECH EHS Solution
Wondershare Filmora 15 Crack With Activation Key [2025
Digital Systems & Binary Numbers (comprehensive )
System and Network Administraation Chapter 3
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
How to Migrate SBCGlobal Email to Yahoo Easily
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
top salesforce developer skills in 2025.pdf
CHAPTER 2 - PM Management and IT Context
PTS Company Brochure 2025 (1).pdf.......
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
Which alternative to Crystal Reports is best for small or large businesses.pdf
Designing Intelligence for the Shop Floor.pdf
ai tools demonstartion for schools and inter college

Xen Cache Coloring: Interference-Free Real-Time System

  • 1. © Copyright 2020 Xilinx Xen Cache Coloring & Real-Time Stefano Stabellini Marco Solieri Luca Miccio Giulio Corradi
  • 2. © Copyright 2020 Xilinx Xen in Embedded Consolidation and Componentization Isolation  Security  Reliability  Safety  Interference& Real-Time
  • 3. © Copyright 2020 Xilinx Xen Schedulers CPU CPU CPU CPU
  • 4. © Copyright 2020 Xilinx Xen Schedulers CPU CPU CPU CPU sched=null sched=credit vCPU vCPU vCPU vCPU vCPU vCPU vCPU vCPU vCPU vCPU
  • 5. © Copyright 2020 Xilinx Xen Schedulers CPU CPU CPU CPU sched=null sched=credit vCPU vCPU vCPU vCPU vCPU vCPU vCPU vCPU vCPU vCPU
  • 6. © Copyright 2020 Xilinx Xen Schedulers CPU CPU CPU CPU sched=null sched=rtds vCPU vCPU vCPU vCPU vCPU vCPU vCPU vCPU vCPU vCPU
  • 7. © Copyright 2020 Xilinx Shared L2 cache L2 Core 1 Core 2 Core 3 Core 4 DDR L1 L1 L1 L1
  • 8. © Copyright 2020 Xilinx Shared L2 cache L2 Core 1 Core 2 Core 3 Core 4 DDR L1 L1 L1 L1
  • 9. © Copyright 2020 Xilinx Shared L2 cache L2 Core 1 Core 2 Core 3 Core 4 DDR L1 L1 L1 L1
  • 10. © Copyright 2020 Xilinx Xen Cache Coloring CPUs clusters often share L2 cache Interference via L2 cache affects performance  App0 running on CPU0 can cause cache entries evictions, which affect App1 running on CPU1  App1 running on CPU1 could miss a deadline due to App0’s behavior  It can happen betweenApps running on the same OS & between VMs on the same hypervisor Hypervisor Solution: Cache Partitioning, AKA Cache Coloring  Each VM gets its own allocation of cache entries  No shared cache entries between VMs  Allows real-time apps to run with deterministic IRQ latency Core 1 Core 2 Core 3 Core 4 L2 D D R
  • 11. © Copyright 2020 Xilinx Colors Calculation Detect Way Size  via registers  via xen command line Calculate colors masks and total number of available colors  Xilinx ZynqMP: way size is 65536  Order 16 -> color bitmask 0xF000 -> 16 colors D D R
  • 12. © Copyright 2020 Xilinx Colored Allocation New colored memory allocator  In alternative to Buddy  Pages are stored by color in separate lists Can be used for Xen memory as well as Domain memory
  • 13. © Copyright 2020 Xilinx Coloring Configuration Xen command line Dom0-less DomUs xl domU config files way_size=65536 xen_colors=0 dom0_colors=1-6 fdt set /chosen/domU0 colors <0x0 0x80> colors=["10-11"]
  • 14. © Copyright 2020 Xilinx Benchmarking  Hardware: Xilinx MPSoC  Workload: Bare Metal application  Stress: Bare Metal application  Test configuration:  Measured load: 1500 sums  Internal load: 8000 sums every 250us  Interrupt triggered every 8ms  Samples:1000  Colored configuration:  Xen: ["0,1"]  Motor Control DomU: ["4,7"]  Stress DomU: ["8,11"]  Stress2 DomU:["12,15"]  Linux stress:["2,3"]  Linux stress command: stress -m 1 --vm-bytes 8M --vm-stride 64 --vm-keep -t 3600 &
  • 15. © Copyright 2020 Xilinx L1 vs L2 cache L1 cache can hide L2 cache interference effects in simple test scenarios Make sure not use the L1 cache by accident during the measurements
  • 16. © Copyright 2020 Xilinx Benchmark #1: Motor Control Execution Time Measure the time it takes to run a typical motor control execution routine, with and without interference
  • 17. © Copyright 2020 Xilinx Results No interference: results for reference Lower is better
  • 18. © Copyright 2020 Xilinx Results Adding interference: Xen Coloring has the best execution time
  • 19. © Copyright 2020 Xilinx Results Increasing interference: • Xen Coloring is stable • Other results worsen
  • 20. © Copyright 2020 Xilinx Results Increasing interference again: • Xen Coloring is stable • Other results worsen still
  • 21. © Copyright 2020 Xilinx Results Comparing Xen vs. Xen Colored Lower is better
  • 22. © Copyright 2020 Xilinx Benchmark #2: interrupt response time Measure the difference between the time when the interrupt service routine runs and the time the interrupt is set to fire, with and without interference Timer in Programmable Logic
  • 23. © Copyright 2020 Xilinx Results No interference: results for reference Lower is better
  • 24. © Copyright 2020 Xilinx Results Adding interference: • Xen without Coloring worsen • Xen Coloring is stable
  • 25. © Copyright 2020 Xilinx Results Adding more interference: • Xen without Coloring worsen again • Xen Coloring is stable
  • 26. © Copyright 2020 Xilinx Results Adding even more interference: • Xen without Coloring worsen still • Xen Coloring is stable
  • 27. © Copyright 2020 Xilinx Results All results together Xen Coloring provides stable IRQ latency even under severe levels of interference
  • 28. © Copyright 2020 Xilinx Conclusions Xen Cache Coloring offers  Much lower execution times under stress  Much lower IRQ latency under stress Greatly improves Determinism -- measurements have far lower variance Xen Cache Coloring effectively reduces the effects of cache interference Enable deployments of real-time and non-real-time workloads on a single SoC
  • 29. © Copyright 2020 Xilinx Status All patches online at:  https://github.com/Xilinx/xen.git xilinx/release-2020.1 TODO  Upstreaming  Linux Dom0 not 1:1 mapped, i.e. PV drivers support
  • 30. © Copyright 2020 Xilinx Xen Cache Coloring: Demo Xen [0] Baremetal Latency Measurements [7] Baremetal Memory Stress [10 11] Dom0 [1 2 3 4 5 6]
  • 31. © Copyright 2020 Xilinx Baremetal Latency Measurements
  • 32. © Copyright 2020 Xilinx Baremetal Memory Stress
  • 33. © Copyright 2020 Xilinx Thank You