WO2020177567A1 - Method, apparatus, and system for migrating data - Google Patents

Method, apparatus, and system for migrating data Download PDF

Info

Publication number
WO2020177567A1
WO2020177567A1 PCT/CN2020/076476 CN2020076476W WO2020177567A1 WO 2020177567 A1 WO2020177567 A1 WO 2020177567A1 CN 2020076476 W CN2020076476 W CN 2020076476W WO 2020177567 A1 WO2020177567 A1 WO 2020177567A1
Authority
WO
WIPO (PCT)
Prior art keywords
migration
processor
buffer area
identification
identifier
Prior art date
Application number
PCT/CN2020/076476
Other languages
French (fr)
Chinese (zh)
Inventor
刘晓建
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2020177567A1 publication Critical patent/WO2020177567A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0659Command handling arrangements, e.g. command buffers, queues, command scheduling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines

Definitions

  • This application relates to the field of computer technology, and in particular to a method, device and system for migrating data.
  • the central processing unit (CPU) of the host when migrating the data stored in the memory of the host to the destination host, the central processing unit (CPU) of the host obtains the stored data from the memory of the host, and then sends the obtained data to the destination host through the network card of the host. Therefore, the current operation of migrating data in the memory of the host is mainly performed by the CPU of the host, and therefore requires a large amount of CPU resources of the host.
  • the embodiments of the present application provide a method, device and system for migrating data to reduce the consumption of CPU resources.
  • the following introduces the solutions provided by this application through different aspects. It should be understood that the implementation modes and beneficial effects of different aspects can be referred to each other.
  • the present application provides a method for migrating data.
  • the method is applied to a host that includes a processor, a memory, and a migration component.
  • the processor is used to run an application instance, and the memory includes access for the application instance.
  • the migration component sends a migration command to the processor, and the migration command is used to trigger the processor to generate an identification set, and the identification set includes the information in the application access area
  • the identification of the at least one storage unit to be migrated obtaining the identification set; sending the data stored in the storage unit corresponding to the identification in the identification set. Since the data transmission is completed by the migration component, the processor only needs to generate an identification set, so that part of the migration operation of the processor is shared by the migration component, thereby reducing the consumption of processor resources.
  • a central processing unit (CPU) is used as an example to introduce the processor, and the CPU is mainly widely used in desktop computers, notebooks, servers, and the like.
  • CPU central processing unit
  • this application can reduce CPU resource consumption.
  • this application can also be extended to other processors that need to reduce resource consumption, such as application processors on terminals or other processor types that have not yet been developed, and this application does not limit this.
  • the identifier set includes an identifier of each storage unit in the application access area.
  • This situation usually occurs when the migration component sends a migration command to the processor for the first time.
  • the processor first receives a migration command for an application instance sent by the migration component, since it is not sure which data in the application access area should be migrated, the identification set includes each storage unit in the application access area , So you can avoid missing data.
  • the identifier set includes the identifiers of the n storage units whose data is written by the application instance in the application access area from the first time to the current time (that is, when For the n storage units that have been modified within this period of time), the first time is the last time the processor generated the identification set.
  • n is an integer, n is greater than or equal to 1 and less than or equal to the total number of storage cells included in the application access area.
  • the processor can record the modified storage units (such as dirty pages) after receiving the migration command for the first time, and then use the identification set to instruct the migration component to migrate only the modified storage units during the next migration, avoiding repeated migration of unmodified storage Unit to improve the accuracy of migration and reduce the power consumption of migration components.
  • modified storage units such as dirty pages
  • the processor no matter how many times the processor receives the migration command sent by the migration component, it sends the identifier of each storage unit in the application access area to the migration component to facilitate migration. All data in the access area of the component migration application. This can avoid missing data.
  • the migration component includes an interrupt interface and a migration control interface, and the migration component writes a migration command to the migration control interface; and sends a migration command to the processor through the interrupt interface. Sending an interrupt signal, where the interrupt signal is used to trigger the processor to read the migration command from the migration control interface. In this way, the migration command is sent to the processor.
  • the migration component includes a status notification interface, and the migration component reads collection generation completion information from the status notification interface, and the collection generation completion information is the processing
  • the device writes the identification set into the status notification interface after writing the identification set into the interaction buffer area; the migration component reads the identification set from the interaction buffer area. In this way, the identification set provided by the processor is obtained.
  • the migration component when the host is started, receives initialization information sent by the processor, and the initialization information includes the address and space size of the interaction buffer area.
  • the migration component determines the interaction buffer area according to the address and space size of the interaction buffer area, and reads the identification set from the interaction buffer area. In this way, the identification set provided by the processor is obtained.
  • the interaction buffer area includes a plurality of buffer areas
  • the set generation completion information carries an identifier of the buffer area
  • the buffer area is the processor from the plurality of buffer areas.
  • the buffer area selected in the buffer area, the buffer area selected by the processor is different from the buffer area selected last time by the processor; the buffer area corresponding to the identifier of the buffer area selected by the processor is read Identity collection. In this way, the identification set provided by the processor is obtained.
  • the migration component when the total capacity of the storage unit corresponding to each identifier in the identifier set does not exceed a preset threshold, the migration component sends a migration stop command to the processor
  • the stop migration command is used to trigger the processor to stop running the application instance.
  • the total capacity of the storage unit corresponding to each identifier in the identifier set does not exceed the preset threshold, it indicates that the data migration is complete, and the application instance can be started on the destination host, and the migration stop command can be sent to the processor to make the processor Stop running the user instance and perform subsequent operations to maintain the host.
  • the present application provides a method for migrating data.
  • the method is applied to a host that includes a processor, a memory, and a migration component.
  • the processor is used to run an application instance, and the memory includes access for the application instance.
  • the processor receives the migration command sent by the migration component; generates an identification set according to the migration command, and the identification set includes at least the to-be-migrated in the application access area An identifier of a storage unit; the migration component is provided with the identifier set so that the migration component sends the data stored in the storage unit corresponding to the identifier in the identifier set. Since the identifier set is provided to the migration component, the migration component sends the data stored in the storage unit corresponding to the identifiers in the identifier set, so that the migration component shares part of the processor migration operation, thereby reducing the consumption of processor resources.
  • the processor receives the interrupt signal sent by the migration component through the interrupt interface; reads the migration command from the migration control interface according to the interrupt signal, so The migration command is written into the migration control interface by the migration component before sending the interrupt signal. In this way, the migration command is received.
  • the processor when the migration command is a migration command received by the processor for the first time, the processor generates a first set of identifiers, and the migration command is the migration command. Sent when the component determines to start migrating the data stored in the application access area, the first identification set includes an identification of each storage unit in the application access area. At the beginning of the migration, since the processor does not know which data in the application access area should be migrated, the first identification set includes the identification of each storage unit in the application access area, which can avoid missing data.
  • the processor records the time of the last migration to the current time, and during this period of time, the application access area has n storages where data is written by the application instance. The identity of the unit.
  • the processor receives the migration command for the xth time, the processor generates a third identification set, and the migration command is the storage unit corresponding to the identification in the second identification set sent by the migration component
  • the second identifier set is the identifier set generated last time by the processor
  • the third identifier set includes the identifier set in the application access area from the first time to the current time.
  • the identification of the n storage units where the application instance writes data is the first time is the time when the processor generates the second identification set, n is an integer, n is greater than or equal to 1 and less than or equal to the application access The total number of storage cells included in the area. Since the third set of identifiers includes the identifiers of the n storage units that are written by the application instance in the application access area from the first time to the current time, the migration is thus transferred from the first time to the current time.
  • the data stored in the storage unit where the data is written improves the accuracy of data migration and reduces the power consumption of the migration component.
  • the migration component includes a status notification interface
  • the memory further includes an interactive buffer area
  • the processor writes the set of identifiers into the interactive buffer area, and Write set generation completion information in the status notification interface, where the set generation completion information is used to trigger the migration component to obtain the identification set from the interaction buffer area. In this way, the identification set is provided to the migration component.
  • the interactive buffer area includes multiple buffer areas
  • the processor selects a buffer area from the multiple buffer areas, and the selected buffer area is connected to the The last time the processor selected a different buffer area, writes the set of identifiers into the selected buffer area, and writes set generation completion information on the status notification interface, and the set generation completion information carries the The ID of the selected buffer.
  • this application provides a data migration device (or called a migration component), which is used to execute the first aspect or the method in any one of the possible implementations of the first aspect.
  • the device includes one or more units for executing the first aspect or any one possible implementation method of the first aspect.
  • the device can be a network card or a device in the network card.
  • the present application provides a processor configured to execute the second aspect or the method in any possible implementation manner of the second aspect.
  • the device includes one or more units for executing the second aspect or any one possible implementation method of the second aspect.
  • this application provides a device for migrating data.
  • the device includes a processor, a memory, an interrupt interface, a migration control interface, a status notification interface, a setting interface, a DMA interface, and a network transceiver interface.
  • the processors are respectively Connect with memory, interrupt interface, migration control interface, status notification interface, setting interface, DMA interface and network transceiver interface.
  • the memory stores one or more programs, the one or more programs are configured to be executed by the processor, and the one or more programs include any one of the first aspect or the first aspect. Instructions for possible implementation methods.
  • the present application provides a computer program product.
  • the computer program product includes a computer program stored in a computer-readable storage medium, and the calculation program is loaded by a processor to implement the first aspect and the first aspect.
  • the second aspect any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect.
  • this application provides a non-volatile computer-readable storage medium for storing a computer program that is loaded by a processor to execute the above-mentioned aspects of the first, second, and first aspects. Instructions for any possible implementation or any possible implementation of the second aspect.
  • the present application provides a chip, the chip includes a logic circuit, and the logic circuit may be a programmable logic circuit.
  • the chip When the chip is running, it is used to implement the foregoing first aspect, second aspect, any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect.
  • the present application provides a chip that includes one or more physical cores and a storage medium, and the one or more physical cores implement the above-mentioned first after reading computer instructions in the storage medium.
  • the second aspect any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect.
  • the present application provides a computer system that includes a memory, the data migration device described in the third aspect, and the processor described in the fourth aspect.
  • FIG. 1 is a schematic diagram of a network architecture provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a host structure provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of another host structure provided by an embodiment of the present application.
  • FIG. 4 is a flowchart of a method for migrating data provided by an embodiment of the present application.
  • FIG. 5 is a sequence diagram of data migration provided by an embodiment of the present application.
  • FIG. 6 is a flowchart of another data migration method provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a data migration device provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a processor provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a system structure for migrating data provided by an embodiment of the present application.
  • the present application provides a network architecture including a source host and a destination host.
  • a network connection is established between the source host and the destination host, and the network connection may be a wired connection or a wireless connection.
  • the application instance may be a bare metal virtualization instance, such as an AWS (Amazon Web Services) i3.meal instance, an Facebook Dragon cloud server instance, and a Microsoft Azure bare metal server instance.
  • AWS Amazon Web Services
  • the memory of the source host may be the memory or disk of the source host.
  • the memory of the source host uses the memory of the source host as an example to illustrate how to migrate data stored in the memory of the source host to the destination host.
  • the memory of the source host includes storage units as memory pages.
  • a person of ordinary skill in the art can replace the memory in any of the following embodiments with a disk, and replace the memory page with a storage unit of the disk, or combine some adaptive changes to obtain the disk of the source host.
  • the detailed scheme for migrating the data stored in the data to the destination host is not described in detail in this application.
  • the host may be the source host in the network architecture shown in FIG. 1.
  • the host may be a server, a personal computer (PC), or a notebook.
  • CPU1 memory 2, migration part 3 and main board (shown in the figure).
  • the CPU1, the memory 2 and the migration component 3 are connected through a motherboard.
  • the motherboard includes a system bus, and the CPU1, the memory 2 and the migration component 3 can be connected through the system bus in the motherboard.
  • the memory 2 includes a non-overlapping code storage area 21, an interactive buffer area 22, and an application access area 23.
  • the code storage area 21 can store the implementation code of the application instance and the implementation code of the memory page collection module.
  • the implementation code of the application instance can be called and run by CPU1.
  • the application instance can access the application access area 23.
  • that the application instance accesses the application access area 23 means that the CPU 1 can write data to the application access area 23 and/or read data from the application access area 23 when the CPU 1 runs the application instance.
  • the implementation code of the memory page collection module can be called and run by the CPU1.
  • the CPU1 When the memory page collection module is running, the CPU1 generates an identification set through the memory page collection module.
  • the identification set includes the identification of the memory page to be migrated in the application access area 23.
  • the CPU 1 obtains the identification of the memory page to be migrated from the application access area 23 by running the memory page collection module, and composes the obtained identification into an identification set.
  • Migrating the data in the memory of the source host to the destination host refers to migrating the data in the user access area 23 of the source host to the destination host.
  • the interaction buffer 22 is used to store the identification set. That is, after the CPU 1 generates the identification set, the identification set can be written into the interaction buffer area 22.
  • the host may also include a disk or other types of external storage devices, and the disk may be connected to the CPU 1, the memory 2 and the migration component 3 through the system.
  • the disk can save the implementation code of the application instance and the implementation code of the memory page collection module.
  • the CPU1 can read the implementation code of the application instance and the implementation code of the memory page collection module from the disk, and store the implementation code of the application instance And the implementation code of the memory page collection module is loaded into the code storage area 21.
  • the migration component 3 When the source host starts to migrate the data in the memory of the source host to the destination host, the migration component 3 sends a migration command to CPU1, and CPU1 receives the migration command, generates an identification set through the memory page collection module according to the migration command, and sends data to The migration component 3 provides this identification set. After obtaining the identification set, the migration component 3 sends to the destination host the data stored in the memory page corresponding to the identification in the identification set.
  • the migration component 3 includes a processor 31, an interrupt interface 32, a migration control interface 33, a status notification interface 34, a setting interface 35, a direct memory access (DMA) interface 36, a network transceiver interface 37 and Storage 38.
  • the processor 31 is connected to the interrupt interface 32, the migration control interface 33, the status notification interface 34, the setting interface 35, the DMA interface 36, the network transceiver interface 37 and the memory 38 respectively.
  • the CPU 1 may send initialization information to the migration component 3, and the initialization information may include information such as interrupt mode, command code, address of the interactive buffer area, and space size.
  • the command code may include migration commands and so on.
  • the interactive buffer area may include a plurality of buffer areas of equal size, and the address of the interactive buffer area includes the address of each buffer area.
  • the interactive buffer area includes a first buffer area and a second buffer area, and the address of the interactive buffer area includes the address of the first buffer area and the address of the second buffer area.
  • the processor 31 may receive the initialization information sent by the CPU 1 through the setting interface 35, and store the initialization information in the memory 38.
  • the processor 31 may send a migration command to the CPU1 through the interrupt interface 32 and the migration control interface 33 according to the interrupt mode stored in the memory 38; obtain the identification set provided by the CPU1 through the status notification interface 34; and through the DMA interface 36 and The network transceiver interface 37 sends the data stored in the memory page corresponding to the identifier in the identifier set.
  • the interrupt interface 32, the migration control interface 33, the status notification interface 34, the setting interface 35, and the DMA interface 36 can be five different registers in the migration component 3, or the interrupt interface 32, the migration control interface 33, and the status The notification interface 34, the setting interface 35, and the DMA interface 36 can be five different storage areas in the memory 2.
  • the five storage areas are the code storage area 21, the interactive buffer area 22, and the application access area 23 in the memory 2. Other areas.
  • the migration component 3 may be integrated on the network card of the host.
  • the network transceiver interface 37 may be a network port on the network card.
  • the migration component 3 may be a board card, which can be plugged into the main board.
  • the migration component 3 may include a network transceiver interface 37, or the network card of the host may be used as the network transceiver interface 37 of the migration component 3.
  • the board may be a high-speed serial computer expansion bus standard (peripheral component interconnect express, PCIe) board.
  • the CPU 1 can run the first instruction for data migration to receive the migration command sent by the migration component 3, call and run the implementation code of the memory page collection module, and generate an identification set through the memory page collection module.
  • the first instruction may be stored in a disk, and the CPU 1 may call and execute the instruction.
  • the first instruction may be solidified in CPU1, and CPU1 may directly run the instruction.
  • the processor 31 included in the migration component can run a second instruction for migrating data to implement operations such as sending a migration command to CPU1, obtaining an identifier set, and sending data stored in a memory page corresponding to an identifier in the identifier set. .
  • the second instruction may be stored in the memory 38 of the migration component 3 or the disk of the host, and the processor 31 may call the second instruction from the memory 38 or the disk of the host and run the second instruction.
  • the second instruction may be solidified in the processor 31, and the processor 31 may directly execute the second instruction.
  • an embodiment of the present application provides a method for migrating data, which can be applied to the host provided in the embodiments shown in FIGS. 2 and 3 above.
  • Step 301 The migration component sends a migration command to the CPU for the first time, which is referred to as a start migration command below.
  • the migration component, memory, and CPU belong to the same host, and the migration component, memory, and CPU are connected through the mainboard of the host.
  • the CPU is used to run an application instance, and the application instance can access the application access area of the memory when the CPU runs the application instance. For example, the application instance can write data to the application access area or read data from the application access area.
  • the memory of the host also includes a code storage area, and the code storage area includes implementation codes of application examples.
  • the CPU can call and run the implementation code of the application instance to realize the operation of the application instance.
  • the application access area includes the data written by the application instance at runtime, so that the destination host can be based on The data starts and continues to run the application instance.
  • the user can input a trigger command to the migration component on the host.
  • the migration component receives the trigger command, and sends a start migration command to the CPU in response to the trigger command.
  • the migration components include a processor, an interrupt interface, a migration control interface, a status notification interface, a setting interface, a DMA interface, a memory, and a network transceiver interface.
  • the migration component writes a migration command to the migration control interface, and then sends an interrupt signal to the CPU through the interrupt interface; the CPU receives the interrupt signal, pauses and continues to run the application instance according to the interrupt signal, and migrates from the migration component
  • the migration command is read in the control interface, so the migration component realizes sending the start migration command to the CPU.
  • the CPU may send initialization information to the migration component, and the initialization information may include information such as interrupt mode, command code, address of the interactive buffer area, and space size.
  • the command code can include a migration command and a stop migration command.
  • the interactive buffer area may be a storage area.
  • the interactive buffer area may include a plurality of buffer areas of equal size, and the address of the interactive buffer area includes the address of each buffer area.
  • the interactive buffer area includes a first buffer area and a second buffer area, the address of the interactive buffer area includes the address of the first buffer area and the address of the second buffer area, and the size of the space in the initialization information is the space of the first buffer area Size and the space size of the second buffer area.
  • the initialization information may further include an identifier of the first buffer area corresponding to the address of the first buffer area, and an identifier of the second buffer area corresponding to the address of the second buffer area.
  • the identifier of the buffer area may be the address of the buffer area or the number of the buffer area.
  • the interrupt mode may include a system management interrupt (SMI) interrupt mode and a non-maskable interrupt (NMI) interrupt mode.
  • SMI system management interrupt
  • NMI non-maskable interrupt
  • the interrupt mode is the NMI interrupt mode.
  • the processor of the migration component may receive the initialization information sent by the CPU through the setting interface, and save the initialization information in the memory of the migration component.
  • the processor of the migration component can read the interrupt mode and migration command from the memory of the migration component, write the migration command to the migration control interface, and send an interrupt signal to the CPU through the interrupt interface according to the interrupt mode.
  • the read interrupt mode includes SMI interrupt mode and NMI interrupt mode
  • the first interrupt signal is sent to the CPU through the interrupt interface
  • the NMI interrupt mode Send a second interrupt signal to the CPU through the interrupt interface.
  • the read interrupt mode includes the NMI interrupt mode
  • the NMI interrupt mode the second interrupt signal is sent to the CPU through the interrupt interface.
  • the memory page collection module may also be referred to as a dirty page collection module.
  • the application instance runs in a non-virtualized mode.
  • the dirty page collection module appears as a component of the host's Basic Input Output System (BIOS) and resides in a system that can only be accessed by x86 In the memory accessible by the System Management Mode (SMM) mode.
  • BIOS Basic Input Output System
  • SMM System Management Mode
  • the migration component is a network card that contains the function of data migration.
  • the migration control interface, status notification interface, and setting interface are all embodied as different registers exposed by the network card to the host.
  • the internal storage space includes the private registers and private storage inside the device.
  • Space, the private register is used to store the setting information of the host CPU for this network card: the method of sending interrupts, the physical address and length of the information exchange buffer, etc.
  • the private storage space is used to cache dirty page information.
  • Step 302 The CPU receives the migration command and generates a first identification set, where the first identification set includes the identification of each memory page in the application access area.
  • the CPU After the CPU receives the migration command, it can obtain the identifier of each memory page in the application access area, and compose the identifier of each memory page into the first identifier set.
  • the space size of each memory page in the application access area can be equal or unequal.
  • the identification of the memory page may be the starting address of the memory page; or, each memory page in the application access area may be sequentially numbered in advance, and the identification of the memory page may also be the number of the memory page.
  • the application access area saves the data written by the application instance, but because the CPU does not know which memory pages in the application access area store the data that should be migrated when the migration starts, the CPU will be in the application access area when the migration starts All memory pages in are determined as memory pages to be migrated, and the identifier of each memory page in the application access area is obtained, and the identifiers in each memory are formed into a first identifier set.
  • the code storage area may also include the implementation code of the memory page collection module.
  • the CPU suspends running the application instance, calls and runs the implementation code of the memory page collection module, and obtains application access by running the memory page collection module
  • the identifier of each memory page in the area composes the identifier of each memory page into the first identifier set.
  • the CPU receives the first interrupt signal, switches the host to the virtual state according to the first interrupt signal, and then receives the second interrupt signal, and stops running the application instance according to the second interrupt signal. , Read the migration command from the migration control interface to realize the reception of the migration command.
  • the CPU receives the second interrupt signal, stops running the application instance according to the second interrupt signal, and reads the migration command from the migration control interface to Realize receiving the migration command.
  • the host When the application instance is a bare metal instance, the host will remain in the virtual state after the host is switched to the virtual state. When the application instance is a virtual machine, the host will be in the virtual state. When the host is in a virtual state, after the CPU generates the first identification set, the attribute of each memory page in the application access area may also be set to write protection. After the properties of the memory page are set to write protection, while the CPU continues to run the application instance, when the application instance writes data to the memory page, the CPU can learn that the memory page is written by the application instance and record the The identifier of the memory page.
  • the CPU may record the learned identifier of the memory page in a storage area in the memory, where the storage area is a storage area in the memory excluding the code storage area, the interaction buffer area, and the application access area.
  • Step 303 The CPU provides the first identification set to the migration component.
  • the memory may also include an interactive buffer area.
  • the CPU may write the first set of identifiers to the interactive buffer area, and write the set to the status notification interface of the migration component to generate a complete message to provide the migration component with the first identifier. set.
  • the interactive buffer area includes a first buffer area and a second buffer area with equal spaces.
  • the CPU selects a buffer area from the first buffer area and the second buffer area, writes the first identification set into the selected buffer area, and writes the set generation completion message to the status notification interface of the migration component.
  • the generated completion message carries the identifier of the selected buffer area.
  • the application instance may continue to run.
  • Step 304 The migration component obtains the first set of identifiers provided by the CPU.
  • the migration component reads the set generation completion message from its status notification interface, generates the completion message according to the set, and reads the first identification set from the interaction buffer area.
  • the status notification interface may be a register in the migration component.
  • the processor of the migration component can find that the status notification interface is written with the message. And read the collection generation completion message from the status notification interface.
  • the status notification interface can be a storage area in the memory. After the processor of the migration component sends the start migration command, it periodically or irregularly reads the status notification interface, and when the CPU writes to the status notification interface, the set generation is completed After the message, the processor of the migration component reads the set generation completion message from the state notification interface.
  • the processor of the migration component reads the address and space size of the interaction buffer area from the memory of the migration component, and determines the interaction buffer area in the memory according to the address and space size. Read the first set of identifiers from the interactive buffer area.
  • the set generation completion message read by the migration component also carries the identifier of the buffer area selected by the CPU, and the address and address of the buffer area corresponding to the identifier are obtained from the memory of the migration component.
  • the size of the space, the buffer area in the memory is determined according to the address and the size of the space, and the first identification set is read from the buffer area.
  • Step 305 The migration component (to the destination host) sends the data stored in the memory page corresponding to the identifier in the first identifier set. Specifically, when the total capacity of the memory page corresponding to each identifier in the first identifier set exceeds a preset threshold, the migration component sends the data stored in the memory page corresponding to the identifier in the first identifier set.
  • the preset threshold is usually less than the capacity of the application access area.
  • the size of each memory page in the memory is equal, and the initialization information sent by the CPU to the migration component may include the size of the memory page.
  • the processor of the migration component receives the initialization information sent by the CPU through the setting interface, and saves the initialization information in the memory of the migration component.
  • the processor of the migration component can read the size of the memory page from the memory of the migration component, and obtain each identifier in the first identifier set according to the number of identifiers included in the first identifier set and the size of the memory page.
  • the total capacity of the corresponding memory page determines whether the total capacity exceeds the preset threshold.
  • the size of each memory page in the memory varies, and the initialization information sent by the CPU to the migration component may include the identification and size of each memory page.
  • the processor of the migration component receives the initialization information sent by the CPU through the setting interface, and stores the initialization information in the memory of the migration component, that is, the memory page identifier and the memory page identifier corresponding to the memory page identifier are stored in the memory of the migration component The size of the memory page.
  • the processor of the migration component can read the size of the memory page corresponding to each identifier included in the first identifier set from the memory of the migration component, and obtain the first memory page size according to the size of the memory page corresponding to each identifier.
  • the total capacity of the memory page corresponding to each identifier in the identifier set is determined, and it is determined whether the total capacity exceeds a preset threshold.
  • the processor of the migration component can read data from the memory page corresponding to the identifier through the DMA interface according to the identifier in the first identifier set, and send the read data to the destination host through the network transceiver interface.
  • the processor of the migration component may select at least one identifier from the first set of identifiers, the total capacity of the memory page corresponding to each selected identifier is less than or equal to the maximum allowable capacity, and the memory page corresponding to each selected identifier is sent Data saved inside.
  • the migration component may be a PCI device with network transmission capability, which may also be called an intelligent network card, including an internal processor, a network card, and a memory; PCI space interface registers.
  • the PCI space interface register supports the processor to input the address of the dirty page information, and supports the output of the current working status to the processor.
  • the dirty page information is the memory page in the memory where data is written by the application instance.
  • the internal processor sends an SMI interrupt signal to the CPU through the interrupt sending interface, and updates the device status to: notify the CPU to enter the dirty page tracking state.
  • the dirty page information address is obtained from the CPU, the dirty page information is read from the CPU by DMA and stored in the internal memory, and then the dirty pages registered in the internal memory are scanned and transferred to the destination host through DMA.
  • SMI interrupt processing program function is: according to the self-developed hardware state, decide to perform one of the following actions; return SMI interrupt processing to vmx non-root state to continue execution
  • the instruction before the SMI interrupt occurs enables the dirty page tracking function of the user instance, and stores the dirty page information in the memory area accessible by self-developed hardware, the storage space of the EPT page table and the storage space of dirty page information.
  • the migration component After the migration component obtains the identification set, it takes a period of time to send the data stored in the memory page corresponding to the identification in the identification set.
  • the application instance continues to run during the process of sending data. During the operation, the application instance may also send the data to the application
  • the access area writes data, so after completing a data transmission, you can continue to migrate the memory data through the following steps 401 to 407, see Figure 6, the steps 401 to 407 are:
  • Step 401 After sending the data stored in the memory page corresponding to the identifier in the second identifier set, the migration component sends a migration command to the CPU.
  • the following migration command is also referred to as a memory page acquisition command, which is used to acquire dirty page information.
  • the second identification set is the identification set acquired by the migration component last time, that is, the identification set generated by the CPU last time.
  • the last identifier set generated by the CPU is the first identifier set
  • the second identifier set is the same as the first identifier set.
  • the processor of the migration component can read the NMI interruption mode and migration command from the memory of the migration component, write the migration command to the migration control interface, and send the first migration command to the CPU through the interrupt interface according to the NMI interruption mode. 2. Interrupt signal.
  • the host is already in a virtual state at this time, so the processor of the migration component sends a second interrupt signal to the CPU according to the NMI interrupt mode.
  • Step 402 The CPU receives the migration command and generates a third identification set.
  • the third identification set includes the identifications of the n memory pages that are written by the application instance in the application access area from the first time to the current time, and n is greater than or equal to 1 and less than or equal to the total number of memory pages included in the application access area.
  • the first time is determined based on the time when the CPU generates the second identification set.
  • the first time is the time when the CPU generates the second identification set. Specifically, whether it is before, after, or at the same time when the second identification set is generated, this embodiment does not do it. limited.
  • the CPU receives the interrupt signal, stops running the application instance according to the interrupt signal, and reads the migration command from the migration control interface to realize the reception of the migration command.
  • the CPU After the CPU receives the migration command, since the migration command is the migration command received the xth time, the CPU obtains the identifier of the memory page recorded between the first time and the current time according to the trigger of the migration command received the xth time.
  • the identifiers of the acquired memory pages are formed into a third identifier set, and x is an integer greater than 1.
  • the CPU suspends running the application instance, calls and runs the implementation code of the memory page collection module, and obtains the identification of the memory page recorded between the first time and the current time by running the memory page collection module , Compose the acquired identifiers of the memory pages into a third identifier set.
  • the CPU may delete the recorded identification.
  • the attribute of each memory page in the application access area is set to write protection.
  • the CPU can learn that the memory page is written by the application instance when the application instance writes data to the memory page while the CPU continues to run the application instance, and record the The identifier of the memory page.
  • auxiliary storage required for dirty page collection Space such as a storage area used to record dirty pages
  • buffers for information interaction with migration components for example, for CPU to write dirty page information or migration components write control commands, such as interactive buffers, migration components included Interrupt interface, migration control interface, status notification interface, setting interface, DMA interface, and adjust the range of physical memory accessible to the application instance to ensure that the application instance cannot access this memory space; and to set the host's CPU so that After the CPU receives the interrupt issued by the migration component, it will immediately interrupt the operation of the application instance and immediately transfer control to the interrupt processing entry of the dirty page collection module for execution.
  • Write the communication method expected by the dirty page collection module to the migration component for example, the physical memory address of the allocated information exchange buffer is 0x100000 and the length is 8192 bytes; the dirty page collection module expects to obtain notification through the
  • Step 403 The CPU provides a third identification set to the migration component.
  • the CPU may write the third identification set to the interaction buffer area, and write the set generation completion message to the status notification interface of the migration component, so as to provide the third identification set to the migration component.
  • the interactive buffer area includes a plurality of buffer areas of equal size.
  • the CPU selects a buffer area from multiple buffer areas, and the selected buffer area is different from the last selected buffer area by the CPU, and writes the third set of identifiers into the selected buffer area to transfer the status of the component
  • the notification interface writes a set generation complete message, and the set generation complete message carries the identifier of the selected buffer area.
  • the interactive buffer area includes a first buffer area and a second buffer area with equal spaces.
  • the CPU selects a buffer area from the first buffer area and the second buffer area.
  • the application instance can continue to run.
  • Step 404 The migration component obtains a third identifier set provided by the CPU, and the third identifier set includes the identifiers of the n memory pages.
  • the migration component reads the set generation completion message from its state notification interface, generates the completion message according to the set, and reads the third identification set from the interaction buffer area.
  • the status notification interface may be a register in the migration component.
  • the processor of the migration component can find that the status notification interface is written with the message. And read the collection generation completion message from the status notification interface.
  • the status notification interface can be a storage area in the memory. After sending the migration command, the processor of the migration component will periodically or irregularly read the status notification interface.
  • the processor of the migration component reads the set generation completion message from the state notification interface.
  • the processor included in the migration component reads the address and space size of the interaction buffer area from the memory included in the migration component, and determines the interaction buffer in the memory according to the address and space size Area, read the third identification set from the interactive buffer area.
  • the set generation completion message read by the processor of the migration component carries the identifier of the buffer area selected by the CPU, and the processor of the migration component obtains the identifier from the memory of the migration component.
  • the address and space size of the corresponding buffer area, the buffer area selected by the CPU is determined according to the address and the space size, and the third set of identifiers is read from the determined buffer area.
  • Step 405 The migration component judges whether the total capacity of the n memory pages exceeds a preset threshold, if it exceeds, execute step 406, and if it does not exceed, execute step 407.
  • the size of each memory page in the memory is equal, and the processor of the migration component can read the size of the memory page from the memory of the migration component, according to the number n of identifiers included in the third identifier set and the size of the memory page Obtain the total capacity of the n memory pages, and determine whether the total capacity exceeds a preset threshold.
  • the processor of the migration component can read from the memory of the migration component the size of the memory page corresponding to each identifier included in the third identifier set, according to each Identify the size of the corresponding memory page to obtain the total capacity of the n memory pages, and determine whether the total capacity exceeds a preset threshold.
  • Step 406 The migration component sends the data stored in the memory page corresponding to the identifier in the third identifier set, and returns to perform step 401.
  • the processor included in the migration component can read data from the memory page corresponding to the identifier through the DMA interface according to the identifier in the third identifier set, and send the read data to the destination host through the network transceiver interface.
  • the processor of the migration component may select at least one identifier from the third identifier set, and the total capacity of the memory page corresponding to each selected identifier is less than or equal to the maximum allowable capacity, and sends the memory page corresponding to each selected identifier Data saved inside. This can reduce the amount of data sent twice, so as to reduce the time of sending data twice, and can try to avoid the application instance after writing data to a memory page, the data has not been sent by the migration component and re-reset by the application instance. The written data is overwritten.
  • the processor of the migration component will select the identities in the third identity set. All logos.
  • the processor of the migration component obtains the second identification set, if all the identifications in the second identification set have not been selected, that is, there are still unselected identifications in the second identification set, then the third identification Before selecting the identity in the set, add the unselected identity in the second identity set to the third identity set, and then select the identity from the third identity set.
  • Step 407 The migration component sends a stop migration command to the CPU, sends the data stored in the memory page corresponding to the identifier in the third identifier set, and ends the operation.
  • the processor of the migration component can read the interrupt mode and stop migration command from the memory of the migration component, write the stop migration command to the migration control interface, and send an interrupt signal to the CPU through the interrupt interface according to the interrupt mode .
  • the processor of the migration component may read data from the memory page corresponding to each identifier through the DMA interface according to each identifier in the third identifier set, and send the read data to the destination host through the network transceiver interface.
  • the CPU receives an interrupt signal, stops running the application instance according to the interrupt signal, reads the migration stop command from the migration control interface, and stops running the application instance according to the migration stop command.
  • the total capacity of the n memory pages does not exceed the preset threshold, indicating that the migration component has obtained all the data generated by the application instance, and then continues to run the application instance, the application instance may not generate new data, so you can stop continuing to run the application instance , And after sending the data stored in the memory page corresponding to each identifier in the third identifier set, the host can be shut down.
  • the interactive buffer is used to store dirty page information, that is, the first identification set, the second identification set, or the third identification set. It is divided into two buffer areas of the same size but not overlapping, and one is used for migration components. Dirty page information is obtained by DMA, and the other is used for the dirty page collection module to cache the latest dirty page information.
  • the dirty page collection module informs the migration component from which area to obtain dirty page information through the status notification interface, and uses the other buffer area To cache dirty page information.
  • the SMI interrupt handler is responsible for responding to the SMI interrupt sent by the smart peripheral and setting the current user to run in a virtual state. Specifically, after the SMI interrupt handler obtains control of the CPU due to the SMI interrupt, it executes a process including the following steps:
  • the virtual machine operation support module is similar to the virtual machine monitor (VMM) function in the traditional virtualization technology. It is responsible for ensuring that the user instance can run normally in the non-root state of the x86 processor. When the processor exits the non-root state because of receiving an NMI interrupt, the virtual machine running support module queries the migration control interface. When this interface is set with a valid control command, it calls the dirty page collection module to perform the actions expected by the smart peripheral .
  • VMM virtual machine monitor
  • the smart peripheral first wakes up the dirty page collection module through the SMI interrupt, and then uses the NMI interrupt to communicate with the dirty page collection module because the cost of the SMI interrupt is significantly higher than the NMI interrupt, so the NMI interrupt can also achieve For the purpose, use NMI interrupt instead.
  • the migration component may send a migration command to the CPU, and the CPU suspends running the application instance according to the migration command, and generates an identification set (may be the first identification set or the third identification set), and the identification set includes application access
  • the identification of at least one memory page to be migrated in the area provides the identification set to the migration component, and then continues to run the application instance; the migration component obtains the identification set provided by the CPU, and sends the identification in the identification set to the memory page corresponding to the storage The data. In this way, part of the CPU migration operation is shared by the migration component, thereby reducing the consumption of CPU resources.
  • an embodiment of the present application provides an apparatus 500 for migrating data.
  • the device can be a network card or a migration component integrated on the network card.
  • the device 500 is applied to a host including a CPU, a memory, and the device 500.
  • the CPU is used to run an application instance, and the memory includes an application access area accessed by an application instance.
  • the device 500 includes:
  • the sending unit 501 is configured to send a migration command to the CPU, where the migration command is used to trigger the CPU to generate an identification set, the identification set including an identification of at least one storage unit to be migrated in an application access area;
  • the processing unit 502 is configured to obtain the identification set
  • the sending unit 501 is further configured to send the data stored in the storage unit corresponding to the identifier in the identifier set.
  • the sending unit 501 is configured to:
  • the processing unit 502 When the processing unit 502 determines to start migrating the data stored in the application access area, it sends a migration command to the CPU.
  • the migration command is used to trigger the CPU to generate a first identification set.
  • the first identification set includes the identification of each storage unit in the application access area. .
  • the sending unit 501 is configured to:
  • the sending unit 501 sends the data stored in the storage unit corresponding to the identifiers in the second identifier set, it sends a migration command to the CPU.
  • the second identifier set is the identifier set generated by the CPU last time.
  • the migration command is used to trigger the CPU to generate The third identification set.
  • the third identification set includes identifications of n storage units that are written by the application instance in the application access area from the first time to the current time.
  • the first time is the time when the CPU generates the second identification set, n It is an integer, n is greater than or equal to 1 and less than or equal to the total number of storage cells included in the application access area.
  • the device 500 includes an interrupt interface and a migration control interface
  • the processing unit 502 is further configured to write a migration command to the migration control interface
  • the sending unit 501 is configured to send an interrupt signal to the CPU through the interrupt interface, and the interrupt signal is used to trigger the CPU to read the migration command from the migration control interface.
  • the device 500 includes a status notification interface
  • the memory also includes an interactive buffer area
  • the processing unit 502 is configured to:
  • the interactive buffer area includes a first buffer area and a second buffer area, and the collectively generated information carries the identifier of the buffer area, and the buffer area is a buffer area selected by the CPU from the first buffer area and the second buffer area.
  • CPU selection The buffer area of is different from the buffer area selected last time by the CPU;
  • the processing unit 502 is used for:
  • the identifier set is read from the buffer area corresponding to the identifier of the buffer area selected by the CPU.
  • the sending unit 501 is configured to:
  • a migration stop command is sent to the CPU, and the migration stop command is used to trigger the CPU to stop running the application instance and send the identifier set
  • the identifier in corresponds to the data stored in the storage unit.
  • the sending unit may send a migration command to the CPU to cause the CPU to generate an identification set that includes the identification of at least one storage unit to be migrated in the application access area, and the processing unit obtains the identification set provided by the CPU, Send the data stored in the storage unit corresponding to the identifier in the identifier set.
  • the sending unit and the processing unit share part of the CPU migration operation, thereby reducing the consumption of CPU resources.
  • an embodiment of the present application provides a processor 600 that is applied to a host including a memory, a migration component, and the processor 600, and the processor 600 is configured to run an application instance, and the memory includes For the application access area accessed by the application instance, the processor 600 includes:
  • the receiving unit 601 is configured to receive a migration command sent by the migration component
  • the processing unit 602 is configured to generate an identification set according to the migration command, the identification set including an identification of at least one storage unit to be migrated in the application access area;
  • the processing unit 602 is further configured to provide the identifier set to the migration component, so that the migration component sends the data stored in the storage unit corresponding to the identifier in the identifier set.
  • the migration component includes an interrupt interface and a migration control interface
  • the receiving unit 601 is configured to receive an interrupt signal sent by the migration component through the interrupt interface
  • the processing unit 602 is further configured to read a migration command from the migration control interface according to the interrupt signal, and the migration command is written into the migration control interface by the migration component before sending the interrupt signal.
  • processing unit 602 is configured to:
  • a first identification set is generated.
  • the migration command is sent when the migration component determines to start migrating data stored in the application access area.
  • the first identification set includes application access. The identifier of each storage unit in the area.
  • processing unit 602 is configured to:
  • a third identification set is generated, where x is an integer greater than 1, and the migration command is the storage unit corresponding to the identification in the second identification set sent by the migration component
  • the second identification set is the identification set generated last time by the processing unit 602
  • the third identification set includes n storages where data is written by the application instance in the application access area from the first time to the current time.
  • the identification of the unit, the first time is the time when the processing unit 602 generates the second identification set, n is an integer, and n is greater than or equal to 1 and less than or equal to the total number of storage units included in the application access area.
  • the migration component includes a status notification interface
  • the memory also includes an interactive buffer area
  • the processing unit 602 is configured to:
  • the identification set is written into the interaction buffer area, and the set generation completion information is written in the status notification interface, and the set generation completion information is used to trigger the migration component to obtain the identification set from the interaction buffer area.
  • the interactive buffer area includes a first buffer area and a second buffer area
  • the processing unit 602 is configured to:
  • the identification set is written into the selected buffer area, and the set generation completion information is written in the status notification interface.
  • the set generation completion information carries the identification of the selected buffer.
  • the receiving unit may receive the migration command sent by the migration component, the processing unit suspends running the application instance according to the migration command, and generates an identification set (may be the first identification set or the third identification set), and the identification set Include the identifier of at least one storage unit to be migrated in the application access area, provide the identifier set to the migration component, and then continue to run the application instance; the migration component obtains the identifier set provided by the CPU, and sends the storage corresponding to the identifier in the identifier set Data saved in the unit. In this way, the migration component is used to share part of the migration operation of the processor, thereby reducing the consumption of the processor resources.
  • an identification set may be the first identification set or the third identification set
  • the identification set include the identifier of at least one storage unit to be migrated in the application access area, provide the identifier set to the migration component, and then continue to run the application instance; the migration component obtains the identifier set provided by the CPU, and sends the storage corresponding to the identifier in the
  • an embodiment of the present application provides a system 700 for migrating data, and the system 700 is a computer system.
  • the system 700 includes an apparatus 500 as described in FIG. 7 and a processor 600 as described in FIG. 8.
  • the apparatus 500 may be a migration component 701, and the processor 600 may be a CPU 702.

