An on-site data saving method, device, equipment, medium and product

By enabling the backup interface to acquire field data when the PCIe connection is lost, the problem of PCIe devices being unable to save data after a connection loss is solved, ensuring data support for troubleshooting and diagnosis.

CN122363997APending Publication Date: 2026-07-10XIAMEN UNISOC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIAMEN UNISOC TECH CO LTD
Filing Date
2026-03-13
Publication Date
2026-07-10

Smart Images

  • Figure CN122363997A_ABST
    Figure CN122363997A_ABST
Patent Text Reader

Abstract

This disclosure relates to a method, apparatus, device, medium, and product for field data storage. The method includes: monitoring the link status of a first communication interface between a first device and a second device; when a disconnection of the first communication interface is detected, establishing a connection with the second device through a second communication interface; wherein the second communication interface is a backup interface independent of the first communication interface; sending a data request command to the second device through the second communication interface based on a preset protocol; wherein the data request command instructs the second device to read field data; receiving the field data returned by the second device through the second communication interface, and storing the field data. This disclosure can effectively solve the problem of being unable to obtain field data after the first communication interface is disconnected, thereby improving the fault tolerance capability when the interface fails and ensuring the smooth progress of fault analysis and problem diagnosis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of communication technology, and in particular to a method, apparatus, device, medium and product for field data storage. Background Technology

[0002] PCIe, as a high-speed bus standard, is widely used to connect application processors (APs) and communication processors (CPs) or peripheral devices. Before normal communication, the initialization, training, and state transition of the PCIe link are usually managed by the Link Training and Status State Machine (LTSSM) to ensure the establishment of a stable high-speed data connection.

[0003] However, PCIe devices are prone to disconnection due to hardware and software failures during actual operation. Most existing field data acquisition solutions rely on the PCIe bus itself for transmission, and once a disconnection occurs, they cannot work effectively. This means that when a disconnection occurs, the system cannot acquire and save the field data before the disconnection, which will seriously affect subsequent troubleshooting and diagnosis. Summary of the Invention

[0004] This disclosure provides a method, apparatus, device, medium, and product for field data storage.

[0005] According to a first aspect of this disclosure, a method for storing field data is provided, the method comprising:

[0006] Monitor the link status of the first communication interface between the first device and the second device; When a disconnection is detected in the first communication interface, a connection is established with the second device through the second communication interface; wherein, the second communication interface is a backup interface independent of the first communication interface; Based on a preset protocol, a data request command is sent to the second device through the second communication interface; wherein, the data request command is used to instruct the second device to read field data; Receive the field data returned by the second device through the second communication interface, and save the field data.

[0007] Furthermore, the first communication interface is a PCIe interface; the second communication interface includes at least one of the following: a Universal Asynchronous Receiver / Transmitter (UART) interface, an internal integrated circuit (I2C) interface, or a Serial Peripheral Interface (SPI) interface. The monitoring of the link status of the first communication interface between the first device and the second device includes: The link state is obtained by detecting the state of the link training state machine corresponding to the PCIe interface.

[0008] Furthermore, the step of establishing a connection with the second device through the second communication interface when the link of the first communication interface is detected to be disconnected includes: When the link of the first communication interface is detected to be disconnected, the state saving thread is started; In the field saving thread, a connection is established with the second device through the second communication interface, and a start command is sent to the second device to notify the second device to start the field saving process.

[0009] Furthermore, the step of sending a data request instruction to the second device through the second communication interface based on a preset protocol includes: Send a first data request instruction to the second device to request the second device to read memory data and peripheral register data at the target address; Send a second data request instruction to the second device to request the second device to read data from the central processing unit core register.

[0010] Further, receiving the field data returned by the second device through the second communication interface and saving the field data includes: The received field data is saved to memory; After receiving the field data, the field data in the memory is saved to the flash memory to obtain the target file; wherein, the target file contains the memory snapshot and register state of the second device before the link of the first communication interface is disconnected.

[0011] Furthermore, before monitoring the link status of the first communication interface between the first device and the second device, the method further includes: The system sends a synchronization command conforming to the preset protocol to the second device through the second communication interface to synchronize the devices.

[0012] According to a second aspect of this disclosure, a field data storage device is provided, the device comprising: The monitoring module is used to monitor the link status of the first communication interface between the first device and the second device; A connection module is used to establish a connection with the second device through a second communication interface when the link of the first communication interface is detected to be disconnected; wherein, the second communication interface is a backup interface independent of the first communication interface; The sending module is used to send a data request instruction to the second device through the second communication interface based on a preset protocol; wherein the data request instruction is used to instruct the second device to read field data; The receiving module is used to receive the field data returned by the second device through the second communication interface and save the field data.

[0013] According to a third aspect of this disclosure, an electronic device is provided. The electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the program to implement the method described above.

[0014] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the methods described above.

[0015] According to a fifth aspect of this disclosure, a computer program product is provided. The computer program product includes a computer program that, when executed by a processor, implements the methods described above in this disclosure.

[0016] This disclosure provides a method, apparatus, device, medium, and product for storing field data. First, the link status of a first communication interface between a first device and a second device is monitored. Then, when a disconnection of the first communication interface is detected, a connection is established with the second device via a second communication interface, wherein the second communication interface is a backup interface independent of the first communication interface. Next, based on a preset protocol, a data request instruction is sent to the second device via the second communication interface, wherein the data request instruction instructs the second device to read field data. Finally, the field data returned by the second device via the second communication interface is received and stored.

[0017] As described above, this embodiment of the present disclosure effectively overcomes the technical defects of existing field data acquisition schemes that rely heavily on the main communication bus itself, which prevents them from working effectively and acquiring field data once a link break occurs. This is achieved by promptly activating a second communication interface independent of the first communication interface as a backup channel to establish a connection and acquire field data when a link break is detected at the first communication interface. Furthermore, the field data storage method provided by this embodiment of the present disclosure bypasses the communication limitations of the paralyzed main communication link, ensuring that the system can still successfully capture and securely store the field data before the link break even in the event of a link break caused by a hardware or software failure. This provides crucial and reliable data support for subsequent troubleshooting, root cause location, and accurate diagnosis. Attached Figure Description

[0018] The above and other objects, features, and advantages of this disclosure will become more apparent from the more detailed description of the embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.

[0019] Figure 1 A flowchart illustrating an exemplary embodiment of this disclosure of a method for saving field data; Figure 2 One of the flowcharts for a field data storage method provided as another exemplary embodiment of this disclosure; Figure 3 A second flowchart illustrating a field data storage method provided for another exemplary embodiment of this disclosure; Figure 4 A third flowchart of a field data storage method provided for another exemplary embodiment of this disclosure; Figure 5 A schematic diagram illustrating the interaction between a first device and a second device provided in an exemplary embodiment of this disclosure; Figure 6 A schematic block diagram of the functional modules of a field data storage device provided for an exemplary embodiment of the present disclosure; Figure 7 A structural block diagram of an electronic device provided as an exemplary embodiment of this disclosure; Figure 8 A structural block diagram of a computer system provided as an exemplary embodiment of this disclosure; Figure 9 A structural block diagram of a computer program product provided for an exemplary embodiment of this disclosure. Detailed Implementation

[0020] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0021] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0022] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc., used in this disclosure are only used to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.

[0023] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0024] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0025] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0026] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0027] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device. It is understood that the above notification and user authorization process is merely illustrative and does not constitute a limitation on the implementation of this disclosure; other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0028] In one embodiment, such as Figure 1 As shown, a method for saving on-site data is provided, applied to a first device, including the following steps: Step 101: Monitor the link status of the first communication interface between the first device and the second device.

[0029] Here, the first device can monitor the link status of the first communication interface between itself and the second device. The first device and the second device can be any electronic device, chip, chip module, terminal device or base station device with data processing and communication capabilities.

[0030] In one possible embodiment, for example, the first device can be an application processor (AP) and the second device can be a communication processor (CP). The two devices interact with each other at high speed through a main communication bus. In addition, the first device can also be a central processing unit (CPU) and the second device can also be various high-speed peripherals, such as graphics processing units (GPUs), storage devices (such as NVMe solid-state drives), network interface cards (NICs), or artificial intelligence accelerator cards. It should be noted that the embodiments disclosed herein do not impose specific limitations on the specific type, model, and chip architecture of the first and second devices.

[0031] In one possible embodiment, the first communication interface is a PCIe interface, and monitoring the link status of the first communication interface between the first device and the second device further includes the following steps: The link state is obtained by detecting the state of the link training state machine corresponding to the PCIe interface.

