Method and apparatus for detecting link failure

CN117527649BActive Publication Date: 2026-09-15INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311541618.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-17
Publication Date
2026-09-15
Estimated Expiration
2043-11-17

AI Technical Summary

Technical Problem

[0005]本申请实施例提供了一种链路故障的检测方法和装置,以至少解决现有技术中链路故障的检测方式存在链路训练中故障检测的准确性较低的问题

Benefits of technology

[0016] This application employs a method that sets breakpoints in the code performing link training to automatically read the link training state and related parameters, and automatically captures information recorded in the link state log when an anomaly is detected, thereby determining the link state corresponding to the fault. Since the link log can be captured solely through code, there is no need to rely on external devices to capture the link training state machine when an anomaly occurs to determine the fault. This does not affect the physical layer of the target link, thus improving the efficiency of obtaining the link state log and consequently improving the accuracy of fault detection during link training. Therefore, it can solve the problem of low accuracy in fault detection during link training in existing link fault detection methods, achieving the technical effect of improving the accuracy of fault detection during link training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117527649B_ABST
    Figure CN117527649B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of link fault detection method and device, the method comprises: using preset code is carried out link training to target link, and the link state log of target link in link training process is recorded by log recorder, obtain a group of link state logs, preset code includes a group of preset breakpoints, each preset breakpoint in a group of preset breakpoints is used to trigger log recorder record the link state log of target link in one of multiple link states;From a group of link state logs, the parameter information of the link state parameter of target link in each link state in multiple link states is extracted;Based on the parameter information of the link state parameter of target link in each link state, the fault detection of target link is carried out, and the fault detection result is obtained, and the fault detection result is used to indicate multiple link states, and the link state of target link exists fault.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more specifically, to a method and apparatus for detecting link failures. Background Technology

[0002] Before a PCIe (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard) link can function properly, it needs to be trained. PCIe link training refers to the process of initializing the PCIe link's physical layer, port configuration information, transmit and receive modules, and related link states, as well as understanding the topology of the peer end of the link, ultimately enabling data communication between the devices at both ends of the PCIe link. If an anomaly occurs during PCIe link training, causing bandwidth or speed reduction, it is necessary to capture the link training state machine to determine at which stage the anomaly occurred.

[0003] In existing technologies, external devices (such as protocol analyzers) are typically used to capture the link training state machine during the link training process. Although this allows for a relatively comprehensive observation of the PCIe link training state, connecting a protocol analyzer can alter the physical link of the PCIe in some cases, resulting in the inability to capture state logs that record bandwidth and other relevant information in a timely manner when anomalies such as bandwidth reduction occur.

[0004] Therefore, existing link fault detection methods suffer from low accuracy in link training. Summary of the Invention

[0005] This application provides a method and apparatus for detecting link faults, which at least solves the problem that the accuracy of fault detection during link training is low in the prior art.

[0006] According to one embodiment of this application, a link fault detection method is provided, comprising: performing link training on a target link using preset code, and recording the link state log of the target link during the link training process using a logger to obtain a set of link state logs, wherein the target link is a data transmission channel between a server host and a peripheral device of the server, the link training state machine of the target link includes multiple link states, the preset code includes a set of preset breakpoints, each preset breakpoint in the set of preset breakpoints is used to trigger the logger to record the link state log of the target link in one of the multiple link states; extracting parameter information of the link state parameters of the target link in each of the multiple link states from the set of link state logs; and performing fault detection on the target link based on the parameter information of the link state parameters of the target link in each of the multiple link states to obtain a fault detection result, wherein the fault detection result is used to indicate that the target link has a faulty link state among the multiple link states.

[0007] In an exemplary embodiment, extracting parameter information of the link state parameters of the target link in each of the plurality of link states from the set of link state logs includes at least one of the following: extracting parameter information of the link parameters of the target link in each of the plurality of link states from the set of link state logs, wherein the link parameters include at least one of the following: link bandwidth, link rate; and extracting parameter information of the link switching parameters of the target link in each of the plurality of link states from the set of link state logs, wherein the link switching parameters are used to describe the state switching relationship from the corresponding link state to at least one of the plurality of link states.

[0008] In an exemplary embodiment, the step of performing fault detection on the target link based on the parameter information of the link state parameters of the target link in each link state to obtain a fault detection result includes: when the link state parameters include link parameters, determining whether there is a link state among the plurality of link states that satisfies a first fault condition, wherein the link parameters include at least one of the following: link bandwidth, link rate, and the first fault condition is that the parameter value of the link parameter of the target link in a link state does not belong to the parameter value range of the link parameter preset for the link state; and when there is a first link state among the plurality of link states that satisfies the first fault condition, generating a first detection result, wherein the first detection result is used to indicate that the first link state is a link state in which the target link has a fault.

