A dirty page determination method and computing device

By creating peer virtual machines on computing devices and recording dirty pages using the virtual machine's PML mechanism, the system resource overhead caused by dirty page tracking in the existing technology is solved, and more efficient dirty page tracking and server migration is achieved.

CN117076105BActive Publication Date: 2025-04-08XFUSION DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310915783.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-20
Publication Date
2025-04-08
Estimated Expiration
2043-07-20

AI Technical Summary

Technical Problem

When tracking dirty pages generated during server operation, the prior art needs to frequently trigger page failures, resulting in large system resource overhead.

Method used

By creating a virtual machine peer to the physical machine on the computing device, the virtual machine's page modification record (PML) mechanism records dirty pages generated by the target service operation, thereby reducing the overhead of system resources.

Benefits of technology

It realizes that in scenarios such as server migration, the system overhead during dirty page tracking is reduced, and the performance and stability of the service are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117076105B_ABST
    Figure CN117076105B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a dirty page determination method and computing device, which relate to the field of server technology. The computing device includes a host operating system, a virtual machine and a target service deployed on the host operating system, and the method includes monitoring the state information of the target service; wherein the state information is used to characterize the calling of the target service; when the target service is called, the target service is switched to the virtual machine for operation; wherein the page table used by the target service in the virtual machine is the same as the page table used by the target service running on the host operating system; and the dirty pages generated by the running of the target service are recorded through the page modification record PML mechanism in the virtual machine. In this way, the system overhead can be reduced when tracking the dirty pages of the target service on the host operating system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of server technology, and in particular to a dirty page determination method and computing device. Background Art

[0002] During the operation of a service (such as a fund transaction service), the physical machine (such as a server) where the service is located may need to migrate the service to another physical machine for reasons such as load balancing and planned downtime. When performing service migration, in order to reduce the amount of memory data transmitted by the service and shorten the transmission time, incremental replication can be used to complete the transfer of the corresponding memory state through multiple rounds of copying. To this end, in each round of copying, it is necessary to determine which memory pages have changed from the completion of the previous round of copying to the current time, that is, to track the dirty pages generated during this period for copying.

[0003] In the related dirty page tracking technology, the specific principle is: mark the virtual address page used by the service as read-only, so that the virtual address page triggers a page fault when reading and writing, and then register the corresponding physical memory page, so that the registered page can be obtained for migration during incremental copy, and the corresponding virtual address page needs to be marked as read-only again before memory transmission, so that the modification of the page can be tracked later. However, this dirty page tracking method triggers a page fault every time a dirty page is obtained, which causes high overhead to system resources. Summary of the invention

[0004] Embodiments of the present application provide a dirty page determination method, apparatus, computing device, computer storage medium, and computer program product, which can reduce system resource overhead when tracking dirty pages.

[0005] In a first aspect, an embodiment of the present application provides a dirty page determination method, which is applied to a computing device, wherein the computing device includes a host operating system, and a virtual machine and a target service deployed on the host operating system, and the method includes: monitoring the status information of the target service; wherein the status information is used to characterize the calling of the target service; when the target service is called, switching the target service to the virtual machine for execution; wherein the page table used by the target service in the virtual machine is the same as the page table used by the target service when running on the host operating system; and recording the dirty pages generated by the running of the target service through the page modification record PML mechanism in the virtual machine.

[0006] In this embodiment, in the computing device, the page table used in the virtual machine state and the non-virtual state is the same, and the memory space used when the read and write operations occur in the virtual machine state and the non-virtual state is the same. Based on the shared characteristics of the page table, when the target service on the host operating system needs to record dirty pages, the target service can be switched to the virtual machine of the computing device to run. At this time, the target service can still use the same page table to read and write normally, and can directly record the dirty pages generated by the target service operation through the PML mechanism of the virtual machine, thereby reducing the system's resource overhead when tracking the dirty pages of the target service on the host operating system.

[0007] In some possible embodiments, the virtual machine includes an extended page table EPT; wherein the EPT includes an identity mapping relationship; the identity mapping relationship is used to map the physical address of the virtual machine to the physical address of the computing device; after switching the target service to run in the virtual machine, the method also includes: determining the physical address of the computing device corresponding to the physical address of the virtual machine accessed by the target service through the identity mapping relationship of the extended page table EPT; and executing the write operation of the target service based on the physical address of the computing device.

[0008] In this embodiment, the virtual machine mode and the non-virtual machine mode share a page table, and through the EPT page table with an identical mapping relationship, the virtual addresses between the two modes have a corresponding linear relationship, so as to access the real memory space commonly available to the two modes. In this way, it is ensured that the target service can still perform normal read and write operations based on the same page table after switching to the virtual machine.

[0009] In some possible embodiments, switching the target service to run in a virtual machine includes: determining the running site of the target service in the virtual machine, wherein the running site of the virtual machine is the same as the site state when the target service runs on the host operating system; scheduling the target service to run in the virtual machine.

[0010] In this way, by deploying the same operation site under different operation modes, it can be ensured that the target service can run stably when switching between different operation modes.

[0011] In some possible embodiments, before switching the target service to a virtual machine for execution, the method further includes: determining an operation mode of the computing device; the operation modes include a virtual machine mode and a non-virtual machine mode; and when the computing device is operating in a non-virtual machine mode, switching the target service to a virtual machine for execution.

[0012] In this embodiment, the processor of the computing device monitors the current operating mode, and when it is determined that the target service is in a non-virtual machine mode when being called, it switches the operating mode to ensure the reliability of the operating mode switching.

[0013] In some possible embodiments, determining the operation mode of the computing device includes: obtaining a return result of a CPUID instruction; and determining the operation mode of the computing device according to the return result of the CPUID instruction. The detection logic of the operation mode is simple and reliable.

[0014] In some possible embodiments, a computing device includes a first memory page and a second memory page; wherein, in a virtual machine mode, the first memory page corresponds to a predetermined physical memory page; in a non-virtual machine mode, the second memory page corresponds to a predetermined physical memory page; determining the operating mode of the computing device includes: accessing a predetermined physical memory page, and determining the operating mode of the computing device according to the content of a target memory page corresponding to the predetermined physical memory page, wherein the target memory page is the first memory page or the second memory page.

[0015] In some possible embodiments, the method also includes: obtaining configuration information; the configuration information is used to indicate whether to enable dirty page tracking for the target service; when the configuration information indicates to enable dirty page tracking for the target service, recording the dirty pages generated by the write operation based on the PML mechanism of the virtual machine.

[0016] In some possible embodiments, the method further includes: when a virtualization exit condition is met, switching the target service from the virtual machine to run on the host operating system; wherein the exit condition includes that dirty page tracking is not required, the target service stops running, or the buffer for recording dirty pages is full.

[0017] In some possible embodiments, the method includes: when a migration condition is met, migrating the dirty page to the target computing device, wherein the migration condition includes that the number of dirty pages is lower than a preset value, or the estimated transfer time is lower than a preset threshold. In this way, hot migration of the target service on the host operating system can be achieved with low system overhead.

[0018] In the second aspect, an embodiment of the present application provides a dirty page determination device, which is applied to a computing device, wherein the computing device includes a host operating system, and a virtual machine and a target service deployed on the host operating system, and the device includes: a monitoring module, which is used to monitor the status information of the target service; wherein the status information is used to characterize the calling of the target service; a processing module, which is used to switch the target service to the virtual machine for execution when the target service is called; wherein the page table used by the target service in the virtual machine is the same as the page table used by the target service running on the host operating system; and the device records the dirty pages generated by the operation of the target service through the page modification record PML mechanism in the virtual machine.

[0019] In a third aspect, an embodiment of the present application provides a computing device, comprising: at least one memory for storing programs; and at least one processor for executing programs stored in the memory; wherein, when the program stored in the memory is executed, the processor is used to execute the method described in the first aspect or any possible implementation of the first aspect.

[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method described in the first aspect or any possible implementation of the first aspect.

[0021] In a fifth aspect, an embodiment of the present application provides a computer program product, characterized in that when the computer program product runs on a processor, the processor executes the method described in the first aspect or any possible implementation of the first aspect.

[0022] In the sixth aspect, an embodiment of the present application provides a chip, characterized in that it includes at least one processor and an interface; at least one processor obtains program instructions or data through the interface; at least one processor is used to execute program line instructions to implement the method described in the first aspect or any possible implementation method of the first aspect.

[0023] It can be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 This is a schematic diagram of an application scenario of a physical machine service hot migration provided by an embodiment of the present application;

[0025] Figure 2 It is a structural diagram of a physical machine provided in an embodiment of the present application;

[0026] Figure 3 is a schematic diagram of the storage space relationship between a physical machine and its peer virtual machine in an embodiment of the present application;

[0027] Figure 4 It is a schematic diagram of a non-virtualized mode and a virtualized mode sharing a page table in an embodiment of the present application;

[0028] Figure 5 is a schematic diagram of a related page table created on a physical machine in an embodiment of the present application;

[0029] Figure 6 It is a structural diagram of a physical machine and its equivalent virtual machine in a specific embodiment of the present application;

[0030] Figure 7This is a flowchart of scheduling target services in a specific embodiment of the present application;

[0031] Figure 8 is a schematic diagram of a related page table created on a physical machine in a specific embodiment of the present application;

[0032] Fig. 9 It is a flowchart of a dirty page determination method provided in an embodiment of the present application;

[0033] Fig.10 It is a flowchart of a dirty page determination method provided by a specific embodiment of the present application;

[0034] Fig.11 It is a flowchart of a dirty page determination method provided by a specific embodiment of the present application;

[0035] Fig.12 It is a structural schematic diagram of a dirty page determination device provided in an embodiment of the present application;

[0036] Fig.13 It is a schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0037] The term "and / or" in this article is a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The symbol " / " in this article indicates that the associated objects are in an or relationship, for example, A / B means A or B.

[0038] The terms "first" and "second" in the specification and claims herein are used to distinguish different objects rather than to describe a specific order of the objects. For example, a first response message and a second response message are used to distinguish different response messages rather than to describe a specific order of the response messages.

[0039] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0040] To facilitate understanding of the technical solutions of the embodiments of the present application, the technical terms involved in this document are explained below.

[0041] Dirty page tracking refers to how the kernel records file pages as dirty at the appropriate time so that the kernel knows which pages to write back to disk when writing dirty pages back.

[0042] Page modification logging (PML) is a mechanism of virtual machines. It is a hardware feature developed to support dirty page tracking in virtualization scenarios. Specifically, when the software modifies a memory page, the processor will set the corresponding "dirty" bit (dirty bit) for the page entry in the system's page table structure to record the modification behavior of the page.

[0043] A virtual machine (VM) is a complete computer system that is simulated by software and has complete hardware system functions and runs in a completely isolated environment.

[0044] Virtual machine manager (VMM): The role of the virtual machine manager is to implement computing virtualization, network virtualization, and storage virtualization of virtual machines, and is responsible for managing virtual machines.

[0045] The virtual machine control structure (vmcs) is a key data structure that implements CPU virtualization in Intel x86 processors and records the status of the virtual processor (vCPU).

[0046] A hypercall is a system call from the client operating system of a virtual machine to the VMM, which is used to implement some privileged operations that the client operating system itself cannot implement (such as updating page tables, accessing physical resources, etc.).

[0047] Virtual address (virtual address), the central processing unit (CPU) generates a virtual address when the program is running, and the virtual address is mapped to physical memory through the page table.

[0048] Physical address: A unique address given to each byte unit in the memory.

[0049] A page table is a data structure placed in the page table area of ​​the system space, storing the correspondence between logical pages and physical pages. Each process has its own page table, which is maintained by the operating system and referenced by the processor.

[0050] The extended page table (EPT) is used to implement the conversion from the guest physical address (GPA) to the host physical address (HPA). The EPT page table is stored in the VMM. Each virtual machine has its own EPT page table, which is maintained by the VMM.

[0051] The kernel scheduler is a module in the kernel that is used to schedule process execution. It can switch process states, such as execution, interruptible sleep, uninterruptible sleep, exit, pause, etc.

[0052] The page table base address register (CR3) is mainly used to store the physical memory base address of the page directory table. Whenever the process switches, Linux will store the physical memory base address of the page directory table of the next process to be run in the CR3 register.

[0053] The stack pointer register (stack pointer, SP) is used to store the offset within the current stack segment, so the SP register is called the stack pointer, and SP always points to the top of the stack.

[0054] The program counter, in the X86 field, is the RIP register, which is used to store the address of the next instruction to be executed by the CPU. When the program is executed sequentially, RIP keeps moving down, and the CPU keeps executing the next instruction.

