Allow overriding the kernel version check for recv multishot
enhancementdriver: io-uring
Compio enables `RecvMulti` and `RecvMsgMulti` only when the reported kernel version is at least 6.0:
https://github.com/compio-rs/compio/blob/9721017467cb18edbc58ff11299e321738962a20/compio-driver/src/sys/op/managed/iour.rs#L580-L591
This does not work correctly on distribution kernels with backported io_uring features.
For example, CentOS Stream 9 kernel `5.14.0-710.el9.x86_64` contains recv and recvmsg multishot support:
https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/blob/kernel-5.14.0-710.el9/io_uring/net.c#L798-840
A functional test confirmed that a single multishot SQE produces multiple successful CQEs with both `IORING_CQE_F_MORE` and `IORING_CQE_F_BUFFER`. However, Compio sees the `5.14` release string and always selects the one-shot fallback.
The existing `io_uring::Probe` cannot detect this capability because it only reports opcode support. Multishot recv uses the existing `IORING_OP_RECV` or `IORING_OP_RECVMSG` opcode with `IORING_RECV_MULTISHOT` in `sqe.ioprio`.
My suggestion is to provide an official runtime option to force `RecvMulti` and `RecvMsgMulti`, bypassing the kernel version check. The default behavior can remain unchanged, while users who know their kernel includes the backport can explicitly enable multishot.
This would solve the issue without requiring a complex functional probe. Would such an override be acceptable to the project?
4 条评论