XDP-based radio astronomical data real-time acquisition and processing method

Through the programmable network data packet processing solution based on XDP, the problem of slow data packet processing speed of the radio astronomy data acquisition system under high-speed Ethernet is solved, real-time collection and processing of massive data is realized, performance is improved and system resources are reduced. Occupied, it meets the needs for high-speed collection of radio astronomy data.

CN118612288APending Publication Date: 2024-09-06KUNMING UNIV OF SCI & TECH
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202410690080.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

The existing radio astronomy data acquisition system faces problems of data packet loss and high system resource usage in a high-speed Ethernet environment. Traditional Socket technology cannot effectively improve the data packet processing speed and cannot meet the real-time collection and processing needs of massive astronomical sampling data. .

Method used

Adopting a programmable network data packet processing solution based on Package redirection uses CUDA threads for real-time data processing to generate archiveable astronomical data products.

Benefits of technology

It realizes real-time collection and processing of massive astronomical data in a high-speed Ethernet environment, reduces memory copy load, reduces kernel-user mode switching overhead, improves packet processing performance, and maintains the interface management and security protection capabilities of the operating system. , making full use of the parallel and floating-point computing capabilities of the GPU.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118612288A
    Figure CN118612288A
Patent Text Reader

Abstract

The invention provides a radio astronomical data real-time acquisition and processing method based on an XDP. Comprising the steps that 1, an XDP program is constructed and compiled into eBPF byte codes, and the XDP program byte codes are loaded to a kernel; 2, analyzing a processing path of a kernel protocol stack data packet, and establishing a zero-copy and network protocol stack bypass astronomical data real-time acquisition and processing mechanism based on an XDP redirection function; step 3, in a user space data real-time acquisition processing program, creating a socket of an AFXDP type, and constructing a UMEM memory buffer area to capture a UDP sampling data message redirected by an XDP program in real time; and 4, constructing a memory pool, analyzing the sampling data message, storing the sampling data part in the UDP message into the memory pool, and reading the memory pool and carrying out real-time data processing by the CUDA thread. According to the invention, a frame for real-time acquisition and processing of radio astronomical data is constructed based on the XDP, the load on memory copying is reduced, and the processing performance of astronomical observation data in each key stage is accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a real-time acquisition and processing method for radio astronomy data based on XDP, and belongs to the field of network data packet processing. Background Art

[0002] The development of radio astronomy has enabled humans to detect previously unobservable cosmic phenomena, such as radio clusters, pulsars, and radio galaxies. These observations can reveal important information such as the physical processes of the universe, the evolution of galaxies, and the life cycle of stars, and play a vital role in understanding the structure and evolution of the universe. Radio wavelengths are part of the electromagnetic spectrum with longer wavelengths and lower frequencies. They have different properties and applications than visible light and other wavelengths such as infrared, ultraviolet, X-rays, and gamma rays. Radio astronomers use radio telescopes and antennas to observe and study celestial bodies in the universe, including stars, galaxies, nebulae, planets, star clusters, etc.

[0003] With the continuous innovation and development of observation technology and instruments, the observation sensitivity of modern radio telescopes has been greatly improved. Higher observation sensitivity requires wider observation bandwidth and higher sampling accuracy, which leads to an exponential growth in the amount of data generated by radio telescopes (when the sampling bandwidth is 1024Mhz and the sampling accuracy is 8bit, the amount of data generated by the digital baseband converter within 1s is 8Gbit). In view of the sharp increase in observation data generated by the digital baseband converter in the radio telescope, it is urgent to increase the data transmission rate. To solve this problem, the new generation of data transmission system has adopted 10Gb / 40Gb Ethernet technology as the underlying hardware. This technology upgrade has brought huge challenges in the real-time collection, transmission and processing of massive data under high-speed Ethernet. This is not only a challenge faced by the field of radio astronomy, but also one of the key issues commonly faced by data processing pipelines in many research fields.

[0004] At present, most of the common Ethernet-based data transmission and collection technologies use socket technology based on the Linux network protocol stack. Traditional socket technology often cannot reach the linear rate of the theoretical bandwidth of the network interface card (NIC) under high-speed Ethernet, which requires parameter tuning of the operating system's network stack, such as interrupt coalescing, adjusting hard interrupt affinity (IRQ affinities), adjusting a larger MTU, and adjusting a larger socket receive buffer. However, parameter tuning often has limited effects on improving network performance.

[0005] Socket technology based on the standard Linux network stack does not guarantee higher packet processing speeds because there are various unavoidable overheads in the architectural design of the general network protocol stack. The universality of the network stack architecture brings high performance costs, which greatly limits the effectiveness of increasingly powerful hardware. In order to improve the network performance and scalability of the traditional Linux kernel stack, many performance patches have been released. For example, Packet_mmap is a function in the Linux kernel standard UNIX socket, which uses a memory area for packet buffers shared between the kernel and user space. Therefore, data does not need to be copied between user mode / kernel mode. However, the data packet is still processed by the entire kernel stack and requires kernel copying between the DMA buffer and sk_buff, which only avoids the copy between the kernel and user space.

[0006] Existing radio astronomy data acquisition systems, such as psrdada, guppi_daq and hashpipe, these open source frameworks basically use traditional Socket technology in data transmission and acquisition, or expand the Socket with Packet_mmap function. Socket based on kernel protocol stack has no performance advantage in dealing with high-speed astronomical sampling data packets. When facing the demand for extremely high-speed data acquisition, frequent data packet loss and high system resource occupation will occur in a high network I / O environment, and there are various additional overheads. In the actual deployment and use of data acquisition systems, in view of the data characteristics of the current radio astronomy digital processing backend, the real-time acquisition and immediate processing of high-speed network data packets is still a huge challenge, and directly choosing the existing open source Internet solutions cannot completely solve the problem. In recent years, many user space I / O frameworks have emerged to focus on high-speed network data packet processing. These frameworks (such as Netmap, DPDK, PF_Ring, etc.) implement programmable network data packet processing through kernel bypass. The implementation method is to completely hand over the network device to a dedicated user space application to avoid the expensive performance overhead of kernel and user state context switching. Compared with traditional Socket technology, it has significant advantages in data packet processing speed. However, since device control is moved to user space programs, the application isolation and interface management functions provided by the operating system become ineffective.

[0007] Therefore, it is necessary to design a radio astronomy data acquisition and processing framework based on the XDP programmable network packet processing solution to solve the problem of real-time acquisition and processing of high-speed and massive astronomical sampling data in an Ethernet environment. Summary of the invention

[0008] The present invention provides a real-time acquisition and processing method for radio astronomy data based on XDP. The method solves the problem of real-time acquisition and processing of massive astronomical sampling data under high-speed Ethernet based on the programmable data packet processing characteristics of XDP.

[0009] The technical solution of the present invention is: a method for real-time acquisition and processing of radio astronomy data based on XDP, the specific steps are:

[0010] Step 1: Build the XDP program and compile it into eBPF bytecode, and load the XDP program bytecode into the kernel;

[0011] Step 2: Analyze the processing path of kernel protocol stack data packets and establish a real-time astronomical data collection and processing mechanism with zero copy and network protocol stack bypass based on XDP;

[0012] Step 3: In the user space data real-time acquisition processing program, create a socket of type AF_XDP, and build a UMEM memory buffer to capture the UDP sampling data message redirected by the XDP program in real time;

[0013] Step 4: Construct a memory pool, parse the sampled data message, store the sampled data part of the UDP message into the memory pool, and the CUDA thread reads the memory pool and performs real-time data processing to generate archivable astronomical data products.

[0014] The technology of the present invention originates from the National Natural Science Foundation Regional Science Fund Project: Research on Key Technologies of Real-time Pipeline of Pulsar Backend of 40-meter Radio Telescope of Yuntai, Fund No. 12063003.