[0032] In one possible embodiment, taking the first device as an application processor (AP) and the second device as a communication processor (CP), the AP can read the PCIe controller inside the AP or the status value of the link training and status machine (LTSSM) recorded in the status register of the PCIe interface on the AP side by periodic polling or hardware interrupt triggering.

[0033] Specifically, the LTSSM is the core state machine in the PCIe bus protocol used to manage link training, state transitions, and anomaly recovery. When the AP and CP are normally exchanging high-speed data, the LTSSM inside the AP usually remains stable in a normal transmission state, such as the L0 state. When the physical link between the AP and CP is disconnected due to hardware or software failure, electrostatic interference, or environmental anomalies, the state of the LTSSM will undergo an abnormal transition. The AP's underlying driver or state saving thread detects and parses the state words in the aforementioned state register. If it detects that the LTSSM's state has transitioned from the normal transmission state and eventually reverts to or remains in the link disconnected state, such as the state machine remaining in the Detect state and unable to complete the link training, or directly throwing the Link Down error flag, then the AP can accurately determine that the current first communication interface, i.e., the PCIe interface, is disconnected.

[0034] In this embodiment, the method of obtaining the link status by having the AP directly read its own internal underlying hardware state machine enables the AP to detect the link failure between the AP and the CP at the physical layer and data link layer in the first time. Compared with the traditional detection mechanism that relies on the upper layer application software to wait for timeout, the detection method of this embodiment greatly reduces the delay in fault detection and improves the real-time performance and accuracy of link status monitoring.

[0035] Step 102: When the link of the first communication interface is detected to be disconnected, a connection is established with the second device through the second communication interface.

[0036] Here, after monitoring the link status of the first communication interface between the first device and the second device, when the link of the first communication interface is detected to be disconnected, the first device can establish a connection with the second device through the second communication interface. The second communication interface is a backup interface independent of the first communication interface.

[0037] In one possible embodiment, the second communication interface includes at least one of the following: a Universal Asynchronous Receiver / Transmitter (UART) interface, an internal integrated circuit (I2C) interface, or a Serial Peripheral Interface (SPI) interface. The aforementioned UART interface, I2C interface, or SPI interface serves as a low-speed but highly reliable out-of-band communication channel independent of the PCIe main bus. Since its physical pins, transmission lines, and internal controller are completely isolated from the main communication bus, even if the first communication interface, such as the PCIe bus, experiences kernel-level blocking, bus hang, or power failure due to severe hardware or software faults, the second communication interface can still maintain physical layer connectivity unaffected by the main link failure.

[0038] In one possible embodiment, such as Figure 2As shown, when a disconnection is detected in the first communication interface, a connection is established with the second device through the second communication interface, including the following steps: Step 1021: When the link of the first communication interface is detected to be disconnected, start the field saving thread.

[0039] Here, after monitoring the link status of the first communication interface between the first device and the second device, the first device can start the field saving thread when it detects that the link of the first communication interface is disconnected.

[0040] In one possible embodiment, taking the first device as the application processor (AP), the second device as the communication processor (CP), and the first communication interface as a PCIe interface as an example, when the underlying driver on the AP side confirms a PCIe link disconnection (LinkDown) exception by querying the LTSSM status, the kernel or monitoring service on the AP side will immediately trigger an exception handling callback and create an independent context saving thread at the AP's operating system level. It should be noted that this context saving thread has a high scheduling priority in the system kernel, which is intended to ensure that even in extreme cases where the main communication link is paralyzed and system kernel resources are scarce, the AP can still execute the initialization task of the backup communication link, thereby avoiding the loss of context data due to the main system being suspended.

[0041] Step 1022: In the field saving thread, a connection is established with the second device through the second communication interface, and a start command is sent to the second device to notify the second device to start the field saving process.

[0042] Here, when the first device detects that the link of the first communication interface is disconnected, it starts the field saving thread. In the field saving thread, the first device establishes a connection with the second device through the second communication interface and sends a start command to the second device to notify the second device to start the field saving process.

