From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by sourceware.org (Postfix) with ESMTPS id 341CC3858D39 for ; Tue, 9 Nov 2021 13:05:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 341CC3858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=arndb.de Received: from mail-wr1-f41.google.com ([209.85.221.41]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1M3UhO-1mjsaI1S2U-000dJw for ; Tue, 09 Nov 2021 14:05:28 +0100 Received: by mail-wr1-f41.google.com with SMTP id i5so32923932wrb.2 for ; Tue, 09 Nov 2021 05:05:27 -0800 (PST) X-Gm-Message-State: AOAM533JhGvsM3nt98b9N4kyaFK9NI9Ixx2JKooIz3xY7urpUlm4ggCt UKgeFrLR2wGxp5khVfZ46ldCRryaTVzOg6eUhVY= X-Google-Smtp-Source: ABdhPJw59Rmr+DMXszKBukNsUqZ3FsgOiqKQbSlqF8XuY+XgF6EW4Cq5VhV2Y1l1S7CXitxZ6DpXsOJS8z6kaIvCVpE= X-Received: by 2002:adf:df89:: with SMTP id z9mr8974988wrl.336.1636463127622; Tue, 09 Nov 2021 05:05:27 -0800 (PST) MIME-Version: 1.0 References: <20210923171111.300673-1-andrealmeid@collabora.com> <20210923171111.300673-21-andrealmeid@collabora.com> <51bbfe74-33f6-bb92-3ce8-a22e4185820b@collabora.com> In-Reply-To: <51bbfe74-33f6-bb92-3ce8-a22e4185820b@collabora.com> From: Arnd Bergmann Date: Tue, 9 Nov 2021 14:05:11 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 20/22] selftests: futex: Test sys_futex_waitv() timeout To: =?UTF-8?Q?Andr=C3=A9_Almeida?= Cc: Vasily Gorbik , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Darren Hart , Linux Kernel Mailing List , Steven Rostedt , Sebastian Andrzej Siewior , Collabora kernel ML , Gabriel Krisman Bertazi , Linux API , GNU C Library , Michael Kerrisk , Davidlohr Bueso , Arnd Bergmann , Alistair Francis Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Xdg4HDVpJrD8cp/HRuVp7CoFr+JIAshlvgGgOjv6oItQIlSsVbE x3d8W6BvmJtucgLT1ouFHUAl/GsuDWWkoMHX2EBXvbXMX5lzW5sGoXsIoQH6bD2rRbhBM8T 0FKN8ZJjfkjJ0YRMW5GhsvOKhFSd0EVzfVth/t4uFAxMjSzngPTUR2GB9NS/weamsJoT6Wr JunbvSN/AumTxeBRxShCA== X-UI-Out-Filterresults: notjunk:1;V03:K0://jqR374Dxk=:Y2xQ5B7W7A6iLG9ytyiZbN tU7w+cOISxHVzlLh+u5wCzwsMxRLLvonSc3c4OTht26M8oXtoVX4c3Rs7ARQvgsWiryb8CJJv TPLrRtGC57Eyz3Wef0EAg164JexBLIhxzN8fcAIFf+AMyA9OmdhwFvF7raIChbLQo1pvJXFbP srn5S3Rh2dVkZ8jtZRgHDcjVmpuBw/o4BIDeHLOyo5fUrEJt0vptq1LVvma+x4ix79UFBWlVl B29NuiCyz26gW4MsqoovzeLOkTsNjxPBLdonZ9YCDVvZcLcTqugDFFgKTFZaZxrqE3bLH9Uxc Jn9H8QfU+9bdLEMzbvT91y+C2xvqrkwnQL9EbuiL+T0Dbvo0xFQ+JZPAT0S3Hiq73BhUaJkQ5 9OAX0OTHBl2CIW2HcBaoTetTIA0TBU5iTe5DMXYNydRLbdYwdl6OPKLdRnV0fi71O9OguJqvy YrKaOZywSrBI7BISdh0Pr5yR2hTlUo6uq/O6NfWlibV39UHjK1ssRNi2BZKq9X8IM4RKnkkdb Q4/zmZ8ASQAd7vIuSp5PXpjTWunqlepJ+J1D7MPnnFHv3+522+9KzclrZFVbdmjkZa3a1LXwZ JzH++3oYkAIcQzjt6fv6pTjCrs54JICfTV6QDsw+6YICKbl/MnP0Zvn6ErobWon/UNdnaOmoy TmPRyJEBBULiJ/ogMFA1GhWcyecPOg6cmS/4fiq8K9/2cP+GN+DRXGXK9iQqIvDbHLTZSQ2Kp fFFCBKhHhUdtWP9cheNimEmGCIn5R24AG2tC3XLX1UoF9o9bsROFmwYbOXrxG29fHtg0WyjC5 ZZANV+1IcRuSUWRZylTd0jlJYnUQy+/xBWBe1F10mU7yBDP/3o= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2021 13:05:32 -0000 On Tue, Nov 9, 2021 at 1:52 PM Andr=C3=A9 Almeida wrote: > =C3=80s 08:18 de 09/11/21, Vasily Gorbik escreveu: > > On Thu, Sep 23, 2021 at 02:11:09PM -0300, Andr=C3=A9 Almeida wrote: > >> Test if the futex_waitv timeout is working as expected, using the > >> supported clockid options. > > > >> + /* futex_waitv with CLOCK_MONOTONIC */ > >> + if (futex_get_abs_timeout(CLOCK_MONOTONIC, &to, timeout_ns)) > >> + return RET_FAIL; > >> + res =3D futex_waitv(&waitv, 1, 0, &to, CLOCK_MONOTONIC); > >> + test_timeout(res, &ret, "futex_waitv monotonic", ETIMEDOUT); > >> + > >> + /* futex_waitv with CLOCK_REALTIME */ > >> + if (futex_get_abs_timeout(CLOCK_REALTIME, &to, timeout_ns)) > >> + return RET_FAIL; > >> + res =3D futex_waitv(&waitv, 1, 0, &to, CLOCK_REALTIME); > >> + test_timeout(res, &ret, "futex_waitv realtime", ETIMEDOUT); > > > > Hi Andr=C3=A9, > > > > when built with -m32 and run as compat this two futex_waitv calls hang > > on x86 and s390 (noticed while wiring up futex_waitv). The rest of the > > futex selftests pass. This suggests some common compat issue? Any ideas= ? > > The issue is that futex_waitv() only accepts struct timespec that uses > 64bit members. When using -m32, glibc will give you a 32bit timespec, > thus the timeout won't wort. Someday glibc will provide 64bit timespec > to 32bit userspace, given that this is affected by y2038 bug. I think in the latest glibc you should be able to pass -D_TIME_BITS=3D64 to the compiler to get the correct definition. Unfortunately, this only works for simple test cases, but breaks if you call any interfaces from another (non-glibc) library that depend on a particular time_t definition. Alistair Francis also recently posted a set of helpers for the old futex() call to make that easier to use from applications regardless of the libc interface. I think it would be good to have this for futex_waitv() as well. Arnd