Linux symposium 2012Jiun-Hung Ding, Chang-Jung Lin, Ping-Hao ChangChieh-Hao Tsang, Wei-Chung Hsu, Yeh-Ching ChungARMVISOR ...
Hypervisor on ARM architectureARMVISOR                                 2
KVM Linux Kernel module Free, open Many developers maintain it!!! QEMU                                   3
System Architecture           Guest           QEMU             Device     Driver Linux KVM          Hardware              ...
Trap & emulate                  Guest OS    User space     trap   Kernel space                   VMM                      ...
Challenges ARM is non-virtualizable.   Sensitive instructions   Privileged instructions                              6
Non-virtualizable    2531 sensitive       sensitive but       25 critical    non-privileged      instructions      instruc...
Challenges ARM is non-virtualizable   Critical instructions Possible solutions   Hardware support   Dynamic binary tr...
Implementation CPU virtualization Memory virtualization IO virtualization Optimization                          9
User space                    Kernel space                   Guest Mode     1. VM initialization                  2. Retur...
CPU Virtualization                     11
CPU Virtualization ARM: non-virtualizable ISA   Para-virtualization Manually insert software interrupts (SWI) into  gue...
Para-virtualization…mov r0, r0add sp, spmovs pc, lr…                      13
Para-virtualization (cont.)                    .macro virt_svc_movs, inst                    SWI 0x190…                   ...
UND            ABORT       SWI     IRQ/FIQ                      KVM Trap Entry                       KVM/GuestHost Trap Ha...
KVM Vectoroxffff1000                      0x1C         FIQ                      0x18         IRQ                      0x14...
KVM Vector             The KVM trap               Interfaceoxffff10000xffff001c                 KVMoxffff0000      Vector ...
Memory Virtualization                        18
GVAGuestPTB        GPA              19
Shadow Page Tables Map guest virtual address to host physical  address For each guest page table (GPT), ARMvisor  will a...
GuestPTB                    GVA                       GPA                             Host                       HVA   PTB...
Emulation FlowPABT/DABT                                               Hidden protection fault   trap  guest             Gu...
Shadow Page Tables Map guest virtual address to host physical  address For each guest page table (GPT), ARMvisor  will a...
Synchronization Write protect page table page   Modification would cause a protection fault.   Reverse map (RMAP) : Rec...
Permission Emulation (1) Guest OS in non-privileged mode Some instructions access kernel space with  user permission   ...
Permission Mapping Permission mechanism on ARM   Permission bits   Domain     No access     Client     Manager      ...
Using Domain Mechanism                      GUD    GKD Virtual User Space   CLIENT NA Virtual Kernel Space CLIENT CLIENT  ...
Optimizations                30
Virtualization Overhead -CPU CPU virtualization   Frequent lightweight traps result lots of context    switch Try to re...
CPU Optimization Shadow file register (SFR)   Map VCPU’s shadow state of the register file into    memory region that is...
mcr cpsr, r1           oxffff2000 VCPURegister      Sync  File                     Shadow        Read/Write               ...
CPU Optimization Shadow file register (SFR)   Map VCPU’s shadow state of the register file into    memory region that is...
Virtualization Overhead –MEM Memory virtualization   Synchronization model Try to reduce…   Protection faults         ...
Memory Optimization Para-virtualization: hyper calls for PT  modifications   When Guest OS sets PTEs   When Guest OS is...
Implementation Status                        39
Experiment Board ARMvisor supports ARMv6 & ARMv7 architecture in host   ARM v6 11mpcore      ARM v7 cortex-a8            ...
Environment Host OS: Linux 2.6.35 Ubuntu Guest OS: Linux 2.6.31 LMBench                                 41
Experiment Data10080604020 0            base   cpu opt   mem opt   all opt                                                ...
16     Experiment Data     15.2014        12.46                                                     12.1712    11.24      ...
Related Work VMware MVP Xen-ARM B LABS CODEZEOR OK Labs OKL4 Virtual Open System                        44
Conclusion ARMvisor supports ARMv6 & ARMv7  architecture in host   Support RealView EB and Beagle Board CPU and memory ...
Future Work I/O optimization Support ARM hardware virtualization  extensions Multi-VM Multi-core …                   ...
Contact Us SSLAB, NTHU, Taiwan Website   https://sites.google.com/a/sslab.cs.nthu.edu.tw/ar    mvisor/ Thanks For Your...
IO Virtualization Overhead           Guest                   Driver           QEMU             Device     Driver Linux KVM...
Upcoming SlideShare
Loading in …5
×

ARMvisor @ Linux Symposium 2012

1,582 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,582
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

