[go: up one dir, main page]

CN104268005A - Virtual machine waking method and device - Google Patents

Virtual machine waking method and device Download PDF

Info

Publication number
CN104268005A
CN104268005A CN201410566931.8A CN201410566931A CN104268005A CN 104268005 A CN104268005 A CN 104268005A CN 201410566931 A CN201410566931 A CN 201410566931A CN 104268005 A CN104268005 A CN 104268005A
Authority
CN
China
Prior art keywords
page
virtual machine
memory
crucial
memory page
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201410566931.8A
Other languages
Chinese (zh)
Other versions
CN104268005B (en
Inventor
汪晶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changzhou Hengtang Technology Industry Co ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201410566931.8A priority Critical patent/CN104268005B/en
Publication of CN104268005A publication Critical patent/CN104268005A/en
Application granted granted Critical
Publication of CN104268005B publication Critical patent/CN104268005B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)

Abstract

本发明实施例提供一种虚拟机唤醒方法和装置,通过获取虚拟机的上下文信息以及关键内存页,将上下文信息以及关键内存页从磁盘恢复到内存中,唤醒虚拟机,从而,完成虚拟机的唤醒过程,在此过程中,由于仅将虚拟机的上下文信息和关键内存页从磁盘恢复到内存中,在一定程度上减少了从磁盘恢复到内存的数据数量,加快了虚拟机唤醒速度,在此过程中,无需额外的部署的高成本的部件,节约了部署成本。

Embodiments of the present invention provide a method and device for waking up a virtual machine. By obtaining the context information and key memory pages of the virtual machine, the context information and key memory pages are restored from the disk to the memory, and the virtual machine is woken up, thereby completing the virtual machine. During the wake-up process, because only the context information and key memory pages of the virtual machine are restored from the disk to the memory, the amount of data restored from the disk to the memory is reduced to a certain extent, and the speed of the virtual machine wake-up is accelerated. In this process, there is no need for additional high-cost components to be deployed, which saves deployment costs.

Description

虚拟机唤醒方法和装置Virtual machine wake-up method and device

技术领域technical field

本发明实施例涉及计算机技术,尤其涉及一种虚拟机唤醒方法和装置。The embodiments of the present invention relate to computer technology, and in particular to a method and device for waking up a virtual machine.

背景技术Background technique

虚拟机休眠是指将处于运动状态的虚拟机数据保存到磁盘,完全释放虚拟机所占有的内存与CPU资源,虚拟机唤醒是指将保存在磁盘中的数据恢复到内存并恢复到运行状态,因为磁盘的读写速度较慢,因此,虚拟机休眠或唤醒的速度都相对较慢,而在实际应用中,对虚拟机唤醒的速度有较高的要求。Virtual machine hibernation refers to saving the data of the virtual machine in the moving state to the disk, completely releasing the memory and CPU resources occupied by the virtual machine, and waking up the virtual machine refers to restoring the data saved in the disk to the memory and returning to the running state. Because the read and write speed of the disk is relatively slow, the speed of the virtual machine to sleep or wake up is relatively slow, but in practical applications, there is a higher requirement for the speed of the virtual machine to wake up.

现有技术中,为了加快虚拟机唤醒的速度,通过在主机上部署高速物理缓存,当虚拟机休眠时,将数据保存在高速物理缓存,当唤醒时从高速物理缓存中恢复数据,从而,加快虚拟机的唤醒速度。In the prior art, in order to speed up the wake-up speed of the virtual machine, by deploying a high-speed physical cache on the host, when the virtual machine sleeps, the data is saved in the high-speed physical cache, and the data is restored from the high-speed physical cache when it wakes up, thereby speeding up The wakeup speed of the virtual machine.

然而,部署高速物理缓存成本较高,因此,采用现有技术的方法,增加部署成本。However, the cost of deploying a high-speed physical cache is relatively high. Therefore, the deployment cost is increased by adopting the method of the prior art.

发明内容Contents of the invention

本发明实施例提供一种虚拟机唤醒方法和装置,以节约部署成本。Embodiments of the present invention provide a method and device for waking up a virtual machine to save deployment costs.

本发明实施例第一方面提供一种虚拟机唤醒方法,包括:The first aspect of the embodiments of the present invention provides a method for waking up a virtual machine, including:

获取虚拟机的上下文信息以及关键内存页,所述关键内存页包括唤醒所述虚拟机必备的内存页;Obtain context information of the virtual machine and key memory pages, where the key memory pages include memory pages necessary to wake up the virtual machine;

将所述上下文信息以及所述关键内存页从磁盘恢复到内存中;Restore the context information and the key memory page from disk to memory;

唤醒所述虚拟机。Wake up the virtual machine.

结合第一方面,在第一种可能的实现方式中,所述获取虚拟机的上下文信息以及关键内存页之前,还包括:In combination with the first aspect, in the first possible implementation manner, before acquiring the context information of the virtual machine and the key memory page, it also includes:

识别所述关键内存页。The critical memory pages are identified.

结合第一方面的第一种可能的实现方式,在第二种可能的实现方式中,所述识别所述关键内存页,包括:With reference to the first possible implementation of the first aspect, in a second possible implementation, the identifying the critical memory page includes:

根据虚拟机休眠过程中对所述关键内存页的标识识别所述关键内存页。The critical memory page is identified according to the identification of the critical memory page during the virtual machine hibernation process.

结合第一方面的第二种可能的实现方式,在第三种可能的实现方式中,所述根据虚拟机休眠过程中对所述关键内存页的标识识别所述关键内存页之前,还包括:With reference to the second possible implementation of the first aspect, in the third possible implementation, before identifying the critical memory page according to the identification of the critical memory page during the virtual machine hibernation process, further includes:

