WO2022178988A1 - 虚拟机热迁移的方法及其装置 - Google Patents

虚拟机热迁移的方法及其装置 Download PDF

Info

Publication number
WO2022178988A1
WO2022178988A1 PCT/CN2021/094935 CN2021094935W WO2022178988A1 WO 2022178988 A1 WO2022178988 A1 WO 2022178988A1 CN 2021094935 W CN2021094935 W CN 2021094935W WO 2022178988 A1 WO2022178988 A1 WO 2022178988A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
instruction
host
destination host
instruction set
Prior art date
Application number
PCT/CN2021/094935
Other languages
English (en)
French (fr)
Inventor
蔡雨
张春晖
Original Assignee
澜起电子科技(昆山)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 澜起电子科技(昆山)有限公司 filed Critical 澜起电子科技(昆山)有限公司
Priority to US18/278,433 priority Critical patent/US20240231882A9/en
Publication of WO2022178988A1 publication Critical patent/WO2022178988A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing

Definitions

  • the present application relates to the field of computer technology, and more particularly to a method and device for hot migration of a virtual machine.
  • Virtual machines created based on libvirt/QEMU/KVM usually have three modes: host CPU complete passthrough (host-passthrough), partial host CPU passthrough (host-model) and host CPU customization (custom-model) , the virtual machine performance corresponding to these three modes decreases in turn, but the live migration compatibility increases in turn.
  • the deployment of the data center usually selects the virtual machine in the host-model mode of the host CPU part. In this mode, the instruction set exposed by the host to the virtual machine is often less than that of the host.
  • the target node processor and the source node processor allow a certain difference, the allowable difference cannot be Override the AVX512 instruction set, so the live migration will still fail.
  • the purpose of the present application is to provide a method for hot migration of virtual machines, so as to realize the hot migration of virtual machines across different generations of processors.
  • An embodiment of the present application discloses a method for virtual machine hot migration, including:
  • the kernel-based virtual machine module in the destination host captures the exception and parses the exception's interrupt context
  • the decoding process of the instruction is simulated by using the instruction set of the destination host.
  • the method further includes:
  • the step of using the instruction set of the destination host to simulate the decoding process of the instruction further includes:
  • the simulation instruction is transplanted to a kernel-based virtual machine module in the target host, and a regression test is performed on the test case library.
  • the source host is a higher generation processor than the destination host.
  • the instruction set of the destination host is AVX2
  • the instruction set of the destination host is AVX512.
  • Another embodiment of the present application discloses an apparatus for virtual machine hot migration, including:
  • a triggering unit configured to trigger an exception when executing an instruction of an instruction set that the destination host does not have but the source host has in the virtual machine on the destination host;
  • a capture unit set in the kernel-based virtual machine module in the destination host, and configured to capture the exception and parse the exception's interrupt context
  • a decoding unit configured to acquire and decode the data of the instruction according to the instruction address information of the interrupt context
  • the simulation unit is configured to use the instruction set of the destination host to simulate the execution process of the instruction.
  • the device further includes:
  • a creating unit configured to create a processor feature map in the destination host according to the simulation result, and create a virtual machine on the source host based on the processor feature map;
  • the migration unit is configured to live migrate the virtual machine on the source host to the destination host.
  • the step of simulating the decoding process of the instruction by the simulation unit using the instruction set of the destination host further includes:
  • the simulation instruction is transplanted to a kernel-based virtual machine module in the target host, and a regression test is performed on the test case library.
  • the source host is a higher generation processor than the destination host.
  • the instruction set of the destination host is AVX2
  • the instruction set of the destination host is AVX512.
  • the present application can realize the hot migration of virtual machines across generations of processors on the premise of retaining higher instruction set capabilities, so that the cycle of data center server elimination can be slowed down to a certain extent, thereby reducing server deployment costs.
  • FIG. 1 is a flowchart of a method for hot migration of a virtual machine according to an embodiment of the present application.
  • FIG. 2 is a schematic diagram of an instruction set simulation process in a virtual machine hot migration process according to an embodiment of the present application.
  • FIG. 3 is a schematic diagram of a virtual machine hot migration apparatus according to an embodiment of the present application.
  • Kernel-based Virtual Machine It is an open-source system virtualization module that is integrated in all major Linux distributions.
  • Instruction set It is a set of instructions used in the CPU to calculate and control the computer system, and each new type of CPU specifies a series of instruction systems that cooperate with other hardware circuits during design.
  • the advanced or not of the instruction set is also related to the performance of the CPU, and it is also an important symbol of the performance of the CPU.
  • Virtual Machine refers to a complete computer system with complete hardware system functions simulated by software and running in a completely isolated environment. Anything that can be done in a physical computer can be done in a virtual machine.
  • Hot migration Also known as live migration and live migration, that is, the saving/restoring of virtual machines, usually the entire running state of the entire virtual machine is completely saved, and at the same time, it can be quickly restored to the original hardware platform or even a different hardware platform. After recovery, the virtual machine still runs smoothly and the user will not notice any difference.
  • the first embodiment of the present application discloses a method for hot migration of a virtual machine, the flowchart of which is shown in FIG. 1 , and the method includes steps 110 to 140 .
  • Step 110 Trigger an exception when executing an instruction of an instruction set not possessed by the destination host but possessed by the source host in the virtual machine on the destination host.
  • the source host is a processor of a higher generation than the destination host, for example, the source host is one generation higher than the destination host, the destination host is a fifth-generation Broadwell processor, and the destination The instruction set possessed by the host is AVX2, the source host is a sixth-generation Skylake processor, and the instruction set possessed by the source host is AVX512. It should be understood that the source host may be a processor of several generations higher than the destination host.
  • Step 120 the kernel-based virtual machine module in the destination host captures the exception and parses the exception's interrupt context.
  • Step 130 Acquire and decode the data of the instruction according to the instruction address information of the interrupt context.
  • Step 140 using the instruction set of the destination host to simulate the execution process of the instruction
  • the step 140 of simulating the decoding process of the instruction using the instruction set of the destination host further includes:
  • Step 1401 use a decoding tool to simulate the decoding process of the instruction, generate a simulated instruction, and establish a test case library;
  • Step 1402 Migrate the simulation instruction to a kernel-based virtual machine module in the destination host, and perform regression testing on the test case library.
  • the decoding tool in step 1401 may be a third-party open source or self-written binary decoding tool.
  • the method further comprises:
  • Step 150 creating a processor feature map in the destination host according to the simulation result
  • Step 160 creating a virtual machine on the source host based on the processor feature map
  • Step 170 Live migrate the virtual machine on the source host to the destination host.
  • the present application realizes the hot migration of virtual machines across generations of processors by simulating the instruction set, thereby slowing down the cycle of data center server elimination to a certain extent, thereby reducing server deployment costs.
  • the KVM of the host operating system (host OS) on the Broadwell CPU is improved to support the simulation of AVX512 instruction set architecture (Instruction Set Architecture, ISA).
  • AVX512 instruction set architecture Instruction Set Architecture, ISA
  • the main process of simulating the AVX512 instruction set structure includes four steps: Trigger (Trap), Capture (Intercept), Decode (Decode), and Emulate (Emulate).
  • Trigger Trap
  • Capture Intercept
  • Decode Decode
  • Emulate Emulate
  • the simulation process generates AVX2 instructions that simulate AVX512 instructions, and adds the generated AVX2 instructions to the KVM of the Broadwell CPU, that is, the process of improving the KVM.
  • the specific steps to simulate the AVX512 instruction set structure are as follows:
  • VM virtual machine
  • Broadwell CPU will trigger a #UD exception when executing an AVX512 instruction
  • KVM intercepts the exception and parses the exception interrupt context
  • Decoding Obtain and decode the binary data of the AVX512 instruction through the instruction address information provided in the interrupt context;
  • Simulation The simulation of the decoded AVX512 instruction is completed based on the AVX2 instruction.
  • the content obtained by decoding the interrupt context of the AVX512 instruction includes the opcode (opcode) and the operand (operands).
  • opcode opcode
  • operands operands
  • the host CPU custom-model mode is formed on the Broadwell CPU.
  • the processing capability characteristics of the AVX512 instructions enabled by the AVX2 simulation instructions are added to form a customized feature map. , that is, the CPU feature map of "Broadwell+AVX512" is formed.
  • a virtual machine is created on the Skylake CPU based on the host CPU custom-model mode, and the virtual machine on the Skylake CPU is hot migrated to the Broadwell CPU where the customized processor feature map has been created.
  • the AVX512 instruction is executed in the virtual machine, the above trigger-capture-decode-simulation process can be triggered to complete the simulation of the AVX512 instruction.
  • a list of required compatible server processor models is explicitly compiled to determine the instruction set differences across generations of CPUs involved in the list.
  • the subset of instruction sets that need to be supported is specified, thereby forming a customized host-model CPU feature map on the destination host (ie, a relatively low-generation processor).
  • the simulation experiment of the required instructions is completed in the user space, and a complete test case library is established.
  • the user-space simulation instructions are ported to the kernel-space KVM, and the above test case library is used for regression testing.
  • a virtual machine is created on the previous and subsequent CPU servers at the same time by using the above-mentioned customized host-model of the host CPU part, and a live migration action is performed.
  • the decoding tool is used to obtain the opcode and operand of the AVX512 instruction that caused the exception from the information of the exception context, so that it can know which instruction this exception instruction is, what operation is completed, and which operands are involved.
  • the decoding tool can be implemented by using any decoding tool known in the art or known in the future, which will not be repeated in the present invention.
  • the above embodiment simulates the AVX512 instruction set, so that the virtual machine created based on the Intel Skylake processor can be successfully migrated to the Intel Broadwell processor on the premise of retaining the AVX512 instruction set capability, thereby realizing the virtual machine of cross-generation processors. of thermal migration.
  • FIG. 3 shows a schematic diagram of the apparatus.
  • the apparatus includes a trigger unit, a capture unit, a decoding unit, and an emulation unit.
  • the triggering unit is configured to trigger an exception when executing an instruction of an instruction set that the destination host does not have but the source host has in the virtual machine on the destination host;
  • a capture unit is set in the kernel-based virtual machine module in the destination host, and is configured to capture the exception and parse the exception's interrupt context
  • the decoding unit is configured to acquire and decode the data of the instruction according to the instruction address information of the interrupt context
  • the simulation unit is configured to use the instruction set of the destination host to simulate the execution process of the instruction.
  • the apparatus further includes:
  • a creating unit configured to create a processor feature map in the destination host according to the simulation result, and create a virtual machine on the source host based on the processor feature map;
  • the migration unit is configured to live migrate the virtual machine on the source host to the destination host.
  • the simulation unit uses the instruction set of the destination host to simulate the decoding process of the instruction, further comprising:
  • the simulation instruction is transplanted to a kernel-based virtual machine module in the target host, and a regression test is performed on the test case library.
  • the source host is a higher generation processor than the destination host.
  • the instruction set of the destination host is AVX2
  • the instruction set of the source host is AVX512.
  • the first embodiment is a method embodiment corresponding to this embodiment, the technical details in the first embodiment can be applied to this embodiment, and the technical details in this embodiment can also be applied to the first embodiment.
  • each module shown in the embodiment of the apparatus for virtual machine hot migration can be understood with reference to the relevant description of the foregoing method for virtual machine hot migration.
  • the functions of the modules shown in the foregoing embodiments of the apparatus for live migration of a virtual machine may be implemented by a program (executable instruction) running on the processor, or may be implemented by a specific logic circuit. If the above-mentioned apparatus for virtual machine hot migration in the embodiment of this specification is implemented in the form of a software function module and is sold or used as an independent product, it may also be stored in a computer-readable storage medium.
  • the technical solutions of the embodiments of this specification or the parts that make contributions to the prior art can be embodied in the form of software products, and the computer software products are stored in a storage medium, and include several instructions for A computer device (which may be a personal computer, a server, or a network device, etc.) is caused to execute all or part of the methods described in the various embodiments of this specification.
  • the aforementioned storage medium includes: U disk, mobile hard disk, Read Only Memory (ROM, Read Only Memory), magnetic disk or optical disk and other media that can store program codes.
  • embodiments of this specification are not limited to any particular combination of hardware and software.
  • an action is performed according to a certain element, it means at least that the action is performed according to the element, which includes two situations: the action is performed only according to the element, and the action is performed according to the element and Other elements perform this behavior.
  • Expressions such as multiple, multiple, multiple, etc. include 2, 2, 2, and 2 or more, 2 or more, and 2 or more.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

