Skip to content

[io] Detect io_uring kernel support at runtime - #23455

Open
guitargeek wants to merge 2 commits into
root-project:masterfrom
guitargeek:uring-runtime-detection
Open

guitargeek wants to merge 2 commits into
root-project:masterfrom
guitargeek:uring-runtime-detection

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

Building ROOT with the uring option requires only liburing, but the running kernel may not actually support io_uring, e.g. older EL9 kernels compiled without CONFIG_IO_URING or containers whose seccomp profile blocks the io_uring_setup system call. Previously this was only discovered by a failed ring setup on the first ReadV attempt in each thread, and the io_uring unit tests hard-failed, requiring the ROOTTEST_IGNORE_URING environment variable on such platforms.

Add RIoUring::IsAvailable(), which probes the kernel once per process and returns a diagnostic string that distinguishes an unsupported kernel from a blocked syscall. RRawFileUnix::ReadVImpl consults the probe, warns once per process, and falls back directly to blocking I/O. The unit tests now skip gracefully when io_uring is unavailable, so the ROOTTEST_IGNORE_URING configure-time gate is removed. Also export the liburing include directory: the installed header ROOT/RIoUring.hxx includes liburing headers, so the include path must not be private to the RIO library.

Fixes #12701

🤖 Done with the help of AI

@ferdymercury ferdymercury left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! some suggestions for improvement, now that you touch this code

Comment thread io/io/CMakeLists.txt Outdated
Comment thread io/io/CMakeLists.txt Outdated
Comment thread cmake/modules/RootBuildOptions.cmake

@jblomer jblomer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM.

Comment thread io/io/src/RRawFileUnix.cxx Outdated
std::string errMsg;
if (RIoUring::IsAvailable(&errMsg))
return true;
Warning("RIoUring", "io_uring is unexpectedly not available because:\n%s", errMsg.c_str());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps remove "unexpectedly" from the warning. If there is no kernel support, one can argue that it is expected.

Comment thread io/io/inc/ROOT/RIoUring.hxx Outdated
msg += ": the io_uring_setup system call is blocked, e.g. by a seccomp profile";
return std::pair<bool, std::string>(false, msg);
}();
if (!probeResult.first && errMsg)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just check for errMsg, we set it to the empty string in case of success.

Move the liburing include directory from a private property of the RIO
library to an imported uring::uring target. This exports it transitively
to consumers of the installed public header ROOT/RIoUring.hxx, which
includes liburing headers.
Building ROOT with the uring option requires only liburing, but the
running kernel may not support io_uring, e.g. older EL9 kernels compiled
without CONFIG_IO_URING or containers blocking io_uring_setup via
seccomp.

Add RIoUring::IsAvailable(), which probes the kernel once per process
and reports why io_uring is unusable. RRawFileUnix warns once and falls
back to blocking I/O instead of retrying a failing ring setup per
thread. The io_uring unit tests skip when it is unavailable, replacing
the ROOTTEST_IGNORE_URING environment variable.

Fixes root-project#12701
@guitargeek
guitargeek force-pushed the uring-runtime-detection branch from 8f2f54a to 758ae2d Compare September 22, 2026 14:27
@guitargeek
guitargeek requested a review from dpiparo as a code owner September 22, 2026 14:27
@guitargeek

Copy link
Copy Markdown
Contributor Author

Thank you guys for the review! I have addressed your requests, and have also split up the commit into two: one related to the runtime support issue, and one about the unrelated build system changes.

@jblomer, can you re-review please?

@ferdymercury ferdymercury left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@github-actions

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 17h 19m 30s ⏱️
 3 875 tests  3 874 ✅ 0 💤 1 ❌
80 068 runs  80 067 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 758ae2d.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ROOT does not properly recognize if io_uring is supported

3 participants