axboe / liburing

Library providing helpers for the Linux kernel io_uring support
MIT License
2.83k stars 402 forks source link

After the upgrade, why can't an instance be created with params.flags=IORING_SETUP_SINGLE_ISSUER? What's the issue? #1166

Closed sxstd001 closed 3 months ago

sxstd001 commented 3 months ago
    io_uring ring{};
    io_uring_params params {};
    params.flags |= IORING_SETUP_SINGLE_ISSUER;  // if use this flag, it's error;
    auto ret = io_uring_queue_init_params(256, &ring, &params);

error: Invalid argument.

It was normal before the upgrade;

RogerMarcoHernandez commented 3 months ago

@sxstd001 I can’t reproduce your problem with 6.9 linux kernel version and 2.6 liburing version.

#include <liburing.h>

#include <stdio.h>
#include <string.h>

int main (void)
{
    io_uring ring{};
    io_uring_params params{};
    params.flags |= IORING_SETUP_SINGLE_ISSUER;
    const auto ret = io_uring_queue_init_params (256, &ring, &params);
    if (ret != 0)
        printf ("error: %s", strerror (ret));           

    io_uring_queue_exit (&ring);

    return ret != 0;
}

Could you please specify both versions you are using and within which conditions you are getting the error? On the other side, is there any more code than the one you provided in your program?

axboe commented 3 months ago

Please try and strace that, makes no sense. Unless you're on an old kernel that doesn't support IORING_SETUP_SINGLE_ISSUER, in which case it would indeed return -EINVAL.

sxstd001 commented 3 months ago

@sxstd001 I can’t reproduce your problem with 6.9 linux kernel version and 2.6 liburing version.

#include <liburing.h>

#include <stdio.h>
#include <string.h>

int main (void)
{
  io_uring ring{};
  io_uring_params params{};
  params.flags |= IORING_SETUP_SINGLE_ISSUER;
  const auto ret = io_uring_queue_init_params (256, &ring, &params);
  if (ret != 0)
      printf ("error: %s", strerror (ret));           

  io_uring_queue_exit (&ring);

  return ret != 0;
}

Could you please specify both versions you are using and within which conditions you are getting the error? On the other side, is there any more code than the one you provided in your program?

屏幕截图 2024-06-13 090426

sxstd001 commented 3 months ago

ArchLinux latest version;
liburing-2.6-2;

axboe commented 3 months ago

Works fine here, please provide an strace output of running that as requested.