[0043] In one possible embodiment, after the aforementioned scene save thread is started, the AP initializes the second communication interface by calling the underlying interface driver. The second communication interface can be at least one of a Universal Asynchronous Receiver / Transmitter (UART) interface, an internal integrated circuit (I2C) interface, or a Serial Peripheral Interface (SPI) interface. Taking the UART interface as an example, the AP configures the corresponding communication parameters to establish a communication channel independent of the PCIe bus. To achieve efficient transmission and storage of field data, this disclosure defines a dedicated SCSA (Scene Save Protocol). After establishing a physical connection, the AP and CP interact with each other via the second communication interface based on the SCSA protocol. The data packet format of the SCSA protocol is shown in the table below:

[0044] In one possible embodiment, for example, the Command Type field in the aforementioned SCSA protocol data packet supports a variety of preset operation instructions to fully cover the entire interactive process of field data saving. Specifically, the instructions defined in the Command Type field include at least the following: a synchronization instruction (e.g., 0x0000), which initializes the synchronization device for establishing the initial connection between the first device (e.g., AP) and the second device (e.g., CP); a start instruction (e.g., 0x0001), which notifies the CP to start the field saving process; a first data request instruction (e.g., req_data), which is the AP requesting memory and register data from the CP; and a second data request instruction (e.g., req_reg), which is the AP requesting memory and register data from the CP. 3) The AP requests CPU core register data from the CP; the CP executes a complete reply instruction (e.g., 0x0004), indicating that the command has been completed. The sequence number in the data packet is the sequence number of the complete reply instruction. If the reply is a first data request instruction (req_data), the payload contains the requested data. The CP executes an error reply instruction (e.g., 0x0005), indicating that the previous command execution failed. The payload contains the specific sequence number.

[0045] Using the protocol format shown in the table above, the field saving thread initiates data interaction through the second communication interface. Specifically, after completing the connection and protocol configuration, the process enters the data acquisition phase: First, the AP, as the master controller, constructs and sends a start command conforming to the SCSA protocol format to the CP. In this start command, the AP sets the "Command Type" field to a preset start identifier and fills the relevant start parameters (such as 0x0001) into the "Payload" field. After receiving the command packet through the second communication interface, the CP first performs data integrity verification through the "CRC" field. After confirming that the verification is successful, it parses the "Command Type" field. When the CP recognizes that the field is the start identifier, it confirms that it has entered the field saving mode and triggers its internal field saving program accordingly. During this process, the CP will cooperate in performing subsequent data extraction operations, such as freezing the current system context (including register values ​​and memory state), thereby preparing the field data to respond to the specific read requests subsequently issued by the AP.

[0046] In this embodiment, when the first device detects that the link of the first communication interface is disconnected, it starts the field saving thread. In the field saving thread, the first device establishes a connection with the second device through the second communication interface and sends a start command to the second device to notify the second device to start the field saving process.

[0047] As described above, this embodiment effectively avoids kernel-level suspension or system blocking caused by main communication bus failure of the first device by starting an independent field saving thread when the main link is disconnected, thus ensuring the independence and high priority of the backup channel establishment. Furthermore, this embodiment can promptly send a start command to the second device through the backup channel, which can trigger the second device to know about the link failure and quickly freeze the field state, thereby laying a reliable foundation for the safe and complete retrieval of field data before the failure and greatly improving the success rate and stability of data rescue in extreme abnormal scenarios.

[0048] Step 103: Based on the preset protocol, send a data request command to the second device through the second communication interface.

[0049] Here, when the first device detects that the link of the first communication interface is disconnected, it establishes a connection with the second device through the second communication interface. Then, the first device can send a data request command to the second device through the second communication interface based on a preset protocol. The data request command is used to instruct the second device to read the field data.

[0050] In one possible embodiment, such as Figure 3 As shown, based on a preset protocol, a data request command is sent to a second device through a second communication interface, including the following steps: Step 1031: Send a first data request instruction to the second device to request the second device to read memory data and peripheral register data at the target address.

[0051] Here, the first device can send a first data request instruction to the second device to request the second device to read memory data and peripheral register data at the target address.

[0052] In one possible embodiment, continuing the previous example, taking the first device as AP and the second device as CP, and the preset protocol as SCSA, after AP sends a start command and puts CP into field saving mode, AP begins to perform substantive data retrieval. Specifically, AP sends a first data request command conforming to the SCSA protocol, namely the req_data command, to CP through a second communication interface (such as a UART interface). The command word is, for example, 0x0002. In the data packet of this command, AP can specify the target memory address or peripheral register address to be read in the payload field. After CP receives and parses the req_data command through the second communication interface, it reads memory data and peripheral register data from the corresponding target address. After reading, CP sends an execution completion reply command (complete command, command word, for example, 0x0004) to AP according to the protocol, and places the read field data in the payload field of the complete command and returns it to AP.