[0055] In the related art, when a physical machine migrates a loaded service to another physical machine, in order to ensure user experience, it usually avoids service pauses, which requires that the service memory data migration time is short enough. However, when a service has a lot of memory, it will take a lot of time to transfer all of its memory to another physical machine at one time. In addition, in order to ensure that the migration is a snapshot of the service, the service needs to be frozen during the memory copy process. The result of these factors is that the service memory migration cannot be performed in a full copy manner, but an incremental copy method must be adopted to complete the transfer of the entire service memory state through multiple rounds of copying. To this end, the physical machine needs to know which memory pages of the service have been modified during the period from the completion of the previous round of copying to the start of the next round of copying, so that in the next round of copying, the physical machine can selectively copy only the modified memory pages (i.e., dirty pages), thereby reducing the amount of memory that needs to be transferred and shortening the transfer time. When the physical machine determines that the transfer time is short enough, it can freeze the service to complete the migration, so that the user still feels that the "service is not interrupted".

[0056] During the incremental replication process, the dirty page tracking technology that the Linux system can use is to trigger a write fault through the read-only mark of the virtual address and register the faulty page, so as to obtain the registered faulty page during incremental synchronization. However, this page fault will not occur during normal service operation. Each page fault specially triggered for tracking dirty pages will generate high resource overhead and easily have an adverse impact on service performance. Although in some virtual machines, it is also possible to expose the dirty page tracking capability (PML) of the processor based on the EPT page table to the application in the virtual machine (such as the process migration tool) through a hypercall, this method is only suitable for application services within the virtual machine and cannot be used to track dirty pages generated by application services on the physical machine.

[0057] In order to track dirty pages of services on a physical machine and reduce the impact on service performance, an embodiment of the present application provides a dirty page determination method. The method mainly creates a virtual machine equivalent to the physical machine on the physical machine. When the target service on the physical machine needs to track the generated dirty pages, the target service is switched to run on the virtual machine, and the PML mechanism of the virtual machine is used to record the dirty pages, thereby reducing the system overhead and facilitating the reduction of the impact on service performance in scenarios where dirty pages need to be obtained, such as physical machine service migration.

[0058] In order to facilitate understanding of the technical solution of the present application, an application scenario of an embodiment of the present application is first introduced below.

[0059] For example, Figure 1 FIG. 1 shows a hot migration application scenario of an embodiment of the present application. Figure 1 As shown, the software layer 110 of the physical machine 10 includes an application program of service A, and when service A is running, it can provide corresponding business services (such as fund transaction services, but not limited to this) to the user terminal 20. In addition, a virtual machine 120 (providing a virtualization mode) equivalent to the physical machine 10 is also deployed on the software layer 110 of the physical machine 10, so that service A can run in both non-virtualization mode and virtualization mode without changing the service A and the physical machine kernel on the physical machine 10, and the page table created by the physical machine 10 for service A can also be used when service A runs in the virtual machine 120.

[0060] In this example, based on the equal performance of the physical machine 10 and the virtual machine 120, when it is necessary to migrate service A from the source physical machine 10 to the remote target physical machine 30, it can be manually triggered, or automatically triggered by a preset policy to start the dirty page tracking function of the physical machine 10 for service A, and switch service A from running in non-virtualized mode (also called "root state") to running in virtualized mode (also called "non-root state"). Then, in the virtualized mode, the PML mechanism of the virtual machine 120 is used to record the dirty pages generated during the operation of service A. In this way, the source physical machine 10 can freeze service A by incremental replication when the migration conditions are met (such as the estimated transmission time of dirty pages is lower than the preset threshold), and transfer the recorded dirty pages of service A to the remote target physical machine 30, so as to realize the hot migration of service A on the physical machine 10, and restore service A on the remote target physical machine 30 after the migration is completed, so that the user terminal 20 can maintain the service in an uninterrupted state in terms of perception.

[0061] It can be understood that the physical machine 10 is an entity of a computing device, which is relative to the virtual machine 120 and provides a corresponding hardware environment for the virtual machine 120 .

[0062] The structure of a physical machine provided in an embodiment of the present application is introduced below in conjunction with the accompanying drawings.

[0063] For example, Figure 2 FIG. 1 is a schematic diagram of a physical machine structure provided by an embodiment of the present application. Figure 2 As shown, the physical machine 10 may include a software layer 110 and a hardware layer 130 .

[0064] In this embodiment, the hardware layer 130 may include a processor 131, a memory 132, a disk 133, a network card 134, etc., but is not limited thereto. The processor 131, the memory 132, the disk 133, and the network card 134 may be connected via a bus or other means. In this example, the processor 131 (or referred to as a central processing unit (CPU)) is the computing core and control core of the physical machine 10. In some embodiments, the processor 131 may perform some or all of the steps of the method provided in this embodiment. The memory 132 and the disk 133 form a memory device of the physical machine 10 for storing programs and data. By way of example and not limitation, the memory 132 may be a dynamic random access memory (DRAM), and the disk 133 may be a non-volatile memory, which may be used to store the operating system and executable program code of the physical machine 10. The operating system of the physical machine 10 may include but is not limited to: Windows system, Linux system, etc. The network card 134 may be controlled by the processor 131 to send and receive data information, for example, to obtain a service request sent by a user terminal, or to transmit data to other physical machines.

[0065] In this embodiment, the software layer 110 may include a host operating system (host OS) 111 installed and running on the physical machine 10, applications (such as services A, B, ...) installed and running on the operating system 111, and a virtual machine 120 deployed on the operating system 111. Figure 2 As shown, the host operating system 111 is provided with a virtual machine manager (VMM) 112, which can provide a portion (or a portion of functions, such as network card bandwidth) of the processor 131, memory 132, disk 133, and network card 134 of the physical machine hardware layer to the virtual machine 120, forming Figure 2 120 , vCPU 122 , vMemory 123 , vDisk 124 , vNIC 125 and other virtual resources are shown in FIG. The virtual machine manager 112 may also be used to create or delete a virtual machine 120 , process I / O generated by the virtual machine 120 , and so on.

[0066] In this embodiment, the virtual machine 120 is equivalent to the physical machine 10, and the virtual machine 120 includes a client operating system (guest OS) 121 and applications (such as services A, B, ...) deployed on the operating system 121. The virtual machine 120 is equivalent to the physical machine 10, that is, the application running on the operating system 111 can also run in the virtual machine 120, and the page table created by the operating system 111 for the application can also be used normally when the application runs in the virtual machine 120, so that the same running code has a linear virtual address correspondence in the root state and the non-root state.

[0067] As a specific example, the page table created for the service in the root state can be used in the virtual machine 120 through the identity mapping of the EPT page table. Figure 3 As shown in (3a), the host physical address HPA available to the physical machine 10 can be a storage space starting from address "0", and the guest physical address GPA perceived by the virtual machine 120 also starts from "0" and needs to be converted to the host physical address HPA through the EPT page table. However, in this example, there is only one virtual machine 120 on the physical machine 10 that is equivalent to the physical machine 10, so Figure 3 As shown in (3b), the real storage space available to the virtual machine 120 is the same as the real storage space available to the physical machine 10.

