Method and device for determining interaction state, storage medium and electronic device
Patent Information
- Application Number
- CN202311424077.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-30
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-10-30
AI Technical Summary
[0006]本申请实施例提供了一种交互状态的确定方法和装置、存储介质及电子装置,以至少解决在系统启动的过程中无法发现IPMI模块加载失败的状态,且无法自动解决加载失败的问题
[0017]通过本申请,在目标模块进行初始化的过程中,首先确定目标模块是否读取目标模块对应的控制器的接口地址,然后确定目标模块与控制器的交互状态,在目标模块已经读取到目标模块对应的控制器的接口地址,并且目标模块与控制器交互失败的情况下,调用重试函数,以确定目标模块与控制器的第二交互状态。因此,可以解决在系统启动的过程中无法发现IPMI模块加载失败的状态,且无法自动解决加载失败的问题。
Smart Images

Figure CN117453287B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communications, and more specifically, to a method and apparatus for determining an interactive state, a storage medium, and an electronic device. Background Technology
[0002] During the boot process of an open-source operating system (such as Linux), the Intelligent Platform Management Interface (IPMI) modules are initialized to enable the built-in IPMI functionality. IPMI is a standardized specification, and its most important physical component is the Baseboard Management Controller (BMC). The BMC is essentially the "brain" of the entire platform management system. Through the BMC, IPMI can monitor data from various sensors and log various events. IPMI's biggest advantage is that it is independent of the Central Processing Unit (CPU), Basic Input / Output System (BIOS), and Operating System (OS). Therefore, regardless of whether the power is on or off, monitoring of the server can be achieved as long as power is connected.
[0003] IPMI is a next-generation universal interface standard that enables "intelligent" hardware management. IPMI can be used to monitor the physical characteristics of servers, such as temperature, voltage, fan status, power supply, and chassis intrusion. Specifically: If the IPMI module initializes successfully, it creates the ` / dev / IPMIO` device (a device file in Linux). The in-band intelligent platform management interface tool (IPMItool) interacts with the BMC (Browser Control Center) through ` / dev / IPMIO` to obtain server hardware information such as temperature, voltage, fan status, and BMC-related information including logs, alarms, and version. Customization can also be performed using IPMItool commands. If initialization fails, the ` / dev / IPMIO` device will not be created, and the IPMItool command cannot communicate with the BMC through ` / dev / IPMIO`, meaning it cannot obtain server-related information, BMC-related information, or perform customization using IPMItool.
[0004] In existing technologies, when the BMC fails to complete preparation during system startup, causing IPMI-related modules to fail to initialize and the system to be unable to create the / dev / IPMIO device, thus rendering the IPMItool function unusable after system startup, and causing some IPMItool custom scripts to fail to execute during system startup, the current solution is to manually add the IPMI-related driver modules or reboot. However, this solution requires operation after system startup, and a reboot is still needed to execute the scripts executed during startup.
[0005] Therefore, the current technology has not yet found an effective solution to the problem that the IPMI module loading failure cannot be detected during system startup and that the loading failure cannot be automatically resolved. Summary of the Invention
[0006] This application provides a method and apparatus for determining the interaction state, a storage medium, and an electronic device to at least solve the problem that the IPMI module loading failure cannot be detected during system startup and that the loading failure cannot be automatically resolved.
[0007] According to one embodiment of this application, a method for determining an interaction state is provided, comprising: during the initialization process of a target module, determining whether the target module has read the interface address of the controller corresponding to the target module; if the target module has read the interface address of the controller corresponding to the target module, determining a first interaction state between the target module and the controller; and if the first interaction state indicates that the interaction between the target module and the controller is abnormal, calling a retry function to determine a second interaction state between the target module and the controller.
[0008] In an exemplary embodiment, invoking a retry function to determine a second interaction state between the target module and the controller includes: a retry step: determining whether the timer corresponding to the retry function has timed out; if the timer has not timed out, controlling the target module to send an operation command to the controller within a preset time, so as to determine the second interaction state between the target module and the controller based on the execution result of the operation command; if the second interaction state indicates that the interaction between the target module and the controller is abnormal, updating the timing duration of the timer; and repeatedly executing the retry step until it is determined that the second interaction state indicates that the interaction between the target module and the controller is successful.
[0009] In an exemplary embodiment, after determining whether the timer corresponding to the retry function has timed out, the method further includes: if the timer times out, prohibiting the call to the retry function and obtaining first log information, wherein the first log information is used to indicate the running log information of the call to the retry function; and determining the reason for the initialization failure of the target module based on the first log information.
[0010] In an exemplary embodiment, after determining whether the target module has read the interface address of the controller corresponding to the target module, the method further includes: if the target module has not read the interface address of the controller corresponding to the target module, determining whether to restart the input / output system corresponding to the target module, wherein the input / output system is used to send the interface address of the controller to the target module; if it is determined to restart the input / output system, calling a restart function to restart the input / output system.
[0011] In an exemplary embodiment, after determining whether to restart the input / output system corresponding to the interface address when the target module fails to read the interface address of the controller corresponding to the target module, the method further includes: if it is determined that the input / output system should not be restarted, obtaining second log information; and determining the reason for the initialization failure of the target module based on the second log information.
[0012] In one exemplary embodiment, determining whether the target module has read the interface address of the controller corresponding to the target module includes: setting a monitoring option and determining whether to start the monitoring function corresponding to the monitoring option; if it is determined that the monitoring function is started, determining whether the target module has read the interface address of the controller corresponding to the target module.
[0013] In one exemplary embodiment, invoking a retry function to determine a second interaction state between the target module and the controller includes: identifying an abnormal operation command; writing the operation command as a variable into the target parameter of the retry function to retry the operation command; obtaining the execution result of the operation command; and determining the second interaction state between the target module and the controller based on the execution result of the operation command.
[0014] According to another embodiment of this application, an interaction state determination device is provided, comprising: a first determining module, configured to determine whether the target module reads the interface address of the controller corresponding to the target module during the initialization process of the target module; a second determining module, configured to determine a first interaction state between the target module and the controller when the target module reads the interface address of the controller corresponding to the target module; and a calling module, configured to call a retry function to determine a second interaction state between the target module and the controller when the first interaction state indicates that the interaction between the target module and the controller is abnormal.
[0015] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and the computer program is configured to perform the steps in any of the above method embodiments when it is run.
[0016] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0017] This application addresses the issue that, during the initialization of the target module, it first determines whether the target module has read the interface address of the controller corresponding to it. Then, it determines the interaction state between the target module and the controller. If the target module has already read the interface address of the controller, but the interaction between the target module and the controller fails, a retry function is invoked to determine the second interaction state between the target module and the controller. Therefore, this solves the problem of not being able to detect IPMI module loading failures during system startup and the inability to automatically resolve loading failures. Attached Figure Description
[0018] Figure 1 This is a hardware structure block diagram of a computer terminal for a method of determining an interaction state according to an embodiment of this application.
[0019] Figure 2 This is a flowchart of a method for determining the interaction state according to an embodiment of this application;
[0020] Figure 3 This is a flowchart of the retry method for loading the IPMI module during the Linux system startup process according to an embodiment of this application;
[0021] Figure 4 This is a flowchart illustrating the definition of the retry function according to an embodiment of this application;
[0022] Figure 5This is a flowchart illustrating the causes and solutions for IPMI module initialization failure according to an embodiment of this application;
[0023] Figure 6 This is a structural block diagram of an interaction state determination device according to an embodiment of this application. Detailed Implementation
[0024] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0026] The methods and embodiments provided in this application can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a hardware structure block diagram of a computer terminal for a method of determining an interaction state according to an embodiment of this application. For example... Figure 1 As shown, a computer terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0027] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the method for determining the interaction state in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0028] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0029] Figure 2 This is a flowchart of a method for determining the interaction state according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:
[0030] Step S202: During the initialization process of the target module, determine whether the target module has read the interface address of the controller corresponding to the target module;
[0031] It is understandable that the target module mentioned above can be a driver module, such as an IPMI module.
[0032] Step S204: If the target module reads the interface address of the controller corresponding to the target module, determine the first interaction state between the target module and the controller;
[0033] Step S206: If the first interaction state indicates that the target module and the controller are interacting abnormally, a retry function is called to determine the second interaction state between the target module and the controller.
[0034] Understandably, an interaction anomaly between the target module and the controller can be caused by the target module failing to send a control request to the controller, the target module failing to receive a request returned by the controller, the controller failing to receive a control request sent by the target module, or the controller failing to return a request to the target module.
[0035] Through the above steps, during the initialization process of the target module, it is first determined whether the target module has read the interface address of the controller corresponding to the target module. Then, the interaction state between the target module and the controller is determined. If the target module has already read the interface address of the controller corresponding to the target module, but the interaction between the target module and the controller fails, a retry function is called to determine the second interaction state between the target module and the controller. This solves the problem of not being able to detect the IPMI module loading failure state during system startup and not being able to automatically resolve loading failures.
[0036] Step S206 above can be implemented by the following method, including: calling a retry function to determine the second interaction state between the target module and the controller, including: retry steps: determining whether the timer corresponding to the retry function has timed out; if the timer has not timed out, controlling the target module to send an operation command to the controller within a preset time, so as to determine the second interaction state between the target module and the controller based on the execution result of the operation command; if the second interaction state indicates that the interaction between the target module and the controller is abnormal, updating the timing duration of the timer; repeatedly executing the retry steps until it is determined that the second interaction state indicates that the interaction between the target module and the controller is successful.
[0037] The retry function mentioned above is used when the target module can receive the interface address of the controller corresponding to the target module, but cannot successfully interact with the controller. It can be the retry function.
[0038] By calling the retry function, it is determined whether the timer corresponding to the retry function has timed out. The duration of the timer can be determined according to the actual situation and is not specifically limited, such as 1000ms, 2000ms, etc. If the timer has not timed out, the target module sends an operation command to the controller to determine the second interaction state. If the second interaction state still indicates that the interaction between the target module and the controller is abnormal, the duration of the timer can be updated, for example, by decrementing the duration by 10ms each time. Then, based on the updated duration, it is determined whether to repeat the above steps of determining the interaction state until it is determined that the second interaction state indicates that the interaction between the target module and the controller is successful or the timer has timed out.
[0039] Furthermore, the above solutions can improve the initialization efficiency of the target module, thereby improving the stability and management efficiency of the system corresponding to the target module, and ultimately enhancing the security and maintainability of the system corresponding to the target module.
[0040] Optionally, after determining whether the timer corresponding to the retry function has timed out, the method further includes: if the timer times out, prohibiting the call to the retry function and obtaining first log information, wherein the first log information is used to indicate the running log information of the call to the retry function; and determining the reason for the initialization failure of the target module based on the first log information.
[0041] Understandably, if the timer times out, calling the retry function is prohibited; that is, the retry function exits, and the first log information indicating the retry function call is obtained. Further, the reason for the target module initialization failure is determined based on the first log information.
[0042] In other words, if the timer times out, it can be determined that calling the retry function did not resolve the initialization failure of the target module. Therefore, if the timer times out, it is necessary to determine the reason for the initialization failure of the target module.
[0043] Obtaining the first log information and determining the cause of the target module initialization failure based on the first log information can improve the efficiency and accuracy of fault diagnosis and ensure system stability and reliability.
[0044] Furthermore, after obtaining the first log information and determining the reason for the target module initialization failure based on the first log information, the correspondence between the first log information and the preset solution library can be obtained. The preset solution library may include solutions such as IPMI firmware that may need to be updated or re-flashed, or IPMI configuration network settings errors. Further, it is determined whether the preset solution library contains a solution corresponding to this target module initialization failure. If so, the solution is determined based on the above correspondence. If not, the first log information is sent to the user.
[0045] Based on the above solution, the problem of target module initialization failure can be further solved, and the initialization efficiency of the target module can be improved.
[0046] Optionally, after determining whether the target module has read the interface address of the controller corresponding to the target module, the method further includes: if the target module has not read the interface address of the controller corresponding to the target module, determining whether to restart the input / output system corresponding to the target module, wherein the input / output system is used to send the interface address of the controller to the target module; if it is determined to restart the input / output system, calling a restart function to restart the input / output system.
[0047] The above technical solution stipulates that if the target module fails to read the interface address of the controller corresponding to the target module, it may be due to an error in the target module's reading of the controller's interface address. This indicates a problem in the interaction between the input / output system storing the interface address and the target module. Therefore, it is necessary to determine whether the input / output system needs to be restarted. If restarting the input / output system is determined, a restart function is called to restart the system. This restart function can be the `reboot` function.
[0048] By automatically restarting the input / output system to resolve the issue of the target module being unable to read the interface address of the controller corresponding to the target module, the security and maintainability of the system corresponding to the target module can be improved.
[0049] Optionally, if the target module fails to read the interface address of the controller corresponding to the target module, after determining whether to restart the input / output system corresponding to the interface address, the method further includes: if it is determined not to restart the input / output system, obtaining second log information; and determining the reason for the initialization failure of the target module based on the second log information.
[0050] If it is determined that the input / output system will not be restarted, it is necessary to obtain the second log information, which may include the runtime log information used to indicate the call to the restart function, and then determine the reason for the target module initialization failure based on the second log information.
[0051] Optionally, determining whether the target module has read the interface address of the controller corresponding to the target module includes: setting monitoring options and determining whether to start the monitoring function corresponding to the monitoring options; if the monitoring function is started, determining whether the target module has read the interface address of the controller corresponding to the target module.
[0052] The above technical solution limits whether the initialization process of the target module can be monitored. This can be achieved by setting monitoring options and determining whether to enable the corresponding monitoring function. If the monitoring function is enabled, the initialization process of the target module can be monitored, and it can then be determined whether the target module has read the interface address of the controller corresponding to the target module based on the monitoring function corresponding to the monitoring option. Furthermore, if the monitoring function is not enabled, the initialization process of the target module cannot be monitored, and it cannot be determined whether the target module has read the interface address of the controller corresponding to the target module.
[0053] With the monitoring function enabled, determining whether the target module has read the interface address of the controller corresponding to the target module based on the monitoring function corresponding to the monitoring option can improve troubleshooting efficiency and enhance system maintainability. Furthermore, this embodiment of the application allows for the optional monitoring of the target module's initialization process, increasing system flexibility.
[0054] Optionally, a retry function is invoked to determine the second interaction state between the target module and the controller, including: identifying an abnormal operation command, writing the operation command as a variable into the target parameter of the retry function to retry the operation command; obtaining the execution result of the operation command; and determining the second interaction state between the target module and the controller based on the execution result of the operation command.
[0055] Understandably, the retry function includes a target parameter for writing the operation command that contains an exception. When an exception is determined to exist, the exception can be written into the target parameter, thus enriching the operation command in the retry function. Furthermore, after retrying the operation command, the retry function obtains the execution result of the operation command, thereby determining the second interaction state between the target module and the controller.
[0056] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0057] To better understand the process of determining the interaction state described above, the implementation flow of the method for determining the interaction state will be further explained below with reference to optional embodiments, but this is not intended to limit the technical solution of the embodiments of this application.
[0058] This application proposes a retry method for loading the IPMI module during the Linux system startup process. Figure 3 This is a flowchart of the retry method for loading the IPMI module during the Linux system startup process according to an embodiment of this application, as follows: Figure 3 As shown:
[0059] Step S301: Determine whether the BIOS (i.e., input / output system) has the detection function enabled.
[0060] In the BIOS setup interface, an IPMI monitoring option can be added. This monitoring option passes the option settings to the OS by writing system configuration and power management information (Advanced Configuration and Power Interface, or ACPI table) to determine whether to monitor the IPMI module.
[0061] If the BIOS setting option is enabled, the retry function is called to perform IPMI monitoring, and then step S302 is executed. If disabled, the retry function is not called to perform IPMI monitoring, and step S306 is executed, and the system starts normally.
[0062] Step S302: Define the retry function in the kernel.
[0063] Figure 4 This is a flowchart illustrating the definition of the retry function according to an embodiment of this application, as follows: Figure 4 As shown:
[0064] Step S401, an abnormal command occurred.
[0065] Define a global retry function with a command parameter in the function variable. When calling the function, you need to pass in the corresponding command, which is the command that corresponds to the error reported by the IPMI module.
[0066] Add a check during the IPMI driver module loading process. If a problem occurs, call the defined retry function and pass the problematic command as a variable to the retry function.
[0067] Step S402: Set the timeout period to 1000ms.
[0068] Define a timeout value in the retry function, which can be set to 1000ms. If the retry process cannot be completed within the timeout period, exit directly and continue system startup.
[0069] Step S403: Determine whether the timeout is greater than or equal to 0. If the timeout is greater than or equal to 0, proceed to step S404; if the timeout is less than 0, proceed to step S408.
[0070] Check if the timeout value is greater than or equal to 0. If the condition is met, execute the command and check its execution result. If the execution result is pass, call the break function to exit the loop and return 0. If the execution result is failure, decrement the timeout by 10ms each time and continue to the next iteration of the loop.
[0071] Step S404, execution failed with an error code.
[0072] Step S405: Determine whether the execution was successful. If the execution was successful, proceed to step S407. If the execution was unsuccessful, proceed to step S406.
[0073] Step S406: Decrement the timeout by 10ms.
[0074] Step S407: Call the break function to exit the retry function.
[0075] Step S408: Record error log information.
[0076] Step S409: Exit the retry function.
[0077] If the command fails to execute within the loop count, the retry function exits immediately, logging the error details and the cause for analysis by development. After logging is complete, a non-zero value is returned.
[0078] Step S303: Determine whether the IPMI module has been successfully initialized. If the IPMI module has been successfully initialized, proceed to step S304. If the IPMI module has failed to initialize, proceed to step S306.
[0079] The system reads the ACPI table. If IPMI monitoring is enabled, the `retry` function is called to monitor the IPMI module. If IPMI monitoring is disabled, IPMI monitoring is exited, and the system restarts normally. When the system boots and loads the IPMI driver module, it monitors the read input / output base address (I / O base address, equivalent to the interface address in the above embodiment) and the return value of the IPMI-BMC interaction. If both return success, the IPMI driver module initializes successfully, and execution continues, allowing the system to boot normally.
[0080] Figure 5 This is a flowchart illustrating the causes and solutions for IPMI module initialization failure according to an embodiment of this application, such as... Figure 5 As shown:
[0081] The IPMI module initialization failure may be due to the following two reasons:
[0082] 1) Abnormal interaction between BIOS and IPMI;
[0083] 2) Abnormal interaction between BIOS and BMC.
[0084] Step S501: Load the IPMI module.
[0085] Step S502: Determine whether to read the ACPI table. If the ACPI table is read, proceed to step S503. If the ACPI table is not read, proceed to step S513.
[0086] Step S503: Determine whether IPMI loading is successful. If loading is successful, proceed to step S508. If loading fails, proceed to step S504.
[0087] Step S504: Determine the error type.
[0088] If the error type is BIOS and BMC interaction error, proceed to step S505; if the error type is BIOS and IPMI interaction error, proceed to step S510.
[0089] Step S505: Call the retry function to retry.
[0090] Step S506: Determine whether the return value of retry is a preset value. If it is a preset value, proceed to step S509. If the return value is not a preset value, proceed to step S507.
[0091] Step S507: IPMI loading failed, and the reason for the failure was recorded.
[0092] Step S508, the system starts normally.
[0093] Step S509: IPMI loaded successfully, system started.
[0094] When an anomaly occurs in monitoring the IPMI driver module's I / O base address reading, i.e., the I / O base address cannot be read, the BMC system interface cannot be found, and the IPMI driver module initialization fails. The inability to read the I / O base address indicates that the I / O base address passed to the system by the BIOS is empty. This is due to a problem in the interaction between the BIOS and the BMC. When this problem occurs, a prompt is given, asking whether a reboot is needed to reinitialize the BIOS. If yes, the reboot function is called to start the system. If no, the error log and IPMI module initialization failure information are recorded, and the IPMI module initialization process exits, while the operating system continues to reboot.
[0095] Step S510, IPMI fails to initialize, restart BIOS.
[0096] Step S511 prompts whether a restart is required. If a restart is required, proceed to step S511. If a restart is not required, proceed to step S513.
[0097] Step S512: Call the reboot function to restart.
[0098] Step S513, the system continues to start up.
[0099] If the I / Obase address passed by the BIOS is normal, the IPMI module can find the system interface and proceed with further initialization. During initialization, the IPMI module interacts with the BMC via the I / Obase address passed by the BIOS. If the BMC and IPMI processes restart during this interaction, indicating an error in the interaction between the system IPMI module and the BMC, the `retry()` function is called to retry. If the retry is successful, initialization continues and the ` / dev / IPMIO` device is created. If the process does not complete within the specified time, the reason for the failure is logged, and the startup continues.
[0100] Step S304: Call the retry function.
[0101] Step S305: Return the reset result.
[0102] The result of Reset is the result after calling retry.
[0103] Step S306: Continue execution, i.e., start the system.
[0104] This application proposes a retry method for loading the IPMI module during Linux system startup. Specifically, a `retry` function is added to the kernel code. Calling the `retry` function triggers a retry mechanism. If the retry is successful, startup continues. If the retry fails, multiple retries are performed. If the retry still fails within a certain period, the reason for the failure is recorded in the log. This method primarily monitors the IPMI module loading status during system startup and takes appropriate action based on the monitoring status.
[0105] This embodiment also provides an interaction state determination device, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0106] Figure 6 This is a structural block diagram of the interaction state determination device according to an embodiment of this application, such as... Figure 6 As shown, the device includes:
[0107] The first determining module 62 is used to determine whether the target module has read the interface address of the controller corresponding to the target module during the initialization process of the target module;
[0108] The second determining module 64 is used to determine the first interaction state between the target module and the controller when the target module reads the interface address of the controller corresponding to the target module;
[0109] Module 66 is used to call a retry function when the first interaction state indicates that the target module and the controller are interacting abnormally, so as to determine the second interaction state between the target module and the controller.
[0110] Using the aforementioned device, during the initialization process of the target module, it first determines whether the target module has read the interface address of the controller corresponding to the target module, and then determines the interaction state between the target module and the controller. If the target module has already read the interface address of the controller corresponding to the target module, but the interaction between the target module and the controller fails, a retry function is called to determine the second interaction state between the target module and the controller. Therefore, the problem of not being able to detect the IPMI module loading failure state during system startup and the inability to automatically resolve loading failures can be solved.
[0111] In an exemplary embodiment, the calling module 66 is further configured to determine whether the timer corresponding to the retry function has timed out; if the timer has not timed out, control the target module to send an operation command to the controller within a preset time, so as to determine the second interaction state between the target module and the controller based on the execution result of the operation command; if the second interaction state indicates that the interaction between the target module and the controller is abnormal, update the timing duration of the timer; and repeatedly execute the retry step until it is determined that the second interaction state indicates that the interaction between the target module and the controller is successful.
[0112] The retry function mentioned above is used when the target module can receive the interface address of the controller corresponding to the target module, but cannot successfully interact with the controller. It can be the retry function.
[0113] By calling the retry function, it is determined whether the timer corresponding to the retry function has timed out. The duration of the timer can be determined according to the actual situation and is not specifically limited, such as 1000ms, 2000ms, etc. If the timer has not timed out, the target module sends an operation command to the controller to determine the second interaction state. If the second interaction state still indicates that the interaction between the target module and the controller is abnormal, the duration of the timer can be updated, for example, by decrementing the duration by 10ms each time. Then, based on the updated duration, it is determined whether to repeat the above steps of determining the interaction state until it is determined that the second interaction state indicates that the interaction between the target module and the controller is successful or the timer has timed out.
[0114] In an exemplary embodiment, the calling module 66 is further configured to, in the event of a timer timeout, prohibit the calling of the retry function and obtain first log information, wherein the first log information is used to indicate the running log information of the calling retry function; and determine the reason for the initialization failure of the target module based on the first log information.
[0115] Understandably, if the timer times out, calling the retry function is prohibited; that is, the retry function exits, and the first log information indicating the retry function call is obtained. Further, the reason for the target module initialization failure is determined based on the first log information.
[0116] In other words, if the timer times out, it can be determined that calling the retry function did not resolve the initialization failure of the target module. Therefore, if the timer times out, it is necessary to determine the reason for the initialization failure of the target module.
[0117] In one exemplary embodiment, the apparatus further includes: a third determining module, configured to determine whether to restart the input / output system corresponding to the target module if the target module fails to read the interface address of the controller corresponding to the target module, wherein the input / output system is configured to send the interface address of the controller to the target module; and if it is determined that the input / output system should be restarted, to call a restart function to restart the input / output system.
[0118] In an exemplary embodiment, the third determining module is further configured to, if it is determined that the input / output system should not be restarted, acquire second log information; and determine the reason for the initialization failure of the target module based on the second log information.
[0119] In an exemplary embodiment, the first determining module 62 is further configured to set monitoring options and determine whether to start the monitoring function corresponding to the monitoring option; if it is determined that the monitoring function is started, it determines whether the target module reads the interface address of the controller corresponding to the target module.
[0120] The above technical solution limits whether the initialization process of the target module can be monitored. This can be achieved by setting monitoring options and determining whether to enable the corresponding monitoring function. If the monitoring function is enabled, the initialization process of the target module can be monitored, and it can then be determined whether the target module has read the interface address of the controller corresponding to the target module based on the monitoring function corresponding to the monitoring option. Furthermore, if the monitoring function is not enabled, the initialization process of the target module cannot be monitored, and it cannot be determined whether the target module has read the interface address of the controller corresponding to the target module.
[0121] In an exemplary embodiment, the calling module 66 is further configured to determine an abnormal operation command, write the operation command as a variable into the target parameter of the retry function to retry the operation command; obtain the execution result of the operation command; and determine a second interaction state between the target module and the controller based on the execution result of the operation command.
[0122] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.
[0123] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0124] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0125] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0126] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0127] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0128] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for determining an interaction state, characterized in that, include: During the initialization process of the target module, it is determined whether the target module has read the interface address of the controller corresponding to the target module. The target module is the Intelligent Platform Management Interface (IPMI) module, and the controller is the Embedded Management Microcontroller (BMC). If the target module reads the interface address of the controller corresponding to the target module, the first interaction state between the target module and the controller is determined; If the first interaction state indicates that the target module and the controller are interacting abnormally, a retry function is invoked to determine the second interaction state between the target module and the controller; The retry function, used to determine the second interaction state between the target module and the controller, includes the following steps: First, determining whether the timer corresponding to the retry function has timed out. If the timer has not timed out, controlling the target module to send an operation command to the controller within a preset time, and determining the second interaction state between the target module and the controller based on the execution result of the operation command. If the second interaction state indicates an abnormal interaction between the target module and the controller, updating the timer's duration. The retry steps are executed repeatedly until the second interaction state indicates a successful interaction between the target module and the controller. The process of calling a retry function to determine the second interaction state between the target module and the controller includes: identifying an abnormal operation command; writing the operation command as a variable into the target parameter of the retry function to retry the operation command; obtaining the execution result of the operation command; and determining the second interaction state between the target module and the controller based on the execution result of the operation command.
2. The method according to claim 1, characterized in that, After determining whether the timer corresponding to the retry function has timed out, the method further includes: In the event of a timer expiration, the retry function is disabled, and first log information is obtained, wherein the first log information is used to indicate the running log information of the retry function call; The reason for the initialization failure of the target module is determined based on the first log information.
3. The method according to claim 1, characterized in that, After determining whether the target module has read the interface address of the controller corresponding to the target module, the method further includes: If the target module fails to read the interface address of the controller corresponding to the target module, determine whether to restart the input / output system corresponding to the target module, wherein the input / output system is used to send the interface address of the controller to the target module; If it is determined that the input / output system needs to be restarted, the restart function is invoked to restart the input / output system.
4. The method according to claim 3, characterized in that, If the target module fails to read the interface address of the controller corresponding to the target module, after determining whether to restart the input / output system corresponding to the interface address, the method further includes: If it is determined that the input / output system will not be restarted, obtain the second log information; The reason for the target module initialization failure is determined based on the second log information.
5. The method according to claim 1, characterized in that, Determining whether the target module has read the interface address of the controller corresponding to the target module includes: Configure monitoring options and determine whether to enable the monitoring function corresponding to the configured monitoring option; If the monitoring function is activated, determine whether the target module has read the interface address of the controller corresponding to the target module.
6. A device for determining an interactive state, characterized in that, include: The first determining module is used to determine whether the target module has read the interface address of the controller corresponding to the target module during the initialization process of the target module. The target module is an intelligent platform management interface (IPMI) module, and the controller is an embedded management microcontroller (BMC). The second determining module is used to determine the first interaction state between the target module and the controller when the target module reads the interface address of the controller corresponding to the target module; The calling module is used to call a retry function when the first interaction state indicates that the target module and the controller are in an abnormal interaction, so as to determine the second interaction state between the target module and the controller; The calling module is further configured to perform a retry step: determine whether the timer corresponding to the retry function has timed out; if the timer has not timed out, control the target module to send an operation command to the controller within a preset time, so as to determine the second interaction state between the target module and the controller based on the execution result of the operation command; if the second interaction state indicates that the interaction between the target module and the controller is abnormal, update the timing duration of the timer; and repeatedly execute the retry step until it is determined that the second interaction state indicates that the interaction between the target module and the controller is successful. The calling module is further configured to: identify any abnormal operation commands; write the operation commands as variables into the target parameters of the retry function to retry the operation commands; obtain the execution result of the operation commands; and determine the second interaction state between the target module and the controller based on the execution result of the operation commands.
7. 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 method described in any one of claims 1 to 5.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method, system and equipment for improving reliability of nor flash controller and storage medium
CN115357544A
Method of determining size of error and write control method for hard disc drive, hard disc drive using the write control method, and media storing computer programs for executing the methods
US20070014043A1