在虚拟机休眠过程中确定预设类型的内存页为关键内存页。During the hibernation process of the virtual machine, a memory page of a preset type is determined as a key memory page.

结合第一方面的第一种可能的实现方式,在第四种可能的实现方式中,所述识别所述关键内存页,包括:With reference to the first possible implementation of the first aspect, in a fourth possible implementation, the identifying the critical memory page includes:

在虚拟机唤醒过程中确定预设类型的内存页为关键内存页。During the wake-up process of the virtual machine, a memory page of a preset type is determined as a key memory page.

结合第一方面的第三种或第四种可能的实现方式,在第五种可能的实现方式中,所述预设类型的内存页包括下述任一种类型:With reference to the third or fourth possible implementation of the first aspect, in a fifth possible implementation, the preset type of memory page includes any of the following types:

视频图形阵列VGA显存地址空间范围内的内存页;A memory page within the address space range of the video graphics array VGA memory;

根据所述虚拟机内存分布,处于0M至1M的地址空间范围内的内存页;According to the memory distribution of the virtual machine, memory pages within the address space range from 0M to 1M;

根据所述虚拟机内存分布,处于3.75G至4G的地址空间范围内的内存页;According to the memory distribution of the virtual machine, memory pages within the address space range of 3.75G to 4G;

根据所述虚拟机的上下文信息中的寄存器信息关联的内存页;A memory page associated with register information in the context information of the virtual machine;

根据传输后备缓冲器TLB中缓存的页表信息对应的内存页。According to the memory page corresponding to the page table information cached in the transfer lookaside buffer TLB.

结合第一方面或第一方面的第一种至第五种可能的实现方式中任一种可能的实现方式,在第六种可能的实现方式中,所述唤醒所述虚拟机之后还包括:With reference to the first aspect or any possible implementation manner of the first to fifth possible implementation manners of the first aspect, in a sixth possible implementation manner, after waking up the virtual machine, the method further includes:

将普通内存页恢复到所述内存中,所述普通内存页是指处于运动状态的虚拟机数据中除所述上下文信息和关键内存页之外的内存页。Restoring the common memory page to the memory, the common memory page refers to the memory page in the virtual machine data in the moving state except the context information and the key memory page.

本发明实施例第二方面提供一种虚拟机唤醒装置,包括:The second aspect of the embodiment of the present invention provides a device for waking up a virtual machine, including:

获取模块,用于获取虚拟机的上下文信息以及关键内存页,所述关键内存页包括唤醒所述虚拟机必备的内存页;An acquisition module, configured to acquire the context information of the virtual machine and key memory pages, where the key memory pages include memory pages necessary to wake up the virtual machine;

关键内存页恢复模块,用于将所述上下文信息以及所述关键内存页从磁盘恢复到内存中;A key memory page restoration module, configured to restore the context information and the key memory page from the disk to the memory;

唤醒模块,用于唤醒所述虚拟机。A wake-up module, configured to wake up the virtual machine.

结合第二方面,在第一种可能的实现方式中,所述装置还包括:With reference to the second aspect, in a first possible implementation manner, the device further includes:

关键内存页识别模块,用于识别所述关键内存页。A critical memory page identification module, configured to identify the critical memory page.

结合第二方面的第一种可能的实现方式,在第二种可能的实现方式中,所述关键内存页识别模块具体用于根据虚拟机休眠过程中对所述关键内存页的标识识别所述关键内存页。With reference to the first possible implementation of the second aspect, in the second possible implementation, the critical memory page identification module is specifically configured to identify the critical memory page according to the identification of the critical memory page during the virtual machine hibernation process critical memory pages.

结合第二方面的第二种可能的实现方式,在第三种可能的实现方式中,所述关键内存页识别模块具体用于还用于在虚拟机休眠过程中确定预设类型的内存页为关键内存页。With reference to the second possible implementation of the second aspect, in a third possible implementation, the critical memory page identification module is specifically configured to also determine that a preset type of memory page is critical memory pages.

结合第二方面的第一种可能的实现方式,在第四种可能的实现方式中,所述关键内存页识别模块具体用于在虚拟机唤醒过程中确定预设类型的内存页为关键内存页。With reference to the first possible implementation of the second aspect, in a fourth possible implementation, the critical memory page identification module is specifically configured to determine a preset type of memory page as a critical memory page during the wake-up process of the virtual machine .

结合第二方面的第三种或第四种可能的实现方式,在第五种可能的实现方式中,所述预设类型的内存页包括下述任一种类型:With reference to the third or fourth possible implementation manner of the second aspect, in a fifth possible implementation manner, the preset type of memory page includes any of the following types:

视频图形阵列VGA显存地址空间范围内的内存页;A memory page within the address space range of the video graphics array VGA memory;

根据所述虚拟机内存分布,处于0M至1M的地址空间范围内的内存页;According to the memory distribution of the virtual machine, memory pages within the address space range from 0M to 1M;

根据所述虚拟机内存分布,处于3.75G至4G的地址空间范围内的内存页;According to the memory distribution of the virtual machine, memory pages within the address space range of 3.75G to 4G;

根据所述虚拟机的上下文信息中的寄存器信息关联的内存页;A memory page associated with register information in the context information of the virtual machine;

根据传输后备缓冲器TLB中缓存的页表信息对应的内存页。According to the memory page corresponding to the page table information cached in the transfer lookaside buffer TLB.

结合第二方面或第二方面的第一种至第五种可能的实现方式中任一种可能的实现方式,在第六种可能的实现方式中,还包括:In combination with the second aspect or any possible implementation manner of the first to fifth possible implementation manners of the second aspect, in a sixth possible implementation manner, it further includes:

普通内存页恢复模块,用于将普通内存页恢复到所述内存中,所述普通内存页是指处于运动状态的虚拟机数据中除所述上下文信息和关键内存页之外的内存页。The normal memory page restoring module is used to restore the common memory page to the memory, and the normal memory page refers to the memory page in the virtual machine data in the moving state except the context information and the key memory page.

本发明实施例提供的虚拟机唤醒方法和装置,通过获取虚拟机的上下文信息以及关键内存页,将上下文信息以及关键内存页从磁盘恢复到内存中,唤醒虚拟机,从而,完成虚拟机的唤醒过程,在此过程中,由于仅将虚拟机的上下文信息和关键内存页从磁盘恢复到内存中,在一定程度上减少了从磁盘恢复到内存的数据数量,加快了虚拟机唤醒速度,在此过程中,无需额外的部署的高成本的部件,节约了部署成本。The method and device for waking up a virtual machine provided by the embodiments of the present invention recover the context information and key memory pages from the disk to the memory by acquiring the context information and key memory pages of the virtual machine to wake up the virtual machine, thereby completing the wakeup of the virtual machine In this process, because only the context information and key memory pages of the virtual machine are restored from the disk to the memory, the amount of data restored from the disk to the memory is reduced to a certain extent, and the wake-up speed of the virtual machine is accelerated. Here During the process, there is no need for additional high-cost components for deployment, which saves deployment costs.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1为本发明虚拟机唤醒方法实施例一的流程示意图;FIG. 1 is a schematic flow diagram of Embodiment 1 of a method for waking up a virtual machine according to the present invention;

图2为本发明虚拟机唤醒方法实施例二的流程示意图;FIG. 2 is a schematic flowchart of Embodiment 2 of the method for waking up a virtual machine according to the present invention;

图3为本发明与现有技术的效果对比示意图;Fig. 3 is the effect comparison schematic diagram of the present invention and prior art;

图4为本发明虚拟机唤醒装置实施例一的结构示意图;FIG. 4 is a schematic structural diagram of Embodiment 1 of a device for waking up a virtual machine according to the present invention;

图5为本发明虚拟机唤醒装置实施例二的结构示意图;FIG. 5 is a schematic structural diagram of Embodiment 2 of the device for waking up a virtual machine according to the present invention;

图6为本发明虚拟机唤醒装置实施例三的结构示意图;FIG. 6 is a schematic structural diagram of Embodiment 3 of a device for waking up a virtual machine according to the present invention;

图7为本发明虚拟机唤醒装置实施例四的结构示意图。FIG. 7 is a schematic structural diagram of Embodiment 4 of an apparatus for waking up a virtual machine according to the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

本发明实施例将处于运动状态的虚拟机数据分为关键内存页和普通内存页,关键内存页是指唤醒虚拟机必备的内存页,通过识别关键内存页,在虚拟机唤醒过程中,将虚拟机的上下文信息和关键内存页从磁盘恢复到内存中,然后唤醒虚拟机,完成虚拟机的唤醒过程;在此过程中,由于仅将虚拟机的上下文信息和关键内存页从磁盘恢复到内存中,无需将普通内存页从磁盘恢复到内存中,在一定程度上减少了从磁盘恢复到内存的数据数量,加快了虚拟机唤醒速度,在此过程中,无需额外的部署的高成本的部件,节约了部署成本。In the embodiment of the present invention, the data of the virtual machine in the moving state is divided into key memory pages and common memory pages. The key memory pages refer to the memory pages necessary for waking up the virtual machine. The context information and key memory pages of the virtual machine are restored from the disk to the memory, and then the virtual machine is woken up to complete the wake-up process of the virtual machine; during this process, only the context information and key memory pages of the virtual machine are restored from the disk to the memory In the process, there is no need to restore ordinary memory pages from the disk to the memory, which reduces the amount of data restored from the disk to the memory to a certain extent, and speeds up the wake-up speed of the virtual machine. In the process, there is no need for additional deployment of high-cost components , saving deployment costs.

下面以具体地实施例对本发明的技术方案进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。The technical solution of the present invention will be described in detail below with specific embodiments. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

图1为本发明虚拟机唤醒方法实施例一的流程示意图,如图1所示,本实施例的方法如下:FIG. 1 is a schematic flow diagram of Embodiment 1 of the method for waking up a virtual machine according to the present invention. As shown in FIG. 1 , the method of this embodiment is as follows:

S101:获取虚拟机的上下文信息以及关键内存页。S101: Obtain context information and key memory pages of the virtual machine.

其中,关键内存页包括唤醒虚拟机必备的内存页。Wherein, the critical memory page includes memory pages necessary for waking up the virtual machine.

具体地,获取虚拟机的上下文信息以及关键内存页之前,还包括:识别关键内存页。Specifically, before acquiring the context information of the virtual machine and the key memory page, further includes: identifying the key memory page.

识别关键内存页在不同的场景下,识别关键内存页的方法不同,本发明包括但不限于下述两种实现方式:Identifying key memory pages In different scenarios, the methods for identifying key memory pages are different. The present invention includes but is not limited to the following two implementations:

