|
Zbigniew Jędrzejewski-Szmek |
6384ab |
From fce5b2ac2a51b9ecbfb258ff7e62f4e67a38d4c8 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
Date: Fri, 12 Mar 2021 10:20:38 +0100
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
Subject: [PATCH] sd-event: disable epoll_pwait2 for now
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
This reverts the gist of commit 798445ab84cff51bde7fcf936f0fb19c37cf858c.
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
Unfortunately the new syscall causes test-event to hang. 32 bit architectures
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
seem affected: i686 and arm32 in fedora koji. 32 bit build of test-event hangs
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
reliably under valgrind:
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
$ PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig meson build-32 -Dc_args=-m32 -Dc_link_args=-m32 -Dcpp_args=-m32 -Dcpp_link_args=-m32 && ninja -C build-32 test-event && valgrind build/test-event
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
If I set epoll_pwait2_absent=true, so the new function is never called, then
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
the issue does not reproduce. It seems to be strictly tied to the syscall.
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
On amd64, the syscall is not used, at least with the kernel that Fedora
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
provides. The kernel patch 58169a52ebc9a733aeb5bea857bc5daa71a301bb says:
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
For timespec, only support this new interface on 2038 aware platforms
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
that define __kernel_timespec_t. So no CONFIG_COMPAT_32BIT_TIME.
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
And Fedora sets CONFIG_COMPAT_32BIT_TIME=y. I expect most other distros will too.
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
On amd64: epoll_wait_usec: epoll_pwait2: ret=-1 / errno=38
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
On i686 (same kernel): epoll_wait_usec: epoll_pwait2: ret=2 / errno=0
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
Is this some kind of emulation? Anyway, it seems that this is what is going wrong.
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
So let's disable the syscall until it becomes more widely available and the
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
kinks have been ironed out.
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
Fixes test-event issue in #19052.
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
---
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
src/libsystemd/sd-event/sd-event.c | 10 ++++++++--
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
index 8f74b141015..b76b0623fe3 100644
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
--- a/src/libsystemd/sd-event/sd-event.c
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
+++ b/src/libsystemd/sd-event/sd-event.c
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
@@ -3808,10 +3808,15 @@ static int epoll_wait_usec(
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
int maxevents,
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
usec_t timeout) {
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
- static bool epoll_pwait2_absent = false;
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
int r, msec;
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
+#if 0
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
+ static bool epoll_pwait2_absent = false;
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
- /* A wrapper that uses epoll_pwait2() if available, and falls back to epoll_wait() if not */
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
+ /* A wrapper that uses epoll_pwait2() if available, and falls back to epoll_wait() if not.
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
+ *
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
+ * FIXME: this is temporarily disabled until epoll_pwait2() becomes more widely available.
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
+ * See https://github.com/systemd/systemd/pull/18973 and
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
+ * https://github.com/systemd/systemd/issues/19052. */
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
if (!epoll_pwait2_absent && timeout != USEC_INFINITY) {
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
struct timespec ts;
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
@@ -3829,6 +3834,7 @@ static int epoll_wait_usec(
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
epoll_pwait2_absent = true;
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
}
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
+#endif
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
if (timeout == USEC_INFINITY)
|
|
Zbigniew Jędrzejewski-Szmek |
6384ab |
msec = -1;
|