October 2014 Real-Time Virtualization – How Crazy Are We?

October 2014 Real-Time Virtualization – How Crazy Are We?

Siemens Corporate Technology | October 2014 Real-Time Virtualization – How Crazy Are We? Image: Marcus Quigmire, licensed under CC BY 2.0 Unrestricted © Siemens AG 2014. All rights reserved Real-Time Systems Can Benefit from Virtualization Virtualizable real-time systems • Possible scenarios • Control systems (industry, healthcare, automotive etc.) • Communication systems (media streaming & switching, etc.) • Trading systems (stocks, goods, etc.) • … • Primary drivers • Consolidation, include mixed criticality • Legacy system migration • [Development & test] Images: Ethernet switch by Ben Stanfield, licensed under CC BY-SA 2.0, stock market by Katrina.Tuliao, licensed under CC BY 2.0 Page 2 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved Virtualization ≠ acceleration The critical data path with and without virtualization Real-time Software Other Stack Guests Real-time Software Real-time Stack vCPU vCPU Software Stack Virtual I/O Virt. I/O Hypervisor Hypervisor CPU CPU CPU I/O interface I/O interface I/O interface Event Reaction Event Reaction Event Reaction Native real-time setup Hardware-assisted Resource sharing & abstraction virtualization via emulation Page 3 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved RT Virtualization – Two Architectural Options Real-time Application Real-time Guest Application OS GPOS RTOS RTOS RT-Hyperv. Hypervisor Real-Time Host OS Partitioning Hypervisor CPU CPU CPU CPU I/O I/O I/O I/O Page 4 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved Architecture of a KVM-based RT-Hypervisor Non-RT Real-time Application Application Stand-alone RTOS or AMP Guest RT-enhanced QEMU PREEMPT-RT + KVM on dedicated cores Hardware Page 5 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved PREEMPT-RT enables RT-Virtualization Role of Linux extension PREEMPT-RT • Reduce worst-case event delivery latencies • Integrates KVM support • Original use-case: virtualization + native RT applications • Allows to prioritize virtualization workload over uncritical tasks • Can be combined with CPU isolation • 1:1 assignment: host CPU – RT guest CPU • Off-load all non-RT tasks (including low-priority QEMU threads) • Warning: No 100% guest CPU load feasible! • NO_HZ_FULL extensions work toward enabling this Page 6 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved Decent Latencies Achievable in KVM-only Setups Measuring I/O latency of an RT Guest • Host setup Real-Time RTOS • KVM on x86 PREEMPT-RT Linux Linux Guest • Virtual machine on dedicated core with RTnet RT-KVM • Intel NIC (E1000 family) as I/O device, directly assigned to guest other HW NIC NIC other HW • Permanent disk I/O load • Guest setup • Proprietary RTOS • Real-time network stack • Measurement setup • Linux/Xenomai (native installation) • Real-time network stack RTnet • Periodic ICMP ping messages sent to target • Recorded round-trip latency (error <50 µs) => Worst-case latency after 16h: 330 µs Page 7 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved RT-QEMU is Required for Emulating in Real-Time QEMU as a Real-Time Device Emulator • Scenarios • Guest uses NIC A, host has NIC B attached • Legacy devices are no longer available on a modern host • Multiple guests share single I/O interface for talking to different devices (e.g. on a CAN bus) • QEMU can handle such scenarios via emulation • Requirements on emulation • Equivalent functional behavior • Devices models need to react in time on guest requests • Devices models need to deliver external events to the guest timely Page 8 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved Concurrency in QEMU/KVM – The Big QEMU Lock (BQL) VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU VCPU IO-Thread Device models I/O back-ends GUI QMP, HMP ... Page 9 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved Critical BQL Zones CPUState • Read/write access • cpu_single_env Coalesced MMIO flushing PIO/MMIO request-to-device dispatching Back-end access • TX on network layer • Write to character device • Timer setup, etc. Back-end events (iothread jobs) • Network RX, read from chardev, timer signals, … IRQ delivery • Raising/lowering from device model to IRQ chip • Injection into VCPU (if user space IRQ chips) Page 10 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved Challenge 1: Management of Task Priorities There can be many task involved • VCPU threads • VIRQ injection threads (QEMU: iothreads) • Kernel threads (IRQ, worker, RCU, forgot anything?) Problems • Wrong configuration destroys RT • ...or locks up parts or all of your system • Actually a generic RT Linux issue Proposals? • Tool-based dependency discovery? • Tool-based configuration? • (More) automatic configuration? Page 11 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved Challenge 2: Management of IRQ Parameters Relevant IRQ parameters • CPU affinity • Thread priority (if any) How to configure in advance? • Line-based IRQs may be reachable via /proc/irQ • MSIs are not... • Dynamic IRQ numbers – how to associate with devices? Proposals? • Something like /sys/devices/.../<device>/irQ_vector<N>/...? Page 12 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved Safe Isolation via Linux? SIL 1..4 ASIL Code size Formal Methods SIL2Linux Certification Legacy Code Consolidation Stahlkocher, CC BY-SA 3.0 Validation Mixed Criticality Multicore Page 13 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved What about postponing the hypervisor start? Basic concept of late partitioning Images Linux Configs Linux Linux RT Linux App [Boot Loader] Firmware/BIOS Partitioning Layer Partitioning Layer Hardware Hardware Hardware 1. Boot phase 2. Partitioning 3. Operational phase phase Page 14 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved Jailhouse: Keep it simple, keep it open The Philosophy of Jailhouse • Avoid emulation, focus on hardware assisted isolation • No overcommitment, no scheduler, static partitioning • Directly assign physical devices, do not emulate them • You need more? Use KVM! • Only expose resources that are required for operation • No boot-up phase virtualization • Board initialization done by Linux • Off-load uncritical tasks to Linux • Initial setup / image loading • Reconfigurations while in non-operational mode • Monitoring, logging etc. • Released under GPLv2 => Minimal-sized certifiable hypervisor with full CPU assignment and Linux look-and-feel Page 15 October 2014 Jan Kiszka, Corporate Technology Unrestricted © Siemens AG 2014. All rights reserved.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    15 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us