[0068] Therefore, if Figure 4 As shown, when the service process runs in the non-virtualized mode of the physical machine 10, the service process can map the host virtual address HVA to the host physical address HPA for access based on the page table 140 it owns. When the service process switches to the virtualized mode for operation, the client virtual address GVA accessed by the service process can also point to the corresponding client physical address GPA via the page table 140. When the physical address GPA points to the host physical machine address HPA through the identity mapping of the EPT page table 126, it also points to the client physical address GPA itself. At this time, the GPA is equivalent to the HPA. Therefore, the real physical address addressed by the service process in the virtualized mode can be the same as the real physical address accessed in the non-virtualized mode.

[0069] In this way, the page table 140 created by the processor 131 for the service in the non-virtualized mode can still be used normally when the service switches to the virtualized mode, thereby continuing to support the service to perform read and write operations on the corresponding memory in the virtualized mode. Then, the PML mechanism in the virtualized mode can be used to track the dirty pages generated by the write operation during the operation of the service. When the migration conditions are met (such as the estimated total transmission time of the generated dirty pages is lower than the threshold), the physical machine 10 can also freeze the service and transmit these dirty pages to achieve hot migration of the service on the physical machine 10.

[0070] In this embodiment, the service shares a page table 140 in different operating modes, and there is no need to make changes to the service itself or the OS111 kernel. The hardware PML mechanism is used to track the dirty pages of the physical machine service, reducing the system overhead in the dirty page tracking process, which is beneficial to ensuring the service performance during operations such as hot migration of services on the physical machine.

[0071] In some possible implementations, on the physical machine 10, the same running code of the service has a linear virtual address correspondence in the root state and the non-root state. Based on this, the processor 131 can dynamically create a virtual machine control structure vmcs corresponding to the virtual machine 120 to ensure that the target service (the service whose dirty pages need to be tracked, or the service to be migrated) runs without modification in the virtual state and the non-virtual state.

[0072] As a specific example, the relevant page table structure on the physical machine 10 can be as follows: Figure 5 As shown, the processor 131 creates a virtual machine control structure vmcs510 for the virtual machine 120, creates an EPT page table 140 with an identical mapping relationship for the target service, and allocates a VMM dedicated stack 520, a VMM page table 530, and a PML page 540, etc. Among them, vmcs510 includes state data in the root state (Host), such as the HOST CR3 field (recording the information of the CR3 register), the HOST SP (recording the information of the stack pointer), and the HOSTRIP (recording the information of the RIP register). Similarly, vmcs510 also includes relevant state data of fields such as guest SP and guest RIP in the non-root state (guest). The stack pointer-related fields in vmcs510 can point to the top of the current task kernel stack 560. In addition, vmcs510 also includes an eptp pointer for pointing to the first-level directory of the EPT page table 140, and vmcs510 also includes a pml field that can point to the corresponding PML page table 540.

[0073] In this example, vmcs510 also includes a first flag bit 511 and a second flag bit 512, wherein the first flag bit 511 is used to point to the corresponding physical page. The second flag bit 512 is used to enable the PML feature, so that when the second flag bit 512 is set to the on state, the virtual machine 120 can use the PML mechanism to record dirty pages.

[0074] In this example, the PML page table 540 includes a buffer 543 , and the buffer 543 is used to store the page number of the physical page (dirty page) where data is written when the PML feature is enabled.

[0075] In this way, based on Figure 5 According to the relevant page table structure shown in , the processor 130 can switch the scheduling service between the root state and the non-root state, set the status of the service in different operating modes (non-virtualization mode or virtualization mode) (such as CR3, SP, RIP, etc.), perform physical page addressing to complete the write operation, and perform corresponding dirty page tracking, etc.

[0076] The following takes the Linux system based on X86 (a central processing unit instruction set architecture) architecture in the physical machine 10 as an example, and describes the tracking process of dirty pages generated by running the target service (service to be migrated) on the physical machine 10 in combination with the attached drawings.

[0077] For example, Figure 6 FIG. 1 shows a schematic diagram of the structure of a physical machine 10 and its peer virtual machine 120. Figure 6 As shown, multiple services A, B, ... (including target services and non-target services) can be run on the host operating system (Linux system) 111 of the physical machine 10, and a scheduling swap-in module 150 (working in non-virtualization mode), a scheduling swap-out module 160 (working in virtualization mode) and a virtualization exit processing module 170 (working in non-virtualization mode) can be set in the OS 111 kernel on the physical machine 10. Services A, B, ... can also be run on the client operating system 121 of the peer virtual machine 120, and the peer virtual machine 120 can perceive the corresponding scheduling swap-in module 127 (working in non-virtualization mode), scheduling swap-out module 128 (working in virtualization mode) and virtualization exit processing module 129 (working in non-virtualization mode).

[0078] In this example, Figure 4 , Figure 5 With the support of the relevant page table shown, the processor 131 can use the kernel scheduler to perform the following operations on target services and non-target services in different operating modes: Figure 7 The scheduling switch shown:

[0079] Please refer to Figure 7As shown, in step 1, when dirty page tracking is enabled for target service A in non-virtualized mode, the scheduling swap-in module 150 can monitor the state of target service A being called, and the kernel scheduler can execute step 2 based on the state to switch the target service to virtualized mode to continue running. Then, through step 3, the PML mechanism of the virtual machine 120 is used in the virtualized mode to record the dirty pages generated during the operation of the target service. In addition, in the virtualized mode, the scheduling swap-out module 128 can monitor the state of target service A stopping running, thereby implementing step 4, and notifying the kernel scheduler of the monitored state of target service A stopping running (or monitoring non-target service threads that do not need to track dirty pages). Then, the kernel scheduler executes step 5 to switch the stopped target service A or the thread that does not need to track dirty pages to the non-virtualized mode to continue to execute subsequent related tasks (such as continuing to run the target service, continuing to run the non-target service, or transmitting dirty pages, etc.). The virtualization exit processing module 170 can be used to set the operating scene in the non-virtualization mode to continue to support the execution of subsequent related tasks (such as continuing to run the target service, continuing to run the non-target service thread, or transferring dirty pages, etc.) after the target service A or non-target service exits the virtualization mode.

[0080] It can be understood that in this example, switching the service from non-virtualized mode to virtualized mode is to convert the service on the host operating system into a service in the virtual machine 120, and the same running code is executed before and after the running mode is switched.