[0015] The beneficial effects of the present invention are:

[0016] The present invention builds a framework for real-time acquisition and processing of radio astronomical data based on XDP, and uses the XDP redirection function to redirect astronomical sampled data to the socket of AF_XDP in the user space in a zero-copy manner, reducing the load on memory copying, only bypassing the kernel network stack, leaving the control of network hardware completely within the kernel range, and still retaining the interface management and security protection capabilities provided by the operating system, achieving network data packet processing performance similar to that of the user-mode I / O framework. When facing massive astronomical data, the processing capabilities of the GPU in terms of parallel and floating-point operations are fully utilized, and the received sampled data are calculated in real time on multiple GPU devices, which greatly accelerates the processing performance of astronomical observation data at various key stages. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is the overall step structure diagram of the present invention;

[0018] Figure 2It is the overall architecture diagram of the present invention;

[0019] Figure 3 It is a flow chart of real-time collection and processing of XDP program data packets of the present invention;

[0020] Figure 4 is a user space program data processing flow chart of the present invention;

[0021] Figure 5 This is an example diagram of the lock-free circular queue with multiple consumers dequeuing according to the present invention. DETAILED DESCRIPTION

[0022] The present invention will be further described below in conjunction with the accompanying drawings and specific implementation methods.

[0023] Example 1: Figure 1-5 As shown, a radio astronomy data acquisition and real-time processing method based on XDP, the method steps are as follows:

[0024] Step 1: Build the XDP program and compile it into eBPF bytecode, and load the XDP program bytecode into the kernel;

[0025] First, use the LLVM compiler backend to compile the XDP program written in a C-like language style into BPF instructions. Then, use the command echo 1> / proc / sys / net / core / bpf_jit_enable to enable the kernel's JIT (Just-in-time) compilation function. For system architectures without a BPF JIT compiler, the eBPF program needs to be executed through the kernel's in-kernel interpreter. The JIT compiler can greatly speed up the execution of BPF programs because, compared with the kernel interpreter, the BPF instructions can be directly mapped to the native machine code of the underlying architecture after JIT compilation, thereby reducing the overhead of each instruction. After that, the data processing program in user space calls the xdp_program__open_file() function in libxdp to open the compiled XDP program, and then calls the xdp_program__attach() function to load the XDP program into the kernel. Among them, the XDP program runs in native mode and executes on the network driver's packet receiving path.

[0026] Step 2: Analyze the processing path of kernel protocol stack data packets and establish a real-time astronomical data collection and processing mechanism with zero copy and network protocol stack bypass based on the XDP redirection function;

[0027] The execution of the XDP program is event-driven. The XDP program is executed in the network device driver. Every time the network device receives a packet, it triggers the corresponding data packet reception event, and then executes the XDP program injected into the kernel through the hook function. Because the XDP program is executed directly in the device driver, there is no need to switch to the user space context, avoiding the kernel-user state switching overhead. Figure 2 As shown in the figure, the XDP program is executed at the earliest location where the packet can be processed after the network card receives the packet. At this time, the kernel has not yet allocated a struct sk_buff structure for the packet, nor has it performed any packet parsing operations, which reduces the number of instructions for packet processing, saves CPU cycles, and greatly accelerates the critical path of packet processing.

[0028] like Figure 3 As shown in the figure, when the network card receives a data packet, the XDP program executes in sequence:

[0029] 1) Read meta data: When the XDP program is executed, it will obtain a context object (struct xdp_md*) passed by the system as a parameter of the program. The original representation of the data packet is obtained through this structure pointer, including the network interface card index (ingress_ifindex) and RX queue index (rx_queue_index) of the data packet, the starting position (data) of the data packet, and the pointer to the end (data_end) of the data packet.