Abstract

A method, apparatus, and system for migrating data, relating to the technical field of computers. According to the method, migration of data is completed by means of a CPU (1) and a dedicated migration component (3), in which the operation of data migration is transferred from the CPU (1) to the migration component (3), and the CPU (1) only needs to collect information of data to be migrated. By means of the method, the consumption for resources of the CPU (1) can be reduced. The migration component (3) can be integrated on a smart network card, i.e., data migration is completed by means of coordination of the smart network card and the CPU (1).

Description

一种迁移数据的方法、装置及系统Method, device and system for migrating data
本申请要求于2019年3月5日提交的申请号为201910165515.X、发明名称为“一种迁移数据的方法、装置及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed on March 5, 2019 with the application number 201910165515.X and the invention title "A method, device and system for migrating data", the entire content of which is incorporated herein by reference Applying.
技术领域Technical field
本申请涉及计算机技术领域,特别涉及一种迁移数据的方法、装置及系统。This application relates to the field of computer technology, and in particular to a method, device and system for migrating data.
背景技术Background technique
在云计算中,不可避免的会遇到需要对主机(或称服务器)进行停机维护的场景。在对主机进行停机维护之前,为了保证主机中的应用的可用性,需要将该应用迁移到目的主机上继续运行。在迁移应用时,需要将应用在该主机的内存中保存的数据迁移到目的主机,这样在目的主机上使用迁移的数据继续运行该应用。In cloud computing, it is inevitable to encounter scenarios where the host (or server) needs to be shut down for maintenance. Before the host is shut down for maintenance, in order to ensure the availability of the application in the host, the application needs to be migrated to the destination host to continue running. When migrating an application, the data stored in the memory of the host needs to be migrated to the destination host, so that the migrated data is used on the destination host to continue running the application.
目前在向目的主机迁移主机的内存中保存的数据时,主机的中央处理器(Central Processing Unit,CPU)从主机的内存中获取保存的数据,然后通过主机的网卡向目的主机发送获取的数据。所以目前迁移主机的内存中的数据的操作主要由主机的CPU来执行,因此需要消耗主机的大量CPU资源。At present, when migrating the data stored in the memory of the host to the destination host, the central processing unit (CPU) of the host obtains the stored data from the memory of the host, and then sends the obtained data to the destination host through the network card of the host. Therefore, the current operation of migrating data in the memory of the host is mainly performed by the CPU of the host, and therefore requires a large amount of CPU resources of the host.
发明内容Summary of the invention
本申请实施例提供了一种迁移数据的方法、装置及系统,以降低对CPU资源的消耗。下面通过不同的方面介绍本申请提供的方案,应理解的是,不同方面的实现方式和有益效果可互相参考。The embodiments of the present application provide a method, device and system for migrating data to reduce the consumption of CPU resources. The following introduces the solutions provided by this application through different aspects. It should be understood that the implementation modes and beneficial effects of different aspects can be referred to each other.
第一方面,本申请提供了一种迁移数据的方法,所述方法应用于包括处理器、存储器和迁移部件的主机,所述处理器用于运行应用实例,所述存储器包括供所述应用实例访问的应用访问区域,在所述方法中所述迁移部件向所述处理器发送迁移命令,所述迁移命令用于触发所述处理器生成标识集合,所述标识集合包括所述应用访问区域中的待迁移的至少一个存储单元的标识;获取所述标识集合;发送所述标识集合中的标识对应的存储单元内保存的数据。由于数据发送由迁移部件来完成,处理器只需要生成标识集合,这样通过迁移部件分担处理器部分迁移操作,从而可以减少对处理器资源的消耗。In the first aspect, the present application provides a method for migrating data. The method is applied to a host that includes a processor, a memory, and a migration component. The processor is used to run an application instance, and the memory includes access for the application instance. In the method, the migration component sends a migration command to the processor, and the migration command is used to trigger the processor to generate an identification set, and the identification set includes the information in the application access area The identification of the at least one storage unit to be migrated; obtaining the identification set; sending the data stored in the storage unit corresponding to the identification in the identification set. Since the data transmission is completed by the migration component, the processor only needs to generate an identification set, so that part of the migration operation of the processor is shared by the migration component, thereby reducing the consumption of processor resources.
需要说明的是,本申请实施例将处理器以中央处理器CPU为例来介绍,CPU主要广泛应用于台式机、笔记本、服务器等。采用本申请能够降低CPU的资源消耗。显然的,本申请也可以扩展应用到其它需要降低资源消耗的处理器上,比如终端上的应用处理器或其它还未发展出的处理器类型等,本申请对此不做限定。It should be noted that, in the embodiment of the present application, a central processing unit (CPU) is used as an example to introduce the processor, and the CPU is mainly widely used in desktop computers, notebooks, servers, and the like. Using this application can reduce CPU resource consumption. Obviously, this application can also be extended to other processors that need to reduce resource consumption, such as application processors on terminals or other processor types that have not yet been developed, and this application does not limit this.
在第一方面的一种可能的实现方式中,所述标识集合包括所述应用访问区域中的每个存储单元的标识。In a possible implementation of the first aspect, the identifier set includes an identifier of each storage unit in the application access area.
这种情况通常出现在所述迁移部件首次向所述处理器发送迁移命令。在处理器第一次接收到迁移部件发送的针对某个应用实例的迁移命令时,由于并不确定应用访问区域中的 哪些数据应该被迁移,所以标识集合包括应用访问区域中的每个存储单元的标识,这样可以避免遗漏数据。This situation usually occurs when the migration component sends a migration command to the processor for the first time. When the processor first receives a migration command for an application instance sent by the migration component, since it is not sure which data in the application access area should be migrated, the identification set includes each storage unit in the application access area , So you can avoid missing data.
在第一方面的一种可能的实现方式中,所述标识集合包括在第一时间至当前时间内所述应用访问区域中被所述应用实例写入数据的n个存储单元的标识(即在这段时间内被修改的n个存储单元),所述第一时间为所述处理器最近上一次生成标识集合的时间。n为整数,n大于或等于1且小于或等于所述应用访问区域包括的存储单元总数目。In a possible implementation of the first aspect, the identifier set includes the identifiers of the n storage units whose data is written by the application instance in the application access area from the first time to the current time (that is, when For the n storage units that have been modified within this period of time), the first time is the last time the processor generated the identification set. n is an integer, n is greater than or equal to 1 and less than or equal to the total number of storage cells included in the application access area.
这种情况出现在所述迁移部件非首次向所述处理器发送迁移命令的时候。处理器可在首次接收到迁移命令之后记录被修改的存储单元(例如脏页),然后通过标识集合指示迁移部件下一次迁移的时候仅迁移被修改的存储单元,避免重复迁移那些没有修改的存储单元,提高迁移的精确度,降低迁移部件的功耗。This situation occurs when the migration component sends a migration command to the processor for the first time. The processor can record the modified storage units (such as dirty pages) after receiving the migration command for the first time, and then use the identification set to instruct the migration component to migrate only the modified storage units during the next migration, avoiding repeated migration of unmodified storage Unit to improve the accuracy of migration and reduce the power consumption of migration components.
在第一方面的一种可能的实现方式中,无论处理器是第几次接收到迁移部件发送的迁移命令,都将应用访问区域中的每个存储单元的标识发送给迁移部件,以便于迁移部件迁移应用访问区域中的所有数据。这样可以避免遗漏数据。In a possible implementation of the first aspect, no matter how many times the processor receives the migration command sent by the migration component, it sends the identifier of each storage unit in the application access area to the migration component to facilitate migration. All data in the access area of the component migration application. This can avoid missing data.
在第一方面的一种可能的实现方式中,所述迁移部件包括中断接口和迁移控制接口,所述迁移部件向所述迁移控制接口写入迁移命令;通过所述中断接口向所述处理器发送中断信号,所述中断信号用于触发所述处理器从所述迁移控制接口中读取所述迁移命令。如此实现向处理器发送迁移命令。In a possible implementation of the first aspect, the migration component includes an interrupt interface and a migration control interface, and the migration component writes a migration command to the migration control interface; and sends a migration command to the processor through the interrupt interface. Sending an interrupt signal, where the interrupt signal is used to trigger the processor to read the migration command from the migration control interface. In this way, the migration command is sent to the processor.
在第一方面的一种可能的实现方式中,所述迁移部件包括状态通知接口,所述迁移部件从所述状态通知接口中读取集合生成完成信息,所述集合生成完成信息是所述处理器在将所述标识集合写入到所述交互缓冲区域之后写入到所述状态通知接口中的;所述迁移部件从所述交互缓冲区域读取所述标识集合。如此实现获取处理器提供的标识集合。In a possible implementation of the first aspect, the migration component includes a status notification interface, and the migration component reads collection generation completion information from the status notification interface, and the collection generation completion information is the processing The device writes the identification set into the status notification interface after writing the identification set into the interaction buffer area; the migration component reads the identification set from the interaction buffer area. In this way, the identification set provided by the processor is obtained.
在第一方面的一种可能的实现方式中,在所述主机启动时,所述迁移部件接收所述处理器发送的初始化信息,所述初始化信息包括所述交互缓冲区域的地址和空间大小。所述迁移部件根据所述交互缓冲区域的地址和空间大小确定所述交互缓冲区域,从所述交互缓冲区域读取所述标识集合。如此实现获取处理器提供的标识集合。In a possible implementation manner of the first aspect, when the host is started, the migration component receives initialization information sent by the processor, and the initialization information includes the address and space size of the interaction buffer area. The migration component determines the interaction buffer area according to the address and space size of the interaction buffer area, and reads the identification set from the interaction buffer area. In this way, the identification set provided by the processor is obtained.
在第一方面的一种可能的实现方式中,所述交互缓冲区域包括多个缓冲区域,所述集合生成完成信息携带缓冲区域的标识,所述缓冲区域是所述处理器从所述多个缓冲区域中选择的缓冲区域,所述处理器选择的缓冲区域与所述处理器最近上一次选择的缓冲区域不同;从所述处理器选择的缓冲区域的标识对应的缓冲区域中读取所述标识集合。如此实现获取处理器提供的标识集合。In a possible implementation manner of the first aspect, the interaction buffer area includes a plurality of buffer areas, the set generation completion information carries an identifier of the buffer area, and the buffer area is the processor from the plurality of buffer areas. The buffer area selected in the buffer area, the buffer area selected by the processor is different from the buffer area selected last time by the processor; the buffer area corresponding to the identifier of the buffer area selected by the processor is read Identity collection. In this way, the identification set provided by the processor is obtained.
在第一方面的一种可能的实现方式中,在所述标识集合中的每个标识对应的存储单元的总容量未超过预设阈值时,所述迁移部件向所述处理器发送停止迁移命令,所述停止迁 移命令用于触发所述处理器停止运行所述应用实例。在所述标识集合中的每个标识对应的存储单元的总容量未超过预设阈值时,表明数据迁移完成,可以在目的主机上启动该应用实例,向处理器发送停止迁移命令,使处理器停止运行用户实例,并执行后续维护主机的操作。In a possible implementation manner of the first aspect, when the total capacity of the storage unit corresponding to each identifier in the identifier set does not exceed a preset threshold, the migration component sends a migration stop command to the processor The stop migration command is used to trigger the processor to stop running the application instance. When the total capacity of the storage unit corresponding to each identifier in the identifier set does not exceed the preset threshold, it indicates that the data migration is complete, and the application instance can be started on the destination host, and the migration stop command can be sent to the processor to make the processor Stop running the user instance and perform subsequent operations to maintain the host.
第二方面,本申请提供了一种迁移数据的方法,所述方法应用于包括处理器、存储器和迁移部件的主机,所述处理器用于运行应用实例,所述存储器包括供所述应用实例访问的应用访问区域,在所述方法中:所述处理器接收所述迁移部件发送的迁移命令;根据所述迁移命令生成标识集合,所述标识集合包括所述应用访问区域中的待迁移的至少一个存储单元的标识;向所述迁移部件提供所述标识集合,以使所述迁移部件发送所述标识集合中的标识对应的存储单元内保存的数据。由于向迁移部件提供该标识集合,使迁移部件发送该标识集合中的标识对应的存储单元内保存的数据,这样通过迁移部件分担处理器部分迁移操作,从而可以减少对处理器资源的消耗。In a second aspect, the present application provides a method for migrating data. The method is applied to a host that includes a processor, a memory, and a migration component. The processor is used to run an application instance, and the memory includes access for the application instance. In the method: the processor receives the migration command sent by the migration component; generates an identification set according to the migration command, and the identification set includes at least the to-be-migrated in the application access area An identifier of a storage unit; the migration component is provided with the identifier set so that the migration component sends the data stored in the storage unit corresponding to the identifier in the identifier set. Since the identifier set is provided to the migration component, the migration component sends the data stored in the storage unit corresponding to the identifiers in the identifier set, so that the migration component shares part of the processor migration operation, thereby reducing the consumption of processor resources.
在第二方面的一种可能的实现方式中,所述处理器接收所述迁移部件通过所述中断接口发送的中断信号;根据所述中断信号从所述迁移控制接口中读取迁移命令,所述迁移命令是所述迁移部件在发送所述中断信号之前写入到所述迁移控制接口中的。如此实现接收迁移命令。In a possible implementation of the second aspect, the processor receives the interrupt signal sent by the migration component through the interrupt interface; reads the migration command from the migration control interface according to the interrupt signal, so The migration command is written into the migration control interface by the migration component before sending the interrupt signal. In this way, the migration command is received.
在第二方面的一种可能的实现方式中,在所述迁移命令是所述处理器第一次接收的迁移命令时,所述处理器生成第一标识集合,所述迁移命令是所述迁移部件在确定开始迁移所述应用访问区域保存的数据时发送的,所述第一标识集合包括所述应用访问区域中的每个存储单元的标识。在开始迁移时,由于处理器并不知应用访问区域中的哪些数据应该被迁移,所以第一标识集合包括应用访问区域中的每个存储单元的标识,这样可以避免遗漏数据。In a possible implementation manner of the second aspect, when the migration command is a migration command received by the processor for the first time, the processor generates a first set of identifiers, and the migration command is the migration command. Sent when the component determines to start migrating the data stored in the application access area, the first identification set includes an identification of each storage unit in the application access area. At the beginning of the migration, since the processor does not know which data in the application access area should be migrated, the first identification set includes the identification of each storage unit in the application access area, which can avoid missing data.
在第二方面的一种可能的实现方式中,所述处理器记录最近上一次迁移的时间到当前时间,这段时间内所述应用访问区域中被所述应用实例写入数据的n个存储单元的标识。相应的,所述处理器在第x次接收的迁移命令时,所述处理器生成第三标识集合,所述迁移命令是所述迁移部件在发送第二标识集合中的标识对应的存储单元内保存的数据之后发送的,所述第二标识集合是所述处理器最近上一次生成的标识集合,所述第三标识集合包括在第一时间至当前时间内所述应用访问区域中被所述应用实例写入数据的n个存储单元的标识,所述第一时间为所述处理器生成所述第二标识集合的时间,n为整数,n大于或等于1且小于或等于所述应用访问区域包括的存储单元总数目。由于所述第三标识集合包括在第一时间至当前时间内所述应用访问区域中被所述应用实例写入数据的n个存储单元的标识,这样迁移在第一时间到当前时间被应用实例写入数据的存储单元中保存的数据,提高数据迁移的精确度,降低迁移部件的功耗。In a possible implementation of the second aspect, the processor records the time of the last migration to the current time, and during this period of time, the application access area has n storages where data is written by the application instance. The identity of the unit. Correspondingly, when the processor receives the migration command for the xth time, the processor generates a third identification set, and the migration command is the storage unit corresponding to the identification in the second identification set sent by the migration component After the saved data is sent, the second identifier set is the identifier set generated last time by the processor, and the third identifier set includes the identifier set in the application access area from the first time to the current time. The identification of the n storage units where the application instance writes data, the first time is the time when the processor generates the second identification set, n is an integer, n is greater than or equal to 1 and less than or equal to the application access The total number of storage cells included in the area. Since the third set of identifiers includes the identifiers of the n storage units that are written by the application instance in the application access area from the first time to the current time, the migration is thus transferred from the first time to the current time. The data stored in the storage unit where the data is written improves the accuracy of data migration and reduces the power consumption of the migration component.
在第二方面的一种可能的实现方式中,所述迁移部件包括状态通知接口,所述存储器 还包括交互缓冲区域,所述处理器将所述标识集合写入到所述交互缓冲区域,以及在所述状态通知接口写入集合生成完成信息,所述集合生成完成信息用于触发所述迁移部件从所述交互缓冲区域中获取所述标识集合。如此实现向迁移部件提供标识集合。In a possible implementation of the second aspect, the migration component includes a status notification interface, the memory further includes an interactive buffer area, and the processor writes the set of identifiers into the interactive buffer area, and Write set generation completion information in the status notification interface, where the set generation completion information is used to trigger the migration component to obtain the identification set from the interaction buffer area. In this way, the identification set is provided to the migration component.
在第二方面的一种可能的实现方式中,所述交互缓冲区域包括多个缓冲区域,所述处理器从所述多个缓冲区域中选择一个缓冲区域,所述选择的缓冲区域与所述处理器最近上一次选择的缓冲区域不同,将所述标识集合写入到所述选择的缓冲区域中,以及在所述状态通知接口写入集合生成完成信息,所述集合生成完成信息携带所述选择的缓冲区的标识。In a possible implementation of the second aspect, the interactive buffer area includes multiple buffer areas, the processor selects a buffer area from the multiple buffer areas, and the selected buffer area is connected to the The last time the processor selected a different buffer area, writes the set of identifiers into the selected buffer area, and writes set generation completion information on the status notification interface, and the set generation completion information carries the The ID of the selected buffer.
第三方面,本申请提供了一种迁移数据的装置(或称迁移部件),用于执行第一方面或第一方面的任意一种可能的实现方式中的方法。具体地,所述装置包括用于执行第一方面或第一方面的任意一种可能的实现方式的方法的一个或多个单元。该装置可以为网卡或网卡内的一个装置。In a third aspect, this application provides a data migration device (or called a migration component), which is used to execute the first aspect or the method in any one of the possible implementations of the first aspect. Specifically, the device includes one or more units for executing the first aspect or any one possible implementation method of the first aspect. The device can be a network card or a device in the network card.
第四方面,本申请提供了一种处理器,用于执行第二方面或第二方面的任意一种可能的实现方式中的方法。具体地,所述装置包括用于执行第二方面或第二方面的任意一种可能的实现方式的方法的一个或多个单元。In a fourth aspect, the present application provides a processor configured to execute the second aspect or the method in any possible implementation manner of the second aspect. Specifically, the device includes one or more units for executing the second aspect or any one possible implementation method of the second aspect.
第五方面,本申请提供了一种迁移数据的装置,所述装置包括:处理器、存储器、中断接口、迁出控制接口、状态通知接口、设置接口、DMA接口和网络收发接口,处理器分别与存储器、中断接口、迁出控制接口、状态通知接口、设置接口、DMA接口和网络收发接口连接。所述存储器存储有一个或多个程序,所述一个或多个程序被配置成由所述处理器执行,所述一个或多个程序包含用于进行第一方面或第一方面的任意一种可能的实现方式的方法的指令。In a fifth aspect, this application provides a device for migrating data. The device includes a processor, a memory, an interrupt interface, a migration control interface, a status notification interface, a setting interface, a DMA interface, and a network transceiver interface. The processors are respectively Connect with memory, interrupt interface, migration control interface, status notification interface, setting interface, DMA interface and network transceiver interface. The memory stores one or more programs, the one or more programs are configured to be executed by the processor, and the one or more programs include any one of the first aspect or the first aspect. Instructions for possible implementation methods.
第六方面,本申请提供了一种计算机程序产品,所述计算机程序产品包括在计算机可读存储介质中存储的计算机程序,并且所述计算程序通过处理器进行加载来实现上述第一方面、第二方面、第一方面的任意可能的实现方式或第二方面的任意可能的实现方式的方法。In a sixth aspect, the present application provides a computer program product. The computer program product includes a computer program stored in a computer-readable storage medium, and the calculation program is loaded by a processor to implement the first aspect and the first aspect. The second aspect, any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect.
第七方面,本申请提供了一种非易失性计算机可读存储介质,用于存储计算机程序,所述计算机程序通过处理器进行加载来执行上述第一方面、第二方面、第一方面的任意可能的实现方式或第二方面的任意可能的实现方式的方法的指令。In a seventh aspect, this application provides a non-volatile computer-readable storage medium for storing a computer program that is loaded by a processor to execute the above-mentioned aspects of the first, second, and first aspects. Instructions for any possible implementation or any possible implementation of the second aspect.
第八方面,本申请提供了一种芯片,所述芯片包括逻辑电路,所述逻辑电路可以为可编程逻辑电路。当所述芯片运行时用于实现上述第一方面、第二方面、第一方面任意可能实现方式或第二方面的任意可能实现方式的方法。In an eighth aspect, the present application provides a chip, the chip includes a logic circuit, and the logic circuit may be a programmable logic circuit. When the chip is running, it is used to implement the foregoing first aspect, second aspect, any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect.
第九方面,本申请提供了一种芯片,所述芯片包括一个或多个物理核、以及存储介质, 所述一个或多个物理核在读取所述存储介质中的计算机指令后实现上述第一方面、第二方面、第一方面任意可能实现方式或第二方面的任意可能实现方式的方法。In a ninth aspect, the present application provides a chip that includes one or more physical cores and a storage medium, and the one or more physical cores implement the above-mentioned first after reading computer instructions in the storage medium. One aspect, the second aspect, any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect.
第十方面,本申请提供了一种计算机系统,所述计算机系统包括存储器、第三方面所述的迁移数据的装置和所述第四方面所述的处理器。In a tenth aspect, the present application provides a computer system that includes a memory, the data migration device described in the third aspect, and the processor described in the fourth aspect.
附图说明Description of the drawings
图1是本申请实施例提供的一种网络架构示意图;FIG. 1 is a schematic diagram of a network architecture provided by an embodiment of the present application;
图2是本申请实施例提供的一种主机结构示意图;FIG. 2 is a schematic diagram of a host structure provided by an embodiment of the present application;
图3是本申请实施例提供的另一种主机结构示意图;FIG. 3 is a schematic diagram of another host structure provided by an embodiment of the present application;
图4是本申请实施例提供的一种迁移数据的方法流程图;4 is a flowchart of a method for migrating data provided by an embodiment of the present application;
图5是本申请实施例提供的一种迁移数据的时序图;FIG. 5 is a sequence diagram of data migration provided by an embodiment of the present application;
图6是本申请实施例提供的另一种迁移数据的方法流程图;FIG. 6 is a flowchart of another data migration method provided by an embodiment of the present application;
图7是本申请实施例提供的一种迁移数据的装置结构示意图;FIG. 7 is a schematic structural diagram of a data migration device provided by an embodiment of the present application;
图8是本申请实施例提供的一种处理器结构示意图;FIG. 8 is a schematic structural diagram of a processor provided by an embodiment of the present application;
图9是本申请实施例提供的一种迁移数据的系统结构示意图。FIG. 9 is a schematic diagram of a system structure for migrating data provided by an embodiment of the present application.
具体实施方式detailed description
下面将结合附图对本申请实施方式作进一步地详细描述。The implementation manners of the present application will be described in further detail below in conjunction with the accompanying drawings.
参见图1,本申请提供了一种网络架构,该网络架构包括源主机和目的主机,源主机和目的主机之间建立有网络连接,该网络连接可以为有线连接或无线连接。Referring to Fig. 1, the present application provides a network architecture including a source host and a destination host. A network connection is established between the source host and the destination host, and the network connection may be a wired connection or a wireless connection.
源主机中运行有应用实例,当对源主机进行停机维护时,将源主机的存储器中保存的数据迁移到目的主机,源主机的存储器中保存的数据包括源主机在运行应用实例时产生的数据,这样在目的主机中可以通过该数据启动并运行该应用实例。应用实例可以为裸机虚拟化实例,例如AWS(Amazon Web Services)i3.meal实例、阿里神龙云服务器实例、微软Azure裸机服务器实例等。There are application instances running on the source host. When the source host is shut down for maintenance, the data stored in the memory of the source host is migrated to the destination host. The data stored in the memory of the source host includes the data generated by the source host when the application instance is running. , So that the application instance can be started and run through the data in the destination host. The application instance may be a bare metal virtualization instance, such as an AWS (Amazon Web Services) i3.meal instance, an Alibaba Dragon cloud server instance, and a Microsoft Azure bare metal server instance.
源主机的存储器可以为源主机的内存或磁盘等。在如下任一实施例中,源主机的存储器以源主机的内存为例,来说明如何将源主机的内存中保存的数据迁移到目的主机,源主机的内存包括的存储单元为内存页。对于源主机的磁盘,本领域普通技术人员可以将如下任一实施例出现的内存替换为磁盘,内存页替换为磁盘的存储单元,或者再结合一些适应性变化,便可得到将源主机的磁盘中保存的数据迁移到目的主机的详细方案,本申请对此不再详细描述。The memory of the source host may be the memory or disk of the source host. In any of the following embodiments, the memory of the source host uses the memory of the source host as an example to illustrate how to migrate data stored in the memory of the source host to the destination host. The memory of the source host includes storage units as memory pages. For the disk of the source host, a person of ordinary skill in the art can replace the memory in any of the following embodiments with a disk, and replace the memory page with a storage unit of the disk, or combine some adaptive changes to obtain the disk of the source host. The detailed scheme for migrating the data stored in the data to the destination host is not described in detail in this application.
参见图2,本申请实施例提供了一种主机,该主机可以为上述图1所示的网络架构中的源主机,在实现时该主机可以为服务器、个人计算机(Personal Computer,PC)、笔记本电脑、智能终端、车载装置、人工智能装置、或虚拟现实/增强现实/混合现实等,包括:Referring to FIG. 2, an embodiment of the present application provides a host. The host may be the source host in the network architecture shown in FIG. 1. In implementation, the host may be a server, a personal computer (PC), or a notebook. Computers, smart terminals, vehicle-mounted devices, artificial intelligence devices, or virtual reality/augmented reality/mixed reality, etc., including:
CPU1、内存2、迁移部件3和主板(图中示画出)。该CPU1、内存2和迁移部件3之间通过主板连接。CPU1, memory 2, migration part 3 and main board (shown in the figure). The CPU1, the memory 2 and the migration component 3 are connected through a motherboard.
可选的,主板中包括系统总线,CPU1、内存2和迁移部件3之间可以通过主板中的系统总线相连。Optionally, the motherboard includes a system bus, and the CPU1, the memory 2 and the migration component 3 can be connected through the system bus in the motherboard.
内存2包括不重叠的代码存储区域21、交互缓冲区域22和应用访问区域23,代码存储区21可以存储应用实例的实现代码和内存页收集模块的实现代码等。The memory 2 includes a non-overlapping code storage area 21, an interactive buffer area 22, and an application access area 23. The code storage area 21 can store the implementation code of the application instance and the implementation code of the memory page collection module.
应用实例的实现代码可以被CPU1调用并运行。在运行应用实例的过程中,应用实例可以访问应用访问区域23。可选的,应用实例访问应用访问区域23是指CPU1运行应用实例时可以向应用访问区域23写入数据和/或从应用访问区域23中读取数据。The implementation code of the application instance can be called and run by CPU1. In the process of running the application instance, the application instance can access the application access area 23. Optionally, that the application instance accesses the application access area 23 means that the CPU 1 can write data to the application access area 23 and/or read data from the application access area 23 when the CPU 1 runs the application instance.
内存页收集模块的实现代码可以被CPU1调用并运行,在运行内存页收集模块时,CPU1通过内存页收集模块生成标识集合,该标识集合包括应用访问区域23中待迁移的内存页的标识。可选的,CPU1通过运行内存页收集模块,从应用访问区域23中获取待迁移的内存页的标识,将获取的标识组成标识集合。将源主机的内存中的数据迁移到目的主机是指将源主机的用户访问区域23中的数据迁移到目的主机。The implementation code of the memory page collection module can be called and run by the CPU1. When the memory page collection module is running, the CPU1 generates an identification set through the memory page collection module. The identification set includes the identification of the memory page to be migrated in the application access area 23. Optionally, the CPU 1 obtains the identification of the memory page to be migrated from the application access area 23 by running the memory page collection module, and composes the obtained identification into an identification set. Migrating the data in the memory of the source host to the destination host refers to migrating the data in the user access area 23 of the source host to the destination host.
交互缓冲区22用于存储该标识集合。即CPU1在生成标识集合后,可以将该标识集合写入到交互缓冲区域22中。The interaction buffer 22 is used to store the identification set. That is, after the CPU 1 generates the identification set, the identification set can be written into the interaction buffer area 22.
在其它实施例中,主机还可以包括磁盘或其它类型的外部存储设备,磁盘可以通过系统总与CPU1、内存2和迁移部件3连接。磁盘可以保存应用实例的实现代码和内存页收集模块的实现代码,在主机启动时,CPU1可以从磁盘中读取应用实例的实现代码和内存页收集模块的实现代码,并将应用实例的实现代码和内存页收集模块的实现代码加载到代码存储区域21中。In other embodiments, the host may also include a disk or other types of external storage devices, and the disk may be connected to the CPU 1, the memory 2 and the migration component 3 through the system. The disk can save the implementation code of the application instance and the implementation code of the memory page collection module. When the host starts, the CPU1 can read the implementation code of the application instance and the implementation code of the memory page collection module from the disk, and store the implementation code of the application instance And the implementation code of the memory page collection module is loaded into the code storage area 21.
当源主机开始向目的主机迁移源主机内存中的数据时,迁移部件3向CPU1发送迁移命令,CPU1接收该迁移命令,根据该迁移命令通过内存页收集模块生成标识集合,通过交互缓冲区域22向迁移部件3提供该标识集合。迁移部件3获取该标识集合后向目的主机发送该标识集合中的标识对应的内存页内保存的数据。When the source host starts to migrate the data in the memory of the source host to the destination host, the migration component 3 sends a migration command to CPU1, and CPU1 receives the migration command, generates an identification set through the memory page collection module according to the migration command, and sends data to The migration component 3 provides this identification set. After obtaining the identification set, the migration component 3 sends to the destination host the data stored in the memory page corresponding to the identification in the identification set.
参见图3,迁移部件3包括处理器31、中断接口32、迁出控制接口33、状态通知接口34、设置接口35、直接内存存取(direct memory access,DMA)接口36、网络收发接口37和存储器38。处理器31分别与中断接口32、迁出控制接口33、状态通知接口34、设置接口35、DMA接口36、网络收发接口37和存储器38连接。3, the migration component 3 includes a processor 31, an interrupt interface 32, a migration control interface 33, a status notification interface 34, a setting interface 35, a direct memory access (DMA) interface 36, a network transceiver interface 37 and Storage 38. The processor 31 is connected to the interrupt interface 32, the migration control interface 33, the status notification interface 34, the setting interface 35, the DMA interface 36, the network transceiver interface 37 and the memory 38 respectively.
在主机开机时,CPU1可以向迁移部件3发送初始化信息,该初始化信息可以包括中断方式、命令码、交互缓冲区域的地址和空间大小等信息。命令码可以包括迁移命令等。When the host is turned on, the CPU 1 may send initialization information to the migration component 3, and the initialization information may include information such as interrupt mode, command code, address of the interactive buffer area, and space size. The command code may include migration commands and so on.
可选的,交互缓冲区域可以包括空间大小相等的多个缓冲区域,该交互缓冲区域的地址包括每个缓冲区域的地址。例如交互缓冲区域包括第一缓冲区域和第二缓冲区域,该交互缓冲区域的地址包括第一缓冲区域的地址和第二缓冲区域的地址。Optionally, the interactive buffer area may include a plurality of buffer areas of equal size, and the address of the interactive buffer area includes the address of each buffer area. For example, the interactive buffer area includes a first buffer area and a second buffer area, and the address of the interactive buffer area includes the address of the first buffer area and the address of the second buffer area.
处理器31可以通过设置接口35接收CPU1发送的该初始化信息,将该初始化信息保存在存储器38中。The processor 31 may receive the initialization information sent by the CPU 1 through the setting interface 35, and store the initialization information in the memory 38.
可选的,处理器31可以根据存储器38保存的中断方式,通过中断接口32和迁出控制接口33向CPU1发送迁移命令;通过状态通知接口34获取CPU1提供的标识集合;以及通过DMA接口36和网络收发接口37发送该标识集合中的标识对应的内存页内保存的数据。Optionally, the processor 31 may send a migration command to the CPU1 through the interrupt interface 32 and the migration control interface 33 according to the interrupt mode stored in the memory 38; obtain the identification set provided by the CPU1 through the status notification interface 34; and through the DMA interface 36 and The network transceiver interface 37 sends the data stored in the memory page corresponding to the identifier in the identifier set.
可选的,中断接口32、迁出控制接口33、状态通知接口34、设置接口35和DMA接口36可以为迁移部件3中的五个不同寄存器,或者中断接口32、迁出控制接口33、状态 通知接口34、设置接口35和DMA接口36可以为内存2中的五个不同的存储区域,该五个存储区域是内存2中除代码存储区域21、交互缓冲区域22和应用访问区域23以外的其他区域。Optionally, the interrupt interface 32, the migration control interface 33, the status notification interface 34, the setting interface 35, and the DMA interface 36 can be five different registers in the migration component 3, or the interrupt interface 32, the migration control interface 33, and the status The notification interface 34, the setting interface 35, and the DMA interface 36 can be five different storage areas in the memory 2. The five storage areas are the code storage area 21, the interactive buffer area 22, and the application access area 23 in the memory 2. Other areas.
迁移部件3可以集成在主机的网卡上,此时网络收发接口37可以是网卡上的网口。The migration component 3 may be integrated on the network card of the host. In this case, the network transceiver interface 37 may be a network port on the network card.
迁移部件3可以为板卡,该板卡可以插接在主板上,迁移部件3中可以包括网络收发接口37,或者将主机的网卡作为迁移部件3的网络收发接口37。可选的,该板卡可以为高速串行计算机扩展总线标准(peripheral component interconnect express,PCIe)板卡。The migration component 3 may be a board card, which can be plugged into the main board. The migration component 3 may include a network transceiver interface 37, or the network card of the host may be used as the network transceiver interface 37 of the migration component 3. Optionally, the board may be a high-speed serial computer expansion bus standard (peripheral component interconnect express, PCIe) board.
可选的,CPU1可以运行用于迁移数据的第一指令,来实现接收迁移部件3发送的迁移命令,调用并运行内存页收集模块的实现代码,通过内存页收集模块生成标识集合等操作。Optionally, the CPU 1 can run the first instruction for data migration to receive the migration command sent by the migration component 3, call and run the implementation code of the memory page collection module, and generate an identification set through the memory page collection module.
可选的,第一指令可以保存在磁盘中,CPU1可以调用该指令并运行该指令。或者,第一指令可以固化在CPU1中,CPU1可以直接运行该指令。Optionally, the first instruction may be stored in a disk, and the CPU 1 may call and execute the instruction. Or, the first instruction may be solidified in CPU1, and CPU1 may directly run the instruction.
可选的,迁移部件包括的处理器31可以运行用于迁移数据的第二指令,来实现向CPU1发送迁移命令,获取标识集合以及发送该标识集合中的标识对应的内存页保存的数据等操作。Optionally, the processor 31 included in the migration component can run a second instruction for migrating data to implement operations such as sending a migration command to CPU1, obtaining an identifier set, and sending data stored in a memory page corresponding to an identifier in the identifier set. .
可选的,第二指令可以保存在迁移部件3的存储器38中或主机的磁盘中,处理器31可以从存储器38或主机的磁盘中调用第二指令并运行第二指令。或者,第二指令可以固化在处理器31中,处理器31可以直接运行第二指令。Optionally, the second instruction may be stored in the memory 38 of the migration component 3 or the disk of the host, and the processor 31 may call the second instruction from the memory 38 or the disk of the host and run the second instruction. Alternatively, the second instruction may be solidified in the processor 31, and the processor 31 may directly execute the second instruction.
参见图4,本申请实施例提供了一种迁移数据的方法,该方法可以应用于上述图2和3所示实施例提供的主机。Referring to FIG. 4, an embodiment of the present application provides a method for migrating data, which can be applied to the host provided in the embodiments shown in FIGS. 2 and 3 above.
步骤301:迁移部件首次向CPU发送迁移命令,下述称为启动迁移命令。Step 301: The migration component sends a migration command to the CPU for the first time, which is referred to as a start migration command below.
迁移部件、内存和CPU属于同一个主机,迁移部件、内存和CPU通过主机的主板相连。CPU用于运行应用实例,在CPU运行应用实例的过程中该应用实例可以访问内存的应用访问区域,例如应用实例可以向应用访问区域写入数据或从应用访问区域读取数据。The migration component, memory, and CPU belong to the same host, and the migration component, memory, and CPU are connected through the mainboard of the host. The CPU is used to run an application instance, and the application instance can access the application access area of the memory when the CPU runs the application instance. For example, the application instance can write data to the application access area or read data from the application access area.
参见图2,主机的内存中还包括代码存储区域,代码存储区域中包括应用实例的实现代码。CPU可以调用并运行应用实例的实现代码,以实现运行应用实例。Referring to Fig. 2, the memory of the host also includes a code storage area, and the code storage area includes implementation codes of application examples. The CPU can call and run the implementation code of the application instance to realize the operation of the application instance.
在需要将主机中运行的应用实例迁移到目的主机时,需要将应用访问区域中保存的数据迁移到目的主机,应用访问区域包括应用实例在运行时写入的数据,这样在目的主机上可以根据该数据启动并继续运行该应用实例。When the application instance running in the host needs to be migrated to the destination host, the data saved in the application access area needs to be migrated to the destination host. The application access area includes the data written by the application instance at runtime, so that the destination host can be based on The data starts and continues to run the application instance.
在本步骤中,当需要将内存的应用访问区域内保存的数据迁移到目的主机时,用户可以在主机上向迁移部件输入触发命令。迁移部件接收该触发命令,响应于该触发命令向CPU发送启动迁移命令。In this step, when the data stored in the application access area of the memory needs to be migrated to the destination host, the user can input a trigger command to the migration component on the host. The migration component receives the trigger command, and sends a start migration command to the CPU in response to the trigger command.
参见图3,迁移部件包括处理器、中断接口、迁出控制接口、状态通知接口、设置接口、DMA接口、存储器和网络收发接口。Referring to Figure 3, the migration components include a processor, an interrupt interface, a migration control interface, a status notification interface, a setting interface, a DMA interface, a memory, and a network transceiver interface.
在本步骤中,迁移部件向迁出控制接口写入迁移命令,然后再通过中断接口向CPU发送中断信号;CPU接收该中断信号,根据该中断信号暂停继续运行应用实例,从迁移部件的迁出控制接口中读取该迁移命令,如此迁移部件实现向CPU发送该启动迁移命令。In this step, the migration component writes a migration command to the migration control interface, and then sends an interrupt signal to the CPU through the interrupt interface; the CPU receives the interrupt signal, pauses and continues to run the application instance according to the interrupt signal, and migrates from the migration component The migration command is read in the control interface, so the migration component realizes sending the start migration command to the CPU.
可选的,在主机启动时,CPU可以向迁移部件发送初始化信息,该初始化信息可以包括中断方式、命令码、交互缓冲区域的地址和空间大小等信息。命令码可以包括迁移命令 和停止迁移命令等。Optionally, when the host is started, the CPU may send initialization information to the migration component, and the initialization information may include information such as interrupt mode, command code, address of the interactive buffer area, and space size. The command code can include a migration command and a stop migration command.
可选的,交互缓冲区域可以为一个存储区域。或者,交互缓冲区域可以包括空间大小相等的多个缓冲区域,该交互缓冲区域的地址包括每个缓冲区域的地址。例如,交互缓冲区域包括第一缓冲区域和第二缓冲区域,该交互缓冲区域的地址包括第一缓冲区域的地址和第二缓冲区域的地址,初始化信息中的空间大小为第一缓冲区域的空间大小和第二缓冲区域的空间大小。Optionally, the interactive buffer area may be a storage area. Alternatively, the interactive buffer area may include a plurality of buffer areas of equal size, and the address of the interactive buffer area includes the address of each buffer area. For example, the interactive buffer area includes a first buffer area and a second buffer area, the address of the interactive buffer area includes the address of the first buffer area and the address of the second buffer area, and the size of the space in the initialization information is the space of the first buffer area Size and the space size of the second buffer area.
可选的,该初始化信息还可以包括第一缓冲区域的地址对应的第一缓冲区域的标识,第二缓冲区域的地址对应的第二缓冲区域的标识。Optionally, the initialization information may further include an identifier of the first buffer area corresponding to the address of the first buffer area, and an identifier of the second buffer area corresponding to the address of the second buffer area.
可选的,缓冲区域的标识可以为缓冲区域的地址或缓冲区域的编号。Optionally, the identifier of the buffer area may be the address of the buffer area or the number of the buffer area.
可选的,在应用实例为裸金属实例时,该中断方式可以包括系统管理中断(system management interrupt,SMI)中断方式和不可屏蔽中断(non maskable interrupt,NMI)中断方式。在应用实例为虚拟机时,该中断方式为NMI中断方式。Optionally, when the application instance is a bare metal instance, the interrupt mode may include a system management interrupt (SMI) interrupt mode and a non-maskable interrupt (NMI) interrupt mode. When the application instance is a virtual machine, the interrupt mode is the NMI interrupt mode.
迁移部件的处理器可以通过设置接口接收CPU发送的该初始化信息,将该初始化信息保存在迁移部件的存储器中。The processor of the migration component may receive the initialization information sent by the CPU through the setting interface, and save the initialization information in the memory of the migration component.
这样在本步骤中,迁移部件的处理器可以从迁移部件的存储器中读取中断方式和迁移命令,向迁出控制接口写入该迁移命令,根据该中断方式通过中断接口向CPU发送中断信号。In this step, the processor of the migration component can read the interrupt mode and migration command from the memory of the migration component, write the migration command to the migration control interface, and send an interrupt signal to the CPU through the interrupt interface according to the interrupt mode.
可选的,在应用实例为裸金属实例时,读取的中断方式包括SMI中断方式和NMI中断方式,根据该SMI中断方式,通过中断接口向CPU发送第一中断信号,再根据该NMI中断方式,通过中断接口向CPU发送第二中断信号。在应用实例为虚拟机时,读取的中断方式包括NMI中断方式,根据该NMI中断方式,通过中断接口向CPU发送第二中断信号。Optionally, when the application instance is a bare metal instance, the read interrupt mode includes SMI interrupt mode and NMI interrupt mode, according to the SMI interrupt mode, the first interrupt signal is sent to the CPU through the interrupt interface, and then according to the NMI interrupt mode , Send a second interrupt signal to the CPU through the interrupt interface. When the application instance is a virtual machine, the read interrupt mode includes the NMI interrupt mode, and according to the NMI interrupt mode, the second interrupt signal is sent to the CPU through the interrupt interface.
可选的,以基础设施即服务(Infrastructure as a Service,IaaS)中基于x86处理器的裸金属实例为例来说明,内存页收集模块又可称为脏页收集模块。在裸金属实例中,应用实例运行于非虚拟化模式,此时脏页收集模块表现为主机基本输入输出系统(Basic Input Output System,BIOS)的一个组成部分,驻留在仅能被x86的系统管理模式(System Management Mode,SMM)模式可访问的内存中。迁移部件为内部包含了用于迁移数据功能的网卡,其中迁出控制接口、状态通知接口、设置接口全部体现为此网卡对主机暴露的不同寄存器,内部存储空间包括设备内部的私有寄存器和私有存储空间,私有寄存器用于存放主机CPU对此网卡的设置信息:发送中断的方式,信息交互缓冲区的物理地址和长度等,私有存储空间用于缓存脏页信息。Optionally, taking an x86 processor-based bare metal instance in Infrastructure as a Service (IaaS) as an example, the memory page collection module may also be referred to as a dirty page collection module. In the bare metal instance, the application instance runs in a non-virtualized mode. At this time, the dirty page collection module appears as a component of the host's Basic Input Output System (BIOS) and resides in a system that can only be accessed by x86 In the memory accessible by the System Management Mode (SMM) mode. The migration component is a network card that contains the function of data migration. The migration control interface, status notification interface, and setting interface are all embodied as different registers exposed by the network card to the host. The internal storage space includes the private registers and private storage inside the device. Space, the private register is used to store the setting information of the host CPU for this network card: the method of sending interrupts, the physical address and length of the information exchange buffer, etc. The private storage space is used to cache dirty page information.
步骤302:CPU接收该迁移命令,生成第一标识集合,第一标识集合包括应用访问区域中的每个内存页的标识。Step 302: The CPU receives the migration command and generates a first identification set, where the first identification set includes the identification of each memory page in the application access area.
CPU接收该迁移命令后,可以获取应用访问区域中的每个内存页的标识,将每个内存页的标识组成第一标识集合。After the CPU receives the migration command, it can obtain the identifier of each memory page in the application access area, and compose the identifier of each memory page into the first identifier set.
应用访问区域中的每个内存页的空间大小可以相等或不等。内存页的标识可以为内存页的起始地址;或者,应用访问区域中的每个内存页可以被事先顺序编号,内存页的标识也可以为内存页的编号。The space size of each memory page in the application access area can be equal or unequal. The identification of the memory page may be the starting address of the memory page; or, each memory page in the application access area may be sequentially numbered in advance, and the identification of the memory page may also be the number of the memory page.
应用访问区域中保存有应用实例写入的数据,但由于在开始迁移时,CPU不知应用访问区域中的哪些内存页中存储有应该迁移的数据,所以在开始迁移时,CPU将应用访问区 域中的所有内存页均确定为待迁移的内存页,并获取应用访问区域中的每个内存页的标识,将每个内存内的标识组成第一标识集合。The application access area saves the data written by the application instance, but because the CPU does not know which memory pages in the application access area store the data that should be migrated when the migration starts, the CPU will be in the application access area when the migration starts All memory pages in are determined as memory pages to be migrated, and the identifier of each memory page in the application access area is obtained, and the identifiers in each memory are formed into a first identifier set.
可选的,代码存储区域还可以包括内存页收集模块的实现代码,CPU在接收迁移命令后,暂停运行应用实例,调用并运行内存页收集模块的实现代码,通过运行内存页收集模块获取应用访问区域中的每个内存页的标识,将每个内存页的标识组成第一标识集合。Optionally, the code storage area may also include the implementation code of the memory page collection module. After receiving the migration command, the CPU suspends running the application instance, calls and runs the implementation code of the memory page collection module, and obtains application access by running the memory page collection module The identifier of each memory page in the area composes the identifier of each memory page into the first identifier set.
可选的,在应用实例为裸金属实例时,CPU接收第一中断信号,根据第一中断信号将主机切换到虚拟态,CPU再接收第二中断信号,根据第二中断信号停止继续运行应用实例,从迁出控制接口中读取该迁移命令,以实现接收该迁移命令。Optionally, when the application instance is a bare metal instance, the CPU receives the first interrupt signal, switches the host to the virtual state according to the first interrupt signal, and then receives the second interrupt signal, and stops running the application instance according to the second interrupt signal. , Read the migration command from the migration control interface to realize the reception of the migration command.
可选的,在应用实例为虚拟机时,由于主机已处于虚拟态,CPU接收第二中断信号,根据第二中断信号停止继续运行应用实例,从迁出控制接口中读取该迁移命令,以实现接收该迁移命令。Optionally, when the application instance is a virtual machine, because the host is already in a virtual state, the CPU receives the second interrupt signal, stops running the application instance according to the second interrupt signal, and reads the migration command from the migration control interface to Realize receiving the migration command.
在应用实例为裸金属实例时,将主机切换到虚拟态后,主机会保持在虚拟态,在应用实例为虚拟机时,主机处于虚拟态。在主机处于虚拟态的情况下,CPU在生成第一标识集合后,还可以将应用访问区域中的每个内存页的属性设置为写保护。在内存页的属性设置成写保护后,CPU在继续运行应用实例的过程中,当应用实例向该内存页写入数据时,CPU便可以获知该内存页被应用实例写入数据,并记录该内存页的标识。When the application instance is a bare metal instance, the host will remain in the virtual state after the host is switched to the virtual state. When the application instance is a virtual machine, the host will be in the virtual state. When the host is in a virtual state, after the CPU generates the first identification set, the attribute of each memory page in the application access area may also be set to write protection. After the properties of the memory page are set to write protection, while the CPU continues to run the application instance, when the application instance writes data to the memory page, the CPU can learn that the memory page is written by the application instance and record the The identifier of the memory page.
可选的,CPU可以将获知的该内存页的标识记录在内存中的一个存储区域中,该存储区域是内存中除代码存储区域、交互缓冲区域和应用访问区域以外的存储区域。Optionally, the CPU may record the learned identifier of the memory page in a storage area in the memory, where the storage area is a storage area in the memory excluding the code storage area, the interaction buffer area, and the application access area.
步骤303:CPU向迁移部件提供第一标识集合。Step 303: The CPU provides the first identification set to the migration component.
参见图2,内存中还可以包括交互缓冲区域,CPU可以将第一标识集合写入到交互缓冲区域,向迁移部件的状态通知接口写入集合生成完成消息,以实现向迁移部件提供第一标识集合。Referring to Figure 2, the memory may also include an interactive buffer area. The CPU may write the first set of identifiers to the interactive buffer area, and write the set to the status notification interface of the migration component to generate a complete message to provide the migration component with the first identifier. set.
可选的,交互缓冲区域包括空间大小相等的第一缓冲区域和第二缓冲区域。在本步骤中,CPU从第一缓冲区域和第二缓冲区域中选择一个缓冲区域,将第一标识集合写入选择的缓冲区域,向迁移部件的状态通知接口写入集合生成完成消息,该集合生成完成消息携带选择的缓冲区域的标识。Optionally, the interactive buffer area includes a first buffer area and a second buffer area with equal spaces. In this step, the CPU selects a buffer area from the first buffer area and the second buffer area, writes the first identification set into the selected buffer area, and writes the set generation completion message to the status notification interface of the migration component. The generated completion message carries the identifier of the selected buffer area.
可选的,参见图5,CPU将第一标识集合写入交互缓冲区域后,可以继续运行应用实例。Optionally, referring to FIG. 5, after the CPU writes the first set of identifiers into the interactive buffer area, the application instance may continue to run.
步骤304:迁移部件获取CPU提供的第一标识集合。Step 304: The migration component obtains the first set of identifiers provided by the CPU.
迁移部件从其状态通知接口读取集合生成完成消息,根据该集合生成完成消息,从交互缓冲区域中读取第一标识集合。The migration component reads the set generation completion message from its status notification interface, generates the completion message according to the set, and reads the first identification set from the interaction buffer area.
可选的,状态通知接口可以是迁移部件中的一个寄存器,当CPU向迁移部件的状态通知接口中写入集合生成完成消息时,迁移部件的处理器可以发现其状态通知接口被写入消息,并从该状态通知接口中读取集合生成完成消息。或者,状态通知接口可以为是内存中一个存储区域,迁移部件的处理器在发送完启动迁移命令后,定期或不定期地读取状态通知接口,当CPU向状态通知接口中写入集合生成完成消息后,迁移部件的处理器便从状态通知接口读取到该集合生成完成消息。Optionally, the status notification interface may be a register in the migration component. When the CPU writes the set generation completion message to the status notification interface of the migration component, the processor of the migration component can find that the status notification interface is written with the message. And read the collection generation completion message from the status notification interface. Alternatively, the status notification interface can be a storage area in the memory. After the processor of the migration component sends the start migration command, it periodically or irregularly reads the status notification interface, and when the CPU writes to the status notification interface, the set generation is completed After the message, the processor of the migration component reads the set generation completion message from the state notification interface.
可选的,当交互缓冲区域包括一个区域时,迁移部件的处理器从迁移部件的存储器中读取交互缓冲区域的地址和空间大小,根据该地址和空间大小确定出内存中的交互缓冲区域,从交互缓冲区域中读取第一标识集合。Optionally, when the interaction buffer area includes an area, the processor of the migration component reads the address and space size of the interaction buffer area from the memory of the migration component, and determines the interaction buffer area in the memory according to the address and space size. Read the first set of identifiers from the interactive buffer area.
当交互缓冲区域包括空间大小相等的多个缓冲区域时,迁移部件读取的集合生成完成消息还携带CPU选择的缓冲区域的标识,从迁移部件的存储器中获取该标识对应的缓冲区域的地址和空间大小,根据该地址和空间大小确定出内存中的缓冲区域,从该缓冲区域中读取第一标识集合。When the interactive buffer area includes multiple buffer areas of equal size, the set generation completion message read by the migration component also carries the identifier of the buffer area selected by the CPU, and the address and address of the buffer area corresponding to the identifier are obtained from the memory of the migration component. The size of the space, the buffer area in the memory is determined according to the address and the size of the space, and the first identification set is read from the buffer area.
步骤305:迁移部件(向目的主机)发送第一标识集合中的标识对应的内存页内保存的数据。具体的,在第一标识集合中的每个标识对应的内存页的总容量超过预设阈值时,迁移部件发送第一标识集合中的标识对应的内存页内保存的数据。预设阈值通常小于应用访问区域的容量。Step 305: The migration component (to the destination host) sends the data stored in the memory page corresponding to the identifier in the first identifier set. Specifically, when the total capacity of the memory page corresponding to each identifier in the first identifier set exceeds a preset threshold, the migration component sends the data stored in the memory page corresponding to the identifier in the first identifier set. The preset threshold is usually less than the capacity of the application access area.
可选的,内存中的每个内存页的大小相等,CPU向迁移部件发送的初始化信息可以包括内存页的大小。迁移部件的处理器通过设置接口接收CPU发送的该初始化信息,并将该初始化信息保存在迁移部件的存储器中。这样在本步骤中,迁移部件的处理器可以从迁移部件的存储器中读取内存页的大小,根据第一标识集合包括的标识数目和该内存页的大小获取第一标识集合中的每个标识对应的内存页的总容量,确定该总容量是否超过预设阈值。Optionally, the size of each memory page in the memory is equal, and the initialization information sent by the CPU to the migration component may include the size of the memory page. The processor of the migration component receives the initialization information sent by the CPU through the setting interface, and saves the initialization information in the memory of the migration component. In this step, the processor of the migration component can read the size of the memory page from the memory of the migration component, and obtain each identifier in the first identifier set according to the number of identifiers included in the first identifier set and the size of the memory page. The total capacity of the corresponding memory page determines whether the total capacity exceeds the preset threshold.
可选的,内存中的每个内存页的大小不等,CPU向迁移部件发送的初始化信息可以包括每个内存页的标识和大小。迁移部件的处理器通过设置接口接收CPU发送的该初始化信息,并将该初始化信息保存在迁移部件的存储器中,即在迁移部件的存储器中保存有内存页的标识和与该内存页标识对应的内存页的大小。这样在本步骤中,迁移部件的处理器可以从迁移部件的存储器中读取根据第一标识集合包括的每个标识对应的内存页的大小,根据每个标识对应的内存页的大小获取第一标识集合中的每个标识对应的内存页的总容量,确定该总容量是否超过预设阈值。Optionally, the size of each memory page in the memory varies, and the initialization information sent by the CPU to the migration component may include the identification and size of each memory page. The processor of the migration component receives the initialization information sent by the CPU through the setting interface, and stores the initialization information in the memory of the migration component, that is, the memory page identifier and the memory page identifier corresponding to the memory page identifier are stored in the memory of the migration component The size of the memory page. In this step, the processor of the migration component can read the size of the memory page corresponding to each identifier included in the first identifier set from the memory of the migration component, and obtain the first memory page size according to the size of the memory page corresponding to each identifier. The total capacity of the memory page corresponding to each identifier in the identifier set is determined, and it is determined whether the total capacity exceeds a preset threshold.
在本步骤中,由于第一标识集合包括的应用访问区域中的每个内存页的标识,所以第一标识集合中的每个标识对应的内存页的总容量等于应用访问区域的容量,且超过预设阈值,迁移部件的处理器可以根据第一标识集合中的标识,通过DMA接口从该标识对应的内存页中读取数据,通过网络收发接口向目的主机发送读取的数据。In this step, since the first identification set includes the identification of each memory page in the application access area, the total capacity of the memory page corresponding to each identification in the first identification set is equal to the capacity of the application access area and exceeds With a preset threshold, the processor of the migration component can read data from the memory page corresponding to the identifier through the DMA interface according to the identifier in the first identifier set, and send the read data to the destination host through the network transceiver interface.
可选的,迁移部件的处理器可以从第一标识集合中选择至少一个标识,选择的每个标识对应的内存页的总容量小于或等于最大允许容量,发送选择的每个标识对应的内存页内保存的数据。Optionally, the processor of the migration component may select at least one identifier from the first set of identifiers, the total capacity of the memory page corresponding to each selected identifier is less than or equal to the maximum allowable capacity, and the memory page corresponding to each selected identifier is sent Data saved inside.
可选的,迁移部件可以是具有网络传输能力的PCI设备,又可称为智能网卡,包括内部处理器、网卡、存储器;PCI空间接口寄存器。PCI空间接口寄存器支持处理器输入脏页信息地址,且支持向处理器输出当前的工作状态,脏页信息是内存中被应用实例写入数据的内存页。当需将应用实例迁出本机时,内部处理器通过中断发送接口向CPU发送SMI中断信号,并更新设备状态为:通知CPU进入脏页追踪状态。当从CPU获得脏页信息地址后,使用DMA方式从CPU中读取脏页信息,并存放在内部存储器中,然后扫描内部存储器中登记的脏页,通过DMA方式将其传输到目的主机。Optionally, the migration component may be a PCI device with network transmission capability, which may also be called an intelligent network card, including an internal processor, a network card, and a memory; PCI space interface registers. The PCI space interface register supports the processor to input the address of the dirty page information, and supports the output of the current working status to the processor. The dirty page information is the memory page in the memory where data is written by the application instance. When the application instance needs to be moved out of the machine, the internal processor sends an SMI interrupt signal to the CPU through the interrupt sending interface, and updates the device status to: notify the CPU to enter the dirty page tracking state. When the dirty page information address is obtained from the CPU, the dirty page information is read from the CPU by DMA and stored in the internal memory, and then the dirty pages registered in the internal memory are scanned and transferred to the destination host through DMA.
可选的,主机启动时预留SMM态专用存储空间,其中:SMI中断处理处理程序功能为:根据自研硬件状态,决定执行如下动作之一;令SMI中断处理返回到vmx非根态继续执行SMI中断发生前的指令,开启对用户实例的脏页追踪功能,并将脏页信息存储在可被自研硬件访问的内存区域,EPT页表的存储空间和脏页信息的存储空间。Optionally, reserve SMM state dedicated storage space when the host starts, where: SMI interrupt processing program function is: according to the self-developed hardware state, decide to perform one of the following actions; return SMI interrupt processing to vmx non-root state to continue execution The instruction before the SMI interrupt occurs, enables the dirty page tracking function of the user instance, and stores the dirty page information in the memory area accessible by self-developed hardware, the storage space of the EPT page table and the storage space of dirty page information.
迁移部件获取到标识集合后,需要一段时间发送该标识集合中的标识对应的内存页保存的数据,在发送数据的过程中应用实例还继续运行,在运行的过程中,应用实例还可能向应用访问区域写入数据,所以在完成一次数据发送后,还可以继续通过如下步骤401至407迁移内存数据,参见图6,该步骤401至407分别为:After the migration component obtains the identification set, it takes a period of time to send the data stored in the memory page corresponding to the identification in the identification set. The application instance continues to run during the process of sending data. During the operation, the application instance may also send the data to the application The access area writes data, so after completing a data transmission, you can continue to migrate the memory data through the following steps 401 to 407, see Figure 6, the steps 401 to 407 are:
步骤401:迁移部件在发送第二标识集合中的标识对应的内存页中保存的数据之后,向CPU发送迁移命令。下述将迁移命令也称为内存页获取命令,用于获取脏页信息。Step 401: After sending the data stored in the memory page corresponding to the identifier in the second identifier set, the migration component sends a migration command to the CPU. The following migration command is also referred to as a memory page acquisition command, which is used to acquire dirty page information.
第二标识集合是迁移部件在最近上一次获取的标识集合,也就是CPU在最近上一次生成的标识集合。当CPU最近上一次生成的标识集合为第一标识集合时,第二标识集合和第一标识集合相同。The second identification set is the identification set acquired by the migration component last time, that is, the identification set generated by the CPU last time. When the last identifier set generated by the CPU is the first identifier set, the second identifier set is the same as the first identifier set.
在本步骤中,迁移部件的处理器可以从迁移部件的存储器中读取NMI中断方式和迁移命令,向迁出控制接口写入该迁移命令,根据该NMI中断方式,通过中断接口向CPU发送第二中断信号。In this step, the processor of the migration component can read the NMI interruption mode and migration command from the memory of the migration component, write the migration command to the migration control interface, and send the first migration command to the CPU through the interrupt interface according to the NMI interruption mode. 2. Interrupt signal.
无论应用实例为裸金属实例,还是虚拟机,此时主机已处于虚拟态,所以迁移部件的处理器根据NMI中断方式,向CPU发送第二中断信号。Regardless of whether the application instance is a bare metal instance or a virtual machine, the host is already in a virtual state at this time, so the processor of the migration component sends a second interrupt signal to the CPU according to the NMI interrupt mode.
步骤402:CPU接收该迁移命令,生成第三标识集合,第三标识集合包括在第一时间至当前时间内应用访问区域中被应用实例写入数据的n个内存页的标识,n大于或等于1且小于或等于应用访问区域包括的内存页总数目。Step 402: The CPU receives the migration command and generates a third identification set. The third identification set includes the identifications of the n memory pages that are written by the application instance in the application access area from the first time to the current time, and n is greater than or equal to 1 and less than or equal to the total number of memory pages included in the application access area.
第一时间是基于CPU生成第二标识集合的时间确定的,例如第一时间是CPU生成第二标识集合的时间,具体是生成第二标识集合之前,还是之后,还是同时,本实施例不做限定。The first time is determined based on the time when the CPU generates the second identification set. For example, the first time is the time when the CPU generates the second identification set. Specifically, whether it is before, after, or at the same time when the second identification set is generated, this embodiment does not do it. limited.
可选的,参图5,CPU接收中断信号,根据该中断信号停止继续运行应用实例,从迁出控制接口中读取该迁移命令,以实现接收该迁移命令。Optionally, referring to FIG. 5, the CPU receives the interrupt signal, stops running the application instance according to the interrupt signal, and reads the migration command from the migration control interface to realize the reception of the migration command.
CPU接收该迁移命令后,由于该迁移命令是第x次接收的迁移命令,所以CPU根据第x次接收的迁移命令的触发,获取在第一时间至当前时间之间记录的内存页的标识,将获取的内存页的标识组成第三标识集合,x为大于1的整数。After the CPU receives the migration command, since the migration command is the migration command received the xth time, the CPU obtains the identifier of the memory page recorded between the first time and the current time according to the trigger of the migration command received the xth time. The identifiers of the acquired memory pages are formed into a third identifier set, and x is an integer greater than 1.
可选的,CPU在接收该迁移命令后,暂停运行应用实例,调用并运行内存页收集模块的实现代码,通过运行内存页收集模块获取在第一时间至当前时间之间记录的内存页的标识,将获取的内存页的标识组成第三标识集合。Optionally, after receiving the migration command, the CPU suspends running the application instance, calls and runs the implementation code of the memory page collection module, and obtains the identification of the memory page recorded between the first time and the current time by running the memory page collection module , Compose the acquired identifiers of the memory pages into a third identifier set.
可选的,在组成第三标识集合后,CPU可以删除记录的标识。Optionally, after forming the third identification set, the CPU may delete the recorded identification.
可选的,CPU在生成第三标识集合后,再将应用访问区域中的每个内存页的属性设置为写保护。当内存页的属性设置成写保护后,CPU在继续运行应用实例的过程中,在应用实例向该内存页写入数据时,CPU便可以获知该内存页被应用实例写入数据,并记录该内存页的标识。Optionally, after the CPU generates the third identification set, the attribute of each memory page in the application access area is set to write protection. When the properties of the memory page are set to write protection, the CPU can learn that the memory page is written by the application instance when the application instance writes data to the memory page while the CPU continues to run the application instance, and record the The identifier of the memory page.
可选的,在迁移数据时可以从当前可用主机的内存中分配并初始化迁出数据所需要的内存空间,这些内存空间将用于存放脏页收集模块的代码;脏页收集所需要的辅助存储空间(如用于记录脏页的存储区域);与迁移部件的信息交互的缓冲区(比如,供CPU写入脏页信息或迁移部件写入控制命令,例如为交互缓冲区、迁移部件包括的中断接口、迁出控制接口、状态通知接口、设置接口、DMA接口),并调整应用实例可访问的物理内存范围,确保应用实例不可能访问到此内存空间;以及对主机的CPU进行设置,使得CPU在收到迁 移部件发出的中断后,会立即中断应用实例的运行,立即将控制转到脏页收集模块的中断处理入口执行。向迁移部件写入脏页收集模块期望的通信方法(如:分配的信息交互缓冲区的物理内存地址是0x100000处,长度为8192字节;脏页收集模块期望通过NMI中断获取通知)。Optionally, when migrating data, you can allocate and initialize the memory space required for data migration from the memory of the currently available host. These memory spaces will be used to store the code of the dirty page collection module; auxiliary storage required for dirty page collection Space (such as a storage area used to record dirty pages); buffers for information interaction with migration components (for example, for CPU to write dirty page information or migration components write control commands, such as interactive buffers, migration components included Interrupt interface, migration control interface, status notification interface, setting interface, DMA interface), and adjust the range of physical memory accessible to the application instance to ensure that the application instance cannot access this memory space; and to set the host's CPU so that After the CPU receives the interrupt issued by the migration component, it will immediately interrupt the operation of the application instance and immediately transfer control to the interrupt processing entry of the dirty page collection module for execution. Write the communication method expected by the dirty page collection module to the migration component (for example, the physical memory address of the allocated information exchange buffer is 0x100000 and the length is 8192 bytes; the dirty page collection module expects to obtain notification through the NMI interrupt).
步骤403:CPU向迁移部件提供第三标识集合。Step 403: The CPU provides a third identification set to the migration component.
可选的,CPU可以将第三标识集合写入到交互缓冲区域,向迁移部件的状态通知接口写入集合生成完成消息,以实现向迁移部件提供第三标识集合。Optionally, the CPU may write the third identification set to the interaction buffer area, and write the set generation completion message to the status notification interface of the migration component, so as to provide the third identification set to the migration component.
可选的,交互缓冲区域包括空间大小相等的多个缓冲区域。在本步骤中,CPU从多个缓冲区域中选择一个缓冲区域,选择的该缓冲区域与CPU最近上一次选择的缓冲区域不同,将第三标识集合写入选择的缓冲区域,向迁移部件的状态通知接口写入集合生成完成消息,该集合生成完成消息携带选择的缓冲区域的标识。Optionally, the interactive buffer area includes a plurality of buffer areas of equal size. In this step, the CPU selects a buffer area from multiple buffer areas, and the selected buffer area is different from the last selected buffer area by the CPU, and writes the third set of identifiers into the selected buffer area to transfer the status of the component The notification interface writes a set generation complete message, and the set generation complete message carries the identifier of the selected buffer area.
例如,交互缓冲区域包括空间大小相等的第一缓冲区域和第二缓冲区域。CPU从第一缓冲区域和第二缓冲区域中选择一个缓冲区域。For example, the interactive buffer area includes a first buffer area and a second buffer area with equal spaces. The CPU selects a buffer area from the first buffer area and the second buffer area.
可选的,参见图5,CPU将第三标识集合写入交互缓冲区域后,可以继续运行应用实例。Optionally, referring to FIG. 5, after the CPU writes the third set of identifiers into the interactive buffer area, the application instance can continue to run.
步骤404:迁移部件获取CPU提供的第三标识集合,第三标识集合包括该n个内存页的标识。Step 404: The migration component obtains a third identifier set provided by the CPU, and the third identifier set includes the identifiers of the n memory pages.
迁移部件从其状态通知接口读取集合生成完成消息,根据该集合生成完成消息,从交互缓冲区域中读取第三标识集合。The migration component reads the set generation completion message from its state notification interface, generates the completion message according to the set, and reads the third identification set from the interaction buffer area.
可选的,状态通知接口可以是迁移部件中的一个寄存器,当CPU向迁移部件的状态通知接口中写入集合生成完成消息时,迁移部件的处理器可以发现其状态通知接口被写入消息,并从该状态通知接口中读取集合生成完成消息。或者,状态通知接口可以为是内存中一个存储区域,迁移部件的处理器在发送完该迁移命令后,定期或不定期地读取状态通知接口,当CPU向状态通知接口中写入集合生成完成消息后,迁移部件的处理器便从状态通知接口读取到该集合生成完成消息。Optionally, the status notification interface may be a register in the migration component. When the CPU writes the set generation completion message to the status notification interface of the migration component, the processor of the migration component can find that the status notification interface is written with the message. And read the collection generation completion message from the status notification interface. Alternatively, the status notification interface can be a storage area in the memory. After sending the migration command, the processor of the migration component will periodically or irregularly read the status notification interface. When the CPU writes the set to the status notification interface, the generation is completed After the message, the processor of the migration component reads the set generation completion message from the state notification interface.
可选的,当交互缓冲区域包括一个区域时,迁移部件包括的处理器从迁移部件包括的存储器中读取交互缓冲区域的地址和空间大小,根据该地址和空间大小确定出内存中的交互缓冲区域,从交互缓冲区域中读取第三标识集合。Optionally, when the interaction buffer area includes an area, the processor included in the migration component reads the address and space size of the interaction buffer area from the memory included in the migration component, and determines the interaction buffer in the memory according to the address and space size Area, read the third identification set from the interactive buffer area.
当交互缓冲区域包括空间大小相等的多个缓冲区域时,迁移部件的处理器读取的集合生成完成消息携带CPU选择的缓冲区域的标识,迁移部分的处理器从迁移部件的存储器中获取该标识对应的缓冲区域的地址和空间大小,根据该地址和空间大小确定CPU选择的缓冲区域,从该确定的缓冲区域中读取第三标识集合。When the interactive buffer area includes multiple buffer areas of equal size, the set generation completion message read by the processor of the migration component carries the identifier of the buffer area selected by the CPU, and the processor of the migration component obtains the identifier from the memory of the migration component. The address and space size of the corresponding buffer area, the buffer area selected by the CPU is determined according to the address and the space size, and the third set of identifiers is read from the determined buffer area.
步骤405:迁移部件判断该n个内存页的总容量是否超过预设阈值,如果超过,则执行步骤406,如果未超过,则执行步骤407。Step 405: The migration component judges whether the total capacity of the n memory pages exceeds a preset threshold, if it exceeds, execute step 406, and if it does not exceed, execute step 407.
可选的,内存中的每个内存页的大小相等,迁移部件的处理器可以从迁移部件的存储器中读取内存页的大小,根据第三标识集合包括的标识数目n和该内存页的大小获取该n个内存页的总容量,确定该总容量是否超过预设阈值。Optionally, the size of each memory page in the memory is equal, and the processor of the migration component can read the size of the memory page from the memory of the migration component, according to the number n of identifiers included in the third identifier set and the size of the memory page Obtain the total capacity of the n memory pages, and determine whether the total capacity exceeds a preset threshold.
可选的,内存中的每个内存页的大小不等,迁移部件的处理器可以从迁移部件的存储器中读取根据第三标识集合包括的每个标识对应的内存页的大小,根据每个标识对应的内存页的大小获取该n个内存页的总容量,确定该总容量是否超过预设阈值。Optionally, the size of each memory page in the memory is not equal, the processor of the migration component can read from the memory of the migration component the size of the memory page corresponding to each identifier included in the third identifier set, according to each Identify the size of the corresponding memory page to obtain the total capacity of the n memory pages, and determine whether the total capacity exceeds a preset threshold.
步骤406:迁移部件发送第三标识集合中的标识对应的内存页内保存的数据,返回执行步骤401。Step 406: The migration component sends the data stored in the memory page corresponding to the identifier in the third identifier set, and returns to perform step 401.
在本步骤中,迁移部件包括的处理器可以根据第三标识集合中的标识,通过DMA接口从该标识对应的内存页中读取数据,通过网络收发接口向目的主机发送读取的数据。In this step, the processor included in the migration component can read data from the memory page corresponding to the identifier through the DMA interface according to the identifier in the third identifier set, and send the read data to the destination host through the network transceiver interface.
可选的,迁移部件的处理器可以从第三标识集合中选择至少一个标识,选择的每个标识对应的内存页的总容量小于或等于最大允许容量,发送选择的每个标识对应的内存页内保存的数据。这样可以减小两次发送数据的数据量,以减小两次发送数据的时间,可以尽量避免应用实例在向某内存页写入数据后,该数据还未被迁移部件发送又被应用实例重新写入的数据覆盖掉。Optionally, the processor of the migration component may select at least one identifier from the third identifier set, and the total capacity of the memory page corresponding to each selected identifier is less than or equal to the maximum allowable capacity, and sends the memory page corresponding to each selected identifier Data saved inside. This can reduce the amount of data sent twice, so as to reduce the time of sending data twice, and can try to avoid the application instance after writing data to a memory page, the data has not been sent by the migration component and re-reset by the application instance. The written data is overwritten.
可选的,通常情况下第三标识集合中的标识不是很多,第三标识集合中的标识数目小于或等于预设数目阈值,所以通常情况下迁移部件的处理器会选择第三标识集合中的所有标识。Optionally, usually there are not many identities in the third identity set, and the number of identities in the third identity set is less than or equal to the preset number threshold. Therefore, in general, the processor of the migration component will select the identities in the third identity set. All logos.
可选的,迁移部件的处理器在获取到第二标识集合后,如果没有选择完第二标识集合中的所有标识,即第二标识集合中还存在未选择的标识,则在从第三标识集合中选择标识之前,将第二标识集合中未选择的标识添加到第三标识集合中,然后再从第三标识集合中选择标识。Optionally, after the processor of the migration component obtains the second identification set, if all the identifications in the second identification set have not been selected, that is, there are still unselected identifications in the second identification set, then the third identification Before selecting the identity in the set, add the unselected identity in the second identity set to the third identity set, and then select the identity from the third identity set.
步骤407:迁移部件向CPU发停止迁移命令,发送第三标识集合中的标识对应的内存页内保存的数据,结束操作。Step 407: The migration component sends a stop migration command to the CPU, sends the data stored in the memory page corresponding to the identifier in the third identifier set, and ends the operation.
在本步骤中,迁移部件的处理器可以从迁移部件的存储器中读取中断方式和停止迁移命令,向迁出控制接口写入停止迁移命令,根据该中断方式,通过中断接口向CPU发送中断信号。迁移部件的处理器可以根据第三标识集合中的每个标识,通过DMA接口从每个标识对应的内存页中读取数据,通过网络收发接口向目的主机发送读取的数据。In this step, the processor of the migration component can read the interrupt mode and stop migration command from the memory of the migration component, write the stop migration command to the migration control interface, and send an interrupt signal to the CPU through the interrupt interface according to the interrupt mode . The processor of the migration component may read data from the memory page corresponding to each identifier through the DMA interface according to each identifier in the third identifier set, and send the read data to the destination host through the network transceiver interface.
可选的,CPU接收中断信号,根据该中断信号停止继续运行应用实例,从迁出控制接口中读取该停止迁移命令,根据该停止迁移命令停止继续运行应用实例。Optionally, the CPU receives an interrupt signal, stops running the application instance according to the interrupt signal, reads the migration stop command from the migration control interface, and stops running the application instance according to the migration stop command.
该n个内存页的总容量未超过预设阈值,表示迁移部件已获取到应用实例产生的所有数据,再继续运行应用实例,应用实例可能不会产生新的数据,因此可以停止继续运行应用实例,并在将第三标识集合中的每个标识对应的内存页中保存的数据发送后,就可以关机主机。The total capacity of the n memory pages does not exceed the preset threshold, indicating that the migration component has obtained all the data generated by the application instance, and then continues to run the application instance, the application instance may not generate new data, so you can stop continuing to run the application instance , And after sending the data stored in the memory page corresponding to each identifier in the third identifier set, the host can be shut down.
其中,交互缓冲区被用于存放脏页信息,即第一标识集合、第二标识集合或第三标识集合,它被划分为两个大小相同但不重叠的缓冲区域,一个用于供迁移部件以DMA方式获取脏页信息,另外一个用于供脏页收集模块缓存最新的脏页信息,脏页收集模块通过状态通知接口告知迁移部件从哪个区域获取脏页信息,并将另外那个缓冲区域用于缓存脏页信息。Among them, the interactive buffer is used to store dirty page information, that is, the first identification set, the second identification set, or the third identification set. It is divided into two buffer areas of the same size but not overlapping, and one is used for migration components. Dirty page information is obtained by DMA, and the other is used for the dirty page collection module to cache the latest dirty page information. The dirty page collection module informs the migration component from which area to obtain dirty page information through the status notification interface, and uses the other buffer area To cache dirty page information.
SMI中断处理程序负责响应智能外设发出的SMI中断,并将当前用户设置为在虚拟态运行。具体的说,SMI中断处理程序在因SMI中断获得CPU的控制权后,执行包括如下步骤的流程:The SMI interrupt handler is responsible for responding to the SMI interrupt sent by the smart peripheral and setting the current user to run in a virtual state. Specifically, after the SMI interrupt handler obtains control of the CPU due to the SMI interrupt, it executes a process including the following steps:
(1)、开启当前处理器的虚拟化支持能力。(1) Turn on the virtualization support capability of the current processor.
(2)、为以虚拟态运行当前应用实例创建相关的数据结构,这些数据结构除了可保证应用实例能在虚拟态运行之外,还满足如下约束:1)、若处理器在虚拟态运行时收到NMI中断,则从虚拟态退出,令脏页收集模块获得控制权;2)、应用实例在开始运行时,应用实 例所能访问的物理内存全部处于写保护状态;3)、当应用实例在虚拟态运行时,修改处于写保护状态的内存将导致处理器执行脏页收集模块,记录被修改的物理内存地址信息;4)、应用实例的各个处理器之间不能直接发送NMI中断,而只能虚拟机运行支持模块代为发送。(2) Create related data structures for running the current application instance in a virtual state. These data structures can not only ensure that the application instance can run in the virtual state, but also meet the following constraints: 1) If the processor is running in the virtual state After receiving the NMI interrupt, it exits from the virtual state and makes the dirty page collection module gain control; 2) When the application instance starts to run, the physical memory that the application instance can access is all in a write-protected state; 3) When the application instance When the virtual state is running, modifying the memory in the write-protected state will cause the processor to execute the dirty page collection module to record the modified physical memory address information; 4) The various processors of the application instance cannot directly send NMI interrupts, and Only the virtual machine running support module can send it on its behalf.
(3)、将交互缓冲区中脏页信息初始化为“应用实例可以访问的所有物理内存均被修改”。(3) Initialize the dirty page information in the interactive buffer to "all physical memory accessible by the application instance has been modified".
(4)、通过主机状态通知接口,通知迁移部件“脏页收集完成”。(4), through the host status notification interface, notify the migration component of "Dirty Page Collection Complete".
(5)、在虚拟态继续运行当前应用实例。(5) Continue to run the current application instance in the virtual state.
虚拟机运行支持模块与传统虚拟化技术中的虚拟机监控器(VMM)功能相近,它负责保证用户实例能够在x86处理器的非根态正常运行。当处理器因为接收到NMI中断而退出非根态时,虚拟机运行支持模块查询迁出控制接口,在此接口被设置了有效控制命令时,调用脏页采集模块执行智能外设所期望的动作。The virtual machine operation support module is similar to the virtual machine monitor (VMM) function in the traditional virtualization technology. It is responsible for ensuring that the user instance can run normally in the non-root state of the x86 processor. When the processor exits the non-root state because of receiving an NMI interrupt, the virtual machine running support module queries the migration control interface. When this interface is set with a valid control command, it calls the dirty page collection module to perform the actions expected by the smart peripheral .
在本实施例中,智能外设首先通过SMI中断唤醒脏页采集模块,之后使用NMI中断与脏页采集模块通信的原因是:SMI中断的开销显著高于NMI中断,故在NMI中断也能达到目的时,换用NMI中断。In this embodiment, the smart peripheral first wakes up the dirty page collection module through the SMI interrupt, and then uses the NMI interrupt to communicate with the dirty page collection module because the cost of the SMI interrupt is significantly higher than the NMI interrupt, so the NMI interrupt can also achieve For the purpose, use NMI interrupt instead.
在本申请实施例中,迁移部件可以向CPU发送迁移命令,CPU根据该迁移命令暂停运行应用实例,生成标识集合(可以为第一标识集合或为第三标识集合),该标识集合包括应用访问区域中的待迁移的至少一个内存页的标识,向迁移部件提供该标识集合,然后继续运行应用实例;迁移部件获取CPU提供的该标识集合,发送该标识集合中的标识对应的内存页内保存的数据。这样通过迁移部件分担CPU部分迁移操作,从而可以减少对CPU资源的消耗。In the embodiment of the present application, the migration component may send a migration command to the CPU, and the CPU suspends running the application instance according to the migration command, and generates an identification set (may be the first identification set or the third identification set), and the identification set includes application access The identification of at least one memory page to be migrated in the area, provides the identification set to the migration component, and then continues to run the application instance; the migration component obtains the identification set provided by the CPU, and sends the identification in the identification set to the memory page corresponding to the storage The data. In this way, part of the CPU migration operation is shared by the migration component, thereby reducing the consumption of CPU resources.
参见图7,本申请实施例提供了一种迁移数据的装置500。该装置可以为网卡,或为集成在网卡上的一个迁移部件。所述装置500应用于包括CPU、存储器和该装置500的主机,CPU用于运行应用实例,存储器包括供应用实例访问的应用访问区域,该装置500包括:Referring to FIG. 7, an embodiment of the present application provides an apparatus 500 for migrating data. The device can be a network card or a migration component integrated on the network card. The device 500 is applied to a host including a CPU, a memory, and the device 500. The CPU is used to run an application instance, and the memory includes an application access area accessed by an application instance. The device 500 includes:
发送单元501,用于向CPU发送迁移命令,该迁移命令用于触发CPU生成标识集合,该标识集合包括应用访问区域中的待迁移的至少一个存储单元的标识;The sending unit 501 is configured to send a migration command to the CPU, where the migration command is used to trigger the CPU to generate an identification set, the identification set including an identification of at least one storage unit to be migrated in an application access area;
处理单元502,用于获取该标识集合;The processing unit 502 is configured to obtain the identification set;
发送单元501,还用于发送该标识集合中的标识对应的存储单元内保存的数据。The sending unit 501 is further configured to send the data stored in the storage unit corresponding to the identifier in the identifier set.
可选的,发送单元501,用于:Optionally, the sending unit 501 is configured to:
在处理单元502确定开始迁移应用访问区域保存的数据时,向CPU发送迁移命令,该迁移命令用于触发CPU生成第一标识集合,第一标识集合包括应用访问区域中的每个存储单元的标识。When the processing unit 502 determines to start migrating the data stored in the application access area, it sends a migration command to the CPU. The migration command is used to trigger the CPU to generate a first identification set. The first identification set includes the identification of each storage unit in the application access area. .
可选的,发送单元501,用于:Optionally, the sending unit 501 is configured to:
在发送单元501发送第二标识集合中的标识对应的存储单元内保存的数据之后,向CPU发送迁移命令,第二标识集合是CPU最近上一次生成的标识集合,该迁移命令用于触发CPU生成第三标识集合,第三标识集合包括在第一时间至当前时间内应用访问区域中被应用实例写入数据的n个存储单元的标识,第一时间为CPU生成第二标识集合的时间,n为整数,n大于或等于1且小于或等于应用访问区域包括的存储单元总数目。After the sending unit 501 sends the data stored in the storage unit corresponding to the identifiers in the second identifier set, it sends a migration command to the CPU. The second identifier set is the identifier set generated by the CPU last time. The migration command is used to trigger the CPU to generate The third identification set. The third identification set includes identifications of n storage units that are written by the application instance in the application access area from the first time to the current time. The first time is the time when the CPU generates the second identification set, n It is an integer, n is greater than or equal to 1 and less than or equal to the total number of storage cells included in the application access area.
可选的,该装置500包括中断接口和迁移控制接口,Optionally, the device 500 includes an interrupt interface and a migration control interface,
处理单元502,还用于向迁移控制接口写入迁移命令;The processing unit 502 is further configured to write a migration command to the migration control interface;
发送单元501,用于通过中断接口向CPU发送中断信号,该中断信号用于触发CPU从迁移控制接口中读取该迁移命令。The sending unit 501 is configured to send an interrupt signal to the CPU through the interrupt interface, and the interrupt signal is used to trigger the CPU to read the migration command from the migration control interface.
可选的,该装置500包括状态通知接口,存储器还包括交互缓冲区域,处理单元502,用于:Optionally, the device 500 includes a status notification interface, the memory also includes an interactive buffer area, and the processing unit 502 is configured to:
从状态通知接口中读取集合生成完成信息,该集合生成完成信息是CPU在将该标识集合写入到交互缓冲区域之后写入到状态通知接口中的;Read the collection generation completion information from the status notification interface, and the collection generation completion information is written into the status notification interface by the CPU after writing the identification collection to the interactive buffer area;
从交互缓冲区域读取该标识集合。Read the set of identifiers from the interactive buffer area.
可选的,交互缓冲区域包括第一缓冲区域和第二缓冲区域,集合生成完成信息携带缓冲区域的标识,缓冲区域是CPU从第一缓冲区域和第二缓冲区域中选择的缓冲区域述CPU选择的缓冲区域与CPU最近上一次选择的缓冲区域不同;Optionally, the interactive buffer area includes a first buffer area and a second buffer area, and the collectively generated information carries the identifier of the buffer area, and the buffer area is a buffer area selected by the CPU from the first buffer area and the second buffer area. CPU selection The buffer area of is different from the buffer area selected last time by the CPU;
处理单元502,用于:The processing unit 502 is used for:
从CPU选择的缓冲区域的标识对应的缓冲区域中读取该标识集合。The identifier set is read from the buffer area corresponding to the identifier of the buffer area selected by the CPU.
可选的,发送单元501,用于:Optionally, the sending unit 501 is configured to:
在该标识集合中的每个标识对应的存储单元的总容量超过预设阈值时,发送该标识集合中的标识对应的存储单元内保存的数据;When the total capacity of the storage unit corresponding to each identifier in the identifier set exceeds a preset threshold, sending the data stored in the storage unit corresponding to the identifier in the identifier set;
在该标识集合中的每个标识对应的存储单元的总容量未超过预设阈值时,向CPU发送停止迁移命令,该停止迁移命令用于触发CPU停止运行所述应用实例,以及发送该标识集合中的标识对应的存储单元内保存的数据。When the total capacity of the storage unit corresponding to each identifier in the identifier set does not exceed the preset threshold, a migration stop command is sent to the CPU, and the migration stop command is used to trigger the CPU to stop running the application instance and send the identifier set The identifier in corresponds to the data stored in the storage unit.
在本申请实施例中,发送单元可以向CPU发送迁移命令,使CPU生成标识集合,该标识集合包括应用访问区域中的待迁移的至少一个存储单元的标识,处理单元获取CPU提供该标识集合,发送该标识集合中的标识对应的存储单元内保存的数据。这样通过发送单元和处理单元分担CPU部分迁移操作,从而可以减少对CPU资源的消耗。In the embodiment of the present application, the sending unit may send a migration command to the CPU to cause the CPU to generate an identification set that includes the identification of at least one storage unit to be migrated in the application access area, and the processing unit obtains the identification set provided by the CPU, Send the data stored in the storage unit corresponding to the identifier in the identifier set. In this way, the sending unit and the processing unit share part of the CPU migration operation, thereby reducing the consumption of CPU resources.
参见图8,本申请实施例提供了一种处理器600,所述处理器600应用于包括存储器、迁移部件和所述处理器600的主机,所述处理器600用于运行应用实例,存储器包括供应用实例访问的应用访问区域,所述处理器600包括:Referring to FIG. 8, an embodiment of the present application provides a processor 600 that is applied to a host including a memory, a migration component, and the processor 600, and the processor 600 is configured to run an application instance, and the memory includes For the application access area accessed by the application instance, the processor 600 includes:
接收单元601,用于接收迁移部件发送的迁移命令;The receiving unit 601 is configured to receive a migration command sent by the migration component;
处理单元602,用于根据该迁移命令生成标识集合,该标识集合包括应用访问区域中的待迁移的至少一个存储单元的标识;The processing unit 602 is configured to generate an identification set according to the migration command, the identification set including an identification of at least one storage unit to be migrated in the application access area;
处理单元602,还用于向迁移部件提供该标识集合,以使迁移部件发送该标识集合中的标识对应的存储单元内保存的数据。The processing unit 602 is further configured to provide the identifier set to the migration component, so that the migration component sends the data stored in the storage unit corresponding to the identifier in the identifier set.
可选的,迁移部件包括中断接口和迁移控制接口,接收单元601,用于接收迁移部件通过中断接口发送的中断信号;Optionally, the migration component includes an interrupt interface and a migration control interface, and the receiving unit 601 is configured to receive an interrupt signal sent by the migration component through the interrupt interface;
处理单元602,还用于根据该中断信号从迁移控制接口中读取迁移命令,该迁移命令是迁移部件在发送该中断信号之前写入到迁移控制接口中的。The processing unit 602 is further configured to read a migration command from the migration control interface according to the interrupt signal, and the migration command is written into the migration control interface by the migration component before sending the interrupt signal.
可选的,处理单元602,用于:Optionally, the processing unit 602 is configured to:
在该迁移命令是接收单元601第一次接收的迁移命令时,生成第一标识集合,该迁移命令是迁移部件在确定开始迁移应用访问区域保存的数据时发送的,第一标识集合包括应用访问区域中的每个存储单元的标识。When the migration command is the migration command received for the first time by the receiving unit 601, a first identification set is generated. The migration command is sent when the migration component determines to start migrating data stored in the application access area. The first identification set includes application access. The identifier of each storage unit in the area.
可选的,处理单元602,用于:Optionally, the processing unit 602 is configured to:
在该迁移命令是接收单元601第x次接收的迁移命令时,生成第三标识集合,x为大于1的整数,该迁移命令是迁移部件在发送第二标识集合中的标识对应的存储单元内保存的数据之后发送的,第二标识集合是处理单元602最近上一次生成的标识集合,第三标识集合包括在第一时间至当前时间内应用访问区域中被应用实例写入数据的n个存储单元的标识,第一时间为处理单元602生成第二标识集合的时间,n为整数,n大于或等于1且小于或等于应用访问区域包括的存储单元总数目。When the migration command is the migration command received by the receiving unit 601 for the xth time, a third identification set is generated, where x is an integer greater than 1, and the migration command is the storage unit corresponding to the identification in the second identification set sent by the migration component After the saved data is sent, the second identification set is the identification set generated last time by the processing unit 602, and the third identification set includes n storages where data is written by the application instance in the application access area from the first time to the current time. The identification of the unit, the first time is the time when the processing unit 602 generates the second identification set, n is an integer, and n is greater than or equal to 1 and less than or equal to the total number of storage units included in the application access area.
可选的,迁移部件包括状态通知接口,存储器还包括交互缓冲区域,处理单元602,用于:Optionally, the migration component includes a status notification interface, the memory also includes an interactive buffer area, and the processing unit 602 is configured to:
将该标识集合写入到交互缓冲区域,以及在状态通知接口写入集合生成完成信息,该集合生成完成信息用于触发迁移部件从交互缓冲区域中获取该标识集合。The identification set is written into the interaction buffer area, and the set generation completion information is written in the status notification interface, and the set generation completion information is used to trigger the migration component to obtain the identification set from the interaction buffer area.
可选的,交互缓冲区域包括第一缓冲区域和第二缓冲区域,处理单元602,用于:Optionally, the interactive buffer area includes a first buffer area and a second buffer area, and the processing unit 602 is configured to:
从第一缓冲区域和第二缓冲区域中选择一个缓冲区域,选择的缓冲区域与处理单元602最近上一次选择的缓冲区域不同,Select a buffer area from the first buffer area and the second buffer area, the selected buffer area is different from the buffer area selected last time by the processing unit 602,
将该标识集合写入到选择的缓冲区域中,以及在状态通知接口写入集合生成完成信息,集合生成完成信息携带选择的缓冲区的标识。The identification set is written into the selected buffer area, and the set generation completion information is written in the status notification interface. The set generation completion information carries the identification of the selected buffer.
在本申请实施例中,接收单元可以接收迁移部件发送的迁移命令,处理单元根据该迁移命令暂停运行应用实例,生成标识集合(可以为第一标识集合或为第三标识集合),该标识集合包括应用访问区域中的待迁移的至少一个存储单元的标识,向迁移部件提供该标识集合,然后继续运行应用实例;迁移部件获取CPU提供的该标识集合,发送该标识集合中的标识对应的存储单元内保存的数据。这样通过迁移部件分担该处理器部分迁移操作,从而可以减少对该处理器资源的消耗。In the embodiment of the present application, the receiving unit may receive the migration command sent by the migration component, the processing unit suspends running the application instance according to the migration command, and generates an identification set (may be the first identification set or the third identification set), and the identification set Include the identifier of at least one storage unit to be migrated in the application access area, provide the identifier set to the migration component, and then continue to run the application instance; the migration component obtains the identifier set provided by the CPU, and sends the storage corresponding to the identifier in the identifier set Data saved in the unit. In this way, the migration component is used to share part of the migration operation of the processor, thereby reducing the consumption of the processor resources.
参见图9,本申请实施例提供了一种迁移数据的系统700,所述系统700为计算机系统。所述系统700包括如图7所述的装置500和如图8所述的处理器600,所述装置500可以为迁移部件701,所述处理器600可以为CPU702。Referring to FIG. 9, an embodiment of the present application provides a system 700 for migrating data, and the system 700 is a computer system. The system 700 includes an apparatus 500 as described in FIG. 7 and a processor 600 as described in FIG. 8. The apparatus 500 may be a migration component 701, and the processor 600 may be a CPU 702.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the foregoing embodiments can be implemented by hardware, or by a program instructing relevant hardware to be completed. The program can be stored in a computer-readable storage medium. The storage medium mentioned can be a read-only memory, a magnetic disk or an optical disk, etc.
以上所述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above descriptions are only optional embodiments of this application and are not intended to limit this application. Any modification, equivalent replacement, improvement, etc. made within the principles of this application shall be included in the protection scope of this application. Inside.

