Method and system for parallel processing of transaction layer messages and storage medium
By creating multiple memory space queues to process transaction layer messages in parallel, the problem of HOST-side system being easily hanged when processing transaction layer messages is solved, and the processing efficiency and system stability are improved.
Patent Information
- Application Number
- CN202411461940.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-02-14
AI Technical Summary
In the prior art, the HOST side system is prone to hang up when processing transaction layer messages, resulting in system crash.
By creating n memory space queues, each queue is used to store different types of transaction layer messages, and when receiving transaction layer messages, it is stored in the target memory space queue. Then, these transaction layer messages are processed in parallel.
It improves the processing efficiency of transaction layer packets, avoids the system's staleness, and ensures the stable operation of the system.
Smart Images

Figure CN119441103A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, system and storage medium for parallel processing of transaction layer messages. Background Art
[0002] In the prior art, software and hardware negotiate to determine the memory used to store the transaction layer packet (TLP) sent by the host (HOST) side, and after receiving the TLP message sent by the HOST side, the TLP message is stored in the negotiated memory, and the embedded central processing unit (ECPU) software simulator processes the TLP messages in the memory one by one according to a certain processing order. However, the prior art may cause the HOST side system to hang, so how to avoid the HOST side system hanging has become a technical problem that needs to be solved at present. Summary of the invention
[0003] In view of the above problems, the purpose of this application is to provide a method, system and storage medium for parallel processing of transaction layer messages to improve the processing efficiency of TLP messages and avoid the situation where the HOST side system hangs. The specific scheme is as follows:
[0004] In a first aspect, an embodiment of the present application provides a method for processing transaction layer messages in parallel, the method comprising:
[0005] Create n memory space queues; n is a positive integer greater than or equal to 2; each of the n memory space queues is used to store transaction layer messages of different message types;
[0006] When a transaction layer message is received, the transaction layer message is stored in a target memory space queue; the message type of the transaction layer message stored in the target memory space queue includes the message type of the received transaction layer message;
[0007] The transaction layer messages in the n memory space queues are processed in parallel.
[0008] Optionally, the creating n memory space queues includes:
[0009] The n memory space queues are created, and the memory space queues in the n memory space queues are used to store transaction layer messages of one or more message types.
[0010] Optionally, after storing the transaction layer message in a memory space queue of a message type for storing the transaction layer message when the transaction layer message is received, the method further includes:
[0011] Arrange the transaction layer messages stored in the memory space queue in order of storage time from earliest to latest.
[0012] Optionally, the parallel processing of the transaction layer messages in the n memory space queues includes:
[0013] Loop through the n memory space queues to determine m memory space queues; the m memory space queues are memory space queues storing the transaction layer messages; m is a positive integer less than or equal to n;
[0014] Extracting one transaction layer message from each of the m memory space queues to obtain m transaction layer messages; the m transaction layer messages are the transaction layer messages with the earliest storage time in each of the m memory space queues;
[0015] Deleting the m transaction layer messages from the m memory space queues;
[0016] The m transaction layer messages are processed in parallel.
[0017] Optionally, when receiving a transaction layer message, storing the transaction layer message in a target memory space queue includes:
[0018] Parsing the received transaction layer message to determine the message type of the received transaction layer message;
[0019] Determining the target memory space queue based on the message type of the received transaction layer message;
[0020] The received transaction layer message is stored in the target memory space queue.
[0021] In a second aspect, an embodiment of the present application provides a system for processing transaction layer messages in parallel, the system comprising:
[0022] A creation module is used to create n memory space queues; n is a positive integer greater than or equal to 2; each of the n memory space queues is used to store transaction layer messages of different message types;
[0023] A storage module, used for storing the transaction layer message in a target memory space queue when receiving the transaction layer message; the message type of the transaction layer message stored in the target memory space queue includes the message type of the received transaction layer message;
[0024] The processing module is used to process the transaction layer messages in the n memory space queues in parallel.
[0025] Optionally, create a module specifically for:
[0026] The n memory space queues are created, and the memory space queues in the n memory space queues are used to store transaction layer messages of one or more message types.
[0027] Optionally, the system further includes:
[0028] The sorting module is used to sort the transaction layer messages stored in the memory space queue in order from earliest to latest according to the storage time.
[0029] Optionally, the processing module is specifically used for:
[0030] Loop through the n memory space queues to determine m memory space queues; the m memory space queues are memory space queues storing the transaction layer messages; m is a positive integer less than or equal to n;
[0031] Extracting one transaction layer message from each of the m memory space queues to obtain m transaction layer messages; the m transaction layer messages are the transaction layer messages with the earliest storage time in each of the m memory space queues;
[0032] Deleting the m transaction layer messages from the m memory space queues;
[0033] The m transaction layer messages are processed in parallel.
[0034] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the above-mentioned methods for parallel processing of transaction layer messages.
[0035] Compared with the prior art, this application has the following beneficial effects:
[0036] By creating n memory space queues, and each of the n memory space queues is used to store transaction layer messages of different message types. When a transaction layer message is received, the transaction layer message is stored in the target memory space queue. Since the message type of the transaction layer message used to store the target memory space queue includes the message type of the received transaction layer message, the received transaction layer message is stored in the n memory space queues according to the message type. In addition, since the embodiment of the present application processes the transaction layer messages in the n memory space queues in parallel, the parallel processing of the transaction layer messages is realized, the processing efficiency of the transaction layer messages is improved, and the system hang caused by the failure to process the transaction layer messages in time and being covered by other transaction layer messages is avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 A flowchart of a method for parallel processing of transaction layer messages provided in an embodiment of the present application;
[0039] Figure 2 A schematic diagram of the structure of the front end and the back end provided in the embodiment of the present application;
[0040] Figure 3 A schematic diagram of a framework for parallel processing of transaction layer messages provided in an embodiment of the present application;
[0041] Figure 4 A structural diagram of a system for parallel processing of transaction layer messages provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0043] The terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatuses.
[0044] An analysis of the prior art shows that in the data processing unit (DPU) scenario, in order for the DPU to simulate multiple different types of devices that comply with the PCIE (Peripheral Component Interconnect Express) standard for the HOST, the ECPU side software needs to simulate the entire PCIE topology and different types of PCIE devices. The HOST side operating system enumerates the PCIE topology and PCIE devices, and finally the HOST side drives different types of PCIE devices. In order to simulate the entire PCIE topology and different types of PCIE devices, the ECPU side software simulator needs to process all TLP messages sent by the HOST side. Any loss of TLP messages or untimely processing will cause the HOST side system to hang.
[0045] Further analysis shows that, since the prior art processes TLP messages in the memory one by one, if the processing of a certain TLP consumes a lot of time, it will cause the processing time of the TLP messages that are sorted later to time out, and the TLP messages in the memory may overwrite the TLP messages that are not processed in time, and eventually cause the HOST side system to hang due to the loss of TLP messages or untimely processing. Therefore, in order to avoid the hanging of the HOST side system, the present application provides a method, system and storage medium for parallel processing of transaction layer messages, as follows.
[0046] like Figure 1 As shown, an embodiment of the present application provides a method for processing transaction layer messages in parallel, the method comprising:
[0047] S101: Create n memory space queues; n is a positive integer greater than or equal to 2; each of the n memory space queues is used to store transaction layer messages of different message types.
[0048] The ECPU side software simulator is responsible for simulating the PCIE topology and the PCIE device. The ECPU side software simulator can be selected based on actual needs, such as the Emulator simulator. During initialization, the ECPU side software simulator negotiates with the hardware about the number n of memory space queues to be created, and the types of TLP messages to be stored in the created n memory space queues.
[0049] For example, when n is equal to 2, a memory space queue Queue1 and a memory space queue Queue2 are created, and the memory space queue Queue1 is set to store TLP messages of the Memory type (Memory Read / Write), and the memory space queue Queue2 is set to store TLP messages of the Configure type (Configure Read / Write).
[0050] It should be noted that the method in the embodiment of the present application is executed in a system consisting of a host front end, a hardware back end and an ECPU back end. The relationship between the host front end, the hardware back end and the ECPU back end is as follows: Figure 2 The hardware backend may be an application specific integrated circuit (ASIC) or a field programmable gate array (FPGA). The hardware backend exchanges data with the host frontend and the ECPU backend respectively.
[0051] In an optional embodiment, n memory space queues are created, specifically including:
[0052] N memory space queues are created, and the memory space queues in the n memory space queues are used to store transaction layer messages of one or more message types.
[0053] Specifically, any one or more of the n memory space queues can be used to store transaction layer messages of one message type, or to store transaction layer messages of multiple different message types. Furthermore, the number of message types stored in each of the n memory space queues can be different. That is, each of the n memory space queues can be set to store only one message type, or to allow storage of multiple message types.
[0054] For easier understanding, the following example is given:
[0055] When n is equal to 3, if the TLP message includes a first message type, a second message type, a third message type, a fourth message type and a fifth message type, the memory space queue Queue1 can be set to store TLP messages of the first message type, the memory space queue Queue2 can be set to store TLP messages of the second message type or the third message type, and the memory space queue Queue3 can be set to store TLP messages of the fourth message type or the fifth message type.
[0056] S102: When a transaction layer message is received, the transaction layer message is stored in a target memory space queue; the message type of the transaction layer message stored in the target memory space queue includes the message type of the received transaction layer message.
[0057] When the hardware receives the TLP message sent by the HOST side, it stores the received TLP message in the target memory space queue based on the message type of the TLP message.
[0058] In an optional embodiment, when receiving a transaction layer message, storing the transaction layer message in a target memory space queue includes:
[0059] Parse the received transaction layer message to determine the message type of the received transaction layer message;
[0060] Determine a target memory space queue based on a message type of the received transaction layer message;
[0061] The received transaction layer message is stored in the target memory space queue.
[0062] Specifically, after receiving the TLP message, the Fmt field and the Type field of the TLP message header are parsed to determine the message type of the TLP message. Based on the message type of the TLP message, a memory space queue for storing the message type of the received TLP message is determined from n memory space queues to obtain a target memory space queue. The received TLP message is stored in the target memory space queue.
[0063] For example, after parsing the TLP message, if it is determined that the message type of the received TLP message is Memory type, the memory space queue used to store TLP messages of Memory type among the n memory space queues is determined as the target memory space queue, and the received TLP message is stored in the target space queue. If it is determined that the message type of the received TLP message is Configure type, the memory space queue used to store TLP messages of Configure type among the n memory space queues is determined as the target memory space queue, and the received TLP message is stored in the target space queue.
[0064] Furthermore, after storing the transaction layer message in a memory space queue of a message type for storing the transaction layer message, the method further includes: arranging the transaction layer message stored in the memory space queue in a preset order. The preset order may be an order of storage time from early to late, or an order of remaining processing time from small to large.
[0065] The embodiment of the present application takes the arrangement of the transaction layer messages stored in the memory space queue in order of storage time from earliest to latest as an example for illustration:
[0066] Since a single memory space queue may store multiple TLP messages, in order for the subsequent processing steps to determine the processing order of each TLP message in the memory space queue, it is necessary to arrange the TLP messages in the memory space queue in the order from earliest to latest when the TLP messages are stored in the memory space queue. For example, when the memory space queue includes 3 TLP messages, if the time when the first TLP message is stored in the memory space queue is earlier than the time when the second TLP message and the third TLP message are stored in the memory space queue, and the time when the third TLP message is stored in the memory space queue is earlier than the time when the second TLP message is stored, the arrangement result is the first TLP message, the third TLP message, and the second TLP message.
[0067] S103: Process the transaction layer messages in n memory space queues in parallel.
[0068] Specifically, the transaction layer messages in n memory space queues are processed in parallel, including:
[0069] Loop through n memory space queues to determine m memory space queues; the m memory space queues are memory space queues storing transaction layer messages; m is a positive integer less than or equal to n;
[0070] Extract one transaction layer message from each of the m memory space queues to obtain m transaction layer messages; the m transaction layer messages are the transaction layer messages with the earliest storage time in each of the m memory space queues;
[0071] Delete m transaction layer messages from m memory space queues;
[0072] Process m transaction layer messages in parallel.
[0073] Specifically, the ECPU side software simulator loops through n memory space queues during operation, determines a non-empty memory space queue from the n memory space queues, and obtains m memory space queues. The first TLP message is extracted from each of the m memory space queues to obtain m TLP messages, and the m TLP messages are deleted from the memory space queues to update the memory space queues, thereby avoiding repeated processing of the same TLP message in the memory space queues.
[0074] Further, after any one of the m TLP messages is processed, if there are still TLP messages stored in the memory space queue where the processed TLP message was originally located, the first TLP message is extracted from the memory space queue and processed in parallel with the TLP message currently being processed. If the memory space queue where the processed TLP message was originally located is empty, the first TLP message is extracted from other memory space queues that are not empty and processed in parallel with the TLP message currently being processed.
[0075] It should be noted that when the number of n memory space queues processed in parallel exceeds the processing capacity of the hardware, nk memory space queues are processed in parallel. After any one of the nk memory space queues is empty, one memory space queue is selected from the k memory space queues and processed in parallel with nk-1 memory space queues. The nk memory space queues are the maximum number of memory space queues allowed to be processed in parallel by the hardware. Alternatively, the n memory space queues are processed in round-robin fashion, with nk TLP messages processed each time. After any one TLP message is processed, one TLP message is selected from the k memory space queues and processed in parallel with nk-1 TLP messages.
[0076] In an optional embodiment, the above method further includes: dynamically adjusting the number n of memory space queues.
[0077] During the operation of the software simulator on the ECPU side, the user can dynamically adjust the number n of memory space queues based on actual needs to renegotiate with the hardware to obtain a new memory space queue. The message type of the TLP messages stored in the new memory space queue is different from the message type of the TLP messages stored in the created memory space queue.
[0078] For example, when only TLP messages of the first and second types need to be processed, the number n of memory space queues is equal to 2, and memory space queue Queue1 is used to store TLP messages of the first type, and memory space queue Queue2 is used to store TLP messages of the second type. When a TLP message of the third type is newly processed, the number n of memory space queues is dynamically adjusted to 3, and a new memory space queue Queue3 is added, and memory space queue Queue3 is used to store TLP messages of the third type.
[0079] To facilitate understanding of the solutions in the embodiments of the present application, the following examples are given:
[0080] like Figure 3As shown, in the process of driving the loading of PCIE devices such as device A1 and device A2 on the HOST side, there will be a large number of Memory-type TLP messages, which will trigger the ECPU-side software simulator to perform complex and time-consuming processing. At this time, the HOST-side user may make information query requests to other PCIE devices, such as device B1, device B2 and other PCIE devices, which will result in a large number of Configure-type TLP messages, which simply access the configuration space of the PCIE device. Because when processing Configure-type TLP messages, there is no need to rely on Memory-type TLP messages. Therefore, in this scenario, the embodiment of the present application can negotiate with the hardware through the ECPU-side software simulator to create two memory space queues, the memory space queue Q1 is used to store Memory-type TLP messages, and the memory queue Q2 is used to store Configure-type TLP messages, so that the Memory-type TLP messages received during the loading of device A1 or device A2 can be stored in the memory queue Q1. Furthermore, when the HOST-side user makes an information query request to device B1 or device B2, the received Configure-type TLP message can be stored in the memory queue Q2, and the TLP messages can be extracted from the memory queue Q1 and the memory queue Q2 for processing, so as to realize parallel processing of the TLP messages.
[0081] It should be noted that device C is a PCIE bridge device.
[0082] By creating n memory space queues, and each of the n memory space queues is used to store transaction layer messages of different message types. When a transaction layer message is received, the transaction layer message is stored in the target memory space queue. Since the message type of the transaction layer message used to store the target memory space queue includes the message type of the received transaction layer message, the received transaction layer message is stored in the n memory space queues according to the message type. In addition, since the embodiment of the present application processes the transaction layer messages in the n memory space queues in parallel, the parallel processing of the transaction layer messages is realized, the processing efficiency of the transaction layer messages is improved, and the system hang caused by the failure to process the transaction layer messages in time and being covered by other transaction layer messages is avoided.
[0083] like Figure 4 As shown, an embodiment of the present application provides a system for parallel processing of transaction layer messages, the system comprising:
[0084] The creation module 401 is used to create n memory space queues; n is a positive integer greater than or equal to 2; each of the n memory space queues is used to store transaction layer messages of different message types;
[0085] The storage module 402 is used to store the transaction layer message in the target memory space queue when the transaction layer message is received; the message type of the transaction layer message stored in the target memory space queue includes the message type of the received transaction layer message;
[0086] The processing module 403 is used to process the transaction layer messages in n memory space queues in parallel.
[0087] In an optional embodiment, the creation module 401 is specifically used for:
[0088] N memory space queues are created, and the memory space queues in the n memory space queues are used to store transaction layer messages of one or more message types.
[0089] In an optional embodiment, the system further includes:
[0090] The sorting module is used to sort the transaction layer messages stored in the memory space queue in order from earliest to latest according to the storage time.
[0091] In an optional embodiment, the processing module 403 is specifically used to:
[0092] Loop through n memory space queues to determine m memory space queues; the m memory space queues are memory space queues storing transaction layer messages; m is a positive integer less than or equal to n;
[0093] Extract one transaction layer message from each of the m memory space queues to obtain m transaction layer messages; the m transaction layer messages are the transaction layer messages with the earliest storage time in each of the m memory space queues;
[0094] Delete m transaction layer messages from m memory space queues;
[0095] Process m transaction layer messages in parallel.
[0096] In an optional embodiment, the storage module 402 is specifically used for:
[0097] Parse the received transaction layer message to determine the message type of the received transaction layer message;
[0098] Determine a target memory space queue based on a message type of the received transaction layer message;
[0099] The received transaction layer message is stored in the target memory space queue.
[0100] By creating n memory space queues, and each of the n memory space queues is used to store transaction layer messages of different message types. When a transaction layer message is received, the transaction layer message is stored in the target memory space queue. Since the message type of the transaction layer message used to store the target memory space queue includes the message type of the received transaction layer message, the received transaction layer message is stored in the n memory space queues according to the message type. In addition, since the embodiment of the present application processes the transaction layer messages in the n memory space queues in parallel, the parallel processing of the transaction layer messages is realized, the processing efficiency of the transaction layer messages is improved, and the system hang caused by the failure to process the transaction layer messages in time and being covered by other transaction layer messages is avoided.
[0101] An embodiment of the present application provides a computer storage medium for storing a computer program. When the computer program is executed, it is used to implement any of the above-mentioned methods for parallel processing of transaction layer messages.
[0102] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0103] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0104] The technical content provided by the present invention is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for general technical personnel in the field, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for processing transaction layer messages in parallel, characterized in that: The method comprises: Create n memory space queues; n is a positive integer greater than or equal to 2; each of the n memory space queues is used to store transaction layer messages of different message types; When a transaction layer message is received, the transaction layer message is stored in a target memory space queue; the message type of the transaction layer message stored in the target memory space queue includes the message type of the received transaction layer message; The transaction layer messages in the n memory space queues are processed in parallel.
2. The method according to claim 1, characterized in that The creation of n memory space queues includes: The n memory space queues are created, and the memory space queues in the n memory space queues are used to store transaction layer messages of one or more message types.
3. The method according to claim 1, characterized in that After storing the transaction layer message in a memory space queue of a message type for storing the transaction layer message when the transaction layer message is received, the method further includes: Arrange the transaction layer messages stored in the memory space queue in order of storage time from earliest to latest.
4. The method according to claim 3, characterized in that The parallel processing of the transaction layer messages in the n memory space queues includes: Loop through the n memory space queues to determine m memory space queues; the m memory space queues are memory space queues storing the transaction layer messages; m is a positive integer less than or equal to n; Extracting one transaction layer message from each of the m memory space queues to obtain m transaction layer messages; the m transaction layer messages are the transaction layer messages with the earliest storage time in each of the m memory space queues; Deleting the m transaction layer messages from the m memory space queues; The m transaction layer messages are processed in parallel.
5. The method according to claim 1, characterized in that When receiving the transaction layer message, storing the transaction layer message in the target memory space queue includes: Parsing the received transaction layer message to determine the message type of the received transaction layer message; Determining the target memory space queue based on the message type of the received transaction layer message; The received transaction layer message is stored in the target memory space queue.
6. A system for processing transaction layer messages in parallel, characterized in that: The system comprises: A creation module is used to create n memory space queues; n is a positive integer greater than or equal to 2; each of the n memory space queues is used to store transaction layer messages of different message types; A storage module, used for storing the transaction layer message in a target memory space queue when receiving the transaction layer message; the message type of the transaction layer message stored in the target memory space queue includes the message type of the received transaction layer message; The processing module is used to process the transaction layer messages in the n memory space queues in parallel.
7. The system according to claim 6, characterized in that Create modules specifically for: The n memory space queues are created, and the memory space queues in the n memory space queues are used to store transaction layer messages of one or more message types.
8. The system according to claim 6, characterized in that The system further comprises: The sorting module is used to sort the transaction layer messages stored in the memory space queue in order from earliest to latest according to the storage time.
9. The system according to claim 8, characterized in that The processing module is specifically used for: Loop through the n memory space queues to determine m memory space queues; the m memory space queues are memory space queues storing the transaction layer messages; m is a positive integer less than or equal to n; Extracting one transaction layer message from each of the m memory space queues to obtain m transaction layer messages; the m transaction layer messages are the transaction layer messages with the earliest storage time in each of the m memory space queues; Deleting the m transaction layer messages from the m memory space queues; The m transaction layer messages are processed in parallel.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the method for parallel processing of transaction layer messages according to any one of claims 1 to 5 is implemented.