[0009] In an exemplary embodiment, the step of performing fault detection on the target link based on the parameter information of the link state parameters of the target link in each link state to obtain a fault detection result includes: when the link state parameters include link switching parameters, determining whether there is a link state among the plurality of link states that satisfies a second fault condition, wherein the link switching parameters are used to describe the state switching relationship from the corresponding link state to at least one of the plurality of link states, and the second fault condition is that the state switching relationship indicated by the parameter information of the link switching parameters of the target link in a link state is inconsistent with the state switching relationship preset for the link state; and when there is a second link state among the plurality of link states that satisfies the second fault condition, generating a second detection result, wherein the second detection result is used to indicate that the second link state is a link state in which the target link has a fault.

[0010] In an exemplary embodiment, before performing link training on the target link using preset code, the method further includes: establishing a communication connection with the target client through a joint test workgroup debugger, wherein the driver of the joint test workgroup interface is integrated in the baseboard management controller of the server; and executing a link training configuration script in response to a link training configuration command sent by the target client received through the joint test workgroup interface; wherein the link training configuration command is used to trigger the execution of the link training configuration script, and the link training configuration script contains at least one of the following configuration commands: a configuration command for the number of test cycles, a configuration command for the interval time, a configuration command for the log storage path, and a configuration command for the log name, wherein the number of test cycles is the number of times the link training is performed on the target link, and the interval time is the pause time after each command is executed during the link training process of the target link.

[0011] In one exemplary embodiment, before performing link training on the target link using preset code, the method further includes: controlling the server to perform a restart operation in response to a received restart command, wherein the link training on the target link is performed during the server startup process.

[0012] In an exemplary embodiment, before performing link training on the target link using preset code, the method further includes: detecting the effective status of each preset breakpoint to determine whether each preset breakpoint has taken effect; if there are ineffective breakpoints in the set of preset breakpoints, continuously detecting the effective status of the ineffective breakpoints according to a preset period until the ineffective breakpoints have taken effect; wherein, link training on the target link is performed when all of the set of preset breakpoints have taken effect.

[0013] According to another embodiment of this application, a link fault detection device is provided, comprising: a first execution module, configured to perform link training on a target link using preset code, and record the link state log of the target link during the link training process using a log recorder to obtain a set of link state logs, wherein the target link is a data transmission channel between the host of a server and the peripheral device of the server, the link training state machine of the target link includes multiple link states, the preset code includes a set of preset breakpoints, each preset breakpoint in the set of preset breakpoints is used to trigger the log recorder to record the link state log of the target link in one of the multiple link states; an extraction module, configured to extract parameter information of the link state parameters of the target link in each of the multiple link states from the set of link state logs; and a first detection module, configured to perform fault detection on the target link based on the parameter information of the link state parameters of the target link in each of the multiple link states, and obtain a fault detection result, wherein the fault detection result is used to indicate that the target link has a faulty link state among the multiple link states.

[0014] 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.

[0015] 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.

[0016] This application employs a method that sets breakpoints in the code performing link training to automatically read the link training state and related parameters, and automatically captures information recorded in the link state log when an anomaly is detected, thereby determining the link state corresponding to the fault. Since the link log can be captured solely through code, there is no need to rely on external devices to capture the link training state machine when an anomaly occurs to determine the fault. This does not affect the physical layer of the target link, thus improving the efficiency of obtaining the link state log and consequently improving the accuracy of fault detection during link training. Therefore, it can solve the problem of low accuracy in fault detection during link training in existing link fault detection methods, achieving the technical effect of improving the accuracy of fault detection during link training. Attached Figure Description

[0017] Figure 1This is a schematic diagram of the hardware environment for a link failure detection method according to an embodiment of this application;

[0018] Figure 2 This is a flowchart illustrating a link failure detection method according to an embodiment of this application;

[0019] Figure 3 This is a flowchart illustrating another link failure detection method according to an embodiment of this application;

[0020] Figure 4 This is a schematic diagram of the detection result of a link failure according to an embodiment of this application;

[0021] Figure 5 This is a flowchart illustrating another link failure detection method according to an embodiment of this application;

[0022] Figure 6 This is a flowchart illustrating another link failure detection method according to an embodiment of this application;

[0023] Figure 7 This is a flowchart illustrating another link failure detection method according to an embodiment of this application;

[0024] Figure 8 This is a structural block diagram of a link fault detection device according to an embodiment of this application. Detailed Implementation

[0025] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.

[0026] 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.

[0027] The methods and embodiments provided in this application can be executed on a server device or a similar computing device. Taking running on a server device as an example, Figure 1 This is a hardware structure block diagram of a server device for a link failure detection method according to an embodiment of this application. Figure 1 As shown, the server device 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 server device 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 1The structure shown is for illustrative purposes only and does not limit the structure of the server equipment described above. For example, the server equipment may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0028] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the link failure detection method 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 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 server devices 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.

[0029] 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 server device. 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.

[0030] This embodiment provides a method for detecting link failures. Figure 2 This is a flowchart illustrating a link failure detection method according to an embodiment of this application, as shown below. Figure 2 As shown, the process includes the following steps:

[0031] Step S202: Use preset code to train the target link and record the link status log of the target link during the link training process through a logger to obtain a set of link status logs. The target link is the channel for data transmission between the server host and the server peripherals. The link training state machine of the target link contains multiple link states. The preset code contains a set of preset breakpoints. Each preset breakpoint in the set of preset breakpoints is used to trigger the logger to record the link status log of the target link in one of the multiple link states.