Claims (31)

  1. 一种迁移数据的方法,其特征在于,所述方法应用于包括处理器、存储器和迁移部件的主机,所述处理器用于运行应用实例,所述存储器包括供所述应用实例访问的应用访问区域,所述方法包括:A method for migrating data, characterized in that the method is applied to a host including a processor, a memory, and a migration component, the processor is used to run an application instance, and the memory includes an application access area accessible by the application instance , The method includes:
    所述迁移部件向所述处理器发送迁移命令,所述迁移命令用于触发所述处理器生成标识集合,所述标识集合包括所述应用访问区域中的待迁移的至少一个存储单元的标识;Sending, by the migration component, a migration command to the processor, the migration command being used to trigger the processor to generate an identification set, the identification set including an identification of at least one storage unit to be migrated in the application access area;
    所述迁移部件获取所述标识集合;The migration component obtains the identification set;
    所述迁移部件发送所述标识集合中的标识对应的存储单元内保存的数据。The migration component sends the data stored in the storage unit corresponding to the identifier in the identifier set.
  2. 如权利要求1所述的方法,其特征在于,所述标识集合包括所述应用访问区域中的每个存储单元的标识。The method according to claim 1, wherein the identification set includes an identification of each storage unit in the application access area.
  3. 如权利要求1所述的方法,其特征在于,所述标识集合包括在第一时间至当前时间内所述应用访问区域中被所述应用实例写入数据的n个存储单元的标识,其中,所述第一时间为所述处理器最近上一次生成标识集合的时间,n为整数,n大于或等于1且小于或等于所述应用访问区域包括的存储单元总数目。The method according to claim 1, wherein the set of identifiers includes the identifiers of n storage units in the application access area that are written by the application instance from the first time to the current time, wherein, The first time is the last time the processor generated the identification set last time, n is an integer, and n is greater than or equal to 1 and less than or equal to the total number of storage units included in the application access area.
  4. 如权利要求1至3任一项所述的方法,其特征在于,所述迁移部件包括中断接口和迁移控制接口,所述迁移部件向所述处理器发送迁移命令,包括:The method according to any one of claims 1 to 3, wherein the migration component includes an interrupt interface and a migration control interface, and the migration component sending a migration command to the processor includes:
    所述迁移部件向所述迁移控制接口写入迁移命令;The migration component writes a migration command to the migration control interface;
    所述迁移部件通过所述中断接口向所述处理器发送中断信号,所述中断信号用于触发所述处理器从所述迁移控制接口中读取所述迁移命令。The migration component sends an interrupt signal to the processor through the interrupt interface, where the interrupt signal is used to trigger the processor to read the migration command from the migration control interface.
  5. 如权利要求1至4任一项所述的方法,其特征在于,所述迁移部件包括状态通知接口,所述存储器还包括交互缓冲区域,所述迁移部件获取所述标识集合,包括:The method according to any one of claims 1 to 4, wherein the migration component includes a status notification interface, the memory further includes an interactive buffer area, and the migration component acquiring the identification set includes:
    所述迁移部件从所述状态通知接口中读取集合生成完成信息,所述集合生成完成信息是所述处理器在将所述标识集合写入到所述交互缓冲区域之后写入到所述状态通知接口中的;The migration component reads collection generation completion information from the status notification interface, where the collection generation completion information is written to the status by the processor after writing the identification collection to the interaction buffer area In the notification interface;
    所述迁移部件从所述交互缓冲区域读取所述标识集合。The migration component reads the identification set from the interaction buffer area.
  6. 如权利要求5所述的方法,其特征在于,所述交互缓冲区域包括多个缓冲区域,所述集合生成完成信息携带缓冲区域的标识,所述缓冲区域是所述处理器从所述多个缓冲区域中选择的缓冲区域,所述处理器选择的缓冲区域与所述处理器最近上一次选择的缓冲区域不同;The method according to claim 5, wherein the interactive buffer area includes a plurality of buffer areas, the set generation completion information carries the identifier of the buffer area, and the buffer area is the processor from the plurality of buffer areas. The buffer area selected in the buffer area, the buffer area selected by the processor is different from the buffer area selected last time by the processor;
    所述迁移部件从所述交互缓冲区域读取所述标识集合,包括:The migration component reading the identifier set from the interaction buffer area includes:
    所述迁移部件从所述处理器选择的缓冲区域的标识对应的缓冲区域中读取所述标识集合。The migration component reads the identifier set from the buffer area corresponding to the identifier of the buffer area selected by the processor.
  7. 如权利要求1至6任一项所述的方法,其特征在于,所述迁移部件获取所述标识集合之后,还包括:The method according to any one of claims 1 to 6, wherein after the migration component obtains the identification set, the method further comprises:
    在所述标识集合中的每个标识对应的存储单元的总容量未超过预设阈值时,所述迁移部件向所述处理器发送停止迁移命令,所述停止迁移命令用于触发所述处理器停止运行所述应用实例。When the total capacity of the storage unit corresponding to each identifier in the identifier set does not exceed a preset threshold, the migration component sends a migration stop command to the processor, and the migration stop command is used to trigger the processor Stop running the application instance.
  8. 一种迁移数据的方法,其特征在于,所述方法应用于包括处理器、存储器和迁移部件的主机,所述处理器用于运行应用实例,所述存储器包括供所述应用实例访问的应用访问区域,所述方法包括:A method for migrating data, characterized in that the method is applied to a host including a processor, a memory, and a migration component, the processor is used to run an application instance, and the memory includes an application access area accessible by the application instance , The method includes:
    所述处理器接收所述迁移部件发送的迁移命令;The processor receives the migration command sent by the migration component;
    所述处理器根据所述迁移命令生成标识集合,所述标识集合包括所述应用访问区域中的待迁移的至少一个存储单元的标识;Generating, by the processor, an identification set according to the migration command, the identification set including an identification of at least one storage unit to be migrated in the application access area;
    所述处理器向所述迁移部件提供所述标识集合,以使所述迁移部件发送所述标识集合中的标识对应的存储单元内保存的数据。The processor provides the identifier set to the migration component, so that the migration component sends the data stored in the storage unit corresponding to the identifier in the identifier set.
  9. 如权利要求8所述的方法,其特征在于,所述迁移部件包括中断接口和迁移控制接口,所述处理器接收所述迁移部件发送的迁移命令,包括:The method according to claim 8, wherein the migration component includes an interrupt interface and a migration control interface, and the processor receiving the migration command sent by the migration component includes:
    所述处理器接收所述迁移部件通过所述中断接口发送的中断信号;The processor receives the interrupt signal sent by the migration component through the interrupt interface;
    所述处理器根据所述中断信号从所述迁移控制接口中读取迁移命令,所述迁移命令是所述迁移部件在发送所述中断信号之前写入到所述迁移控制接口中的。The processor reads a migration command from the migration control interface according to the interrupt signal, and the migration command is written into the migration control interface by the migration component before sending the interrupt signal.
  10. 如权利要求8或9所述的方法,其特征在于,所述标识集合包括所述应用访问区域中的每个存储单元的标识。The method according to claim 8 or 9, wherein the identification set includes an identification of each storage unit in the application access area.
  11. 如权利要求8或9所述的方法,其特征在于,所述标识集合包括在第一时间至当前时间内所述应用访问区域中被所述应用实例写入数据的n个存储单元的标识,其中,所述第一时间为所述处理器最近上一次生成标识集合的时间,n为整数,n大于或等于1且小于或等于所述应用访问区域包括的存储单元总数目。The method according to claim 8 or 9, wherein the set of identifiers includes the identifiers of n storage units whose data is written by the application instance in the application access area from the first time to the current time, Wherein, the first time is the last time the processor generated the identification set last time, n is an integer, and n is greater than or equal to 1 and less than or equal to the total number of storage units included in the application access area.
  12. 如权利要求8至11任一项所述的方法,其特征在于,所述迁移部件包括状态通知接口,所述存储器还包括交互缓冲区域,所述处理器向所述迁移部件提供所述标识集合,包括:The method according to any one of claims 8 to 11, wherein the migration component includes a status notification interface, the memory further includes an interactive buffer area, and the processor provides the identification set to the migration component ,include:
    所述处理器将所述标识集合写入到所述交互缓冲区域,以及在所述状态通知接口写入集合生成完成信息,所述集合生成完成信息用于触发所述迁移部件从所述交互缓冲区域中获取所述标识集合。The processor writes the set of identifiers into the interaction buffer area, and writes the set generation completion information on the status notification interface, and the set generation completion information is used to trigger the migration component from the interaction buffer The identification set is acquired in the area.
  13. 如权利要求12所述的方法,其特征在于,所述交互缓冲区域包括多个缓冲区域,所述处理器将所述第一标识集合写入到所述交互缓冲区域,以及在所述状态通知接口写入集合生成完成信息,包括:The method according to claim 12, wherein the interactive buffer area includes a plurality of buffer areas, and the processor writes the first set of identifiers into the interactive buffer area, and notifies in the state Interface write collection generation complete information, including:
    所述处理器从所述多个缓冲区域中选择一个缓冲区域,所述选择的缓冲区域与所述处理器最近上一次选择的缓冲区域不同,The processor selects a buffer area from the plurality of buffer areas, and the selected buffer area is different from the buffer area selected last time by the processor,
    所述处理器将所述标识集合写入到所述选择的缓冲区域中,以及在所述状态通知接口写入集合生成完成信息,所述集合生成完成信息携带所述选择的缓冲区的标识。The processor writes the identifier set into the selected buffer area, and writes set generation completion information on the status notification interface, where the set generation completion information carries the identifier of the selected buffer area.
  14. 一种迁移数据的装置,其特征在于,所述装置应用于包括处理器、存储器和所述装置的主机,所述处理器用于运行应用实例,所述存储器包括供所述应用实例访问的应用访问区域,所述装置包括:A device for migrating data, characterized in that the device is applied to a host including a processor, a memory, and the device, the processor is used to run an application instance, and the memory includes application access for the application instance to access Area, the device includes:
    发送单元,用于向所述处理器发送迁移命令,所述迁移命令用于触发所述处理器生成标识集合,所述标识集合包括所述应用访问区域中的待迁移的至少一个存储单元的标识;A sending unit, configured to send a migration command to the processor, the migration command being used to trigger the processor to generate an identification set, the identification set including an identification of at least one storage unit to be migrated in the application access area ;
    处理单元,用于获取所述标识集合;A processing unit for obtaining the set of identifiers;
    所述发送单元,还用于发送所述标识集合中的标识对应的存储单元内保存的数据。The sending unit is further configured to send the data stored in the storage unit corresponding to the identifiers in the identifier set.
  15. 如权利要求14所述的装置,其特征在于,所述标识集合包括所述应用访问区域中的每个存储单元的标识。The apparatus of claim 14, wherein the identification set includes an identification of each storage unit in the application access area.
  16. 如权利要求14所述的装置,其特征在于,所述标识集合包括在第一时间至当前时间内所述应用访问区域中被所述应用实例写入数据的n个存储单元的标识,其中,所述第一时间为所述处理器最近上一次生成标识集合的时间,n为整数,n大于或等于1且小于或等于所述应用访问区域包括的存储单元总数目。The apparatus according to claim 14, wherein the set of identifiers includes identifiers of n storage units in the application access area where data is written by the application instance from the first time to the current time, wherein, The first time is the last time the processor generated the identification set last time, n is an integer, and n is greater than or equal to 1 and less than or equal to the total number of storage units included in the application access area.
  17. 如权利要求14-16任一项所述的装置,其特征在于,所述装置包括中断接口和迁移控制接口,The device according to any one of claims 14-16, wherein the device comprises an interrupt interface and a migration control interface,
    所述处理单元,还用于向所述迁移控制接口写入迁移命令;The processing unit is further configured to write a migration command to the migration control interface;
    所述发送单元,用于通过所述中断接口向所述处理器发送中断信号,所述中断信号用于触发所述处理器从所述迁移控制接口中读取所述迁移命令。The sending unit is configured to send an interrupt signal to the processor through the interrupt interface, where the interrupt signal is used to trigger the processor to read the migration command from the migration control interface.
  18. 如权利要求14至17任一项所述的装置,其特征在于,所述装置包括状态通知接口,所述存储器还包括交互缓冲区域,所述处理单元,用于:The device according to any one of claims 14 to 17, wherein the device comprises a status notification interface, the memory further comprises an interactive buffer area, and the processing unit is configured to:
    从所述状态通知接口中读取集合生成完成信息,所述集合生成完成信息是所述处理器在将所述标识集合写入到所述交互缓冲区域之后写入到所述状态通知接口中的;Read set generation completion information from the status notification interface, where the set generation completion information is written by the processor to the status notification interface after writing the identification set to the interaction buffer area ;
    从所述交互缓冲区域读取所述标识集合。Reading the identification set from the interaction buffer area.
  19. 如权利要求18所述的装置,其特征在于,所述交互缓冲区域包括多个缓冲区域,所述集合生成完成信息携带缓冲区域的标识,所述缓冲区域是所述处理器从所述多个缓冲区域中选择的缓冲区域,所述处理器选择的缓冲区域与所述处理器最近上一次选择的缓冲区域不同;所述处理单元,用于:The device according to claim 18, wherein the interactive buffer area includes a plurality of buffer areas, the set generation completion information carries an identifier of the buffer area, and the buffer area is the processor from the plurality of buffer areas. The buffer area selected in the buffer area, the buffer area selected by the processor is different from the buffer area selected last time by the processor; the processing unit is configured to:
    从所述处理器选择的缓冲区域的标识对应的缓冲区域中读取所述标识集合。Read the set of identifiers from the buffer area corresponding to the identifier of the buffer area selected by the processor.
  20. 如权利要求14至19任一项所述的装置,其特征在于,所述发送单元,还用于:The device according to any one of claims 14 to 19, wherein the sending unit is further configured to:
    在所述标识集合中的每个标识对应的存储单元的总容量未超过预设阈值时,向所述处理 器发送停止迁移命令,所述停止迁移命令用于触发所述处理器停止运行所述应用实例。When the total capacity of the storage unit corresponding to each identifier in the identifier set does not exceed a preset threshold, a migration stop command is sent to the processor, and the migration stop command is used to trigger the processor to stop running the Applications.
  21. 一种处理器,其特征在于,所述处理器应用于包括存储器、迁移部件和所述处理器的主机,所述处理器用于运行应用实例,所述存储器包括供所述应用实例访问的应用访问区域,所述处理器包括:A processor, characterized in that the processor is applied to a host including a memory, a migration component, and the processor, the processor is used to run an application instance, and the memory includes an application access for the application instance to access Area, the processor includes:
    接收单元,用于接收所述迁移部件发送的迁移命令;A receiving unit, configured to receive a migration command sent by the migration component;
    处理单元,用于根据所述迁移命令生成标识集合,所述标识集合包括所述应用访问区域中的待迁移的至少一个存储单元的标识;A processing unit, configured to generate an identification set according to the migration command, the identification set including an identification of at least one storage unit to be migrated in the application access area;
    所述处理单元,还用于向所述迁移部件提供所述标识集合,以使所述迁移部件发送所述标识集合中的标识对应的存储单元内保存的数据。The processing unit is further configured to provide the identification set to the migration component, so that the migration component sends the data stored in the storage unit corresponding to the identification in the identification set.
  22. 如权利要求21所述的处理器,其特征在于,所述迁移部件包括中断接口和迁移控制接口,所述接收单元,用于接收所述迁移部件通过所述中断接口发送的中断信号;22. The processor of claim 21, wherein the migration component comprises an interrupt interface and a migration control interface, and the receiving unit is configured to receive an interrupt signal sent by the migration component through the interrupt interface;
    所述处理单元,还用于根据所述中断信号从所述迁移控制接口中读取迁移命令,所述迁移命令是所述迁移部件在发送所述中断信号之前写入到所述迁移控制接口中的。The processing unit is further configured to read a migration command from the migration control interface according to the interrupt signal, where the migration command is written by the migration component into the migration control interface before sending the interrupt signal of.
  23. 如权利要求21或22所述的处理器,其特征在于,所述标识集合包括所述应用访问区域中的每个存储单元的标识。The processor according to claim 21 or 22, wherein the identification set includes an identification of each storage unit in the application access area.
  24. 如权利要求21或22所述的处理器,其特征在于,所述标识集合包括在第一时间至当前时间内所述应用访问区域中被所述应用实例写入数据的n个存储单元的标识,其中,所述第一时间为所述处理器最近上一次生成标识集合的时间,n为整数,n大于或等于1且小于或等于所述应用访问区域包括的存储单元总数目。The processor according to claim 21 or 22, wherein the identifier set includes identifiers of n storage units in the application access area whose data is written by the application instance from the first time to the current time , Wherein the first time is the last time the processor generated the identification set last time, n is an integer, and n is greater than or equal to 1 and less than or equal to the total number of storage units included in the application access area.
  25. 如权利要求21至24任一项所述的处理器,其特征在于,所述迁移部件包括状态通知接口,所述存储器还包括交互缓冲区域,所述处理单元,用于:The processor according to any one of claims 21 to 24, wherein the migration component comprises a status notification interface, the memory further comprises an interactive buffer area, and the processing unit is configured to:
    将所述标识集合写入到所述交互缓冲区域,以及在所述状态通知接口写入集合生成完成信息,所述集合生成完成信息用于触发所述迁移部件从所述交互缓冲区域中获取所述标识集合。The identification set is written into the interactive buffer area, and the set generation completion information is written in the status notification interface, and the set generation completion information is used to trigger the migration component to obtain all information from the interactive buffer area. Said logo collection.
  26. 如权利要求25所述的处理器,其特征在于,所述交互缓冲区域包括多个缓冲区域,所述处理单元,用于:The processor according to claim 25, wherein the interaction buffer area comprises a plurality of buffer areas, and the processing unit is configured to:
    从所述多个缓冲区域中选择一个缓冲区域,所述选择的缓冲区域与所述处理单元最近上一次选择的缓冲区域不同,Selecting a buffer area from the plurality of buffer areas, and the selected buffer area is different from the buffer area selected last time by the processing unit,
    将所述标识集合写入到所述选择的缓冲区域中,以及在所述状态通知接口写入集合生成完成信息,所述集合生成完成信息携带所述选择的缓冲区的标识。The identification set is written into the selected buffer area, and the set generation completion information is written in the status notification interface, and the set generation completion information carries the identification of the selected buffer.
  27. 一种计算机系统,其特征在于,所述计算机系统包括存储器,如权利要求14至20任一项所述的迁移数据的装置,以及如权利要求21至26任一项所述的处理器。A computer system, wherein the computer system includes a memory, the data migration device according to any one of claims 14 to 20, and the processor according to any one of claims 21 to 26.
  28. 一种芯片,其特征在于,所述芯片包括可编程逻辑电路,当所述芯片运行时用于实现如权利要求1-7任意一项所述的方法。A chip, characterized in that the chip includes a programmable logic circuit, which is used to implement the method according to any one of claims 1-7 when the chip is running.
  29. 一种芯片,其特征在于,所述芯片包括逻辑电路,当所述芯片运行时用于实现如权利要求8-13任意一项所述的方法。A chip, characterized in that the chip includes a logic circuit, which is used to implement the method according to any one of claims 8-13 when the chip is running.
  30. 一种芯片,其特征在于,所述芯片包括一个或多个物理核、以及存储介质,所述一个或多个物理核在读取所述存储介质中的计算机指令后实现如权利要求1-7任意一项所述的方法。A chip, characterized in that, the chip includes one or more physical cores and a storage medium, and the one or more physical cores realize the implementation according to claims 1-7 after reading the computer instructions in the storage medium. Any of the methods described.
  31. 一种芯片,其特征在于,所述芯片包括一个或多个物理核、以及存储介质,所述一个或多个物理核在读取所述存储介质中的计算机指令后实现如权利要求8-13任意一项所述的方法。A chip, characterized in that, the chip includes one or more physical cores and a storage medium, and the one or more physical cores realize the implementation as claimed in claims 8-13 after reading computer instructions in the storage medium. Any of the methods described.