[0081] In this embodiment, the service can be switched between different operation modes by setting vmcs510, and the corresponding operation scene before and after the operation mode switching remains consistent. The operation scene includes but is not limited to: the stack pointer SP when the service is running, the page table base address register CR3, the program status register, the segment register, etc.

[0082] Exemplarily, the kernel scheduler can implement the scheduling switching of the target service's running mode by inserting a springboard code in the kernel scheduler. Specifically, the kernel scheduler can implement the following by running the springboard code: when the target service is in a scheduled running state, the target service is switched to a virtualized mode for running, or when the target service is in a stopped running state, the target service is switched to a non-virtualized mode.

[0083] In this example, during the above-mentioned scheduling switching process, the processor 131 also monitors the operating mode in which it is located. For example, rather than by way of limitation, the implementation method of monitoring the operating mode of the processor may include:

[0084] In some possible implementations, when monitoring the operating mode of the processor 131, the operating mode of the current processor 131 can be determined through the execution information of the specified CPU instruction, such as the cpuid instruction under the X86 architecture. The cpuid instruction is an instruction opcode provided by the processor 131, which enables the software to analyze the processor information. Because the cpuid instruction is different in virtualization mode and non-virtualization mode, the operating mode of the current processor 131 can be distinguished by checking the execution result of the cpuid instruction.

[0085] In other possible implementations, when monitoring the operating mode of the processor 131, the EPT page table can be set to not have an identical mapping property for a specified physical memory page, so that the virtual machine 120 and the physical machine 10 will access different machine memory pages when accessing the same physical memory page, thereby achieving the distinction between operating modes.

[0086] A specific example of this implementation is as follows: Figure 8 As shown, two memory pages in the allocated memory are designated physical pages (551, 552), so that the marks of the two pages are different, for example, a designated physical page (also referred to as the first memory page in this article) 551 is marked as "0000", and another designated physical page (also referred to as the second memory page in this article) 552 is marked as "FFFF". In addition, in this example, the designated physical pages 551 and 552 are both used to record the configuration information of dirty page tracking (such as the configuration information indicating whether to perform dirty page tracking, but not limited to this), and the processor 131 can determine whether to perform dirty page tracking of the service by accessing the two designated physical pages 551 and 552. In addition, when creating an EPT page table with an identical mapping, the two physical pages 551 and 552 do not have the identical mapping property, so that the processor 131 will access the physical page 551 when it is in the non-virtualization mode, and the processor 131 will access the physical page 552 when it is in the virtualization mode. Therefore, the distinction between different operating modes can be achieved according to the mark of the accessed physical page.

[0087] In this embodiment, based on the equal characteristics between the physical machine 10 and the virtual machine 120, the OS kernel of the physical machine 10 can schedule the services deployed on the host operating system 111 to run in the virtual machine 120, and use the PML mechanism of the virtual machine 120 to track the dirty pages generated by the services, thereby realizing hot migration of the services, reducing the impact on the performance of the services, and ensuring the stability of the services during the migration process.

[0088] Next, based on the above description, a dirty page determination method provided by an embodiment of the present application is introduced. It can be understood that the method is proposed based on the above description, and part or all of the contents of the method can be referred to the above description.

[0089] See also Fig. 9 , Fig. 9 : is a flowchart of a dirty page determination method provided by an embodiment of the present application. It can be understood that the method can be executed by any physical machine with computing and processing capabilities, and the physical machine as the source end physical machine includes a host operating system and a virtual machine deployed on the host operating system, and the virtual machine is equivalent to the source end physical machine. As a specific example, the source end physical machine can be Figure 2 The physical machine 10 shown in FIG. 10 , the virtual machine may be Figure 2 The virtual machine 120 shown in FIG. 1 is also used as an example in the following description.

[0090] Specifically, Fig. 9 As shown, the method may include:

[0091] S910, monitor the status information of the target service, where the target service is deployed on the host operating system of the source physical machine.

[0092] In this embodiment, multiple services can be deployed on the source end physical machine 10, and these services can include target services (services that need to track dirty pages, or services to be migrated), and can also include non-target services. When the source end physical machine 10 determines to migrate the target service on the host operating system 111 to the target end physical machine, or the processor 131 of the source end physical machine 10 determines that it is necessary to track the dirty pages generated by the target service (which can be achieved by accessing Figure 8 The target service may be determined by the physical page 551 shown in FIG. 5 ), and the current calling state information of the target service may be detected at S910 . The state information may be used to represent the called state, or the stopped running state, etc.

[0093] S920, when the target service is called, switching the target service to run in the virtual machine;