本申请涉及计算机技术领域,提供一种虚拟机热迁移的方法及其装置,在一个实施例中,该方法包括:在目的主机上的虚拟机中执行所述目的主机不具有而源主机具有的指令集的指令时触发异常;所述系统虚拟化模块捕获所述异常并解析所述异常的中断上下文;根据所述中断上下文的指令地址信息获取所述指令的数据并进行解码;基于所述目的主机的指令集模拟所述指令的执行过程。本申请可以在保留更高指令集能力的前提下,实现跨代处理器的虚拟机的热迁移。

Description

虚拟机热迁移的方法及其装置 技术领域
本申请涉及一种计算机技术领域,更涉及一种虚拟机热迁移的方法及其装置。
背景技术
当前数据中心普遍存在的虚拟机热迁移失败的问题,其主要原因是由于数据中心往往会部署有指令集不完全兼容的处理器,比如Intel的Broadwell和Skylake处理器。虽然这两种处理器同属于X86架构,但Skylake处理器具有最新的AVX512指令集,而Broadwell处理器不具备AVX512指令集,这通常会导致在基于Skylake处理器的源节点上创建的虚拟机无法成功迁移到基于Broadwell处理器的目标节点。
基于libvirt/QEMU/KVM所创建的虚拟机,通常有三种模式:宿主机CPU完全透传(host-passthrough)、宿主机CPU部分透传(host-model)和宿主机CPU定制(custom-model),这三种模式所对应的虚拟机性能依次降低但热迁移兼容性依次增强。为了保证足够的性能并兼顾热迁移能力,数据中心的部署通常会选择宿主机CPU部分透传(host-model)模式的虚拟机。在这种模式下,宿主机(host)暴露给虚拟机的指令集往往比宿主机所具有的指令集少,虽然目标节点处理器和源节点处理器允许存在一定的差异,但允许的差异无法覆盖AVX512指令集,故热迁移依旧会失败。
因此,需要提供一种保留更高指令集能力的跨代处理器的虚拟机的热迁移方法。
发明内容
本申请的目的在于提供一种虚拟机热迁移的方法,实现跨不同代处理器虚拟机的热迁移。
本申请的一实施方式中公开了一种虚拟机热迁移的方法,包括:
在目的主机上的虚拟机中执行所述目的主机不具有而源主机具有的指令集的指令时触发异常;
所述目的主机中的基于内核的虚拟机模块捕获所述异常并解析所述异常的中断上下文;
根据所述中断上下文的指令地址信息获取所述指令的数据并进行解码;以及
采用所述目的主机的指令集模拟所述指令的解码过程。
根据本申请的一实施例,所述方法还包括:
根据模拟结果在所述目的主机中创建处理器特征图;
基于所述处理器特征图在所述源主机上创建虚拟机;以及
将所述源主机上的虚拟机热迁移至所述目的主机。
根据本申请的一实施例,采用所述目的主机的指令集模拟所述指令的解码过程的步骤,进一步包括:
采用二进制解码工具模拟所述指令的解码过程,生成模拟指令,并建立测试用例库;以及
将所述模拟指令移植到所述目的主机中的基于内核的虚拟机模块,并对所述测试用例库进行回归测试。
根据本申请的一实施例,所述源主机是比所述目的主机的更高代的处理器。
根据本申请的一实施例,所述目的主机的指令集为AVX2,所述目的主机的指令集为AVX512。
本申请的另一实施方式中公开了一种虚拟机热迁移的装置,包括:
触发单元,被配置为在所述目的主机上的虚拟机中执行所述目的主机不具有而所述源主机具有的指令集的指令时触发异常;
捕获单元,设置于所述目的主机中的基于内核的虚拟机模块中,并被配置为 捕获所述异常并解析所述异常的中断上下文;
解码单元,被配置为根据所述中断上下文的指令地址信息获取所述指令的数据并进行解码;以及
模拟单元,被配置为采用所述目的主机的指令集模拟所述指令的执行过程。
根据本申请的一实施例,所述装置还包括:
创建单元,被配置为根据模拟结果在所述目的主机中创建处理器特征图,并基于所述处理器特征图在所述源主机上创建虚拟机;以及
迁移单元,被配置为将所述源主机上的虚拟机热迁移至所述目的主机。
根据本申请的一实施例,所述模拟单元采用所述目的主机的指令集模拟所述指令的解码过程的步骤,进一步包括:
采用二进制解码工具模拟所述指令的解码过程,生成模拟指令,并建立测试用例库;以及
将所述模拟指令移植到所述目的主机中的基于内核的虚拟机模块,并对所述测试用例库进行回归测试。
根据本申请的一实施例,所述源主机是比所述目的主机的更高代的处理器。
根据本申请的一实施例,所述目的主机的指令集为AVX2,所述目的主机的指令集为AVX512。
本申请可以在保留更高指令集能力的前提下,实现跨代处理器的虚拟机的热迁移,如此可在一定程度上减缓数据中心服务器淘汰的周期,从而降低服务器部署成本。
本说明书中记载了大量的技术特征,分布在各个技术方案中,如果要罗列出本申请所有可能的技术特征的组合(即技术方案)的话,会使得说明书过于冗长。为了避免这个问题,本说明书上述发明内容中公开的各个技术特征、在下文各个实施方式和例子中公开的各技术特征、以及附图中公开的各个技术特征,都可以自由地互相组合,从而构成各种新的技术方案(这些技术方案均应该视为在本说明书中已经记载),除非这种技术特征的组合在技术上是不可行的。例如,在一 个例子中公开了特征A+B+C,在另一个例子中公开了特征A+B+D+E,而特征C和D是起到相同作用的等同技术手段,技术上只要择一使用即可,不可能同时采用,特征E技术上可以与特征C相组合,则,A+B+C+D的方案因技术不可行而应当不被视为已经记载,而A+B+C+E的方案应当视为已经被记载。
附图说明
图1为本申请一实施例中的虚拟机热迁移方法的流程图。
图2为本申请一实施例中的虚拟机热迁移过程中指令集模拟过程的示意图。
图3为本申请一实施例中的虚拟机热迁移装置的示意图。
具体实施方式
在以下的叙述中,为了使读者更好地理解本申请而提出了许多技术细节。但是,本领域的普通技术人员可以理解,即使没有这些技术细节和基于以下各实施方式的种种变化和修改,也可以实现本申请所要求保护的技术方案。
部分概念的说明:
基于内核的虚拟机(Kernel-based Virtual Machine,KVM):是一个开源的系统虚拟化模块,集成在Linux的各个主要发行版本中。
指令集:是CPU中用来计算和控制计算机系统的一套指令的集合,而每一种新型的CPU在设计时就规定了一系列与其他硬件电路相配合的指令系统。而指令集的先进与否,也关系到CPU的性能发挥,它也是CPU性能体现的一个重要标志。
虚拟机(Virtual Machine,VM):指通过软件模拟的具有完整硬件系统功能的、运行在一个完全隔离环境中的完整计算机系统。在实体计算机中能够完成的工作在虚拟机中都能够实现。
热迁移:又叫动态迁移、实时迁移,即虚拟机的保存/恢复,通常是将整个虚拟机的运行状态完整保存下来,同时可以快速的恢复到原有硬件平台甚至是不同硬件平台上。恢复以后,虚拟机仍旧平滑运行,用户不会察觉到任 何差异。
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请的实施方式作进一步地详细描述。
本申请的第一实施方式中公开了一种虚拟机热迁移的方法,其流程图参考图1所示,该方法包括步骤110~140。
步骤110,在目的主机上的虚拟机中执行所述目的主机不具有而源主机具有的指令集的指令时触发异常。在一个实施例中,所述源主机是比所述目的主机的更高代的处理器,例如,源主机比目的主机高一代,所述目的主机为第五代的Broadwell处理器,所述目的主机具有的指令集为AVX2,所述源主机为第六代的Skylake处理器,所述源主机具有的指令集为AVX512。应当理解,源主机可以是比目的主机高更多代的处理器。
步骤120,所述目的主机中的基于内核的虚拟机模块捕获所述异常并解析所述异常的中断上下文。
步骤130,根据所述中断上下文的指令地址信息获取所述指令的数据并进行解码。
步骤140,采用所述目的主机的指令集模拟所述指令的执行过程
在一个实施例中,采用所述目的主机的指令集模拟所述指令的解码过程的步骤140进一步包括:
步骤1401,采用解码工具模拟所述指令的解码过程,生成模拟指令,并建立测试用例库;
步骤1402,将所述模拟指令移植到所述目的主机中的基于内核的虚拟机模块,并对所述测试用例库进行回归测试。
在一些实施例中,步骤1401中的解码工具可以是第三方开源或自行编写的二进制解码工具。
在一个实施例中,所述方法进一步包括:
步骤150,根据模拟结果在所述目的主机中创建处理器特征图;
步骤160,基于所述处理器特征图在所述源主机上创建虚拟机;以及
步骤170,将所述源主机上的虚拟机热迁移至所述目的主机。
本申请通过模拟指令集的方式,实现了跨代处理器的虚拟机的热迁移,在一定程度上减缓了数据中心服务器淘汰的周期,从而降低服务器部署成本。
为了能够更好地理解本说明书的技术方案,下面以将基于Intel Skylake处理器创建的虚拟机热迁移至Intel Broadwell处理器为例来进行说明,该示例中罗列的细节主要是为了便于理解,不作为对本申请保护范围的限制。
在一个实施例中,通过对Broadwell CPU上的主机操作系统(host OS)的KVM进行改进,以支持模拟AVX512指令集结构(Instruction Set Architecture,ISA)。参考图2所示,模拟AVX512指令集结构的主要流程包括触发(Trap)、捕获(Intercept)、解码(Decode)及模拟(Emulate)四个步骤,通过模拟AVX512指令集结构的触发-捕获-解码-模拟过程生成模拟AVX512指令的AVX2指令,将生成的AVX2指令添加到Broadwell CPU的KVM,也就是对KVM进行改进的过程。模拟AVX512指令集结构的具体步骤如下:
触发:Broadwell CPU上的虚拟机(VM)在执行AVX512指令时将触发#UD异常;
捕获:KVM截获该异常,并解析异常中断上下文;
解码:通过中断上下文中提供的指令地址信息,获取AVX512指令的二进制数据并解码;
模拟:基于AVX2指令完成解码出的此条AVX512指令的模拟。
对AVX512指令的中断上下文解码得到的内容包括操作码(opcode)和操作数(operands),模拟AVX512指令集结构的过程中获取触发异常的AVX512指令的操作码和操作数,从而可以确定这条触发异常的AVX512指令是哪一条指令,用于完成什么运算,以及涉及到的操作数是哪些。在模拟过程中,采用Broadwell CPU支持的AVX2指令完成此条AVX512指令的操 作。
之后,在Broadwell CPU上形成宿主机CPU定制(custom-model)模式,基于原始的Broadwell CPU特征图(features map),加入AVX2模拟指令所使能的AVX512指令的处理能力特征,形成定制的特征图,即形成“Broadwell+AVX512”的CPU特征图。接着,基于宿主机CPU定制(custom-model)模式在Skylake CPU上创建虚拟机,将Skylake CPU上的虚拟机热迁移至创建了定制的处理器特征图的Broadwell CPU上,此后,在Broadwell CPU的虚拟机中执行AVX512指令时可以触发上述的触发-捕获-解码-模拟流程,完成AVX512指令的模拟。
在特定数据中心的部署中,首先,明确整理出所需兼容的服务器处理器型号列表,以确定该列表中涉及的跨代CPU的指令集差异。明确需要支持的指令集子集,由此在目的主机(即,相对低代的处理器)上形成定制的宿主机CPU部分透传(host-model)的CPU特征图。
在一实施例中,借助第三方开源或者自行编写的二进制解码工具(binary decode tool),在用户空间完成所需指令的模拟实验,并建立完善的测试用例库。将用户空间模拟指令移植到内核空间KVM中,使用上述测试用例库进行回归测试。以上述定制的宿主机CPU部分透传(host-model)同时在前后代CPU服务器上创建虚拟机,执行热迁移动作。解码工具用于从异常上下文的信息中获取导致异常的AVX512指令的操作码和操作数,从而可知道这条异常指令是哪一条指令,完成了什么运算,以及涉及到的操作数是哪些。解码工具可以采用本领域已知或未来可知的任何解码工具实现,对发明对此不做赘述。
以上实施例通过模拟AVX512指令集的方式,使得基于Intel Skylake处理器创建的虚拟机可以在保留AVX512指令集能力的前提下成功热迁移至Intel Broadwell处理器,从而实现了跨代处理器的虚拟机的热迁移。
本申请的第二施方式中公开了一种虚拟机热迁移的装置,图3示出了该装置的示意图,该装置包括触发单元、捕获单元、解码单元和模拟单元。
触发单元被配置为在所述目的主机上的虚拟机中执行所述目的主机不具有而所述源主机具有的指令集的指令时触发异常;
捕获单元设置于所述目的主机中的基于内核的虚拟机模块中,并被配置为捕获所述异常并解析所述异常的中断上下文;
解码单元被配置为根据所述中断上下文的指令地址信息获取所述指令的数据并进行解码;
模拟单元被配置为采用所述目的主机的指令集模拟所述指令的执行过程。
在一个实施例中,所述装置还包括:
创建单元,被配置为根据模拟结果在所述目的主机中创建处理器特征图,并基于所述处理器特征图在所述源主机上创建虚拟机;以及
迁移单元,被配置为将所述源主机上的虚拟机热迁移至所述目的主机。
在一个实施例中,所述模拟单元采用所述目的主机的指令集模拟所述指令的解码过程的步骤,进一步包括:
采用解码工具模拟所述指令的解码过程,生成模拟指令,并建立测试用例库;以及
将所述模拟指令移植到所述目的主机中的基于内核的虚拟机模块,并对所述测试用例库进行回归测试。
在一个实施例中,所述源主机是比所述目的主机的更高代的处理器。
在一个实施例中,所述目的主机的指令集为AVX2,所述源主机的指令集为AVX512。
第一实施方式是与本实施方式相对应的方法实施方式,第一实施方式中的技术细节可以应用于本实施方式,本实施方式中的技术细节也可以应用于第一实施方式。
需要说明的是,本领域技术人员应当理解,上述虚拟机热迁移的装置的实施方式中所示的各模块的实现功能可参照前述虚拟机热迁移的方法的相关 描述而理解。上述在虚拟机热迁移的装置的实施方式中所示的各模块的功能可通过运行于处理器上的程序(可执行指令)而实现,也可通过具体的逻辑电路而实现。本说明书实施例上述虚拟机热迁移的装置如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本说明书实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本说明书各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本说明书实施例不限制于任何特定的硬件和软件结合。
需要说明的是,在本专利的申请文件中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。本专利的申请文件中,如果提到根据某要素执行某行为,则是指至少根据该要素执行该行为的意思,其中包括了两种情况:仅根据该要素执行该行为、和根据该要素和其它要素执行该行为。多个、多次、多种等表达包括2个、2次、2种以及2个以上、2次以上、2种以上。
在本说明书提及的所有文献都被认为是整体性地包括在本说明书的公开内容中,以便在必要时可以作为修改的依据。此外应理解,以上所述仅为本说明书的较佳实施例而已,并非用于限定本说明书的保护范围。凡在本说 明书一个或多个实施例的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例的保护范围之内。
在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描述的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。