PCT/CN2020/076476 2019-03-05 2020-02-24 Method, apparatus, and system for migrating data WO2020177567A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910165515.X 2019-03-05
CN201910165515.XA CN111666036B (en) 2019-03-05 2019-03-05 Method, device and system for migrating data

Publications (1)

Publication Number Publication Date
WO2020177567A1 true WO2020177567A1 (en) 2020-09-10

Family

ID=72338136

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/076476 WO2020177567A1 (en) 2019-03-05 2020-02-24 Method, apparatus, and system for migrating data

Country Status (2)

Country Link
CN (1) CN111666036B (en)
WO (1) WO2020177567A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116185553A (en) * 2021-11-26 2023-05-30 华为技术有限公司 Data migration method and device and electronic equipment
CN114265670B (en) * 2022-03-02 2022-09-23 阿里云计算有限公司 Memory block sorting method, medium and computing device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120137292A1 (en) * 2010-11-26 2012-05-31 Fujitsu Limited Virtual machine migrating system and method
CN103530167A (en) * 2013-09-30 2014-01-22 华为技术有限公司 Virtual machine memory data migration method and relevant device and cluster system
CN103618809A (en) * 2013-11-12 2014-03-05 华为技术有限公司 Method, device and system for communication under vitualization environment
CN103942087A (en) * 2014-03-31 2014-07-23 华为技术有限公司 Virtual machine thermal migration method, related device and cluster computing system
CN104410681A (en) * 2014-11-21 2015-03-11 上海交通大学 Dynamic migration and optimization method of virtual machines based on remote direct memory access

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3193880B2 (en) * 1996-12-11 2001-07-30 株式会社日立製作所 Data migration method
JP2011097198A (en) * 2009-10-27 2011-05-12 Yamaha Corp Memory access control device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120137292A1 (en) * 2010-11-26 2012-05-31 Fujitsu Limited Virtual machine migrating system and method
CN103530167A (en) * 2013-09-30 2014-01-22 华为技术有限公司 Virtual machine memory data migration method and relevant device and cluster system
CN103618809A (en) * 2013-11-12 2014-03-05 华为技术有限公司 Method, device and system for communication under vitualization environment
CN103942087A (en) * 2014-03-31 2014-07-23 华为技术有限公司 Virtual machine thermal migration method, related device and cluster computing system
CN104410681A (en) * 2014-11-21 2015-03-11 上海交通大学 Dynamic migration and optimization method of virtual machines based on remote direct memory access