其中,第一种实现方式,在虚拟机休眠过程中确定并标识关键内存页,在休眠过程中确定关键内存页即确定预设类型的内存页为关键内存页,确定出关键内存页之后,对关键内存页进行标识,具体地标识方法,一种方式,可以是将关键内存页存储在磁盘中预设的地址空间中,可以通过地址空间标识出其内存储的内容为关键内存页;另一种方式,可以是通过增加特殊字符串标记关键内存页;又一种方式,通过偏移量标识存储关键内存储页的地址空间,对于具体地标识方式,本发明不作限制。这种实现方式即在虚拟机唤醒过程中,根据虚拟机休眠过程中对关键内存页的标识识别关键内存页。Among them, the first implementation method is to determine and identify the key memory page during the hibernation process of the virtual machine. To determine the key memory page during the hibernation process means to determine the preset type of memory page as the key memory page. After the key memory page is determined, the The key memory page is identified, specifically the identification method, one way, can be to store the key memory page in the preset address space of the disk, and the content stored in it can be identified as the key memory page through the address space; the other One method may be to mark the key memory page by adding a special character string; another method is to identify the address space storing the key memory page through the offset, and the present invention does not limit the specific identification method. This implementation method is to identify the key memory page according to the identification of the key memory page during the sleep process of the virtual machine during the wake-up process of the virtual machine.

第二种实现方式,在虚拟机唤醒过程中确定预设类型的内存页为关键内存页。In the second implementation manner, a memory page of a preset type is determined as a key memory page during the wake-up process of the virtual machine.

第二种实现方式与第一种实现方式不同的是,第一种实现方式是在虚拟机休眠过程中,确定并标识预设类型的内存页为关键内存页。第二种实现方式是在虚拟机唤醒过程中确定预设类型的内存页为关键内存页。第一种实现方式比第二种实现方式更为准确一些。The second implementation is different from the first implementation in that the first implementation is to determine and identify a preset type of memory page as a key memory page during the hibernation process of the virtual machine. The second implementation manner is to determine a memory page of a preset type as a key memory page during the wake-up process of the virtual machine. The first implementation is more accurate than the second implementation.

其中,预设类型的内存页包括下述任一种类型:Among them, the preset type of memory page includes any of the following types:

视频图形阵列VGA显存地址空间范围内的内存页;该类型可根据虚拟机上下文信息动态识别,该类型内存页影响到虚拟机唤醒后的界面显示。A memory page within the address space of the video graphics array VGA memory; this type can be dynamically identified according to the virtual machine context information, and this type of memory page affects the interface display after the virtual machine wakes up.

根据所述虚拟机内存分布,处于0M至1M的地址空间范围内的内存页;0M-1M内存范围内通常为特殊内存页,为了保证虚拟机正常运行,该部分内存页必须优先恢复。According to the memory distribution of the virtual machine, memory pages in the address space range of 0M to 1M; usually special memory pages in the memory range of 0M-1M, in order to ensure the normal operation of the virtual machine, this part of memory pages must be restored first.

根据所述虚拟机内存分布,处于3.75G至4G的地址空间范围内的内存页;3.75G至4G的地址空间范围内的内存页主要用于硬件映射,为了保证虚拟机设备的正常运行,该部分内存页必须优先恢复。According to the memory distribution of the virtual machine, memory pages within the address space range of 3.75G to 4G; memory pages within the address space range of 3.75G to 4G are mainly used for hardware mapping. In order to ensure the normal operation of the virtual machine device, the Some memory pages must be restored first.

根据所述虚拟机的上下文信息中的寄存器信息关联的内存页;具体地,根据虚拟机CPU上下文信息获取虚拟机当前正在处理的寄存器信息,根据寄存器信息动态识别关联的内存页。According to the memory page associated with the register information in the context information of the virtual machine; specifically, according to the virtual machine CPU context information, obtain the register information currently being processed by the virtual machine, and dynamically identify the associated memory page according to the register information.

根据传输后备缓冲器TLB中缓存的页表信息对应的内存页,TLB中缓存的页表信息通常为热点内存页,热点内存页是指被高频访问的内存页。According to the memory page corresponding to the page table information cached in the transmission lookaside buffer TLB, the page table information cached in the TLB is usually a hot memory page, and the hot memory page refers to a memory page frequently accessed.

S102:将上下文信息以及关键内存页从磁盘恢复到内存中。S102: Restore the context information and key memory pages from the disk to the memory.

S103:唤醒虚拟机。S103: Waking up the virtual machine.

从而,完成虚拟机的唤醒过程。Thus, the process of waking up the virtual machine is completed.

本实施例中,通过获取虚拟机的上下文信息以及关键内存页,将上下文信息以及关键内存页从磁盘恢复到内存中,唤醒虚拟机,从而,完成虚拟机的唤醒过程,在此过程中,由于仅将虚拟机的上下文信息和关键内存页从磁盘恢复到内存中,在一定程度上减少了从磁盘恢复到内存的数据数量,加快了虚拟机唤醒速度,在此过程中,无需额外的部署的高成本的部件,节约了部署成本。In this embodiment, by obtaining the context information and key memory pages of the virtual machine, the context information and the key memory pages are restored from the disk to the memory, and the virtual machine is woken up, thereby completing the wake-up process of the virtual machine. During this process, due to Only the context information and key memory pages of the virtual machine are restored from the disk to the memory, which reduces the amount of data restored from the disk to the memory to a certain extent and speeds up the wake-up of the virtual machine. During this process, no additional deployment High-cost components save deployment costs.

