Package: libuv1
Severity: serious
Tags: patch ftbfs
Justification: fails to build from source (but built successfully in the past)
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu noble ubuntu-patch
X-Debbugs-Cc: scho...@ubuntu.com

Hi!

If the buildd is using an older kernel version, such as 5.4 as is the
case in the Ubuntu s390x builders, the build fails on the following
tests:

not ok 147 - idle_starvation
not ok 366 - timer_from_check

In Ubuntu, the attached patch was applied to fix it.

-- System Information:
Debian Release: trixie/sid
  APT prefers mantic-updates
  APT policy: (500, 'mantic-updates'), (500, 'mantic-security'), (500, 'mantic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0-14-generic (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_USER, TAINT_OOT_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru 
libuv1-1.46.0/debian/patches/lp2046442-linux-don-t-use-io_uring-on-pre-5.10.186-kernels-409.patch
 
libuv1-1.46.0/debian/patches/lp2046442-linux-don-t-use-io_uring-on-pre-5.10.186-kernels-409.patch
--- 
libuv1-1.46.0/debian/patches/lp2046442-linux-don-t-use-io_uring-on-pre-5.10.186-kernels-409.patch
   1970-01-01 01:00:00.000000000 +0100
+++ 
libuv1-1.46.0/debian/patches/lp2046442-linux-don-t-use-io_uring-on-pre-5.10.186-kernels-409.patch
   2023-12-15 12:44:07.000000000 +0100
@@ -0,0 +1,39 @@
+From 50b53cbd0db8d4e7be06939a0976ff520e791d31 Mon Sep 17 00:00:00 2001
+From: Ben Noordhuis <i...@bnoordhuis.nl>
+Date: Wed, 12 Jul 2023 23:33:49 +0200
+Subject: [PATCH] linux: don't use io_uring on pre-5.10.186 kernels (#4093)
+
+Those kernels have a known resource consumption bug where the sqpoll
+thread busy-loops.
+
+Fixes: https://github.com/libuv/libuv/issues/4089
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libuv1/+bug/2046442
+Origin: upstream, 
https://github.com/libuv/libuv/commit/50b53cbd0db8d4e7be06939a0976ff520e791d31
+Applied-Upstream: v1.47.0
+---
+ src/unix/linux.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/src/unix/linux.c b/src/unix/linux.c
+index 28803225..65fb847f 100644
+--- a/src/unix/linux.c
++++ b/src/unix/linux.c
+@@ -431,8 +431,14 @@ static int uv__use_io_uring(void) {
+   use = atomic_load_explicit(&use_io_uring, memory_order_relaxed);
+ 
+   if (use == 0) {
++    /* Older kernels have a bug where the sqpoll thread uses 100% CPU. */
++    use = uv__kernel_version() >= /* 5.10.186 */ 0x050ABA ? 1 : -1;
++
++    /* But users can still enable it if they so desire. */
+     val = getenv("UV_USE_IO_URING");
+-    use = val == NULL || atoi(val) ? 1 : -1;
++    if (val != NULL)
++      use = atoi(val) ? 1 : -1;
++
+     atomic_store_explicit(&use_io_uring, use, memory_order_relaxed);
+   }
+ 
+-- 
+2.40.1
+
diff -Nru libuv1-1.46.0/debian/patches/series 
libuv1-1.46.0/debian/patches/series
--- libuv1-1.46.0/debian/patches/series 2023-10-15 16:37:48.000000000 +0200
+++ libuv1-1.46.0/debian/patches/series 2023-12-15 12:43:14.000000000 +0100
@@ -3,3 +3,4 @@
 disable_ipv6_test.patch
 path_max_zero_st_size
 skip-multicast-test
+lp2046442-linux-don-t-use-io_uring-on-pre-5.10.186-kernels-409.patch

Reply via email to