Method, equipment and medium for hot migration of Xinchuang operating system across different CPU virtual machines
By identifying and defining ARM architecture registers in the Xinchuang operating system and cooperating with virtualization management services, the difficulty of live migration of virtual machines across different CPU architectures in cloud computing environments is solved, and the smooth migration of virtual machines on different CPUs is achieved, improving improve the stability of cloud services.
Patent Information
- Application Number
- CN202410711332.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-04
AI Technical Summary
In a cloud computing environment, live migration of virtual machines across different CPU architectures is difficult. In particular, virtual machine migration fails due to differences in registers and instruction sets. It is difficult for existing technology to effectively support live migration between different CPU architectures.
By identifying and defining ARM architecture registers in the Xinchuang operating system, and cooperating with virtualization management services, user-mode virtual machines are supported to use common registers, avoiding the use of CPU-specific registers, thereby realizing live migration of virtual machines across different CPUs. Specific methods include increasing the modifiability of ARM64 registers, supporting the judgment and reading and writing rules of ID registers, and not loading CPU-specific registers in the Qemu component, only loading commonly used registers.
It implements the live migration function of virtual machines across different CPUs, improves the stability and user experience of cloud services, ensures the smooth migration of virtual machines on different CPUs, and avoids the problem of migration failure.
Smart Images