Claims (10)

  1. 一种虚拟机热迁移的方法,其特征在于,包括:
    在目的主机上的虚拟机中执行所述目的主机不具有而源主机具有的指令集的指令时触发异常;
    所述目的主机中的基于内核的虚拟机模块捕获所述异常并解析所述异常的中断上下文;
    根据所述中断上下文的指令地址信息获取所述指令的数据并进行解码;以及
    采用所述目的主机的指令集模拟所述指令的执行过程。
  2. 根据权利要求1所述的虚拟机热迁移的方法,其特征在于,进一步包括:
    根据模拟结果在所述目的主机中创建处理器特征图;
    基于所述处理器特征图在所述源主机上创建虚拟机;以及
    将所述源主机上的虚拟机热迁移至所述目的主机。
  3. 根据权利要求1所述的虚拟机热迁移的方法,其特征在于,采用所述目的主机的指令集模拟所述指令的解码过程的步骤,进一步包括:
    采用解码工具模拟所述指令的解码过程,生成模拟指令,并建立测试用例库;以及
    将所述模拟指令移植到所述目的主机中的基于内核的虚拟机模块,并对所述测试用例库进行回归测试。
  4. 根据权利要求1所述的虚拟机热迁移的方法,其特征在于,所述源主机是比所述目的主机的更高代的处理器。
  5. 根据权利要求1所述的虚拟机热迁移的方法,其特征在于,所述目的主机的指令集为AVX2,所述源主机的指令集为AVX512。
  6. 一种虚拟机热迁移的装置,其特征在于,包括:
    触发单元,被配置为在所述目的主机上的虚拟机中执行所述目的主机不具有而所述源主机具有的指令集的指令时触发异常;
    捕获单元,设置于所述目的主机中的基于内核的虚拟机模块中,并被配置为捕获所述异常并解析所述异常的中断上下文;
    解码单元,被配置为根据所述中断上下文的指令地址信息获取所述指令的 数据并进行解码;以及
    模拟单元,被配置为采用所述目的主机的指令集模拟所述指令的执行过程。
  7. 根据权利要求6所述的虚拟机热迁移的装置,其特征在于,进一步包括:
    创建单元,被配置为根据模拟结果在所述目的主机中创建处理器特征图,并基于所述处理器特征图在所述源主机上创建虚拟机;以及
    迁移单元,被配置为将所述源主机上的虚拟机热迁移至所述目的主机。
  8. 根据权利要求6所述的虚拟机热迁移的装置,其特征在于,所述模拟单元采用所述目的主机的指令集模拟所述指令的解码过程的步骤,进一步包括:
    采用解码工具模拟所述指令的解码过程,生成模拟指令,并建立测试用例库;以及
    将所述模拟指令移植到所述目的主机中的基于内核的虚拟机模块,并对所述测试用例库进行回归测试。
  9. 根据权利要求6所述的虚拟机热迁移的装置,其特征在于,所述源主机是比所述目的主机的更高代的处理器。
  10. 根据权利要求6所述的虚拟机热迁移的装置,其特征在于,所述目的主机的指令集为AVX2,所述源主机的指令集为AVX512。