在上述实施例中,唤醒虚拟机之后,还包括,将普通内存页恢复到内存中,普通内存页是指处于运动状态的虚拟机数据中除上下文信息和上述关键内存页之外的内存页。也就是,普通内存页在后台异步恢复,假如虚拟机唤醒之后运行过程中发现找不到对应的内存页,则从磁盘中存储的普通内存页中找到对应的内存页恢复到内存,从而,不影响虚拟机业务的正常运行。在本发明实施例的技术方案中,虚拟机唤醒过程中仅将虚拟机上下文信息和关键内存页从磁盘恢复到内存,在一定程度上减少了虚拟机唤醒过程中数据读取量,也就是,虚拟机唤醒过程中消耗时间为将虚拟机上下文信息和关键内存页从磁盘恢复到内存的时间,因此,加快了虚拟机的唤醒速度。In the above embodiment, after waking up the virtual machine, it also includes restoring the common memory page to the memory. The common memory page refers to the memory page in the virtual machine data in the moving state except the context information and the above-mentioned critical memory page. That is, normal memory pages are restored asynchronously in the background. If the virtual machine finds that the corresponding memory page cannot be found during the running process after waking up, it will find the corresponding memory page from the normal memory pages stored on the disk and restore it to the memory. The normal operation of virtual machine services is affected. In the technical solution of the embodiment of the present invention, only the virtual machine context information and key memory pages are restored from the disk to the memory during the virtual machine wake-up process, which reduces the amount of data read during the virtual machine wake-up process to a certain extent, that is, The time consumed in the process of waking up the virtual machine is the time for restoring the context information of the virtual machine and key memory pages from the disk to the memory, thus speeding up the waking up speed of the virtual machine.

针对S101中的第一种场景,即在虚拟机休眠过程中,确定并标识预设类型的内存页为关键内存页,在虚拟机唤醒过程中,根据虚拟机休眠过程中对关键内存页的标识识别关键内存页。具体地,虚拟机休眠过程中的流程如图2所示,图2为本发明虚拟机唤醒方法实施例二的流程示意图,如图2所示,本实施例的方法如下:For the first scenario in S101, that is, during the sleep process of the virtual machine, determine and identify the memory page of the preset type as a key memory page, and during the wake-up process of the virtual machine, according to the identification of the key memory page during the sleep process of the virtual machine Identify critical memory pages. Specifically, the process during the virtual machine sleep process is shown in FIG. 2, and FIG. 2 is a schematic flowchart of Embodiment 2 of the method for waking up a virtual machine according to the present invention. As shown in FIG. 2, the method of this embodiment is as follows:

其中,S201~S202为虚拟机休眠过程中的流程,S203~S206为虚拟机唤醒过程中的流程。Wherein, S201-S202 are the processes during the sleep process of the virtual machine, and S203-S206 are the processes during the wake-up process of the virtual machine.

S201:通过关键内存页识别模块识别关键内存页。S201: Identify the critical memory page by using the critical memory page identification module.

S202:完成关键内存页的识别之后,将虚拟机上下文信息,关键内存页以及普通内存页标保存到磁盘。S202: After the key memory page is identified, the virtual machine context information, the key memory page and the common memory page are saved to the disk.

S203:关键内存页恢复装置恢复虚拟机上下文信息以及关键内存页,确保虚拟机能够正常唤醒。S203: The key memory page recovery device recovers the virtual machine context information and key memory pages to ensure that the virtual machine can be woken up normally.

S204:完成上下文信息和关键内存页恢复之后唤醒虚拟机,同时激活普通内存恢复装置。S204: Waking up the virtual machine after restoring the context information and key memory pages, and activating the common memory restoring device at the same time.

该步骤之后,虚拟机唤醒过程完成。After this step, the process of waking up the virtual machine is completed.

S205:普通内存页恢复装置读取普通内存。S205: The normal memory page recovery device reads the normal memory.

S206:普通内存页恢复装置将普通内存恢复到内存。S206: The normal memory page restoration device restores the normal memory to the internal memory.

本实施例中,通过识别关键内存页,在虚拟机唤醒过程中,将虚拟机上下文信息和关键内存页从磁盘恢复到内存,唤醒虚拟机,从而,完成虚拟机唤醒过程,在虚拟机唤醒之后,将普通内存页恢复到内存,也就是普通内存页通过异步方式恢复到内存中,在虚拟机唤醒过程中仅将虚拟机上下文信息和关键内存页从磁盘恢复到内存,在一定程度上减少了虚拟机唤醒过程中数据读取量,也就是,虚拟机唤醒过程中消耗时间为将虚拟机上下文信息和关键内存页从磁盘恢复到内存的时间,因此,加快了虚拟机的唤醒速度。In this embodiment, by identifying key memory pages, during the virtual machine wake-up process, the virtual machine context information and key memory pages are restored from the disk to the memory, and the virtual machine is woken up, thereby completing the virtual machine wake-up process. After the virtual machine wakes up , restore normal memory pages to memory, that is, normal memory pages are restored to memory in an asynchronous manner, and only virtual machine context information and key memory pages are restored from disk to memory during the virtual machine wake-up process, which reduces to a certain extent The amount of data read during the virtual machine wake-up process, that is, the time spent during the virtual machine wake-up process is the time for restoring the virtual machine context information and key memory pages from the disk to the memory, thus speeding up the virtual machine wake-up speed.

为了进一步地描述本发明的技术效果,本发明实施例还提供了采用现有技术的方法与采用本发明实施例的技术方案虚拟机唤醒时间对比仿真图,如图3所示,图3为本发明与现有技术的效果对比示意图。从图3可以看出,采用现有技术的方案(对应图示中的普通唤醒),随着虚拟机规格增大,消耗时间线性增加,而采用本发明的技术方案,虚拟机唤醒消耗时间只有小幅增加。In order to further describe the technical effect of the present invention, the embodiment of the present invention also provides a comparison simulation diagram of the virtual machine wake-up time between the method of the prior art and the technical solution of the embodiment of the present invention, as shown in Figure 3, which is the Schematic diagram of the effect comparison between the invention and the prior art. It can be seen from Fig. 3 that, using the solution of the prior art (corresponding to the normal wake-up in the illustration), as the specification of the virtual machine increases, the consumption time increases linearly, while using the technical solution of the present invention, the consumption time of the virtual machine wake-up is only small increase.

