Power adjustment method and device

By using BIOS to respond to interrupt requests in the server, obtaining CPU occupancy in real time and performing power adjustment, the problem of CPU frequency adjustment time and lag in the prior art is solved, and the timely matching of CPU frequency and occupancy is achieved and the energy-saving effect is achieved.

CN119248096APending Publication Date: 2025-01-03XINHUASAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411347150.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

When the prior art adjusts the server CPU frequency to achieve energy saving, there are problems such as time-consuming, labor-intensive and frequency adjustment lag, which is difficult to meet the rapid changes in business needs.

Method used

The BIOS in the server responds to interrupt requests, obtains the current CPU share in real time, and adjusts the power according to the optimal output capability and the target maximum power, realizing timely matching of the CPU operating frequency, and adjusting it using coarse granularity and fine-tuning.

Benefits of technology

It realizes the timely matching of CPU operating frequency and shareholding, quickly responds to business needs, and achieves energy-saving effects, improving the timeliness and accuracy of power adjustments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248096A_ABST
    Figure CN119248096A_ABST
Patent Text Reader

Abstract

The invention provides a power adjustment method and device which are applied to a server. The method comprises the following steps: responding to an interrupt request through a BIOS (Basic Input / Output System) in a server, and obtaining the current occupancy rate of a CPU (Central Processing Unit) in the server in a detection period; obtaining the optimal output capability of the CPU under the current working frequency; if the difference between the current occupancy and the optimal output capability exceeds a set difference, obtaining a target optimal output capability similar to the current occupancy; obtaining a target maximum power corresponding to the target optimal output capability; adjusting the current power of the server to the target maximum power; and if the difference between the current occupancy and the optimal output capability does not exceed the set difference, performing fine tuning processing on the current power of the server according to the set step so as to adjust the working frequency of the CPU by adjusting the current power of the server. Therefore, the working frequency of the CPU is adjusted through a power adjusting method, and the energy-saving effect can also be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a power adjustment method and device. Background Art

[0002] Under the background of the national "dual carbon" policy, the country vigorously advocates energy conservation and environmental protection. As a major energy consumer, servers have received more and more attention in recent years in terms of energy conservation specifications. Energy conservation is also a hard indicator that comprehensively reflects the overall solutions of various server manufacturers. Common solutions include liquid cooling solutions and whole machine power capping. As one of the three core components of the server, the CPU provides overall computing power while also consuming a lot of energy. Therefore, it is crucial to achieve energy conservation on the CPU on the server.

[0003] In actual applications, the lower the overall power consumption of the CPU output, the better. Instead, it depends on the higher computing performance provided per unit power consumption, which can not only meet business needs but also achieve energy-saving effects. The current solution to achieve CPU energy saving is mainly to dynamically adjust the CPU frequency. In this method, the baseboard management controller (Baseboard Management Controller, BMC) in the server obtains the current CPU non-idle occupancy in real time through the management engine (Management Engine, ME) to set different P-state levels to achieve energy-saving effects. For example, the P-state level can have 16 levels from 0 to 15. The lower the P-state level, the higher the CPU frequency. As the P-state level is adjusted, the maximum output capacity of the CPU is also adjusted accordingly. Refer to Figure 1 As shown, based on this, the purpose of CPU energy saving can be achieved by adjusting the P-state level. However, in the above method, the CPU occupancy rate corresponding to different P-state values ​​varies with the CPU type and configuration. In order to accurately obtain the CPU occupancy rate, a large amount of data measurement is required, which will consume a lot of time and manpower. In addition, since BMC obtains the CPU occupancy rate from the ME out-of-band and then sets the CPU frequency through P-state, this method has a certain lag. If the business frequency of the system changes frequently, it is likely that the final adjusted CPU operating frequency will not meet the actual needs. Summary of the invention

[0004] In view of this, the present application provides a power adjustment method and device for adjusting the CPU operating frequency while achieving energy saving effect.

[0005] Specifically, the present application is implemented through the following technical solutions:

[0006] According to a first aspect of the present application, a power adjustment method is provided, which is applied to a server, and the method includes:

[0007] Obtaining the current CPU occupancy rate of the server during the detection cycle by responding to an interrupt request by a basic input and output system BIOS in the server;

[0008] Obtaining the optimal output capacity of the CPU at the current operating frequency;

[0009] If the gap between the current occupancy rate and the optimal output capacity exceeds a set gap, a target optimal output capacity close to the current occupancy rate is obtained;

[0010] Obtaining a target maximum power corresponding to the target optimal output capacity;

[0011] adjusting the current power of the server to the target maximum power, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU;

