Virtualization and Performance: Understanding VM Exits

Posted kelamoyujuzhen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Virtualization and Performance: Understanding VM Exits相关的知识,希望对你有一定的参考价值。

翻译自:Virtualization and Performance: Understanding VM Exits

出于对特定指令 或 特定事件(eg.  page fault)的响应而导致的VM Exit(虚拟机退出)是造成虚拟化系统性能下降的主要原因。但是你有没有想过,为什么会这样?无论出于什么原因,VM Exit的背后究竟发生了什么?

VM Exit意味着从当前运行的VM 到 VMM之间存在一个转换点,而VMM出于特定原因必须执行系统控制。通常,处理器必须保存VM退出时运行状态的快照。对于英特尔架构,大概有如下几步:

  1. 在VM-exit information fields 处记录导致VM Eixt的信息(包括exit reason, exit qualification, guest address),并更新VM-entry control fields.
  2. 保存处于Guest Mode状态下的CPU状态,包括control registers(控制寄存器), debug registers(调试寄存器), MSRs  segment registers(段寄存器), descriptor-table registers, RIP, RSP, and RFLAGS, 以及非状态寄存器。
  3. MSRs  用于控制报告处理器性能,将MSRs  保存到VM-exit MSR-store area
  4. 根据host-state area和一些VM-exit controls加载processor state,包括control registers, debug registers, MSRs, host table and descriptor-table registers, RIP, RSP, and RFLAGS, page-directory pointer table entries, as well as non-register state.
  5. 从VM-exit MSR-store area加载MSRs

哦,不要忘记在VMM执行了系统管理功能之后,将执行相应的VM entry,将处理器控制从VMM转移到VM!

现在,您可以看到为什么VM退出会产生相当大的开销,为单个转换(VM到VMM)浪费数百或数千个CPU周期。 顺便说一下,为了缓解这个问题,Intel付出了相当大的努力减少了单个转换(VM到VMM)所需的时钟周期数。

以上是关于Virtualization and Performance: Understanding VM Exits的主要内容,如果未能解决你的问题,请参考以下文章

Intel‘s EPT and AMD‘s NPT - Hardware Virtualization: the Nuts and Bolts

Windows10启动Docker报错:Hardware assisted virtualization and data execution protection must enabled BIOS

Docker安装报错Hardware assisted virtualization and data execution protection must be enabled in the BIOS

Virtualization Essentials---Understanding hypervisor

论文研读《Virtualization and deep recognition for system fault classi?cation》_系统故障分类的虚拟化与深度识别_2017

SupportFragment + TabWidget + Samsung Device = "java.lang.IllegalStateException: Can not perfor