Re: [PATCH] check kernel version for io_method

From: Pierre Forstmann <pierre(dot)forstmann(at)gmail(dot)com>
To: Steven Niu <niushiji(at)gmail(dot)com>, Andreas Karlsson <andreas(at)proxel(dot)se>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] check kernel version for io_method
Date: 2026-01-14 15:29:43
Message-ID: 5c251f33-8463-4736-aef7-6873b37e48a5@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

OK I was wrong: I can use io_uring_get_probe() if postgres has been
built with liburing flag.

So I have replaced uname() call by io_uring_get_probe() call and I have
modified the error messages: Linux kernel version is neither directly
used  nor mentioned.

Le 14/01/2026 à 11:18, Pierre a écrit :
>
> Le 14/01/2026 à 08:31, Steven Niu a écrit :
>> From: Andreas Karlsson <andreas(at)proxel(dot)se>
>> Sent: Wednesday, January 14, 2026 15:27
>> To: Steven Niu <niushiji(at)gmail(dot)com>; Pierre
>> <pierre(dot)forstmann(at)gmail(dot)com>; pgsql-hackers(at)lists(dot)postgresql(dot)org
>> <pgsql-hackers(at)lists(dot)postgresql(dot)org>
>> Subject: Re: [PATCH] check kernel version for io_method
>>
>>
>> On 1/14/26 8:22 AM, Steven Niu wrote:
>>> I agree that you are correct for now. But in future, the IoMethod
>>> may have new member. Then we have to process it.
>>>
>>> How about change to like this:
>>>     + #else
>>>     +     if (*newval == IOMETHOD_IO_URING)
>>>     +     {
>>>     +             GUC_check_errdetail("io_uring not enabled.");
>>>     +             return false;
>>>     +     }
>> No, that would be incorrect. It would not even compile.
>> IOMETHOD_IO_URING is not even defined if we do not compile with liburing
>> enabled. You can try it out yourself by compiling PostgreSQL without
>> io_uring support and then try to enable it. You will get an error and
>> that code will never be reached.
>>
>> Andreas
>>
>>
>>
>>
>> ________________________________________
>>
>>
>> Yes, you are definitely correct.
>> I'd like to withdwar my proposal.
>
> Hello,
>
> I have modified message in case io_uring is not enabled when building
> PG. But currently I cannot test it, GUC parameter is rejected in
> earlier steps:
>
> pg_ctl start
> waiting for server to start....2026-01-14 09:35:37.046 GMT [16336]
> LOG:  invalid value for parameter "io_method": "io_uring"
> 2026-01-14 09:35:37.046 GMT [16336] HINT:  Available values: sync,
> worker.
> 2026-01-14 10:35:37.047 CET [16336] FATAL:  configuration file
> "/home/pierre/pgdata/postgresql.conf" contains errors
>  stopped waiting
> pg_ctl: could not start server
>
> I don't know how to test io_uring features in code because if io_uring
> is not enabled at compilation time, I don't think it is possible to
> compile code calling  io_uring_get_probe_ring() or
> io_uring_opcode_supported() ?
>
>
> Thanks.
>

Attachment Content-Type Size
0003-patch-check-kernel-support-for-io-uring.patch text/x-patch 2.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Japin Li 2026-01-14 15:31:11 Re: Add IS_INDEX macro to brin and gist index
Previous Message Andres Freund 2026-01-14 15:20:02 Re: Buffer locking is special (hints, checksums, AIO writes)