PCT/CN2021/094935 2021-02-23 2021-05-20 虚拟机热迁移的方法及其装置 WO2022178988A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/278,433 US20240231882A9 (en) 2021-02-23 2021-05-20 Method and apparatus for live migration of virtual machine

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110204159.5 2021-02-23
CN202110204159.5A CN114968469A (zh) 2021-02-23 2021-02-23 虚拟机热迁移的方法及其装置

Publications (1)

Publication Number Publication Date
WO2022178988A1 true WO2022178988A1 (zh) 2022-09-01

Family

ID=82974316

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/094935 WO2022178988A1 (zh) 2021-02-23 2021-05-20 虚拟机热迁移的方法及其装置

Country Status (2)

Country Link
CN (1) CN114968469A (zh)
WO (1) WO2022178988A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100250824A1 (en) * 2009-03-25 2010-09-30 Vmware, Inc. Migrating Virtual Machines Configured With Pass-Through Devices
CN103036947A (zh) * 2012-11-21 2013-04-10 北京航空航天大学 基于kvm的虚拟机迁移方法及系统
CN108255576A (zh) * 2017-12-08 2018-07-06 上海陆家嘴国际金融资产交易市场股份有限公司 虚拟机热迁移异常处理方法、装置和存储介质
CN109032763A (zh) * 2018-08-14 2018-12-18 新华三云计算技术有限公司 一种虚拟机迁移方法及虚拟机管理器

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100250824A1 (en) * 2009-03-25 2010-09-30 Vmware, Inc. Migrating Virtual Machines Configured With Pass-Through Devices
CN103036947A (zh) * 2012-11-21 2013-04-10 北京航空航天大学 基于kvm的虚拟机迁移方法及系统
CN108255576A (zh) * 2017-12-08 2018-07-06 上海陆家嘴国际金融资产交易市场股份有限公司 虚拟机热迁移异常处理方法、装置和存储介质
CN109032763A (zh) * 2018-08-14 2018-12-18 新华三云计算技术有限公司 一种虚拟机迁移方法及虚拟机管理器

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ISHIGURO KENTA, KONO KENJI: "Instruction Filters for Mitigating Attacks on Instruction Emulation in Hypervisors", IEICE TRANSACTIONS ON INFORMATION AND SYSTEMS, INFORMATION & SYSTEMS SOCIETY, TOKYO., JP, vol. E103.D, no. 7, 1 July 2020 (2020-07-01), JP , pages 1660 - 1671, XP055961288, ISSN: 0916-8532, DOI: 10.1587/transinf.2019EDP7186 *

Also Published As

Publication number Publication date
US20240134676A1 (en) 2024-04-25
CN114968469A (zh) 2022-08-30

Similar Documents

Publication Publication Date Title
US11126448B1 (en) Systems and methods for using dynamic templates to create application containers
US7596781B2 (en) Register-based instruction optimization for facilitating efficient emulation of an instruction stream
CN113260993B (zh) 虚拟平台系统的安全部署和操作
US9552285B2 (en) Micro-execution for software testing
US20110321040A1 (en) Systems and Methods for Sharing the Results of Analyses Among Virtual Machines
JP2017107540A (ja) エミュレータを組み合わせることにより、悪意のある実行ファイルであってインタープリタを有する実行ファイルを検出するためのシステム及び方法
JP2021022400A (ja) 分析システム、方法、及び、プログラム
JP6568564B2 (ja) ファイルのウイルス対策スキャン実行のため仮想マシン上にログを生成するシステム及び方法
JP6507633B2 (ja) ハードウェア故障を実行アプリケーションに注入する方法を可能にする方法及びコンピューティングシステム
Shi et al. Handling anti-virtual machine techniques in malicious software
Harrison et al. A framework for detecting malware in cloud by identifying symptoms
US11709716B2 (en) Hardware offload support for an operating system offload interface using operation code verification
Mäki et al. Interface diversification in IoT operating systems
US20180189479A1 (en) Verification of security domain separation
RU2649794C1 (ru) Система и способ формирования журнала в виртуальной машине для проведения антивирусной проверки файла
CN113821297B (zh) 仿真器和仿真方法
WO2022178988A1 (zh) 虚拟机热迁移的方法及其装置
CN107861795B (zh) 模拟物理tcm芯片的方法、系统、装置及可读存储介质
Brooker et al. Restoring uniqueness in microvm snapshots
US20240231882A9 (en) Method and apparatus for live migration of virtual machine
CN114640597B (zh) 网络靶场配置迁移方法、装置、计算机设备及介质
McDaniel et al. Identifying weaknesses in VM/hypervisor interfaces
US10642631B1 (en) Apparatus, system, and method for dynamically replacing call paths of running applications
Yan et al. BP: DECREE: A Platform for Repeatable and Reproducible Security Experiments
Chattra et al. Implementation of Meltdown Attack Simulation for Cybersecurity Awareness Material

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21927421

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 18278433

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21927421

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 21927421

Country of ref document: EP

Kind code of ref document: A1