图4为本发明虚拟机唤醒装置实施例一的结构示意图,本实施例的装置设置在虚拟机运行的主机中,本实施例的装置包括获取模块401、关键内存页恢复模块402和唤醒模块403,其中,获取模块401用于获取虚拟机的上下文信息以及关键内存页,所述关键内存页包括唤醒所述虚拟机必备的内存页;关键内存页恢复模块402用于将所述上下文信息以及所述关键内存页从磁盘恢复到内存中;唤醒模块403用于唤醒所述虚拟机。FIG. 4 is a schematic structural diagram of Embodiment 1 of the device for waking up a virtual machine according to the present invention. The device of this embodiment is set in the host computer where the virtual machine runs. The device of this embodiment includes an acquisition module 401, a key memory page recovery module 402, and a wakeup module 403. , wherein the obtaining module 401 is used to obtain the context information of the virtual machine and a key memory page, the key memory page includes memory pages necessary to wake up the virtual machine; the key memory page recovery module 402 is used to use the context information and The key memory page is restored from the disk to the memory; the wakeup module 403 is used to wake up the virtual machine.

图5为本发明虚拟机唤醒装置实施例二的结构示意图,图5是在图4所示实施例的基础上进一步地还包括:关键内存页识别模块404,用于识别所述关键内存页。Fig. 5 is a schematic structural diagram of Embodiment 2 of the device for waking up a virtual machine according to the present invention. Fig. 5 is based on the embodiment shown in Fig. 4 and further includes: a critical memory page identification module 404, configured to identify the critical memory page.

在上述实施例中,所述关键内存页识别模块404具体用于根据虚拟机休眠过程中对所述关键内存页的标识识别所述关键内存页。In the above embodiment, the critical memory page identification module 404 is specifically configured to identify the critical memory page according to the identification of the critical memory page during the virtual machine hibernation process.

在上述实施例中,所述关键内存页识别模块404具体用于还用于在虚拟机休眠过程中确定预设类型的内存页为关键内存页。In the above embodiment, the critical memory page identification module 404 is specifically configured to also determine a preset type of memory page as a critical memory page during the hibernation process of the virtual machine.

在上述实施例中,所述关键内存页识别模块404具体用于在虚拟机唤醒过程中确定预设类型的内存页为关键内存页。In the above embodiment, the critical memory page identification module 404 is specifically configured to determine a preset type of memory page as a critical memory page during the virtual machine wake-up process.

在上述实施例中,所述预设类型的内存页包括下述任一种类型:In the above embodiments, the preset types of memory pages include any of the following types:

视频图形阵列VGA显存地址空间范围内的内存页;A memory page within the address space range of the video graphics array VGA memory;

根据所述虚拟机内存分布,处于0M至1M的地址空间范围内的内存页;According to the memory distribution of the virtual machine, memory pages within the address space range from 0M to 1M;

根据所述虚拟机内存分布,处于3.75G至4G的地址空间范围内的内存页;According to the memory distribution of the virtual machine, memory pages within the address space range of 3.75G to 4G;

根据所述虚拟机的上下文信息中的寄存器信息关联的内存页;A memory page associated with register information in the context information of the virtual machine;

根据传输后备缓冲器TLB中缓存的页表信息对应的内存页。According to the memory page corresponding to the page table information cached in the transfer lookaside buffer TLB.

图6为本发明虚拟机唤醒装置实施例三的结构示意图,图6是在图5所示实施例的基础上进一步地还包括:普通内存页恢复模块405用于将普通内存页恢复到所述内存中,所述普通内存页是指处于运动状态的虚拟机数据中除所述上下文信息和关键内存页之外的内存页。Fig. 6 is a schematic structural diagram of Embodiment 3 of the virtual machine wake-up device of the present invention. Fig. 6 is based on the embodiment shown in Fig. 5 and further includes: a common memory page restoration module 405 for restoring the normal memory page to the In the memory, the normal memory page refers to a memory page in the virtual machine data in a moving state except the context information and key memory pages.

图4、图5、图6所示装置实施例中的装置对应地,可用于执行上述图1或图2所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。Correspondingly, the devices in the device embodiments shown in Figure 4, Figure 5, and Figure 6 can be used to implement the technical solutions of the above-mentioned method embodiments shown in Figure 1 or Figure 2, and their implementation principles and technical effects are similar, and will not be repeated here. .

图7为本发明虚拟机唤醒装置实施例四的结构示意图,如图7所示,本实施例的装置包括存储器710和处理器720,存储器710可以包括随机存储器、闪存、只读存储器、可编程只读存储器、非易失性存储器或寄存器等。处理器720可以是中央处理器(Central Processing Unit,CPU)。存储器710用于存储可执行指令。处理器720可以执行存储器710中存储的可执行指令,例如,处理器720用于获取虚拟机的上下文信息以及关键内存页,所述关键内存页包括唤醒所述虚拟机必备的内存页;将所述上下文信息以及所述关键内存页从磁盘恢复到内存中,唤醒所述虚拟机。FIG. 7 is a schematic structural diagram of Embodiment 4 of the device for waking up a virtual machine according to the present invention. As shown in FIG. 7 , the device of this embodiment includes a memory 710 and a processor 720. Read-only memory, non-volatile memory or registers, etc. The processor 720 may be a central processing unit (Central Processing Unit, CPU). The memory 710 is used to store executable instructions. The processor 720 can execute the executable instruction stored in the memory 710, for example, the processor 720 is used to obtain the context information of the virtual machine and a key memory page, and the key memory page includes a necessary memory page for waking up the virtual machine; The context information and the key memory page are restored from the disk to the memory, and the virtual machine is woken up.

