[io] Detect io_uring kernel support at runtime - #23455
guitargeek wants to merge 2 commits into
Conversation
ferdymercury
left a comment
There was a problem hiding this comment.
thanks! some suggestions for improvement, now that you touch this code
| std::string errMsg; | ||
| if (RIoUring::IsAvailable(&errMsg)) | ||
| return true; | ||
| Warning("RIoUring", "io_uring is unexpectedly not available because:\n%s", errMsg.c_str()); |
There was a problem hiding this comment.
Perhaps remove "unexpectedly" from the warning. If there is no kernel support, one can argue that it is expected.
| 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) |
There was a problem hiding this comment.
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
8f2f54a to
758ae2d
Compare
|
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? |
Test Results 23 files 23 suites 3d 17h 19m 30s ⏱️ For more details on these failures, see this check. Results for commit 758ae2d. |
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