Processor control method and device and server
By configuring differentiated performance for the target physical core of the virtual processor, the problem of low utilization of the virtual processor is solved and efficient utilization of the physical processor is achieved.
Patent Information
- Application Number
- CN202410095175.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-23
- Publication Date
- 2025-07-25
AI Technical Summary
In the prior art, the performance of virtual processors cannot be differentiated according to task requirements, resulting in some virtual processors being busy while the other part being idle, resulting in low overall utilization, which in turn affects the utilization rate of physical processors.
By determining the target physical core corresponding to the current virtual processor and obtaining its virtual configuration information, the operating parameters of the target physical core are updated based on this information to provide differentiated performance and achieve reasonable utilization of the virtual processor.
The overall utilization of multiple virtual processors is improved, thereby improving utilization of physical processors.
Smart Images

Figure CN120371450A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and in particular, to a control method, device, and server for a processor. Background Art
[0002] Virtual machines can run in a server, and a virtual machine can include multiple virtual central processing units (vCPUs). The multiple virtual processors run based on the physical processors in the server.
[0003] In the related art, for any virtual machine, the performance of multiple vCPUs in the virtual machine is the same. However, in the above manner, since the tasks executed by each vCPU are different, some vCPUs are very busy and have reached the performance limit, while some other vCPUs are relatively idle, wasting some performance.
[0004] As can be seen from the above, in the related art, the overall utilization rate of multiple virtual processors is low, which in turn leads to low utilization rate of physical processors. Summary of the Invention
[0005] Multiple aspects of this application provide a control method, device, and server for a processor to improve the utilization rate of physical processors.
[0006] In a first aspect, an embodiment of this application provides a control method for a processor, including:
[0007] Determine a target physical core corresponding to a current virtual processor, where the current virtual processor is a virtual processor in a virtual machine;
[0008] Obtain virtual configuration information of the current virtual processor, where the virtual configuration information is generated based on user configuration;
[0009] Update operating parameters of the target physical core according to the virtual configuration information.
[0010] In a possible implementation manner, updating the operating parameters of the target physical core according to the virtual configuration information includes:
[0011] Determine a previous virtual processor corresponding to the target physical core;
[0012] Determine an update status of the current virtual processor, where the update status is an updated status or an unupdated status;
[0013] Update the operating parameters of the target physical core according to the previous virtual processor, the update status, and the virtual configuration information.
[0014] In a possible implementation, according to the previous virtual processor, the update status, and the virtual configuration information, update the operating parameters of the target physical core, including:
[0015] If the current virtual processor is different from the previous virtual processor, and / or the update status is the updated status, update the operating parameters of the target physical core according to the virtual configuration information.
[0016] In a possible implementation, if the current virtual processor is different from the previous virtual processor, and / or the update status is the updated status, update the operating parameters of the target physical core according to the virtual configuration information, including:
[0017] Determine whether the current virtual processor is the same as the previous virtual processor;
[0018] If so, when the update status is the updated status, update the operating parameters according to the virtual configuration information;
[0019] If not, update the operating parameters according to the virtual configuration information.
[0020] In a possible implementation, determining whether the current virtual processor is the same as the previous virtual processor includes:
[0021] Obtain the current structure pointer corresponding to the target physical core, where the current structure pointer is used to indicate the current virtual processor;
[0022] Obtain the previous structure pointer corresponding to the target physical core, where the previous structure pointer is used to indicate the previous virtual processor;
[0023] If the current structure pointer is the same as the previous structure pointer, determine that the current virtual processor is the same as the previous virtual processor;
[0024] If the current structure pointer is different from the previous structure pointer, determine that the current virtual processor is different from the previous virtual processor.
[0025] In a possible implementation, the method further includes:
[0026] When the target physical core stops running the current virtual processor, update the current structure pointer corresponding to the target physical core to null; and,
[0027] Update the previous structure pointer corresponding to the target physical core to the structure pointer corresponding to the current virtual processor.
[0028] In a possible implementation, determining the update status of the current virtual processor includes:
[0029] Obtaining a status bit corresponding to the current virtual processor;
[0030] If the status bit is a first preset value, determining that the update status is the updated state;
[0031] If the status bit is a second preset value, determining that the update status is the unupdated state.
[0032] In a possible implementation, after the update status is the updated state and the operating parameters are updated according to the virtual configuration information, it further includes:
[0033] Setting the status bit to the second preset value.
[0034] In a possible implementation, after updating the operating parameters of the target physical core according to the previous virtual processor, the update status, and the virtual configuration information, it further includes:
[0035] Determining the previous physical core corresponding to the current virtual processor, where the previous physical core is the physical core called by the current virtual processor before calling the target physical core;
[0036] Determining whether a virtual processor is running on the previous physical core;
[0037] If not, setting the operating parameters of the previous physical core to default operating parameters.
[0038] In a possible implementation, the virtual machine is provided with an interaction interface and a register; obtaining the virtual configuration information of the current virtual processor includes:
[0039] Reading the virtual configuration information in the register, where the virtual configuration information is written into the register by the virtual machine through the interaction interface.
[0040] In a possible implementation, the method further includes:
[0041] Running the current virtual processor according to the updated operating parameters of the target physical core.
[0042] In a second aspect, an embodiment of the present application provides a control device for a processor, and the device includes: a first determination module, an acquisition module, and an update module, where
[0043] The first determination module is configured to determine a target physical core corresponding to the current virtual processor, where the current virtual processor is a virtual processor in a virtual machine;
[0044] The acquisition module is configured to acquire virtual configuration information of the current virtual processor, where the virtual configuration information is generated based on user configuration;
[0045] The update module is configured to update the operating parameters of the target physical core according to the virtual configuration information.
[0046] In a possible implementation manner, the update module is specifically configured to:
[0047] Determine the previous virtual processor corresponding to the target physical core;
[0048] Determine the update status of the current virtual processor, where the update status is an updated status or an unupdated status;
[0049] Update the operating parameters of the target physical core according to the previous virtual processor, the update status, and the virtual configuration information.
[0050] In a possible implementation manner, the update module is specifically configured to:
[0051] If the current virtual processor is different from the previous virtual processor, and / or the update status is the updated status, then update the operating parameters of the target physical core according to the virtual configuration information.
[0052] In a possible implementation manner, the update module is specifically configured to:
[0053] Determine whether the current virtual processor is the same as the previous virtual processor;
[0054] If so, when the update status is the updated status, update the operating parameters according to the virtual configuration information;
[0055] If not, update the operating parameters according to the virtual configuration information.
[0056] In a possible implementation manner, the update module is specifically configured to:
[0057] Acquire a current structure pointer corresponding to the target physical core, where the current structure pointer is used to indicate the current virtual processor;
[0058] Acquire a previous structure pointer corresponding to the target physical core, where the previous structure pointer is used to indicate the previous virtual processor;
[0059] If the current structure pointer is the same as the previous structure pointer, it is determined that the current virtual processor is the same as the previous virtual processor;
[0060] If the current structure pointer is different from the previous structure pointer, it is determined that the current virtual processor is different from the previous virtual processor.
[0061] In a possible implementation manner, the update module is further configured to:
[0062] When the target physical core stops running the current virtual processor, update the current structure pointer corresponding to the target physical core to be empty; and,
[0063] Update the previous structure pointer corresponding to the target physical core to the structure pointer corresponding to the current virtual processor.
[0064] In a possible implementation manner, the update module is configured to:
[0065] Obtain the status bit corresponding to the current virtual processor;
[0066] If the status bit is the first preset value, determine that the update status is the updated status;
[0067] If the status bit is the second preset value, determine that the update status is the unupdated status.
[0068] In a possible implementation manner, the update module is further configured to:
[0069] Set the status bit to the second preset value.
[0070] In a possible implementation manner, the device further includes a second determination module and a setting module, where
[0071] The second determination module is configured to determine the previous physical core corresponding to the current virtual processor, where the previous physical core is the physical core called by the current virtual processor before calling the target physical core;
[0072] The second determination module is further configured to determine whether a virtual processor is running on the previous physical core;
[0073] The setting module is configured to, if not, set the operating parameters of the previous physical core to default operating parameters.
[0074] In a possible implementation manner, the virtual machine is provided with an interaction interface and a register; the obtaining module is specifically configured to:
[0075] Read the virtual configuration information in the register, where the virtual configuration information is written to the register by the virtual machine through the interaction interface.
[0076] In a possible implementation, the device further includes: an operation module,
[0077] The operation module is configured to run the current virtual processor according to the updated operation parameters of the target physical core.
[0078] In a third aspect, an embodiment of the present application provides a server, including: a memory and a processor;
[0079] The memory stores computer-executable instructions;
[0080] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the method according to any one of the first aspect.
[0081] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the method according to any one of the first aspect.
[0082] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the method according to any one of the first aspect.
[0083] An embodiment of the present application provides a control method, device and server for a processor. The server can determine the target physical core corresponding to the current virtual processor, obtain the virtual configuration information of the current virtual processor, and then can update the operation parameters of the target physical core according to the virtual configuration information. Since the virtual processor runs based on the target physical core, updating the operation parameters of the target physical core according to the virtual configuration information can make the target physical core have different performances, so as to provide different performances for the virtual processor running based on the target physical core, so that multiple virtual processors have different performances, making reasonable use of multiple virtual processors, thus improving the overall utilization rate of multiple virtual processors, and further improving the utilization rate of the physical processor. Description of the Drawings
[0084] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application, and do not constitute an improper limitation to the present application. In the drawings:
[0085] Figure 1 It is a schematic diagram of a scenario provided for an exemplary embodiment of the present application;
[0086] Figure 2 Schematic flow chart of a control method for a processor provided by an exemplary embodiment of the present application;
[0087] Figure 3 Schematic flow chart of another control method for a processor provided by an exemplary embodiment of the present application;
[0088] Figure 4 Schematic diagram of a dirty map structure provided by an exemplary embodiment of the present application;
[0089] Figure 5 Architecture diagram of a server provided by an exemplary embodiment of the present application;
[0090] Figure 6 Schematic structural diagram of a control device for a processor provided by an exemplary embodiment of the present application;
[0091] Figure 7 Schematic structural diagram of another control device for a processor provided by an exemplary embodiment of the present application;
[0092] Figure 8 Schematic structural diagram of a server provided by an exemplary embodiment of the present application. Detailed implementation manners
[0093] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties. And the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards, and corresponding operation entrances are provided for users to select authorization or rejection.
[0094] To make the objectives, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be clearly and completely described below in conjunction with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art without creative efforts based on the embodiments in the present application belong to the scope of protection of the present application.
[0095] The technical solution of the present application is implemented based on the microprocessor power management technology (Intel Speed Select Technology, ISST). Through the ISST technology, the performance of physical cores can be configured, and by sacrificing the performance of other physical cores, the performance of the target physical core can be improved.
[0096] The ISST technology mainly includes the following four technologies:
[0097] 1. Core Power Technology (Intel(R) Speed Select Technology Core Power, ISST-CP)
[0098] With the ISST-CP technology, physical cores can be configured to different priorities. When the load on the physical processor causes the power consumption of the physical processor to exceed the Thermal Design Power, the operation of the physical cores with higher priorities in the physical processor can be preferentially ensured.
[0099] 2. Turbo Frequency Technology (Intel(R) Speed Select Technology Turbo Frequency, ISST-TF)
[0100] With the ISST-TF technology, physical cores can be configured to different priorities. The frequency of the physical cores with lower priorities is controlled within a lower range, and the frequency of the physical cores with higher priorities is controlled within a higher range, that is, a higher turbo frequency is provided for the physical cores with higher priorities, thereby improving the overall performance of multiple physical cores.
[0101] 3. Base Frequency Technology (Intel(R) Speed Select Technology Base Frequency, ISST-BF)
[0102] With the ISST-BF technology, the base frequency of the physical cores with higher priorities can be increased, and the base frequency of the physical cores with lower priorities can be decreased. The base frequency refers to the lowest frequency at which the physical core operates.
[0103] 4. Performance Configuration Technology (Intel(R) Speed Select Technology Perf Profile, ISST-PP)
[0104] With the ISST-PP technology, it is possible to support physical cores to operate in different working modes. For any one working mode, there can be a corresponding configuration file. The configuration file can include the base frequency, thermal design power, and maximum operating temperature of the physical core. The physical core can operate according to different configuration files in different working modes.
[0105] Through the technical solution of this application, the virtualization of the ISST technology is realized, and the ISST capability is provided for the virtual machine, that is, by configuring each virtual processor in the virtual machine, the target physical core corresponding to the virtual processor can be configured, so that the target physical core has differentiated performance.
[0106] Figure 1A scenario schematic diagram provided for an exemplary embodiment of this application. Please refer to Figure 1 The server may include at least one physical processor and at least one virtual machine.
[0107] The physical processor may include multiple physical cores. For example, the physical processor may include 32 physical cores, namely physical core 0, physical core 1, ……, physical core 31.
[0108] The virtual machine may include multiple vCPUs. These multiple vCPUs may execute different tasks. For example, virtual machine 1 may include 64 vCPUs, namely vCPU0, vCPU1, ……, vCPU63. Among them, vCPU0 and vCPU1 may be used to execute graphics processing tasks; vCPU2 and vCPU3 may be used to execute logging tasks.
[0109] For any one vCPU, the vCPU runs based on the physical cores in the physical processor. For example, vCPU0 and vCPU1 may run based on physical core 0; vCPU2 and vCPU3 may run based on physical core 1; ……; vCPU62 and vCPU63 may run based on physical core 31.
[0110] Since different vCPUs are used to execute different tasks, the user can perform differential configuration on any one vCPU in the virtual machine to adjust the performance of the vCPU, so that the performance of the vCPU can match the performance required for the execution of the task. For example, in virtual machine 1, if vCPU0 is used to execute graphics processing tasks and the utilization rate of vCPU0 is 90%; if vCPU2 is used to execute logging tasks and the utilization rate of vCPU2 is 30%, then the user can configure vCPU0 in virtual machine 1 to make vCPU1 have higher performance for better execution of graphics processing tasks; vCPU2 can be configured to make vCPU2 have lower performance to avoid wasting some performance.
[0111] In the related art, for any one virtual machine, the performance of multiple vCPUs in the virtual machine is the same. However, in the above manner, since the tasks executed by each vCPU are different, some vCPUs are very busy and have reached the performance limit; while some other vCPUs are relatively idle, wasting some performance. Therefore, in the related art, the overall utilization rate of multiple virtual processors is low, which in turn leads to low utilization rate of the physical processor.
[0112] In an embodiment of the present application, the server may determine the target physical core corresponding to the current virtual processor, obtain the virtual configuration information of the current virtual processor, and then update the operating parameters of the target physical core according to the virtual configuration information. Since the virtual processor runs based on the target physical core, updating the operating parameters of the target physical core according to the virtual configuration information can enable the target physical core to have different performances, so as to provide different performances for the virtual processor running based on the target physical core, thereby enabling multiple virtual processors to have differentiated performances, making rational use of multiple virtual processors, and thus improving the overall utilization rate of multiple virtual processors, and further improving the utilization rate of the physical processor.
[0113] Next, the technical solution shown in the present application will be described in detail through specific embodiments. It should be noted that the following several embodiments may exist independently or be combined with each other. For the same or similar content, it will not be repeated in different embodiments.
[0114] Figure 2 It is a schematic flowchart of a control method for a processor provided by an exemplary embodiment of the present application. Please refer to Figure 2 The method may include:
[0115] S201. Determine the target physical core corresponding to the current virtual processor.
[0116] The execution subject of the embodiment of the present application may be a server or a control device of a processor provided in the server. The control device of the processor may be implemented by software or by a combination of software and hardware. The control device of the processor may be a processor in the server. For the sake of easy understanding, hereinafter, the execution subject is taken as an example of the server for description.
[0117] The current virtual processor is a virtual processor in a virtual machine. The current virtual processor refers to the virtual processor currently running on the target physical core.
[0118] Since any virtual processor runs based on a physical core, for the current virtual processor, the target physical core corresponding to the current virtual processor can be determined. For example, if the current virtual processor is vCPU0, the target physical core corresponding to vCPU0 can be determined. Suppose the target physical core is physical core 0.
[0119] S202. Obtain the virtual configuration information of the current virtual processor.
[0120] The virtual configuration information refers to the configuration information of the current virtual processor. The virtual configuration information may be generated based on user configuration.
[0121] Optionally, the virtual configuration information may include information such as the priority, thermal design power consumption, and / or operating frequency of the current virtual processor.
[0122] Optionally, the virtual machine may be provided with corresponding interaction interfaces and registers, and the virtual configuration information may be written into the registers through the interaction interfaces.
[0123] For example, the interaction interfaces may include a communication (MailBox) interface and a memory-mapped input / output (MMIO) interface.
[0124] Optionally, the virtual configuration information may be read from the registers to obtain the virtual configuration information of the current virtual processor. For example, if the current virtual processor is vCPU0, the virtual configuration information 0 may be read from the registers to obtain the virtual configuration information 0 of vCPU0. The virtual configuration information 0 may include that the priority of vCPU0 is 1, the thermal design power consumption is 600 W (watts), and the operating frequency is 2000 MHz (megahertz).
[0125] S203. Update the operating parameters of the target physical core according to the virtual configuration information.
[0126] In an optional embodiment, the operating parameters of the target physical core may be updated according to the virtual configuration information in the following manner: determine the previous virtual processor corresponding to the target physical core; determine the update status of the current virtual processor; update the operating parameters of the target physical core according to the previous virtual processor, the update status, and the virtual configuration information.
[0127] For any physical core, 1 vCPU can be run at any time, that is, 2 vCPUs will not be run simultaneously at the same time. Therefore, the physical core can run different virtual processors at different times. For example, for physical core 0, vCPU0 can be run at the first time, and vCPU1 can be run at the second time, and vCPU0 and vCPU1 will not be run simultaneously at the same time.
[0128] The previous virtual processor refers to the virtual processor that the target physical core ran before running the current virtual processor.
[0129] The update status may be an updated status or an unupdated status.
[0130] The update status of the current virtual processor is the update status of the virtual configuration information of the current virtual processor. For example, if the current virtual processor is vCPU0, the virtual configuration information of vCPU0 is virtual configuration information 0, and if the update status of virtual configuration information 0 is the updated status, that is, the update status of the current virtual processor vCPU0 is the updated status.
[0131] For example, if the target physical core is physical core 0, assume that it can be determined that the previous virtual processor corresponding to physical core 0 is vCPU2; if the current virtual processor is vCPU0, then the update status of vCPU0 can be determined.
[0132] Optionally, the operating parameters of the target physical core can be updated according to the previous virtual processor, the update status, and the virtual configuration information in the following manner: if the current virtual processor is different from the previous virtual processor, and / or the update status is the updated status, then the operating parameters of the target physical core are updated according to the virtual configuration information.
[0133] For example, if the target physical core is physical core 0, if the previous virtual processor corresponding to physical core 0 is vCPU2, and if the current virtual processor is vCPU0, then it can be determined that the current virtual processor is different from the previous virtual processor; and / or, if the update status of the current virtual processor vCPU0 is the updated status, then the operating parameters of physical core 0 can be updated according to the virtual configuration information 0 of vCPU0. If the virtual configuration information 0 can include that the priority of vCPU0 is 1, the thermal design power consumption is 600W, and the operating frequency is 2000MHz, then the priority of physical core 0 can be set to 1, the thermal design power consumption can be set to 600W, and the operating frequency can be set to 2000MHz.
[0134] After updating the operating parameters of the target physical core, the target physical core can run the current virtual processor based on the updated operating parameters, so that the target physical core can provide performance different from that before the update and different from the virtual processors on other physical cores for the current virtual processor.
[0135] For example, if the target physical core is physical core 0, after updating the operating parameters of physical core 0, the priority of physical core 0 is 1, the thermal design power consumption is 600W, and the operating frequency is 2000MHz; if the current virtual processor running on physical core 0 is vCPU0, then physical core 0 can run vCPU0 based on the updated operating parameters, that is, the priority of vCPU0 can be 1, and the thermal design power consumption of 600W and the operating frequency of 2000MHz can be provided for vCPU0.
[0136] In the embodiments of the present application, the server may determine the target physical core corresponding to the current virtual processor, obtain the virtual configuration information of the current virtual processor, and then update the operating parameters of the target physical core according to the virtual configuration information. Since the virtual processor runs based on the target physical core, updating the operating parameters of the target physical core according to the virtual configuration information can enable the target physical core to have different performances, so as to provide different performances for the virtual processors running based on the target physical core, thereby enabling multiple virtual processors to have differentiated performances, making reasonable use of multiple virtual processors, and thus improving the overall utilization rate of multiple virtual processors, and further improving the utilization rate of the physical processor.
[0137] Next, based on the embodiments shown in Figure 2 , in combination with Figure 3 , the above control method of the processor will be described in detail.
[0138] Figure 3 FIG. is a schematic flowchart of another control method of a processor provided by an exemplary embodiment of the present application. Please refer to Figure 3 , the method may include:
[0139] S301. Determine the target physical core corresponding to the current virtual processor.
[0140] It should be noted that the execution process of step S301 may refer to step S201, and details will not be repeated here.
[0141] S302. Obtain the virtual configuration information of the current virtual processor.
[0142] Optionally, the virtual machine may be provided with corresponding interaction interfaces and registers, and the virtual configuration information may be written into the registers through the interaction interfaces.
[0143] Optionally, the interaction interfaces may include a vMailBox interface, a vMMIO interface, a MailBox interface, and an MMIO interface. Among them, the vMailBox interface refers to a virtual MailBox interface, and the vMMIO interface refers to a virtual MMIO interface.
[0144] The vMailBox interface corresponds to the MailBox interface, and the vMMIO interface corresponds to the MMIO interface. The vMailBox interface and the vMMIO interface are in the user state, and the MailBox interface and the MMIO interface are in the kernel state.
[0145] For the vMailBox interface, the vMailBox interface may have 2 corresponding registers. For example, the names and corresponding address offsets of the 2 registers may be as shown in Table 1:
[0146] Table 1
[0147] Name Address Offset Punit_MailBox_data Register 0xA0 Punit_MailBox_interface Register 0xA4
[0148] Optionally, a vMailBox configuration space can be set in the memory. The vMailBox configuration space can store the address offsets corresponding to the two registers. The server can determine the address offset in the vMailBox configuration space and access the corresponding register according to the address offset.
[0149] For the Punit_MailBox_interface register, the Punit_MailBox_interface register can include 32 bits, and the functions of each bit can be as shown in Table 2:
[0150] Table 2
[0151] 31 30:29 28:16 15:8 7:0 busy_bit Reserved Bit Parameter Subcommand Configuration Command
[0152] As shown in Table 2, bits 0 to 7 are used to store specific commands; bits 8 to 15 are used to store sub-commands; bits 16 to 28 are used to store parameters; bits 29 to 30 are reserved bits; and bit 31 is the busy-bit.
[0153] Optionally, when the busy-bit is 0, it can be used to indicate that the Punit_MailBox_interface register is not in use and the data in the Punit_MailBox_data register is invalid data; when the busy-bit is 1, it can be used to indicate that the Punit_MailBox_interface register is being used and the data in the Punit_MailBox_data register is valid data.
[0154] Optionally, the server can generate configuration operation data, configuration commands, and sub-commands of the configuration commands in response to the user's configuration operation on the current virtual processor. The server can determine whether the busy-bit in the Punit_MailBox_interface register is 0. If it is 1, the server can loop and wait for the busy-bit to be 0; if it is 0, the server can write the configuration operation data into the Punit_MailBox_data register, write the configuration commands and the sub-commands of the configuration commands into the Punit_MailBox_interface register, and update the busy-bit to 1.
[0155] The server can operate on the configuration operation data in the Punit_MailBox_data register, execute the configuration commands in the Punit_MailBox_interface register, as well as the sub-commands of the configuration commands, to generate a command return status and virtual configuration information. The server can store the command return status and error code in the Punit_MailBox_interface register, and can store the virtual configuration information in the Punit_MailBox_data register.
[0156] Optionally, after the execution of the configuration commands and their sub-commands is completed, the busy-bit can be updated to 0 to indicate the completion of the response.
[0157] Optionally, other data of the current virtual processor, etc., can also be stored in the Punit_MailBox_data register and the Punit_MailBox_interface register.
[0158] The command return status can be a normal status or an abnormal status. When the command return status is in the normal status, the virtual configuration information can be read from the Punit_MailBox_data register to obtain the virtual configuration information of the current virtual processor.
[0159] For the vMMIO interface, the vMMIO interface can have corresponding registers. Data such as the address offsets of multiple physical cores and operating parameters can be stored in the registers corresponding to the vMMIO interface.
[0160] For the MailBox interface, the MailBox interface can have multiple corresponding registers; for the MMIO interface, the MMIO interface can have multiple corresponding registers.
[0161] The server can write the data in the registers corresponding to the vMailBox interface to the registers corresponding to the MailBox interface; it can write the data in the registers corresponding to the vMMIO interface to the registers corresponding to the MMIO interface. The server can obtain the virtual configuration information in the registers corresponding to the MailBox interface.
[0162] For example, if the current virtual processor is vCPU0, the virtual configuration information 0 can be obtained in the registers corresponding to the MailBox interface to obtain the virtual configuration information 0 of vCPU0. The virtual configuration information 0 can include that the priority of vCPU0 is 1, the thermal design power is 600W, and the operating frequency is 2000MHz.
[0163] S303. Determine the previous virtual processor corresponding to the target physical core.
[0164] For any target physical core, the target physical core may have a corresponding current structure pointer and a previous structure pointer.
[0165] Optionally, the current structure pointer may be represented by "current_running_vcpu", and the current structure pointer may be used to indicate the current virtual processor.
[0166] Optionally, the previous structure pointer may be represented by "last_running_vcpu", and the previous structure pointer may be used to indicate the previous virtual processor.
[0167] The server may obtain the previous structure pointer corresponding to the target physical core, and determine the previous virtual processor corresponding to the target physical core according to the previous structure pointer, that is, the previous virtual processor running on the target physical core.
[0168] For example, if the target physical core is physical core 0, the previous structure pointer 0 corresponding to physical core 0 may be determined. If the previous structure pointer 0 indicates vCPU2, the previous virtual processor running on physical core 0 may be determined as vCPU2.
[0169] S304. Determine the update status of the current virtual processor.
[0170] In an optional embodiment, the update status of the current virtual processor may be determined in the following manner: obtain the status bit corresponding to the current virtual processor; if the status bit is the first preset value, determine that the update status is the updated status; if the status bit is the second preset value, determine that the update status is the unupdated status.
[0171] Optionally, the dirty bitmap (dirty map) structure may be obtained in the KVM simulation device in the kernel state. The dirtymap structure may include status bits corresponding to multiple virtual processors, and the status bit corresponding to the virtual processor is the status bit corresponding to the virtual configuration information.
[0172] Optionally, the first preset value may be 1, which is used to represent the updated status; the second preset value may be 0, which represents the unupdated status.
[0173] Next, in combination with Figure 4 , the dirty map structure will be described.
[0174] Figure 4 FIG. is a schematic diagram of a dirty map structure provided by an exemplary embodiment of the present application. Please refer to Figure 4, the dirty map structure may include multiple status bits. If the current virtual processor is vCPU0 and the virtual configuration information of vCPU0 is virtual configuration information 0, and in the dirty map structure, the status bit corresponding to virtual configuration information 0 is status bit 0, then vCPU0 corresponds to status bit 0. If status bit 0 is 1, it means that the update status of virtual configuration information 0 is the updated status, that is, the update status of vCPU0 is the updated status; if virtual configuration information 1 is the virtual configuration information corresponding to vCPU1, the status bit corresponding to virtual configuration information 1 is status bit 1, and status bit 1 is 0, it means that the update status of virtual configuration information 1 is the unupdated status, that is, the update status of vCPU1 is the unupdated status; if virtual configuration information 2 is the virtual configuration information corresponding to vCPU2, the status bit corresponding to virtual configuration information 2 is status bit 2, and status bit 2 is 1, it means that the update status of virtual configuration information 2 is the updated status, that is, the update status of vCPU2 is the updated status.
[0175] S305. Determine whether the current virtual processor is the same as the previous virtual processor.
[0176] Optionally, the server can determine whether the current virtual processor is the same as the previous virtual processor. If so, it means that the target physical core has been running the current virtual processor, and step S306 can be executed; if not, it means that the virtual processor running on the target physical core has changed, and step S308 can be executed.
[0177] In an optional embodiment, the following method can be used to determine whether the current virtual processor is the same as the previous virtual processor: obtain the current structure pointer corresponding to the target physical core; obtain the previous structure pointer corresponding to the target physical core; if the current structure pointer is the same as the previous structure pointer, determine that the current virtual processor is the same as the previous virtual processor; if the current structure pointer is different from the previous structure pointer, determine that the current virtual processor is different from the previous virtual processor.
[0178] For example, if the target physical core is physical core 0, the current structure pointer 0 and the previous structure pointer 0 corresponding to physical core 0 can be obtained. If the current structure pointer 0 indicates that the current virtual processor is vCPU0 and the previous structure pointer 0 indicates that the previous virtual processor is vCPU0, it can be determined that the current virtual processor is the same as the previous virtual processor, and step S306 can be executed; if the current structure pointer 0 indicates that the current virtual processor is vCPU0 and the previous structure pointer 0 indicates that the previous virtual processor is vCPU2, it can be determined that the current virtual processor is different from the previous virtual processor, and step S308 can be executed.
[0179] S306. When the update status is the updated status, update the operating parameters according to the virtual configuration information.
[0180] If the target physical core has been running the current virtual processor, the server can further determine the update status of the current virtual processor. If the update status is the updated status, the operating parameters can be updated according to the virtual configuration information; if the update status is the unupdated status, it can be indicated that the user has no operation on the current virtual processor, and there is no need to update the operating parameters of the target physical core.
[0181] For example, if the target physical core is physical core 0 and the current virtual processor is vCPU0, the server can determine the update status of vCPU0, and when the update status is the updated status, update the operating parameters of physical core 0 according to the virtual configuration information 0 of vCPU0. If the virtual configuration information 0 includes that the priority of vCPU0 is 1, the thermal design power consumption is 600W, and the operating frequency is 2000MHz, the operating parameters of physical core 0 can be updated according to the virtual configuration information 0 to: priority is 1, thermal design power consumption is 600W, and operating frequency is 2000MHz.
[0182] S307. Set the status bit to the second preset value.
[0183] After the update status is the updated status and the operating parameters are updated according to the virtual configuration information, the status bit corresponding to the current virtual processor can be set to the second preset value, that is, set to 0.
[0184] S308. Update the operating parameters according to the virtual configuration information.
[0185] If the virtual processor running on the target physical core changes, the operating parameters can be updated according to the virtual configuration information of the current virtual processor.
[0186] For example, if the target physical core is physical core 0 and the current virtual processor is vCPU0, if the virtual configuration information 0 includes that the priority of vCPU0 is 1, the thermal design power consumption is 600W, and the operating frequency is 2000MHz, the operating parameters of physical core 0 can be updated according to the virtual configuration information 0 to: priority is 1, thermal design power consumption is 600W, and operating frequency is 2000MHz.
[0187] S309. When the target physical core stops running the current virtual processor, update the current structure pointer corresponding to the target physical core to null.
[0188] Since the current structure pointer corresponding to the target physical core is used to indicate the current virtual processor running on the target physical core, and the previous structure pointer is used to indicate the previous virtual processor running on the target physical core, when the target physical core stops running the current virtual processor, that is, there is no current virtual processor running on the target physical core, the current structure pointer corresponding to the target physical core can be updated to NULL.
[0189] For example, if the target physical core is physical core 0, and if physical core 0 stops running the current virtual processor, the current structure pointer 0 corresponding to physical core 0 can be updated to NULL, that is, current_running_vcpu = NULL.
[0190] S310. Update the previous structure pointer corresponding to the target physical core to the structure pointer corresponding to the current virtual processor.
[0191] When the target physical core stops running the current virtual processor, the current virtual processor becomes the previous virtual processor running on the target physical core. Therefore, the previous structure pointer corresponding to the target physical core can be updated to the structure pointer corresponding to the current virtual processor.
[0192] For example, if the target physical core is physical core 0, and if the current virtual processor is vCPU0 and the corresponding structure pointer is the vCPU0 pointer, the previous structure pointer 0 of physical core 0 can be updated to the vCPU0 pointer, that is, last_running_vcpu = vcpu0.
[0193] S311. Determine the previous physical core corresponding to the current virtual processor.
[0194] The previous physical core is the physical core that the current virtual processor called before calling the target physical core.
[0195] For example, if the current virtual processor is vCPU0 and the target physical core is physical core 0, before vCPU0 runs on physical core 0, it runs on physical core 1. Then it can be determined that the previous physical core corresponding to the current virtual processor vCPU0 is physical core 1.
[0196] S312. Determine whether there is a virtual processor running on the previous physical core.
[0197] If not, step S313 can be executed.
[0198] For example, if the previous physical core is physical core 1, it can be determined whether there is a virtual processor running on physical core 1.
[0199] S313. Set the running parameters of the previous physical core to the default running parameters.
[0200] If it is determined that no virtual processor is running on the previous physical core, the previous physical core can be reset, that is, the operating parameters of the previous physical core are set to the default operating parameters.
[0201] For example, if the previous physical core is physical core 1 and it is determined that no virtual processor is running on physical core 1, the operating parameters of physical core 1 can be set to the default operating parameters.
[0202] It should be noted that in the technical solution of this application, in steps S301 to S313, only in the stage of loading the current virtual processor, the operating parameters of the target physical core are updated according to the virtual configuration information of the current virtual processor, and the reason for not resetting in the stage when the target physical core stops running the current virtual processor is as follows:
[0203] 1. The main task executed by the target physical core in the server is to run the virtual processor. In other words, the virtual processor is the main user of the resources of the target physical core. Although the target physical core has stopped running the current virtual processor, since the performance of the target physical core has little impact on processing tasks in other servers, as long as the virtual processor running on the target physical core has not been replaced, the operating parameters of the target physical core do not need to be set to the default operating parameters.
[0204] 2. Updating the operating parameters of the target physical core according to the virtual configuration information of the current virtual processor requires a certain amount of overhead. If the operating parameters of the target physical core are restored to the default operating parameters every time the target physical core stops running the current virtual processor, then when the target physical core runs the current virtual processor next time, it is also necessary to update the operating parameters of the target physical core according to the virtual configuration information of the current virtual processor. For about 1000 times of updating operating parameters and restoring default operating parameters per second, the overhead is dozens of milliseconds, and this overhead is unacceptable for the performance of the target physical core.
[0205] In an embodiment of the present application, the server may determine a target physical core corresponding to the current virtual processor and obtain the virtual configuration information of the current virtual processor. The server may determine the previous virtual processor corresponding to the target physical core and may determine the update status of the current virtual processor. The server may determine whether the current virtual processor is the same as the previous virtual processor. If so, when the update status is the updated status, the operating parameters may be updated according to the virtual configuration information, and the status bit may be set to a second preset value. If not, the operating parameters may be updated according to the virtual configuration information. The server may also update the current structure pointer corresponding to the target physical core to null when the target physical core stops running the current virtual processor, and update the previous structure pointer corresponding to the target physical core to the structure pointer corresponding to the current virtual processor. The server may also determine the previous physical core corresponding to the current virtual processor and determine whether there is a virtual processor running on the previous physical core. If not, the operating parameters of the previous physical core may be set to the default operating parameters. Since the virtual processor runs based on the target physical core, updating the operating parameters of the target physical core according to the virtual configuration information can enable the target physical core to have different performances, so as to provide different performances for the virtual processors running based on the target physical core, thereby enabling multiple virtual processors to have differentiated performances, making rational use of multiple virtual processors, and thus improving the overall utilization rate of multiple virtual processors, and further improving the utilization rate of the physical processor.
[0206] Next, based on any of the above embodiments, in combination with Figure 5 , the architecture in the server will be described.
[0207] Figure 5 This is an architecture diagram of a server provided by an exemplary embodiment of the present application. Please refer to Figure 5 , the server may include a user mode, a kernel mode, and a hardware layer.
[0208] The server may run multiple virtual machines in the user mode. Each virtual machine may include multiple virtual processors. For example, virtual machine 0 may include vCPU0-0, vCPU0-1,..., vCPU0-63.
[0209] In the user mode, for any virtual machine, the virtual machine may have a corresponding vISST device, and the vISST device refers to a virtual ISST device. The vISST device may include a vMailBox interface and a vMMIO interface.
[0210] The vISST device may include some data structures for recording the status of the vISST device, which are used for virtual machine hot upgrade, hot migration, etc.
[0211] For example, for virtual machine 0, virtual machine 0 may have a corresponding vISST-0 device. The vISST-0 device may include a vMailBox-0 interface and a vMMIO-0 interface. The vMailBox-0 interface may have corresponding Punit_MailBox_data register and Punit_MailBox_interface register. In the Punit_MailBox_interface register, configuration commands for configuring the current virtual processor in virtual machine 0, as well as sub-commands, etc. may be stored; in the Punit_MailBox_data register, configuration operation data and / or virtual configuration information obtained after executing the configuration commands and sub-commands, that is, the virtual configuration information of the current virtual processor in virtual machine 0, may be stored. The vMMIO-0 interface may have corresponding registers, and data such as address offsets of multiple physical cores and operation parameters may be stored in the registers corresponding to the vMMIO-0 interface. The multiple physical cores include a target physical core.
[0212] In the kernel mode, for each vISST device, there may be a corresponding open-source hardware virtualization technology (Kernel-based Virtual Machine, KVM) simulation device.
[0213] The KVM simulation device may include a MailBox interface and a MMIO interface. The MailBox interface corresponds to the vMailBox interface, and the MMIO interface corresponds to the vMMIO interface. The MailBox interface and the vMMIO interface may respectively have corresponding multiple registers.
[0214] The KVM simulation device and the corresponding vISST device combined together can serve as an overall interface.
[0215] For example, for the vISST-0 device, the vISST-0 device may have a corresponding KVM-0 simulation device. The KVM-0 simulation device may include a MailBox-0 interface and a MMIO-0 interface. Data such as virtual configuration information in the registers corresponding to the vMailBox-0 interface can be obtained through the MailBox-0 interface and stored in the registers corresponding to the MailBox-0 interface; data such as the address offset of the physical core in the registers corresponding to the vMMIO-0 interface can be obtained through the MMIO-0 interface and stored in the MMIO-0 interface.
[0216] In the kernel mode, most of the virtualization operations on the vISST device are implemented, including storing the state of the vISST device, operations on the vISST device, and operation results of the vISST device, etc.
[0217] The server may include multiple physical processors. Each physical processor may include multiple physical cores. For example, physical processor 0 may include physical cores 0-0, 0-1, ……, 0-31.
[0218] Optionally, the server may obtain the virtual configuration information of the current virtual processor and the address offset of the target physical core in the KVM simulation device (i.e., MailBox-0 interface and MMIO-0 interface). The server may find the target physical core according to the address offset and update the operating parameters of the target physical core according to the virtual configuration information. For example, if the current virtual processor is vCPU0 and the corresponding target physical core is physical core 0-0 in physical processor 0, the operating parameters of physical core 0-0 may be updated according to the virtual configuration information of vCPU0.
[0219] In the embodiments of the present application, the server may determine the target physical core corresponding to the current virtual processor, obtain the virtual configuration information of the current virtual processor, and then update the operating parameters of the target physical core according to the virtual configuration information. Since the virtual processor runs based on the target physical core, updating the operating parameters of the target physical core according to the virtual configuration information can enable the target physical core to have different performances, so as to provide different performances for the virtual processors running based on the target physical core, thereby enabling multiple virtual processors to have differentiated performances, making reasonable use of multiple virtual processors, and thus improving the overall utilization rate of multiple virtual processors, and further improving the utilization rate of physical processors.
[0220] Figure 6 The following is a schematic structural diagram of a control device for a processor provided by an exemplary embodiment of the present application. Please refer to Figure 6 , the control device 10 of the processor includes: a first determination module 11, an acquisition module 12, and an update module 13, where
[0221] The first determination module 11 is configured to determine the target physical core corresponding to the current virtual processor, where the current virtual processor is a virtual processor in a virtual machine;
[0222] The acquisition module 12 is configured to acquire the virtual configuration information of the current virtual processor, where the virtual configuration information is generated based on user configuration;
[0223] The update module 13 is configured to update the operating parameters of the target physical core according to the virtual configuration information.
[0224] The control device for a processor provided by the embodiments of the present application may execute the technical solutions shown in the above method embodiments, and its implementation principles and beneficial effects are similar, and will not be described in detail here.
[0225] In a possible implementation, the update module 13 is specifically configured to:
[0226] Determine the previous virtual processor corresponding to the target physical core;
[0227] Determine the update status of the current virtual processor, where the update status is an updated status or an unupdated status;
[0228] Update the operating parameters of the target physical core according to the previous virtual processor, the update status, and the virtual configuration information.
[0229] In a possible implementation, the update module 13 is specifically configured to:
[0230] If the current virtual processor is different from the previous virtual processor, and / or the update status is the updated status, then update the operating parameters of the target physical core according to the virtual configuration information.
[0231] In a possible implementation, the update module 13 is specifically configured to:
[0232] Determine whether the current virtual processor is the same as the previous virtual processor;
[0233] If so, when the update status is the updated status, update the operating parameters according to the virtual configuration information;
[0234] If not, update the operating parameters according to the virtual configuration information.
[0235] In a possible implementation, the update module 13 is specifically configured to:
[0236] Obtain the current structure pointer corresponding to the target physical core, where the current structure pointer is used to indicate the current virtual processor;
[0237] Obtain the previous structure pointer corresponding to the target physical core, where the previous structure pointer is used to indicate the previous virtual processor;
[0238] If the current structure pointer is the same as the previous structure pointer, determine that the current virtual processor is the same as the previous virtual processor;
[0239] If the current structure pointer is different from the previous structure pointer, determine that the current virtual processor is different from the previous virtual processor.
[0240] In a possible implementation, the update module 13 is further configured to:
[0241] When the target physical core stops running the current virtual processor, update the current structure pointer corresponding to the target physical core to null; and,
[0242] Update the previous structure pointer corresponding to the target physical core to the structure pointer corresponding to the current virtual processor.
[0243] In a possible implementation manner, the updating module 13 is configured to:
[0244] Obtain the status bit corresponding to the current virtual processor;
[0245] If the status bit is a first preset value, determine that the update status is the updated status;
[0246] If the status bit is a second preset value, determine that the update status is the non-updated status.
[0247] In a possible implementation manner, the updating module 13 is further configured to:
[0248] Set the status bit to the second preset value.
[0249] The control device of the processor provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, and will not be elaborated here.
[0250] Figure 7 FIG. is a schematic structural diagram of another control device of a processor provided by an exemplary embodiment of the present application. Please refer to Figure 7 , on the basis of the embodiment shown in Figure 6 , the control device 10 of the processor may further include a second determination module 14, a setting module 15, and an operation module 16, where,
[0251] The second determination module 14 is configured to determine the previous physical core corresponding to the current virtual processor, and the previous physical core is the physical core called by the current virtual processor before calling the target physical core;
[0252] The second determination module 14 is further configured to determine whether a virtual processor is running on the previous physical core;
[0253] The setting module 15 is configured to, if not, set the operation parameters of the previous physical core to default operation parameters.
[0254] The control device of the processor provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, and will not be elaborated here.
[0255] In a possible implementation, the virtual machine is provided with an interaction interface and a register; specifically, the obtaining module 12 is configured to:
[0256] Read the virtual configuration information from the register, where the virtual configuration information is written by the virtual machine to the register through the interaction interface.
[0257] In a possible implementation,
[0258] The running module 16 is configured to run the current virtual processor according to the updated running parameters of the target physical core.
[0259] The control device of the processor provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, and will not be elaborated here.
[0260] An exemplary embodiment of the present application provides a schematic structural diagram of a server. Please refer to Figure 8 , the server 20 may include a processor 21 and a memory 22. Exemplarily, the processor 21 and the memory 22 are interconnected with each other through a bus 23.
[0261] The memory 22 stores computer-executable instructions;
[0262] The processor 21 executes the computer-executable instructions stored in the memory 22, so that the processor 21 executes the method shown in the above method embodiments.
[0263] Correspondingly, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the above method embodiments.
[0264] Correspondingly, an embodiment of the present application may further provide a computer program product, including a computer program, and when the computer program is executed by a processor, it can implement the method shown in the above method embodiments.
[0265] Those skilled in the art should understand that the embodiments of the present invention may be provided as a method, a system, or a computer program product. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
[0266] The present invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each flow and / or block of the flowchart illustrations and / or block diagrams, and combinations of flows and / or blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing apparatus create means for implementing the functions specified in the flowchart flow or flows and / or block or blocks. Figure 1 in one flow or more flows and / or blocks Figure 1 or means for implementing the functions specified in one block or more blocks.
[0267] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means that implement the functions specified in the flowchart flow or flows and / or block or blocks. Figure 1 in one flow or more flows and / or blocks Figure 1 or means for implementing the functions specified in one block or more blocks.
[0268] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and / or block or blocks. Figure 1 in one flow or more flows and / or blocks Figure 1 or means for implementing the functions specified in one block or more blocks.
[0269] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0270] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or flash memory. The memory is an example of computer-readable media.
[0271] A computer-readable medium includes both permanent and non-permanent, removable and non-removable media and can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer-readable medium does not include transitory computer-readable media such as modulated data signals and carrier waves.
[0272] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or apparatus comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or apparatus. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising the element.
[0273] The above description is only for the embodiments of the present application and is not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A control method for a processor, characterized in that, Including: Determine the target physical core corresponding to the current virtual processor, where the current virtual processor is a virtual processor in a virtual machine; Obtain the virtual configuration information of the current virtual processor, where the virtual configuration information is generated based on user configuration; Update the operating parameters of the target physical core according to the virtual configuration information.
2. The method according to claim 1, wherein Updating the operating parameters of the target physical core according to the virtual configuration information includes: Determine the previous virtual processor corresponding to the target physical core; Determine the update status of the current virtual processor, where the update status is an updated status or an unupdated status; Update the operating parameters of the target physical core according to the previous virtual processor, the update status, and the virtual configuration information.
3. The method according to claim 2, wherein Updating the operating parameters of the target physical core according to the previous virtual processor, the update status, and the virtual configuration information includes: If the current virtual processor is different from the previous virtual processor, and / or the update status is the updated status, then update the operating parameters of the target physical core according to the virtual configuration information.
4. The method according to claim 3, characterized in that If the current virtual processor is different from the previous virtual processor, and / or the update status is the updated status, then update the operating parameters of the target physical core according to the virtual configuration information, including: Determine whether the current virtual processor is the same as the previous virtual processor; If so, when the update status is the updated status, update the operating parameters according to the virtual configuration information; If not, update the operating parameters according to the virtual configuration information.
5. The method according to claim 4, wherein Determining whether the current virtual processor is the same as the previous virtual processor includes: Obtain the current structure pointer corresponding to the target physical core, where the current structure pointer is used to indicate the current virtual processor; Obtain the previous structure pointer corresponding to the target physical core, where the previous structure pointer is used to indicate the previous virtual processor; If the current structure pointer is the same as the previous structure pointer, then determine that the current virtual processor is the same as the previous virtual processor; If the current structure pointer is different from the previous structure pointer, then determine that the current virtual processor is different from the previous virtual processor.
6. The method according to claim 5, wherein The method further includes: When the target physical core stops running the current virtual processor, update the current structure pointer corresponding to the target physical core to null; and, Update the previous structure pointer corresponding to the target physical core to the structure pointer corresponding to the current virtual processor.
7. The method according to any one of claims 2-6, characterized in that, Determining the update status of the current virtual processor includes: Obtain the status bit corresponding to the current virtual processor; If the status bit is the first preset value, then determine that the update status is the updated status; If the status bit is the second preset value, then determine that the update status is the unupdated status.
8. The method according to claim 7, wherein After the update status is the updated status and the operating parameters are updated according to the virtual configuration information, it further includes: Set the status bit to the second preset value.
9. The method according to any one of claims 2-8, characterized in that After updating the operating parameters of the target physical core according to the previous virtual processor, the updated status, and the virtual configuration information, it further includes: Determine the previous physical core corresponding to the current virtual processor, where the previous physical core is the physical core called by the current virtual processor before calling the target physical core; Determine whether there is a virtual processor running on the previous physical core; If not, set the operating parameters of the previous physical core to default operating parameters.
10. The method according to any one of claims 1-9, characterized in that, The virtual machine is provided with an interaction interface and a register; obtaining the virtual configuration information of the current virtual processor includes: Read the virtual configuration information in the register, where the virtual configuration information is written by the virtual machine to the register through the interaction interface.
11. The method according to any one of claims 1 to 10, characterized in that, The method further includes: Run the current virtual processor according to the updated operating parameters of the target physical core.
12. A control device for a processor, characterized in that, It includes: A first determination module, an acquisition module, and an update module, where The first determination module is used to determine the target physical core corresponding to the current virtual processor, and the current virtual processor is a virtual processor in the virtual machine; The acquisition module is used to acquire the virtual configuration information of the current virtual processor, and the virtual configuration information is generated based on user configuration; The update module is used to update the operating parameters of the target physical core according to the virtual configuration information.
13. A server, characterized in that, It includes: At least one processor; And A memory communicatively connected to the at least one processor; Wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the server to execute the method according to any one of claims 1-11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1-11 is implemented.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the method according to any one of claims 1-11 is implemented.