[0012] If the gap between the current occupancy rate and the optimal output capacity does not exceed the set gap, the current power of the server is fine-tuned according to the set step, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU.

[0013] According to a second aspect of the present application, a power adjustment device is provided, which is applied to a server, and the device includes:

[0014] An obtaining unit, used to respond to the interrupt request through a basic input and output system BIOS in the server, and obtain the current occupancy rate of the CPU in the server during the detection cycle;

[0015] A second obtaining unit is used to obtain the optimal output capacity of the CPU at the current operating frequency;

[0016] a third obtaining unit, configured to obtain a target optimal output capacity close to the current occupancy rate if the difference between the current occupancy rate and the optimal output capacity exceeds a set difference;

[0017] A fourth obtaining unit, configured to obtain a target maximum power corresponding to the target optimal output capacity;

[0018] an adjusting unit, configured to adjust the current power of the server to the target maximum power, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU;

[0019] The adjustment unit is further used to fine-tune the current power of the server according to a set step if the gap between the current occupancy rate and the optimal output capacity does not exceed a set gap, so as to adjust the operating frequency of the CPU by adjusting the current power of the server so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU.

[0020] According to the third aspect of the present application, an electronic device is provided, including a processor and a machine-readable storage medium, the machine-readable storage medium storing a computer program that can be executed by the processor, and the processor is prompted by the computer program to execute the method provided in the first aspect of the embodiment of the present application.

[0021] According to the fourth aspect of the present application, a machine-readable storage medium is provided, which stores a computer program. When called and executed by a processor, the computer program prompts the processor to execute the method provided in the first aspect of the embodiment of the present application.

[0022] Beneficial effects of the embodiments of the present application:

[0023] In the power adjustment method and device provided in the embodiment of the present application, the basic input and output system BIOS in the server responds to the interrupt request and obtains the current occupancy rate of the CPU in the server within the detection cycle; obtains the optimal output capacity under the current operating frequency of the CPU; if the gap between the current occupancy rate and the optimal output capacity exceeds the set gap, obtains the target optimal output capacity close to the current occupancy rate; obtains the target maximum power corresponding to the target optimal output capacity; adjusts the current power of the server to the target maximum power, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU; if the gap between the current occupancy rate and the optimal output capacity does not exceed the set gap, fine-tunes the current power of the server according to the set step, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU.

[0024] By using interrupts to adjust power, the hardware interrupt has a high priority, so the power adjustment is timely, which ensures the timeliness of the adjustment of the working frequency based on the power adjustment. In addition, two adjustment methods, coarse-grained adjustment and fine-tuning, are proposed for power adjustment. The coarse-grained adjustment method can achieve rapid power adjustment under the premise of a large gap, so that the working frequency can converge quickly to better meet the actual business needs and achieve the purpose of energy saving; while the fine-tuning method is implemented under the premise of a small gap. Through small adjustments, the adjusted working frequency can better meet the actual business needs and also achieve the purpose of energy saving. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 It provides a schematic diagram of the maximum external output capability of the CPU measured at different P-state levels;

[0026] Figure 2 It is a flowchart of a power adjustment method provided in an embodiment of the present application;

[0027] Figure 3 is a schematic diagram of a structure of a register for power adjustment provided in an embodiment of the present application;

[0028] Figure 4 is a structural schematic diagram of a power adjustment device provided in an embodiment of the present application;

[0029] Figure 5 It is a hardware structure diagram of an electronic device implementing a power adjustment method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application.

[0031] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more corresponding listed items.

[0032] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0033] Before introducing this application, the technical terms involved in this application are introduced first:

[0034] 1. P-state is the CPU operating frequency level. The lower the level, the higher the frequency and the greater the power consumption.

[0035] 2. Baseboard Management Controller (BMC) is out-of-band management software that has the ability to monitor the server as a whole, remotely control it, and issue alarms.

[0036] 3. Basic Input Output System (BIOS): performs necessary initialization of the server's hardware resources in the post stage and provides abstract hardware resources for the upper-level operating system and application software.

[0037] The power adjustment method provided in this application is described in detail below.

[0038] See also Figure 2 , Figure 2 This is a flow chart of a power adjustment method provided by the present application. The method can be applied to a server. When the server implements the method, the following steps can be included:

[0039] Step 201: respond to an interrupt request through the basic input and output system BIOS in the server, and obtain the current CPU occupancy rate in the server during this detection cycle.

[0040] In this step, the interrupt request is triggered by the BMC in the server according to the detection cycle, that is, the BMC will set a detection cycle, and when the detection cycle arrives, it will trigger an interrupt request to the BIOS to start power adjustment in the detection cycle.