ARMvisor @ Linux Symposium 2012

  1. 1. Linux symposium 2012Jiun-Hung Ding, Chang-Jung Lin, Ping-Hao ChangChieh-Hao Tsang, Wei-Chung Hsu, Yeh-Ching ChungARMVISOR 1
  2. 2. Hypervisor on ARM architectureARMVISOR 2
  3. 3. KVM Linux Kernel module Free, open Many developers maintain it!!! QEMU 3
  4. 4. System Architecture Guest QEMU Device Driver Linux KVM Hardware 4
  5. 5. Trap & emulate Guest OS User space trap Kernel space VMM 5
  6. 6. Challenges ARM is non-virtualizable.  Sensitive instructions  Privileged instructions 6
  7. 7. Non-virtualizable 2531 sensitive sensitive but 25 critical non-privileged instructions instructions instructions 6 privileged instructions 7
  8. 8. Challenges ARM is non-virtualizable  Critical instructions Possible solutions  Hardware support  Dynamic binary translation (DBT)  Para-virtualization 8
  9. 9. Implementation CPU virtualization Memory virtualization IO virtualization Optimization 9
  10. 10. User space Kernel space Guest Mode 1. VM initialization 2. Return to QEMU 3. Run VM 4. Enter Guest 5. Exit Guest Lightweight trap Enter Guest Heavyweight trap Exit Guest Return to QEMU Run VM Enter Guest QEMU KVM Guest OS
  11. 11. CPU Virtualization 11
  12. 12. CPU Virtualization ARM: non-virtualizable ISA  Para-virtualization Manually insert software interrupts (SWI) into guest OS 12
  13. 13. Para-virtualization…mov r0, r0add sp, spmovs pc, lr… 13
  14. 14. Para-virtualization (cont.) .macro virt_svc_movs, inst SWI 0x190… instmov r0, r0 .endmadd sp, spvirt_svc_movs “movs pc, lr”… 14
  15. 15. UND ABORT SWI IRQ/FIQ KVM Trap Entry KVM/GuestHost Trap Handler Context Switch Unit KVM Trap DispatcherInstruction MMU Exception/Interrupt QEMU I/OEmulation Emulation Emulation Emulation 15
  16. 16. KVM Vectoroxffff1000 0x1C FIQ 0x18 IRQ 0x14 (Reserved*)0xffff001c 0x10 Data Abort Kernel 0x0C Prefetch Abort Vector 0x08 Software Interruptoxffff0000 0x04 Undefined Instruction 0x00 Reset 16
  17. 17. KVM Vector The KVM trap Interfaceoxffff10000xffff001c KVMoxffff0000 Vector 17
  18. 18. Memory Virtualization 18
  19. 19. GVAGuestPTB GPA 19
  20. 20. Shadow Page Tables Map guest virtual address to host physical address For each guest page table (GPT), ARMvisor will allocate a shadow page table (SPT) to map it. 20
  21. 21. GuestPTB GVA GPA Host HVA PTB New SPTE !!! HPA 21
  22. 22. Emulation FlowPABT/DABT Hidden protection fault trap guest Guest MMIO Shadow Shadowpage table permission access page table page table walker checker checker mapping update True permission fault Hidden translation faultTrue Translation fault MMIO emulation 22
  23. 23. Shadow Page Tables Map guest virtual address to host physical address For each guest page table (GPT), ARMvisor will allocate a shadow page table (SPT) to map it. How to keep coherence between SPT and GPT? 23
  24. 24. Synchronization Write protect page table page  Modification would cause a protection fault.  Reverse map (RMAP) : Record reverse mapping form guest physical page to SPT entries 25
  25. 25. Permission Emulation (1) Guest OS in non-privileged mode Some instructions access kernel space with user permission  LDRBT, LDRT, STRBT, STRT Double shadow page table 26
  26. 26. Permission Mapping Permission mechanism on ARM  Permission bits  Domain  No access  Client  Manager 28
  27. 27. Using Domain Mechanism GUD GKD Virtual User Space CLIENT NA Virtual Kernel Space CLIENT CLIENT 29
  28. 28. Optimizations 30
  29. 29. Virtualization Overhead -CPU CPU virtualization  Frequent lightweight traps result lots of context switch Try to reduce…  number of traps  Overhead of emulation 31
  30. 30. CPU Optimization Shadow file register (SFR)  Map VCPU’s shadow state of the register file into memory region that is both accessible for the VMM and guest with RW permission. 33
  31. 31. mcr cpsr, r1 oxffff2000 VCPURegister Sync File Shadow Read/Write Register File Instructions KVM/Guest Context Switch Interface oxffff1000 KVM vector oxffff0000 34
  32. 32. CPU Optimization Shadow file register (SFR)  Map VCPU’s shadow state of the register file into memory region that is both accessible for the VMM and guest with RW permission. Para-virtualization: Fast instruction trap  Sets of pre-defined macros which is composed of encoded information of the replaced instructions. 36
  33. 33. Virtualization Overhead –MEM Memory virtualization  Synchronization model Try to reduce…  Protection faults 37
  34. 34. Memory Optimization Para-virtualization: hyper calls for PT modifications  When Guest OS sets PTEs  When Guest OS is going to free a L2 page table 38
  35. 35. Implementation Status 39
  36. 36. Experiment Board ARMvisor supports ARMv6 & ARMv7 architecture in host ARM v6 11mpcore ARM v7 cortex-a8 40
  37. 37. Environment Host OS: Linux 2.6.35 Ubuntu Guest OS: Linux 2.6.31 LMBench 41
  38. 38. Experiment Data10080604020 0 base cpu opt mem opt all opt 42
  39. 39. 16 Experiment Data 15.2014 12.46 12.1712 11.24 10.81 9.37 9.9410 8.45 7.97 8.048 7.18 5.78 5.666 4.63 4.39 4.414 1.89 1.432 1.230 all opt 43
  40. 40. Related Work VMware MVP Xen-ARM B LABS CODEZEOR OK Labs OKL4 Virtual Open System 44
  41. 41. Conclusion ARMvisor supports ARMv6 & ARMv7 architecture in host  Support RealView EB and Beagle Board CPU and memory optimization gain lots of performance improvement  Reduce traps  Decrease protection faults 45
  42. 42. Future Work I/O optimization Support ARM hardware virtualization extensions Multi-VM Multi-core … 46
  43. 43. Contact Us SSLAB, NTHU, Taiwan Website  https://sites.google.com/a/sslab.cs.nthu.edu.tw/ar mvisor/ Thanks For Your Attention 47
  44. 44. IO Virtualization Overhead Guest Driver QEMU Device Driver Linux KVM Hardware 49

×