A log dump method, apparatus, device and medium

By using a unidirectional channel and status register implemented in the DPU to perform log dumping, the problems of resource waste and poor stability in the existing technology are solved, and an efficient and secure log dumping method is realized, which improves the overall performance and reliability of the system.

CN118860712BActive Publication Date: 2025-12-12ZHUHAI XINGYUN ZHILIAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410886718.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2025-12-12
Estimated Expiration
2044-07-03

AI Technical Summary

Technical Problem

In DPU scenarios, existing log dumping methods rely on network transmission, which leads to resource waste, poor stability, poor flexibility and poor security. This is especially true when HPS resources are scarce, affecting performance and potentially causing log loss.

Method used

The unidirectional channel and status register implemented using FPGA are used to transmit log data through field-programmable gate array. Log dumping is performed directly inside the DPU, avoiding network transmission. The status register and heartbeat register are used to synchronize the status of the storage unit, ensuring the security and stability of log data.

Benefits of technology

It enables efficient and stable log dumping without relying on the network, saving HPS resources, improving system controllability and security, avoiding log loss, and improving the overall system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860712B_ABST
    Figure CN118860712B_ABST
Patent Text Reader

Abstract

The application discloses a log dump method and device, equipment and medium, relates to the computer technical field, is applied to the field programmable gate array of the first processing component in the data processing unit, the data processing unit also includes the second processing component, the first processing component also includes the hardware processing system configured with the first drive, the field programmable gate array includes one-way channel and state register, the second processing component includes the second drive and storage service unit;Method includes: after detecting that the first drive reads the state register, the first state information of state register is sent to the first drive, so that the first drive will obtain the log data sent to one-way channel;The first drive reads the state register after obtaining the log data, and the first state information indicates that the storage service unit is in a living state;One-way channel sends log data to the second drive, so that the storage service unit obtains and saves log data from the second drive.Can complete log dump without network.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer technology, and in particular to a log dump method, device, equipment and medium. BACKGROUND

[0002] DPU is the abbreviation of Data Processing Unit, which means data processing unit in Chinese. DPU is a special hardware unit used to process data-related tasks such as calculation, acceleration, analysis, filtering, etc. DPU can provide efficient data processing capability in specific scenarios, and is usually used in network processing, artificial intelligence, image processing, etc. In different contexts, DPU may have different meanings. For example, in the field of network processing, DPU may refer to a hardware unit that specifically processes data packets for network traffic processing and management; while in the field of artificial intelligence, DPU may refer to a hardware unit for accelerating deep learning inference tasks, such as neural network accelerators. In general, DPU is a special hardware unit for data processing tasks, which can provide efficient data processing capability and help to accelerate the execution of various applications.

[0003] Log dump is the process of copying log information generated in a system, application program or device from its current storage location to another location. This is usually done for archiving, analyzing or backing up log data for subsequent troubleshooting, performance optimization or security auditing purposes. Log dump is very important for system management, fault diagnosis and security monitoring. By dumping log data, administrators can discover system problems, track abnormal events in time, and take appropriate measures to solve problems or improve system performance. A basic log dump system includes the sending end of the log, the transmission channel, and the receiving end of the log. The current commonly used log dump method relies on the network. The sending end needs to record the system generated log to the local first, which may be memory, flash and disk, etc. Then, after the sending end and the receiving end establish a network connection, the log is transmitted to the receiving end through the network. The receiving end stores the log after receiving it.

[0004] Two processing components are included in the DPU, one of which is a SOC (System on Chip) based processing component, and the other is called an ECPU component. The SOC includes an HPS (Hard processor system) and an FPGA (Field-Programmable Gate Array) component. The ECPU has high computing power and a general-purpose disk. The HPS has small resources and computing power and no separate disk, and is commonly used for embedded control applications. To solve the problem that the HPS cannot perform persistent storage of logs, inter-SOC communication is needed to dump HPS logs into the ECPU.

[0005] However, log dumping in the inter-SOC communication scenario needs to rely on a network to be implemented, mainly relying on a log sending end, a network, and a log receiving end. The log sending end is mainly responsible for collecting log data generated by various programs in the system. In the usual case, the log sending end will package the log data into a certain format (such as JSON (JavaScript Object Notation), XML (Extensible Markup Language), text, etc.), and save it to the local disk. Then, in the case that the network is available, the log data is sent to the log receiving end through a network protocol. The network is a communication channel connecting the log sending end and the log receiving end. Protocols (such as TCP / IP (transmission Control Protocol / Internet Protocol), UDP (User Datagram Protocol), etc.) define the rules for data packet transmission in the network. The selection of the network protocol depends on the communication needs of the log sending end and the receiving end, as well as the characteristics of the network environment (such as bandwidth, delay, reliability, etc.). The log receiving end is responsible for receiving data packets from the log sending end, and unpacking and parsing them. The parsed log data is stored in local disks, databases, etc. for subsequent analysis, monitoring, and auditing.

[0006] In summary, log dump often relies on the network. In the DPU scenario, this scheme is too complex, has poor flexibility, wastes resources, and has poor stability, mainly due to the following reasons: log dump relies on the network, and the operating system running on the HPS of the DPU needs to enable network functions. The resources of the HPS are scarce and valuable, and an embedded real-time operating system (such as zephyrrtos) is usually run thereon. If a network service is run specifically for log dump, it will occupy storage, CPU (Central Processing Unit / Processor), and other resources, not only wasting the resources of the HPS, but also affecting the performance of the application on the HPS. In addition, log dump relies on the network and is also affected by the network environment, such as bandwidth, delay, and reliability. At the same time, the transmission path is long and needs to cross devices, and control cannot be performed on the transmission path, so the flexibility and security are poor. In addition, if the HPS hangs, the network service will not work. There will be a problem of log loss due to the inability to transmit logs through the network in time, and the stability is poor. SUMMARY

[0007] Therefore, the present application aims to provide a log dump method, device, equipment and medium, which can complete log dump without network, and the specific scheme is as follows:

[0008] In a first aspect, the present application discloses a log dump method applied to a field programmable gate array in a data processing unit, wherein the data processing unit comprises a first processing component and a second processing component, the field programmable gate array is located in the first processing component based on a system on chip, the first processing component further comprises a hardware processing system configured with a first driver for forwarding log data, the field programmable gate array comprises a target unidirectional channel and a state register representing a service state of a storage service unit, and the second processing component comprises a second driver for receiving log data and the storage service unit; wherein the method comprises:

[0009] After detecting that the first driver reads the state register, first state information of the state register is sent to the first driver, so that the first driver sends the acquired log data to the target unidirectional channel when the first state information is acquired; wherein the first driver reads the state register after acquiring the log data, and the first state information indicates that the service state of the storage service unit is a live state;

[0010] The log data is sent to the second driver through the target unidirectional channel, so that the storage service unit acquires and saves the log data from the second driver.

[0011] The field programmable gate array further comprises a heartbeat register, and the method further comprises:

[0012] acquire an initial value sent by the second driver after periodically determining that the service state of the storage service unit is a live state through the heartbeat register; wherein the value of the heartbeat register is decremented from the initial value; and the storage service unit periodically sends service state information of the storage service unit to the second driver;

[0013] set the state information of the state register through the value of the heartbeat register; wherein the state information set when the value of the heartbeat register is not 0 indicates that the service state of the storage service unit is a live state.

[0014] wherein the storage service unit has a corresponding periodic timer for periodically determining the service state of the storage service unit, and the period value of the periodic timer is less than the initial value.

[0015] wherein the log dump method further comprises:

[0016] after detecting that the first driver reads the state register, send the second state information of the state register to the first driver, so that the first driver stores the acquired log data in the memory of the hardware processing system when the second state information is acquired, and periodically reads the state register until the first state information is acquired, and sends the log data in the memory to the target unidirectional channel; the second state information indicates that the service state of the storage service unit is a non-live state.

[0017] wherein, after detecting that the first driver reads the state register, the first state information of the state register is sent to the first driver, so that the first driver sends the acquired log data to the target unidirectional channel when the first state information is acquired, comprising:

[0018] after detecting that the first driver reads the state register, send the first state information to the first driver, so that the first driver checks whether there is historical data in the memory of the hardware processing system when the first state information is acquired, if there is, send the historical data in the memory and the acquired log data to the target unidirectional channel, if there is not, send the acquired log data to the target unidirectional channel.

[0019] wherein the hardware processing system further comprises a target thread; the first driver reads the state register after acquiring target log data sent by the target thread;

[0020] The target log data is log data sent by a log print interface provided by the target thread to the first driver.

[0021] The sending of the log data to the second driver through the target unidirectional channel so that the storage service unit obtains and saves the log data from the second driver comprises:

[0022] The sending of the log data to the second driver through the target unidirectional channel so that the storage service unit obtains the log data from the second driver and stores the log data to a local disk or stores the log data to a remote end based on a network of the second processing component.

[0023] In a second aspect, the present application discloses a log dumping device applied to a field programmable gate array in a data processing unit, the data processing unit comprising a first processing component and a second processing component, the field programmable gate array being located in the first processing component based on a system on chip, the first processing component further comprising a hardware processing system configured with a first driver for forwarding log data, the field programmable gate array comprising a target unidirectional channel and a state register representing a service state of a storage service unit, and the second processing component comprising a second driver for receiving log data and the storage service unit; wherein the log dumping device comprises:

[0024] An information sending module is configured to send first state information of the state register to the first driver after detecting that the first driver reads the state register, so that the first driver sends the obtained log data to the target unidirectional channel when obtaining the first state information; wherein the first driver reads the state register after obtaining the log data, and the first state information represents that the service state of the storage service unit is a live state.