[0041] Specifically, the BMC is connected to the south bridge chip (Platform Controller Hub, PCH) to periodically trigger external hardware interrupts through the GPIO pins connected to the PCH to notify the BIOS of the interrupt request, so that the BIOS can respond to the external interrupt sent by the BMC in a timely manner. Since the external hardware interrupt has a very high priority, the BIOS will respond to the interrupt request in a timely manner, and since the external hardware interrupt is used, the overall performance of the CPU is also relatively small.

[0042] After responding to the interrupt request, the BIOS may start to implement power adjustment in this detection cycle, that is, calculate the current occupancy rate of the CPU in the server in this detection cycle, which may be understood as the overall occupancy rate of the CPU in the server.

[0043] Optionally, this embodiment proposes that the current occupancy rate of the CPU in the server during the detection cycle can be obtained according to the following process: calculate the occupancy rate of each logical core included in each CPU in the server; calculate the occupancy rate of each CPU based on the occupancy rate of each logical core of each CPU; and determine the average occupancy rate of each CPU as the current occupancy rate.

[0044] Specifically, we can take the example that the server includes M CPUs, and each CPU includes N logical cores. It is worth noting that the number of CPU cores (N) corresponding to different CPUs may be different, which can be determined according to actual conditions. On this basis, the i-th CPU includes j logical cores, and the occupancy rate of the i-th CPU can be expressed as: Then the current CPU occupancy rate in the above server can be expressed as:

[0045] Step 202: Obtain the optimal output capacity of the CPU at the current operating frequency.

[0046] In this step, in order to achieve energy saving effect and adapt the current operating frequency of the CPU to the actual business needs of the server, this embodiment proposes to obtain the current operating frequency of the CPU. Then, based on the corresponding relationship between each operating frequency and the optimal output capacity, the optimal output capacity corresponding to the current operating frequency of the CPU is obtained.

[0047] Specifically, the above correspondence is sent by the BMC in the server to the BIOS by carrying it in the configuration information. Optionally, this embodiment proposes that step 202 can be performed according to the following process: in the initialization stage, receiving the configuration information sent by the baseboard management controller BMC in the server, the configuration information includes the correspondence between the CPU operating frequency, maximum power and optimal output capacity; in the operation stage, based on the configuration information, obtaining the optimal output capacity corresponding to the current operating frequency of the CPU;

[0048] Specifically, since the maximum power output of different CPUs is different, and the maximum power output of different CPU operating frequencies is also different, the corresponding relationship between the CPU operating frequency and the maximum power can be statistically obtained through a large number of tests, and the corresponding relationship can be referred to as shown in the following Table 1. It should be noted that Table 1 is only an example and does not constitute a specific limitation on the values ​​of the CPU operating frequency, maximum power, and optimal output capacity.

[0049] Table 1

[0050]

[0051] It should be noted that the above configuration information may also include a parameter for the management engine (ME) to obtain the maximum occupancy rate, and the above maximum occupancy rate refers to the non-idle proportion of the CPU at a specific frequency, which is the same as the value trend of the utilization rate obtained under the in-band operating system. The corresponding optimal output capacity is 90% of the maximum output capacity under the current specific frequency. The optimal output capacity is obtained at this time. That is to say, the above optimal output capacity is determined by the maximum occupancy rate obtained by the above ME. For example, when the CPU is expected to run at 90% of the optimal output capacity, the optimal output capacity corresponding to each operating frequency in Table 1 is 90% of the corresponding maximum occupancy rate at the operating frequency.

[0052] On this basis, when the BIOS obtains the above configuration information in the initialization phase, when executing the power adjustment process in the runtime phase, after obtaining the current operating frequency of the CPU, the optimal output capacity corresponding to the current operating frequency can be obtained based on Table 1. For example, if the current operating frequency of the CPU is 2000MHz, the optimal output capacity under the operating frequency can be obtained as 67.5%.

[0053] Step 203: If the gap between the current occupancy rate and the optimal output capacity exceeds a set gap, a target optimal output capacity close to the current occupancy rate is obtained.

[0054] In this step, after obtaining the optimal output capacity under the current operating frequency, the current CPU occupancy rate obtained in step 201 can be compared with the optimal output capacity. If it is found that the current occupancy rate is significantly different from the optimal output capacity, that is, it exceeds the set gap, it indicates that the current occupancy rate is seriously inconsistent with the optimal output capacity. Therefore, the power adjustment method can be used to match the subsequent occupancy rate with the optimal output capacity, and then the adjusted CPU operating frequency is matched with the CPU occupancy rate to achieve energy saving. Optionally, the specific value of the above-mentioned set gap can be configured according to actual conditions, and the present embodiment does not specifically limit its value. For example, the above-mentioned set gap can be about 5%, etc.

