feat(thread): add interrupt mode and FdGroup API wrappers#105
Open
jr42 wants to merge 2 commits intoopenebs:developfrom
Open
feat(thread): add interrupt mode and FdGroup API wrappers#105jr42 wants to merge 2 commits intoopenebs:developfrom
jr42 wants to merge 2 commits intoopenebs:developfrom
Conversation
This was referenced Apr 12, 2026
Add safe Rust wrappers for SPDK's interrupt mode facility (available since SPDK 24.09) and the fd_group hierarchical event multiplexing API. New Thread methods: - interrupt_mode_enable/is_enabled: global init and query - set_interrupt_mode: per-thread poll/interrupt switching - get_interrupt_fd/get_interrupt_fd_group: access thread event fds New FdGroup struct with RAII lifecycle: - create/wait/nest/unnest: hierarchical event multiplexing - add/add_with_fd_type: fd registration with optional auto-drain New FD_TYPE_EVENTFD constant for auto-draining eventfds in fd_group_wait. These APIs enable custom reactors to sleep in fd_group_wait() instead of busy-polling, reducing CPU usage from ~100% to near-zero when idle. Ref: openebs/mayastor#1745 Signed-off-by: Jeremias Reith <jr42@users.noreply.github.com>
Update SPDK revision to include iSCSI poll group interrupt registration and bdev wait_for_examine periodic poller fix, both required for interrupt mode with custom reactors. Note: temporarily points to jr42/spdk fork until the upstream PR is merged into openebs/spdk, at which point owner should revert to "openebs" and rev/sha256 updated to the merged commit. Depends-On: openebs/spdk PR (iSCSI + bdev interrupt fixes) Signed-off-by: Jeremias Reith <jr42@users.noreply.github.com>
tiagolobocastro
approved these changes
Apr 14, 2026
Member
tiagolobocastro
left a comment
There was a problem hiding this comment.
We'll have to merge the dependent PR before this one, I'll try to review it a little later today
| /// fd_type value for eventfds: `fd_group_wait()` auto-drains these | ||
| /// by reading the counter to 0 before invoking the callback. | ||
| /// Matches `SPDK_FD_TYPE_EVENTFD` in `spdk/fd_group.h`. | ||
| pub const FD_TYPE_EVENTFD: u32 = 0x1; |
Member
There was a problem hiding this comment.
We should have access to it, via crate::libspdk::SPDK_FD_TYPE_EVENTFD ?
|
|
||
| impl Debug for FdGroup { | ||
| fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | ||
| write!(f, "FdGroup({:p})", self.inner) |
Member
There was a problem hiding this comment.
Is it worth including the owner?
|
|
||
| impl FdGroup { | ||
| /// Create a new fd_group. | ||
| pub fn create() -> Result<Self, i32> { |
Member
There was a problem hiding this comment.
nit: Should we return nix::Error here? and throughout
Abhinandan-Purkait
approved these changes
Apr 14, 2026
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.
Summary
Safe Rust wrappers for SPDK's interrupt mode facility and fd_group
hierarchical event multiplexing API (available since SPDK 24.09),
enabling custom reactors to sleep in
fd_group_wait()instead ofbusy-polling.
New Thread methods:
interrupt_mode_enable()/interrupt_mode_is_enabled(): global init and queryset_interrupt_mode(enable): per-thread poll/interrupt switchingget_interrupt_fd()/get_interrupt_fd_group(): access thread event fdsNew FdGroup struct with RAII lifecycle:
create()/Drop: lifecycle managementwait(timeout): block until events (fd_group_wait)nest(child)/unnest(child): hierarchical event multiplexingadd()/add_with_fd_type(): fd registration with optional auto-drainNew constant:
FD_TYPE_EVENTFD: marks eventfds for auto-draining infd_group_wait()These APIs enable the mayastor reactor to implement interrupt mode,
reducing CPU from ~1000m per core to <300m when idle.
Depends-On: openebs/spdk#70 (iSCSI + bdev interrupt fixes)
Ref: openebs/mayastor#1745
Test plan