[0094] In this embodiment, if the processor 131 determines that the target service is called through the monitored status information, the target service is switched to the virtual machine 120 for execution, that is, the target service running on the host operating system is converted to the target service running in the virtual machine 120, and the running codes before and after the conversion are the same. In addition, in this embodiment, the page table (e.g. Figure 4The page table 140 shown in FIG. 1 is the same as the page table used when the target service runs in the host operating system. Based on the page table shared by the virtual machine 120 and the non-virtualization mode, the processor 131 can perform write operations on the memory that occur during the operation of the target service.

[0095] In this way, the target service shows a normal and continuous operation effect on the physical machine 10, so that the corresponding business provided by the physical machine 10 to the user will not be abnormal.

[0096] S930, recording dirty pages generated by the target service running through the page modification record PML mechanism in the virtual machine.

[0097] In this embodiment, when a write operation occurs in the target service running on the virtual machine 120, the PML mechanism of the virtual machine 120 can be used to record the physical page (ie, dirty page) where the write operation occurs.

[0098] In this way, when the service originally deployed on the host operating system of the physical machine 10 needs to track dirty pages (such as migrating the service), it can use the hardware PML characteristics of the peer virtual machine 120 to track the dirty pages generated by the service on the host operating system, thereby reducing system overhead.

[0099] The dirty page determination method in a specific embodiment of the present application is described in detail below in conjunction with the accompanying drawings.

[0100] For example, Fig.10 FIG. 2 shows a flow chart of a dirty page determination method. Fig.10 As shown, the dirty page determination method may include:

[0101] S1010, monitoring status information of the target service.

[0102] In this embodiment, S101 may be similar to the execution process of step S910 in the above embodiment, and will not be described in detail here.

[0103] Exemplarily, in addition to monitoring the status information of the target service, the method may further include:

[0104] S1011, determining an operating mode of the computing device.

[0105] In this step, the processor 131 of the physical machine 10 can determine its current operating mode through the execution information of the specified cpu instruction. Specifically, step S1011 may include:

[0106] The return result of the CPUID instruction is obtained, and then the operation mode of the computing device is determined according to the return result of the CPUID instruction. In this way, the processor 131 distinguishes which operation mode the processor 131 is currently running in by checking the execution result of the cpuid instruction.

[0107] In some other possible implementations, reference may be made again to Figure 8 As shown, when setting the EPT page table with the same mapping, the OS111 kernel can separately set the two memory pages 551 and 552 to not have the same mapping property, and the page marks of the two are different, and both are used to record the configuration information such as whether to track dirty pages. The two memory pages 551 and 552 are respectively accessed by the processor 131 in different operating modes. Then, in this implementation, S1011 may specifically include:

[0108] A predetermined physical memory page is accessed, and then an operation mode of the computing device is determined according to content of a target memory page corresponding to the predetermined physical memory page, wherein the target memory page is the first memory page or the second memory page.

[0109] In this example, the processor 131 can determine whether to enable dirty page tracking of the target service by accessing a predetermined physical memory page. In the non-virtual machine mode, the predetermined physical memory page accessed by the processor 131 is a real memory space page, so the physical address HPA of the predetermined physical memory page can directly address the corresponding target memory page, that is, the first memory page 551, so as to read the content in the first memory page 551 (such as the memory page identifier, and the configuration information for indicating whether to start tracking dirty pages, etc.). In the virtual machine mode, the predetermined physical memory page accessed by the processor 131 needs to be converted by the EPT page table before the corresponding real memory space page can be accessed. Therefore, in the virtual machine mode, the physical address GPA of the predetermined physical memory page accessed by the processor 131 will be mapped to the corresponding host machine physical address HPA through the EPT page table 126, so as to address the corresponding target memory page, that is, the second memory page 552, and read the content in the second memory page 552. In this way, since the identifiers of the first and second memory pages are different, the processor 131 can determine the current operation mode according to the identifier.

[0110] Moreover, in this example, if the processor 131 determines to enable dirty page tracking based on the configuration information of the accessed memory page, the PML mechanism of the virtual machine 120 can be enabled. If it is determined that dirty page tracking is not enabled, no processing can be performed or the PML mechanism can be disabled.

[0111] In some other possible examples, the configuration information of whether to start tracking dirty pages may also be recorded in the vmcs510 structure and saved in the memory page of the physical machine 10. Then, after S1011, the method may further include:

[0112] The configuration information of the memory page is obtained, and when the configuration information indicates to enable dirty page tracking of the target service, the PML mechanism of the virtual machine 120 is enabled, so that after the target service is subsequently switched to run in the virtual machine mode, the dirty pages generated by the target service are recorded based on the PML mechanism.

[0113] S1020: When it is determined that the target service is called and the computing device is running in a non-virtual machine mode, the target service is scheduled to run in a virtual machine.

[0114] In this embodiment, if the processor 131 is in a non-virtualized mode and monitors a target service being called, the target service is scheduled to run in the virtual machine 120 .

[0115] Exemplarily, when executing S1020, the following steps may be specifically included:

[0116] S1021, when the computing device is running in a non-virtualized mode and the target service is called, determine the running scene of the virtual machine, the running scene of the virtual machine is the same as the scene state when the target service is running on the host operating system.

[0117] S1022, setting a dedicated stack for exiting the virtualization mode;

[0118] S1023, dispatch the target service to run in the virtual machine.

[0119] In this embodiment, in order to ensure the stability of the target service when it is switched to the virtual machine 120 for operation, before scheduling the target service to the virtual machine 120, the processor 131 can set vmcs510 through S1021 to configure the state of the virtual machine 120 after entering the virtualization mode (such as CR3 register, stack pointer, program status register, segment register, etc.) to ensure that the virtual machine 120 can continue to execute the code originally executed in the non-virtualization mode.

[0120] As a specific example, the OS 111 kernel may implement the monitoring of the scheduling and preemption of the target service through a scheduling preemption notification mechanism (sched_in_preempt_notifiers / sched_out_preempt_notifiers).

[0121] Specifically, the physical machine 10 can provide the target service with the callback functions required by sched_in_preempt_notifiers and sched_out_preempt_notifiers through a kernel module (kernel code that can be loaded or unloaded on demand). Among them, when the callback function corresponding to sched_in_preempt_notifiers is called in the non-virtualized mode, the corresponding domain in the vcms510 structure of the peer virtual machine 120 (the domain that the target service has in the vcms structure) is set, so that the stack pointer of the target service when running in the virtualized mode is the same as the stack pointer when running in the non-virtualized mode, and the corresponding page table base address register, program status register, segment register, etc. are also completely consistent before and after the operation mode is switched. The value of the program counter RIP is the next instruction after the instruction to enter the virtualized mode (it can also be a later instruction, as long as the program logic is correct), and then S1023 can be executed, that is, the instruction to enter the virtualized mode is executed. Then, the program code of the target service can be continued to be executed in the virtual machine 120.

[0122] Optionally, when a processing task after exiting the virtualization mode (such as a task for the processor to obtain dirty pages) needs to use a stack, a separate stack can be allocated for this purpose through step S1022 to ensure that other data structures will not be destroyed when the task thread executes the task after virtualization exits and accesses the stack.

[0123] In this embodiment, after the target service is switched to the virtual machine for execution through the above step S1020, the method may further include:

[0124] S1030, determining the physical address of the computing device corresponding to the physical address of the virtual machine accessed by the target service through the identity mapping relationship of the extended page table EPT.

[0125] In this embodiment, the target service running in the virtual machine 120 is entered, and the page table created for it by the processor 131 in the non-virtualization mode is still used. The page table can be Figure 4 The page table 140 shown in FIG. 140 and the corresponding EPT page table 126 in the virtual machine 120 have an identical mapping relationship. In this way, the target service can access the host machine physical address HPA of the physical machine 10 corresponding to the virtual machine physical address GPA based on the page table 140 and the EPT page table 126.

[0126] The working principle of the page table 140 and the EPT page table 126 in different operation modes can be found in the above description of Figure 4 The description is not repeated here.

[0127] S1031, executing a write operation of the target service based on the physical address of the computing device.

[0128] In this embodiment, the target service can perform read and write operations on the corresponding physical page based on the addressed host physical address HPA in the virtualization mode.

[0129] S1040, recording dirty pages generated by the write operation through the page modification record PML mechanism in the virtual machine.

[0130] In this embodiment, if the target service performs a write operation on the physical pages of the memory, the OS111 kernel can use the PML mechanism in the virtual machine to record these physical pages to implement dirty page tracking.

[0131] For example, please combine Figure 5 As shown, when the processor 131 determines that it wants to track dirty pages of memory, it can first set the second flag bit 512 of VMCS510 to enable the dirty page recording function of PML. Then, when the target service is scheduled by the OS111 kernel to run in the virtual machine 120, the processor 131 confirms that the PML mechanism is turned on according to VMCS510 (it may not be turned off when the virtual machine exits). Every time the process of the target service writes a physical page, a corresponding dirty page record will be added to the buffer 543 of the PML page table 540 (the first flag bit 511 pointing to the physical page is also set to dirty). In this way, the read buffer 543 can obtain the physical address of the dirty page.

[0132] S1050: When the virtualization exit condition is met, the target service is switched from the virtual machine to the host operating system for execution.

[0133] In this embodiment, when the virtualization exit condition is met, for example, dirty page tracking is not required, the target service stops running, or the buffer 543 is full, the virtualization exit is triggered, and the target service is switched from running on the client operating system 121 of the virtual machine 120 to running on the host operating system 111. The processor 131 can continue to execute subsequent tasks (such as continuing to run the target service, transferring dirty pages, etc.) in the non-virtualized mode.

[0134] Exemplarily, the scheduling of the target service can be achieved through the above-mentioned scheduling preemptive notification mechanism. Specifically, when the callback function corresponding to the target service sched_out_preempt_notifiers is called in the virtualization mode, the virtualization mode can be exited by a specified method (such as hypercall). At this time, the control will be transferred to the virtualization exit processing function (Vmexit_handler, used to terminate the service process and return the relevant status value) registered for this virtual machine 120 when the virtual machine 120 is created. ). By reading the virtual machine exit reason, the value of the relevant register at the exit time, etc. from the VMCS510 structure, the virtualization exit processing function will synchronize the state in the virtualization mode to the non-virtualization mode after confirming the information such as "it is because of the need to continue to run in the non-virtualization mode". These states include: stack pointer, page table base address register, program status register, etc., and then directly jump to the next instruction when the virtual machine 120 exits to continue execution.