[0055] When power adjustment is performed, the target optimal output capacity that is close to the current occupancy rate will be obtained first in this step. Specifically, when obtaining the above-mentioned target optimal output capacity, it can also be obtained based on the above-mentioned configuration information. Specifically, it can also be explained with reference to Table 1. When obtaining the target optimal output capacity, the target optimal output capacity must meet the following conditions: close to the above-mentioned current occupancy rate. In order to better understand the above conditions, the current occupancy rate of 60% can be used as an example. Based on Table 1, it can be seen that the optimal output capacities in Table 1 that are close to the current occupancy rate of 60% are 61.7% and 58.2%. Since 61.7% is closer to 60%, the target optimal output capacity can be determined as 61.7%, and so on.

[0056] For the convenience of description, the target optimal output capacity of 61.7% is used as an example for explanation.

[0057] Optionally, the target optimal output capacity needs to meet the following conditions: it is close to the current occupancy rate and is not limited to the current occupancy rate. It can be seen that the above 58.2% is less than 60%, so the target optimal output capacity can be determined as 61.7%.

[0058] Step 204: Obtain a target maximum power corresponding to the target optimal output capacity.

[0059] In this step, after obtaining the target optimal output capacity, when obtaining the above-mentioned target maximum power, it can be implemented according to the following process: in the operation stage, based on the configuration information, the target maximum power corresponding to the target optimal output capacity is obtained.

[0060] Specifically, taking the current occupancy rate of 60% and combining it with Table 1 as an example, after obtaining the target optimal output capacity, the maximum power corresponding to the target optimal output capacity can be obtained according to the correspondence between the maximum power and the optimal output capacity shown in Table 1, that is, the above-mentioned target maximum power. It can be seen from Table 1 that the maximum power corresponding to the target optimal output capacity is 260w. Based on this, the target maximum power is obtained.

[0061] Step 205: Adjust the current power of the server to the target maximum power, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU.

[0062] In this step, after obtaining the target maximum power, coarse-grained power adjustment can be performed, that is, the current power is set to the target maximum power, and the power adjustment can be achieved. Since the power is adjusted, the CPU operating frequency will also be affected, that is, the CPU operating frequency will also be adjusted accordingly. Therefore, the CPU operating frequency can be adjusted by adjusting the power, so that the adjusted CPU operating frequency can be adapted to the CPU occupancy rate.

[0063] In order to better understand this embodiment, the current operating frequency of 2200MHz is used as an example for explanation. When the current CPU occupancy rate calculated within this detection cycle is 60%, it indicates that the current server only needs the CPU occupancy rate to reach 60% to meet business needs when processing business. Based on Table 1, it can be seen that the optimal output capacity when the operating frequency is 2200MHz can reach 75.6%. In other words, the current CPU operating frequency is too high, there is a certain waste of processing resources, and the power consumption is also relatively large at this time. Therefore, in order to achieve energy saving while meeting business needs, the above-mentioned power adjustment method can be implemented to meet the above needs. That is, based on the above description, when the current occupancy rate is 60%, according to Figure 2 The maximum power determined by the process is 260w. In order to achieve fast convergence, the power consumption wall can be set directly, that is, the current power is adjusted from 300w (the maximum power corresponding to the operating frequency of 2200) to the above-mentioned maximum power of 260w, thereby achieving rapid adjustment of power. In addition, since the power is adjusted quickly, the CPU operating frequency will also be adjusted accordingly, and the optimal output capacity of the adjusted operating frequency can be adapted to the current occupancy rate of the CPU. Therefore, the adjusted operating frequency can also be adapted to the current occupancy rate of the CPU, that is, business needs can be met. At the same time, since the power is reduced, the energy-saving effect is achieved while meeting business needs.

[0064] In addition, the current CPU occupancy rate is 60% as an example for explanation. If the current operating frequency is 1300, based on Table 1, it can be known that the current optimal output capacity is 44.8%. It can be concluded that the current occupancy rate is far from the optimal output capacity. Therefore, it can be concluded that the current operating frequency is difficult to meet business needs. Therefore, in order to better meet business needs and not increase energy consumption too much to meet the goal of energy saving, refer to the above description and adjust the current power from 210w (the maximum power corresponding to the operating frequency of 1300) to the above maximum power of 260w, thereby achieving rapid adjustment of power. In addition, since the power is adjusted rapidly, the CPU operating frequency will be adjusted accordingly, and the optimal output capacity of the adjusted operating frequency can be adapted to the current CPU occupancy rate. Therefore, the adaptation of the adjusted operating frequency to the current CPU occupancy rate can also be achieved, that is, business needs are met. At the same time, although the power is increased, it can better meet business needs while achieving energy saving effects.