[0030] 2) Parse the data packet based on the Ethernet frame format: First, use the data packet start position pointer and end position pointer to check the legitimacy of the data packet boundary. If the data packet boundary check fails, the data packet is discarded. Then, parse the protocol type of the data packet according to the Ethernet frame format, and hand over the non-IPv4 format message to the kernel protocol stack for processing. The IPv4 message is processed in the next step;

[0031] 3) Parse data packets based on IPv4 format: parse the protocol field in the IPv4 header, use the UDP protocol for subsequent processing, and pass non-UDP packets to the protocol stack for processing;

[0032] 4) Parse the data packet based on UDP format: Check whether the destination port number in the UDP message is consistent with the preset port number. If the destination port number is not the preset port number, pass this message to the kernel protocol stack. If the verification is successful, use the rx_queue_index in the data packet meta-information as a parameter, use the bpf_map_lookup_elem() function to find the corresponding AF_XDP type Socket in the user space, use the XDP redirection function, call the bpf_redirect_map() function, and redirect this UDP message to the corresponding Socket in a zero-copy manner.

[0033] Step 3: In the user space data real-time acquisition processing program, create a socket of type AF_XDP, and build a UMEM memory buffer to capture the UDP sampling data packets redirected by the XDP program in real time;

[0034] In the user space handler, create a socket of type AF_XDP. Allocate Rx ring and Tx ring for the socket, which store packet descriptors. By checking the Rx ring, the application can find out whether a packet has been received. Conversely, if the application wants to send a packet, it puts the same type of information in the Tx ring and sends a signal to the kernel to transmit the packet. The size of the entries in the Rx ring and Tx ring are both 2048.

[0035] Through the mmap mechanism, a continuous virtual memory area UMEM is constructed, and the UMEM memory buffer is divided into frames equal to the memory page size (4k). Then, the fill ring and complete ring are used to bind to UMEM. The fill ring and complete ring store the relative address of UMEM. Note that a UMEM can only be bound to a pair of fill rings and complete rings. Among them, the entry size in the fill ring and the complete ring is 4096.

[0036] When a packet enters the network device, the kernel driver captures it and executes the XDP program to decide whether the packet should be redirected to a specific AF_XDP type socket. Since XDP runs in zero-copy mode, the network card places the packet directly in the UMEM packet buffer. The kernel then fills a packet descriptor in the Rx ring, sets the addr field in the packet descriptor to the relative address of UMEM and sets the length of the packet through the len field. The application checks the Rx ring to see if the packet has been received. Once the packet is processed, the application returns it to the kernel through the fill ring so that a new packet can arrive at the UMEM space corresponding to this address. The Rx ring is constantly polled to capture sampled packets that are redirected to user space after being processed by the XDP program. When the packet descriptor in the Rx ring reaches the specified batch size, the batch size packets are subsequently processed. Among them, the specified batch size is 128.

[0037] Step 4: Parse the sampled data message, construct a lock-free memory pool, store the sampled data part of the UDP data message into the memory pool, and use the CUDA thread to read the memory pool and process the data in real time to generate archivable astronomical data products.

[0038] Construct a data memory pool, in which 8 fixed-size 256MB memory blocks are pre-allocated to store sampled data. Then, build a lock-free, first-in, first-out circular queue and bind the lock-free circular queue to the data memory pool.

[0039] Get a free memory block from the memory pool. Capture a batch of sampled data. For each data packet, strip the UDP header of the data packet, obtain the sampled data part, and fill it into the free memory block. When a memory block is filled with sampled data, enqueue the offset address of this memory block into the lock-free ring queue.

[0040] Create the same number of CUDA threads as the number of CUDA devices in the machine, that is, create the same number of CUDA threads as there are CUDA devices on the machine.

[0041] For each CUDA thread, try to dequeue a memory block address from the lock-free circular queue. When multiple CUDA threads simultaneously enqueue or dequeue the same queue, data competition will occur. One thread may read the data being modified by another thread, resulting in data inconsistency. Therefore, an appropriate synchronization mechanism is required to protect shared resources.

[0042] Use CAS (Compare and Swap) atomic instructions to ensure data consistency and implement a lock-free ring queue. Figure 5 As shown in the figure, when two CUDA threads dequeue an element at the same time, each thread uses the local variables cons_head and prod_tail to save the r->cons.head and r->prod.tail pointers of the circular queue respectively. Use prod_tail to determine whether there is an element in the queue that can be dequeued. Then, use the local variable pointer cons_next to point to the next position of r->cons.head, modify the r->cons.head pointer in the circular queue, and point it to the position pointed to by the local variable pointer cons_next. This operation is performed by using the CAS instruction, which contains the following atomic operations:

[0043] If r->cons.head in the ring queue is not equal to the thread's local variable pointer cons_head, the CAS operation fails and the code will restart execution;

[0044] Otherwise, modify the r->cons.head pointer to point it to the location of the local variable cons_next, the CAS operation is successful, and proceed to the next step.

[0045] Assuming that CUDA thread 1 is dequeued successfully, CUDA thread 2 needs to restart execution until the CAS instruction in CUDA thread 2 is retried successfully and the r->cons.head position is updated.

[0046] CUDA thread 1 dequeues element object1 from the ring, and CUDA thread 2 dequeues element object2 from the ring. Then, each CUDA thread needs to use CAS to update the r->cons.tail pointer. However, r->cons.tail can only be updated if it is equal to the thread-local variable cons_head. Therefore, only after CUDA thread 1 updates r->cons.tail can CUDA thread 2 update r->cons.tail. At this point, CUDA thread 2 has also completed the dequeue operation.

[0047] If the queue is successfully dequeued, the sampling data of the fixed size (256MB) of the memory block is copied from the memory pool address to the corresponding CUDA device, and the following processing is performed in real time:

[0048] 1) Convert the original sampled binary data into floating point data through table lookup operation;

[0049] 2) Perform scientific calculations on the decoded floating-point data, such as de-dispersion, signal detection, folding, etc.;

[0050] 3) Output the processed data in the corresponding format.

[0051] After the data processing is completed, the corresponding memory block is released to the memory pool for receiving subsequent collected data.

[0052] The present invention redirects astronomical sampling data to the socket of AF_XDP in user space in a zero-copy manner based on the XDP redirection function, reducing the load on memory copying. The XDP program runs in the kernel network driver, reducing the overhead of kernel-user state switching. It is executed at the earliest position where the packet can be processed after the network card receives the data packet, avoiding the additional processing of the general network protocol stack, greatly improving the data packet processing performance, and achieving network message processing performance similar to that of the user-state I / O framework. It only bypasses the kernel network stack, leaving the control of the network hardware completely within the kernel, and still retains the interface management and security protection capabilities provided by the operating system.

[0053] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.

Claims

1. A method for real-time acquisition and processing of radio astronomy data based on XDP, characterized in that: include: Step 1: Build the XDP program and compile it into eBPF bytecode, and load the XDP program bytecode into the kernel; Step 2: Analyze the processing path of kernel protocol stack data packets and establish a real-time astronomical data collection and processing mechanism with zero copy and network protocol stack bypass based on the XDP redirection function; Step 3: In the user space data real-time acquisition processing program, create a socket of type AF_XDP, and build a UMEM memory buffer to capture the UDP sampling data message redirected by the XDP program in real time; Step 4: Construct a memory pool, parse the UDP sampling data message, store the sampling data part of the UDP message into the memory pool, and the CUDA thread reads the memory pool and performs real-time data processing to generate archivable astronomical data products.

2. The method for real-time acquisition and processing of radio astronomy data based on XDP according to claim 1, characterized in that: The step 1 comprises: Step 1.1: Use the LLVM compiler backend to compile the XDP kernel program into eBPF bytecode; Step 1.2: Enable the kernel BPF JIT compilation function to enhance the performance of the XDP program; Step 1.3: Load the XDP program into the kernel in native mode through the libxdp library.

3. The method for real-time acquisition and processing of radio astronomy data based on XDP according to claim 1, characterized in that: The step 2 comprises: Step 2.1: The XDP program is executed in the network device driver. The program is executed once each time the network device receives a packet. When the XDP program is executed, it obtains a context object passed by the system as a parameter of the program and obtains the original representation of the data packet through the struct xdp_md* pointer. Step 2.2: Parse the data packet based on the Ethernet frame format. First, check the legitimacy of the data packet boundary through the data packet start position pointer and the end position pointer. If the data packet boundary check is illegal, the data packet is discarded. Then, parse the protocol type of the data packet according to the Ethernet frame format, hand over the non-IPv4 format message to the kernel protocol stack for processing, and the IPv4 message is processed in the next step. Step 2.3: Parse the data packet based on the IPv4 format, treat the UDP protocol as the subsequent processing, and pass the non-UDP protocol to the kernel protocol stack for processing; Step 2.4: Parse the data packet based on the UDP format and check whether the destination port number in the UDP message is consistent with the preset port number. If the destination port number is not the preset port number, pass this message to the kernel protocol stack. If the verification is successful, based on the XDP redirection function, bypass the redundant processing of the kernel network protocol stack and redirect this UDP message to the Socket of type AF_XDP in the data acquisition processing program in a zero-copy manner.

4. The method for real-time acquisition and processing of radio astronomy data based on XDP according to claim 1, characterized in that: The step 3 comprises: Step 3.1: In the real-time data acquisition processing program in the user space, create a Socket of type AF_XDP and allocate Rx ring and Tx ring for the Socket. If the application wants to send a data packet, put the same type of information into Txring and send a signal to the kernel to transmit this data packet; Step 3.2: Build a UMEM memory buffer. Through the mmap mechanism, build a continuous virtual memory area UMEM, divide the UMEM memory buffer into frames equal to memory pages, and then create a fill ring and a complete ring to bind to the UMEM buffer; Step 3.3: Continuously poll the Rx ring to capture the UDP sampling data packets that are redirected to the user space after being processed by the XDP program. When the data packet descriptor in the Rx ring reaches the specified batch size, the batch size data packets are subsequently processed.

5. The method for real-time acquisition and processing of radio astronomy data based on XDP according to claim 1, characterized in that: The step 4 comprises: Step 4.1: Construct a memory pool, construct a data memory pool to store sampled data; then, build a lock-free, first-in-first-out circular queue, and bind the lock-free circular queue to the data memory pool; Step 4.2: Get a free memory block from the memory pool, capture the batch-sized sampling data, and for each of the batch-sized packets, strip the UDP header of the packet, obtain the sampling data part, and fill it into the free memory block; when a memory block is filled with sampling data, queue the address of this memory block into the lock-free ring queue; Step 4.3: Create the same number of CUDA threads as the number of CUDA devices in the machine; For a CUDA thread, try to dequeue a memory block address from the lock-free circular queue. After successfully dequeuing, copy the fixed-size sampling data from the memory block address to the corresponding CUDA device, and perform the following processing in real time: 1) Convert the original sampled binary data into floating point data through table lookup operation; 2) Perform scientific calculations on the decoded floating-point data; 3) Output the processed data in the corresponding format; After the data processing is completed, the corresponding memory block is released to the memory pool for receiving subsequent collected data.

Citation Information

Cited By

  • Unmanned vehicle data distribution method based on rapid data path processing

    CN118869634A

  • Unmanned Vehicle Data Distribution Method Based on Fast Data Path Processing

    CN118869634B

  • Large-flow laser radar message receiving method and system based on eBPF

    CN120785914A

  • Power digital recording high-speed sampling data processing method and system based on Ethernet

    CN121070628A

  • Ethernet-based power digital recording high-speed sampling data processing method and system

    CN121070628B