本实施例,通过获取虚拟机的上下文信息以及关键内存页,将上下文信息以及关键内存页从磁盘恢复到内存中,唤醒虚拟机,从而,完成虚拟机的唤醒过程,在此过程中,由于仅将虚拟机的上下文信息和关键内存页从磁盘恢复到内存中,在一定程度上减少了从磁盘恢复到内存的数据数量,加快了虚拟机唤醒速度,在此过程中,无需额外的部署的高成本的部件,节约了部署成本。In this embodiment, by obtaining the context information of the virtual machine and the key memory page, the context information and the key memory page are restored from the disk to the memory, and the virtual machine is woken up, thereby completing the wake-up process of the virtual machine. In this process, only Restore the context information and key memory pages of the virtual machine from the disk to the memory, which reduces the amount of data restored from the disk to the memory to a certain extent, and speeds up the wake-up of the virtual machine. During this process, no additional deployment of high Cost-effective components, saving deployment costs.

本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above method embodiments can be completed by program instructions and related hardware. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present invention. scope.

Claims (14)

1. a virtual machine awakening method, is characterized in that, comprising:
Obtain the contextual information of virtual machine and crucial page, described crucial page comprises the page waking described virtual machine indispensability up;
Described contextual information and described crucial page are returned to internal memory from disk;
Wake described virtual machine up.
2. method according to claim 1, is characterized in that, before the contextual information of described acquisition virtual machine and crucial page, also comprises:
Identify described crucial page.
3. method according to claim 2, is characterized in that, the described crucial page of described identification, comprising:
According in virtual machine sleep procedure to the described crucial page of the mark identification of described crucial page.
4. method according to claim 3, is characterized in that, described according in virtual machine sleep procedure to before the described crucial page of the mark identification of described crucial page, also comprise:
In virtual machine sleep procedure, determine that the page of preset kind is crucial page.
5. method according to claim 2, is characterized in that, the described crucial page of described identification, comprising:
In virtual machine wakeup process, determine that the page of preset kind is crucial page.
6. the method according to claim 4 or 5, is characterized in that, the page of described preset kind comprises any one type following:
Page in Video Graphics Array VGA video memory address space range;
Distribute according to described virutal machine memory, be in the page in the address space range of 0M to 1M;
Distribute according to described virutal machine memory, be in the page in the address space range of 3.75G to 4G;
According to the page of the register information association in the contextual information of described virtual machine;
The page corresponding according to the page table information of buffer memory in transmission look-aside buffer TLB.
7. the method according to any one of claim 1 ~ 6, is characterized in that, described in wake described virtual machine up after also comprise:
Returned to by common memory page in described internal memory, described common memory page refers to the page in the virtual-machine data be kept in motion except described contextual information and crucial page.
8. a virtual machine Rouser, is characterized in that, comprising:
Acquisition module, for obtaining the contextual information of virtual machine and crucial page, described crucial page comprises the page waking described virtual machine indispensability up;
Crucial page recovers module, for returning to internal memory by described contextual information and described crucial page from disk;
Wake module, for waking described virtual machine up.
9. device according to claim 8, is characterized in that, also comprises:
Crucial page identification module, for identifying described crucial page.
10. device according to claim 9, is characterized in that, described crucial page identification module specifically for according in virtual machine sleep procedure to the described crucial page of the mark identification of described crucial page.
11. devices according to claim 10, is characterized in that, described crucial page identification module is specifically for also for determining that in virtual machine sleep procedure the page of preset kind is crucial page.
12. devices according to claim 9, is characterized in that, described crucial page identification module is specifically for determining that in virtual machine wakeup process the page of preset kind is crucial page.
13. devices according to claim 11 or 12, it is characterized in that, the page of described preset kind comprises any one type following:
Page in Video Graphics Array VGA video memory address space range;
Distribute according to described virutal machine memory, be in the page in the address space range of 0M to 1M;
Distribute according to described virutal machine memory, be in the page in the address space range of 3.75G to 4G;
According to the page of the register information association in the contextual information of described virtual machine;
The page corresponding according to the page table information of buffer memory in transmission look-aside buffer TLB.
Device described in 14. according to Claim 8 ~ 13 any one, is characterized in that, also comprise:
Common memory page recovers module, and for returning in described internal memory by common memory page, described common memory page refers to the page in the virtual-machine data be kept in motion except described contextual information and crucial page.
CN201410566931.8A 2014-10-22 2014-10-22 Virtual machine awakening method and device Active CN104268005B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410566931.8A CN104268005B (en) 2014-10-22 2014-10-22 Virtual machine awakening method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410566931.8A CN104268005B (en) 2014-10-22 2014-10-22 Virtual machine awakening method and device

Publications (2)

Publication Number Publication Date
CN104268005A true CN104268005A (en) 2015-01-07
CN104268005B CN104268005B (en) 2018-11-30

Family

ID=52159529

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410566931.8A Active CN104268005B (en) 2014-10-22 2014-10-22 Virtual machine awakening method and device

Country Status (1)

Country Link
CN (1) CN104268005B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107220102A (en) * 2017-04-19 2017-09-29 深圳中兴网信科技有限公司 The dormancy of virtual machine and awakening method and system
CN107810488A (en) * 2017-08-11 2018-03-16 深圳前海达闼云端智能科技有限公司 A kind of method of state management of virtual machine, device and intelligent terminal
CN117075971A (en) * 2023-04-18 2023-11-17 阿里巴巴(中国)有限公司 Hibernation methods and related equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101154130A (en) * 2006-09-30 2008-04-02 联想(北京)有限公司 Virtual machine system and its power supply management method
US20080089338A1 (en) * 2006-10-13 2008-04-17 Robert Campbell Methods for remotely creating and managing virtual machines
CN102037428A (en) * 2008-05-22 2011-04-27 Ati技术无限责任公司 Integrated circuit and method with secondary memory controller for providing sleep states with reduced power consumption
CN102331949A (en) * 2011-10-12 2012-01-25 华为技术有限公司 Methods for generating and restoring memory snapshot of virtual machine, device and system
CN103927145A (en) * 2014-04-28 2014-07-16 中国科学院微电子研究所 Method and device for system sleep and wake-up based on hybrid memory

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101154130A (en) * 2006-09-30 2008-04-02 联想(北京)有限公司 Virtual machine system and its power supply management method
US20080089338A1 (en) * 2006-10-13 2008-04-17 Robert Campbell Methods for remotely creating and managing virtual machines
CN102037428A (en) * 2008-05-22 2011-04-27 Ati技术无限责任公司 Integrated circuit and method with secondary memory controller for providing sleep states with reduced power consumption
CN102331949A (en) * 2011-10-12 2012-01-25 华为技术有限公司 Methods for generating and restoring memory snapshot of virtual machine, device and system
CN103927145A (en) * 2014-04-28 2014-07-16 中国科学院微电子研究所 Method and device for system sleep and wake-up based on hybrid memory

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107220102A (en) * 2017-04-19 2017-09-29 深圳中兴网信科技有限公司 The dormancy of virtual machine and awakening method and system
CN107810488A (en) * 2017-08-11 2018-03-16 深圳前海达闼云端智能科技有限公司 A kind of method of state management of virtual machine, device and intelligent terminal
WO2019028854A1 (en) * 2017-08-11 2019-02-14 深圳前海达闼云端智能科技有限公司 Method and device for state management of virtual machine, and intelligent terminal
CN117075971A (en) * 2023-04-18 2023-11-17 阿里巴巴(中国)有限公司 Hibernation methods and related equipment

Also Published As

Publication number Publication date
CN104268005B (en) 2018-11-30

Similar Documents

Publication Publication Date Title
US8954707B2 (en) Automatic use of large pages
EP3161622B1 (en) Accelerating boot time zeroing of memory based on non-volatile memory (nvm) technology
JP2013542486A5 (en)
US20160055095A1 (en) Storing data from cache lines to main memory based on memory addresses
KR20120000089A (en) Interoperating system memory hot swap to support memory expansion in nonvirtualized systems
US20150234687A1 (en) Thread migration across cores of a multi-core processor
US10990153B2 (en) Application processor and system on chip
TWI610239B (en) Electronic apparatus and method for resuming from hibernation
JP2014508332A (en) Determination method, determination apparatus, determination system, and storage medium
CN111625546B (en) Data writing method, device, equipment and medium
CN104268005A (en) Virtual machine waking method and device
US12210883B1 (en) Accelerating windows fast startup for dram-less SSD
US8417903B2 (en) Preselect list using hidden pages
CN106170776A (en) For using, there is the invalid bandwidth read in reduction cache memory and the method and apparatus of power
WO2023151352A1 (en) Memory snapshot management method and apparatus, and device and medium
US9857864B1 (en) Systems and methods for reducing power consumption in a memory architecture
US9852100B2 (en) Guest-programmable location of advanced configuration and power interface (ACPI) tables in virtualized systems
US9158697B2 (en) Method for cleaning cache of processor and associated processor
CN110308861B (en) Storage data preservation method, device, electronic device and readable storage medium
CN106407132A (en) A data communication synchronization method based on a shared memory
US11210074B2 (en) On-demand binary translation state map generation
CN106815008B (en) System pause method, system recovery method and computer system using same
CN107943415A (en) The method and system of lookup free cluster based on FAT file system
CN116635833A (en) Precise timestamp or derived counter value generation on complex CPUs
CN107423165A (en) A kind of data snapshot head writes copy method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20201104

Address after: 625, room 269, Connaught platinum Plaza, No. 518101, Qianjin Road, Xin'an street, Shenzhen, Guangdong, Baoan District

Patentee after: SHENZHEN SHANGGE INTELLECTUAL PROPERTY SERVICE Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201130

Address after: 213000 No. 11 Qingyang North Road, Tianning District, Changzhou, Jiangsu

Patentee after: Changzhou Hong quantity Electronic Technology Co.,Ltd.

Address before: 625, room 269, Connaught platinum Plaza, No. 518101, Qianjin Road, Xin'an street, Shenzhen, Guangdong, Baoan District

Patentee before: SHENZHEN SHANGGE INTELLECTUAL PROPERTY SERVICE Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220824

Address after: Tianning District Hehai road 213000 Jiangsu city of Changzhou province No. 9

Patentee after: Changzhou Tianning Communication Technology Industrial Park Co.,Ltd.

Address before: 213000 No. 11 Qingyang North Road, Tianning District, Changzhou City, Jiangsu Province

Patentee before: Changzhou Hong quantity Electronic Technology Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230106

Address after: Tianning District Hehai road 213000 Jiangsu city of Changzhou province No. 9

Patentee after: Changzhou Hengtang Technology Industry Co.,Ltd.

Address before: Tianning District Hehai road 213000 Jiangsu city of Changzhou province No. 9

Patentee before: Changzhou Tianning Communication Technology Industrial Park Co.,Ltd.