IP Library Granted Patent US 12,293,207
Granted Patent B2
US 12,293,207 · App. 17/591,459 · Granted May 6, 2025

Virtual machine hot migration method, apparatus, electronic device, and computer storage medium

Inventor: Chao Zhang (Hangzhou, CN)
Assignee: Alibaba Group Holding Limited
G06F9/45558G06F9/5016G06F12/10G06F2009/4557G06F2009/45583G06F2212/657
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,293,207
App. No.
17/591,459
Granted
May 6, 2025
Kind
B2
Abstract

Virtual machine hot migration method, device, electronic device, and computer storage medium are provided. The method includes: switching a first page table used for indicating a mapping relationship between a memory address of a virtual guest and a physical address of a host machine in a first physical machine to a second page table according to a switching trigger instruction; and performing a hot migration of the virtual guest from the first physical machine to a second physical machine according to the second page table, wherein a size of a physical memory page indicated by a last-level page table of the second page table satisfies a defined size, and a size of a physical memory page indicated by a last-level page table of the first page table is greater than the defined size. The embodiments of the present disclosure improve the performance of the virtual guest and its hot migration.

Claims (61)

1. A method comprising:

switching a first page table used for indicating a mapping relationship between a memory address of a virtual guest and a physical address of a host machine in a first physical machine to a second page table according to a switching trigger instruction;

performing a hot migration of the virtual guest from the first physical machine to a second physical machine according to the second page table, wherein a size of a physical memory page indicated by a last-level page table of the second page table satisfies a defined size, and a size of a physical memory page indicated by a last-level page table of the first page table is greater than the defined size;

determining whether the hot migration is successful;

releasing the first page table and the second page table in the first physical machine if the hot migration is successful; and

switching the second page table back to the first page table, and releasing the second page table in the first physical machine If the hot migration fails.

2. The method according to claim 1 , wherein switching the first page table used for indicating the mapping relationship between the memory address of the virtual guest and the physical address of the host machine in the first physical machine to the second page table according to the switching trigger instruction comprises:

switching a currently used active page table of a virtual machine from the first page table to the second page table according to the switching trigger instruction; and

sending an instruction signal for instructing to perform page table reloading to all virtual guests in the first physical machine to instruct each virtual guest to switch a currently used page table node in the first page table to a corresponding page table node in the second page table.

3. The method according to claim 2 , wherein switching the currently used active page table of the virtual machine from the first page table to the second page table according to the switching trigger instruction comprises:

creating the second page table according to the first page table after receiving the switching trigger instruction; and

after the second page table is successfully created, switching the currently used active page table of the virtual machine from the first page table to the second page table.

4. The method according to claim 3 , wherein switching the currently used active page table of the virtual machine from the first page table to the second page table comprises:

determining a variable value corresponding to a first variable pointing to a root page table of the currently used active page table of the virtual machine, and determining the currently used active page table of the virtual machine as the first page table according to the variable value; and

resetting the first variable to a set value, deactivating the first page table according to the set value, and activating the second page table as the currently used active page table of the virtual machine.

5. The method according to claim 4 , wherein the first variable is a memory management unit node MMU_NODE variable, and the method further comprises:

locking a memory management unit (MMU) corresponding to the first variable before resetting the first variable to the set value; and

unlocking the MMU after activating the second page table as the active page table of the virtual machine.

6. The method according to claim 4 , wherein sending the instruction signal for instructing to perform the page table reloading to all the virtual guests in the first physical machine to instruct each virtual guest to switch the currently used page table node in the first page table to the corresponding page table node in the second page table, comprises:

sending an instruction signal for instructing to perform page table reloading to virtual processors corresponding to all the virtual guests in the first physical machine to instruct each virtual processor to switch a currently used page table node in the first page table to a corresponding page table node in the second page table.

7. The method according to claim 6 , wherein each virtual processor switches the currently used page table node in the first page table to the corresponding page table node in the second page table by:

each virtual processor checking whether a variable value of a second variable pointing to the root page table currently used by each virtual processor is consistent with the variable value of the first variable according to the instruction signal; and

using the variable value of the first variable to replace the variable value of the second variable if being inconsistent.

8. The method according to claim 3 , wherein creating the second page table according to the first page table comprises:

traversing a memory reverse mapping table corresponding to a virtual memory slot pointed to by the first page table, and creating the second page table according to a traversal result.

9. The method according to claim 8 , wherein creating the second page table according to the traversal result comprises:

copying and generating a last-level page table entry in the second page table according to each last-level page table item that is traversed, and using a set identifier to mark the generated last-level page table entry;

determining whether a size of a physical memory page pointed to by the generated last-level page table entry is greater than a set size; and

if greater, deleting the set identifier corresponding to the last-level page table entry, and create at least one-level sub-page table entry according to the size of the physical memory page pointed to by the last-level page table entry, wherein a size of a physical memory page pointed to by a last-level page table entry in the at least one-level sub-page table entry is the set size.

10. The method according to claim 9 , further comprising:

determining whether an upper-level page table corresponding to the generated last-level page table entry exists; and

if not exist, generating a corresponding upper-level page table for the last-level page table entry, and save thereof into the second page table.