[0065] It should be noted that if the current operating frequency is the maximum operating frequency of the CPU, such as 2600w in Table 1, and the current occupancy rate is higher than 89.0%, if the maximum power of the highest operating frequency of the CPU has been reached, then the current power is kept unchanged, that is, the current operating frequency is kept unchanged; if the maximum power has not been reached, the current power can be increased in a step-by-step manner to better meet actual business needs. Similarly, if the current operating frequency is the minimum operating frequency of the CPU, if the current occupancy rate is lower than the optimal output capacity corresponding to the minimum operating frequency, then if the power at this time is the minimum and cannot be reduced any further, then the current power can be kept unchanged, that is, the current operating frequency is kept unchanged. If the power at this time is not the minimum, the current power can be reduced in a step-by-step manner to meet actual business needs.

[0066] Step 206: If the gap between the current occupancy rate and the optimal output capacity does not exceed the set gap, the current power of the server is fine-tuned according to the set step, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU.

[0067] In this step, when the current occupancy rate is compared and identified to be not much different from the optimal output capacity, the current power is fine-tuned, so as to meet the requirement of matching the adjusted CPU operating frequency with the CPU occupancy rate on the basis of power fine-tuning, and also meet the business needs and energy saving purposes. In order to better understand this embodiment, the current occupancy rate is 60% as an example for explanation. If the current operating frequency is 1700, the optimal output capacity corresponding to the operating frequency is 58.2%. It can be seen that the optimal output capacity is very close to the current occupancy rate, which is less than the set difference of 5%. Then the current power can be adjusted according to the set step. For example, the above-mentioned set step is 2W. Since the current optimal output capacity is less than 58.2%, the power needs to be increased to meet the above-mentioned current occupancy rate of 60%. Therefore, the current power can be increased by 2W to obtain the adjusted power. In this way, since the adjusted power is increased, it can meet the actual business needs, and the power is fine-tuned, so the energy saving purpose can also be achieved.

[0068] In the implementation of the power adjustment method provided in the present application, the basic input and output system BIOS in the server responds to the interrupt request and obtains the current occupancy rate of the CPU in the server within the detection cycle; obtains the optimal output capacity under the current operating frequency of the CPU; if the gap between the current occupancy rate and the optimal output capacity exceeds the set gap, obtains the target optimal output capacity close to the current occupancy rate; obtains the target maximum power corresponding to the target optimal output capacity; adjusts the current power of the server to the target maximum power, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU; if the gap between the current occupancy rate and the optimal output capacity does not exceed the set gap, fine-tunes the current power of the server according to the set step, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU.

[0069] The above method is used to adjust the power by using an interrupt. Since the hardware interrupt has a high priority, the power adjustment is timely, thereby ensuring the timeliness of the adjustment of the working frequency based on the power adjustment. In addition, two adjustment methods, coarse-grained adjustment and fine-tuning, are proposed when adjusting the power. The coarse-grained adjustment method can achieve rapid adjustment of power under the premise of a large gap, thereby enabling the working frequency to converge quickly to better meet actual business needs and achieve the purpose of energy saving; while the fine-tuning method is implemented under the premise of a small gap. Through small adjustments, the adjusted working frequency can better meet actual business needs and also achieve the purpose of energy saving.

[0070] Optionally, in this embodiment, after executing step 205, the following method is also provided: wait for a set time, and execute again the step of obtaining the current occupancy rate of the CPU in the server during this detection cycle until the adjusted CPU operating frequency matches the occupancy rate of the CPU.

[0071] Specifically, after adjusting the current power to the above-mentioned target maximum power, that is, after performing a coarse-grained power adjustment, you can wait for a set time, which can be less than the remaining time of this detection cycle. When waiting for the set time to be reached, you can calculate the current occupancy rate again, and then judge whether the adjusted working frequency is compatible with the occupancy rate obtained again, that is, whether the optimal output capacity corresponding to the adjusted working frequency is compatible with the occupancy rate obtained again. If the optimal output capacity is compatible with the occupancy rate obtained again, the process ends; if it is not compatible, but the difference is relatively small, the power can be fine-tuned according to the fine-tuning process in step 206, so that the adjusted CPU working frequency matches the occupancy rate of the CPU. In this way, on the basis of coarse-grained adjustment, it can be judged again to confirm whether fine-tuning is needed to meet business needs and energy saving purposes.

