Virtual machine CPU (Central Processing Unit) hot plug method for SW architecture and electronic equipment
Through QEMU, the Shenwei architecture is simulated, the CPU parameters are analyzed and processed, and the KVM and pm-device device drivers are used to realize the hot plug and unplug of virtual machine CPUs, which solves the problem of lack of CPU hot plug and unplug on Shenwei platform and realizes the virtual machine CPU dynamic management and random repeated hot plugging.
Patent Information
- Application Number
- CN202411308359.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-27
AI Technical Summary
The Shenwei platform currently does not support the virtual machine CPU hot-swap function, and it is impossible to dynamically add and delete CPUs when the virtual machine is running through QEMU or Libvirt management commands.
Simulate the Shenwei architecture through QEMU, parse the add or delete commands, obtain CPU parameters and align it, control KVM to create simulated CPU threads, build a virtual machine CPU structure, trigger hot plug or hot unplug interrupts, and use pm-device device driver to realize the CPU Hot-swap operation.
It realizes the hot-swap function of virtual machine CPU on the Shenwei platform, solves the problem of lack of CPU hot-swap function on the platform, and realizes dynamic management and random and repeated hot-swap function of virtual machine CPUs.
Smart Images

Figure CN119201344A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of computer technology and relates to a virtual machine CPU hot plugging method and electronic equipment oriented to Shenwei architecture. Background Art
[0002] Virtual machine CPU hot-plug technology refers to dynamically increasing or decreasing the number of virtual CPUs when the virtual machine is running. This technology can improve the flexibility of virtual machine performance configuration and is a very important function in virtualization. Currently, the X86 platform implements the virtual machine CPU hot-plug function of the platform through the mechanism of Advanced Configuration and Power Management Interface ACPI (Advanced Configuration and Power Management Interface), but the Shenwei platform does not currently support ACPI.
[0003] QEMU (Quick EMUlator) is an open source virtual machine monitor and emulator. It can modify the virtual machine configuration and update the virtual machine status, and further notify the operating system in the virtual machine to perform corresponding processing, thereby realizing hot plugging of the virtual machine CPU. KVM (Kernel-based Virtual Machine) is an open source virtualization technology based on the Linux kernel, which allows administrators to create and manage virtual machines on Linux systems. Libvirt is an open source API, background program and management tool for managing virtualization platforms. It aims to provide a general and stable software library to efficiently and securely manage virtual machines on a node and support remote operations.
[0004] In the virtual machine CPU hot-plugging, Libvirt's virsh management command will be converted into a qmp-shell command that can be recognized by QEMU's external monitor interface, and the converted command will be further sent to QEMU's external monitor interface to implement the virtual machine CPU hot-plugging operation through Libvirt commands. Through the cooperation of QEMU and KVM, the CPU resources of the virtual machine in the running state can be dynamically managed. Since the implementation of the CPU is strongly related to the platform architecture, the implementation of virtual machine CPU hot-plugging on different platforms is a special implementation for the platform. There is no relevant implementation on the current Shenwei platform. On the Shenwei platform, the code logic and functions of virtual machine CPU hot-plugging are not implemented at this stage, and it is impossible to dynamically add and delete CPUs when virtual machines are running through QEMU or Libvirt management commands.
[0005] Therefore, there is an urgent need for a virtual machine CPU hot-swap method and electronic device for the Shenwei architecture to solve the above technical problems. Summary of the invention
[0006] The purpose of the present invention is to overcome the deficiencies in the prior art and provide a virtual machine CPU hot-plugging method and electronic device for the Shenwei architecture, which can solve the problem that the prior art cannot implement virtual machine CPU hot-plugging on the Shenwei platform.
[0007] In order to alleviate the above technical problems, the present invention is implemented by adopting the following technical solutions: In a first aspect, the present invention provides a virtual machine CPU hot-plug method for the Shenwei architecture, which is executed by QEMU, wherein the Shenwei architecture is simulated in the QEMU, a virtual machine is constructed in the Shenwei architecture, and KVM is applied in the QEMU, including: Parse the input add command, obtain the CPU parameters of the Shenwei architecture, align the CPU parameters with the CPU parameters supported in the QEMU description document, obtain the aligned CPU parameters, add and save the aligned CPU parameters to the CPU structure of the Shenwei architecture; Control the KVM to create a thread that simulates the CPU under the Shenwei architecture, and build a virtual machine CPU structure in QEMU, trigger a hot plug interrupt, and send the aligned CPU parameters to the pm-device device driver of the virtual machine kernel; After receiving the virtual machine CPU hot plug interrupt, the aligned CPU parameters sent by QEMU are parsed in the virtual machine pm-device device driver, and a virtual machine CPU structure is created in the virtual machine kernel according to the information obtained by the parsing; The virtual machine CPU structure in the QEMU and the virtual machine CPU structure created by the virtual machine kernel are bound to complete the hot plug of the CPU.
[0008] Furthermore, before controlling the KVM to create a thread simulating the CPU under the Shenwei architecture: The CPU online status of the CPU corresponding to the aligned CPU parameters is detected by the CPU status management module in the QEMU. When the CPU corresponding to the aligned CPU parameters is offline, it is queried whether the slot of the corresponding virtual machine CPU in the QEMU is empty. When the slot of the virtual machine CPU is empty, the slot information of the hot-pluggable CPU is returned to the QEMU, and the CPU hot-plug status management table in the CPU status management module is updated.
[0009] Further, triggering the hot plug interrupt includes: The aligned CPU parameters are filled in through the pm-device device of the Shenwei architecture, and the registered hot-plug CPU interrupt is triggered through the CPU hot-plug operation function registered in the pm-device device under the Shenwei architecture.
[0010] Furthermore, the added command is a qmp-shell command or a virsh command, wherein the virsh command is converted into a qmp-shell command by Libvirt in the QEMU.
[0011] Further, after binding the virtual machine CPU structure in the QEMU and the virtual machine CPU structure created by the virtual machine kernel: Use the online command to control the newly inserted virtual machine CPU to go online, and use the display command to display the newly inserted virtual machine CPU.
[0012] In a second aspect, the present invention provides a virtual machine CPU hot-plug method for the Shenwei architecture, characterized in that it is executed by QEMU, and the Shenwei architecture is simulated in the QEMU, including: Enter the command to delete the CPU on the QEMU side; Parse the input delete command to obtain the ID information of the CPU to be hot-plugged; Based on the ID information of the CPU to be hot-plugged, the CPU status management module in the QEMU detects whether the CPU to be hot-plugged is online and has a non-zero core. If all the conditions are met, the CPU hot-plug status management table in the CPU status management module is updated to search for the slot information of the CPU to be hot-plugged, and the corresponding CPU device information is found through the slot information of the CPU to be hot-plugged; Through the CPU hot-plug operation function registered in the pm-device device under the Shenwei architecture, the registered hot-plug CPU interrupt is triggered, and after receiving the hot-plug CPU interrupt sent by the QEMU, the corresponding virtual machine CPU is controlled to release resources according to the corresponding CPU device information; After the virtual machine CPU resources are released, an interrupt is sent to QEMU to release the simulated virtual machine CPU thread resources and complete the hot pull of the CPU.
[0013] Furthermore, before parsing the input deletion command, the CPU of the virtual machine is controlled to go offline through an offline command.
[0014] In a third aspect, the present invention provides an electronic device for executing the virtual machine CPU hot-plug method for the Shenwei architecture described in the first aspect or the virtual machine CPU hot-unplug method for the Shenwei architecture described in the second aspect.
[0015] Compared with the prior art, the present invention has the following beneficial effects: After parsing the input add command, obtaining the CPU parameters of the Shenwei architecture and aligning them, KVM is controlled to create a thread that simulates the CPU under the Shenwei architecture, and a virtual machine CPU structure in QEMU is constructed. After receiving the virtual machine CPU hot-plug interrupt, the aligned CPU parameters sent by QEMU are parsed in the virtual machine pm-device device driver, and a virtual machine CPU structure is created in the virtual machine kernel according to the information obtained from the analysis, and the virtual machine CPU structure in QEMU and the virtual machine CPU structure created by the virtual machine kernel are bound to complete the hot plug of the CPU; after obtaining the id information of the CPU to be hot-plugged, the slot information of the CPU to be hot-plugged is searched, and after receiving the hot-plug CPU interrupt, the release operation in the virtual machine CPU initialization is called to destroy the virtual machine CPU device created by QEMU to complete the hot plug of the CPU; the virtual machine CPU hot plug is realized on the Shenwei platform; Since the Shenwei platform does not support ACPI at this stage, in order to realize the complete hot-swap logic chain of the Shenwei platform, the CPU hot-swap function is registered in the pm-device device of the Shenwei platform, and the interrupt sending mechanism of the Shenwei platform is implemented in the callback of the registered function, which is different from the ACPI interrupt sending process of the X86 platform. The implementation problem of CPU hot-swap interrupt reception and transmission and hot-swap CPU information transmission between QEMU and the virtual machine under the existing Shenwei platform is solved; Design and implement the virtual machine CPU hot-swap logic on the Shenwei platform to solve the problem of missing virtual machine CPU hot-swap function on the Shenwei platform and realize the random and repeated hot-swap function of the virtual machine CPU on the Shenwei platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flow chart of a virtual machine CPU hot-plugging method for Shenwei architecture provided in the first embodiment of the present invention; Figure 2 This is a flow chart of a method for hot-plugging a virtual machine CPU for a Shenwei architecture provided in the second embodiment of the present invention; Figure 3 This is a flow chart of a CPU state management module in an electronic device provided in Embodiment 3 of the present invention; Figure 4 This is a diagram showing the effect of hot-plugging the CPU of a Shenwei architecture virtual machine in an electronic device provided in Example 3 of the present invention. DETAILED DESCRIPTION
[0017] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0018] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and the like are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", and the like may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0019] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood by specific circumstances. Embodiment 1:
[0020] This embodiment provides a virtual machine CPU hot-plug method for the Shenwei architecture, which is executed by QEMU, wherein the Shenwei architecture is simulated in the QEMU, a virtual machine is constructed in the Shenwei architecture, and KVM is applied in the QEMU, including: Step 1: Parse the input qmp-shell add command, obtain the CPU parameters of the Shenwei architecture, align the CPU parameters with the CPU parameters supported in the QEMU description document, add and save the aligned CPU parameters to the CPU structure of the Shenwei architecture, so that after the subsequent interrupt is triggered, the information is sent to the virtual machine kernel for use; Step 2: Detect the online status of the CPU corresponding to the aligned CPU parameters through the CPU status management module in the QEMU. When the CPU corresponding to the aligned CPU parameters is offline, query whether the slot of the corresponding virtual machine CPU in the QEMU is empty. When the slot of the virtual machine CPU is empty, that is, the two conditions that the CPU corresponding to the aligned CPU parameters is offline and the slot of the corresponding virtual machine CPU in the QEMU is empty are required to be met at the same time before executing the subsequent operation steps. When one condition cannot be met, the method stops executing, controls the KVM to create a thread that simulates the CPU under the Shenwei architecture, and constructs the virtual machine CPU structure in QEMU, fills in the aligned CPU parameters through the pm-device device of the Shenwei architecture, and triggers the registered hot-plug CPU interrupt through the CPU hot-plug operation function registered in the pm-device device under the Shenwei architecture, and sends the aligned CPU parameters to the pm-device device driver of the virtual machine kernel; Step 3: Control the pm-device device driver of the virtual machine to monitor and receive the virtual machine CPU hot plug interrupt sent by QEMU through the registered interrupt receiving thread; Step 4: After receiving the virtual machine CPU hot plug interrupt, parse the aligned CPU parameters sent by QEMU in the virtual machine pm-device device driver, and create a virtual machine CPU structure in the virtual machine kernel according to the information obtained by the parsing; Step 5: Bind the virtual machine CPU structure in the QEMU and the virtual machine CPU structure created by the virtual machine kernel, control the newly inserted virtual machine CPU to go online through the online command, display the newly inserted virtual machine CPU through the display command, and complete the hot plug of the CPU.
[0021] The adding command may be a qmp-shell command or a virsh command, wherein the virsh command is converted into a qmp-shell command by Libvirt in the QEMU. In this embodiment, the adding command may be: device_add id=cpu-2 driver=core3-sw64-cpu socket-id=0 core-id=2 thread-id=0.
[0022] The CPU resources of the virtual machine can be dynamically increased or decreased through QEMU's qmp-shell or Libvirt's virsh command. During hot plugging of the virtual machine CPU, the virsh command will be converted into a qmp-shell command through Libvirt. The two are only logical encapsulations. Libvirt is a collection of logical encapsulations of qmp-shell commands and is also a commonly used management tool for cloud management platforms.
[0023] Use the virsh command through the Libvirt management tool: Add the command "virsh setvcpu domain cpulist --enable" (for example, the command virsh setvcpudomain 2 --enable will perform hot-plugging of CPU No. 2 of the virtual machine domain) to perform hot-plugging of the virtual machine CPU; Libvirt commands are converted into qmp-shell commands that can be recognized by QEMU monitor. Therefore, the corresponding qmp-shell command parsing logic needs to be associated with the virsh command on the QEMU side: Corresponding to the add command of virsh, qemu side uses the add command "device_add id=cpu-id driver=cpu-typesocket-id=x core-id=x thread-id=x" of qmp-shell (for example, the command device_add id=cpu-2driver=core3-sw64-cpu socket-id=0 core-id=2 thread-id=0 will perform the hot-plug operation of CPU No. 2 of the current virtual machine and mark the CPU as "cpu-2" in QEMU) to hot-plug the CPU of the virtual machine; Run the echo 1> / sys / devices / system / cpu / cpu2 / online command to bring the newly inserted virtual machine CPU online. Run the lscpu command to see the newly inserted virtual machine CPU, and the hot-plug operation is complete.
[0024] To demonstrate the parsing process of command parameters, the qmp-shell command is used to explain the detailed steps. To be close to actual use, the CPU No. 2 of the virtual machine is used as an example of the detailed steps. For detailed parameter settings, please refer to the explanation in the above paragraph. Figure 1 The hot-plugging process of the virtual machine CPU in the present invention is shown. Embodiment 2:
[0025] The second embodiment provides a method for hot-plugging a virtual machine CPU for the Shenwei architecture, which is executed by QEMU, and the Shenwei architecture is simulated in the QEMU, including: The virtual machine CPU is controlled to go offline through the offline command. In this embodiment, the corresponding virtual machine CPU is taken offline through the "echo0> / sys / devices / system / cpu / cpu2 / online" command. The "lscpu" command can display that the corresponding CPU of the virtual machine is in the off-line state; Parse the input delete command to obtain the ID information of the CPU to be hot-plugged; Based on the ID information of the CPU to be hot-plugged, the CPU status management module in the QEMU detects whether the CPU to be hot-plugged is online and has a non-zero core, and updates the CPU hot-plug status management table in the CPU status management module when all the conditions are met; Regarding the non-zero core, the following explanation is given: System dependency: Core 0 is usually the first core used when the operating system starts up. It is responsible for executing the startup code and initializing other cores. If core 0 is hot-plugged, it may cause system instability or crash.
[0026] Interrupt handling: Core 0 may be responsible for handling certain critical interrupts that are essential for the normal operation of the system. If this core is hot-plugged, it may affect the normal processing of interrupts.
[0027] Task allocation: The operating system may assign critical tasks to core 0, which are essential for system stability and performance. If core 0 is hot-plugged, these tasks may be affected.
[0028] Hardware Design: From a hardware design perspective, the CPU core may be physically or logically tightly integrated with the motherboard, making hot-plugging core 0 unrealistic.
[0029] Security and stability: Hot-unplugging any core may bring security risks and stability issues, especially core 0 because it usually bears more responsibilities.
[0030] Technical limitations: The design and manufacturing technology of modern CPUs may not allow hot-plugging of cores, especially core 0, without restarting the system.
[0031] Searching for the slot information of the CPU to be hot-plugged, and finding the corresponding CPU device information through the slot information of the CPU to be hot-plugged; Through the CPU hot-plug operation function registered in the pm-device device under the Shenwei architecture, the registered hot-plug CPU interrupt is triggered, and after receiving the hot-plug CPU interrupt sent by the QEMU, the corresponding virtual machine CPU is controlled to release resources according to the corresponding CPU device information; After the CPU resources of the virtual machine are released, an interrupt is sent to QEMU to release the CPU thread resources of the simulated virtual machine, that is, the KVM is controlled to create a thread of the simulated CPU under the Shenwei architecture as described in Example 1 to complete the hot pull of the CPU.
[0032] Use the virsh command through the Libvirt management tool: Delete the command "virsh setvcpu domain cpulist --disable" (for example, the virsh setvcpudomain 2 --disable command will hot-plug CPU 2 of the virtual machine domain) to hot-plug the virtual machine CPU.
[0033] Libvirt commands are converted into qmp-shell commands that can be recognized by QEMU monitor. Therefore, the corresponding qmp-shell command parsing logic needs to be associated with the virsh command on the QEMU side: Corresponding to the virsh delete command, QEMU uses the qmp-shell delete command "device_del id=cpu-id" (for example, the device_del id=cpu-2 command will perform a hot-plug operation on the CPU marked as "cpu-2" in the current virtual machine) to hot-plug the virtual machine CPU.
[0034] To demonstrate the parsing process of command parameters, the qmp-shell command is used to explain the detailed steps. To be close to actual use, the CPU No. 2 of the virtual machine is used as an example of the detailed steps. For detailed parameter settings, please refer to the explanation in the above paragraph. Figure 2 The hot-plug process of the virtual machine CPU in the present invention is shown. Embodiment three:
[0035] This embodiment provides an electronic device for executing the virtual machine CPU hot-swapping method for the Shenwei architecture described in the first embodiment or the virtual machine CPU hot-pulling method for the Shenwei architecture described in the second embodiment, and has corresponding beneficial effects: Regarding the CPU status management module described in Embodiment 1 and Embodiment 2, Figure 3 The specific control flow chart of the CPU state management module in the Shenwei architecture is shown, and it can be seen that: In the second embodiment, controlling the virtual machine CPU to go offline by using an offline command can be understood as initializing the CPU hot-plug state management table in the CPU state management module. Initialization is performed by default in the initial stage of the hot-plug process. The subsequent comparison of the CPU hot-plug status management table includes "detecting the online status of the CPU corresponding to the aligned CPU parameters through the CPU status management module in the QEMU, and when the CPU corresponding to the aligned CPU parameters is offline, querying whether the slot of the corresponding virtual machine CPU in the QEMU is empty" and "detecting whether the CPU to be hot-plugged is online and non-0 core through the CPU status management module in the QEMU" in the process of Example 1 and Example 2; The CPU hot-plug state management table can be updated by setting the corresponding position of the hot-plug CPU state management table, wherein the setting is a prior art and will not be described in detail here; The CPU hot-plug information transmission has been disclosed in both Embodiment 1 and Embodiment 2. Figure 3 This is summarized in the article. For the hot-plug CPU situation, the CPU information (i.e., the aligned CPU parameters described in Example 1) is passed and applied to the parameters of the CPU thread created by QEMU (i.e., the thread simulating the CPU under the Shenwei architecture created by KVM in Example 1) and the CPU information structure (i.e., the virtual machine CPU structure in QEMU in Example 1); for the hot-plug CPU situation, the corresponding CPU information in the CPU hot-plug status management table is searched (i.e., the corresponding CPU device information is found through the slot information of the CPU to be hot-plugged in Example 2) and applied to the QEMU device resource release step (i.e., the CPU resource release step in Example 2); During the CPU hot-plug process, management is performed through the CPU hot-plug status management table information, and then the structure of the CPU device is created according to the command parsing information. The index parameter of the qom-path in the CPU information is guaranteed to be unified with the core-id parameter through the intervention of the CPU hot-plug status management table information, wherein the index parameter of the qom-path comes from QEMU, and the core-id parameter comes from the CPU parameter of the Shenwei architecture. During the CPU hot-plug process, the QEMU thread of the virtual CPU is destroyed according to the CPU hot-plug status management table information, and the structure information of the corresponding QEMU in the CPU device is released, ensuring that the index parameter of the qom-path in the CPU information is unified with the core-id and can be reused, thereby solving the problem that the index parameter of the qom-path in the CPU information of the X86 platform is continuously accumulated, and the device structure information of the CPU in the original QEMU is not completely released in the case of repeated hot-plugging.
[0036] Since the Shenwei platform does not support ACPI at this stage, in order to realize the complete hot-plug logic chain of the Shenwei platform, the CPU hot-plug function is registered in the pm-device device of the Shenwei platform, and the interrupt sending mechanism of the Shenwei platform is implemented in the callback of the registered function, which is different from the ACPI interrupt sending process of the X86 platform. The implementation problem of CPU hot-plug interrupt reception and transmission and hot-plug CPU information transmission between QEMU and the virtual machine under the existing Shenwei platform is solved.
[0037] Design and implement the virtual machine CPU hot-swap logic on the Shenwei platform to solve the problem of missing virtual machine CPU hot-swap function on the Shenwei platform and realize the random and repeated hot-swap function of the virtual machine CPU on the Shenwei platform.
[0038] Figure 4 The diagram shows the effect of hot-plugging the CPU of the Shenwei platform virtual machine, which demonstrates the technical effect based on the Libvirt command.
[0039] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A virtual machine CPU hot-swapping method for Shenwei architecture, characterized in that: Executed by QEMU, wherein the QEMU simulates the Shenwei architecture, wherein a virtual machine is built in the Shenwei architecture, wherein KVM is applied in the QEMU, including: Parse the input add command, obtain the CPU parameters of the Shenwei architecture, align the CPU parameters with the CPU parameters supported in the QEMU description document, obtain the aligned CPU parameters, add and save the aligned CPU parameters to the CPU structure of the Shenwei architecture; Control the KVM to create a thread that simulates the CPU under the Shenwei architecture, and build a virtual machine CPU structure in QEMU, trigger a hot plug interrupt, and send the aligned CPU parameters to the pm-device device driver of the virtual machine kernel; After receiving the virtual machine CPU hot plug interrupt, the aligned CPU parameters sent by QEMU are parsed in the virtual machine pm-device device driver, and a virtual machine CPU structure is created in the virtual machine kernel according to the information obtained by the parsing; The virtual machine CPU structure in the QEMU and the virtual machine CPU structure created by the virtual machine kernel are bound to complete the hot plug of the CPU.
2. The virtual machine CPU hot-swapping method for Shenwei architecture according to claim 1 is characterized in that: Before controlling the KVM to create a thread to simulate the CPU under the Shenwei architecture: The CPU online status of the CPU corresponding to the aligned CPU parameters is detected by the CPU status management module in the QEMU. When the CPU corresponding to the aligned CPU parameters is offline, it is queried whether the slot of the corresponding virtual machine CPU in the QEMU is empty. When the slot of the virtual machine CPU is empty, the slot information of the hot-pluggable CPU is returned to the QEMU, and the CPU hot-plug status management table in the CPU status management module is updated.
3. The virtual machine CPU hot-swapping method for Shenwei architecture according to claim 1 is characterized in that: The triggering of hot plug interruption comprises: The aligned CPU parameters are filled in through the pm-device device of the Shenwei architecture, and the registered hot-plug CPU interrupt is triggered through the CPU hot-plug operation function registered in the pm-device device under the Shenwei architecture.
4. The virtual machine CPU hot-swapping method for Shenwei architecture according to claim 1 is characterized in that: The added command is a qmp-shell command or a virsh command, wherein the virsh command is converted into a qmp-shell command by Libvirt in the QEMU.
5. The virtual machine CPU hot-swapping method for Shenwei architecture according to claim 1 is characterized in that: After binding the virtual machine CPU structure in the QEMU and the virtual machine CPU structure created by the virtual machine kernel: Use the online command to control the newly inserted virtual machine CPU to go online, and use the display command to display the newly inserted virtual machine CPU.
6. A virtual machine CPU hot-plug method for Shenwei architecture, characterized in that: Executed by QEMU, which simulates the Shenwei architecture, including: Enter the command to delete the CPU on the QEMU side; Parse the input delete command to obtain the ID information of the CPU to be hot-plugged; Based on the ID information of the CPU to be hot-plugged, the CPU status management module in the QEMU detects whether the CPU to be hot-plugged is online and has a non-zero core. If all the conditions are met, the CPU hot-plug status management table in the CPU status management module is updated to search for the slot information of the CPU to be hot-plugged, and the corresponding CPU device information is found through the slot information of the CPU to be hot-plugged; Through the CPU hot-plug operation function registered in the pm-device device under the Shenwei architecture, the registered hot-plug CPU interrupt is triggered, and after receiving the hot-plug CPU interrupt sent by the QEMU, the corresponding virtual machine CPU is controlled to release resources according to the corresponding CPU device information; After the virtual machine CPU resources are released, an interrupt is sent to QEMU to release the simulated virtual machine CPU thread resources and complete the hot pull of the CPU.
7. The method for hot-plugging a virtual machine CPU for Shenwei architecture according to claim 6, characterized in that: Before parsing the input delete command, the virtual machine CPU is controlled to go offline through the offline command.
8. An electronic device, used to execute the virtual machine CPU hot-swapping method for Shenwei architecture described in claims 1-5 or the virtual machine CPU hot-unplugging method for Shenwei architecture described in claims 6-8.