pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #19368: f54af9f does not create the correct macro for autotools build
6+ messages / 4 participants
[nested] [flat]

* BUG #19368: f54af9f does not create the correct macro for autotools build
@ 2025-12-31 00:25 PG Bug reporting form <noreply@postgresql.org>
  2025-12-31 15:59 ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: PG Bug reporting form @ 2025-12-31 00:25 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: evsi@amazon.com

The following bug has been logged on the website:

Bug reference:      19368
Logged by:          Evan Si
Email address:      evsi@amazon.com
PostgreSQL version: 18.1
Operating system:   Amazon Linux 2, Amazon Linux 2023
Description:        

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=f54af9f2679d

The commit f54af9f2679d added a macro HAVE_LIBURING_QUEUE_INIT_MEM that is
checked to see if slowdown from memory mappings can be avoided when using
io_uring.
This HAVE_LIBURING_QUEUE_INIT_MEM is set by Meson build after checking
liburing.
However, the autotools build seems to set a different macro,
HAVE_IO_URING_QUEUE_INIT_MEM, which is never used.

This means when the server is built with autotools, the slowdown when using
io_uring can never be avoided.



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #19368: f54af9f does not create the correct macro for autotools build
  2025-12-31 00:25 BUG #19368: f54af9f does not create the correct macro for autotools build PG Bug reporting form <noreply@postgresql.org>
@ 2025-12-31 15:59 ` Tom Lane <tgl@sss.pgh.pa.us>
  2025-12-31 16:50   ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Masahiko Sawada <sawada.mshk@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2025-12-31 15:59 UTC (permalink / raw)
  To: evsi@amazon.com; +Cc: pgsql-bugs@lists.postgresql.org, Andres Freund <andres@anarazel.de>

PG Bug reporting form <noreply@postgresql.org> writes:
> The commit f54af9f2679d added a macro HAVE_LIBURING_QUEUE_INIT_MEM that is
> checked to see if slowdown from memory mappings can be avoided when using
> io_uring.
> This HAVE_LIBURING_QUEUE_INIT_MEM is set by Meson build after checking
> liburing.
> However, the autotools build seems to set a different macro,
> HAVE_IO_URING_QUEUE_INIT_MEM, which is never used.

> This means when the server is built with autotools, the slowdown when using
> io_uring can never be avoided.

This is indeed busted, but I'd argue that the autoconf build has the
right macro name and meson and the C code are using the wrong one:

  if cc.has_function('io_uring_queue_init_mem',
      dependencies: liburing, args: test_c_args)
    cdata.set('HAVE_LIBURING_QUEUE_INIT_MEM', 1)
  endif

That's clearly not following the "HAVE_function" convention.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #19368: f54af9f does not create the correct macro for autotools build
  2025-12-31 00:25 BUG #19368: f54af9f does not create the correct macro for autotools build PG Bug reporting form <noreply@postgresql.org>
  2025-12-31 15:59 ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Tom Lane <tgl@sss.pgh.pa.us>
@ 2025-12-31 16:50   ` Masahiko Sawada <sawada.mshk@gmail.com>
  2025-12-31 16:52     ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Masahiko Sawada @ 2025-12-31 16:50 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: evsi@amazon.com, pgsql-bugs@lists.postgresql.org, Andres Freund <andres@anarazel.de>

On Wed, Dec 31, 2025 at 7:59 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> PG Bug reporting form <noreply@postgresql.org> writes:
> > The commit f54af9f2679d added a macro HAVE_LIBURING_QUEUE_INIT_MEM that is
> > checked to see if slowdown from memory mappings can be avoided when using
> > io_uring.
> > This HAVE_LIBURING_QUEUE_INIT_MEM is set by Meson build after checking
> > liburing.
> > However, the autotools build seems to set a different macro,
> > HAVE_IO_URING_QUEUE_INIT_MEM, which is never used.
>
> > This means when the server is built with autotools, the slowdown when using
> > io_uring can never be avoided.
>
> This is indeed busted, but I'd argue that the autoconf build has the
> right macro name and meson and the C code are using the wrong one:
>
>   if cc.has_function('io_uring_queue_init_mem',
>       dependencies: liburing, args: test_c_args)
>     cdata.set('HAVE_LIBURING_QUEUE_INIT_MEM', 1)
>   endif
>
> That's clearly not following the "HAVE_function" convention.

Agreed. The attached patch should fix the issue.

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

Attachments:

  [application/octet-stream] fix.patch (1.4K, ../../CAD21AoBpFg-gMByFf0bQMx8dhE9jG5s0u6r1_QcCJKs+fA+Xcw@mail.gmail.com/2-fix.patch)
  download | inline diff:
diff --git a/meson.build b/meson.build
index ec08cd49056..f95b99f7063 100644
--- a/meson.build
+++ b/meson.build
@@ -1030,7 +1030,7 @@ if liburing.found()
 
   if cc.has_function('io_uring_queue_init_mem',
       dependencies: liburing, args: test_c_args)
-    cdata.set('HAVE_LIBURING_QUEUE_INIT_MEM', 1)
+    cdata.set('HAVE_IO_URING_QUEUE_INIT_MEM', 1)
   endif
 
 endif
diff --git a/src/backend/storage/aio/method_io_uring.c b/src/backend/storage/aio/method_io_uring.c
index 00cb017ca3c..6916ae69832 100644
--- a/src/backend/storage/aio/method_io_uring.c
+++ b/src/backend/storage/aio/method_io_uring.c
@@ -156,7 +156,7 @@ pgaio_uring_check_capabilities(void)
 	 * also has a secondary benefit: We can determine precisely how much
 	 * memory we need for each io_uring instance.
 	 */