[0025] A data sending module is configured to send the log data to the second driver through the target unidirectional channel, so that the storage service unit obtains and saves the log data from the second driver.

[0026] In a third aspect, the present application discloses an electronic device, comprising:

[0027] A memory is configured to save a computer program.

[0028] A processor is configured to execute the computer program to implement the log dumping method disclosed above.

[0029] In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program, wherein the computer program is executed by a processor to implement the log dump method disclosed above.

[0030] It can be seen that, after detecting that the first driver reads the status register, the first state information of the status register is sent to the first driver, so that the first driver sends the acquired log data to the target unidirectional channel when the first state information is acquired; wherein the first driver reads the status register after acquiring the log data, and the first state information indicates that the service state of the storage service unit is a live state; the log data is sent to the second driver through the target unidirectional channel, so that the storage service unit acquires and saves the log data from the second driver. It can be seen that, in the present application, the first driver and the second driver are respectively set on both sides of log dump, and a unidirectional transmission channel is set in the FPGA for log transmission, which discards the network transmission mode and avoids the influence of the network environment on the log dump process. Further, since the network transmission mode is discarded, it is not necessary to run a network service on the HPS, which saves resources and avoids affecting the performance of the HPS. In addition, the present application directly uses the first driver for dump, which has higher stability and does not have the situation of being unable to dump compared with indirectly dumping the log by using the network or other modes. The present application uses the status register to determine the service state of the storage service unit, which reduces the resource waste caused by the HPS processing the keep-alive message and saves resources. BRIEF DESCRIPTION OF DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only constitute the embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on the provided drawings.

[0032] Figure 1 A log dump method flow chart disclosed by the present application;

[0033] Figure 2 A specific log dump method flow chart disclosed by the present application;

[0034] Figure 3 A specific log dump method flow chart disclosed by the present application;

[0035] Figure 4 A specific data processing unit structure schematic diagram disclosed by the present application;

[0036] Figure 5A flowchart of a process of HPS log dump to ECPU disclosed in the present application;

[0037] Figure 6 A flowchart of a process of synchronizing the state of the ecpu_log service in the ECPU to the HPS disclosed in the present application;

[0038] Figure 7 A structural diagram of a log dump device disclosed in the present application;

[0039] Figure 8 A structural diagram of an electronic device disclosed in the present application. DETAILED DESCRIPTION

[0040] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0041] Log dump usually depends on the network. In the DPU scenario, this solution is too complex, has poor flexibility, wastes resources, and has poor stability, mainly due to the following reasons: log dump depends on the network, and the operating system running on the HPS of the DPU needs to start the network function. The resources of the HPS are scarce and valuable, and an embedded real-time operating system (such as zephyr rtos) is usually run thereon. If a network service is run specifically for log dump, it will occupy storage, CPU (Central Processing Unit / Processor), and other resources, which not only wastes the resources of the HPS, but also affects the performance of the application on the HPS. In addition, log dump depends on the network, and is also affected by the network environment, such as bandwidth, delay, and reliability. At the same time, the transmission path is long and needs to cross devices, and cannot be controlled on the transmission path, which has poor flexibility and poor security. In addition, if the HPS hangs, the network service will not be used. There will be a problem of log loss due to the failure to transmit the log through the network in time, and poor stability.

[0042] Therefore, the embodiments of the present application propose a log dump solution that can realize log dump without using the network.

[0043] The embodiments of the present application disclose a log dump method, which is described with reference to Figure 1As shown, the field programmable gate array applied in the data processing unit includes a first processing component and a second processing component, the field programmable gate array is located in the first processing component based on system on chip, the first processing component further includes a hardware processing system configured with a first driver for forwarding log data, the field programmable gate array includes a target unidirectional channel and a state register representing the service state of a storage service unit, the second processing component includes a second driver for receiving log data and the storage service unit; wherein the method comprises:

[0044] Step S11: after detecting that the first driver reads the state register, send the first state information of the state register to the first driver, so that the first driver sends the acquired log data to the target unidirectional channel when the first state information is acquired; wherein the first driver reads the state register after acquiring the log data, and the first state information indicates that the service state of the storage service unit is a live state.

[0045] In this embodiment, the first driver is hps_log_backend driver, the first processing component is system on chip, the second processing component is ECPU (Embedded CPU, Embedded Central Processing Unit) component, the second driver is ecpu_log_backend driver, the storage service unit is ecpu_log service, and the target unidirectional channel is hps2ecpu unidirectional channel.

[0046] In this embodiment, when the state register is first state information, it indicates that the storage service unit can save log data, so it can be transmitted directly without saving, of course, if necessary, it can also be saved. For example, save the pre-specified data in the log data.

[0047] In this embodiment, the hardware processing system further includes a target thread; the first driver reads the state register after acquiring the target log data sent by the target thread; wherein the target log data is the log data sent by the target thread to the first driver through the log printing interface provided by the first driver.

[0048] In the embodiment, in the transmission of the log data, whether historical log data exists in the memory also needs to be considered. If the historical log data exists, the historical log data in the memory needs to be transmitted together with the current log data. Specifically, after detecting that the first driver reads the status register, the first status information of the status register is sent to the first driver, so that the first driver sends the acquired log data to the target unidirectional channel when the first status information is acquired. The method comprises the following steps: after detecting that the first driver reads the status register, the first status information is sent to the first driver, so that the first driver checks whether historical data exists in the memory of the hardware processing system when the first status information is acquired. If the historical data exists, the historical data in the memory and the acquired log data are sent to the target unidirectional channel. If the historical data does not exist, the acquired log data is sent to the target unidirectional channel.

[0049] Step S12: The log data is sent to the second driver through the target unidirectional channel, so that the storage service unit acquires and saves the log data from the second driver.

[0050] In the embodiment, the HPS provides an hps_log_backend driver specially used for receiving, recording and forwarding the log; the ECPU provides an ecpu_log_backend driver used for receiving the log and an ecpu_log service used for storing the received log to the disk; the FPGA implements an hps2ecpu unidirectional channel used for dumping the log from the HPS to the ECPU and a status register used for synchronizing the state of the ECPU to the HPS. Specifically, the hps2ecpu unidirectional channel implemented by the FPGA is used to replace the network transmission channel, without the need of adding extra hardware, thereby saving the cost. The status register implemented by the FPGA is used to replace the sending of the keep-alive information, thereby reducing the waste of resources caused by the processing of the keep-alive message by the HPS. The hps_log_backend driver is used to replace the application service of the sending end by providing a log printing interface. The thread can call the interface to directly send the log data, without the need of saving the log data locally and encapsulating and analyzing the log data through a complex network protocol, thereby greatly reducing the resource consumption for processing the data and improving the real-time performance. The entire transmission path of the log data is implemented in the DPU, the transmission path is short and the log data will not be leaked, and the controllability and safety are ensured. When the HPS operating system has a problem, error output is performed. Compared with the case of indirectly forwarding the log by relying on other applications, the log is directly sent through the hps_log_backend driver, without the problems of system hanging and the log being unable to be dumped, and the stability is improved.

[0051] It can be seen that, after detecting that the first drive reads the status register, the first state information of the status register is sent to the first drive, so that the first drive sends the acquired log data to the target unidirectional channel when the first state information is acquired; wherein the first drive reads the status register after acquiring the log data, and the first state information indicates that the service state of the storage service unit is a live state; the log data is sent to the second drive through the target unidirectional channel, so that the storage service unit acquires and saves the log data from the second drive. The first drive and the second drive are respectively set on both sides of the log dump, and a unidirectional transmission channel is set in the FPGA for log transmission, which discards the network transmission mode and avoids the influence of the network environment on the log dump process. Further, since the network transmission mode is discarded, it is not necessary to run a network service on the HPS, which saves resources and avoids affecting the performance of the HPS. In addition, the first drive is directly used for dumping, and compared with indirectly dumping the log by using a network or other modes, there is no situation that cannot dump, and the stability is high. The state register is used to determine the service state of the storage service unit, which reduces the resource waste caused by the HPS processing the keep-alive message and saves resources.

[0052] The embodiment of the application discloses a specific log dump method. Compared with the previous embodiment, the technical solution is further described and optimized. Referring to Figure 2 as shown, specifically comprising:

[0053] Step S21: after detecting that the first drive reads the status register, the second state information of the status register is sent to the first drive, so that the first drive stores the acquired log data in the memory of the hardware processing system when the second state information is acquired, and periodically reads the status register until the first state information is acquired, and the log data in the memory is sent to the target unidirectional channel; the second state information indicates that the service state of the storage service unit is a non-live state.

[0054] In the embodiment, when the status register is the second state information, it indicates that the storage service unit cannot save the log data, so it cannot be transmitted, and therefore the log data needs to be saved in the memory for subsequent transmission when the status register is the first state information.

[0055] In the embodiment, a periodic timer of a read state register can be set for the first driver, when the log data needs to be transmitted, the state register is read first, if the service state of the storage service unit is the alive state, the periodic timer is closed, if the service state of the storage service unit is the non-alive state, the periodic timer is opened, so that the state register is read according to the period time of the periodic timer until the state register indicates that the service state of the storage service unit is the alive state.

[0056] Step S22: sending the log data to the second driver through the target one-way channel, so that the storage service unit acquires and saves the log data from the second driver.

[0057] It can be seen that, after the first driver reads the state register, the second state information of the state register is sent to the first driver, so that the first driver stores the acquired log data into the memory of the hardware processing system when the second state information is acquired, and periodically reads the state register until the first state information is acquired, and the log data in the memory is sent to the target one-way channel; the second state information indicates that the service state of the storage service unit is the non-alive state; the log data is sent to the second driver through the target one-way channel, so that the storage service unit acquires and saves the log data from the second driver. It can be seen that, when the storage service unit is in the non-alive state, the log data is stored into the memory, and when the storage service unit is in the alive state, the log data is sent to the second driver, so that the loss of the log data in the non-alive state is effectively avoided.

[0058] The embodiment of the application discloses a specific log dump method, and relative to the previous embodiment, the field programmable gate array further comprises a heartbeat register, and the embodiment further describes and optimizes the technical scheme. Referring to FIG. 1, Figure 3 as shown, specifically comprising:

[0059] Step S31: acquiring an initial value sent by the second driver after periodically determining that the service state of the storage service unit is the alive state through the heartbeat register; wherein the value of the heartbeat register starts to decrease from the initial value; and the storage service unit periodically sends the service state information of the storage service unit to the second driver.

[0060] In the embodiment, the storage service unit has a corresponding periodic timer for periodically determining the service state of the storage service unit, and the period value of the periodic timer is less than the initial value. It should be noted that the periodic timer is created by the storage service unit itself.

[0061] It should be noted that the number of cycles is less than the initial value, which can ensure that the new initial value is set before the value of the heartbeat register is reduced to 0, so that the value of the heartbeat register is always non-0.

[0062] It should be noted that if the second driver periodically determines that the service state of the storage service unit is a non-living state, the heartbeat register will not obtain an initial value, and the value of the heartbeat register will eventually return to 0. If the second driver periodically determines that the service state of the storage service unit is a living state through the heartbeat register, the heartbeat register will obtain a new initial value.

[0063] Step S32: Set the state information of the state register through the value of the heartbeat register; wherein the state information set when the value of the heartbeat register is non-0 indicates that the service state of the storage service unit is a living state.

[0064] It can be seen that the present application obtains the initial value sent by the second driver after periodically determining that the service state of the storage service unit is a living state through the heartbeat register; wherein the value of the heartbeat register starts to decrease from the initial value; the storage service unit periodically sends the service state information of the storage service unit to the second driver; the state information of the state register is set through the value of the heartbeat register; wherein the state information set when the value of the heartbeat register is non-0 indicates that the service state of the storage service unit is a living state. It can be seen that the present application uses the state register and the heartbeat register to synchronize the state of the storage service unit to the first processing component, which facilitates the first component to control the transmission of log data based on the state of the storage service unit.

[0065] In a specific embodiment, referring to Figure 4 , it is a structure schematic diagram of a data processing unit (DPU component), in which the DPU component includes: an ECPU, an HPS and an FPGA on an SOC. The ECPU includes an ecpu_log_backend driver and an ecpu_log service; the HPS includes a thread and an hps_log_backend driver; the FPGA includes a hps2ecpu one-way channel, a configurable heartbeat register and a read-only state register.

[0066] Firstly, the HPS mainly provides an hps_log_backend driver, which provides a log printing interface to the HPS system thread thread for sending log data, corresponding to step 1 in Figure 4 ; secondly, it is responsible for forwarding the received log to the hps2ecpu one-way channel, corresponding to step 2 in Figure 4Step 2; three is to read the state register state of the FPGA to obtain the state of the ecpu_log service of the ECPU, corresponding to Figure 4 Step 3. The thread of the HPS directly calls the interface provided by the hps_log_backend driver to print the log. When the hps_log_backend driver receives the information, it first reads the state register state of the FPGA and judges the real-time state of the ecpu_log service of the ECPU. If the state of the ecpu_log service is inactive, the hps_log_backend driver will retain the received information in the memory until the state of the ecpu_log service becomes active, and then send the log in the memory out. If the state of the ecpu_log service is active, the hps_log_backend driver directly sends the received log to the hps2ecpu.

[0067] Secondly, the ECPU mainly provides an ecpu_log_backend driver and an ecpu_log service. The ecpu_log_backend driver is responsible for receiving the log data sent by the hps2ecpu and saving, corresponding to Figure 4 Step 4; secondly, it provides an interface for reading the saved log data to the ecpu_log service, corresponding to Figure 4 Step 6; thirdly, it is responsible for configuring the count of the central heartbeat register heartbeat of the FPGA after receiving the state message of the ecpu_log service, for synchronizing the active state of the ecpu_log service to the HPS, corresponding to Figure 4 Steps 7 and 5. The ecpu_log service is responsible for reading the log data received by the ecpu_log_backend driver and writing the log data into the disk, or saving the log in a remote place through the network of the ECPU, corresponding to Figure 4 Step 6; secondly, it is responsible for periodically notifying the hps_log_backend driver of the active state of the ecpu_log service, corresponding to Figure 4 Step 7.

[0068] In addition, the FPGA mainly provides a unidirectional channel of hps2ecpu for the HPS to send log data to the ECPU. The hps2ecpu unidirectional channel is responsible for receiving and forwarding the log data sent by the hps_log_backend driver, corresponding to Figure 4The first is to provide a heartbeat register heartbeat and a state register state. When the heartbeat register heartbeat is configured with a value, the heartbeat value will be periodically decremented by 1. When the heartbeat value is 0, the state register state is inactive. Otherwise, the state register state is active. The ecpu_log_backend driver of the ECPU will receive the ecpu. If the ecpu_log_backend driver does not reconfigure the heartbeat register before the heartbeat value is decremented to 0, the state register state becomes inactive. The hps_log_backend driver of the HPS will read the state register to determine the state of the ecpu_log service and decide whether to dump the log. Corresponding to the above two cases, the hps_log_backend driver will be configured with two different values of the heartbeat register heartbeat, respectively. Figure 5 The second is to provide a heartbeat register heartbeat and a state register state. When the heartbeat register heartbeat is configured with a value, the heartbeat value will be periodically decremented by 1. When the heartbeat value is 0, the state register state is inactive. Otherwise, the state register state is active. The ecpu_log_backend driver of the ECPU will receive the ecpu. If the ecpu_log_backend driver does not reconfigure the heartbeat register before the heartbeat value is decremented to 0, the state register state becomes inactive. The hps_log_backend driver of the HPS will read the state register to determine the state of the ecpu_log service and decide whether to dump the log. Corresponding to the above two cases, the hps_log_backend driver will be configured with two different values of the heartbeat register heartbeat, respectively.

[0069] In a specific embodiment, the complete workflow of dumping the HPS log to the ECPU mainly includes two parts. The first is the workflow of dumping the HPS log to the ECPU, as shown in Figure 5 The second is the workflow of synchronizing the state of the ecpu_log service in the ECPU to the HPS, as shown in Figure 5

[0070] Referring to Figure 6 ​As shown, when thread prints log in HPS, it will call the interface of hps_log_backend driver, and hps_log_backend driver receives log data, firstly reads state register, and judges the ecpu_log service state of ECPU according to the value of state register. If the ecpu_log service state is inactive, the log data is reserved in memory, and a periodic timer timer is started. If the ecpu_log service state is active, if timer is running, timer is cancelled. If there is log data in memory, firstly, the log in memory is sent to hps2ecpu. Then, the received log data is directly forwarded to hps2ecpu. If timer expires, hps_log_backend driver is notified. hps_log_backend driver firstly reads state register, judges whether the ecpu_log service is active and whether there is log data in memory, if the conditions are met, hps_log_backend driver sends the memory log data. Finally, timer is cancelled. hps2ecpu receives and forwards the log data to ecpu_log_backend driver of ECPU. The ecpu_log service of ECPU actively reads the received log data in ecpu_log_backend driver, and saves the log data to local disk, or sends the log to remote storage by using the network of ECPU. The above steps complete the dump of HPS log to ECPU.

[0071] Referring to Figure 7 As shown, after the ecpu_log service is started, a periodic timer timer is created and started, and when timer expires, emu_log service is notified. emu_log service sends a state message to ecpu_log_backend driver. After receiving the message, ecpu_log_backend driver configures a value slightly larger than the period of timer to heartbeat register. The state register automatically sets the value of state register by checking whether the value of heartbeat register is 0. If heartbeat register is 0, state register is set to 0, indicating that the state is inactive. Otherwise, state register is set to 1, indicating that the state is active. Since ecpu_log service notifies hps_log_backend driver to configure heartbeat register to affect the state of state register, HPS can obtain the state of ecpu_log service by reading the state of state register. The above process completes the synchronization of the ecpu_log service state of ECPU to HPS.

[0072] In summary, this application proposes a method and apparatus for implementing DPU log dumping: A unidirectional hps2ecpu channel implemented using FPGA replaces the network transmission channel, eliminating the need for additional hardware and saving costs; a heartbeat register and a state register implemented using FPGA are used to synchronize the ECPU state to the HPS instead of sending keep-alive messages, thus reducing resource waste caused by HPS processing keep-alive messages; the hps_log_backend driver provides a log printing interface instead of the sending application service, allowing threads to directly send log data without storing it locally or undergoing complex network protocol encapsulation and parsing, significantly reducing data processing resource overhead and improving real-time performance; the entire log data transmission path is processed internally within the DPU, resulting in a short transmission path and eliminating the possibility of log data leakage, ensuring controllability and security; error output is provided when the HPS operating system encounters problems. Compared to relying on other applications to indirectly forward logs, sending directly through the hps_log_backend driver avoids issues such as system hangs, application unavailability, and log dumping failure, improving stability.

[0073] Accordingly, this application also discloses a log dumping device applied to a field-programmable gate array (FPGA) in a data processing unit. The data processing unit includes a first processing component and a second processing component. The FPGA is located in the first processing component, which is based on a system-on-a-chip (SoC). The first processing component further includes a hardware processing system configured with a first driver for forwarding log data. The FPGA includes a target unidirectional channel and a status register representing the service status of the storage service unit. The second processing component includes a second driver for receiving log data and the storage service unit. See [link to relevant documentation]. Figure 8 As shown, the device includes:

[0074] The information sending module 11 is used to send the first status information of the status register to the first driver after detecting that the first driver reads the status register, so that the first driver can send the acquired log data to the target unidirectional channel when it obtains the first status information; wherein, after the first driver obtains the log data, it reads the status register, and the first status information indicates that the service status of the storage service unit is alive.

[0075] The data sending module 12 is used to send the log data to the second driver through the target unidirectional channel, so that the storage service unit can obtain and save the log data from the second driver.

[0076] The more specific working processes of the above modules can be understood from the corresponding contents disclosed in the foregoing embodiments, and thus will not be described here.

[0077] It can be seen that, after detecting that the first drive reads the status register, the first state information of the status register is sent to the first drive, so that the first drive sends the acquired log data to the target unidirectional channel when the first state information is acquired; wherein the first drive reads the status register after acquiring the log data, and the first state information indicates that the service state of the storage service unit is a live state; the log data is sent to the second drive through the target unidirectional channel, so that the storage service unit acquires and saves the log data from the second drive. In the present application, the first drive and the second drive are respectively set on both sides of the log dump, and a unidirectional transmission channel is set in the FPGA for log transmission, which discards the network transmission mode and avoids the influence of the network environment on the log dump process. Further, since the network transmission mode is discarded, it is not necessary to run a network service on the HPS, which saves resources and avoids affecting the performance of the HPS. In addition, the present application directly uses the first drive to perform the dump, which is more stable than indirectly dumping the log by using the network or other methods, and cannot exist in the dump situation. The present application uses the status register to determine the service state of the storage service unit, reduces the resource waste caused by the HPS processing the keep-alive message, and saves resources.

[0078] Further, the present application embodiment also provides an electronic device. Figure 8 is the structure diagram of the electronic device 20 according to an exemplary embodiment, and the contents in the figure cannot be considered as any limitation on the use range of the present application.

[0079] ​ The present application embodiment provides a structure schematic diagram of an electronic device 20. The electronic device 20 specifically can include at least one processor 21, at least one memory 22, a display screen 23, an input and output interface 24, a communication interface 25, a power supply 26 and a communication bus 27. The memory 22 is used to store a computer program, the computer program is loaded and executed by the processor 21 to realize the related steps in the log dump method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment can be an electronic computer.

[0080] In this embodiment, the power supply 26 is configured to provide operating voltage for each hardware device on the electronic device 20; the communication interface 25 is configured to create a data transmission channel between the electronic device 20 and external devices, and the communication protocol followed by the communication interface 25 can be any communication protocol applicable to the technical solution of the present application, which will not be limited herein; the input / output interface 24 is configured to obtain external input data or output data to the outside, and the specific interface type can be selected according to the specific application needs, which will not be limited herein.

[0081] In addition, the memory 22 as a carrier of resource storage can be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the resources stored thereon can include a computer program 221, and the storage mode can be temporary storage or permanent storage. In addition to the computer program 221 capable of completing the log dump method executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 221 can further include a computer program capable of completing other specific work.

[0082] Further, the present application further discloses a computer readable storage medium for storing a computer program; wherein the computer program is executed by a processor to implement the log dump method disclosed above.

[0083] The specific steps of the method can refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.

[0084] The embodiments in the present application are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts of each embodiment can be referred to each other. For the device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant parts can refer to the method part.

[0085] The skilled person can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware, computer software or a combination of the two. In order to clearly show the interchangeability of hardware and software, the components and steps of each example have been described in the above description. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0086] The steps of a method or algorithm described in connection with the embodiments disclosed herein can be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module can reside in RAM, flash memory, ROM, electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. The storage medium can be coupled to the processor such that the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium can be integral to the processor. The processor and the storage medium can reside in an ASIC.

[0087] Finally, it should be noted that the terms "first" and "second", etc. are used herein solely to distinguish one entity or action from another entity or action, without necessarily requiring or implying any actual relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by "comprises a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the recited element.

[0088] The above provides a log dump method, device, equipment, and storage medium. The principles and implementation manners of the present application are described by using specific examples. The above description of the embodiments is only used to help understand the method and core idea of the present application. For those skilled in the art, the specific implementation manners and application ranges can be changed according to the idea of the present application. The above description of the present application should not be understood as a limitation.

Claims

1. A log dump method characterized by, The application relates to a field programmable gate array applied to a data processing unit, wherein the data processing unit comprises a first processing component and a second processing component, the field programmable gate array is located in the first processing component based on a system level chip, the first processing component further comprises a hardware processing system configured with a first driver for forwarding log data, the field programmable gate array comprises a target one-way channel and a state register representing a service state of a storage service unit, the second processing component comprises a second driver for receiving log data and the storage service unit; wherein the method comprises the following steps: After detecting that the first driver reads the state register, first state information of the state register is sent to the first driver, so that the first driver sends the acquired log data to the target one-way channel when the first state information is acquired; wherein the first driver reads the state register after acquiring the log data, and the first state information indicates that the service state of the storage service unit is a survival state; The log data is sent to the second driver through the target one-way channel, so that the storage service unit acquires and saves the log data from the second driver; The log dump method further comprises the following steps: After detecting that the first driver reads the state register, second state information of the state register is sent to the first driver, so that the first driver stores the acquired log data into the memory of the hardware processing system when the second state information is acquired, and periodically reads the state register until the first state information is acquired, and then the log data in the memory is sent to the target one-way channel; the second state information indicates that the service state of the storage service unit is a non-survival state.

2. The log dump method according to claim 1, wherein, The field programmable gate array further comprises a heartbeat register, and the method further comprises the following steps: An initial value sent by the second driver after periodically determining that the service state of the storage service unit is a survival state is acquired through the heartbeat register; wherein the value of the heartbeat register is decremented from the initial value; the storage service unit periodically sends service state information of the storage service unit to the second driver; The state information of the state register is set through the value of the heartbeat register; wherein when the value of the heartbeat register is not 0, the set state information indicates that the service state of the storage service unit is a survival state.

3. The log dump method according to claim 2, wherein, The storage service unit has a corresponding periodic timer for periodically determining the service state of the storage service unit, and the period value of the periodic timer is smaller than the initial value.

4. The log dump method according to claim 1, characterized by, The step of sending the first state information of the state register to the first driver after detecting that the first driver reads the state register, so that the first driver sends the acquired log data to the target one-way channel when the first state information is acquired, comprises the following steps: After detecting that the first driver reads the state register, the first state information of the state register is sent to the first driver, so that the first driver checks whether there is historical data in the memory of the hardware processing system when the first state information is acquired, if there is, the historical data in the memory and the acquired log data are sent to the target unidirectional channel, if not, the acquired log data is sent to the target unidirectional channel.

5. The log dump method according to claim 1, wherein, The hardware processing system further comprises a target thread; the first driver reads the state register after acquiring target log data sent by the target thread; The target log data is log data sent by the target thread to the first driver by calling a log printing interface provided by the first driver.

6. The log dump method according to any one of claims 1 to 5, characterized by, The sending of the log data to the second driver through the target unidirectional channel so that the storage service unit acquires and saves the log data from the second driver comprises: The sending of the log data to the second driver through the target unidirectional channel so that the storage service unit acquires the log data from the second driver and stores the log data to a local disk, or stores the log data to a remote end based on a network of the second processing component.

7. A log dump apparatus characterized by comprising: The application is applied to a field programmable gate array in a data processing unit, the data processing unit comprises a first processing component and a second processing component, the field programmable gate array is located in the first processing component based on a system on chip, the first processing component further comprises a hardware processing system configured with a first driver for forwarding log data, the field programmable gate array comprises a target unidirectional channel and a state register representing a service state of a storage service unit, the second processing component comprises a second driver for receiving log data and the storage service unit; wherein the log dump device comprises: An information sending module is configured to send first state information of the state register to the first driver after detecting that the first driver reads the state register, so that the first driver sends acquired log data to the target unidirectional channel when the first state information is acquired; wherein the first driver reads the state register after acquiring the log data, and the first state information indicates that the service state of the storage service unit is a live state; A data sending module is configured to send the log data to the second driver through the target unidirectional channel, so that the storage service unit acquires and saves the log data from the second driver; The log dump device further comprises: The log data processing module is configured to, after detecting that the first driver reads the status register, send second status information of the status register to the first driver, so that the first driver stores the acquired log data in a memory of the hardware processing system when the second status information is acquired, and periodically reads the status register until the first status information is acquired, and then sends the log data in the memory to the target unidirectional channel; the second status information indicates that the service state of the storage service unit is a non-living state.

8. An electronic device, comprising: The computer program is stored in the memory and includes a computer program code. The computer program is stored in the memory and includes a computer program code. The computer program is stored in the memory and includes a computer program code.

9. A computer-readable storage medium, characterized in that, ​

Citation Information

Patent Citations

  • Log data collection method, log data collection apparatus, storage medium and log data collection system

    CN112449750A

  • SOC chip

    CN114064558A