Also Published As

Publication number Publication date
CN111666036A (en) 2020-09-15
CN111666036B (en) 2022-04-22

Similar Documents

Publication Publication Date Title
RU2532708C2 (en) Method and apparatus for input/output operation in virtualisation environment
CN107209681B (en) Storage device access method, device and system
US9389904B2 (en) Apparatus, system and method for heterogeneous data sharing
US5706514A (en) Distributed execution of mode mismatched commands in multiprocessor computer systems
US10176007B2 (en) Guest code emulation by virtual machine function
US9697024B2 (en) Interrupt management method, and computer implementing the interrupt management method
WO2017024783A1 (en) Virtualization method, apparatus and system
US20120167082A1 (en) Direct sharing of smart devices through virtualization
WO2022002106A1 (en) Interrupt processing method, interrupt manager, electronic device and computer-readable storage medium
US20230259380A1 (en) Chip system, virtual interrupt processing method, and corresponding apparatus
US11188365B2 (en) Memory overcommit by speculative fault
US20110219373A1 (en) Virtual machine management apparatus and virtualization method for virtualization-supporting terminal platform
CN112306624A (en) Information processing method, physical machine and PCIE (peripheral component interface express) equipment
WO2020177567A1 (en) Method, apparatus, and system for migrating data
US10719333B2 (en) BIOS startup method and apparatus
US10459662B1 (en) Write failure handling for a memory controller to non-volatile memory
US10642727B1 (en) Managing migration events performed by a memory controller
US10545697B1 (en) Reverse order request queueing by para-virtual device drivers
CN115756730A (en) Virtual machine scheduling method and device, GPU and electronic equipment
CN112559120B (en) Customized PCIE bus IO virtualization supporting method
CN114238183B (en) System, method and medium for implementing Virtio device
CN115904634B (en) Resource management method, system-level chip, electronic component and electronic equipment
CN117311833B (en) Storage control method and device, electronic equipment and readable storage medium
US20220358049A1 (en) Memory access handling for peripheral component interconnect devices
CN114691297A (en) Information reading and writing method, electronic equipment, distributed system and program product

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20765714

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20765714

Country of ref document: EP

Kind code of ref document: A1