[0032] The link fault detection method in this embodiment can be applied to scenarios involving training a target link. The target link here can be a PCIe (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard) link. Link training is a hardware-based (non-software) process controlled by the physical layer. Its main purpose is to initialize the physical layer, port configuration information, and link status of the corresponding ports of the PCIe link, and to understand the topology of the peer end of the link so that devices at both ends of the PCIe link can communicate. During the PCIe link training process, the PCIe device performs a series of negotiations and tests to determine parameters such as link bandwidth, latency, and stability, thereby ensuring the reliability and performance of the link.

[0033] Before a PCIe link can function properly, it needs to be trained. The hardware logic for link training is implemented at the physical layer, and the entire training process is completed by the LTSSM (Link Training and Status State Machine), without the involvement of other layers.

[0034] The link training state machine resides within the physical layer of the PCIe bus. The physical layer's link training and LTSSM modules are responsible for configuring and initializing a device's physical layer, port transmitters and receivers, and associated links, using a state machine to manage and describe this process. The link training state machine encompasses 11 states, including Detect, Poll, Configure, Reset, L0, L0s, L1, L2, Hot Reset, Loopback, and Disable.

[0035] like Figure 3 As shown, when a connection is established between devices, the LTSSM starts in the detection state, then enters the polling state, waiting for the other party to confirm the connection. If confirmation is received, it enters the configuration state to configure the link. Afterward, the LTSSM enters the L0 state, indicating that the link is active. If a device requires a low-power state, it can enter the L0s or L1 state. If an error occurs, it may enter the L2 state or loopback state for repair.

[0036] In the above states, the detection state is the initial state entered after a basic reset or a software-generated hot reset command. It enters this state within 80ms of the reset. The detection state can also be entered from other states.

[0037] The polling state is the first period in the link training and initialization process, during which the two connected devices send PLPs (a type of data packet) to each other.

[0038] The main function of the configuration state is to assign a link number and a path number to each channel and remove the time difference between different paths on the same link.

[0039] The L0 state is the power state in which the PCIe link can function normally.

[0040] The L0s state indicates that the device is in a low-power state, but can still quickly return to the L0 state in a short time to respond to requests from the system.

[0041] The L1 state indicates that the device is in a more stringent low-power mode and it takes some time to return to the L0 state. In the L1 state, the device still receives signals from the system but does not transmit data.

[0042] The L2 state indicates that the device is in a minimum power consumption mode and it takes a long time to recover from it. At this time, the device can no longer respond to signals from the system. In the L2 state, the device will shut down its transmission channels to achieve the minimum power consumption state.

[0043] The reset state is the state that a PCIe link enters when it needs to be retrained. It will enter the reset state when an error is detected in the link signal, when it exits from the L0s or L1 low power state, or when the link speed needs to be adjusted.

[0044] Loopback mode refers to the state in which data is transmitted via a default "loopback" path between a pair of physical or logical channels on the PCIe bus. This state is used to test and diagnose the condition of PCIe devices and the bus. In PCIe loopback mode, the device sends and receives data, but the data does not leave the device; instead, it returns to the sending device through the physical or logical channel. This process can test the device's sending and receiving capabilities, as well as signal quality and latency. PCIe loopback mode can be used to test all PCIe layers, including the physical layer, data link layer, and transport layer.

[0045] The hot reset state is the state in which a PCIe device needs to be reset via software when an error occurs.

[0046] The disabled state is the state in which a device is disabled. When the driver for a PCIe device fails to load correctly or malfunctions during system startup, the device may enter the disabled state. In this case, the device will be disabled and cannot be used.

[0047] If an anomaly occurs during PCIe link training, causing bandwidth or speed reduction, it's necessary to capture the link training state machine to determine at which stage the anomaly occurred. Current technology typically uses external devices such as protocol analyzers to capture the link training state machine during training. However, in some cases, connecting a protocol analyzer alters the physical link, making it difficult to capture bandwidth-related state logs when anomalies such as bandwidth reduction occur, thus making it impossible to pinpoint the exact stage of the anomaly.

[0048] To address at least some of the aforementioned issues, this embodiment sets breakpoints in the power-on self-test (POST) related code. Upon encountering a breakpoint during code execution, the link training state machine for all PCIe ports is read, and the link bandwidth and speed of all ports are displayed. By automatically capturing the PCIe link training state machine logs, changes and anomalies in link bandwidth, link speed, and the current link training state machine state can be clearly observed throughout the entire link training process. This allows for monitoring of the PCIe link training process from a software perspective, freeing it from the constraints of external hardware connections. By capturing the PCIe link training state machine logs when an anomaly occurs, the stage at which the anomaly occurs can be identified, facilitating quick and easy troubleshooting without relying on external devices that might affect the link, thus improving the accuracy of the analysis.

[0049] It should be noted that the above method can be applied to various server chip architectures.

