A method and device for processing virtual machine memory failure, and an electronic device
Patent Information
- Application Number
- CN202311485021.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-08
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2043-11-08
AI Technical Summary
这些技术依赖于虚拟机分配Huge Page(巨型页)作为其MemoryBackend(内存后端),但虚拟机使用Huge Page往往扩大了内存故障的影响范围
[0015] In this embodiment, memory fault information sent by the host is received. This information carries the host virtual address (HVA) of the faulty page, which is a physical memory page within a massive physical memory page used by the virtual machine that has failed. The client physical address (GPA) mapped to the host virtual address (HVA) is determined. The client physical address (GPA) is then passed to the virtual machine to instruct it to isolate the faulty page based on the GPA. By using the client physical address (GPA) of the faulty page, the virtual machine accurately isolates the faulty physical memory page, reducing the impact on normal pages within the massive physical memory page. Isolating the faulty page prevents the virtual machine from crashing due to reading the faulty page, thus enhancing the reliability, availability, and fault recovery capabilities of the virtual machine.
Smart Images

Figure CN117472632B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal devices, and more particularly to a method and apparatus for handling virtual machine memory faults, and an electronic device. Background Technology
[0002] With the explosive growth of information, higher demands are placed on the data processing capabilities of cloud platforms, leading to the widespread use of technologies such as DPDK (Data Plane Development Kit) and SPDK (Storage Performance Development Kit) in virtualization scenarios to improve performance. These technologies rely on virtual machines allocating Huge Pages as their Memory Backend, but the use of Huge Pages by virtual machines often amplifies the impact of memory failures.
[0003] How to efficiently handle virtual machine memory failures is the technical problem that this application aims to solve. Summary of the Invention
[0004] The purpose of this application is to provide a method, apparatus, and electronic device for handling virtual machine memory faults, so as to efficiently handle virtual machine memory faults.
[0005] Firstly, a method for handling virtual machine memory failures is provided, applicable to virtual operating system emulators, including:
[0006] Receive memory fault information sent by the host, the memory fault information carrying the host virtual address (HVA) of the faulty page, the faulty page being the physical memory page that has failed in the physical memory giant page used by the virtual machine;
[0007] Determine the client physical address (GPA) mapped to the host virtual address (HVA);
[0008] The client physical address (GPA) is passed to the virtual machine to instruct the virtual machine to isolate the faulty page based on the client physical address (GPA).
[0009] Secondly, a virtual machine memory fault handling device is provided, applied to a virtual operating system simulator, including:
[0010] The receiving module receives memory fault information sent by the host. The memory fault information carries the host virtual address (HVA) of the faulty page, and the faulty page is the physical memory page that has failed in the physical memory giant page used by the virtual machine.
[0011] The module determines the client physical address (GPA) mapped to the host virtual address (HVA).
[0012] The input module passes the client physical address GPA to the virtual machine to instruct the virtual machine to isolate the faulty page based on the client physical address GPA.
[0013] Thirdly, an electronic device is provided, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method of the first aspect.
[0014] Fourthly, a computer-readable storage medium is provided on which a computer program is stored, which, when executed by a processor, implements the steps of the method of the first aspect.
[0015] In this embodiment, memory fault information sent by the host is received. This information carries the host virtual address (HVA) of the faulty page, which is a physical memory page within a massive physical memory page used by the virtual machine that has failed. The client physical address (GPA) mapped to the host virtual address (HVA) is determined. The client physical address (GPA) is then passed to the virtual machine to instruct it to isolate the faulty page based on the GPA. By using the client physical address (GPA) of the faulty page, the virtual machine accurately isolates the faulty physical memory page, reducing the impact on normal pages within the massive physical memory page. Isolating the faulty page prevents the virtual machine from crashing due to reading the faulty page, thus enhancing the reliability, availability, and fault recovery capabilities of the virtual machine. Attached Figure Description
[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0017] Figure 1a This is a schematic diagram of the handling process for virtual machine physical memory page faults;
[0018] Figure 1b Based on Figure 1a A schematic diagram illustrating the interaction process for handling virtual machine physical memory page faults;
[0019] Figure 2a This is one of the flowcharts illustrating a method for handling virtual machine memory faults according to an embodiment of this application;
[0020] Figure 2b Based on Figure 2a A flowchart illustrating the process of handling virtual machine memory faults according to an embodiment of this application;
[0021] Figure 3This is a second flowchart illustrating a method for handling virtual machine memory faults according to an embodiment of this application;
[0022] Figure 4a This is a third flowchart illustrating a method for handling virtual machine memory faults according to an embodiment of this application;
[0023] Figure 4b Based on Figure 4a A schematic diagram of the thermal migration process;
[0024] Figure 5a This is the fourth flowchart illustrating a method for handling virtual machine memory faults according to an embodiment of this application;
[0025] Figure 5b Based on Figure 5a A schematic diagram of the fault paging release process;
[0026] Figure 6 This is the fifth flowchart illustrating a method for handling virtual machine memory faults according to an embodiment of this application;
[0027] Figure 7 This is a sixth flowchart illustrating a method for handling virtual machine memory faults according to an embodiment of this application;
[0028] Figure 8 This is the seventh flowchart illustrating a method for handling virtual machine memory faults according to an embodiment of this application;
[0029] Figure 9 This is a schematic diagram of the structure of a virtual machine memory fault handling device according to an embodiment of this application. Detailed Implementation
[0030] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. The drawing numbers in this application are only used to distinguish the various steps in the solution and are not used to limit the execution order of the various steps. The specific execution order is subject to the description in the specification.
[0031] This solution can be applied to scenarios where virtual machines use Huge Pages as memory backends. When physical memory failure occurs, virtual machines often crash due to accessing faulty memory or other reasons. The method proposed in this solution will greatly reduce the probability of virtual machine crashes and enhance the virtual machine's Reliability, Serviceability, and Availability (RAS) characteristics.
[0032] The aforementioned RAS specifically refers to Reliability, Availability, and Serviceability. Reliability refers to the system's ability to avoid unexpected crashes. A reliable system can self-correct minor errors and isolate uncorrectable errors, ensuring the normal operation of the rest of the system. Availability refers to the system's ability to operate continuously for extended periods without downtime, ensuring the overall system continues to function normally even with minor issues. Serviceability refers to the system's ability to provide convenient diagnostic functions.
[0033] This solution enhances the RAS (Reliability, Assurance, and Security) features of virtual machines, enabling them to run reliably for as long as possible without going offline, and possesses a sufficiently robust fault tolerance mechanism.
[0034] In practical applications, when a physical memory page used by a virtual machine experiences a hardware failure, if an UNMAP operation is performed on the virtual machine page on the client host, and the error information of the hardware failure and the starting address of the Huge Page are injected into the virtual machine through the QEMU emulator, physical memory pages with a 4KB granularity can be isolated within the virtual machine. However, this method cannot correctly handle SRAR (Software Recoverable Action Required) type memory failures. See [link to relevant documentation]. Figure 1a The process is shown below.
[0035] During the machine check `do_machine_check`, the simulated `MCG_STATUS` global status register value is first obtained via `mce_gather_info`, where `mce` stands for Machine Check Error, `MCG` stands for Global MCA Register, and `MCA` stands for Machine Check Architecture. Then, it determines whether the fault is in user mode. If not, it occurs in kernel space and is handled by the kernel. If it is, the `MCG_STATUS_RIPV` bit in `mcgstatus` is further checked. If the bit is set, `kill_me_maybe` is used, ultimately calling `memory_failure` to handle the memory fault. If the bit is not set, `kill_me_now` sends a `SIGBUS` signal to the process, thereby releasing the error page to the buddy system.
[0036] The buddy system contains memory pages numbered 0, 1, 2...MAX_ORDER. For SRAR errors, the faulty page is not isolated, resulting in the faulty page being repeatedly allocated and used. If the error page is reused by the user, it will cause the task to terminate (task is killed). If the error page is reused by the kernel, it will cause the kernel to crash.
[0037] In a Huge Page scenario, the host kernel unmaps the entire Huge Page. However, the address injected into the virtual machine is the Guest Physical Address (GPA) corresponding to the Head Page. This causes the virtual machine to incorrectly isolate non-faulty pages. Furthermore, because the host has already unmapped the entire Huge Page, accessing the address range corresponding to the Huge Page within the virtual machine will still cause a crash. The crash process is as follows: Figure 1b As shown.
[0038] First, after a UCE failure (uce happened), the host performs UNMAP (unmap hugepage) on the failed hugepage and dissolves it. This is then sent via SIGBUS to the QEMU emulator, which injects the hugepage into the guest virtual machine. Next, the virtual machine performs a machine check (do_machine_Check), performing UNMAP on the header page of the hugepage and isolating it.
[0039] When a guest virtual machine accesses a huge page in the kernel via an address, it triggers a VM-EXIT interrupt, where VM refers to the virtual machine. KVM (Kernel-based Virtual Machine) executes `kvm_tdp_page_fault`, which handles the abnormal physical memory `handle_abnormal_pfn` through the page fault handling function, where `pfn` is the page frame number. Ultimately, due to the mapped page fault, the `kvm_handle_bad_page` function calls `kvm_send_hwpoison_signal` to send a SIGBUS signal to QEMU.
[0040] Then, the QEMU emulator injects the MCE into the guest virtual machine, and the machine check triggers a lock do_machine_check:panic.
[0041] The above processing method has at least the following drawbacks:
[0042] ①Free hugepages often cannot be broken down, resulting in hugepages containing error pages being allocated and used;
[0043] ②QEMU injection of SRAR error, the error page cannot be isolated inside the virtual machine;
[0044] ③ A memory error occurring when the virtual machine uses hugepages will cause the virtual machine to crash;
[0045] ④ Memory failure handling does not support 1GB big pages;
[0046] ⑤ Virtual machines injected with SRAR or SRAO (Software Recoverable Action Optional) cannot be hot migrated.
[0047] To address the problems existing in the prior art, embodiments of this application provide a method for handling virtual machine memory faults, applied to a virtual operating system emulator, such as QEMU. Figure 2a As shown, it includes:
[0048] S21: Receive memory fault information sent by the host, the memory fault information carrying the host virtual address HVA of the faulty page, the faulty page being the physical memory page that has failed in the physical memory giant page used by the virtual machine.
[0049] In this step, QEMU receives memory fault information sent by the host, which may be generated and sent by the host upon detecting a UCE. For example, see... Figure 2b When a UCE (Undefined Error Occurred) occurs on the host machine, UNMAP can be skipped for the faulty huge page, so it's not necessary to release it. Instead, a memory fault message is sent to QEMU, specifically via `send SIGBUS`. This message carries the Host Virtual Address (HVA) of the faulty page, representing the physical memory page that failed within the physical memory huge page used by the virtual machine.
[0050] S22: Determine the client physical address GPA mapped to the host virtual address HVA.
[0051] QEMU determines the client physical address of the HVA mapping for the failed physical memory page based on the mapping relationship.
[0052] S23: Pass the client physical address GPA to the virtual machine to instruct the virtual machine to isolate the faulty page according to the client physical address GPA.
[0053] In this step, QEMU accurately transmits the GPA of the faulty physical memory page to the virtual machine, for example, by injecting it into the virtual machine using mceinject, to instruct the virtual machine to isolate the faulty page. Specifically, assuming the page granularity is 4k, then machine checks (do_machine_check) can be used to perform UNMAP and isolate faulty pages with a 4k granularity, thereby achieving precise isolation of faulty pages and reducing the negative impact of faulty pages on the virtual machine.
[0054] This solution eliminates the need for the host to perform UNMAP (Unmap Huge Page) operations when a memory failure occurs in a virtual machine using Huge Pages. Instead, it accurately injects the 4k-granularity page address of the faulty page from the Huge Page into the virtual machine, instructing the virtual machine to accurately isolate the corresponding 4k faulty page, thus achieving precise fault isolation.
[0055] Furthermore, since the host does not need to perform UNMAP (Unified Mapping of Huge Pages) operations, this solution can also support 1GB large pages. Additionally, this solution can correct previously incorrect SRAR (Site Replication Register) information via QEMU, enabling the virtual machine to correctly isolate faulty pages and prevent them from being reallocated after an error occurs. This ensures successful memory giant page splitting and fault isolation, and the isolated fault will not affect the system until the virtual machine is shut down.
[0056] Based on the solutions described in the above embodiments, optionally, such as Figure 3 As shown, after step S23 above, that is, after the client physical address GPA is passed to the virtual machine, the process further includes:
[0057] S31: In the page table of the physical memory giant page to which the faulty page belongs, set the faulty page to be non-cacheable.
[0058] In practical applications, when accessing memory near a faulty page, the read-ahead (pre-caching) function may access the faulty page, leading to a crash. This solution sets the faulty page as non-cached in the page table of the giant page in physical memory to avoid accessing the faulty page and causing a crash, further strengthening the protection against accessing faulty pages.
[0059] Specifically, this solution disables faulty pages by setting the PCD (Page Cache Disabled) bit. For example, setting this bit to 1 indicates that the content of that page cannot be cached.
[0060] Based on the solutions described in the above embodiments, optionally, such as Figure 4a As shown, after step S31 above, that is, after setting the physical memory giant page to which the faulty page belongs to be non-cached in the page table of the physical memory giant page to which the faulty page belongs, the method further includes:
[0061] S41: Receive the hot migration command for the virtual machine.
[0062] S42: Using the virtual machine as the source virtual machine, perform hot migration to the destination host based on the source virtual machine memory other than the faulty page.
[0063] This solution supports live migration of virtual machines in scenarios with massive page memory failures. The solution records the failed pages in QEMU and disables the cacheable capability of the failed pages, so that the CPU (Central Processing Unit) will not pre-read the failed pages.
[0064] like Figure 4b As shown, the virtual machine performs a hot migration from the source (SRC) to the destination (dst). At the source, the page-table entry of the memory-based massive paging mechanism PUD (Page Upper Directory) or PMD (Page Middle Directory) is as follows: Figure 4bAs shown, the Host Physical Address (HPA) of the hugepage contains the fault page. The fault page's PCD is set to non-cacheable in the page table of the hugepage in physical memory. This fault page is represented in the source dirty page bitmap (SRC) as shown below. Figure 4b As shown.
[0065] During virtual machine hot migration, because the QEMU client records the faulty pages, the faulty pages can be skipped during virtual machine migration. The faulty page is not processed in the GPA corresponding to HPA (unpre-sent), avoiding access to the faulty page and causing the virtual machine to crash, thus effectively enhancing the virtual machine RAS capability.
[0066] Based on the scheme described in the above embodiments, optionally, the fault type of the fault paging is an uncorrectable error type. This uncorrectable error type refers to an error that cannot be corrected by itself; for example, the specific error type is SRAR.
[0067] Among them, such as Figure 5a As shown, after step S42 above, that is, after using the virtual machine as the source virtual machine and performing hot migration to the destination host based on the source virtual machine memory other than the faulty page, the process further includes:
[0068] S51: After completing the hot migration, instruct the virtual machine to perform recovery on the isolated physical memory pages.
[0069] In scenarios involving live migration of virtual machines, assuming the source virtual machine is migrated to the destination host, after the migration is complete, the memory corresponding to the virtual machine on the destination host is no longer a faulty page. The virtual machine can recover the faulty page recorded internally, allowing it to come back online. For example... Figure 5b As shown, the page table of the original faulty page inside the virtual machine can be restored, and the original faulty page can be released back to the buddy system, so that the virtual machine can reassign and use the originally recorded faulty page.
[0070] Based on the solutions described in the above embodiments, optionally, such as Figure 6 As shown, the method further includes:
[0071] S61: Instruct the host to mark the physical memory jumbo page to which the faulty page belongs as faulty.
[0072] In this scheme, when a virtual machine's hugepage physical page fails, the host does not need to execute the unmap hugepage process. Instead, it can tag the failed hugepage with hwpoison (HardWarepoison) and record the specific location of the failed page. For example, assuming the paging is 4k granularity, the location of the failed 4k page will be recorded.
[0073] Subsequently, the host passes the virtual address HVA corresponding to the 4k-granularity fault page in the host qemu to qemu. qemu records the HVA and GPA information corresponding to the fault page, and injects the corresponding virtual machine physical address GPA into the virtual machine via mce inject, instructing the virtual machine to perform UNMAP unmapping operation and isolate the fault page through standard memory fault handling logic.
[0074] S62: After the virtual machine releases the physical memory giant page to which the faulty page belongs, the host is instructed to isolate the faulty page in the marked faulty physical memory giant page and release the physical memory pages other than the faulty page.
[0075] When shutting down a virtual machine and releasing huge pages, huge pages tagged with "hwpoison" can be broken up to release normal 4k-granular physical memory pages back to the buddy system and isolate faulty 4k-granular physical memory pages.
[0076] Based on the solutions described in the above embodiments, optionally, such as Figure 7 As shown, in step S23 above, the client physical address GPA is passed to the virtual machine to instruct the virtual machine to isolate the faulty page according to the client physical address GPA, including:
[0077] S71: Pass the client physical address GPA to the virtual machine to instruct the virtual machine to unmap and isolate the faulty page according to the memory fault handling logic.
[0078] In this solution, the virtual machine is instructed to handle faulty pages according to standard memory fault handling logic, specifically including unmapping memory (UNMAP) and isolating them (ISOLATE), thereby performing effective handling of faulty pages and reducing the negative impact of faulty pages on the virtual machine.
[0079] Based on the solutions described in the above embodiments, optionally, such as Figure 8 As shown, in step S23 above, the client physical address GPA is passed to the virtual machine to instruct the virtual machine to isolate the faulty page according to the client physical address GPA, including:
[0080] S81: The client physical address GPA is passed to the virtual machine via the machine check injection (MCE-inject) instruction to instruct the virtual machine to isolate the faulty page based on the client physical address GPA.
[0081] In this solution, the MCE-inject instruction is used to perform injection, thereby selectively injecting fault pages into the virtual machine to perform fault handling.
[0082] The solution provided in this application can effectively handle SRAR-type faults. When a memory fault occurs in a gigapage, it can effectively prevent the virtual machine from crashing. Furthermore, this solution can effectively handle memory faults in gigapages and is widely applicable to various scenarios. In addition, it supports hot migration of virtual machines with memory faults, ensuring overall stability during the hot migration process. After hot migration, the abnormal memory paging can be brought back online.
[0083] To address the problems existing in the prior art, this application also provides a virtual machine memory fault handling device 90, such as... Figure 9 As shown, it is applied to virtual operating system emulators and includes:
[0084] The receiving module 91 receives memory fault information sent by the host. The memory fault information carries the host virtual address (HVA) of the faulty page. The faulty page is a physical memory page that has failed in the giant page of physical memory used by the virtual machine.
[0085] Module 92 determines the client physical address (GPA) mapped to the host virtual address (HVA).
[0086] The input module 93 inputs the client physical address GPA to the virtual machine, instructing the virtual machine to isolate the faulty page according to the client physical address GPA.
[0087] The apparatus provided in this application receives memory fault information sent by the host. The memory fault information carries the host virtual address (HVA) of the faulty page, which is a physical memory page that has failed within a physical memory giant page used by the virtual machine. The apparatus determines the client physical address (GPA) mapped to the host virtual address (HVA). The client physical address (GPA) is then passed to the virtual machine to instruct it to isolate the faulty page based on the client physical address (GPA). Based on the client physical address (GPA) of the faulty page, the virtual machine accurately isolates the faulty physical memory page, reducing the impact on normal pages within the physical memory giant page. By isolating the faulty page, the virtual machine can avoid crashes caused by reading the faulty page, thus enhancing its reliability, availability, and fault recovery capabilities.
[0088] In this application, the modules in the apparatus provided can also implement the method steps provided in the method embodiments. Alternatively, the apparatus provided in this application may include other modules besides those described above to implement the method steps provided in the method embodiments. Furthermore, the apparatus provided in this application can achieve the technical effects achievable by the method embodiments.
[0089] Preferably, this application embodiment also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described embodiment of a virtual machine memory fault handling method and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0090] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the above-described embodiment of a virtual machine memory fault handling method, achieving the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0091] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0092] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.
[0093] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.
[0094] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.
[0095] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0096] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0097] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0098] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0099] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0100] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for handling virtual machine memory faults, characterized in that, Applications to virtual operating system emulators include: Receive memory fault information sent by the host, the memory fault information carrying the host virtual address (HVA) of the faulty page, the faulty page being the physical memory page that has failed in the physical memory giant page used by the virtual machine; Determine the client physical address (GPA) mapped to the host virtual address (HVA); The client physical address (GPA) is passed to the virtual machine to instruct the virtual machine to isolate the faulty page based on the client physical address (GPA).
2. The method as described in claim 1, characterized in that, After passing the client physical address GPA to the virtual machine, the process also includes: In the page table of the physical memory giant page to which the faulty page belongs, the faulty page is set to be uncacheable.
3. The method as described in claim 2, characterized in that, After setting the physical memory giant page to which the faulty page belongs to be non-cacheable, the following is also included: Receive the hot migration command for the virtual machine; Using the virtual machine as the source virtual machine, a hot migration is performed to the destination host based on the source virtual machine memory other than the faulty page.
4. The method as described in claim 3, characterized in that, The fault type of the fault pagination is an uncorrectable error type; The process includes, after using the virtual machine as the source virtual machine and performing a hot migration to the destination host based on the source virtual machine memory other than the faulty page, the following steps are also included: After the hot migration is completed, the virtual machine is instructed to perform recovery on the isolated physical memory pages.
5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: The host is instructed to mark the physical memory giant page to which the faulty page belongs as faulty; After the virtual machine releases the physical memory giant page to which the faulty page belongs, it instructs the host to isolate the faulty page in the marked faulty physical memory giant page and release the physical memory pages other than the faulty page.
6. The method according to any one of claims 1 to 4, characterized in that, Passing the client physical address GPA to the virtual machine to instruct the virtual machine to isolate the faulty page based on the client physical address GPA includes: The client physical address GPA is passed to the virtual machine to instruct the virtual machine to unmap and isolate the faulty page according to the memory fault handling logic.
7. The method according to any one of claims 1 to 4, characterized in that, Passing the client physical address GPA to the virtual machine to instruct the virtual machine to isolate the faulty page based on the client physical address GPA includes: The client physical address GPA is passed to the virtual machine via the machine check injection (MCE-inject) instruction to instruct the virtual machine to isolate the faulty page based on the client physical address GPA.
8. A device for handling virtual machine memory faults, characterized in that, Applications to virtual operating system emulators include: The receiving module receives memory fault information sent by the host. The memory fault information carries the host virtual address (HVA) of the faulty page, and the faulty page is the physical memory page that has failed in the physical memory giant page used by the virtual machine. The module determines the client physical address (GPA) mapped to the host virtual address (HVA). The input module passes the client physical address GPA to the virtual machine to instruct the virtual machine to isolate the faulty page based on the client physical address GPA.
9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Replaying memory transactions while resolving memory access faults
CN104049951A
Freezing method and device of virtual machine
CN114116132A