[0053] Step 1032: Send a second data request instruction to the second device to request the second device to read data from the central processing unit core register.

[0054] Here, the first device can send a second data request instruction to the second device to request the second device to read data from the central processing unit core register.

[0055] In one possible embodiment, continuing the previous example, in order to obtain a lower-level system operating state, in addition to pulling ordinary memory and peripheral register data, the AP will also send a second data request instruction (i.e., req_reg instruction, command word for example 0x0003) conforming to the SCSA protocol to the CP through the second communication interface. This instruction is specifically used to request the CP to read its own central processing unit (CPU) core register data, such as the program counter, stack pointer, and the current snapshot state of various general-purpose registers. After receiving the req_reg instruction, the CP extracts the current CPU core register data, encapsulates it in the payload of the execution completion reply instruction (complete instruction), and sends it to the AP through the second communication interface.

[0056] As can be seen from the above description, through the cooperation of the first data request instruction (req_data) in step 1031 and the second data request instruction (req_reg) in step 1032, the first device can fully retrieve the complete hardware and software context state of the second device at the moment of disconnection, namely the memory snapshot, peripheral state and CPU kernel state.

[0057] Step 104: Receive the field data returned by the second device through the second communication interface and save the field data.

[0058] Here, after the first device sends a data request command to the second device through the second communication interface, it can receive the field data returned by the second device through the second communication interface and save the field data.

[0059] In one possible embodiment, such as Figure 4 As shown, receiving and saving the field data returned by the second device through the second communication interface includes the following steps: Step 1041: Save the received field data into memory.

[0060] Here, after the first device sends a data request command to the second device through the second communication interface, it can save the received field data into memory.

[0061] In one possible embodiment, taking the first device as an application processor (AP) and the second device as a communication processor (CP) as an example, the AP receives a data packet containing field data returned by the CP in response to a data request instruction through the second communication interface. For example, the complete instruction conforming to the above-mentioned SCSA protocol carries the requested data in its payload field. The AP parses the instruction packet and extracts the corresponding field data. Subsequently, the AP writes and saves the extracted field data to the system memory on the AP side for temporary storage.

[0062] Step 1042: After receiving the field data, save the field data in memory to flash memory to obtain the target file.

[0063] Here, after the first device completes the reception of the field data, it can save the field data in memory to flash memory to obtain the target file. The target file contains the memory snapshot and register state of the second device before the link of the first communication interface is disconnected.

[0064] In one possible embodiment, once the AP confirms that it has completed receiving all the required field data, including memory data at the target address, peripheral register data, and CPU core register data, the AP will summarize all the field data temporarily stored in its memory and save it to flash memory for permanent storage, thereby generating and obtaining a target file. This target file completely contains the memory snapshot and register state of the CP at the moment the main communication interface (such as the PCIe interface) link is disconnected. By saving this target file, R&D or testing personnel can restore the system fault scene before the link disconnection by exporting the target file after system restart or afterward, thereby providing accurate data support for troubleshooting and analyzing the cause of the link disconnection.

[0065] This disclosure provides a method, apparatus, device, medium, and product for storing field data. First, the link status of a first communication interface between a first device and a second device is monitored. Then, when a disconnection of the first communication interface is detected, a connection is established with the second device via a second communication interface, wherein the second communication interface is a backup interface independent of the first communication interface. Next, based on a preset protocol, a data request instruction is sent to the second device via the second communication interface, wherein the data request instruction instructs the second device to read field data. Finally, the field data returned by the second device via the second communication interface is received and stored.

[0066] As described above, this embodiment of the present disclosure effectively overcomes the technical defects of existing field data acquisition schemes that rely heavily on the main communication bus itself, which prevents them from working effectively and acquiring field data once a link break occurs. This is achieved by promptly activating a second communication interface independent of the first communication interface as a backup channel to establish a connection and acquire field data when a link break is detected at the first communication interface. Furthermore, the field data storage method provided by this embodiment of the present disclosure bypasses the communication limitations of the paralyzed main communication link, ensuring that the system can still successfully capture and securely store the field data before the link break even in the event of a link break caused by a hardware or software failure. This provides crucial and reliable data support for subsequent troubleshooting, root cause location, and accurate diagnosis.