[0050] In this embodiment, the target link can be trained using preset code. This preset code can be a power-on self-test (POST) code or a portion of it. The preset code may contain a set of preset breakpoints. Each breakpoint can trigger a logger to record relevant information about the current target link's training, including parameter information such as the current link status parameters. These link status parameters indicate whether the target link is functioning correctly in its corresponding state. Parameters can be indicators of the current state or parameters related to data transmission in the current link, such as transmission speed and frequency. Breakpoints in the code are used to pause program execution.

[0051] It should be noted that each link status log in the above set of link status logs can correspond to a preset breakpoint. That is, when each preset breakpoint triggers the logger to record logs, a new log will be generated. Each link status log in the above set of link status logs can also correspond to a link status. That is, a link status log will record all relevant information for a link status.

[0052] During link training on the target link using the preset program, the `sls` command can be used to display the link bandwidth, link speed, and the current state of the link training state machine. After link training is complete, the `logsnapshot` command can be used to obtain a snapshot of the log recorder. The preset code can be a Python script (a computer language) to achieve automatic execution, automatic data collection, and automatic restart.

[0053] Step S204: Extract the parameter information of the link status parameters of the target link in each of the multiple link states from a set of link status logs.

[0054] In this embodiment, when a link training failure occurs (such as abnormal termination of training during link training), the parameter information of the link state parameters of the target link in each of the multiple link states can be extracted from a set of link state logs to determine the stage of the failure. Alternatively, the parameter information of the link state parameters of the target link in each of the multiple link states can be directly extracted from a set of link state logs to determine whether a failure has occurred and the stage of the failure. Here, the failure can be the link training process or an abnormal event occurring on the link.

[0055] The aforementioned stages can refer to the training state corresponding to the fault (i.e., one of the 11 states mentioned above). After determining the training state, the cause and location of the fault are determined based on the training state. For example, if the state corresponding to the fault is disabled, it can be determined that the PCIe device driver has malfunctioned.

[0056] Step S206: Based on the parameter information of the link state parameters of the target link in each link state, perform fault detection on the target link to obtain the fault detection result. The fault detection result is used to indicate the link state in which the target link has a fault among multiple link states.

[0057] In this embodiment, based on the parameter information of the link state parameters of the extracted target link in each link state, parameters whose parameter information does not meet the preset threshold or preset conditions can be found, and then the fault detection result can be determined based on the state corresponding to the found parameters.

[0058] like Figure 4 As shown, the fault detection results can include the identified link status that has failed, the abnormal data corresponding to the fault, and the inferred cause of the fault.

[0059] Through the above steps, the target link is trained using preset code, and the link state log of the target link during the training process is recorded by a logger, resulting in a set of link state logs. The target link is the data transmission channel between the server host and its peripherals. The target link's link training state machine contains multiple link states. The preset code contains a set of preset breakpoints. Each preset breakpoint triggers the logger to record the link state log of the target link in one of the multiple link states. The parameter information of the link state parameters of the target link in each of the multiple link states is extracted from the set of link state logs. Based on the parameter information of the link state parameters of the target link in each link state, fault detection is performed on the target link to obtain fault detection results. These results indicate which link states of the target link have faults, thus solving the problem of low accuracy in fault detection during link training in existing technologies and improving the accuracy of fault detection during link training.

[0060] The entities that perform the above steps can be servers, terminals, etc., but are not limited to these.

[0061] In one exemplary embodiment, parameter information of the link state parameters of the target link in each of multiple link states is extracted from a set of link state logs, including at least one of the following:

[0062] S11, extract the parameter information of the target link in each link state from a set of link state logs, wherein the link parameters include at least one of the following: link bandwidth, link rate;

[0063] S12, extract the parameter information of the link switching parameters of the target link in each link state from a set of link state logs. The link switching parameters are used to describe the state switching relationship from the corresponding link state to at least one of the multiple link states.

[0064] In this embodiment, the link parameter information may include link bandwidth and / or link rate. Link bandwidth is the maximum data capacity that can be transmitted in the link, representing the amount of data that the network transmission medium can transmit within a certain period. Link rate is the actual amount of data transmitted in the link. Both link bandwidth and link rate can be expressed in bits per second (bps).

[0065] In addition, the link parameter information can also include the link switching parameter information. By using the link switching parameter information, we can determine the two adjacent states during the link training process, that is, the current state and the previous state, thereby determining whether the state switching is normal.

[0066] This embodiment directly determines whether there are any abnormalities in link bandwidth / link rate or link switching based on the information recorded in the link status log, which can improve the comprehensiveness and efficiency of fault detection.

[0067] In an exemplary embodiment, fault detection is performed on the target link based on the parameter information of the link state parameters of the target link in each link state, and the fault detection result is obtained, including:

[0068] S21, when the link state parameters include link parameters, determine whether there is a link state that meets the first fault condition among multiple link states, wherein the link parameters include at least one of the following: link bandwidth, link rate, and the first fault condition is that the parameter value of the target link in a link state does not belong to the parameter value range of the link parameters preset for a link state.

[0069] S22, if there is a first link state that meets the first fault condition among multiple link states, a first detection result is generated, wherein the first detection result is used to indicate that the first link state is a link state in which the target link has a fault.

