Add optional support for SPDK on Linux - #116
Draft
benjarvis wants to merge 1 commit into
Draft
Conversation
…protocols Allow libevpl to run as a guest inside an existing SPDK application, intermixing libevpl and SPDK workloads on the same spdk_threads and reactors without stacking two async runtimes: - EVPL_CORE_MECH_SPDK: core mechanism that composes with the epoll backend (all evpl fds live in one internal epoll) and is pumped by a period-0 spdk_poller. Interrupt-mode reactors are supported via spdk_interrupt registration of the epoll fd plus a timerfd that is re-armed post-pump from the evpl timer heap; evpl_run/evpl_stop abort under external-loop mechanisms. evpl_continue now returns a work count so the poller reports honest BUSY/IDLE, and evpl_kick() lets same-thread foreign contexts wake the loop. - evpl_thread/evpl_threadpool transparently wrap spdk_threads in SPDK mode: creation bootstraps via spdk_thread_send_msg (blocking for readiness only on plain-pthread callers; spdk_thread callers return immediately to avoid reactor co-scheduling deadlock) and teardown is fully message-driven via a teardown poller. Existing spdk_threads can instead bolt on an evpl directly with evpl_create(). - EVPL_FRAMEWORK_SPDK registers slab buffers with spdk_mem_register (slabs become 2MiB-aligned when SPDK is enabled) so evpl iovecs are DMA-safe for SPDK I/O. - Block device open/close become asynchronous operations taking an evpl context, like all other libevpl operations (breaking API change); completion is deferral-normalized, close must run on the opening evpl, and all backends, tests and docs are updated. - EVPL_BLOCK_PROTOCOL_SPDK_BDEV: block protocol over SPDK bdevs (uri = bdev name) with byte-offset submits, ENOMEM io_wait retry, sync-write flush chaining, and registered-slab bounce buffers. - EVPL_STREAM_SPDK_TCP: TCP stream protocol over spdk_sock (pluggable impls via evpl_global_config_set_spdk_sock_impl) with zero-copy writev_async sends using a waist-based send ring, group-polled receive, interrupt-mode group registration, and a progress timer for connects and write stalls. - Legacy evpl_run tests (timer_oneshot, ping_pong_msg, bulk_msg, ping_pong_connected_msg, rdma_ops, rpc2 multifrag) are refactored to evpl_thread/callback form and now also run under the SPDK mechanism via EVPL_TEST_CORE_MECH=spdk, which boots a mini-reactor test harness; dedicated SPDK tests cover threads, doorbells, timers, memory registration, sock ping-pong/framing and bdev I/O against a malloc bdev. - The devcontainer builds SPDK v25.09 (shared libs, no nvme-cuse) so the SPDK tests run in CI; builds without SPDK are unaffected (SPDK_ENABLED tri-state, autodetected via pkg-config). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
benjarvis
marked this pull request as draft
July 27, 2026 12:29
benjarvis
added a commit
to benjarvis/libevpl
that referenced
this pull request
Aug 11, 2026
Three issues in open_handles tracking: 1. chimera_vfs_open_cache_release() error path: when a non-detached handle failed to open, it was removed from the shard but open_handles was not decremented, causing a permanent over-count. 2. chimera_vfs_open_cache_release() detached path: the comment clarifies that detached handles should NOT decrement open_handles since they were already removed from the shard during insert(). 3. chimera_vfs_open_cache_defer_close(): counted shard->open_handles before processing the pending_close list, so handles about to be closed were included in the count. Move the count after processing to report the actual remaining handles. These issues could cause the close thread to see incorrect handle counts, potentially leading to shutdown hangs or premature close decisions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SPDK can be enabled or not at compile time.
If enabled at compile time, it can be optionally enabled at runtime. If enabled:
The hybrid event/poll mode that libevpl normally has is removed when running on SPDK per SPDK convention.