Re: BUG #19369: Not documented that io_uring on kernel versions between 5.1 and below 5.6 does not work

From: Pierre Forstmann <pierre(dot)forstmann(at)gmail(dot)com>
To: surya poondla <suryapoondla4(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, "Si, Evan" <evsi(at)amazon(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Subject: Re: BUG #19369: Not documented that io_uring on kernel versions between 5.1 and below 5.6 does not work
Date: 2026-08-27 15:49:50
Message-ID: 85f24359-47b8-4d62-9fe1-4c29e1767db3@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hi Surya,

I confirm that the compiler warning is fixed in patch v4.

About testing with meson I use following commands:

# make check
meson test -C build --print-errorlogs --suite setup --suite regress
# make installcheck-world
meson test -C build -q --print-errorlogs --setup running

I have used Ubuntu 2004 to reproduce the issue with Linux kernel 5.4.

After applying the patch and setting io_method=io_uring ,I have checked
that PG cannot be restarted:

2026-08-27 14:54:13.787 UTC [98714] FATAL:  kernel does not support
required io_uring operations
2026-08-27 14:54:13.787 UTC [98714] DETAIL:  The kernel supports
io_uring but lacks one or more of the required opcodes (IORING_OP_READ,
IORING_OP_WRITE, IORING_OP_READV, IORING_OP_WRITEV). This typically
occurs on Linux kernels older than 5.6.
2026-08-27 14:54:13.787 UTC [98714] HINT:  Either upgrade your kernel to
version 5.6 or newer, or use io_method=worker.
2026-08-27 14:54:13.788 UTC [98714] LOG:  database system is shut down

I have checked this with building PG with make and with meson.

I have also reviewed the source code and I have question about following
code section:

#ifdef HAVE_IO_URING_OPCODE_SUPPORTED
        /*
         * Use io_uring_opcode_supported() if available (liburing 2.1+).
         * This directly queries the kernel for opcode support.
         *
         * PostgreSQL uses both single-buffer (READ/WRITE) and vectored
         * (READV/WRITEV) operations. READV/WRITEV were added in kernel
5.1,
         * but READ/WRITE were added in kernel 5.6. Check for all four to
         * ensure complete support.
         */
        if (!io_uring_opcode_supported(&test_ring, IORING_OP_READ) ||
                !io_uring_opcode_supported(&test_ring, IORING_OP_WRITE) ||
                !io_uring_opcode_supported(&test_ring, IORING_OP_READV) ||
                !io_uring_opcode_supported(&test_ring, IORING_OP_WRITEV))
        {
                unsupported = true;
        }
#else

I have tried to compile the routine "is_uring_read_write_unsupported"
in  a standalone executable and I get following errors:

taio.c: In function ‘is_uring_read_write_unsupported’:
taio.c:63:40: error: passing argument 1 of ‘io_uring_opcode_supported’
from incompatible pointer type [-Wincompatible-pointer-types]
   63 |         if (!io_uring_opcode_supported(&test_ring,
IORING_OP_READ) ||
      |                                        ^~~~~~~~~~
      |                                        |
      |                                        struct io_uring *
In file included from taio.c:16:
/usr/include/liburing.h:153:74: note: expected ‘const struct
io_uring_probe *’ but argument is of type ‘struct io_uring *’
  153 | IOURINGINLINE int io_uring_opcode_supported(const struct
io_uring_probe *p,
      |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
taio.c:64:44: error: passing argument 1 of ‘io_uring_opcode_supported’
from incompatible pointer type [-Wincompatible-pointer-types]
   64 |  !io_uring_opcode_supported(&test_ring, IORING_OP_WRITE) ||
      |                                            ^~~~~~~~~~
      |                                            |
      |                                            struct io_uring *
/usr/include/liburing.h:153:74: note: expected ‘const struct
io_uring_probe *’ but argument is of type ‘struct io_uring *’
  153 | IOURINGINLINE int io_uring_opcode_supported(const struct
io_uring_probe *p,
      |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
taio.c:65:44: error: passing argument 1 of ‘io_uring_opcode_supported’
from incompatible pointer type [-Wincompatible-pointer-types]
   65 |  !io_uring_opcode_supported(&test_ring, IORING_OP_READV) ||
      |                                            ^~~~~~~~~~
      |                                            |
      |                                            struct io_uring *
/usr/include/liburing.h:153:74: note: expected ‘const struct
io_uring_probe *’ but argument is of type ‘struct io_uring *’
  153 | IOURINGINLINE int io_uring_opcode_supported(const struct
io_uring_probe *p,
      |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
taio.c:66:44: error: passing argument 1 of ‘io_uring_opcode_supported’
from incompatible pointer type [-Wincompatible-pointer-types]
   66 |  !io_uring_opcode_supported(&test_ring, IORING_OP_WRITEV))
      |                                            ^~~~~~~~~~
      |                                            |
      |                                            struct io_uring *
/usr/include/liburing.h:153:74: note: expected ‘const struct
io_uring_probe *’ but argument is of type ‘struct io_uring *’
  153 | IOURINGINLINE int io_uring_opcode_supported(const struct
io_uring_probe *p,
      |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

I get these errors both with Debian 13 and Ubuntu 2004.

Can you double-check if this is the right way to call
io_uring_opcode_support and/or if there is an issue with make/meson
configuration ?

Regards,

PF

Le 27/08/2026 à 01:28, surya poondla a écrit :
> Hi Pierre,
>
> Thank you for the review.
>
> I fixed the compiler warning in v4.
>
> I also would like to know if you manage to run the equivalent of
> 'make installcheck-world" with meson ?
>
>
> I couldn't either. I noticed the "meson test --setup running" was
> running SQL suites (regress, isolation) only and  not the TAP suite.
> So it does not look equivalent to installcheck-world in any case.
>
> I am doing some additional testing and will update my findings.
>
> Regards,
> Surya Poondla

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrey Borodin 2026-08-27 16:17:30 Re: BUG #19640: Standby permanently stuck re-requesting old timeline after promotion, never switches to new timeline
Previous Message Fujii Masao 2026-08-27 14:45:08 Re: BUG #19629: pg_restore_relation_stats reports XX000 instead of proper SQLSTATE for input validation errors

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2026-08-27 15:52:02 Re: Bypassing cursors in postgres_fdw to enable parallel plans
Previous Message Nathan Bossart 2026-08-27 15:46:20 REPACK (CONCURRENTLY) fails when table owner lacks CONNECT