From: Arnd Bergmann <arnd@arndb.de>
To: Alistair Francis <alistair.francis@opensource.wdc.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Arnd Bergmann <arnd@arndb.de>, Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Alistair Francis <alistair23@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Davidlohr Bueso <dave@stgolabs.net>,
Ingo Molnar <mingo@redhat.com>,
Darren Hart <dvhart@infradead.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
linux-perf-users@vger.kernel.org,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Alistair Francis <alistair.francis@wdc.com>
Subject: Re: [PATCH v3 3/6] uapi: futex: Add a futex syscall
Date: Fri, 26 Nov 2021 08:24:27 +0100 [thread overview]
Message-ID: <CAK8P3a1sFSaMGhXkKJcLKgd68xSK3MMQuySXb62sWEacwzxt=g@mail.gmail.com> (raw)
In-Reply-To: <20211126060024.3290177-3-alistair.francis@opensource.wdc.com>
On Fri, Nov 26, 2021 at 7:00 AM Alistair Francis
<alistair.francis@opensource.wdc.com> wrote:
>
> From: Alistair Francis <alistair.francis@wdc.com>
>
> This commit adds two futex syscall wrappers that are exposed to
> userspace.
>
> Neither the kernel or glibc currently expose a futex wrapper, so
> userspace is left performing raw syscalls. This has mostly been because
> the overloading of one of the arguments makes it impossible to provide a
> single type safe function.
>
> Until recently the single syscall has worked fine. With the introduction
> of a 64-bit time_t futex call on 32-bit architectures, this has become
> more complex. The logic of handling the two possible futex syscalls is
> complex and often implemented incorrectly.
>
> This patch adds two futux syscall functions that correctly handle the
s/futux/futex/
> time_t complexity for userspace.
>
> This idea is based on previous discussions:
> https://lore.kernel.org/lkml/CAK8P3a3x_EyCiPDpMK54y=Rtm-Wb08ym2TNiuAZgXhYrThcWTw@mail.gmail.com/
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
The implementation looks correct to me, the calling conventions seem
"good enough"
to me, but I wouldn't object if someone else can suggest a better interface.
One minor detail:
> +/**
> + * futex_syscall_timeout() - __NR_futex/__NR_futex_time64 syscall wrapper
> + * @uaddr: address of first futex
> + * @op: futex op code
> + * @val: typically expected value of uaddr, but varies by op
> + * @timeout: an absolute struct timespec
> + * @uaddr2: address of second futex for some ops
> + * @val3: varies by op
> + */
> +static inline int
> +__kernel_futex_syscall_timeout(volatile uint32_t *uaddr, int op, uint32_t val,
> + struct timespec *timeout, volatile uint32_t *uaddr2, int val3)
The two function names do not match the respective documentation.
Arnd
next prev parent reply other threads:[~2021-11-26 7:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-26 6:00 [PATCH v3 1/6] perf bench futex: Add support for 32-bit systems with 64-bit time_t Alistair Francis
2021-11-26 6:00 ` [PATCH v3 2/6] selftests: futex: Call the futex syscall from a function Alistair Francis
2021-11-26 6:00 ` [PATCH v3 3/6] uapi: futex: Add a futex syscall Alistair Francis
2021-11-26 7:24 ` Arnd Bergmann [this message]
2021-11-26 6:00 ` [PATCH v3 4/6] selftests: futex: Add support for 32-bit systems with 64-bit time_t Alistair Francis
2021-11-26 7:36 ` Arnd Bergmann
2021-11-26 6:00 ` [PATCH v3 5/6] uapi: futex: Add a futex waitv syscall Alistair Francis
2021-11-26 7:27 ` Arnd Bergmann
2021-11-26 6:00 ` [PATCH v3 6/6] selftests: futex: Use futex_waitv helper function Alistair Francis
2021-11-26 7:33 ` Arnd Bergmann
2021-11-26 7:19 ` [PATCH v3 1/6] perf bench futex: Add support for 32-bit systems with 64-bit time_t Arnd Bergmann
2022-02-26 11:47 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAK8P3a1sFSaMGhXkKJcLKgd68xSK3MMQuySXb62sWEacwzxt=g@mail.gmail.com' \
--to=arnd@arndb.de \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=alistair.francis@opensource.wdc.com \
--cc=alistair.francis@wdc.com \
--cc=alistair23@gmail.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).