Skip to content

io_uring_queue_init failed when using IORING_SETUP_SQPOLL, SQ_AFF, and COOP_TASKRUN with custom options #803

@TrKNguyen

Description

@TrKNguyen

Hi, I'm encountering an issue when initializing Photon with io_uring options enabled.

Here is the log output:
/////
2025/05/31 10:15:34.596740|INFO |th=000058114BE9E970|iouring-wrapper.cpp:702|new_iouring_event_engine:Init event engine: iouring [is_master=1][setup_sqpoll=1][setup_sq_aff=1][sq_thread_cpu=2]
2025/05/31 10:15:34.596755|DEBUG|th=000058114BE9E970|reset_handle.cpp:27|ResetHandle:push [this=000058114BE89150]
2025/05/31 10:15:34.596767|INFO |th=000058114BE9E970|iouring-wrapper.cpp:557|check_register_file_support:iouring: register_files is enabled
2025/05/31 10:15:34.596791|INFO |th=000058114BE9E970|iouring-wrapper.cpp:123|init:io_uring_queue_init failed, removing IORING_SETUP_COOP_TASKRUN

/////
My code for initializing Photon looks like this:
////

photon::PhotonOptions opts;
opts.iouring_sq_thread_cpu = 1;
opts.iouring_sq_thread_idle_ms = 10;

uint64_t event_flags = INIT_EVENT_IOURING |
INIT_EVENT_IOURING_SQPOLL |
INIT_EVENT_IOURING_SQ_AFF;

if (photon::init(event_flags, INIT_IO_NONE, opts)) {
LOG_ERROR_RETURN(0, -1, "Photon init failed");
}
DEFER(photon::fini());

////

It looks like the kernel rejects IORING_SETUP_COOP_TASKRUN, and Photon silently disables it. I'm trying to understand:
Could someone please clarify:

  1. Why io_uring_queue_init fails with IORING_SETUP_COOP_TASKRUN?

  2. Should I explicitly disable IORING_SETUP_COOP_TASKRUN, or is this fallback expected behavior?

  3. Are there known kernel limitations or conflicts between SQPOLL/SQ_AFF and COOP_TASKRUN?

Thank you so much for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions