This pull request includes significant changes to the eBPF ring buffer implementation, focusing on improving synchronization, memory management, and adding new functionality. The most important changes include the introduction of spin locks for better concurrency control, a new flag-based system for record states, and the addition of a stress test for the ring buffer.
Synchronization and Memory Management Improvements:
libs/runtime/ebpf_ring_buffer.c: Introduced cxplat_spin_lock_t for both producer and consumer locks, replacing the previous ebpf_lock_t. This change improves concurrency control by using spin locks, which are more efficient in high-contention scenarios.
libs/runtime/ebpf_ring_buffer.c: Modified the ebpf_ring_buffer_reserve and ebpf_ring_buffer_output functions to use a new flag-based system for record states, ensuring better synchronization and memory management. [1][2]
New Flag-Based System for Record States:
libs/shared/ebpf_ring_buffer_record.h: Introduced new flags EBPF_RING_BUFFER_RECORD_FLAG_LOCKED and EBPF_RING_BUFFER_RECORD_FLAG_DISCARDED to manage the state of records in the ring buffer. This change simplifies the handling of record states and improves code readability. [1][2]
Additional Functionality:
libs/runtime/unit/platform_unit_test.cpp: Added a new stress test case ring_buffer_stress to evaluate the performance and reliability of the ring buffer under high load conditions. This test helps ensure the robustness of the ring buffer implementation.
Other Notable Changes:
libs/api/ebpf_api.cpp: Added a loop to wait for the producer to finish writing if the record is locked, ensuring data consistency.
external/usersim: Updated the submodule commit reference to point to the latest commit.
Description
This pull request includes significant changes to the eBPF ring buffer implementation, focusing on improving synchronization, memory management, and adding new functionality. The most important changes include the introduction of spin locks for better concurrency control, a new flag-based system for record states, and the addition of a stress test for the ring buffer.
Synchronization and Memory Management Improvements:
libs/runtime/ebpf_ring_buffer.c
: Introducedcxplat_spin_lock_t
for both producer and consumer locks, replacing the previousebpf_lock_t
. This change improves concurrency control by using spin locks, which are more efficient in high-contention scenarios.libs/runtime/ebpf_ring_buffer.c
: Modified theebpf_ring_buffer_reserve
andebpf_ring_buffer_output
functions to use a new flag-based system for record states, ensuring better synchronization and memory management. [1] [2]New Flag-Based System for Record States:
libs/shared/ebpf_ring_buffer_record.h
: Introduced new flagsEBPF_RING_BUFFER_RECORD_FLAG_LOCKED
andEBPF_RING_BUFFER_RECORD_FLAG_DISCARDED
to manage the state of records in the ring buffer. This change simplifies the handling of record states and improves code readability. [1] [2]Additional Functionality:
libs/runtime/unit/platform_unit_test.cpp
: Added a new stress test casering_buffer_stress
to evaluate the performance and reliability of the ring buffer under high load conditions. This test helps ensure the robustness of the ring buffer implementation.Other Notable Changes:
libs/api/ebpf_api.cpp
: Added a loop to wait for the producer to finish writing if the record is locked, ensuring data consistency.external/usersim
: Updated the submodule commit reference to point to the latest commit.Testing
CI/CD + dedicated stress test
Documentation
No.
Installation
No.