[0072] Optionally, after implementing step 205 or step 206, this embodiment also provides the following process: monitoring and processing the power consumption of the CPU at the adjusted operating frequency to obtain the maximum power at the adjusted operating frequency; synchronizing the correspondence between the adjusted operating frequency and the obtained maximum power to the BMC, so that the BMC adjusts the configuration information based on the received correspondence.

[0073] Specifically, in actual applications, during the running stage, the BIOS may not be able to save all the configuration information. Therefore, after the BIOS applies the configuration information, after the power adjustment is performed, there may be a difference in the maximum power corresponding to the operating frequency. Therefore, the correspondence between the measured maximum power and the operating frequency can be synchronized to the BMC. Specifically, the BIOS can synchronize the above correspondence to the BMC through the IPMI command of the BT or KCS channel, so that the BMC can update the above correspondence in the locally recorded configuration information to ensure that after the next startup, the BMC will send the latest configuration information to the BIOS, so that the BIOS can more accurately obtain the configuration information including the above correspondence, and then more accurately adjust the power.

[0074] Optionally, in this embodiment, the above configuration information may further include a P-state, as shown in Table 2. It should be noted that Table 2 is only an example and does not constitute a specific limitation on the specific corresponding relationship.

[0075] Table 2

[0076]

[0077] Based on what is shown in Table 2, it is convenient for operation and maintenance personnel to know the relationship between the current power adjustment status and the P-state level.

[0078] Optionally, when executing step 205 or step 206, it can be implemented according to the following process: configuring the packet power consumption limit bit in the register used for power consumption limitation to an adjusted power, wherein the adjusted power is the target maximum power, or the power obtained after fine-tuning; configuring the time window power limit bit in the register to a set duration, wherein the set duration is the detection period.

[0079] Specifically, when power adjustment is performed, it can be implemented based on the RAPL (Running Average Power Limit) interface, which provides a mechanism to dynamically enforce power consumption limits. For example, the RAPL interface provides a set of registers for limiting power, which include packet power limit bits and time window power limit bits, see Figure 3 As shown, the above settings are performed on the packet power consumption limit bit and the time window power limit bit respectively to complete the power adjustment in this detection cycle.

[0080] Based on the same inventive concept, the present application also provides a power adjustment device corresponding to the above power adjustment method. The implementation of the power adjustment device can refer to the above description of the power adjustment method, which will not be discussed here one by one.

[0081] See also Figure 4 , Figure 4 A power adjustment device provided by an exemplary embodiment of the present application is applied to a server, and the device includes:

[0082] The first obtaining unit 401 is used to respond to the interrupt request through the basic input and output system BIOS in the server and obtain the current CPU occupancy rate in the server during the detection cycle;

[0083] The second obtaining unit 402 is used to obtain the optimal output capacity of the CPU at the current operating frequency;

[0084] The third obtaining unit 403 is configured to obtain a target optimal output capacity close to the current occupancy rate if the difference between the current occupancy rate and the optimal output capacity exceeds a set difference;

[0085] A fourth obtaining unit 404 is used to obtain a target maximum power corresponding to the target optimal output capacity;

[0086] An adjusting unit 405 is configured to adjust the current power of the server to the target maximum power, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU;

[0087] The adjustment unit 405 is also used to fine-tune the current power of the server according to a set step if the gap between the current occupancy rate and the optimal output capacity does not exceed a set gap, so as to adjust the operating frequency of the CPU by adjusting the current power of the server so that the adjusted CPU operating frequency matches the occupancy rate of the CPU.

[0088] Thus, by using the interrupt method to adjust the power, the hardware interrupt has a high priority, so the power adjustment is timely, thereby ensuring the timeliness of the adjustment of the working frequency based on the power adjustment. In addition, two adjustment methods, coarse-grained adjustment and fine-tuning, are proposed when adjusting the power. The coarse-grained adjustment method can achieve rapid adjustment of power under the premise of a large gap, so that the working frequency can converge quickly to better meet the actual business needs and achieve the purpose of energy saving; while the fine-tuning method is implemented under the premise of a small gap, and through small adjustments, the adjusted working frequency can better meet the actual business needs and also achieve the purpose of energy saving.

[0089] Optionally, in this embodiment, the above-mentioned first obtaining unit 401 is also used to wait for a set time after the adjustment unit adjusts the current power of the server to the target maximum power, and again execute the step of obtaining the current occupancy rate of the CPU in the server during this detection cycle until the adjusted CPU operating frequency matches the occupancy rate of the CPU.

[0090] Optionally, based on any of the above embodiments, in this embodiment, the above second obtaining unit 402 is specifically used to receive configuration information sent by a baseboard management controller BMC in the server during the initialization phase, wherein the configuration information includes a correspondence between a CPU operating frequency, a maximum power and an optimal output capacity; during the operation phase, obtain the optimal output capacity corresponding to the current operating frequency of the CPU based on the configuration information;

[0091] Similarly, the fourth obtaining unit 404 is specifically configured to obtain, during the operation phase, the target maximum power corresponding to the target optimal output capacity based on the configuration information.

[0092] Furthermore, the power adjustment device provided in this embodiment may further include:

[0093] a fifth obtaining unit (not shown in the figure), configured to adjust the current power of the server to the target maximum power in the adjusting unit, or, after fine-tuning the current power of the server according to a set step, monitor the power consumption of the CPU at the adjusted operating frequency to obtain the maximum power at the adjusted operating frequency;

[0094] A synchronization unit (not shown in the figure) is used to synchronize the corresponding relationship between the adjusted operating frequency and the obtained maximum power to the BMC, so that the BMC adjusts the configuration information based on the received corresponding relationship.

[0095] Optionally, in this embodiment, the above-mentioned first obtaining unit 401 is specifically used to calculate the occupancy of each logical core included in each CPU in the server; calculate the occupancy of each CPU based on the occupancy of each logical core of each CPU; and determine the average occupancy of each CPU as the current occupancy.

[0096] Optionally, based on any of the above embodiments, in this embodiment, the above-mentioned adjustment unit 405 is specifically used to configure the packet power consumption limit bit in the register used for power consumption limitation to an adjusted power, wherein the adjusted power is the target maximum power, or the power obtained after fine-tuning; and configure the time window power limit bit in the register to a set duration, wherein the set duration is the detection period.

[0097] Based on the same inventive concept, an embodiment of the present application provides an electronic device, which may be the above-mentioned server. Figure 5 As shown, the electronic device may include a processor 501 and a machine-readable storage medium 502, the machine-readable storage medium 502 stores a computer program that can be executed by the processor 501, and the processor 501 is prompted by the computer program to execute the power adjustment method provided in any embodiment of the present application. In addition, the electronic device also includes a communication interface 503 and a communication bus 504, wherein the processor 501, the communication interface 503, and the machine-readable storage medium 502 communicate with each other through the communication bus 504.

[0098] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0099] The communication interface is used for communication between the above electronic device and other devices.

[0100] The machine-readable storage medium 502 may be a memory, which may include a random access memory (RAM), a DDR SRAM (Double Data Rate Synchronous Dynamic Random Access Memory), or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor.

[0101] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0102] In addition, this embodiment also provides a machine-readable storage medium, which stores a computer program. When called and executed by a processor, the computer program prompts the processor to execute the method provided by any embodiment of the present application.

[0103] As for the electronic device and machine-readable storage medium embodiments, since the method contents involved are basically similar to the aforementioned method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0104] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0105] The implementation process of the functions and effects of each unit / module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0106] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are merely schematic, wherein the units / modules described as separate components may or may not be physically separated, and the components displayed as units / modules may or may not be physical units / modules, that is, they may be located in one place, or they may be distributed on multiple network units / modules. Some or all of the units / modules may be selected according to actual needs to achieve the purpose of the present application. A person of ordinary skill in the art can understand and implement it without creative work.

[0107] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A power adjustment method, characterized in that: Applied in a server, the method comprises: Responding to the interrupt request through the basic input and output system BIOS in the server, and obtaining the current occupancy rate of the CPU in the server during the detection cycle; Obtaining the optimal output capacity of the CPU at the current operating frequency; If the gap between the current occupancy rate and the optimal output capacity exceeds a set gap, a target optimal output capacity close to the current occupancy rate is obtained; Obtaining a target maximum power corresponding to the target optimal output capacity; adjusting the current power of the server to the target maximum power, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU; If the gap between the current occupancy rate and the optimal output capacity does not exceed the set gap, the current power of the server is fine-tuned according to the set step, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU.

2. The method according to claim 1, characterized in that After adjusting the current power of the server to the target maximum power, the method further includes: Wait for a set time, and execute again the step of obtaining the current CPU occupancy rate in the server during the detection cycle, until the adjusted CPU operating frequency matches the CPU occupancy rate.

3. The method according to claim 1, characterized in that Obtaining the optimal output capability of the CPU at the current operating frequency, including: In the initialization phase, configuration information sent by a baseboard management controller (BMC) in the server is received, wherein the configuration information includes a corresponding relationship between a CPU operating frequency, a maximum power and an optimal output capacity; In the operation phase, based on the configuration information, the optimal output capacity corresponding to the current operating frequency of the CPU is obtained; Obtaining a target maximum power corresponding to the target optimal output capacity includes: During the operation phase, based on the configuration information, a target maximum power corresponding to the target optimal output capacity is obtained.

4. The method according to claim 3, characterized in that After adjusting the current power of the server to the target maximum power, or after fine-tuning the current power of the server according to a set step, the method further includes: Monitoring the power consumption of the CPU at the adjusted operating frequency to obtain the maximum power at the adjusted operating frequency; The corresponding relationship between the adjusted operating frequency and the obtained maximum power is synchronized to the BMC, so that the BMC adjusts the configuration information based on the received corresponding relationship.

5. The method according to claim 3, characterized in that: Get the current CPU usage of the server during the detection period, including: Calculate the occupancy rate of each logical core included in each CPU in the server; Calculate the occupancy of each CPU based on the occupancy of each logical core of each CPU; An average value of the occupancy rates of the CPUs is determined as the current occupancy rate.

6. The method according to claim 1, characterized in that The current power of the server is adjusted to the target maximum power, or the current power of the server is fine-tuned according to a set step, including: configuring the packet power consumption limit bit in the register for power consumption limit to the adjusted power, wherein the adjusted power is the target maximum power, or the power obtained after fine-tuning; The time window power limit bit in the register is configured to a set duration, where the set duration is the detection period.

7. A power adjustment device, characterized in that: Applied in a server, the device comprises: A first obtaining unit is used to respond to the interrupt request through the basic input and output system BIOS in the server, and obtain the current occupancy rate of the CPU in the server during the detection cycle; A second obtaining unit, used to obtain the optimal output capacity of the CPU at the current operating frequency; a third obtaining unit, configured to obtain a target optimal output capacity close to the current occupancy rate if the difference between the current occupancy rate and the optimal output capacity exceeds a set difference; A fourth obtaining unit, configured to obtain a target maximum power corresponding to the target optimal output capacity; an adjusting unit, configured to adjust the current power of the server to the target maximum power, so as to adjust the operating frequency of the CPU by adjusting the current power of the server, so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU; The adjustment unit is further used to fine-tune the current power of the server according to a set step if the gap between the current occupancy rate and the optimal output capacity does not exceed a set gap, so as to adjust the operating frequency of the CPU by adjusting the current power of the server so that the adjusted operating frequency of the CPU matches the occupancy rate of the CPU.

8. The device according to claim 7, characterized in that The first obtaining unit is also used to wait for a set time after the adjustment unit adjusts the current power of the server to the target maximum power, and again execute the step of obtaining the current occupancy rate of the CPU in the server during this detection cycle until the adjusted CPU operating frequency matches the occupancy rate of the CPU.

9. The device according to claim 7, characterized in that The second obtaining unit is specifically used to receive configuration information sent by a baseboard management controller BMC in the server during the initialization phase, wherein the configuration information includes a corresponding relationship between a CPU operating frequency, a maximum power and an optimal output capacity; In the operation phase, based on the configuration information, the optimal output capacity corresponding to the current operating frequency of the CPU is obtained; The fourth obtaining unit is specifically configured to obtain, during an operation phase, a target maximum power corresponding to the target optimal output capacity based on the configuration information.

10. The device according to claim 9, characterized in that Also includes: a fifth obtaining unit, configured to adjust the current power of the server to the target maximum power in the adjusting unit, or, after fine-tuning the current power of the server according to a set step, monitor the power consumption of the CPU at the adjusted operating frequency to obtain the maximum power at the adjusted operating frequency; The synchronization unit is used to synchronize the corresponding relationship between the adjusted operating frequency and the obtained maximum power to the BMC, so that the BMC adjusts the configuration information based on the received corresponding relationship.

11. The device according to claim 7, characterized in that The first obtaining unit is specifically used to calculate the occupancy of each logical core included in each CPU in the server; calculate the occupancy of each CPU based on the occupancy of each logical core of each CPU; and determine the average occupancy of each CPU as the current occupancy.

12. The device according to claim 7, characterized in that The adjustment unit is specifically used to configure the packet power consumption limit bit in the register used for power consumption limitation to the adjusted power, wherein the adjusted power is the target maximum power, or the power obtained after fine-tuning; and configure the time window power limit bit in the register to a set duration, wherein the set duration is the detection period.