[0070] In this embodiment, a range of parameter values ​​can be preset for the link parameters. When the parameter value of the link parameter does not conform to the corresponding range, it is determined that the link parameter is abnormal. The current abnormal link status is determined according to the link status corresponding to the link parameter, thus completing the fault location.

[0071] It should be noted that the parameter value ranges corresponding to link bandwidth and link rate can be different. When the extracted link parameter is link bandwidth, the extracted bandwidth value can be compared with the preset parameter value range for bandwidth. When the extracted link parameter is link rate, the extracted rate value can be compared with the preset parameter value range for rate. Furthermore, the parameter value ranges corresponding to link bandwidth and / or link rate can also be different under different link states.

[0072] The first detection result generated above may include abnormal link bandwidth values ​​and / or abnormal link rate values, and may also include the link status corresponding to the abnormal link bandwidth values ​​and / or abnormal link rate values. Furthermore, it may include possible causes of the fault analyzed based on the abnormal values ​​and link status.

[0073] In this embodiment, since link bandwidth / link rate can generally indicate the data transmission status between at least two transmission modules, fault location based on abnormal data in link bandwidth and / or link rate can improve the accuracy and efficiency of fault location during link training.

[0074] In an exemplary embodiment, fault detection is performed on the target link based on the parameter information of the link state parameters of the target link in each link state, and the fault detection result is obtained, including:

[0075] S31, when the link state parameters include link switching parameters, determine whether there is a link state that satisfies the second fault condition among the multiple link states, wherein the link switching parameters are used to describe the state switching relationship from the corresponding link state to at least one of the multiple link states, and the second fault condition is that the state switching relationship indicated by the parameter information of the link switching parameters of the target link in a link state is inconsistent with the state switching relationship preset for a link state.

[0076] S32, if there is a second link state that meets the second fault condition among multiple link states, a second detection result is generated, wherein the second detection result is used to indicate that the second link state is a link state in which the target link has a fault.

[0077] In this embodiment, the switching order between different states can be preset. It should be noted that the preset state switching order can be the switching order of the 11 states mentioned in the previous embodiments, and the specific switching order can be as follows: Figure 3 As shown, this embodiment will not be described in detail here.

[0078] When a fault has been confirmed and it is necessary to determine the fault status from the data recorded in the logs, the status switching relationship of multiple link statuses recorded in the logs can be analyzed. If there is a link status whose status switching relationship indicated by the link switching parameter information is inconsistent with the preset status switching relationship for a link status, then that link status is the state in which the current fault has occurred.

[0079] If the link switching parameters for multiple link states indicate a state switching relationship that is inconsistent with the corresponding preset state switching relationship, the link state with the shortest time interval can be determined as the state where the current fault has occurred. The second detection result described above can display the faulty link state and the time of the fault occurrence, among other information.

[0080] This embodiment uses the link state switching relationship recorded in the log to determine the training state that does not switch according to the preset state switching relationship, which can improve the completeness of link training and the efficiency of fault location.

[0081] In one exemplary embodiment, before performing link training on the target link using preset code, the above method further includes:

[0082] S41 establishes a communication connection with the target client through the joint test workgroup debugger, wherein the driver for the joint test workgroup interface is integrated into the server's baseboard management controller;

[0083] S42, in response to the link training configuration command sent by the target client received through the joint test working group interface, execute the link training configuration script;

[0084] The link training configuration command is used to trigger the execution of the link training configuration script. The link training configuration script contains at least one of the following configuration commands: test cycle number configuration command, interval time configuration command, log storage path configuration command, and log name configuration command. The test cycle number is the number of times the target link is trained, and the interval time is the pause time after each command is executed during the link training process of the target link.

[0085] In this embodiment, the joint test group debugger can be used to control the target link for link training. Here, the joint test group debugger can be a JTAG (Joint Test Action Group) debugger.

[0086] The JTAG driver related to CPU debugging is integrated into the BMC. It establishes a connection with the local client over a network, enabling remote debugging of the server via JTAG. By configuring the target server's address and port number on the local client, a remote connection between JTAG and the server can be established. JTAG also allows configuration of the execution environment for CScripts (a set of code for debugging and verification). These scripts can be opened via the command line, allowing the execution of commands related to link training.

[0087] It should be noted that the number of states switched during each link training process can be different. For example, ... Figure 5 As shown, an ideal link training cycle could be: detection state - polling state - configuration state - L0 - L0s. However, during link training, when switching between detection state - polling state - configuration state - L0 - L0s, as... Figure 6As shown, if an exception occurs in the configuration state (such as configuration failure), it will not switch to L0, but will re-enter the detection state (i.e., the next link training begins). Therefore, this link training only includes the detection state, polling state, and configuration state.

[0088] The interval between each command execution can be used to save or record important data.

[0089] Optionally, since JTAG may be somewhat unstable, the JTAG can be reconnected and configured using the `reconnect` command before each link training session. Additionally, a delay can be added before reconnecting and configuring JTAG to allow sufficient execution time for the configuration command.