[0067] In one possible embodiment, before monitoring the link status of the first communication interface between the first device and the second device, the method further includes: The system sends a synchronization command conforming to a preset protocol to the second device through the second communication interface to synchronize the devices.

[0068] Here, before monitoring the link status of the first communication interface between the first device and the second device, the first device can send a synchronization command conforming to a preset protocol to the second device through the second communication interface to synchronize the devices.

[0069] In one possible embodiment, taking the first device as an application processor (AP) and the second device as a communication processor (CP), and the preset protocol as the SCSA protocol, during the system power-on initialization phase, or before officially starting real-time monitoring of the link status of the first communication interface (such as the PCIe interface), the AP will send a synchronization instruction conforming to the above-mentioned SCSA protocol to the CP through the second communication interface. This synchronization instruction is mainly used to initialize the synchronization device status between the AP and the CP, and to complete the initial connection establishment in advance on the backup channel outside the main communication link. After receiving the synchronization instruction through the second communication interface, the CP will perform the corresponding status confirmation and protocol readiness preparation, thereby completing device synchronization with the AP.

[0070] By sending synchronization commands to synchronize devices before monitoring for link loss, it can be ensured that in the event of unpredictable link disconnection or other sudden anomalies on the main communication interface, the backup second communication interface between the AP and CP is already in a known and reliable protocol-ready state. This lays a solid communication foundation for quickly and stably sending start commands and various data request commands in emergency situations, avoiding the risk of delays or failures that may result from temporarily negotiating the protocol after a failure occurs.

[0071] In one possible embodiment, to more clearly demonstrate the entire on-site data preservation process, such as... Figure 5 As shown, Figure 5 An exemplary schematic diagram illustrates the complete interaction process between a first device (e.g., AP) and a second device (e.g., CP) via a second communication interface. First, before detecting a disconnection of the main communication link, the AP sends a synchronization command (sync) to the CP via the backup second communication interface. Upon receiving this, the CP returns a completion command (complete) to establish an initial connection in advance. When the AP detects a disconnection of the main link, it immediately sends a start command (start) to the CP to trigger the context saving process. After freezing the system context, the CP replies with a complete command to confirm readiness. Subsequently, the AP formally enters the data acquisition phase. The AP sequentially sends a first data request command (req_data) and a second data request command (req_reg) to the CP. Upon receiving the corresponding requests, the CP carries the read target address memory / peripheral register data and CPU core register data in the payload of the completion command (i.e.,...). Figure 5 The `complete(data)` function in the process returns data to the application in sequence, thus forming a complete data retrieval loop.

[0072] In another possible embodiment, to ensure the stability and integrity of the field data retrieval process, this disclosure also provides a mechanism for handling communication anomalies, specifically including a handling strategy for when the second device replies with an error and a handling mechanism for reply timeout: First, when the second device (such as the CP) determines that the currently received instruction cannot be processed, it will return an execution error response instruction to the first device (such as the AP) through the second communication interface. After receiving the error response instruction, the first device will execute the corresponding processing strategy according to the specific error type: if the error type is synchronization failure, the first device will periodically resend the synchronization instruction until it receives the execution completion response instruction returned by the second device; if the error type is that the second device is not ready when the main communication link (such as PCIe) is disconnected, the first device will periodically resend the start instruction until it receives the execution completion response instruction returned by the second device; if the error type is that the requested memory or peripheral register address cannot be accessed, the first device will skip the address with the current access exception and directly continue to request data from the next target address.

[0073] Secondly, if the first device does not receive a reply from the second device after sending a command within a preset time, it is determined that the current communication channel may be temporarily disconnected. At this time, the first device will trigger a timeout retransmission mechanism and repeatedly send the same command to the second device until it successfully receives a reply from the second device.

[0074] Through the above-mentioned anomaly handling and timeout retransmission mechanisms, the first and second devices can still ensure the progress of data recovery to the greatest extent when faced with sudden situations such as link instability or local address failure, effectively improving the fault tolerance rate of data interaction in extreme failure scenarios.

[0075] As described above, this technical solution effectively avoids system-level suspension or resource blocking issues caused by the main communication bus crash by starting an independent field saving thread when the PCIe main link is detected to be disconnected, and using a second communication interface independent of the main link to interact with the second device for command and data retrieval. This ensures the independence and high execution priority of the fault recovery process. Furthermore, this technical solution, combined with a dedicated communication protocol and a robust error handling and timeout retransmission mechanism, ensures strong robustness and high fault tolerance of dual-end communication under extreme abnormal scenarios. As a result, this technical solution can safely and completely export and solidify the underlying hardware and software context at the moment of link failure into a target file, greatly improving the success rate of field data saving and providing comprehensive and reliable underlying data support for subsequent accurate location and investigation of the root cause of the link failure.

[0076] By dividing each functional module according to its corresponding function, this disclosure provides a field data storage device, which can be a server or a chip applied to a server. Figure 6 A schematic block diagram of the functional modules of a field data storage device provided for an exemplary embodiment of this disclosure. (See diagram below.) Figure 6 As shown, the field data storage device includes: The monitoring module 601 is used to monitor the link status of the first communication interface between the first device and the second device; The connection module 602 is used to establish a connection with the second device through the second communication interface when the link of the first communication interface is detected to be disconnected; wherein, the second communication interface is a backup interface independent of the first communication interface; The sending module 603 is used to send a data request instruction to the second device through the second communication interface based on a preset protocol; wherein the data request instruction is used to instruct the second device to read field data; The receiving module 604 is used to receive the field data returned by the second device through the second communication interface and save the field data.

[0077] In one embodiment, the monitoring module 601 includes: The monitoring unit is used to obtain the link status by detecting the status of the link training state machine corresponding to the PCIE interface.

[0078] In one embodiment, the connection module 602 includes: The detection unit is used to start the field saving thread when the link of the first communication interface is detected to be disconnected; The first sending unit is used to establish a connection with the second device through the second communication interface in the field saving thread, and send a start command to the second device to notify the second device to start the field saving process.

[0079] In one embodiment, the transmitting module 603 includes: The second sending unit is used to send a first data request instruction to the second device to request the second device to read memory data and peripheral register data at the target address; The third sending unit is used to send a second data request instruction to the second device to request the second device to read data from the central processing unit core register.

[0080] In one embodiment, the receiving module 604 includes: The first storage unit is used to save the received field data into memory; The second storage unit is used to save the field data in the memory to the flash memory after receiving the field data to obtain a target file; wherein the target file contains a memory snapshot and register state of the second device before the link of the first communication interface is disconnected.

[0081] In one embodiment, the apparatus further includes: The synchronization module is used to send a synchronization command conforming to the preset protocol to the second device through the second communication interface, and to synchronize the device with the second device.

[0082] Figure 7 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this disclosure. For example... Figure 7 As shown, the electronic device 700 includes at least one processor 701 and a memory 702 coupled to the processor 701. The processor 701 can perform the corresponding steps in the methods disclosed in the embodiments of this disclosure.

[0083] The processor 701 described above can also be called a central processing unit (CPU), which can be an integrated circuit chip with signal processing capabilities. Each step in the method disclosed in this embodiment can be implemented by the integrated logic circuitry in the processor 701 or by software instructions. The processor 701 can be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this embodiment can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in the memory 702, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The processor 701 reads information from the memory 702 and, in conjunction with its hardware, completes the steps of the method described above.

[0084] Furthermore, various operations / processes according to this disclosure, implemented via software and / or firmware, can be transmitted from a storage medium or network to a computer system with a dedicated hardware architecture, such as... Figure 8 The computer system 800 shown is equipped with the programs that constitute the software. When various programs are installed, the computer system is able to perform various functions, including those described above. Figure 8 A block diagram of a computer system provided for an exemplary embodiment of this disclosure.

[0085] Computer system 800 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0086] like Figure 8 As shown, the computer system 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 may also store various programs and data required for the operation of the computer system 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0087] Multiple components in the computer system 800 are connected to the I / O interface 805, including: an input unit 806, an output unit 807, a storage unit 808, and a communication unit 809. The input unit 806 can be any type of device capable of inputting information into the computer system 800. The input unit 806 can receive input numerical or character information and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 807 can be any type of device capable of presenting information and may include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. The storage unit 808 may include, but is not limited to, a hard disk and an optical disk. The communication unit 809 allows the computer system 800 to exchange information / data with other devices via a network such as the Internet, and may include, but is not limited to, a modem, network card, infrared communication device, wireless communication transceiver, and / or chipset, such as Bluetooth™ device, WiFi device, WiMax device, cellular communication device, and / or the like.

[0088] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above. For example, in some embodiments, the methods disclosed in this disclosure can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 700 via ROM 802 and / or communication unit 809. In some embodiments, the computing unit 801 can be configured to perform the methods disclosed in this disclosure by any other suitable means (e.g., by means of firmware).

[0089] This disclosure also provides a computer-readable storage medium, wherein when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform the methods disclosed in this disclosure.

[0090] The computer-readable storage medium in this disclosure can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. The aforementioned computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specifically, the aforementioned computer-readable storage medium may include electrical connections based on one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0091] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0092] Figure 9 A computer program product 900 is provided as an exemplary embodiment of the present disclosure. The computer program product 900 includes a computer program 901, wherein the computer program 901, when executed by a processor, implements the methods disclosed in the embodiments of the present disclosure.

[0093] In embodiments of this disclosure, computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include, but are not limited to, object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN)), or it can be connected to an external computer.

[0094] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0095] The modules, components, or units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules, components, or units do not necessarily constitute a limitation on the module, component, or unit itself.

[0096] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary hardware logic components that can be used include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.

[0097] The above description is merely an illustration of some embodiments of this disclosure and the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0098] While specific embodiments of this disclosure have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of this disclosure. Those skilled in the art should understand that modifications can be made to the above embodiments without departing from the scope and spirit of this disclosure. The scope of this disclosure is defined by the appended claims.

Claims

1. A method for storing on-site data, applied to a first device, characterized in that, The method includes: Monitor the link status of the first communication interface between the first device and the second device; When a disconnection is detected in the first communication interface, a connection is established with the second device through the second communication interface; wherein, the second communication interface is a backup interface independent of the first communication interface; Based on a preset protocol, a data request command is sent to the second device through the second communication interface; wherein, the data request command is used to instruct the second device to read field data; Receive the field data returned by the second device through the second communication interface, and save the field data.

2. The method according to claim 1, characterized in that, The first communication interface is a PCIe interface; the second communication interface includes at least one of the following: a Universal Asynchronous Receiver / Transmitter (UART) interface, an internal integrated circuit (I2C) interface, or a Serial Peripheral Interface (SPI) interface. The monitoring of the link status of the first communication interface between the first device and the second device includes: The link state is obtained by detecting the state of the link training state machine corresponding to the PCIe interface.

3. The method according to claim 1, characterized in that, When a disconnection is detected in the first communication interface, establishing a connection with the second device through the second communication interface includes: When the link of the first communication interface is detected to be disconnected, the state saving thread is started; In the field saving thread, a connection is established with the second device through the second communication interface, and a start command is sent to the second device to notify the second device to start the field saving process.

4. The method according to claim 1, characterized in that, The step of sending a data request instruction to the second device through the second communication interface based on a preset protocol includes: Send a first data request instruction to the second device to request the second device to read memory data and peripheral register data at the target address; Send a second data request instruction to the second device to request the second device to read data from the central processing unit core register.

5. The method according to claim 1, characterized in that, The step of receiving the field data returned by the second device through the second communication interface and saving the field data includes: The received field data is saved to memory; After receiving the field data, the field data in the memory is saved to the flash memory to obtain the target file; wherein, the target file contains a memory snapshot and register state of the second device before the link of the first communication interface is disconnected.

6. The method according to claim 1, characterized in that, Before monitoring the link status of the first communication interface between the first device and the second device, the method further includes: The system sends a synchronization command conforming to the preset protocol to the second device through the second communication interface to synchronize the devices.

7. A field data storage device, characterized in that, include: The monitoring module is used to monitor the link status of the first communication interface between the first device and the second device; A connection module is used to establish a connection with the second device through a second communication interface when the link of the first communication interface is detected to be disconnected; wherein, the second communication interface is a backup interface independent of the first communication interface; The sending module is used to send a data request instruction to the second device through the second communication interface based on a preset protocol; wherein the data request instruction is used to instruct the second device to read field data; The receiving module is used to receive the field data returned by the second device through the second communication interface and save the field data.

8. An electronic device, characterized in that, include: At least one processor; Memory for storing the at least one processor-executable instruction; The at least one processor is configured to execute the instructions to implement the method as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the method as described in any one of claims 1-6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-6.