From: "André Almeida" <andrealmeid@collabora.com>
To: linux-kernel@vger.kernel.org, tglx@linutronix.de, peterz@infradead.org
Cc: krisman@collabora.com, kernel@collabora.com,
andrealmeid@collabora.com, dvhart@infradead.org,
mingo@redhat.com, pgriffais@valvesoftware.com,
fweimer@redhat.com, libc-alpha@sourceware.org,
malteskarupke@web.de, linux-api@vger.kernel.org, arnd@arndb.de
Subject: [RFC v2 0/4] futex2: Add new futex interface
Date: Thu, 9 Jul 2020 14:59:17 -0300 [thread overview]
Message-ID: <20200709175921.211387-1-andrealmeid@collabora.com> (raw)
Hello,
This RFC is a followup to the previous discussion initiated from my last
patch "futex: Implement mechanism to wait on any of several futexes"[1].
As stated in the thread, the correct approach to move forward with the
wait multiple operation would be to create a new syscall that would have
all new cool features.
The first patch adds the new interface and just translate the call for
the old interface, without implementing new features. The goal here is
to establish the interface and to check if everyone is happy with this
API. The rest of patches are selftests to show the interface in action.
I have the following questions:
- What suggestions do you have to implement this? Start from scratch or
reuse the most code possible?
- The interface seems correct and implements the requirements asked by you?
Those are the cool new features that this syscall should address some
day:
- Operate with variable bit size futexes, not restricted to 32:
8, 16 and 64
- Wait on multiple futexes, using the following semantics:
struct futex_wait {
void *uaddr;
unsigned long val;
unsigned long flags;
};
sys_futex_waitv(struct futex_wait *waiters, unsigned int nr_waiters,
unsigned long flags, struct __kernel_timespec *timo);
- Have NUMA optimizations: if FUTEX_NUMA_FLAG is set, the `void *uaddr`
argument won't be a value of type u{8, 16, 32, 64} anymore, but a struct
containing a NUMA node hint:
struct futex32_numa {
u32 value __attribute__ ((aligned (8)));
u32 hint;
};
struct futex64_numa {
u64 value __attribute__ ((aligned (16)));
u64 hint;
};
Thanks,
André
Changes since v1:
- The timeout argument now uses __kernel_timespec as type
- time32 interface was removed
v1: https://lore.kernel.org/patchwork/cover/1255437/
[1] https://lore.kernel.org/patchwork/patch/1194339/
André Almeida (4):
futex2: Add new futex interface
selftests: futex: Add futex2 wake/wait test
selftests: futex: Add futex2 timeout test
selftests: futex: Add futex2 wouldblock test
MAINTAINERS | 2 +-
arch/x86/entry/syscalls/syscall_32.tbl | 2 +
arch/x86/entry/syscalls/syscall_64.tbl | 2 +
include/linux/syscalls.h | 7 ++
include/uapi/asm-generic/unistd.h | 8 +-
include/uapi/linux/futex.h | 10 ++
init/Kconfig | 7 ++
kernel/Makefile | 1 +
kernel/futex2.c | 73 ++++++++++++
kernel/sys_ni.c | 4 +
tools/include/uapi/asm-generic/unistd.h | 7 +-
.../selftests/futex/functional/.gitignore | 1 +
.../selftests/futex/functional/Makefile | 4 +-
.../selftests/futex/functional/futex2_wait.c | 111 ++++++++++++++++++
.../futex/functional/futex_wait_timeout.c | 38 ++++--
.../futex/functional/futex_wait_wouldblock.c | 33 +++++-
.../testing/selftests/futex/functional/run.sh | 3 +
.../selftests/futex/include/futex2test.h | 77 ++++++++++++
18 files changed, 373 insertions(+), 17 deletions(-)
create mode 100644 kernel/futex2.c
create mode 100644 tools/testing/selftests/futex/functional/futex2_wait.c
create mode 100644 tools/testing/selftests/futex/include/futex2test.h
--
2.27.0
next reply other threads:[~2020-07-09 18:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 17:59 André Almeida [this message]
2020-07-09 17:59 ` [RFC v2 1/4] futex2: Add new futex interface André Almeida
2020-07-10 0:09 ` Randy Dunlap
2020-07-10 0:19 ` André Almeida
2020-07-09 17:59 ` [RFC v2 2/4] selftests: futex: Add futex2 wake/wait test André Almeida
2020-07-09 17:59 ` [RFC v2 3/4] selftests: futex: Add futex2 timeout test André Almeida
2020-07-09 17:59 ` [RFC v2 4/4] selftests: futex: Add futex2 wouldblock test André Almeida
2020-07-10 13:23 ` [RFC v2 0/4] futex2: Add new futex interface Oleksandr Natalenko
2020-07-10 13:45 ` André Almeida
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=20200709175921.211387-1-andrealmeid@collabora.com \
--to=andrealmeid@collabora.com \
--cc=arnd@arndb.de \
--cc=dvhart@infradead.org \
--cc=fweimer@redhat.com \
--cc=kernel@collabora.com \
--cc=krisman@collabora.com \
--cc=libc-alpha@sourceware.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=malteskarupke@web.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pgriffais@valvesoftware.com \
--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).