[0090] The number of test laps can be used to set the server restart time. Each server restart will re-start the link training from the detection state. Server restarts can be performed when an anomaly occurs during link training. Furthermore, considering that bandwidth reduction is probabilistic, multiple server restarts can reproduce this probabilistic bandwidth reduction phenomenon; therefore, server restarts can also be performed when no bandwidth reduction occurs during a single link training session.

[0091] Optionally, before training the target link using the preset code, the above method further includes:

[0092] In response to the received restart command, the server is controlled to perform a restart operation. The link training for the target link is performed during the server boot process.

[0093] Since the server boot process starts executing the self-test code, training the target link during the server boot process can make reasonable use of the breakpoints in the self-test code, thereby improving the efficiency of collecting relevant information about the link status.

[0094] The aforementioned restart command can be the io(0xcf9, 1, 0xe) command, which automatically shuts down and powers on the server to achieve automatic server restart. After the server restarts, the forcereconfig command (a command used to reload or reconfigure the configuration file of a system or application) can be used to reconfigure the JTAG debugger driver to achieve the best connection state with the server.

[0095] This embodiment demonstrates how using the joint test team debugger to remotely control the server can improve the efficiency and flexibility of link training.

[0096] In one exemplary embodiment, before performing link training on the target link using preset code, the above method further includes:

[0097] S61, Check the activation status of each preset breakpoint to determine whether each preset breakpoint has been activated;

[0098] S62, if there are inactive breakpoints in a set of preset breakpoints, continuously check the activation status of the inactive breakpoints according to a preset cycle until the inactive breakpoints have become active.

[0099] Link training for the target link is performed after a set of preset breakpoints have been activated.

[0100] It should be noted that the breakpoints in this embodiment can be based on the CPU sockets (Central Processing Unit sockets) on the server. The socket provides a connection point for inserting the CPU into the computer motherboard. All CPU sockets on the server can be detected by scanning with the `refresh` command (a command used to reload or update data). The number of CPUs on the server can be determined by the detected CPU sockets. Based on the number of CPUs, the `biosscratchpad6_cfg` command (a command used to configure and manage Basic Input / Output System settings) is used to set breakpoints according to the postcode. The postcode is a code used by the Basic Input / Output System to distinguish different steps and states during the Power-On Self-Test (POST) phase.

[0101] For pre-set breakpoints, their effectiveness can be checked before link training. This can be done by using the `biosnonstickyscratchpad7_cfg.show()` command to check if the breakpoint settings are effective. The return value determines whether the breakpoint is active. If the return value matches the preset value, the breakpoint is active. If the return value does not match the preset value, the breakpoint is inactive.

[0102] If a breakpoint is not active, the active status of the inactive breakpoint can be continuously checked according to a preset period, which can be a few seconds.

[0103] This embodiment uses a method to determine whether the set breakpoints are effective, which can prevent the omission of parameter information during link training due to the breakpoints not being effective, and improve the accuracy of fault detection.

[0104] The link failure detection method in this application embodiment is explained below with reference to optional examples. This optional example provides a method for automatically capturing the PCIe link training state machine during server startup. After establishing a remote connection between JTAG and the server, breakpoints are set to automatically capture the link training state machine logs. This allows for a direct view of the link bandwidth, link speed, and the entire training process, as well as any anomalies occurring on the link, avoiding the influence of protocol analyzers on the link.

[0105] like Figure 7 As shown, the process of the link failure detection method in this optional example may include the following steps:

[0106] Step 1: The JTAG driver related to CPU debugging is integrated into the BMC. It establishes a connection with the local client via the network, allowing remote debugging of the server via JTAG.

[0107] Step 2: Configure the target server's IP address and port number on the local client, and establish a remote connection with the server via JTAG.

[0108] Step 3: Configure the execution environment of the Cscripts script. Open the script with the command line and execute the commands in the following steps within the script.

[0109] Step 4: Set the number of test cycles and the interval time, and set the log storage path and name; the interval time is used to pause after each command is executed, allowing sufficient execution time for the relevant commands; the number of test cycles is used to set the number of times the server restarts.

[0110] Step 5: Reconnect and configure JTAG using the reconnect command.

[0111] Step 6: Add a delay to allow sufficient execution time for the JTAG configuration command.

[0112] Step 7: Automatically shut down and power on the server using the io(0xcf9, 1, 0xe) command to achieve automatic server restart.

[0113] Step 8: Use the forcereconfig command to reconfigure JTAG to ensure optimal connection.

[0114] Step 9: Use the refresh command to scan and discover all CPU sockets on the server.

[0115] Step 10: Use the biosscratchpad6_cfg command to set a breakpoint in the corresponding power-on self-test code of the Socket.

[0116] Step 11: Use the biosnonstickyscratchpad7_cfg.show() command to check if the breakpoint settings are effective. If they are not effective, read them again after a few seconds. Only proceed to the next step after confirming that the breakpoints are effective.

[0117] Step 12: Enable the LTSSM logger on the PCIe link to record changes in the link's state during training.

[0118] Step 13: Use the sls command to display the link bandwidth, link speed, and current LTSSM status.

[0119] Step 14: After the PCIe link training is complete, use the logsnapshot command to obtain a snapshot of the logger.

[0120] Step 15: Add judgment conditions to the script to print out bandwidth, speed, etc. that do not meet expectations.

[0121] Step 16: All logs related to the link training state machine will be saved in the path preset in step 4.

[0122] This optional example allows for analysis and location without relying on external devices that may affect the link, thus improving the accuracy of anomaly analysis.

[0123] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0124] 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 of the various embodiments of this application.

[0125] This embodiment also provides a link failure detection 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.

[0126] Figure 8 This is a structural block diagram of a link fault detection device according to an embodiment of this application, such as... Figure 8 As shown, the device includes:

[0127] The first execution module 802 is used to train the target link using preset code and record the link status log of the target link during the link training process through a log recorder to obtain a set of link status logs. The target link is the channel for data transmission between the server host and the server peripherals. The link training state machine of the target link contains multiple link states. The preset code contains a set of preset breakpoints. Each preset breakpoint in the set of preset breakpoints is used to trigger the log recorder to record the link status log of the target link in one of the multiple link states.

[0128] Extraction module 804 is used to extract parameter information of the link status parameters of the target link in each of the multiple link states from a set of link status logs.

[0129] The first detection module 806 is used to perform fault detection on the target link based on the parameter information of the link status parameters of the target link in each link state, and obtain the fault detection result. The fault detection result is used to indicate the link state in which the target link has a fault among multiple link states.

[0130] In this embodiment, a target link is trained using preset code, and the link status logs of the target link during the training process are recorded by a logger, resulting in a set of link status logs. The target link is the data transmission channel between the server's host and its peripherals. The target link's training state machine contains multiple link states. The preset code includes a set of preset breakpoints. Each preset breakpoint triggers the logger to record the link status log of the target link in one of the multiple link states. Parameter information of the link status parameters of the target link in each of the multiple link states is extracted from the set of link status logs. Based on the parameter information of the link status parameters of the target link in each link state, fault detection is performed on the target link to obtain fault detection results. These results indicate which link states of the target link have faults, thus solving the problem of low accuracy in fault detection during link training in existing link fault detection methods.

[0131] In one exemplary embodiment, the extraction module includes at least one of the following:

[0132] The first extraction submodule is used to extract parameter information of the target link in each link state from a set of link state logs, wherein the link parameters include at least one of the following: link bandwidth, link rate;

[0133] The second extraction submodule is used to extract the parameter information of the link switching parameters of the target link in each link state from a set of link state logs. The link switching parameters are used to describe the state switching relationship from the corresponding link state to at least one of multiple link states.

[0134] In one exemplary embodiment, the first detection module includes:

[0135] The first judgment submodule is used to determine whether there is a link state that meets the first fault condition among multiple link states when the link state parameters include link parameters. The link parameters include at least one of the following: link bandwidth, link rate, and the first fault condition is that the parameter value of the target link in a link state does not belong to the parameter value range of the link parameters preset for a link state.

[0136] The first generation submodule is used to generate a first detection result when there is a first link state that meets the first fault condition among multiple link states. The first detection result is used to indicate that the first link state is a link state in which the target link has a fault.

[0137] In one exemplary embodiment, the first detection module includes:

[0138] The second judgment submodule is used to determine whether there is a link state that meets the second fault condition among multiple link states when the link state parameters include link switching parameters. The link switching parameters are used to describe the state switching relationship from the corresponding link state to at least one of the multiple link states. The second fault condition is that the state switching relationship indicated by the parameter information of the link switching parameters of the target link in a link state is inconsistent with the state switching relationship preset for a link state.

[0139] The second generation submodule is used to generate a second detection result when there is a second link state that meets the second fault condition among multiple link states. The second detection result is used to indicate that the second link state is a link state in which the target link has a fault.

[0140] In one exemplary embodiment, the above-described apparatus further includes:

[0141] A module is established to establish a communication connection with the target client through the joint test workgroup debugger before link training is performed on the target link using preset code. The driver for the joint test workgroup interface is integrated into the baseboard management controller of the server.

[0142] The second execution module is used to execute the link training configuration script in response to the link training configuration command sent by the target client received through the joint test working group interface.

[0143] The link training configuration command is used to trigger the execution of the link training configuration script. The link training configuration script contains at least one of the following configuration commands: test cycle number configuration command, interval time configuration command, log storage path configuration command, and log name configuration command. The test cycle number is the number of times the target link is trained, and the interval time is the pause time after each command is executed during the link training process of the target link.

[0144] In one exemplary embodiment, the above-described apparatus further includes:

[0145] The control module is used to control the server to perform a restart operation in response to a received restart command before performing link training on the target link using preset code. The link training on the target link is performed during the server startup process.

[0146] In one exemplary embodiment, the above-described apparatus further includes:

[0147] The second detection module is used to detect the effective status of each preset breakpoint before using preset code to train the target link, so as to determine whether each preset breakpoint has been effective.

[0148] The third detection module is used to continuously detect the effective status of ineffective breakpoints according to a preset cycle when there are ineffective breakpoints in a set of preset breakpoints, until the ineffective breakpoints have become effective.

[0149] Link training for the target link is performed after a set of preset breakpoints have been activated.

[0150] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0151] 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.

[0152] 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.

[0153] 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.

[0154] 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.

[0155] 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.

[0156] 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.

[0157] 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 detecting link faults, characterized in that, include: The target link is trained using preset code, and the link status log of the target link during the link training process is recorded by a logger to obtain a set of link status logs. The target link is a data transmission channel between the server host and the server peripherals. The link training state machine of the target link contains multiple link states. The preset code contains a set of preset breakpoints. Each preset breakpoint in the set of preset breakpoints is used to trigger the logger to record the link status log of the target link in one of the multiple link states. The preset code is a power-on self-test code. Extract the parameter information of the link status parameters of the target link in each of the multiple link states from the set of link status logs; Based on the parameter information of the link state parameters of the target link in each link state, fault detection is performed on the target link to obtain a fault detection result, wherein the fault detection result is used to indicate the link state in which the target link has a fault among the multiple link states.

2. The method according to claim 1, characterized in that, The step of extracting the link state parameters of the target link in each of the multiple link states from the set of link state logs includes at least one of the following: Extract the parameter information of the target link in each link state from the set of link state logs, wherein the link parameters include at least one of the following: link bandwidth, link rate; Extract the parameter information of the link switching parameters of the target link in each link state from the set of link state logs, wherein the link switching parameters are used to describe the state switching relationship from the corresponding link state to at least one of the multiple link states.

3. The method according to claim 1, characterized in that, The step of performing fault detection on the target link based on the parameter information of the link state parameters of the target link in each link state, and obtaining fault detection results, includes: When the link state parameters include link parameters, it is determined whether there is a link state that satisfies the first fault condition among the multiple link states, wherein the link parameters include at least one of the following: link bandwidth, link rate, and the first fault condition is that the parameter value of the link parameter of the target link in a link state does not belong to the parameter value range of the link parameter preset for the link state. If a first link state that meets the first fault condition exists among the plurality of link states, a first detection result is generated, wherein the first detection result is used to indicate that the first link state is a link state in which the target link has a fault.

4. The method according to claim 1, characterized in that, The step of performing fault detection on the target link based on the parameter information of the link state parameters of the target link in each link state, and obtaining fault detection results, includes: When the link status parameters include link switching parameters, it is determined whether there is a link status that satisfies the second fault condition among the plurality of link statuses. The link switching parameters are used to describe the state switching relationship from the corresponding link status to at least one of the plurality of link statuses. The second fault condition is that the state switching relationship indicated by the parameter information of the link switching parameters of the target link in a link status is inconsistent with the state switching relationship preset for the link status. If a second link state that meets the second fault condition exists among the plurality of link states, a second detection result is generated, wherein the second detection result is used to indicate that the second link state is a link state in which the target link has a fault.

5. The method according to claim 1, characterized in that, Before performing link training on the target link using preset code, the method further includes: A communication connection is established with the target client through the joint test workgroup debugger, wherein the driver of the joint test workgroup debugger is integrated into the baseboard management controller of the server; In response to the link training configuration command sent by the target client and received through the joint test group debugger, the link training configuration script is executed; The link training configuration command is used to trigger the execution of the link training configuration script. The link training configuration script contains at least one of the following configuration commands: a test cycle configuration command, an interval time configuration command, a log storage path configuration command, and a log name configuration command. The test cycle number is the number of times the target link is trained. The interval time is the pause time after each command is executed during the link training process of the target link.

6. The method according to claim 1, characterized in that, Before performing link training on the target link using preset code, the method further includes: In response to the received restart command, the server is controlled to perform a restart operation, wherein link training for the target link is performed during the server startup process.

7. The method according to any one of claims 1 to 6, characterized in that, Before performing link training on the target link using preset code, the method further includes: The activation status of each preset breakpoint is detected to determine whether each preset breakpoint has been activated. If there are inactive breakpoints in the set of preset breakpoints, the activation status of the inactive breakpoints is continuously checked according to a preset period until the inactive breakpoints are activated. Link training for the target link is performed after all the preset breakpoints have taken effect.

8. A link fault detection device, characterized in that, include: The first execution module is used to train the target link using preset code and record the link status log of the target link during the link training process through a logger to obtain a set of link status logs. The target link is a data transmission channel between the server's host and the server's peripherals. The link training state machine of the target link contains multiple link states. The preset code contains a set of preset breakpoints. Each preset breakpoint in the set of preset breakpoints is used to trigger the logger to record the link status log of the target link in one of the multiple link states. The preset code is a power-on self-test code. The extraction module is used to extract parameter information of the link status parameters of the target link in each of the multiple link states from the set of link status logs; The first detection module is used to perform fault detection on the target link based on the parameter information of the link state parameters of the target link in each link state, and obtain a fault detection result, wherein the fault detection result is used to indicate the link state in which the target link has a fault among the multiple link states.

9. 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 7.

10. 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 7.

Citation Information

Patent Citations

  • Methods, devices and systems for transmitting and receiving failure state of computer system

    CN106547503A

  • Implied directory state updates

    CN112433683A