Figure CN118295773B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of operating system technology, and specifically to a method, device and medium for hot migration of a trusted operating system across different CPU virtual machines. Background Art
[0002] In cloud computing environments, it is common to have operating systems and servers that support multiple CPU architectures. This diversity enables cloud vendors to select appropriate hardware devices based on different needs and scenarios, and provide more flexible and diverse cloud services.
[0003] Virtualization technology is an important part of cloud computing. It can divide a physical server into multiple virtual machines and provide resource isolation and management. Virtualization services can effectively manage users' virtual machines and allow virtual machines to be hot migrated between different physical servers. This hot migration capability makes the cloud computing environment more flexible and reliable, and can achieve resource balance and fault tolerance when real-time load changes or failures occur.
[0004] Xinchuang operating systems generally support CPU architectures such as ARM and Loongarch. CPU manufacturers of different brands support ARM architecture CPUs. However, due to subtle differences in the specific implementation of CPUs by different CPU manufacturers, including registers, instruction sets, and memory management, hot migration of virtual machines across CPU architectures of different manufacturers may encounter some problems. For example, the registers and instructions used by the virtual machine when running on the source server may not exist or may be different on the target server, resulting in hot migration failure.
[0005] To solve this problem, cloud vendors need to perform corresponding optimization and adaptation in the virtualization management software to support hot migration between different CPU architectures. However, if the virtual machine migration fails due to differences in CPU registers, and the trusted operating system on the physical server does not support the definition of the corresponding registers, the virtualization management software cannot identify the difference and cannot complete the hot migration of virtual machines across CPUs.
[0006] Therefore, how to achieve hot migration of virtual machines across different CPUs based on the trusted operating system and ensure the stability of cloud services is a technical problem that needs to be solved urgently. Summary of the invention
[0007] The technical task of the present invention is to provide a method, device and medium for hot migration of a trusted operating system across different CPU virtual machines, so as to solve the problem of how to realize hot migration across different CPU virtual machines based on the trusted operating system and ensure the stability of cloud services.
[0008] The technical task of the present invention is achieved in the following way: a method for hot migration of virtual machines across different CPUs of a trusted operating system. The method is based on the definition and identification of ARM architecture registers by the trusted operating system, in conjunction with virtualization management services, to support the use of ARM architecture registers by user-state virtual machines, and to use registers shared by CPU one and CPU two on node one, and registers unique to CPU one are not applicable, to achieve hot migration of virtual machines across CPU one and CPU two through shared registers.
[0009] Preferably, the definition and identification of the ARM architecture register refers to adding the identification of the register corresponding to the CPU on the Xinchuang operating system and defining the register corresponding to the CPU, as follows:
[0010] Increase the modifiability of ARM64 registers and support the judgment and reading and writing rules of ID registers;
[0011] Among them, before modification, check the visibility and characteristics of ARM64 registers;
[0012] When reading and writing, writes are performed to the corresponding read-only registers according to visibility.
[0013] Preferably, the format of ARM64 register definitions is:
[0014] #define register number_field offset in register offset number;
[0015] Among them, the register number is used to describe the characteristics and extensions of the corresponding CPU;
[0016] The field offset in the register is used to describe the offset number starting from bit 0 and counting to the right.
[0017] More preferably, the ARM64 registers include registers of the ID_AA64AFR0_EL1 class, registers of the ID_DFR1_EL1 class, registers of the ID_AFR0_EL1 class, and registers of the ID_MMFR{1..3} class.
[0018] Preferably, the kernel file customized for the Xinchuang operating system is kernel / arch / arm64 / include / asm / sysreg.h.
[0019] Preferably, the user-mode virtual machine uses the ARM architecture registers as follows:
[0020] After the Xinchuang operating system supports the register recognition of CPU 2, the Qemu component in the computing node virtualization management service is modified so that when the Qemu component starts the virtual machine, it does not load the special registers corresponding to CPU 1, but only loads the registers used by CPU 1 and CPU 2, thereby realizing the hot migration of the virtual machine from CPU 1 to CPU 2.
[0021] More preferably, when initializing CPU 2, the specified register is marked as 0 through aarch64_max_ft2000plus_initfn, so as to achieve the purpose of not loading the special register corresponding to CPU 1.
[0022] Preferably, the Qemu component in the compute node virtualization management service is transformed as follows:
[0023] Set the ATOMIC field in the ID_AA64ISAR0 register to 0 and obtain the register feature definition return code; where ATOMIC is an atomic operation feature of the ID_AA64ISAR0 register;
[0024] Set the DP field in the ID_AA64ISAR0 register to 0 and obtain the register characteristic definition return code; where DP is a double-precision operation characteristic of the ID_AA64ISAR0 register.
[0025] An electronic device comprising: a memory and at least one processor;
[0026] Wherein, the memory stores computer-executable instructions;
[0027] The at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the above-mentioned method of hot migration of the trusted operating system across different CPU virtual machines.
[0028] A computer-readable storage medium having computer execution instructions stored therein. When a processor executes the computer execution instructions, the above-mentioned method of hot migration of a trusted operating system across different CPU virtual machines is implemented.
[0029] The method, device and medium for hot migration of the Xinchuang operating system across different CPU virtual machines of the present invention have the following advantages:
[0030] (I) The present invention implements the definition and identification of ARM architecture registers, supports the use of ARM architecture registers by user-mode virtual machines, supports the hot migration function of virtual machines on different servers, improves user experience, and ensures the stability of cloud services;
[0031] (ii) The present invention adds the definition and identification of the registers of CPU 1, specifically supports the definition of ARM64 registers ID_AA64AFR0_EL1, ID_DFR1_EL1, ID_AFR0_EL1, ID_MMFR{1..3}, and realizes the hot migration of virtual machines across different CPUs;
[0032] (III) The present invention uses Qemu service to not load the special registers of CPU 1 when starting the virtual machine, thereby ensuring that CPU 1 and CPU 2 use the same registers;
[0033] (IV) When creating a virtual machine, the present invention identifies the registers of CPU 1 and does not enable these special registers, thereby ensuring that the registers of virtual machines running on different CPUs are used consistently, thereby supporting hot migration of the virtual machine from CPU 1 to CPU 2. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The present invention is further described below in conjunction with the accompanying drawings.
[0035] Attached Figure 1 This is a schematic diagram of Example 2. DETAILED DESCRIPTION
[0036] The following detailed description is made of the method, device and medium for hot migration of the trusted computing operating system across different CPU virtual machines of the present invention with reference to the drawings and specific embodiments of the specification.
[0037] Example 1: The method for hot migration of virtual machines across different CPUs of the trusted operating system of the present invention is based on the definition and identification of ARM architecture registers by the trusted operating system, in conjunction with virtualization management services, supporting the use of ARM architecture registers by user-mode virtual machines, using registers shared by CPU one and CPU two on node one, and not using registers specific to CPU one, and realizing hot migration of virtual machines across CPU one and CPU two through shared registers.
[0038] The definition and identification of the ARM architecture registers in this embodiment refers to adding the identification of the registers corresponding to the CPU on the Xinchuang operating system and defining the registers corresponding to the CPU, as follows:
[0039] Increase the modifiability of ARM64 registers and support the judgment and reading and writing rules of ID registers;
[0040] Among them, before modification, check the visibility and characteristics of ARM64 registers;
[0041] When reading and writing, writes are performed to the corresponding read-only registers according to visibility.
[0042] The format of the ARM64 register definition in this embodiment is:
[0043] #define register number_field offset in register offset number;
[0044] Among them, the register number is used to describe the characteristics and extensions of the corresponding CPU;
[0045] The field offset in the register is used to describe the offset number starting from bit 0 and counting to the right.
[0046] For example: #define ID_AA64AFR0_IMPDEF7_SHIFT 28
[0047] Meaning:
[0048] ID_AA64AFR0: Indicates the Auxiliary Feature Register 0 of the AArch64 CPU, which is used to describe some features and extensions of the CPU.
[0049] IMPDEF7_SHIFT: Indicates the offset of the IMPDEF7 feature in Auxiliary Feature Register 0, which is 28 bits from the 0th bit to the right.
[0050] The ARM64 registers in this embodiment include registers of the ID_AA64AFR0_EL1 class, registers of the ID_DFR1_EL1 class, registers of the ID_AFR0_EL1 class, and registers of the ID_MMFR{1..3} class.
[0051] The kernel file customized for the Xinchuang operating system in this embodiment is kernel / arch / arm64 / include / asm / sysreg.h.
[0052] In this embodiment, the user-mode virtual machine uses the ARM architecture registers as follows:
[0053] After the Xinchuang operating system supports the register recognition of CPU 2, the Qemu component in the computing node virtualization management service is modified so that when the Qemu component starts the virtual machine, it does not load the special registers corresponding to CPU 1, but only loads the registers used by CPU 1 and CPU 2, thereby realizing the hot migration of the virtual machine from CPU 1 to CPU 2.
[0054] In this embodiment, when initializing CPU 2, aarch64_max_ft2000plus_initfn is used to mark the designated register as 0, so as to achieve the purpose of not loading the special register corresponding to CPU 1.
[0055] In this embodiment, the Qemu component in the computing node virtualization management service is transformed as follows:
[0056] t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 0); / / Set the ATOMIC field in the ID_AA64ISAR0 register and set it to 0. ATOMIC is an atomic operation feature of the ID_AA64ISAR0 register.
[0057] t = FIELD_DP64(t, ID_AA64ISAR0, DP, 0); / / Set the DP field in the ID_AA64ISAR0 register and set it to 0. DP is a double-precision operation characteristic of the ID_AA64ISAR0 register.
[0058] t indicates the register characteristic definition return code.
[0059] Embodiment 2: As attached Figure 1 As shown in the figure, the Xinchuang operating system is adapted to CPU chip servers such as Kunpeng and Feiteng, and provides services for the cloud platform. In the cloud computing platform, there are both Kunpeng and Feiteng server nodes, and the Xinchuang operating system is running on the server nodes. The computing node virtualization management service is running in the Xinchuang operating system. The virtualization management service is supported by Qemu and KVM to complete the creation, startup, restart, shutdown, hot migration and other functions of virtual machines, and supports hot migration of virtual machines between Kunpeng and Feiteng servers.
[0060] During actual use, it was found that when the user's virtual machine runs on a Feiteng server, it can be hot migrated to a Kunpeng server smoothly; however, when the user's virtual machine runs on a Kunpeng server, it cannot be hot migrated to a Feiteng server.
[0061] After positioning, it was found that the operating system used Kunpeng-specific registers on the Kunpeng server, which resulted in the failure of migration when the corresponding Kunpeng-specific registers could not be found on the Feiteng server.
[0062] By implementing the definition and identification of ARM architecture registers and cooperating with virtualization management software, it supports the use of ARM architecture registers by user-mode virtual machines. On Kunpeng nodes, registers shared by Kunpeng and Feiteng are used instead of registers specific to Kunpeng, thereby supporting the hot migration function of virtual machines on Kunpeng and Feiteng servers.
[0063] Definition and identification of ARM architecture registers: (Services of Xinchuang operating system adapted to cloud platform)
[0064] In the Xinchuang operating system, the identification of Kunpeng registers has been added to support the definition of Kunpeng registers. Specifically:
[0065] Added modifiability to ARM64 registers ID_AA64AFR0_EL1, ID_DFR1_EL1, ID_AFR0_EL1, and ID_MMFR{1..3}, supported the judgment and read-write rules of ID registers, checked register visibility and characteristics before modification, and wrote to the read-only register according to visibility when reading and writing.
[0066] The register definition format is: #define register number_field offset in register offset number
[0067] For example: #define ID_AA64AFR0_IMPDEF7_SHIFT 28
[0068] Meaning:
[0069] ID_AA64AFR0: Indicates the Auxiliary Feature Register 0 of the AArch64 CPU, which is used to describe some features and extensions of the CPU.
[0070] IMPDEF7_SHIFT: Indicates the offset of the IMPDEF7 feature in Auxiliary Feature Register 0, which is 28 bits from the 0th bit to the right.
[0071] In this way, the characteristics or functions of registers ID_AA64AFR0, ID_DFR1, ID_AFR0, ID_MMFR{1..3}, etc. are defined as follows:
[0072]
[0073] The specific customized Xinchuang operating system kernel file is: kernel / arch / arm64 / include / asm / sysreg.h.
[0074] Specific customization content:
[0075] …
[0076] #define ID_AA64AFR0_IMPDEF7_SHIFT 28
[0077] #define ID_AA64AFR0_IMPDEF6_SHIFT 24
[0078] …
[0079] #define ID_DFR1_HPMN0_SHIFT 8
[0080] …
[0081] #define ID_AFR0_IMPDEF3_SHIFT 12
[0082] #define ID_AFR0_IMPDEF2_SHIFT 8
[0083] …
[0084] #define ID_MMFR1_BPred_SHIFT 28
[0085] #define ID_MMFR1_L1TstCln_SHIFT 24
[0086] …
[0087] User-mode virtual machines use ARM architecture registers (transforming computing node management services)
[0088] The computing node virtualization management service is jointly supported by Qemu and KVM, completing functions such as virtual machine creation, startup, restart, shutdown, and hot migration, and supporting hot migration of virtual machines between Kunpeng and Feiteng servers.
[0089] After the Xinchuang operating system supports the recognition of Kunpeng CPU registers, the Qemu component in the computing node virtualization management service is transformed to support not loading Kunpeng's special registers when starting the virtual machine, ensuring that the Kunpeng server and Feiteng server use the same registers, thereby supporting hot migration of virtual machines from Kunpeng servers to Feiteng servers.
[0090] When initializing the Feiteng CPU, the register flag is specified as 0 to avoid loading the Kunpeng register. The specific function is defined as:
[0091]
[0092] The modified code sample is:
[0093] t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 0); / / Set the ATOMIC field in the ID_AA64ISAR0 register and set it to 0. ATOMIC is an atomic operation feature of the ID_AA64ISAR0 register.
[0094] t = FIELD_DP64(t, ID_AA64ISAR0, DP, 0); / / Set the DP field in the ID_AA64ISAR0 register and set it to 0. DP is a double-precision operation characteristic of the ID_AA64ISAR0 register.
[0095] t indicates the register characteristic definition return code.
[0096] The specific examples are:
[0097] static void aarch64_max_ft2000plus_initfn(Object *obj)
[0098] {
[0099] ARMCPU *cpu = ARM_CPU(obj); / / define CPU object
[0100] aarch64_a72_initfn(obj); / / Initialize CPU object
[0101] cpu->midr = 0x70186622; / / Specify the main identifier register of the CPU (Main IDRegister)
[0102] uint64_t t; / / Define register characteristics and return code
[0103] t = cpu->isar.regs[ID_AA64ISAR0]; / / Register register ID_AA64ISAR0
[0104] t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 0); / / Disable the ATOMIC feature of register ID_AA64ISAR0
[0105] t = FIELD_DP64(t, ID_AA64ISAR0, DP, 0); / / Disable the DP feature of register ID_AA64ISAR0
[0106] …
[0107] The operating system kernel supports the recognition of Kunpeng registers. When the virtual machine is created, these Kunpeng registers are identified and then, by not enabling these special registers, the registers of the virtual machines running on the Kunpeng server and the Feiteng server are guaranteed to be used consistently, thereby supporting the hot migration of virtual machines from the Kunpeng server to the Feiteng server.
[0108] After testing, the performance of the virtual machines running on the Kunpeng server is almost lossless. The specific test data is as follows:
[0109]
[0110] Embodiment 3: This embodiment also provides an electronic device, including: a memory and at least one processor;
[0111] Wherein, the memory stores computer-executable instructions;
[0112] The at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the method for hot migration of the trusted operating system across different CPU virtual machines described in any one of the present inventions.
[0113] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor may be a microprocessor or any conventional processor, etc.
[0114] The memory can be used to store computer programs and / or modules. The processor realizes various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the terminal, etc. In addition, the memory can also include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, at least one disk storage period, a flash memory device, or other volatile solid-state storage devices.
[0115] Embodiment 4: This embodiment also provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions are loaded by a processor, so that the processor executes the method for hot migration of the Xinchuang operating system across different CPU virtual machines in any embodiment of the present invention. Specifically, a system or device equipped with a storage medium can be provided, on which software program codes for implementing the functions of any of the above embodiments are stored, and a computer (or CPU or MPU) of the system or device is enabled to read and execute the program code stored in the storage medium.
[0116] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
[0117] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer via a communication network.
[0118] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.
[0119] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.
[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for hot migration of a trusted operating system across different CPU virtual machines. It is characterized in that This method is based on the definition and identification of ARM architecture registers by the Xinchuang operating system, in conjunction with virtualization management services, to support the use of ARM architecture registers by user-mode virtual machines, to use the registers shared by CPU 1 and CPU 2 on node 1, and to achieve hot migration of virtual machines across CPU 1 and CPU 2 through the shared registers; Among them, the definition and identification of ARM architecture registers refers to adding the identification of the registers corresponding to the CPU on the Xinchuang operating system and defining the registers corresponding to the CPU, as follows: Increase the modifiability of ARM64 registers and support the judgment and reading and writing rules of ID registers; Among them, before modification, check the visibility and characteristics of ARM64 registers; When reading and writing, write the corresponding read-only register according to visibility; The user-mode virtual machine uses the ARM architecture registers as follows: After the Xinchuang operating system supports the register recognition of CPU 2, the Qemu component in the computing node virtualization management service is modified so that when the Qemu component starts the virtual machine, it does not load the special registers corresponding to CPU 1, but only loads the registers used by CPU 1 and CPU 2, thereby realizing the hot migration of the virtual machine from CPU 1 to CPU 2.
2. According to claim 1, the method for hot migration of the Xinchuang operating system across different CPU virtual machines, It is characterized in that The format of ARM64 register definition is: #define register number_field offset in register offset number; Among them, the register number is used to describe the characteristics and extensions of the corresponding CPU; The field offset in the register is used to describe the offset number starting from bit 0 and counting to the right.
3. According to claim 1 or 2, the method for hot migration of the Xinchuang operating system across different CPU virtual machines, It is characterized in that ARM64 registers include registers of the ID_AA64AFR0_EL1 class, registers of the ID_DFR1_EL1 class, registers of the ID_AFR0_EL1 class, and registers of the ID_MMFR{1..3} class.
4. According to claim 3, the method for hot migration of the Xinchuang operating system across different CPU virtual machines, It is characterized in that The kernel file customized for the Xinchuang operating system is kernel / arch / arm64 / include / asm / sysreg.h.
5. According to claim 4, the method for hot migration of the Xinchuang operating system across different CPU virtual machines, It is characterized in that When initializing CPU 2, the specified register is marked as 0 through aarch64_max_ft2000plus_initfn, so as not to load the special register corresponding to CPU 1.
6. According to claim 5, the method for hot migration of the Xinchuang operating system across different CPU virtual machines, It is characterized in that The details of transforming the Qemu component in the compute node virtualization management service are as follows: Set the ATOMIC field in the ID_AA64ISAR0 register to 0 and obtain the register feature definition return code; where ATOMIC is an atomic operation feature of the ID_AA64ISAR0 register; Set the DP field in the ID_AA64ISAR0 register to 0 and obtain the register characteristic definition return code; where DP is a double-precision operation characteristic of the ID_AA64ISAR0 register.
7. An electronic device, It is characterized in that include: memory and at least one processor; Wherein, the memory stores computer-executable instructions; The at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the method for hot migration of the trusted operating system across different CPU virtual machines as described in any one of claims 1 to 6.
8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer execution instructions. When the processor executes the computer execution, it implements the method for hot migration of the trusted operating system across different CPU virtual machines as described in any one of claims 1 to 6.