11. The method according to claim 8 , wherein:

when a physical memory page of the host machine is mapped to multiple virtual guest memory pages, the memory reverse mapping table stores a linked list of corresponding multiple last-level page table entries that point to the physical memory page.

12. The method according to claim 11 , wherein traversing the memory reverse mapping table corresponding to the virtual memory slot pointed to by the first page table, and creating the second page table according to the traversal result comprise:

obtaining the memory reverse mapping table corresponding to the virtual memory slot pointed to by the first page table;

traversing entries of the memory reverse mapping table one by one, and determining whether the linked list is stored in a current table entry;

if the linked list is stored, traversing each last-level page table entry in the linked list, and copying information of multiple last-level page table entries corresponding to the linked list and content of each last-level page table entry that is traversed to the second page table; and

if the linked list is not stored, copying content of the current table entry to the second page table.

13. The method according to claim 2 , further comprising:

first releasing the second page table if a hot migration abnormality occurs during a process of the hot migration, and then releasing the first page table after the currently used active page table of the virtual machine is switched back to the first page table.

14. An apparatus comprising:

one or more processors;

memory;

a switching module stored in the memory and executable by the one or more processors to switch a first page table used for indicating a mapping relationship between a memory address of a virtual guest and a physical address of a host machine in a first physical machine to a second page table according to a switching trigger instruction, wherein the switching module comprises:

an active page table switching sub-module configured to switch a currently used active page table of a virtual machine from the first page table to the second page table according to the switching trigger instruction; and

an instruction sub-module configured to send an instruction signal for instructing to perform page table reloading to all virtual guests in the first physical machine, to instruct each virtual guest to switch a currently used page table node in the first page table to a corresponding page table node in the second page table; and

a hot migration module configured to hot migrate the virtual guest from the first physical machine to a second physical machine according to the second page table, wherein a size of a physical memory page indicated by a last-level page table of the second page table satisfies a defined size, and a size of a physical memory page indicated by a last-level page table of the first page table is greater than the defined size.

15. The apparatus according to claim 14 , wherein the active page table switching sub-module comprises:

a creation unit configured to create the second page table according to the first page table after receiving the switching trigger instruction; and

a post-creation switching unit configured to switch the currently used active page table of the virtual machine from the first page table to the second page table after the second page table is successfully created.

16. The apparatus according to claim 15 , wherein the post-creation switching unit is configured to determine a variable value corresponding to a first variable pointing to a root page table of the currently used active page table of the virtual machine after the second page table is successfully created, and determine that the currently used active page table of the virtual machine is the first page table according to the variable value; and reset the first variable to a set value, deactivate the first page table according to the set value, and activate the second page table as the currently used active page table of the virtual machine.

17. The apparatus according to claim 16 , wherein:

the first variable is a memory management unit node MMU_NODE variable; and

the post-creation switching unit is further configured to lock a memory management unit MMU corresponding to the first variable before resetting the value of the first variable to the set value; and unlock the MMU after activating the second page table as the currently used active page table of the virtual machine.

18. One or more computer storage media storing executable instructions that, when executed by one or more processors, cause the one or more processors to perform acts comprising:

switching a first page table used for indicating a mapping relationship between a memory address of a virtual guest and a physical address of a host machine in a first physical machine to a second page table according to a switching trigger instruction;

performing a hot migration of the virtual guest from the first physical machine to a second physical machine according to the second page table, wherein a size of a physical memory page indicated by a last-level page table of the second page table satisfies a defined size, and a size of a physical memory page indicated by a last-level page table of the first page table is greater than the defined size;

determining whether the hot migration is successful;

releasing the first page table and the second page table in the first physical machine if the hot migration is successful; and

switching the second page table back to the first page table, and releasing the second page table in the first physical machine If the hot migration fails.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 21, 2026
From: ALIBABA GROUP HOLDING LIMITED
To: CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PRIVATE LIMITED
Reel/Frame 075478/0225 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 6, 2022
From: ZHANG, CHAO
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 060413/0074 →
Priority Claims (1)
CN 201910715884.1 · Aug 5, 2019 · national
Continuity (2)
Continuation PCTCN2020105032 · Jul 28, 2020
Related Publication 20220156106A1 · May 19, 2022
References Cited (11)
US 9330013B2 · Li et al. · 2016 [cited by applicant]
US 9672075B2 · Wang · 2017 [cited by applicant]
US 10884645B2 · Chen et al. · 2021 [cited by applicant]
US 10990431B2 · Liu et al. · 2021 [cited by applicant]
US 20090007106A1 · Araujo, Jr. et al. · 2009 [cited by applicant]
US 20110066597A1 · Mashtizadeh et al. · 2011 [cited by applicant]
US 20110302577A1 · Reuther et al. · 2011 [cited by applicant]
US 20110320556A1 · Reuther · 2011 [cited by applicant]
US 20150143372A1 · Bercovici et al. · 2015 [cited by applicant]
US 20150378766A1 · Beveridge et al. · 2015 [cited by applicant]
US 20210011856A1 · Xia et al. · 2021 [cited by applicant]