[0135] Optionally, in the sched_out_preempt_notifiers callback function, if the task to be run next is also part of the target service, the exit from the virtualization state is abandoned and execution is continued in the virtualization mode until it is confirmed that the target service or its related tasks have stopped running, triggering the exit from the virtualization state.

[0136] Optionally, in some examples, the above-mentioned scheduling preemptive notification mechanism (sched_in_preempt_notifiers / sched_out_preempt_notifiers) can be deployed as the above-mentioned Figure 6 The scheduling swap-in module and the scheduling swap-out module shown in the above virtualization exit processing function can be deployed as the above Figure 6 The virtualization exit processing module shown in .

[0137] In some possible implementations, in virtualization mode, the target service may be scheduled to run, and non-target services may also be scheduled to run. Non-target services may be tasks related to the migration target service, such as migration management tasks and dirty page transfer tasks, but not limited to these. These services may generate dirty pages, then:

[0138] Optionally, in some examples, in virtualization mode, when it is detected that the target service stops running, virtualization exit can be triggered, so that only dirty pages generated by the target task are obtained.

[0139] Alternatively, in some examples, since migration management tasks and dirty page transfer tasks usually generate very few dirty pages, in order to reduce the complexity of program logic design, in virtualization mode, it can be set to trigger virtualization exit when the processor 131 determines that dirty page tracking is not required (such as accessing the specified physical page 552 to determine the end of dirty page tracking). In this way, the dirty pages generated by the target service and its related tasks can be obtained.

[0140] Alternatively, in some examples, in the target service migration scenario, we may only focus on the dirty pages generated by the target service and its transfer tasks. Therefore, we may set the virtualization exit to be triggered when performing tasks other than the target service and the corresponding dirty page transfer tasks, thereby obtaining the dirty pages of the target service and its dirty page transfer tasks.

[0141] For example, similar to the principle of scheduling the target task to the non-virtualized mode, refer to Fig.11 As shown, if in step 1, in the virtualization mode, it is detected that the threads that do not need dirty page tracking are scheduled and run, the OS111 kernel can execute step 2 and continue to execute these threads in the non-virtualization mode through the hypercall request. Then, in step 3, when the control is transferred back to the non-virtualization mode, the corresponding stack state is modified, and then step 4 is executed to directly jump to the next instruction of the hypercall to execute, so as to realize the conversion of these threads from the virtualization mode to the non-virtualization mode. In this way, in different operating modes, not only the virtual address space of the service process is always available, but also the service thread stack is always available.

[0142] S1060, when the migration condition is met, the dirty page corresponding to the target service is sent to the target computing device.

[0143] In this embodiment, after collecting dirty pages of the target service, the processor 131 transfers the dirty pages to the target physical machine (ie, the target computing device) when the migration conditions are met (for example, the number of dirty pages is lower than a preset value, or the expected transmission time is lower than a preset threshold).

[0144] Exemplarily, when the target service is migrated, not only dirty page tracking is required, but also the tracked dirty pages need to be sent to the target physical machine. In this case, the processor 131 needs to execute the wake-up step of the dirty page sending task. Specifically, when running in virtualization mode, the PML mechanism will trigger the virtualization exit when the dirty page buffer 543 is full. At this time, the virtualization exit scene may not be the scene corresponding to the aforementioned sched_out_preempt_notifiers callback function, but may be in an uncertain situation, such as when the interrupt is turned off and the scheduling lock is acquired. Therefore, the virtualization exit handler cannot immediately perform the wake-up action of the related dirty page sending task. After the processor 131 sets a new PML dirty page buffer 543, it switches back to virtualization mode.

[0145] However, in order to ensure that the dirty pages will be transferred out, an interrupt for waking up the transmission task is injected into the virtual machine 120 when re-entering the virtualization mode. After the virtual machine 120 enters the interrupt-enabled state, the above interrupt will be triggered, and the high-priority transmission task will be woken up by the preset interrupt handler. When the target service is preempted and wants to execute the transmission task, the sched_out_preempt_notifiers callback function of the target service will be triggered, causing the processor 131 to transfer to the non-virtualization mode, and then complete the task switching in the non-virtualization mode and start transmitting the dirty pages.

[0146] In an embodiment of the present application, a peer virtual machine is constructed for the physical machine. Based on this, the processor can be notified to enter / exit the virtualization mode by scheduling relevant callbacks, thereby running the target application in the virtualization mode on the original physical machine, so that the processor's PML mechanism can be used to track dirty pages, especially in the scenario of hot migration of services on the physical machine, which helps to reduce the impact on the performance of the services on the physical machine during the migration process.

