Virtual machine deployment and hot migration methods, VMM upgrade methods, servers
By only copying the mapping relationship between virtual addresses and physical addresses during the virtual machine migration process, the existing technology problems of requiring a large amount of computing resources to be reserved for virtual machine migration and the complexity of the migration process are solved, achieving efficient virtual machine deployment and Migration saves time and resource costs.
Patent Information
- Application Number
- CN201911355638.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-25
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2039-12-25
AI Technical Summary
The existing technology requires a large amount of computing resources to be reserved during the virtual machine migration process, and the migration process is complex and time-consuming. Especially in the virtual machine virtualization scenario, when the memory space of the virtual machine is large, it is difficult to achieve efficient resources. Utilize and quickly migrate.
By establishing a mapping relationship between the HVA space of the upgraded virtual machine and the HPA space of the pre -upgraded virtual machine, only the mapping relationship between the host's virtual address and the physical address of the virtual address and the content of the entire memory space of the virtual machine is not copied. As a result, efficient deployment and migration of virtual machines.
Without interrupting the virtual machine business, the migration from the pre-upgrade virtual machine to the post-upgrade virtual machine is realized, and the hot replacement of the VMM software is completed. It is suitable for batch hot migration of a large number of virtual machines, saving time and resource costs. .
Smart Images

Figure CN113032086B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular, to a virtual machine deployment method, a virtual machine hot migration method, a VMM upgrade method, a server, and a computer-readable storage medium. Background Art
[0002] Virtual Machine Monitor (VMM) is a program that carries and monitors virtual machines. In order to upgrade it to add functions or fix program defects, it is necessary to migrate the virtual machines running on the VMM. In order not to affect or interrupt the operation of business virtual machines during migration, the existing technology mainly completes it through online migration of virtual machines combined with software cold patching. Specifically, it can be divided into two types: 1. Off-site migration, that is, first hot migrate the virtual machine of the server to be upgraded to other servers online, then upgrade the VMM using the cold patch method, and finally hot migrate the virtual machine online back to the upgraded VMM to run; 2. Local migration, that is, start the old and new versions of the VMM program on the server host at the same time, and then use local migration technology to migrate the virtual machine from the old VMM to the new VMM online.
[0003] The above two methods of online migration combined with cold patching are essentially to copy the virtual machine computing resources first and then release them. During the execution process, the entire memory space of the virtual machine needs to be copied. Therefore, before execution, it is necessary to reserve computing resources at least equal to the memory space of the migrated virtual machine on other servers or the current server. However, in practice, computing resources are usually allocated according to actual business, and in the cloud computing server virtualization scenario, the memory space of some virtual machines used by servers is tens or hundreds of GB, so it is difficult to reserve resources. Moreover, when a large number of virtual machines need to be migrated, the entire implementation process will be very complicated, time-consuming and labor-intensive. Summary of the invention
[0004] To solve at least one aspect of the above problems in the prior art, the present disclosure provides a virtual machine deployment method, a virtual machine hot migration method, a VMM upgrade method, a server and a computer-readable storage medium.
[0005] To achieve the above objective, as a first aspect of the present disclosure, a method for deploying a virtual machine is provided, comprising:
[0006] According to the mapping relationship between the host virtual address HVA space of the virtual machine before the upgrade and the host physical address HPA space of the virtual machine before the upgrade, a mapping between the HVA space of the upgraded virtual machine and the HPA space of the virtual machine before the upgrade is established, wherein the upgraded virtual machine is deployed on the upgraded virtual machine monitor VMM, and the memory configuration of the upgraded virtual machine is the same as the memory configuration of the virtual machine before the upgrade running on the VMM before the upgrade.
[0007] Optionally, according to the mapping relationship between the host virtual address HVA space of the virtual machine before the upgrade and the host physical address HPA space of the virtual machine before the upgrade, the step of establishing a mapping between the HVA space of the upgraded virtual machine and the HPA space of the virtual machine before the upgrade includes:
[0008] Determine the order and sequence number of the page table entries of each physical memory page in the HPA space of the virtual machine before the upgrade;
[0009] According to the correspondence between the page table entry of each physical memory page and the sequence number, each physical memory page is inversely mapped to a virtual memory page of the HVA space of the corresponding upgraded virtual machine.
[0010] Optionally, the step of determining the sequence and sequence number of the page table entries of each physical memory page in the HPA space of the virtual machine before the upgrade includes:
[0011] Get the first entry address of the HVA space of the virtual machine before the upgrade;
[0012] Obtaining a page address offset of a virtual memory page of an HVA space of the virtual machine before upgrading corresponding to each of the physical memory pages relative to the first entry address;
[0013] The size sequence of the page address offsets is determined as the order of the page table entries of each of the physical memory pages, and the page address offsets are determined as the sequence numbers of the page table entries of the corresponding physical memory pages.
[0014] Optionally, according to the correspondence between the page table entries of each physical memory page and the sequence number, the step of inversely mapping each physical memory page to a virtual memory page of the HVA space of the corresponding upgraded virtual machine includes:
[0015] Obtaining a second entry address of the HVA space of the upgraded virtual machine;
[0016] In the order of increasing sequence numbers, taking the second entry address as the starting point, each of the physical memory pages is demapped to the virtual memory page of the HVA space of the upgraded virtual machine, wherein the page address offset of the virtual memory page corresponding to each of the physical memory pages relative to the second entry address is equal to the sequence number corresponding to the page table entry of the physical memory page.
[0017] Optionally, before the step of reversely mapping each of the physical memory pages to a virtual memory page of the HVA space of the upgraded virtual machine in the order of increasing sequence numbers and taking the second entry address as a starting point, the deployment method further includes:
[0018] A signaling is sent to the upgraded VMM to put the virtual central processing unit VCPU of the upgraded virtual machine into a pause state.
[0019] Optionally, according to the correspondence between the page table entries of each physical memory page and the sequence number, the step of inversely mapping each physical memory page to a virtual memory page of the HVA space of the corresponding upgraded virtual machine includes:
[0020] Obtaining a third entry address of the HVA space of the upgraded virtual machine;
[0021] Sending a signal to the upgraded VMM to put the VCPU of the upgraded virtual machine into a running state;
[0022] According to the page fault address offset generated by the page fault interrupt, the physical memory page is reverse mapped to the target virtual memory page, wherein the target virtual memory page is the virtual memory page of the HVA space of the upgraded virtual machine, the sequence number of the page table entry of the physical memory page is equal to the page fault address offset, and the page address offset of the target virtual memory page relative to the third entry address is equal to the page fault address offset.
[0023] Optionally, after the step of reversely mapping the physical memory page to a virtual memory page of the HVA space of the upgraded virtual machine according to the page fault address offset generated by the page fault interrupt, the deployment method further includes:
[0024] Determine whether the number of the physical memory pages on the virtual memory pages to be demapped to the HVA space of the upgraded virtual machine is less than a predetermined threshold;
[0025] In response to the number of the physical memory pages on the virtual memory pages to be demapped to the HVA space of the upgraded virtual machine being less than the predetermined threshold, sending a signal to the upgraded VMM to put the VCPU of the upgraded virtual machine into a paused state;
[0026] The physical memory page to be demapped to the virtual memory page of the HVA space of the upgraded virtual machine is demapped to the virtual memory page of the HVA space of the upgraded virtual machine, wherein the page address offset of the virtual memory page corresponding to each of the physical memory pages relative to the third entry address is equal to the sequence number corresponding to the page table entry of the physical memory page.
[0027] Optionally, the step of determining the order of the page table entries of each of the physical memory pages comprises:
[0028] Obtaining the sequence number of the virtual memory page of the HVA space of the virtual machine before the upgrade corresponding to each physical memory page in the page frame mapping map MS of the virtual machine before the upgrade;
[0029] The size order of the sequence numbers is determined as the order of the page table entries of each of the physical memory pages, and the sequence numbers are determined as the sequence numbers of the page table entries corresponding to the physical memory pages.
[0030] Optionally, after the step of inversely mapping the physical memory page to a virtual memory page of the HVA space of the corresponding upgraded virtual machine according to the correspondence between the page table entry of each physical memory page and the sequence number, the deployment method further includes:
[0031] A multi-level page table is created for the physical memory page on the virtual memory page that is inversely mapped to the HVA space of the upgraded virtual machine.
[0032] Optionally, before the step of establishing a mapping between the HVA space of the upgraded virtual machine and the HPA space of the virtual machine before the upgrade according to the mapping relationship between the host virtual address HVA space of the virtual machine before the upgrade and the host physical address HPA space of the virtual machine before the upgrade, the deployment method further includes:
[0033] Determine whether the MS of the virtual machine after the upgrade is consistent with the MS of the virtual machine before the upgrade;
[0034] If they are inconsistent, the MS of the virtual machine before the upgrade is copied to the virtual machine after the upgrade.
[0035] As a second aspect of the present disclosure, a method for hot migration of a virtual machine is provided, comprising:
[0036] Execute the above deployment method to map the HPA space of the virtual machine before the upgrade to the HVA space of the virtual machine after the upgrade;
[0037] A signaling is sent to the upgraded VMM to put the VCPU of the upgraded virtual machine into a running state, wherein the HPA space of the upgraded virtual machine is the HPA space of the virtual machine before the upgrade.
[0038] As a third aspect of the present disclosure, a method for upgrading a VMM is provided, comprising:
[0039] Deploy the upgraded VMM on the host machine;
[0040] Start the VMM before and after the upgrade on the host machine at the same time;
[0041] Execute the above hot migration method to migrate the pre-upgrade virtual machine running on the pre-upgrade VMM to the post-upgrade virtual machine running on the upgraded VMM;
[0042] Delete the VMM before the upgrade.
[0043] As a fourth aspect of the present disclosure, a server is provided, the server being used as a host of a virtual machine, the server comprising:
[0044] A storage module, in which an application is stored;
[0045] One or more processors, when the application is executed by the one or more processors, cause the one or more processors to implement one of the following methods:
[0046] The deployment method described above;
[0047] The above-mentioned thermal migration method;
[0048] The upgrade method mentioned above.
[0049] As a fifth aspect of the present disclosure, a computer-readable storage medium is provided, on which an executable program is stored, and when the executable program is executed, one of the following methods can be implemented:
[0050] The deployment method described above;
[0051] The above-mentioned thermal migration method;
[0052] The upgrade method mentioned above.
[0053] The virtual machine deployment method provided by the present disclosure only copies the mapping relationship between the host machine virtual address HVA space and the host machine physical address HPA space during the virtual machine deployment process (which can be achieved by copying or modifying the page table (PageTable Entry, PTE)), without copying the content of the entire memory space of the virtual machine. Therefore, the mapping relationship between the HVA space of the upgraded virtual machine and the HPA space of the virtual machine before the upgrade can be established without interrupting the virtual machine business or reserving a large amount of computing resources. When the deployment method is used in the virtual machine migration process, it can realize the migration from the virtual machine before the upgrade to the virtual machine after the upgrade, and then complete the hot replacement of the old and new versions of the VMM software. Moreover, it is also suitable for batch hot migration of a large number of virtual machines, which can effectively save time and resource costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present invention but do not constitute a limitation of the present invention. In the accompanying drawings:
[0055] Figure 1 is a flowchart of an implementation of the deployment method provided by the present disclosure;
[0056] Figure 2 Schematic diagram of various memory concepts and their conversion relationships in virtualization scenarios;
[0057] Figure 3 is a flowchart of another implementation of the deployment method provided by the present disclosure;
[0058] Figure 4 is a flowchart of another implementation of the deployment method provided by the present disclosure;
[0059] Figure 5 is a flowchart of another implementation of the deployment method provided by the present disclosure;
[0060] Figure 6 is a flowchart of another implementation of the deployment method provided by the present disclosure;
[0061] Figure 7 is a flowchart of another implementation of the deployment method provided by the present disclosure;
[0062] Figure 8 is a flow chart of an embodiment of the thermal migration method provided by the present disclosure;
[0063] Fig. 9 is a flowchart of an implementation of the upgrade method provided by the present disclosure;
[0064] Fig.10It is a schematic diagram of virtual machine memory mapping before and after the deployment method in the present disclosure is executed. DETAILED DESCRIPTION
[0065] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.
[0066] As a first aspect of the present disclosure, a method for deploying a virtual machine is provided, such as Figure 1 As shown, including:
[0067] In step S110, a mapping between the HVA space of the upgraded virtual machine and the HPA space of the virtual machine before the upgrade is established according to the mapping relationship between the host virtual address HVA space of the virtual machine before the upgrade and the host physical address HPA space of the virtual machine before the upgrade, wherein the upgraded virtual machine is deployed on the upgraded virtual machine monitor VMM, and the memory configuration of the upgraded virtual machine is the same as the memory configuration of the virtual machine before the upgrade running on the VMM before the upgrade.
[0068] like Figure 2 As shown, the page table (Guest Page Table, GPT) in the virtual machine provides a mapping relationship between the virtual machine virtual address (Guest Virtual Address, GVA) space and the virtual machine pseudo physical address (Guest Physical Address, GPA) space; the page table (Host Page Table, HPT) of the host machine provides a mapping relationship between the host virtual address (HostVirtual Address, HVA) space and the host physical address (Host Physical Address, HPA) space; the page frame mapping map (Memory Slot, MS) matches the GPA and HVA according to the serial number.
[0069] It should be noted that the page address offsets mentioned in the present disclosure are all page address offsets relative to the entry address of the respective address space. For example, the page address offset of the virtual memory page of the HVA space is the page address offset relative to the entry address of the HVA space, and the page address offset of the physical memory page of the HPA space is the page address offset relative to the entry address of the HPA space.
[0070] In the present disclosure, when deploying a virtual machine, the upgraded virtual machine is first started on the upgraded VMM, so that the memory configuration of the upgraded virtual machine is consistent with the memory configuration of the pre-upgrade virtual machine running on the pre-upgrade VMM, but the actual physical memory is not allocated to the upgraded virtual machine. Because the memory configuration and initialization process of the upgraded virtual machine and the pre-upgrade virtual machine are consistent, the mapping relationship from GPA to HVA of the upgraded virtual machine is also consistent with the mapping relationship from GPA to HVA of the pre-upgrade virtual machine. Specifically, the MS of the upgraded virtual machine is consistent with the MS of the pre-upgrade virtual machine, that is, the pages of the HVA space in the upgraded virtual machine with the same sequence number and the pages of the HVA space in the pre-upgrade virtual machine respectively corresponding to the pages of the GPA space in the upgraded virtual machine and the pages of the GPA space in the pre-upgrade virtual machine have the same sequence number; in addition, the pages in the GPA space of the upgraded virtual machine and the pages in the GPA space of the pre-upgrade virtual machine respectively corresponding to the virtual memory pages of the HVA space of the upgraded virtual machine with the same page offset also have the same page offset.
[0071] Combine the following Fig.10 The mapping relationship between the address spaces of the virtual machines before and after the upgrade is further explained. Fig.10 In (a), the pre-upgrade VMM and the post-upgrade VMM are deployed on the server at the same time, and the post-upgrade virtual machine is started on the post-upgrade VMM, but no actual physical memory HPA space is allocated to the post-upgrade virtual machine. Since the memory configuration and initialization process of the virtual machine on the VMM before and after the upgrade are consistent, the mapping relationship between the GPA space and the HVA space of the pre-upgrade virtual machine and the mapping relationship between the GPA space and the HVA space of the post-upgrade virtual machine are the same. Fig.10 In the example, the numbers 1, 2, and 3 can represent the sequence number of the memory page in the corresponding MS, or the page address offset of the memory in its address space. Fig.10As shown in (a), when the numbers 1, 2, and 3 in the figure represent serial numbers, the page of the HVA space in the upgraded virtual machine with serial number 1 and the page of the HVA space in the virtual machine before the upgrade respectively correspond to the page of the GPA space in the upgraded virtual machine and the page of the GPA space in the virtual machine before the upgrade, and the page of the HVA space in the upgraded virtual machine with serial number 2 and the page of the HVA space in the virtual machine before the upgrade respectively correspond to the page of the GPA space in the upgraded virtual machine and the page of the GPA space in the virtual machine before the upgrade, and the serial numbers are both 2; when the numbers 1, 2, and 3 in the figure represent serial numbers, the page of the HVA space in the upgraded virtual machine with serial number 1 and the page of the HVA space in the virtual machine before the upgrade respectively correspond to the page of the GPA space in the upgraded virtual machine and the page of the GPA space in the virtual machine before the upgrade, and the serial numbers are both 2; When , 2, and 3 represent page address offsets, the page address offsets of the pages of the HVA space in the upgraded virtual machine with a page address offset of 1 and the pages of the HVA space in the virtual machine before the upgrade, respectively, correspond to the pages of the GPA space in the upgraded virtual machine and the pages of the GPA space in the virtual machine before the upgrade, and the page address offsets of the pages of the HVA space in the upgraded virtual machine with a page address offset of 2 and the pages of the HVA space in the virtual machine before the upgrade, respectively, correspond to the pages of the GPA space in the upgraded virtual machine and the pages of the GPA space in the virtual machine before the upgrade, and the page address offsets of the pages of the GPA space in the upgraded virtual machine and the pages of the GPA space in the virtual machine before the upgrade, respectively, are both 2. It should be noted that when the numbers 1, 2, and 3 in the figure represent page address offsets, Fig.10 The case where the page address offset of the page in the GPA space is equal to the page address offset of the corresponding page in the HVA space is only illustrated for example. In actual applications, the page address offset of the page in the GPA space and the page address offset of the corresponding page in the HVA space may not be equal, as long as the virtual memory pages of the HVA space of the upgraded virtual machine and the virtual memory pages of the HVA space of the virtual machine before the upgrade that have the same page offset respectively correspond to the pages in the GPA space of the upgraded virtual machine and the pages in the GPA space of the virtual machine before the upgrade. For example, the page address offset of the page in the HVA space of the upgraded virtual machine with a page address offset of 1 and the page in the HVA space of the virtual machine before the upgrade respectively correspond to the page in the GPA space of the upgraded virtual machine and the page in the GPA space of the virtual machine before the upgrade, and the page address offset of the page in the GPA space of the upgraded virtual machine and the page in the GPA space of the virtual machine before the upgrade are both 3.
[0072] In the present disclosure, according to the mapping relationship between the host virtual address HVA space of the virtual machine before the upgrade and the host physical address HPA space of the virtual machine before the upgrade, the HPA space of the virtual machine before the upgrade is reversely mapped to the HVA space of the virtual machine after the upgrade. When the virtual machine after the upgrade accesses the page of the HVA space, the physical memory page found through multi-level table lookup is the same as the physical page of the HPA space corresponding to the page of the HVA space with the same sequence number or page address offset in the virtual machine before the upgrade, that is, the virtual machine after the upgrade can access the same physical memory page as the virtual machine before the upgrade, thereby completing the deployment of the virtual machine after the upgrade.
[0073] Combine the following Fig.10 For further explanation. Fig.10As shown in (a), in the HVA space of the virtual machine before the upgrade, the page with the serial number 1 corresponds to the p1 physical memory page of the HPA space, the page with the serial number 2 corresponds to the p2 physical memory page of the HPA space, and the page with the serial number 3 corresponds to the p3 physical memory page of the HPA space. In step S110 of the present disclosure, the HPA space of the virtual machine before the upgrade is reversely mapped to the HVA space of the virtual machine after the upgrade, that is, Fig.10 As shown in (b), in the HVA space of the upgraded virtual machine, the page with serial number 1 corresponds to the p1 physical memory page of the HPA space, the page with serial number 2 corresponds to the p2 physical memory page of the HPA space, and the page with serial number 3 corresponds to the p3 physical memory page of the HPA space. In other words, the upgraded virtual machine corresponds to the same HPA space as the virtual machine before the upgrade. As mentioned above, the mapping relationship between the GPA space and the HVA space of the virtual machine before the upgrade is the same as the mapping relationship between the GPA space and the HVA space of the virtual machine after the upgrade. Therefore, Fig.10 As shown, the mapping relationships among the GVA space, GPA space, HVA space, and HPA space of the upgraded virtual machine are the same as the mapping relationships among the GVA space, GPA space, HVA space, and HPA space of the virtual machine before the upgrade. Fig.10 In (b), after deleting the pre-upgrade VMM and starting the post-upgrade virtual machine, the physical memory pages accessed by the program running on the post-upgrade virtual machine through multi-level table lookup are the same as the physical memory pages accessed when running on the pre-upgrade virtual machine.
[0074] like Fig.10 As shown, in step S110, the memory of the physical memory page is not copied, and the mapping between the HVA space of the upgraded virtual machine and the HPA space of the virtual machine before the upgrade is established by copying or modifying the page table (Page Table Entry, PTE). Therefore, the entire mapping relationship establishment process is very fast and does not require the reservation of a large amount of memory resources.
[0075] The virtual machine deployment method provided by the present disclosure only copies the mapping relationship between the host machine virtual address HVA space and the host machine physical address HPA space during the virtual machine deployment process (which can be achieved by copying or modifying the page table (PageTable Entry, PTE)), without copying the content of the entire memory space of the virtual machine. Therefore, the mapping relationship between the HVA space of the upgraded virtual machine and the HPA space of the virtual machine before the upgrade can be established without interrupting the virtual machine business or reserving a large amount of computing resources. When the deployment method is used in the virtual machine migration process, it can realize the migration from the virtual machine before the upgrade to the virtual machine after the upgrade, and then complete the hot replacement of the old and new versions of the VMM software. Moreover, it is also suitable for batch hot migration of a large number of virtual machines, which can effectively save time and resource costs.
[0076] In the present disclosure, when the upgraded virtual machine accesses a page in the HVA space, in order to ensure that the physical memory page found through multi-level table lookup is the same as the physical page in the HPA space corresponding to the page in the HVA space with the same sequence number or page address offset in the virtual machine before the upgrade, the MS of the upgraded virtual machine should be consistent with the MS of the virtual machine before the upgrade. Figure 3 As shown, after starting the upgraded virtual machine, the deployment method may further include the following steps:
[0077] In step S121, it is determined whether the page frame map MS of the upgraded virtual machine is consistent with the MS of the virtual machine before the upgrade;
[0078] If they are inconsistent, in step S122, the MS of the virtual machine before the upgrade is copied to the virtual machine after the upgrade.
[0079] In the present disclosure, there is no particular limitation on the order between step S121 and step S110, and step S121 may be performed before step S110 or after step S110. Figure 3 In the embodiment shown in , step S121 is performed before step S110.
[0080] In the present disclosure, there is no special limitation on how to implement step S110. As an optional implementation, Figure 3 As shown, step S110 specifically includes the following steps:
[0081] In step S111, the sequence and sequence number of the page table entries of each of the physical memory pages in the HPA space of the virtual machine before the upgrade are determined.
[0082] In step S112, each of the physical memory pages is inversely mapped to a virtual memory page of the HVA space of the corresponding upgraded virtual machine according to the correspondence between the page table entry of each of the physical memory pages and the sequence number.
[0083] In the present disclosure, the page table entries of the physical memory pages of the HPA space corresponding to the HVA space of the virtual machine before the upgrade can be found according to the entry address of the HVA space of the virtual machine before the upgrade and the size information of the HVA space. After determining the order of the page table entries of each physical memory page, a list can be created to save each physical memory page and its sequence number in the order in the above list in sequence according to the order.
[0084] In the present disclosure, there is no specific limitation on how to de-map the physical memory page to the virtual memory page of the HVA space of the upgraded virtual machine. As long as, when the upgraded virtual machine accesses the page of the HVA space, the physical memory page found through multi-level table lookup is the same as the physical page of the HPA space corresponding to the page of the HVA space with the same sequence number or page address offset in the virtual machine before the upgrade, it falls within the scope of the present disclosure.
[0085] In order to save memory space, multi-level page tables are often used in memory management. When a multi-level page table is created for the physical memory page on the virtual memory page that is inversely mapped to the HVA space of the upgraded virtual machine, the page table entry of the physical memory page of the HPA space is finally switched from the HVA space of the virtual machine before the upgrade to the HVA space of the upgraded virtual machine. Figure 3 As shown, after step S112, step S110 further includes:
[0086] In step S113, a multi-level page table is created for the physical memory pages on the virtual memory pages that are inversely mapped to the HVA space of the upgraded virtual machine.
[0087] From the above analysis, it can be seen that the virtual memory pages of the HVA space of the upgraded virtual machine and the virtual memory pages of the HVA space of the virtual machine before the upgrade, which have the same page address offset, respectively correspond to the pages in the GPA space of the upgraded virtual machine and the pages in the GPA space of the virtual machine before the upgrade. Figure 4 As shown, step S111 may specifically include the following steps:
[0088] In step S111a, the first entry address of the HVA space of the virtual machine before the upgrade is obtained;
[0089] In step S111b, the page address offset of the virtual memory page of the HVA space of the virtual machine before the upgrade corresponding to each of the physical memory pages relative to the first entry address is obtained;
[0090] In step S111c, the size sequence of the page address offsets is determined as the order of the page table entries of each physical memory page, and the page address offsets are determined as the sequence numbers of the page table entries of the corresponding physical memory pages.
[0091] like Fig.10As shown in the figure, when the numbers 1, 2, and 3 represent page address offsets, in the HVA space of the virtual machine before the upgrade, the page with a page address offset of 1 corresponds to the p1 physical memory page of the HPA space, the page with a page address offset of 2 corresponds to the p2 physical memory page of the HPA space, and the page with a page address offset of 3 corresponds to the p3 physical memory page of the HPA space. Therefore, the sequence number corresponding to the p1 physical memory page is 1, the sequence number corresponding to the p2 physical memory page is 2, and the sequence number corresponding to the p3 physical memory page is 3.
[0092] In the present disclosure, the correspondence between the page address offset of the physical memory page and the corresponding virtual memory page can be obtained through the page table HPT of the host machine. The page table entries of each physical memory page can be sorted according to the increment of the offset size, increment or any other method, without special limitation.
[0093] In the present disclosure, there is no special limitation on how to implement step S112. As an optional implementation, Figure 5 As shown, step S112 specifically includes:
[0094] In step S112a, a second entry address of the HVA space of the upgraded virtual machine is obtained;
[0095] In step S112b, in the order of increasing sequence numbers and starting from the second entry address, each of the physical memory pages is demapped to the virtual memory page of the HVA space of the upgraded virtual machine, wherein the page address offset of the virtual memory page corresponding to each physical memory page relative to the second entry address is equal to the sequence number corresponding to the page table entry of the physical memory page.
[0096] In the present disclosure, a memory page reverse mapping mechanism (rmap) is used to reversely map the page table entries of the physical memory pages of the HPA space of the virtual machine before the upgrade to the virtual memory pages of the HVA space of the target virtual machine whose page address offset is equal to the page address offset corresponding to the page table entries of the physical memory page, that is, the reverse mapping of the physical memory page to the virtual memory page of the HVA space of the target virtual machine whose page address offset is equal to the page address offset corresponding to the page table entries of the physical memory page is completed.
[0097] In order to prevent the virtual central processing unit (VCPU) of the upgraded virtual machine from generating a page fault interrupt during operation, before executing step S112b, the deployment method further includes:
[0098] In step S112c, a signaling is sent to the upgraded VMM to put the virtual central processing unit VCPU of the upgraded virtual machine into a paused state.
[0099] There is no special limitation on the order between step S112a and step S112c. Step S112a can be executed first and then step S112c, or step S112c can be executed first and then step S112a, or step S112c can be executed at the same time as step S112a, as long as step S112c is executed before step S112b.
[0100] It should be pointed out that the "page fault interrupt" here refers to the interrupt issued by the memory management unit of the server central processing unit when the upgraded virtual machine accesses the physical memory because the virtual memory page of the HVA space of the upgraded virtual machine is not mapped to the physical memory and the extended page table EPT of the upgraded virtual machine is empty.
[0101] In some specific application scenarios, during the process of executing step S112b to map the physical memory pages back to the virtual memory pages of the HVA space of the upgraded virtual machine, the VCPU of the virtual machine before the upgrade can be briefly paused, wherein the time required for all physical memory pages to be mapped back to the virtual memory pages of the HVA space of the upgraded virtual machine is the time when the VCPU of the virtual machine before the upgrade is briefly paused, which generally does not exceed 1 second.
[0102] In some other specific application scenarios, during the process of executing step S112b to map the physical memory page back to the virtual memory page of the HVA space of the upgraded virtual machine, the physical memory page can be temporarily set to a fixed state, and after the physical memory page is mapped back to the virtual memory page of the HVA space of the upgraded virtual machine, its fixed state can be released.
[0103] By briefly pausing the VCPU of the virtual machine before the upgrade or temporarily setting the physical memory page to a fixed state, the VCPU of the virtual machine before the upgrade can be prevented from modifying, adding or deleting the physical memory page, ensuring that the page table or page content of the physical memory page remains consistent before and after the physical memory page is demapped to the virtual memory page of the HVA space of the virtual machine after the upgrade, thereby enabling business programs to continue to run on the virtual machine before the upgrade and the virtual machine after the upgrade.
[0104] The implementation process of implementing step S112 through steps S112a to S112b is simple and easy to implement. However, when the physical memory that needs to be de-mapped to the HVA space of the upgraded virtual machine is large, the VCPU of the virtual machine before the upgrade is placed in a suspended state for a long time, which usually causes the business to be suspended for about 1 second. Therefore, it is only suitable for hot migration of virtual machines with smaller memory. In order to shorten the suspension time of business programs running on the virtual machine caused by de-mapping physical memory pages to virtual memory pages of the HVA space of the upgraded virtual machine, so as to be suitable for hot migration of virtual machines with larger memory, the present disclosure also provides an implementation method for actively triggering a page fault interrupt to execute step S112. In this implementation, if Figure 6 As shown, step S112 specifically includes:
[0105] In step S112d, a third entry address of the HVA space of the upgraded virtual machine is obtained;
[0106] In step S112e, a signaling is sent to the upgraded VMM to put the VCPU of the upgraded virtual machine into a running state;
[0107] In step S112f, the physical memory page is reverse mapped to the target virtual memory page according to the page fault address offset generated by the page fault interrupt, wherein the target virtual memory page is the virtual memory page of the HVA space of the upgraded virtual machine, the sequence number of the page table entry of the physical memory page is equal to the page fault address offset, and the page address offset of the target virtual memory page relative to the third entry address is equal to the page fault address offset.
[0108] Since no actual physical memory is allocated to the upgraded virtual machine, when the upgraded VCPU runs to access the memory, a page fault interrupt will be generated, and a page fault address offset will be generated. The page fault address offset corresponds to the page address offset of the virtual memory page of the HVA space of the upgraded virtual machine.
[0109] In order to further shorten the suspension time of the above-mentioned business programs, the memory page faults of the upgraded virtual machine and the physical memory page switching of the HPA space can be tracked during the operation of the upgraded virtual machine, and in step S112g, it is determined whether the number of the physical memory pages on the virtual memory pages to be demapped to the HVA space of the upgraded virtual machine is less than a predetermined threshold.
[0110] In step S112h, when the number of the physical memory pages on the virtual memory pages to be demapped to the HVA space of the upgraded virtual machine is less than a predetermined threshold, a signal is sent to the upgraded VMM to put the VCPU of the upgraded virtual machine into a paused state.
[0111] In step S112i, the physical memory page to be demapped to the virtual memory page of the HVA space of the upgraded virtual machine is demapped to the virtual memory page of the HVA space of the upgraded virtual machine, wherein the page address offset of the virtual memory page corresponding to each physical memory page relative to the third entry address is equal to the sequence number corresponding to the page table entry of the physical memory page.
[0112] Since the number of physical memory pages that need to be demapped to the virtual memory pages of the HVA space of the upgraded virtual machine at one time is very small, the VCPU pause time of the upgraded virtual machine can be controlled at the microsecond level. The business programs in the virtual machine are unaware of the above pause, so it will not cause business pause or interruption.
[0113] The above article describes in detail the implementation method of determining the order of the page table entries of each of the physical memory pages by the page address offset of the virtual memory page of the HVA space of the virtual machine before the upgrade, and reverse mapping the physical memory page to the virtual memory page of the HVA space of the virtual machine after the upgrade. Of course, the present disclosure is not limited to this, and any sorting method that can reflect the mapping relationship between the HVA space of the virtual machine before the upgrade and the HPA space of the virtual machine before the upgrade belongs to the scope of the present disclosure. The following introduces another implementation method of determining the order of the page table entries of each of the physical memory pages.
[0114] From the above analysis, it can be seen that the MS of the upgraded virtual machine is consistent with the MS of the virtual machine before the upgrade, that is, the pages of the HVA space in the upgraded virtual machine and the pages of the HVA space in the virtual machine before the upgrade that have the same sequence number in the MS respectively correspond to the pages of the GPA space in the upgraded virtual machine and the pages of the GPA space in the virtual machine before the upgrade. Therefore, in the present disclosure, if Figure 7 As shown, step S111 may specifically include:
[0115] In step S111d, the sequence number of the virtual memory page of the HVA space of the virtual machine before the upgrade corresponding to each physical memory page in the page frame map MS of the virtual machine before the upgrade is obtained;
[0116] In step S111e, the size order of the sequence numbers is determined as the order of the page table entries of each physical memory page, and the sequence number is determined as the sequence number of the page table entry corresponding to the physical memory page.
[0117] like Fig.10As shown in the figure, when the numbers 1, 2, and 3 represent sequence numbers, in the HVA space of the virtual machine before the upgrade, the page with sequence number 1 corresponds to the p1 physical memory page of the HPA space, the page with sequence number 2 corresponds to the p2 physical memory page of the HPA space, and the page with sequence number 3 corresponds to the p3 physical memory page of the HPA space. Therefore, the sequence number corresponding to the p1 physical memory page is 1, the sequence number corresponding to the p2 physical memory page is 2, and the sequence number corresponding to the p3 physical memory page is 3.
[0118] As a second aspect of the present disclosure, a method for hot migration of a virtual machine is provided, such as Figure 8 As shown, including:
[0119] In step S210, the above deployment method is executed to map the HPA space of the virtual machine before the upgrade to the HVA space of the virtual machine after the upgrade;
[0120] In step S220, a signaling is sent to the upgraded VMM to put the VCPU of the upgraded virtual machine into a running state, wherein the HPA space of the upgraded virtual machine is the HPA space of the virtual machine before the upgrade.
[0121] Fig.10 The following is a schematic diagram showing the memory mapping of a virtual machine before and after hot migration using the hot migration method provided by the present disclosure. Fig.10 (a) is the memory mapping of the virtual machine before hot migration. Fig.10 (b) shows the memory mapping of the virtual machine after hot migration. It can be seen that before and after hot migration, the virtual machine runs on the same HPA space, and because the content of the physical memory page is not copied, the entire hot migration process is very fast and the business program of the virtual machine is unaware of it.
[0122] The hot migration method of the virtual machine provided by the present disclosure uses the deployment method of the virtual machine provided by the present disclosure to deploy the upgraded virtual machine by establishing a mapping relationship between the HVA space of the upgraded virtual machine and the HPA space of the pre-upgrade virtual machine. During the migration of the virtual machine, only the mapping relationship between the host machine virtual address HVA space and the host machine physical address HPA space is copied (which can be achieved by copying or modifying the page table (Page Table Entry, PTE)), without copying the content of the entire memory space of the virtual machine. Therefore, the pre-upgraded virtual machine can be migrated to the upgraded virtual machine without interrupting the virtual machine business or reserving a large amount of computing resources, thereby realizing the migration from the pre-upgraded virtual machine to the upgraded virtual machine. Moreover, the hot migration method is also applicable to batch hot migration of a large number of virtual machines, which can effectively save time and resource costs.
[0123] As a third aspect of the present disclosure, a method for upgrading a VMM is provided. Fig. 9As shown, the upgrade method includes:
[0124] In step S310, the upgraded VMM is deployed on the host machine;
[0125] In step S320, the VMM before the upgrade and the VMM after the upgrade are started simultaneously on the host machine;
[0126] In step S330, the above-mentioned hot migration method is executed to migrate the pre-upgrade virtual machine running on the pre-upgrade VMM to the upgraded virtual machine running on the upgraded VMM;
[0127] In step S340, the VMM before the upgrade is deleted.
[0128] It should be noted that, in the prior art, when hot migrating a virtual machine, in order to ensure that the virtual machine business is unaware of the migration process, the back-end device information of the virtual machine before the upgrade saved by the VMM before the upgrade must be copied to the upgraded VMM. Therefore, the VMM upgrade method provided in the present invention naturally includes the above-mentioned step of copying the back-end device information of the virtual machine before the upgrade saved by the VMM before the upgrade to the upgraded VMM.
[0129] In addition, since the extended page table EPT of the upgraded virtual machine in the server kernel is initially empty, as the upgraded virtual machine runs, the server kernel will start to establish the EPT of the upgraded virtual machine based on the MS consistent with the virtual machine before the upgrade, thereby forming a high-speed conversion from GPA to HPA.
[0130] The VMM upgrade method provided in the present disclosure uses the hot migration method provided in the present disclosure to implement hot migration of virtual machines running on the VMM, thereby implementing hot upgrade of the VMM, which can effectively save time cost and resource cost.
[0131] At present, commonly used VMM software includes VMware's vSphere, Microsoft Hyper-V, QEMU before upgrading, XEN, KVM, etc. The following takes QEMU-KVM and XEN as examples to further illustrate the virtual machine deployment method, hot migration method and VMM upgrade method provided by the present disclosure.
[0132] Embodiment 1
[0133] This embodiment runs on an x86 server, the CPU uses Intel(R) Xeon(R) CPU E5-2640, and the EPT function is enabled. The operating system runs the 2.6 version of the LINUX kernel, uses QEMU-KVM as the virtualization VMM (Hypervisor), and runs the Window 7 system virtual machine currently used by the business user.
[0134] The user's virtual machine runs normally on the QEMU before the upgrade. The GPA space used by the operating system (windows7) in the virtual machine before the upgrade and the HVA space of the QEMU process before the upgrade establish a mapping relationship through the kvm_memory_slot data structure maintained by the kernel KVM module, and the HVA space is mapped to the physical memory page of the GPA space through the multi-level page table including PTE maintained by the server LINUX kernel.
[0135] On the upgraded QEMU, an upgraded virtual machine is created through KVM, but actual physical memory is not allocated to the upgraded virtual machine, and the VCPU of the upgraded virtual machine is placed in a suspended state.
[0136] The migration execution thread of the QEMU program before the upgrade is connected to the migration thread of the upgraded QEMU program through the Transmission Control Protocol (TCP) to synchronize the backend device information such as the virtual network card and virtio.
[0137] Put the VCPU of the VM before the upgrade into the paused state.
[0138] In the deployment method provided in the first aspect of the present disclosure, step S111a is specifically performed as follows:
[0139] Get the starting address of the HVA space of the virtual machine before the upgrade.
[0140] In the deployment method provided in the first aspect of the present disclosure, step S111b is specifically performed as follows:
[0141] Find the virtual memory space (VMA, Virtual Memory Area) corresponding to the HVA space in the kernel through the starting address of the HVA;
[0142] According to the starting address of HVA and the VMA red-black tree, the memory walk mechanism provided by the kernel is used to traverse the multi-level page tables corresponding to the HVA of the old virtual machine before the upgrade step by step. For example, for the x86_64 Linux kernel in this embodiment, it is necessary to traverse the PGD table, PUD table, PMD table, and finally PTE table in sequence to find the pointers of all HVA memory pages (step S111b ends).
[0143] In the deployment method provided in the first aspect of the present disclosure, step S111c is specifically performed as follows:
[0144] A list is created to store all page pointers corresponding to the HVA space of the virtual machine before the upgrade in order.
[0145] In the deployment method provided in the first aspect of the present disclosure, step S112a is specifically performed as follows:
[0146] Get the HVA space entry address of the upgraded virtual machine.
[0147] In the deployment method provided in the first aspect of the present disclosure, step S112b is specifically performed as follows:
[0148] The kernel's reverse mapping anonymous page technology (page_set_anon_rmap) calculates the offset of the above-stored page pointer relative to the entry address in sequence and maps it to the HVA space of the upgraded virtual machine.
[0149] In the deployment method provided in the first aspect of the present disclosure, step S113 is specifically performed as follows: creating a multi-level page table.
[0150] At this point, the page table is switched from the virtual machine before the upgrade to the virtual machine after the upgrade.
[0151] Confirm that the correspondence between the GPA space and the HVA space serial number in the kvm_memory_slot structure of the upgraded virtual machine is consistent with that of the virtual machine before the upgrade. Normally, since the memory configuration of the upgraded virtual machine is the same as that of the virtual machine before the upgrade, and the initialization process is the same, the mapping relationship in kvm_memory_slot should be consistent. This step is equivalent to step S121 provided in the first aspect of the present disclosure. It can be seen that in this embodiment, step S121 is performed after step S110.
[0152] In this embodiment, the hot migration method provided in the second aspect of the present disclosure may be performed according to the following steps:
[0153] Step S210 is specifically implemented as the steps described above;
[0154] Step S220 is specifically performed as follows: placing the VCPU of the upgraded virtual machine in a running state.
[0155] Since the EPT of the upgraded virtual machine is initially empty, the KVM module enters the Page Fault process by continuously accessing the HVA address space during operation. According to the kvm_memory_slot structure in the KVM module that is consistent with the virtual machine before the upgrade, the mapping information is found and a new EPT table is gradually established.
[0156] After the upgrade, all memory pages of the virtual machine complete the EPT table building on the KVM module and take effect, realizing high-speed conversion from GPA to HPA. After confirming the normal operation of the upgraded virtual machine, delete the QEMU running process before the upgrade.
[0157] Embodiment 2
[0158] The purpose of this embodiment is to minimize the time that the VCPU of the virtual machine is suspended during the page table switching. The running software and hardware environment and the host machine and virtual machine status before the QEMU upgrade are the same as those in Embodiment 1. Only the step of mapping the HPA space of the virtual machine before the upgrade to the HVA space of the virtual machine after the upgrade is different.
[0159] In the deployment method provided in the first aspect of the present disclosure, step S112e is specifically performed as follows:
[0160] The upgraded virtual machine VCPU is placed in a running state. Since no actual physical memory is allocated to the HVA space of the upgraded virtual machine, when a certain HVA address in the HVA space of the upgraded virtual machine is accessed, the kernel will generate a page fault interrupt (no_page_fault).
[0161] In the deployment method provided in the first aspect of the present disclosure, step S112f is specifically performed as follows:
[0162] According to the page fault address offset required by the page fault interrupt, search among all the page pointers corresponding to the HVA space of the virtual machine before the upgrade, find the pointer of the page corresponding to the same offset, and map it to the HVA space of the virtual machine after the upgrade through the kernel's reverse mapping anonymous page technology (page_set_anon_r-map).
[0163] In the deployment method provided in the first aspect of the present disclosure, step S113 is specifically performed as follows:
[0164] Create a multi-level page table corresponding to the page.
[0165] In the deployment method provided in the first aspect of the present disclosure, step S112g is specifically performed as follows:
[0166] Keep checking the memory page faults and page table switching of the virtual machine after the upgrade.
[0167] In the deployment method provided in the first aspect of the present disclosure, step S112h is specifically performed as follows:
[0168] When the number of pages to be switched is less than a certain threshold, the upgraded virtual machine VCPU is paused.
[0169] In the deployment method provided in the first aspect of the present disclosure, step S112i is specifically performed as follows:
[0170] Reverse-map all remaining memory to the upgraded virtual machine HVA space at one time and create a multi-level page table.
[0171] In the process of missing pages and switching memory pages in sequence, the KVM module will gradually build a new EPT table based on the kvm_memory_slot that is consistent with the virtual machine before the upgrade. Finally, all memory pages of the upgraded virtual machine complete the EPT table building on the KVM module and take effect, realizing high-speed conversion from GPA to HPA.
[0172] After confirming that the VM runs normally after the upgrade, delete the QEMU running process before the upgrade.
[0173] Embodiment 3
[0174] This embodiment uses XEN as the virtualization VMM (Hypervisor) software.
[0175] Create an upgraded virtual machine on the upgraded XEN hypervisor, but do not apply for actual HVA memory, and put the upgraded virtual machine VCPU in a suspended state.
[0176] Pause the execution of the VM VCPU before the upgrade.
[0177] In the deployment method provided in the first aspect of the present disclosure, step S111 is specifically performed as follows:
[0178] Obtain the HVA space entry address of the virtual machine before the upgrade and pass it to the server LINUX operating system kernel;
[0179] According to the starting address of HVA and the VMA red-black tree, the memory walk mechanism provided by the kernel is used to traverse the multi-level page table corresponding to the old virtual machine HVA level by level. Taking the Linux kernel of the x86_64 architecture as an example, the PGD table, PUD table, PMD table, and the last PTE table are traversed in turn to find all HVA memory page pointers (step S111 ends).
[0180] In the deployment method provided in the first aspect of the present disclosure, step S112 is specifically performed as follows:
[0181] Through XEN's TestSetPagePinned() method, the memory page corresponding to the traversed HVA is marked and locked;
[0182] Get the HVA space entry address of the upgraded virtual machine. At the same time, traverse the page table and use XEN's PagePinned() method to determine whether the memory page is marked and locked;
[0183] The locked pages are mapped to the HVA space of the upgraded virtual machine through map_pages_to_xen (end of step S112 ).
[0184] In the deployment method provided in the first aspect of the present disclosure, step S113 is specifically executed as follows:
[0185] Create and improve the corresponding multi-level page table as the actual running memory of the upgraded virtual machine. Clear the lock mark through the ClearPagePinned() method.
[0186] In this embodiment, the hot migration method provided in the second aspect of the present disclosure may be performed according to the following steps:
[0187] Step S210 is specifically implemented as the steps described above;
[0188] Step S220 is specifically performed as follows: placing the upgraded virtual machine VCPU in a running state, so as to automatically create a corresponding shadow page table or EPT page table by continuously accessing the HVA address space during operation.
[0189] After confirming that the VM runs normally after the upgrade, delete the VM process on the XEN before the upgrade.
[0190] As a fourth aspect of the present disclosure, a server is provided, the server being used as a host of a virtual machine, the server comprising:
[0191] A storage module, in which an application is stored;
[0192] One or more processors, when the application is executed by the one or more processors, cause the one or more processors to implement one of the following methods:
[0193] The deployment method described above;
[0194] The above-mentioned thermal migration method;
[0195] The upgrade method mentioned above.
[0196] The working principles and beneficial effects of the deployment method, hot migration method or upgrade method provided by the present disclosure have been described in detail above and will not be repeated here.
[0197] As a fifth aspect of the present disclosure, a computer-readable storage medium is provided, on which an executable program is stored, and when the executable program is executed, one of the following methods can be implemented:
[0198] The deployment method described above;
[0199] The above-mentioned thermal migration method;
[0200] The upgrade method mentioned above.
[0201] The working principles and beneficial effects of the deployment method, hot migration method or upgrade method provided by the present disclosure have been described in detail above and will not be repeated here.
[0202] Among them, computer-readable storage media include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer-readable storage media include but are not limited to RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage media, or any other medium that can be used to store the desired information and can be accessed by a computer.
[0203] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.
Claims
1. A method for deploying a virtual machine, comprising: According to the mapping relationship between the host virtual address HVA space of the virtual machine before the upgrade and the host physical address HPA space of the virtual machine before the upgrade, a mapping between the HVA space of the virtual machine after the upgrade and the HPA space of the virtual machine before the upgrade is established to reversely map the HPA space of the virtual machine before the upgrade to the HVA space of the virtual machine after the upgrade; wherein, The upgraded virtual machine is deployed on an upgraded virtual machine monitor VMM, the upgraded VMM and the pre-upgrade VMM are deployed on the host machine at the same time, and the memory configuration of the upgraded virtual machine is the same as the memory configuration of the pre-upgrade virtual machine running on the pre-upgrade VMM.
2. The deployment method according to claim 1, wherein: According to the mapping relationship between the host virtual address HVA space of the virtual machine before the upgrade and the host physical address HPA space of the virtual machine before the upgrade, the step of establishing a mapping between the HVA space of the upgraded virtual machine and the HPA space of the virtual machine before the upgrade includes: Determine the order and sequence number of the page table entries of each physical memory page in the HPA space of the virtual machine before the upgrade; According to the correspondence between the page table entry of each physical memory page and the sequence number, each physical memory page is inversely mapped to a virtual memory page of the HVA space of the corresponding upgraded virtual machine.
3. The deployment method according to claim 2, wherein: The steps of determining the sequence and sequence number of the page table entries of each physical memory page in the HPA space of the virtual machine before the upgrade include: Get the first entry address of the HVA space of the virtual machine before the upgrade; Determine a page address offset of a HVA space virtual memory page of the virtual machine before the upgrade corresponding to each of the physical memory pages relative to the first entry address; The size sequence of the page address offsets is determined as the order of the page table entries of each physical memory page, and the page address offset is determined as the sequence number of the page table entry of the corresponding physical memory page.
4. The deployment method according to claim 3, wherein: According to the correspondence between the page table entries of each physical memory page and the sequence number, the step of inversely mapping each physical memory page to a virtual memory page of the HVA space of the corresponding upgraded virtual machine includes: Obtaining a second entry address of the HVA space of the upgraded virtual machine; In the order of increasing sequence numbers, taking the second entry address as the starting point, each of the physical memory pages is demapped to the virtual memory page of the HVA space of the upgraded virtual machine, wherein the page address offset of the virtual memory page corresponding to each of the physical memory pages relative to the second entry address is equal to the sequence number corresponding to the page table entry of the physical memory page.
5. The deployment method according to claim 4, wherein: Before the step of reversely mapping each of the physical memory pages to a virtual memory page of the HVA space of the upgraded virtual machine in the order of increasing sequence numbers and taking the second entry address as a starting point, the deployment method further includes: A signaling is sent to the upgraded VMM to put the virtual central processing unit VCPU of the upgraded virtual machine into a pause state.
6. The deployment method according to claim 3, wherein: According to the correspondence between the page table entries of each physical memory page and the sequence number, the step of inversely mapping each physical memory page to a virtual memory page of the HVA space of the corresponding upgraded virtual machine includes: Obtaining a third entry address of the HVA space of the upgraded virtual machine; Sending a signal to the upgraded VMM to put the VCPU of the upgraded virtual machine into a running state; According to the page fault address offset generated by the page fault interrupt, the physical memory page is reverse mapped to the target virtual memory page, wherein the target virtual memory page is the virtual memory page of the HVA space of the upgraded virtual machine, the sequence number of the page table entry of the physical memory page is equal to the page fault address offset, and the page address offset of the target virtual memory page relative to the third entry address is equal to the page fault address offset.
7. The deployment method according to claim 6, wherein: After the step of reverse mapping the physical memory page to the target virtual memory page according to the page fault address offset generated by the page fault interrupt, the deployment method further includes: Determine whether the number of the physical memory pages on the virtual memory pages to be demapped to the HVA space of the upgraded virtual machine is less than a predetermined threshold; In response to the number of the physical memory pages on the virtual memory pages to be demapped to the HVA space of the upgraded virtual machine being less than the predetermined threshold, sending a signal to the upgraded VMM to put the VCPU of the upgraded virtual machine into a paused state; The physical memory page to be demapped to the virtual memory page of the HVA space of the upgraded virtual machine is demapped to the virtual memory page of the HVA space of the upgraded virtual machine, wherein the page address offset of the virtual memory page corresponding to each of the physical memory pages relative to the third entry address is equal to the sequence number corresponding to the page table entry of the physical memory page.
8. The deployment method according to claim 2, wherein: The step of determining the order of the page table entries of each of the physical memory pages comprises: Obtaining the sequence number of the virtual memory page of the HVA space of the virtual machine before the upgrade corresponding to each physical memory page in the page frame mapping map MS of the virtual machine before the upgrade; The size order of the sequence numbers is determined as the order of the page table entries of each of the physical memory pages, and the sequence numbers are determined as the sequence numbers of the page table entries corresponding to the physical memory pages.
9. The deployment method according to any one of claims 2 to 8, wherein: After the step of inversely mapping the physical memory page to the virtual memory page of the HVA space of the corresponding upgraded virtual machine according to the correspondence between the page table entry of each physical memory page and the sequence number, the deployment method further includes: A multi-level page table is created for the physical memory page on the virtual memory page that is inversely mapped to the HVA space of the upgraded virtual machine.
10. The deployment method according to any one of claims 1 to 8, wherein: Before the step of establishing a mapping between the HVA space of the upgraded virtual machine and the HPA space of the virtual machine before the upgrade according to the mapping relationship between the host virtual address HVA space of the virtual machine before the upgrade and the host physical address HPA space of the virtual machine before the upgrade, the deployment method further includes: Determine whether the MS of the virtual machine after the upgrade is consistent with the MS of the virtual machine before the upgrade; If they are inconsistent, the MS of the virtual machine before the upgrade is copied to the virtual machine after the upgrade.
11. A method for hot migration of a virtual machine, comprising: Execute the deployment method according to any one of claims 1 to 10 to map the HPA space of the virtual machine before the upgrade to the HVA space of the virtual machine after the upgrade; A signaling is sent to the upgraded VMM to put the VCPU of the upgraded virtual machine into a running state, wherein the HPA space of the upgraded virtual machine is the HPA space of the virtual machine before the upgrade.
12. A method for upgrading a VMM, comprising: Deploy the upgraded VMM on the host machine; Start the VMM before and after the upgrade on the host machine at the same time; Executing the hot migration method of claim 11 to migrate the pre-upgrade virtual machine running on the pre-upgraded VMM to the post-upgraded virtual machine running on the upgraded VMM; Delete the VMM before the upgrade.
13. A server, the server being used as a host of a virtual machine, the server comprising: A storage module, in which an application is stored; One or more processors, when the application is executed by the one or more processors, cause the one or more processors to implement one of the following methods: The deployment method according to any one of claims 1 to 10; The thermal migration method according to claim 11; The upgrading method according to claim 12.
14. A computer-readable storage medium having an executable program stored thereon, wherein the executable program can implement one of the following methods when executed: The deployment method according to any one of claims 1 to 10; The thermal migration method according to claim 11; The upgrading method according to claim 12.
Citation Information
Patent Citations
Virtual machine thermal migration method, related device and cluster computing system
CN103942087A