-#if defined(HAVE_LIBURING_QUEUE_INIT_MEM) && defined(IORING_SETUP_NO_MMAP)
+#if defined(HAVE_IO_URING_QUEUE_INIT_MEM) && defined(IORING_SETUP_NO_MMAP)
 	{
 		struct io_uring test_ring;
 		size_t		ring_size;
@@ -341,7 +341,7 @@ pgaio_uring_shmem_init(bool first_time)
 		 * with its data in shared memory. Otherwise fall back io_uring
 		 * creating a memory mapping for each ring.
 		 */
-#if defined(HAVE_LIBURING_QUEUE_INIT_MEM) && defined(IORING_SETUP_NO_MMAP)
+#if defined(HAVE_IO_URING_QUEUE_INIT_MEM) && defined(IORING_SETUP_NO_MMAP)
 		if (pgaio_uring_caps.mem_init_size > 0)
 		{
 			struct io_uring_params p = {0};


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #19368: f54af9f does not create the correct macro for autotools build
  2025-12-31 00:25 BUG #19368: f54af9f does not create the correct macro for autotools build PG Bug reporting form <noreply@postgresql.org>
  2025-12-31 15:59 ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Tom Lane <tgl@sss.pgh.pa.us>
  2025-12-31 16:50   ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Masahiko Sawada <sawada.mshk@gmail.com>
@ 2025-12-31 16:52     ` Tom Lane <tgl@sss.pgh.pa.us>
  2025-12-31 19:20       ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Masahiko Sawada <sawada.mshk@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2025-12-31 16:52 UTC (permalink / raw)
  To: Masahiko Sawada <sawada.mshk@gmail.com>; +Cc: evsi@amazon.com, pgsql-bugs@lists.postgresql.org, Andres Freund <andres@anarazel.de>

Masahiko Sawada <sawada.mshk@gmail.com> writes:
> On Wed, Dec 31, 2025 at 7:59 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> This is indeed busted, but I'd argue that the autoconf build has the
>> right macro name and meson and the C code are using the wrong one:

> Agreed. The attached patch should fix the issue.

You beat me to it ;-).  Patch LGTM.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #19368: f54af9f does not create the correct macro for autotools build
  2025-12-31 00:25 BUG #19368: f54af9f does not create the correct macro for autotools build PG Bug reporting form <noreply@postgresql.org>
  2025-12-31 15:59 ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Tom Lane <tgl@sss.pgh.pa.us>
  2025-12-31 16:50   ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Masahiko Sawada <sawada.mshk@gmail.com>
  2025-12-31 16:52     ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Tom Lane <tgl@sss.pgh.pa.us>
@ 2025-12-31 19:20       ` Masahiko Sawada <sawada.mshk@gmail.com>
  2026-01-02 14:28         ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 6+ messages in thread

From: Masahiko Sawada @ 2025-12-31 19:20 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: evsi@amazon.com, pgsql-bugs@lists.postgresql.org, Andres Freund <andres@anarazel.de>

On Wed, Dec 31, 2025 at 8:52 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Masahiko Sawada <sawada.mshk@gmail.com> writes:
> > On Wed, Dec 31, 2025 at 7:59 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> This is indeed busted, but I'd argue that the autoconf build has the
> >> right macro name and meson and the C code are using the wrong one:
>
> > Agreed. The attached patch should fix the issue.
>
> You beat me to it ;-).  Patch LGTM.

Thank you for reviewing the patch! Pushed.

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #19368: f54af9f does not create the correct macro for autotools build
  2025-12-31 00:25 BUG #19368: f54af9f does not create the correct macro for autotools build PG Bug reporting form <noreply@postgresql.org>
  2025-12-31 15:59 ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Tom Lane <tgl@sss.pgh.pa.us>
  2025-12-31 16:50   ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Masahiko Sawada <sawada.mshk@gmail.com>
  2025-12-31 16:52     ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Tom Lane <tgl@sss.pgh.pa.us>
  2025-12-31 19:20       ` Re: BUG #19368: f54af9f does not create the correct macro for autotools build Masahiko Sawada <sawada.mshk@gmail.com>
@ 2026-01-02 14:28         ` Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 6+ messages in thread

From: Andres Freund @ 2026-01-02 14:28 UTC (permalink / raw)
  To: Masahiko Sawada <sawada.mshk@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; evsi@amazon.com; pgsql-bugs@lists.postgresql.org

Hi,

On 2025-12-31 11:20:17 -0800, Masahiko Sawada wrote:
> On Wed, Dec 31, 2025 at 8:52 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >
> > Masahiko Sawada <sawada.mshk@gmail.com> writes:
> > > On Wed, Dec 31, 2025 at 7:59 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > >> This is indeed busted, but I'd argue that the autoconf build has the
> > >> right macro name and meson and the C code are using the wrong one:

Ugh, yea, not sure what I running on that day.

> > > Agreed. The attached patch should fix the issue.
> >
> > You beat me to it ;-).  Patch LGTM.
> 
> Thank you for reviewing the patch! Pushed.

Thanks!

Greetings,

Andres Freund





^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-01-02 14:28 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-12-31 00:25 BUG #19368: f54af9f does not create the correct macro for autotools build PG Bug reporting form <noreply@postgresql.org>
2025-12-31 15:59 ` Tom Lane <tgl@sss.pgh.pa.us>
2025-12-31 16:50   ` Masahiko Sawada <sawada.mshk@gmail.com>
2025-12-31 16:52     ` Tom Lane <tgl@sss.pgh.pa.us>
2025-12-31 19:20       ` Masahiko Sawada <sawada.mshk@gmail.com>
2026-01-02 14:28         ` Andres Freund <andres@anarazel.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox