A vehicle-mounted kernel queue transmission optimization system and method based on NTB-vNTB EPF cooperation
By optimizing the kernel queue transmission of NTB-vNTB EPF collaboration using real-time kernel threads and zero-copy technology in the vehicle system, the problems of vehicle communication latency and CPU overhead are solved, achieving highly deterministic data processing and low-latency transmission, thus improving the real-time performance and reliability of the vehicle system.
Patent Information
- Application Number
- CN202511772117.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2045-11-28
AI Technical Summary
In in-vehicle intelligent driving and advanced driver assistance systems, the scheduling uncertainty of tasklets and the communication latency and CPU overhead caused by the data copying mechanism in traditional Linux kernel drivers affect the safety and reliability of the in-vehicle system.
The system replaces tasklets with real-time kernel threads, combines zero-copy technology with pre-allocated memory pools, optimizes the onboard kernel queue transmission of NTB-vNTB EPF collaboration, ensures high-priority processing through SCHED_FIFO or SCHED_RR scheduling policies, and intelligently manages resources when the CPU is idle.
It significantly reduced data processing latency and CPU utilization, improved the real-time performance and reliability of the vehicle system, and ensured that the vehicle video transmission latency was within 10ms, meeting real-time requirements.
Smart Images

Figure CN121210156B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of vehicle electronic communication and operating system technology, and in particular relates to the optimization of kernel data processing efficiency in high-speed communication between vehicle multi-domain controllers, especially to a vehicle kernel queue transmission optimization system and method based on NTB-vNTB EPF collaboration. Background Technology
[0002] In applications such as autonomous driving and Advanced Driver Assistance Systems (ADAS), heterogeneous automotive SoCs require real-time exchange of large amounts of data, with extremely high requirements for latency and determinism in data processing. PCIe Non-Transparent Bridge (NTB) and Virtual NTB (vNTB EPF) technologies provide 10-gigabit-level physical transmission bandwidth for automotive heterogeneous SoCs. Specifically, the vNTB EPF function driver simulates and virtualizes NTB functionality in software on a general-purpose PCIe EP device, enabling SoCs without native NTB hardware to perform NTB communication as EP terminals. This provides a flexible and high-performance heterogeneous interconnection solution for the automotive field and effectively circumvents potential patent barriers associated with direct NTB hardware implementations in existing technologies.
[0003] However, even with superior underlying hardware performance, the efficiency of data processing by the upper-layer driver remains a key factor affecting overall communication latency. In traditional Linux kernel drivers, to avoid performing time-consuming operations in interrupt contexts, mechanisms such as tasklets and workqueues are often used to postpone complex post-interrupt processing to non-interrupt contexts. While tasklets have relatively high priority, their scheduling is still non-real-time and can be affected by other high-priority interrupts or kernel tasks, leading to uncertain processing latency. This is unacceptable in vehicle-grade safety-critical applications with extremely high real-time requirements. For example, when processing data queues from doorbell interrupt notifications from NTBs (whether hardware NTBs or vNTB virtual implementations), jitter in tasklet scheduling directly impacts end-to-end data transmission latency, threatening the safety and reliability of the vehicle system. Furthermore, traditional data copying and dynamic memory allocation mechanisms also introduce unnecessary latency and CPU overhead. Therefore, achieving more efficient and deterministic data processing at the driver layer of the vehicle NTB / vNTB communication link has become a significant challenge. Summary of the Invention
[0004] To address the shortcomings of existing technologies, the present invention aims to provide an in-vehicle kernel queue transmission optimization system and method based on NTB-vNTB EPF collaboration. By improving the data processing mechanism of the driver layer, the system reduces the transmission latency of communication between heterogeneous in-vehicle SoCs and improves CPU utilization, thereby meeting the stringent real-time requirements of in-vehicle safety-critical applications.
[0005] To achieve the objectives of this invention, the technical solution adopted is as follows:
[0006] An optimization method for onboard kernel queue transmission based on NTB-vNTB EPF collaboration includes the following steps:
[0007] (1) In the NTB device driver of the first SoC of the vehicle and the vNTB EPF function driver of the second SoC of the vehicle, the traditional asynchronous data processing mechanism based on tasklet is replaced with a real-time kernel thread processing mechanism.
[0008] The real-time kernel thread adopts the SCHED_FIFO or SCHED_RR scheduling policy and is set to high priority;
[0009] (2) The NTB device driver works in conjunction with the vNTB EPF function driver. The NTB device driver is responsible for discovering, mapping and utilizing the shared memory window and doorbell interrupt provided by the EP terminal through the vNTB EPF function driver.
[0010] (3) The vNTB EPF function driver is responsible for the virtual configuration and management of the shared memory window and doorbell interrupt required by the virtual NTB function on the EP side, and responds to the doorbell interrupt triggered by the RC side to drive its local real-time kernel thread to perform data processing.
[0011] (4) During real-time kernel thread processing, vehicle-mounted zero-copy technology and pre-allocated memory pool are used.
[0012] Furthermore, the kernel queue optimization process based on real-time kernel threads specifically includes the following steps:
[0013] Upon receiving a doorbell interrupt / data ready notification, the system directly wakes up the high-priority real-time kernel thread SCHED_FIFO / RR, and directly wakes up the preset real-time thread through the wake_up_process() function; the real-time kernel thread immediately preempts the CPU for execution, and the operating system scheduler ensures that the priority real-time thread immediately obtains CPU time; the real-time kernel thread performs data processing, directly operates on shared memory using zero-copy technology, and uses a pre-allocated memory pool; and submits data to the upper-layer protocol stack or application.
[0014] Furthermore, the priority of the real-time kernel thread is dynamically adjusted according to the safety criticality level of the vehicle data being processed.
[0015] Furthermore, the method further includes intelligent management of CPU idle state. When there is no vehicle data processing, the thread can call the schedule_timeout() or wait_event_interruptible() mechanism to enter a sleep state and release CPU resources; when a new event arrives, it is quickly woken up by wake_up_process().
[0016] Furthermore, upon receiving a doorbell interrupt or data ready notification, the NTB device driver and vNTB EPF function driver wake up a high-priority real-time kernel thread.
[0017] Furthermore, the zero-copy technology allows real-time kernel threads to perform data processing directly within the shared memory window that is virtually configured and managed by the vNTB EPF driver after being awakened.
[0018] Furthermore, the system pre-allocates a fixed-size memory pool for use by the NTB / vNTB driver and upper-layer applications; when a data packet requires memory, it is allocated directly from the memory pool and returned after transmission is complete.
[0019] An onboard kernel queue transmission optimization system based on NTB-vNTB EPF collaboration includes:
[0020] The first SoC for automotive applications has a first real-time kernel thread module embedded in its NTB device driver;
[0021] The second SoC in the vehicle has a second real-time kernel thread module embedded in its vNTB EPF function driver.
[0022] Both the first real-time kernel thread module and the second real-time kernel thread module are configured as high-priority threads using the SCHED_FIFO or SCHED_RR scheduling strategy to process the vehicle communication data queue.
[0023] The NTB device driver and the vNTB EPF function driver work together through a PCIe non-transparent bridge mechanism. The vNTB EPF function driver virtually configures and manages the shared memory window and doorbell interrupt. The NTB device driver discovers, maps, and utilizes these virtual resources, and triggers the real-time kernel thread module to process data through the doorbell interrupt mechanism.
[0024] Furthermore, the system is further configured with an on-board zero-copy module and a pre-allocated memory pool module to optimize the data transmission process.
[0025] The beneficial effect of this invention lies in that, compared with the prior art, it replaces non-real-time tasklets with high-priority real-time kernel threads and optimizes their interaction with vNTB virtual resources. This is key to achieving deterministic low latency at the in-vehicle NTB / vNTB driver layer. Compared with traditional processing mechanisms based on tasklets or work queues, the scheduling of tasklets in traditional methods is non-deterministic; it may be interfered with by other high-priority interrupts or kernel tasks, leading to jitter in data processing latency. For example, when the RC-side NTB driver triggers a notification through a virtual doorbell interrupt or data writing to shared memory, in the traditional approach, the ISR will schedule a tasklet for subsequent processing. However, the execution timing of the tasklet depends on the state of the kernel scheduler, which may result in millisecond-level latency fluctuations.
[0026] This invention replaces the Tasklet mechanism with a high-priority real-time kernel thread. The EP-side vNTB EPF function drives virtual configuration and provides a shared memory window and doorbell interrupt. When the RC-side NTB driver triggers a notification or writes data through these virtual resources, the receiver's vNTB EPF driver no longer schedules Tasklets but directly wakes up a preset high-priority real-time kernel thread. By using the SCHED_FIFO or SCHED_RR scheduling policy and assigning high priority, it is ensured that the data processing thread can immediately preempt the CPU upon receiving the notification. This fundamentally eliminates the latency jitter caused by the uncertainty of traditional Tasklet scheduling, significantly improving the real-time performance and determinism of data processing.
[0027] This invention combines in-vehicle zero-copy technology and a pre-allocated memory pool to maximize the use of vNTB virtual shared memory. In the real-time kernel thread data processing flow, it fully utilizes the shared memory characteristics of the vNTB EPF driver's virtual configuration to achieve in-vehicle zero-copy data transmission, avoiding multiple copies of data between different memory regions. Simultaneously, the pre-allocated memory pool mechanism avoids frequent dynamic memory allocation and release during runtime, further reducing latency and system overhead.
[0028] This invention incorporates dynamic onboard kernel thread scheduling and intelligent CPU idle state management. The priority of real-time kernel threads can be dynamically adjusted based on the security level of the onboard data being processed (such as ASIL level) and the current data transmission frequency, ensuring that the highest priority security-critical data receives the highest priority processing. When there is no onboard data transmission, the thread can enter a low-power or suspended state, effectively managing CPU resources, and can be quickly woken up to respond when data is available.
[0029] Compared to traditional vehicle communication methods, this invention can reduce the processing latency of the driver layer of the vehicle NTB / vNTB communication link by more than 50%, and at the same time, by reducing copying and optimizing scheduling, the CPU utilization rate can be reduced by more than 20%, effectively improving the overall performance and reliability of the vehicle system.
[0030] Through this invention, 10-gigabit-level communication between heterogeneous automotive SoCs can process data more efficiently, ensuring that the latency of automotive video transmission is reduced to the 10ms level, and meeting the transmission requirements of other automotive sensor data and control commands with extremely high real-time requirements, providing solid software support for applications such as automotive intelligent driving. Attached Figure Description
[0031] Figure 1 This is a schematic diagram of the overall architecture of an onboard kernel queue transmission optimization system based on NTB-vNTB EPF collaboration;
[0032] Figure 2 This is a schematic diagram of a kernel queue optimization processing mechanism based on real-time kernel threads. Detailed Implementation
[0033] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of this application.
[0034] like Figure 1 As shown, the in-vehicle kernel queue transmission optimization system based on NTB-vNTB EPF collaboration described in this invention is applied to a scenario where the first in-vehicle SoC (e.g., RK3588, as the RC end) and the second in-vehicle SoC (e.g., TDA4-VH, as the EP end) are interconnected through a PCIe non-transparent bridge mechanism. The EP end drives virtual configuration and manages its shared memory window and doorbell interrupt through the vNTB EPF function.
[0035] The vehicle kernel queue transmission optimization system based on NTB-vNTB EPF collaboration described in this invention includes: a first vehicle SoC, whose NTB device driver embeds a first real-time kernel thread module; and a second vehicle SoC, whose vNTB EPF function driver embeds a second real-time kernel thread module.
[0036] Both the first real-time kernel thread module and the second real-time kernel thread module are configured as high-priority threads using the SCHED_FIFO or SCHED_RR scheduling strategy to process the vehicle communication data queue.
[0037] The NTB device driver and the vNTB EPF function driver work together through a PCIe non-transparent bridge mechanism. The vNTB EPF function driver virtually configures and manages shared memory windows and doorbell interrupts, while the NTB device driver discovers, maps, and utilizes these virtual resources and triggers real-time kernel thread modules for data processing through the doorbell interrupt mechanism.
[0038] The system is further configured with an on-board zero-copy module and a pre-allocated memory pool module to optimize the data transmission process.
[0039] The vehicle kernel queue transmission optimization method based on NTB-vNTB EPF collaboration described in this invention replaces the traditional tasklet asynchronous data processing mechanism with high-priority real-time kernel threads in the NTB device driver of the first vehicle SoC and the vNTB EPF function driver of the second vehicle SoC. These real-time kernel threads adopt the SCHED_FIFO (First In First Out) or SCHED_RR (Round-Robin) scheduling strategy and are given high priority to ensure that vehicle communication data can be processed deterministically and in a timely manner.
[0040] The on-board kernel queue transmission optimization method based on NTB-vNTB EPF collaboration described in this invention includes:
[0041] (1) Identify and reconstruct the original asynchronous processing mechanism in the NTB device driver of the first SoC and the vNTB EPF function driver of the second SoC.
[0042] (2) EP-side vNTB EPF function driver: This driver is responsible for virtually configuring and managing a portion of the EP-side local memory as a shared memory window accessible to the RC side, and virtually configuring the doorbell interrupt register. When the RC side (through the NTB driver) writes to these virtual doorbell interrupt registers, or when data is written to the shared memory area virtually provided by the EP side, the vNTB EPF driver, after capturing these events, no longer schedules tasklets, but directly wakes up a pre-created real-time kernel thread specifically for processing the data queue.
[0043] (3) RC-side NTB device driver: This driver is responsible for discovering and mapping the shared memory window and doorbell interrupt virtually exposed by the EP-side vNTB EPF driver. When the NTB driver (or upper-layer application) needs to exchange data or send notifications with the EP side, it directly operates on these virtual resources. When the NTB driver receives a notification from the EP side (e.g., a response via MSI / MSI-X or a doorbell interrupt), it also directly wakes up its local real-time kernel thread for processing.
[0044] (4) Thread creation and scheduling strategy: Real-time kernel threads are created using the kthread_create() function provided by the Linux kernel and set to the SCHED_FIFO or SCHED_RR scheduling strategy using sched_setscheduler() or through the sysfs interface. For example, it can be set to SCHED_FIFO with a priority of 90 (the Linux real-time priority range is usually 1-99), which is higher than most user processes and non-real-time kernel tasks.
[0045] like Figure 2 As shown, the kernel queue optimization process based on real-time kernel threads specifically includes the following steps:
[0046] (1) Upon receiving a doorbell interrupt / data ready notification, the ISR performs a brief processing, such as clearing the interrupt flag;
[0047] (2) Directly wake up high-priority real-time kernel threads SCHED_FIFO / RR. ISR directly wakes up preset real-time threads through functions such as wake_up_process();
[0048] (3) Real-time kernel threads immediately preempt the CPU for execution, and the operating system scheduling ensures that priority real-time threads immediately obtain CPU time;
[0049] (4) Real-time kernel threads perform data processing, directly operate on shared memory using zero-copy technology, and use a pre-allocated memory pool;
[0050] (5) Submit data to the upper-layer protocol stack or application.
[0051] Furthermore, data processing workflow optimization includes:
[0052] (1) Doorbell interrupt and thread wake-up: When the RC writes to the doorbell interrupt register provided by the vNTB virtual terminal of the EP terminal, or when the EP terminal needs to respond to the event of the RC terminal, the underlying processing logic of the corresponding vNTB EPF driver (or NTB driver) (usually the interrupt service routine, ISR) performs only a minimum amount of hardware register operations, and then immediately wakes up the corresponding real-time kernel thread through wake_up_process() or other synchronization mechanisms.
[0053] (2) Zero-copy technology application: After the real-time kernel thread is awakened, it directly processes data in the shared memory window virtually configured and managed by the vNTB EPF driver, avoiding the traditional process of copying data from shared memory to the local kernel cache and then to user space. This is achieved by directly manipulating page table mapping or using PCIe's DMA capabilities. For example, the physical address of shared memory can be directly mapped to user space to achieve true zero-copy.
[0054] (3) Pre-allocated memory pool: To avoid the uncertainty and delay caused by frequent memory allocation and release during runtime, the system pre-allocates a fixed-size memory pool for use by the NTB / vNTB driver and upper-layer applications. When a data packet needs memory, it is allocated directly from the memory pool and returned after transmission is completed.
[0055] Furthermore, dynamic priority adjustment based on vehicle safety level: For different vehicle communication data streams (e.g., ADAS perception data and decision commands may belong to ASIL D or C, while entertainment information may belong to ASIL B or A), their corresponding real-time kernel threads can be assigned different SCHED_FIFO / RR priorities. The thread corresponding to the highest safety level data has the highest priority, ensuring the determinism of its transmission and processing.
[0056] Furthermore, intelligent CPU idle state management: When a real-time kernel thread finishes processing all data and no new interrupts or data arrive within a certain period, the thread can call mechanisms such as `schedule_timeout()` or `wait_event_interruptible()` to enter a sleep state, releasing CPU resources. When a new event arrives, it is quickly woken up using `wake_up_process()`. This mechanism ensures rapid response during data bursts while avoiding unnecessary CPU consumption during idle periods.
[0057] Through the above optimizations, in the 10-gigabit communication link between heterogeneous automotive SoCs, the processing latency of data packets at the driver layer can be reduced from tens of microseconds (and uncertain) in traditional tasklets to several microseconds (and highly deterministic), resulting in an overall driver layer processing latency reduction of over 50%. Due to reduced data copying and optimized scheduling overhead, CPU load can also be significantly reduced by over 20%, freeing up more computing resources for automotive applications. This optimization is crucial for applications with extremely high real-time requirements, such as vehicle surround view, automatic parking, and autonomous driving sensor fusion, ensuring that the end-to-end latency of the vehicle video stream is reduced to the 10ms level and guaranteeing the timeliness of other critical data.
[0058] This invention effectively solves the pain points in real-time vehicle communication by deeply optimizing the kernel queue processing mechanism of the vehicle-mounted NTB / vNTB communication link, and provides key technical support for building a high-performance, highly reliable vehicle-mounted central computing platform.
[0059] The applicant of this invention has provided a detailed description of the embodiments of the invention in conjunction with the accompanying drawings. However, those skilled in the art should understand that the above embodiments are merely preferred embodiments of the invention. The detailed description is only intended to help readers better understand the spirit of the invention and is not intended to limit the scope of protection of the invention. On the contrary, any improvements or modifications made based on the inventive spirit of the invention should fall within the scope of protection of the invention.
Claims
1. A vehicle-mounted kernel queue transmission optimization method based on NTB-vNTB EPF cooperation, characterized in that, The method comprises the following steps: (1) replacing a traditional tasklet-based asynchronous data processing mechanism with a real-time kernel thread processing mechanism in an NTB device driver of a vehicle-mounted first SoC and a vNTB EPF function driver of a vehicle-mounted second SoC; The real-time kernel thread adopts a SCHED_FIFO or SCHED_RR scheduling strategy and is set to a high priority; (2) the NTB device driver program works in cooperation with the vNTB EPF function driver program, the NTB device driver program is responsible for discovering, mapping and utilizing a shared memory window and a doorbell interrupt provided by the vNTB EPF function driver virtually on an EP side; (3) the vNTB EPF function driver program is responsible for virtually configuring and managing the shared memory window and the doorbell interrupt required by the virtual NTB function on the EP side, and responding to a doorbell interrupt triggered by an RC side to drive a local real-time kernel thread to process data; (4) in the real-time kernel thread processing process, a vehicle-mounted zero-copy technology and a pre-allocated memory pool are adopted; The kernel queue optimization process based on the real-time kernel thread comprises the following steps: Upon receiving a doorbell interrupt / data ready notification, a high-priority real-time kernel thread SCHED_FIFO / RR is directly awakened, a preset real-time thread is directly awakened through a wake_up_process() function, the real-time kernel thread immediately preoccupies a CPU for execution, and an operating system scheduling ensures that the priority real-time thread immediately obtains CPU time; The real-time kernel thread executes data processing, directly operates the shared memory by using the zero-copy technology, and uses the pre-allocated memory pool; and submits data to an upper protocol stack or an application.
2. The NTB-vNTB EPF collaboration based in-vehicle kernel queue transfer optimization method according to claim 1, characterized in that, The priority of the real-time kernel thread is dynamically adjusted according to a safety-critical level of vehicle-mounted data being processed.
3. The NTB-vNTB EPF collaboration based in-vehicle kernel queue transfer optimization method according to claim 1, characterized in that, The method further comprises intelligent management of a CPU idle state, when there is no vehicle-mounted data processing, a thread enters a sleep state through a schedule_timeout() or wait_event_interruptible() mechanism, and CPU resources are released; and when a new event arrives, the thread is quickly awakened through a wake_up_process().
4. The NTB-vNTB EPF collaboration based in-vehicle kernel queue transfer optimization method according to claim 1, characterized in that, The NTB device driver and the vNTB EPF function driver awaken a high-priority real-time kernel thread upon receiving a doorbell interrupt or a data ready notification.
5. The NTB-vNTB EPF collaboration based in-vehicle kernel queue transfer optimization method according to claim 1, characterized in that, The zero-copy technology is that, after the real-time kernel thread is awakened, data processing is directly performed in a shared memory window virtually configured and managed by the vNTB EPF driver.
6. The NTB-vNTB EPF collaboration based in-vehicle kernel queue transfer optimization method according to claim 1, characterized in that, A system pre-allocates a fixed-size memory pool for the NTB / vNTB driver and an upper application; when a data packet needs memory, the memory is directly allocated from the memory pool, and is returned after transmission is completed.
7. A system for NTB-vNTB EPF collaborative based in-vehicle kernel queue transfer optimization, configured to perform the method of any one of claims 1-6. The method comprises the following steps: a vehicle-mounted first SoC, an NTB device driver program of which is embedded with a first real-time kernel thread module; a vehicle-mounted second SoC, a vNTB EPF function driver program of which is embedded with a second real-time kernel thread module; and The first real-time kernel thread module and the second real-time kernel thread module are configured as high-priority threads with SCHED_FIFO or SCHED_RR scheduling strategies, and are used for processing the vehicle-mounted communication data queue; The NTB device driver and the vNTB EPF function driver work together through a PCIe non-transparent bridge mechanism, the vNTB EPF function driver virtually configures and manages shared memory windows and doorbell interrupts, the NTB device driver discovers, maps and utilizes these virtual resources, and triggers the real-time kernel thread module to process data through the doorbell interrupt mechanism; The system is further configured with a vehicle-mounted zero-copy module and a pre-allocated memory pool module to optimize the data transmission process.
Citation Information
Patent Citations
Scheduling priority adjustment method and device, equipment and storage medium
CN117112241A
Real-time mixing test control and test system and method based on Linux-RT system and application
CN120972724A