Agent method for operating system high-frequency polling, electronic equipment and storage medium
By running the co-core operating system on the co-core end of the substrate management controller to replace the main core operating system for high-frequency polling, the problem of high-frequency polling of the main core operating system causing the central processor to be occupied for a long time is solved, and the effect of reducing system resource consumption and improving task scheduling efficiency is achieved.
Patent Information
- Application Number
- CN202510386582.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-03-28
AI Technical Summary
The main core operating system performs high-frequency polling, resulting in the central processor being occupied for a long time and unable to handle other tasks, reducing the overall system efficiency.
By running the co-core operating system on the co-core end of the substrate management controller, performing high-frequency polling on the main core operating system, the co-core operating system uses the co-core operating system to respond to the polling proxy commands generated by the main core operating system, poll the polling registers, and send polling results and interrupt signals to the main core operating system.
It reduces the burden on the main core operating system, improves task scheduling efficiency, reduces system resource consumption, and avoids the phenomenon that the central processor occupies other tasks for a long time.
Smart Images

Figure CN119883579A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an agent method, electronic equipment and storage medium for high-frequency polling of an operating system. Background Art
[0002] Currently, most BMC (Baseboard Management Controller) systems use the Linux operating system running on the main core. With its rich functions and good community support, Linux can meet various business needs. Among them, polling is a common hardware event detection mechanism, especially in the scenario of no interrupt support, by periodically checking the status of hardware registers to obtain event information.
[0003] In the related art, when the hardware event does not support interrupts, the Linux system cannot passively receive notifications and can only actively poll. However, this method causes the core resources of the Linux operating system, such as the central processing unit, to be occupied for a long time and unable to handle other tasks, thereby reducing the overall efficiency of the system, which needs to be solved urgently. Summary of the invention
[0004] The present invention provides an agent method, electronic device and storage medium for high-frequency polling of an operating system, so as to at least solve the problem that the main core operating system performs high-frequency polling, causing the central processing unit to be occupied for a long time and unable to process other tasks, thereby achieving the technical effect of reducing system resource consumption.
[0005] The present invention provides an agent method for high-frequency polling of an operating system, characterized in that the method is applied to a co-core operating system running on a co-core end of a baseboard management controller, wherein the method comprises the following steps: Responding to a polling proxy command, wherein the polling proxy command is generated by a main core operating system running on a main core end of the baseboard management controller; Polling at least one register to be polled based on the polling proxy command, and generating a polling result of at least one register to be polled; Send the polling result of at least one register to be polled and the interrupt signal to the main core operating system to wake up the current business process of the main core operating system through the interrupt signal, wherein before the auxiliary core operating system responds to the polling agent command, the main core operating system controls the current business process to enter a sleep state.
[0006] The present invention also provides another proxy method for high-frequency polling of an operating system, characterized in that the method is applied to a main core operating system running on a main core end of a baseboard management controller, wherein the method comprises the following steps: Determine whether the current business process has a polling register requirement; In the case where the current service process has the polling register requirement, generating a polling proxy command; A polling proxy command is sent to the co-core operating system, and a polling result generated by the co-core operating system after polling the register to be polled is received.
[0007] The present invention provides an agent device for high-frequency polling of an operating system, characterized in that the device is applied to a co-core operating system running on a co-core end of a baseboard management controller, wherein the device comprises: A response module, used for responding to a polling proxy command, wherein the polling proxy command is generated by a main core operating system running on a main core end of the baseboard management controller; A polling module, configured to poll at least one register to be polled based on the polling proxy command, and generate a polling result of the at least one register to be polled; A sending module is used to send the polling result of at least one register to be polled and an interrupt signal to the main core operating system, so as to wake up the current business process of the main core operating system through the interrupt signal, wherein before the auxiliary core operating system responds to the polling agent command, the main core operating system controls the current business process to enter a sleep state.
[0008] The present invention also provides another proxy device for high-frequency polling of an operating system, characterized in that the device is applied to a main core operating system running on a main core end of a baseboard management controller, wherein the device comprises: A judgment module, used to judge whether there is a polling register requirement in the current business process; A generating module, used for generating a polling proxy command when the current service process has the polling register requirement; The transceiver module is used to send a polling proxy command to the cooperative core operating system, and receive a polling result generated after the cooperative core operating system polls the register to be polled.
[0009] The present invention also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned operating system high-frequency polling proxy methods when executing the computer program.
[0010] The present invention also provides a computer-readable storage medium, in which a computer program is stored, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned proxy methods for high-frequency polling of an operating system are implemented.
[0011] The present invention also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned operating system high-frequency polling agent methods when executed by a processor.
[0012] Through the present invention, a polling proxy command generated by the main core operating system running on the main core end of the baseboard management controller is responded to, and at least one register to be polled is polled based on the polling proxy command, and the polling result of each register to be polled and the interrupt signal are sent to the main core operating system, so as to wake up the current business process of the main core operating system through the interrupt signal, wherein before the auxiliary core operating system responds to the polling proxy command, the main core operating system controls the current business process to enter a sleep state. Thus, by using the auxiliary core operating system to replace the main core operating system for high-frequency polling, the problem that the main core operating system performs high-frequency polling and causes the central processing unit to be occupied for a long time and unable to process other tasks is solved, and the technical effect of reducing system resource consumption is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0014] Figure 1 A flowchart of an operating system high-frequency polling proxy method provided by an embodiment of the present invention; Figure 2 A schematic diagram of the architecture of an operating system high-frequency polling agent system provided by an embodiment of the present invention; Figure 3 A flowchart of another proxy method for high-frequency polling of an operating system provided by an embodiment of the present invention; Figure 4 A block diagram of an operating system high-frequency polling agent device provided by an embodiment of the present invention; Figure 5 A block diagram of another agent device for high-frequency polling of an operating system provided by an embodiment of the present invention; Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0015] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0016] It should be noted that, in the description of the present invention, 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 includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present invention are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0017] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0018] An embodiment of the present invention provides an operating system high-frequency polling proxy method, and the method is described in detail in conjunction with the execution flow of the operating system high-frequency polling proxy method.
[0019] Figure 1 The present invention is a flowchart of an operating system high-frequency polling agent method according to an embodiment of the present invention.
[0020] For example, Figure 1 As shown, the proxy method of high-frequency polling of the operating system is applied to the co-core operating system running on the co-core end of the baseboard management controller, wherein the method includes the following steps: In step S101, a polling proxy command is responded to, wherein the polling proxy command is generated by a main core operating system running on a main core end of a baseboard management controller.
[0021] Among them, polling is a method of checking the hardware status, that is, checking whether a certain condition is met, such as checking whether the value of a register has changed. The polling proxy command refers to the instruction generated by the main core operating system to instruct the co-core operating system to start the polling operation. The baseboard management controller is BMC, which is an embedded processor that can be used to monitor, report and control the status of server hardware. The main core operating system can be a Linux system. The co-core operating system can be a real-time operating system (Real Time Operation System, referred to as RTOS). RTOS is an operating system specially designed to handle real-time tasks. Its core feature is that it can ensure that tasks are completed within strict time limits. It is suitable for application scenarios with very high time requirements. Compared with operating systems such as Linux, it has the advantages of low latency, lightweight, high real-time performance, and high reliability.
[0022] In order to solve the problem that the resources of the core where the main core operating system is located are occupied for a long time and cannot process other tasks due to the main core operating system actively polling the status of hardware registers in a scenario without interrupt support, an embodiment of the present invention proposes to use the auxiliary core operating system to undertake the high-frequency polling work of the main core operating system to reduce the burden on the core where the main core operating system is located.
[0023] like Figure 2 As shown, in general, the BMC chip contains two types of processor cores, one is a processor core with better performance (such as the ARM Cortex-A (Advanced RISC Machine Cortex-A, an application processor for complex operating systems and user applications) series) which can be called the main core, and the other is a processor core with average performance (such as the ARMCortex-M (Advanced RISC Machine Cortex Microcontroller, a processor core for microcontroller applications) series) which can be called the co-core. In an embodiment of the present invention, the main core end of the BMC runs the main core operating system (Linux system), and the co-core end of the BMC runs a co-core operating system (RTOS) with a faster startup speed. Data can be transmitted between the main core operating system and the co-core operating system through the inter-core communication module.
[0024] When the service process of the main core operating system needs to use the polling register to wait for a hardware event to occur, a polling proxy command can be generated. After the auxiliary core operating system responds to the polling proxy command, it can act as a proxy for the main core operating system to perform the polling operation.
[0025] In step S102, at least one register to be polled is polled based on the polling proxy command to generate a polling result of at least one register to be polled.
[0026] It is understandable that the co-core operating system mainly handles two aspects of work, one is to process the polling proxy command sent by the main core operating system, and the other is to perform register polling operations. It should be noted that after the main core operating system sends the polling proxy command to the co-core operating system, it can also send an interrupt signal to the co-core operating system, which means that there is an event that needs to be processed immediately. After receiving this interrupt signal, the co-core operating system can process the polling proxy command in a special interrupt processing function. And "register polling" is usually performed in a task (or thread) to avoid taking up too much time in the interrupt processing function.
[0027] Specifically, when the co-core operating system receives a polling proxy command, it can perform a polling operation on one or more specified registers to be polled according to the polling proxy command. This process involves checking each register to be polled one by one to obtain its current state or value. Subsequently, the co-core operating system will organize and generate detailed polling results for each register to be polled. These results can reflect the specific state or data of each register to be polled at the time of polling.
[0028] For ease of understanding, the following describes in detail how to poll at least one register to be polled based on the polling proxy command and generate a polling result for each register to be polled.
[0029] As a possible implementation method, in some embodiments, at least one register to be polled is polled based on a polling proxy command to generate a polling result of at least one register to be polled, including: storing the polling proxy command to a preset global variable group; traversing the preset global variable group, parsing the polling proxy command, and determining target polling register information; polling at least one register to be polled based on the target polling register information to generate a polling result of at least one register to be polled.
[0030] It can be understood that global variables refer to variables that can be accessed from any part of the program. They are usually stored in the data segment of the program and are used to save data that needs to be shared across functions or modules.
[0031] That is to say, in the co-core operating system, there will be a group of global variables (i.e., the preset global variable group) used to save the register information that needs to be checked (polled) (i.e., the target polling register information). These global variables constitute a specific data structure, and its structure is shown in Code 1. In Code 1, the register field indicates the address of the register to be polled; the triggerPerChange field indicates the trigger condition; the isPermanent field indicates the permanent flag; the target field indicates the target value; and the mask field indicates the bit of the register to be polled. If triggerPerChange is 1, it means that the main core operating system needs to be reported every time the value of the register to be polled changes. If triggerPerChange is 0, it means that the value of the register to be polled will be reported to the main core operating system only when it becomes the target value (target); if isPermanent is 0, it means that it does not need to be polled all the time. If isPermanent is 1, it means that it needs to be polled all the time; target means that when the value of the register to be polled changes to the target value, it will be reported to the main core operating system. This field is mutually exclusive with the triggerPerChange field, that is, if triggerPerChange is 1, this field is invalid; the bit with a mask value of 1 indicates the bit that needs to be polled in the register to be polled, and the bit with a mask value of 0 indicates the bit that does not need to be polled. Based on the polling proxy command sent by the main core operating system, the cooperative core operating system can store the polling proxy command in a preset global variable group to facilitate the execution of the polling task. Then, by traversing the preset global variable group and parsing the polling proxy command therein, the target polling register information can be determined, that is, the specific information that each register to be polled needs to be polled. Finally, a polling operation is performed on each register to be polled according to the target polling register information, and a corresponding polling result is generated.
[0032] Code 1: typedef PollAgentReq { uint64_t register; uint32_t triggerPerChange; uint32_t isPermanent; uint64_t taget; uint64_t mask; }PollAgentReq_t; Therefore, when the main core operating system sends polling requests for multiple registers, the cooperative core operating system can handle them uniformly by traversing the preset global variable group, avoiding frequent inter-core communication overhead, thereby significantly improving task scheduling efficiency. In addition, the design of the preset global variable group realizes efficient proxying of high-frequency polling tasks through centralized data management, task isolation, dynamic update and fast access mechanism.
[0033] The register polling task flow of the co-core operating system is described in detail below.
[0034] Further, in some embodiments, at least one register to be polled is polled based on the target polling register information to generate a polling result of at least one register to be polled, including: determining whether the information of the current register to be polled is empty; if the information of the current register to be polled is not empty, determining the value of the current register to be polled, performing an AND operation on the value of the current register to be polled and the mask in the target polling register information, and determining whether the AND operation result is consistent with the value of the current register to be polled; if the AND operation result is consistent with the value of the current register to be polled, then re-execute the step of determining whether the information of the current register to be polled is empty after sleeping for a preset period of time, otherwise determine whether the trigger condition in the target polling register information meets the first preset condition; if the trigger condition in the target polling register information meets the first preset condition, generate the polling result of the current register to be polled based on the value of the current register to be polled.
[0035] It can be understood that the role of the mask is that it allows the register to read only 32 bits of data in a single operation. However, not all bits of data need to be paid attention to. Therefore, the mask can be used to filter out the data of the bits that really need to be paid attention to. The corresponding mask is also 32 bits long. Assuming that the 10th bit of the mask is 1, it means that the 10th bit of the register needs to be paid attention to; if the 11th bit of the mask is 0, it means that the 11th bit of the register does not need to be paid attention to. In this way, the data in the register can be flexibly and selectively read and processed, greatly improving the efficiency and flexibility of data processing.
[0036] Specifically, based on the information of each register to be polled, it can be determined whether the information of the current register to be polled is empty. If the information of the current register to be polled is not empty, the value of the current register to be polled can be read. After obtaining the value of the current register to be polled, the next step of judgment can be performed, that is, the value of the current register to be polled is ANDed with the mask in the target polling register information to obtain the corresponding AND operation result, and compare the AND operation result with the value of the current register to be polled. It should be noted that the value of the current register to be polled is the result of the AND operation after the value of the register to be polled last time is ANDed with the mask in the target polling register information. The purpose of the register value and the mask AND operation is to cover all bits that are not concerned to avoid affecting subsequent operations.
[0037] If the result of the AND operation is consistent with the value of the current register to be polled, it means that the value of the current register to be polled has not changed in the bit of interest, then the cooperative core operating system will enter the sleep state for a preset sleep time (such as 10ms), where the preset time can be pre-set, and is not specifically limited here. After the sleep ends, the cooperative core operating system can perform the step of checking whether the information of the register to be polled is empty again. If the result of the AND operation is inconsistent with the value of the current register to be polled, it means that the value of the current register to be polled has changed in the bit of interest, then it can be determined whether the trigger condition of the target polling register information meets the first preset condition, that is, combined with code 1, it is determined whether the triggerPerChange value in the target polling register information is 1. If the triggerPerChange value in the target polling register information is 1 (that is, the trigger condition in the target polling register information meets the first preset condition), it means that each change in the current register to be polled needs to be reported to the main core operating system, so the corresponding polling result can be generated based on the value of the current register to be polled.
[0038] Therefore, by using masks and target value judgments during the polling process, the report is triggered only when the bits of interest change and specific trigger conditions are met, thereby reducing unnecessary data transmission and processing.
[0039] Furthermore, in some embodiments, after determining whether the trigger condition in the target polling register information satisfies the first preset condition, it also includes: if the trigger condition in the target polling register information does not satisfy the first preset condition, determining whether the value of the current register to be polled is consistent with the target value in the target polling register information; when the value of the current register to be polled is consistent with the target value in the target polling register information, generating a polling result of the current register to be polled based on the value of the current register to be polled.
[0040] Specifically, if the triggerPerChange value in the target polling register information is 0 (that is, the trigger condition in the target polling register information does not meet the first preset condition), it means that the value of the current register to be polled is reported to the main core operating system only when it becomes the target value (target). Therefore, it can be further determined whether the value of the current register to be polled is consistent with the target value in the target polling register information. If the value of the current register to be polled is consistent with the target value in the target polling register information, then the corresponding polling result can be generated based on the value of the current register to be polled.
[0041] Therefore, during the polling process, the mask and target value are used for judgment, and the report is triggered only when the bit of interest changes and the specific trigger conditions are met, thereby reducing unnecessary data transmission and processing.
[0042] Further, in some embodiments, after determining whether the value of the current register to be polled is consistent with the target value in the target polling register information, it also includes: if the value of the current register to be polled is inconsistent with the target value in the target polling register information, determining whether the resident flag in the target polling register information meets the second preset condition; if the resident flag in the target polling register information meets the second preset condition, clearing the information of the current register to be polled and polling the next register to be polled, otherwise directly polling the next register to be polled.
[0043] Specifically, if the triggerPerChange value in the target polling register information is 0 (i.e., the trigger condition in the target polling register information does not meet the first preset condition), and the value of the current register to be polled is inconsistent with the target value in the target polling register information, then in this case, it can be further determined whether the permanent flag of the target polling register information meets the second preset condition, that is, in combination with code 1, it is determined whether the isPermanent value in the target polling register information is 0. If the isPermanent value in the target polling register information is 0 (i.e., the permanent flag of the target polling register information meets the second preset condition), it means that the current register to be polled does not need permanent polling, then the information of the current register to be polled can be cleared, and the next register to be polled can be polled. If the isPermanent value in the target polling register information is 1 (i.e., the permanent flag of the target polling register information does not meet the second preset condition), it means that the current register to be polled needs permanent polling, then the next register to be polled can be directly polled.
[0044] It should be noted that, in the embodiment of the present invention, the so-called resident polling mechanism actually means that in each polling cycle, the co-core operating system will perform a polling check on all registers to be polled. In this process, if it is found that a register to be polled no longer meets the established resident polling conditions, then in the next polling cycle, the co-core operating system will no longer perform a polling operation on the register to be polled.
[0045] Therefore, this mechanism can ensure the efficiency of the polling process and avoid unnecessary checks on registers that no longer need to be continuously monitored, thereby saving system resources and improving the efficiency of polling.
[0046] In step S103, the polling result of at least one register to be polled and an interrupt signal are sent to the main core operating system to wake up the current business process of the main core operating system through the interrupt signal, wherein before the auxiliary core operating system responds to the polling agent command, the main core operating system controls the current business process to enter a sleep state.
[0047] That is to say, when a polling result corresponding to at least one register to be polled is obtained and the corresponding trigger condition is met, the polling result of each register to be polled can be sent to the main core operating system. In addition, an interrupt signal can also be sent. The main core operating system can wake up the business process that is currently in sleep state through the received interrupt signal.
[0048] It should be noted that after the main core operating system sends a polling proxy command to the cooperative core operating system, it can control the current business process to enter a sleep state, so that the current business process can sleep and release the core resources of the processor, so as to use the core resources to execute other task processes or enter a low power consumption state to improve the overall efficiency and resource utilization of the system.
[0049] Optionally, in some embodiments, the polling result includes at least one of an address of the register to be polled, a value of the register to be polled, and a mask value of a specific bit of the register to be polled.
[0050] Specifically, the data structure of the polling result sent by the cooperative core operating system to the main core operating system can be as shown in Code 2, wherein register represents the address of the register to be polled, value represents the value of the register to be polled, and mask represents the mask value of a specific bit of the register to be polled.
[0051] Code 2: typedef PollAgentResp { uint64_t register; uint64_t value; uint64_t mask; }PollAgentResp_t; Therefore, by specifying the mask, the system can process only the required bits to improve processing efficiency; clarifying the register address and value can reduce errors and redundant queries and improve system stability; in addition, structured data replies can make communication between systems more standardized, reduce coupling, and facilitate maintenance and expansion.
[0052] According to the proxy method for high-frequency polling of the operating system proposed in an embodiment of the present invention, the burden of the main core operating system can be reduced, the task scheduling efficiency can be improved, and the inter-core communication overhead can be reduced by managing and executing polling tasks based on a preset global variable group by the co-core operating system.
[0053] Figure 3 A flowchart of an operating system high-frequency polling proxy method provided by another embodiment of the present invention.
[0054] like Figure 3 As shown, the proxy method for high-frequency polling of the operating system is applied to the main core operating system running on the main core end of the baseboard management controller, wherein the method includes the following steps: In step S301, it is determined whether the current service process has a polling register requirement.
[0055] It is understandable that during the execution of the current business process, the values of certain registers may be read to determine whether a specific condition is met or to obtain data updates.
[0056] In step S302, when there is a polling register requirement in the current service process, a polling proxy command is generated.
[0057] That is to say, if the current business process has a polling register requirement, the main core operating system can automatically generate a corresponding polling proxy command to ensure the smooth progress of the polling task.
[0058] Optionally, in some embodiments, the polling agent command includes at least one of an address of a register to be polled, a trigger condition, a resident flag, a target value, and a mask.
[0059] Specifically, as shown in Code 1, the polling proxy command includes the address register of the register to be polled, the trigger condition triggerPerChange, the permanent flag isPermanent, the target value target and the mask mask.
[0060] Therefore, through the design of this data structure, the address of the register to be polled can be clearly specified, so that the co-core operating system does not need to traverse all registers and can directly locate the target hardware, thereby reducing the query range and reducing invalid polling; optimizing the event trigger mechanism to avoid high-frequency irrelevant status reporting; realizing dynamic resource management based on resident flags to prevent long-term occupation of co-core resources; specifying specific bits of interest through masks to reduce data processing volume and improve polling efficiency.
[0061] In step S303, a polling proxy command is sent to the co-core operating system, and a polling result generated by the co-core operating system after polling the register to be polled is received.
[0062] That is to say, when there is a need to poll registers in the current business process, the main core operating system can generate and send a polling proxy command to the cooperative core operating system to use the cooperative core operating system to perform polling operations and receive the polling results generated by the cooperative core operating system for polling the polled registers.
[0063] Furthermore, in some embodiments, before sending the polling proxy command to the co-core operating system, it also includes: creating a polling proxy driver and an interface of the polling proxy driver to send the polling proxy command to the co-core operating system through the interface, and / or receiving the polling results generated by the co-core operating system.
[0064] It can be understood that the main core operating system can be divided into the user layer (application layer) and the kernel layer. The user layer (application layer) refers to the layer in the main core operating system that directly interacts with the user, including the applications run by the user, such as text editors, browsers, games, etc. The kernel layer refers to the core part of the main core operating system, which is responsible for managing system resources, such as CPU (Central Processing Unit), memory, device drivers, etc. The kernel provides a system call interface for user-layer programs to use, and is responsible for scheduling processes, managing file systems, handling network communications, etc. Therefore, in order to perform the task of polling registers, a polling proxy driver can be built first. The polling proxy driver is placed in the kernel as a driver, and the register polling proxy driver can provide a program interface to other business drivers. The data structure of this interface is shown in Code 3. pPollReq refers to Code 1, i.e., the polling proxy instruction; pPollResp refers to Code 2, i.e., the polling result; daemonFun is the function to be run when the value of the polling register changes when the resident polling is satisfied. If resident is not required, this parameter is invalid; pDaemonFunData is the parameter of the function to be run when the value of the polling register changes when the resident polling is satisfied. Similarly, if resident is not required, this parameter is invalid. The purpose is that other business drivers can request polling services (i.e., send polling proxy commands to the co-core operating system) or obtain polling results through the polling proxy driver and its interface. The call and execution of the interface occur in other parts of the kernel, i.e., the area where the business driver is located. This process involves the interaction between the main core operating system and the co-core operating system to ensure the correct sending of polling proxy commands and the accurate reception of polling results, thereby realizing real-time monitoring and management of system status.
[0065] Code 3: int pollAgent(PollAgentReq_t *pPollReq, PollAgentResp_t *pPollResp, int(*)(void *)daemonFun void *pDaemonFunData); Therefore, by directly creating a polling proxy driver at the kernel layer, the business driver can directly initiate a polling request through the kernel interface, avoiding data copying and context switching between the user layer and the kernel layer, and significantly reducing data transmission delay.
[0066] Next, the process of sending the polling proxy command and receiving the polling result of the main core operating system is described in detail.
[0067] As a possible implementation method, in some embodiments, a polling proxy command is sent to the co-core operating system, and a polling result generated by the co-core operating system after polling the register to be polled is received, including: creating a command reply message queue; sending the handles of the polling proxy command and the command reply message queue to the polling proxy driver based on the interface; determining whether the polling proxy command meets the preset continuous polling condition; if the polling proxy command meets the preset continuous polling condition, determining whether the command reply message queue has listened to the polling result; if the command reply message queue has listened to the polling result, running the preset function and re-executing the step of determining whether the command reply message queue has listened to the polling result.
[0068] Specifically, the main core operating system of an embodiment of the present invention can first create a command reply message queue, which is used to receive the reply (i.e., polling result) of the polling proxy driver. Next, the interface based on the polling proxy driver can send the polling proxy command and the handle of the command reply message queue (in computer science, a handle refers to a reference or identifier used to access and manage resources, such as files, windows, or message queues, etc.) to the polling proxy driver. As a result, the polling proxy driver can know how to interact with the command reply message queue and can return the execution result of the command. After sending the handle, the polling proxy command can be judged to determine whether it meets the preset continuous polling condition (i.e., whether resident polling is required). If the polling proxy command meets the preset continuous polling condition, it means that resident polling is required, then the polling proxy driver will enter the monitoring state and continuously listen to the command reply message queue to see if the polling result has been received. If the polling result is heard in the command reply message queue, the following operation can be run. Figure 5 The preset function (ie, daemonFun) shown in the figure re-listens to the command reply message queue and continues to wait for new polling results, thus forming a continuous polling and processing cycle.
[0069] Therefore, the amount of data transmitted in inter-core communication is reduced by passing the command reply message queue handle instead of directly passing data. The handle, as a lightweight resource identifier, enables the cooperative core to directly access the shared queue, avoiding the repeated transmission of large amounts of data. The judgment mechanism of preset continuous polling conditions realizes intelligent task management. When resident polling is required, the system automatically enters the monitoring-processing loop, and realizes continuous event response through the daemonFun function to ensure real-time monitoring of key hardware status.
[0070] Furthermore, in other embodiments, after determining whether the command reply message queue satisfies the preset continuous polling conditions, it also includes: if the command reply message queue does not satisfy the preset continuous polling conditions, determining whether the command reply message queue has listened to the polling results; in the case that the command reply message queue listens to the polling results, receiving the polling results through the preset reply data parameters in the interface, and deleting the command reply message queue.
[0071] That is to say, if the polling proxy command does not meet the preset continuous polling conditions, indicating that resident polling is not required, the polling proxy driver can also enter the monitoring state, continuously listen to the command reply message queue, and when the command reply message queue listens to the polling result, it directly returns the polling result through the preset reply data parameter (i.e. pPollResp) of the polling proxy driver's interface and deletes the command reply message queue.
[0072] Therefore, since there is no need to maintain continuous monitoring of the message queue, the number of resident monitoring threads in the kernel is reduced. The cooperative core can release related resources after completing a single polling, avoiding the long-term occupation of the cooperative core processing resources.
[0073] Furthermore, in some embodiments, after sending the polling proxy command to the co-core operating system, it also includes: controlling the current business process to enter a sleep state, and determining whether an interrupt signal sent by the co-core operating system is received; if an interrupt signal is received, controlling the current business process to end the sleep state based on the interrupt signal, and resuming the operation of the current business process.
[0074] That is to say, after the main core operating system sends the polling proxy command to the cooperative core operating system, it immediately controls the current business process to enter the sleep state. While the current business process is in the sleep state, the main core operating system can continuously monitor whether there is an interrupt signal received from the cooperative core operating system. Once the existence of an interrupt signal is detected, the main core operating system can take corresponding actions based on the interrupt signal, that is, wake up the current business process in the sleep state and restore it to a normal operating state.
[0075] Therefore, by hibernating the current business process, the CPU of the main core operating system can be released to process other tasks, achieving optimal resource allocation while ensuring real-time performance.
[0076] According to the proxy method for high-frequency polling of the operating system proposed in an embodiment of the present invention, the main core operating system issues polling proxy instructions to enable the auxiliary core operating system to perform polling operations, which can reduce the burden of the main core operating system, improve task scheduling efficiency and reduce inter-core communication overhead.
[0077] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0078] An embodiment of the present invention also provides an agent device for high-frequency polling of an operating system.
[0079] Figure 4 The figure is a block diagram of an agent device for high-frequency polling of an operating system according to an embodiment of the present invention.
[0080] like Figure 4 As shown, the operating system high-frequency polling agent device 10 is applied to the cooperative core operating system running on the cooperative core end of the baseboard management controller, wherein the operating system high-frequency polling agent device 10 includes: a response module 100, a polling module 200 and a sending module 300.
[0081] The response module 100 is used to respond to the polling proxy command, wherein the polling proxy command is generated by the main core operating system running on the main core end of the baseboard management controller; The polling module 200 is used to poll at least one register to be polled based on the polling proxy command and generate a polling result of at least one register to be polled; The sending module 300 is used to send the polling result of at least one register to be polled and an interrupt signal to the main core operating system, so as to wake up the current business process of the main core operating system through the interrupt signal, wherein before the auxiliary core operating system responds to the polling agent command, the main core operating system controls the current business process to enter a sleep state.
[0082] Further, in some embodiments, the polling module 200 includes: A storage unit, used for storing the polling agent command into a preset global variable group; A determination unit, used to traverse a preset global variable group, parse the polling proxy command, and determine target polling register information; The polling unit is used to poll at least one register to be polled based on the target polling register information and generate a polling result of at least one register to be polled.
[0083] Further, in some embodiments, the polling unit is specifically configured to: Determine whether the information of the register to be polled is empty; When the information of the current register to be polled is not empty, determine the value of the current register to be polled, perform an AND operation on the value of the current register to be polled and the mask in the target polling register information, and determine whether the AND operation result is consistent with the value of the current register to be polled; If the operation result is consistent with the value of the current register to be polled, then the step of determining whether the information of the current register to be polled is empty is re-executed after the preset sleep time, otherwise, determining whether the trigger condition in the target polling register information meets the first preset condition; When the trigger condition in the target polling register information satisfies the first preset condition, a polling result of the current register to be polled is generated based on the value of the current register to be polled.
[0084] Further, in some embodiments, after determining whether the trigger condition in the target polling register information satisfies the first preset condition, the polling unit is further configured to: If the trigger condition in the target polling register information does not meet the first preset condition, determining whether the value of the current register to be polled is consistent with the target value in the target polling register information; When the value of the current register to be polled is consistent with the target value in the target polling register information, a polling result of the current register to be polled is generated based on the value of the current register to be polled.
[0085] Further, in some embodiments, after determining whether the value of the current register to be polled is consistent with the target value in the information of the current register to be polled, the polling unit is further configured to: When the value of the current register to be polled is inconsistent with the target value in the target polling register information, determining whether the resident flag in the target polling register information satisfies a second preset condition; If the resident flag in the target polling register information meets the second preset condition, the information of the current register to be polled is cleared and the next register to be polled is polled; otherwise, the next register to be polled is directly polled.
[0086] Further, in some embodiments, the polling result includes at least one of an address of the register to be polled, a value of the register to be polled, and a mask value of a specific bit of the register to be polled.
[0087] According to the agent device for high-frequency polling of the operating system proposed in an embodiment of the present invention, the burden of the main core operating system can be reduced, the task scheduling efficiency can be improved, and the inter-core communication overhead can be reduced by managing and executing polling tasks based on a preset global variable group through the co-core operating system.
[0088] Figure 5 It is a block diagram of an agent device for high-frequency polling of an operating system according to another embodiment of the present invention.
[0089] like Figure 5As shown, the operating system high-frequency polling agent device 20 is applied to the main core operating system running on the main core end of the baseboard management controller, wherein the operating system high-frequency polling agent device 20 includes: a judgment module 400, a generation module 500 and a transceiver module 600.
[0090] The determination module 400 is used to determine whether there is a polling register requirement in the current business process; A generating module 500, for generating a polling proxy command when there is a polling register requirement in the current service process; The transceiver module 600 is used to send a polling proxy command to the co-core operating system, and receive a polling result generated by the co-core operating system after polling the register to be polled.
[0091] Further, in some embodiments, before sending the polling proxy command to the co-core operating system, the transceiver module 600 is further used to: Create a polling agent driver and an interface of the polling agent driver to send a polling agent command to the co-core operating system through the interface and / or receive a polling result generated by the co-core operating system.
[0092] Furthermore, in some embodiments, the transceiver module 600 includes: A creation unit is used to create a command reply message queue; A sending unit, used for sending the handle of the polling proxy command and the command reply message queue to the polling proxy driver based on the interface; A first determination unit, used to determine whether the polling proxy command meets a preset continuous polling condition; A second judgment unit is used to judge whether the command reply message queue monitors the polling result when the polling proxy command meets the preset continuous polling condition; The running unit is used to run a preset function and re-execute the step of determining whether the command reply message queue has listened to the polling result when the command reply message queue has listened to the polling result.
[0093] Further, in some embodiments, after determining whether the command reply message queue satisfies a preset continuous polling condition, the first determination unit is further configured to: When the command reply message queue does not meet the preset continuous polling condition, determine whether the command reply message queue monitors the polling result; When the command reply message queue monitors the polling result, the polling result is received through the preset reply data parameter in the interface, and the command reply message queue is deleted.
[0094] Further, in some embodiments, the polling agent command includes at least one of an address of a register to be polled, a trigger condition, a resident flag, a target value, and a mask.
[0095] Further, in some embodiments, after sending the polling proxy command to the co-core operating system, the transceiver module 600 is further used to: Control the current business process to enter the sleep state and determine whether an interrupt signal sent by the cooperative core operating system is received; If an interrupt signal is received, the current business process is controlled to end the sleep state based on the interrupt signal and resume the operation of the current business process.
[0096] For the description of the features in the embodiment corresponding to the proxy device for high-frequency polling of the operating system, reference may be made to the relevant description of the embodiment corresponding to the proxy method for high-frequency polling of the operating system, which will not be described in detail here.
[0097] According to the proxy device for high-frequency polling of the operating system proposed in an embodiment of the present invention, the main core operating system issues polling proxy instructions to enable the auxiliary core operating system to perform polling operations, which can reduce the burden of the main core operating system, improve task scheduling efficiency and reduce inter-core communication overhead.
[0098] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device may include: A memory 601 , a processor 602 , and a computer program stored in the memory 601 and executable on the processor 602 .
[0099] When the processor 602 executes the program, the steps in any of the above-mentioned proxy method embodiments for high-frequency polling of the operating system are implemented.
[0100] Furthermore, the electronic device further comprises: The communication interface 603 is used for communication between the memory 601 and the processor 602 .
[0101] The memory 601 is used to store computer programs that can be executed on the processor 602 .
[0102] The memory 601 may include a high-speed RAM (Random Access Memory) memory, and may also include a non-volatile memory, such as at least one disk memory.
[0103] If the memory 601, the processor 602 and the communication interface 603 are implemented independently, the communication interface 603, the memory 601 and the processor 602 can be connected to each other through a bus and communicate with each other. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0104] Optionally, in a specific implementation, if the memory 601, the processor 602 and the communication interface 603 are integrated on a chip, the memory 601, the processor 602 and the communication interface 603 can communicate with each other through an internal interface.
[0105] The processor 602 may be a CPU (Central Processing Unit), or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention.
[0106] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned operating system high-frequency polling agent method embodiments when running.
[0107] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory, a mobile hard disk, a magnetic disk, or an optical disk.
[0108] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above-mentioned operating system high-frequency polling agent method embodiments are implemented.
[0109] An embodiment of the present invention also provides another computer program product, including a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, implementing the steps in any of the above-mentioned operating system high-frequency polling agent method embodiments.
[0110] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0111] The above is a detailed introduction to a proxy method for high-frequency polling of an operating system provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A proxy method for high-frequency polling of an operating system, characterized in that: The method is applied to a co-core operating system running on a co-core end of a baseboard management controller, wherein the method comprises: Responding to a polling proxy command, wherein the polling proxy command is generated by a main core operating system running on a main core end of the baseboard management controller; Polling at least one register to be polled based on the polling proxy command, and generating a polling result of the at least one register to be polled; Send the polling result of at least one register to be polled and the interrupt signal to the main core operating system to wake up the current business process of the main core operating system through the interrupt signal, wherein before the auxiliary core operating system responds to the polling agent command, the main core operating system controls the current business process to enter a sleep state.
2. The agent method for high-frequency polling of an operating system according to claim 1, characterized in that: The step of polling at least one register to be polled based on the polling proxy command to generate a polling result of at least one register to be polled includes: Storing the polling proxy command in a preset global variable group; Traversing the preset global variable group, parsing the polling proxy command, and determining target polling register information; The at least one register to be polled is polled based on the target polling register information to generate a polling result of the at least one register to be polled.
3. The agent method for high-frequency polling of an operating system according to claim 2, characterized in that: The polling the at least one register to be polled based on the target polling register information to generate a polling result of the at least one register to be polled includes: Determine whether the information of the register to be polled is empty; If the information of the current register to be polled is not empty, determine the value of the current register to be polled, perform an AND operation on the value of the current register to be polled and the mask in the target polling register information, and determine whether the AND operation result is consistent with the value of the current register to be polled; If the result of the AND operation is consistent with the value of the current register to be polled, then the step of determining whether the information of the current register to be polled is empty is re-executed after a preset sleep time, otherwise, determining whether the trigger condition in the target polling register information satisfies a first preset condition; When the trigger condition in the target polling register information satisfies the first preset condition, a polling result of the current register to be polled is generated based on the value of the current register to be polled.
4. The agent method for high-frequency polling of an operating system according to claim 3, characterized in that: After determining whether the trigger condition in the target polling register information meets the first preset condition, the method further includes: If the trigger condition in the target polling register information does not meet the first preset condition, determining whether the value of the current register to be polled is consistent with the target value in the target polling register information; When the value of the current register to be polled is consistent with the target value in the target polling register information, a polling result of the current register to be polled is generated based on the value of the current register to be polled.
5. The agent method for high-frequency polling of an operating system according to claim 4, characterized in that: After determining whether the value of the current register to be polled is consistent with the target value in the target polling register information, the method further includes: If the value of the current register to be polled is inconsistent with the target value in the target polling register information, determining whether the resident flag in the target polling register information satisfies a second preset condition; If the resident flag in the target polling register information meets the second preset condition, the information of the current register to be polled is cleared and the next register to be polled is polled; otherwise, the next register to be polled is directly polled.
6. The agent method for high-frequency polling of an operating system according to claim 1, characterized in that: The polling result includes at least one of an address of the register to be polled, a value of the register to be polled, and a mask value of a specific bit of the register to be polled.
7. A proxy method for high-frequency polling of an operating system, characterized in that: The method is applied to a main core operating system running on a main core end of a baseboard management controller, wherein the method comprises: Determine whether the current business process has a polling register requirement; In the case where the current service process has the polling register requirement, generating a polling proxy command; A polling proxy command is sent to the co-core operating system, and a polling result generated by the co-core operating system after polling the register to be polled is received.
8. The agent method for high-frequency polling of an operating system according to claim 7, characterized in that: Before sending the polling proxy command to the cooperative core operating system, the method further includes: A polling proxy driver and an interface of the polling proxy driver are created to send the polling proxy command to the co-core operating system through the interface, and / or receive a polling result generated by the co-core operating system.
9. The agent method for high-frequency polling of an operating system according to claim 8, characterized in that: The sending of the polling proxy command to the co-core operating system and receiving the polling result generated by the co-core operating system after polling the register to be polled includes: Create a command reply message queue; Sending the polling proxy command and the handle of the command reply message queue to the polling proxy driver based on the interface; Determining whether the polling proxy command satisfies a preset continuous polling condition; If the polling proxy command meets the preset continuous polling condition, determining whether the command reply message queue monitors the polling result; In the case that the command reply message queue monitors the polling result, a preset function is run and the step of determining whether the command reply message queue monitors the polling result is re-executed.
10. The agent method for high-frequency polling of an operating system according to claim 9, characterized in that: After determining whether the command reply message queue meets the preset continuous polling condition, the method further includes: If the command reply message queue does not meet the preset continuous polling condition, determining whether the command reply message queue monitors the polling result; When the command reply message queue monitors the polling result, the polling result is received through the preset reply data parameter in the interface, and the command reply message queue is deleted.
11. The agent method for high-frequency polling of an operating system according to claim 7, characterized in that: The polling proxy command includes at least one of an address of a register to be polled, a trigger condition, a resident flag, a target value, and a mask.
12. The agent method for high-frequency polling of an operating system according to claim 7, characterized in that: After sending the polling agent command to the co-core operating system, it also includes: Controlling the current service process to enter a sleep state, and determining whether an interrupt signal sent by the cooperative core operating system is received; If the interrupt signal is received, the current business process is controlled to end the sleep state based on the interrupt signal and resume the operation of the current business process.
13. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to implement the steps of the proxy method for high-frequency polling of the operating system as described in any one of claims 1 to 6, or the steps of the proxy method for high-frequency polling of the operating system as described in any one of claims 7 to 12 when executing the computer program.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the proxy method for high-frequency polling of the operating system as described in any one of claims 1 to 6, or the steps of the proxy method for high-frequency polling of the operating system as described in any one of claims 7 to 12.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the proxy method for high-frequency polling of the operating system as described in any one of claims 1 to 6, or the steps of the proxy method for high-frequency polling of the operating system as described in any one of claims 7 to 12 are implemented.
Citation Information
Patent Citations
Task scheduling method in heterogeneous multi-core architecture
CN104899089A
Master-slave core communication method and system of master-slave architecture chip
CN113986513A
Method for communication between processor cores, multiprocessor platform and readable storage medium
CN116340244A
Remote restarting method and device, storage medium and computer program product
CN119376803A
Start deployment and cooperative processing method for multi-core heterogeneous system
CN119415161A
Cited By
Model reasoning acceleration method and device, storage medium and program product
CN120354956A
Data interaction method and device and electronic equipment
CN121277909A