[0147] It can be understood that if a container is deployed on the host operating system of a physical machine, it is possible to create a virtual machine equivalent to the physical machine in a manner similar to the target service migration in the above embodiment, track the dirty pages generated by the application in the container, and then implement hot migration of the container, which will not be repeated here.

[0148] Based on the method in the above embodiment, the present application embodiment provides a dirty page tracking device. Fig.12 , Fig.12 It is a structural schematic diagram of a dirty page tracking device provided in an embodiment of the present application.

[0149] like Fig.12As shown, the dirty page tracking device 1200 may include: a monitoring module 1201 and a processing module 1202. Among them, the monitoring module 1201 can be used to monitor the status information of the target service, and the status information is used to characterize the calling of the target service. The processing module 1202 can be used to switch the target service to a virtual machine for execution when the target service is called. The virtual machine is equivalent to the physical machine, and the page table used by the target service in the virtual machine is the same as the page table used when the target service runs on the host operating system. In addition, the processing module 1202 can also be used to record the dirty pages generated by the operation of the target service through the page modification record PML mechanism in the virtual machine.

[0150] It should be understood that the above-mentioned device is used to execute the method in the above-mentioned embodiment. The implementation principle and technical effect of the corresponding program module in the device are similar to those described in the above-mentioned method. The working process of the device can refer to the corresponding process in the above-mentioned method, which will not be repeated here.

[0151] Based on the method in the above embodiment, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method in the above embodiment.

[0152] Based on the method in the above embodiment, an embodiment of the present application provides a computer program product, characterized in that when the computer program product runs on a processor, the processor executes the method in the above embodiment.

[0153] Based on the method in the above embodiment, the present application embodiment also provides a chip. Fig.13 , Fig.13 A schematic diagram of the structure of a chip provided in an embodiment of the present application. Fig.13 As shown, the chip 1300 includes one or more processors 1301 and an interface circuit 1302. Optionally, the chip 1300 may also include a bus 1303. Among them:

[0154] The processor 1301 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 1301 or an instruction in the form of software. The above-mentioned processor 1301 can be a general-purpose processor, a digital communicator (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods and steps in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0155] The interface circuit 1302 can be used to send or receive data, instructions or information. The processor 1301 can use the data, instructions or other information received by the interface circuit 1302 to process, and can send the processing completion information through the interface circuit 1302.

[0156] Optionally, the chip 1300 further includes a memory, which may include a read-only memory and a random access memory, and provides operation instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory (NVRAM).

[0157] Optionally, the memory stores executable software modules or data structures, and the processor can perform corresponding operations by calling operation instructions stored in the memory (the operation instructions can be stored in the operating system).

[0158] Optionally, the interface circuit 1302 may be used to output the execution result of the processor 1301 .

[0159] It should be noted that the corresponding functions of the processor 1301 and the interface circuit 1302 can be implemented through hardware design, software design, or a combination of hardware and software, and there is no limitation here.

[0160] It should be understood that each step of the above method embodiment can be completed by a hardware-based logic circuit or a software-based instruction in a processor.

[0161] It is understandable that the size of the sequence number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. In addition, in some possible implementations, each step in the above embodiment can be selectively executed according to actual conditions, and can be partially executed or fully executed, which is not limited here.

[0162] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.

[0163] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.

[0164] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0165] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.

Claims

1. A dirty page determination method, characterized in that: The method is applied to a computing device, the computing device comprising a host operating system, and a virtual machine and a target service deployed on the host operating system, the method comprising: Monitoring the state information of the target service; wherein the state information is used to characterize the calling of the target service; When the target service is called, the target service is switched to the virtual machine for execution; wherein, before and after the target service is switched, the running site state corresponding to the target service is the same, and the page table used by the target service in the virtual machine is the same as the page table used by the target service when running on the host operating system; Based on the page modification record PML mechanism in the virtual machine, dirty pages generated by the running of the target service are recorded.

2. The method according to claim 1, characterized in that: The virtual machine includes an extended page table EPT; wherein the EPT includes an identity mapping relationship; the identity mapping relationship is used to map the physical address of the virtual machine to the physical address of the computing device; After switching the target service to the virtual machine for execution, the method further includes: Determine the physical address of the computing device corresponding to the physical address of the virtual machine accessed by the target service through the identity mapping relationship of the extended page table EPT; Based on the physical address of the computing device, a write operation of the target service is performed.

3. The method according to claim 1 or 2, characterized in that: Switching the target service to the virtual machine for execution includes: Determine the running site of the target service in the virtual machine, wherein the running site of the virtual machine is the same as the site state of the target service when it is running on the host operating system; The target service is scheduled to run in the virtual machine.

4. The method according to any one of claims 1 to 3, characterized in that: Before switching the target service to the virtual machine for execution, the method further includes: Determine an operating mode of the computing device; the operating mode includes a virtual machine mode and a non-virtual machine mode; When the computing device is running in the non-virtual machine mode, the target service is switched to run in the virtual machine.

5. The method according to claim 4, characterized in that Determining the operating mode of the computing device includes: Get the return result of the CPUID instruction; The operating mode of the computing device is determined according to the return result of the CPUID instruction.

6. The method according to claim 4, characterized in that The computing device includes a first memory page and a second memory page; wherein, in a virtual machine mode, the first memory page corresponds to a predetermined physical memory page; In non-virtual machine mode, the second memory page corresponds to the predetermined physical memory page; Determining the operating mode of the computing device includes: Accessing the predetermined physical memory page; The operation mode of the computing device is determined according to the content of the target memory page corresponding to the predetermined physical memory page, wherein the target memory page is the first memory page or the second memory page.

7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: Obtain configuration information; the configuration information is used to indicate whether to enable dirty page tracking for the target service; In a case where the configuration information indicates that dirty page tracking for the target service is enabled, the dirty pages generated by the write operation are recorded based on the PML mechanism of the virtual machine.

8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: When the virtualization exit conditions are met, the target service is switched from the virtual machine to the host operating system for operation; wherein the exit conditions include that dirty page tracking is not required, the target service stops running, or the buffer for recording the dirty pages is full.

9. The method according to any one of claims 1 to 8, characterized in that: The method comprises: When a migration condition is met, the dirty page is migrated to a target computing device, wherein the migration condition includes that the number of dirty pages is lower than a preset value, or the estimated transmission time is lower than a preset threshold.

10. A computing device, characterized in that include: Memory and processor; The memory is used to store program instructions; The processor is configured to execute program instructions stored in the memory so as to enable the computing device to implement the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Dirty page recording method during virtual machine migration based on customized TLB substitution

    CN112559393A

  • PML-based virtual machine page table tracking method and system

    CN115576643A