lkml.org 
[lkml]   [2020]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/4] futex: Implement mechanism to wait on any of several futexes
On Thu, Feb 13, 2020 at 06:45:22PM -0300, André Almeida wrote:
> @@ -150,4 +153,21 @@ struct robust_list_head {
> (((op & 0xf) << 28) | ((cmp & 0xf) << 24) \
> | ((oparg & 0xfff) << 12) | (cmparg & 0xfff))
>
> +/*
> + * Maximum number of multiple futexes to wait for
> + */
> +#define FUTEX_MULTIPLE_MAX_COUNT 128
> +
> +/**
> + * struct futex_wait_block - Block of futexes to be waited for
> + * @uaddr: User address of the futex
> + * @val: Futex value expected by userspace
> + * @bitset: Bitset for the optional bitmasked wakeup
> + */
> +struct futex_wait_block {
> + __u32 __user *uaddr;
> + __u32 val;
> + __u32 bitset;
> +};

So I have a problem with this vector layout, it doesn't allow for
per-futex flags, and esp. with that multi-size futex support that
becomes important, but also with the already extand private/shared and
wait_bitset flags this means you cannot have a vector with mixed wait
types.

> #endif /* _UAPI_LINUX_FUTEX_H */
> diff --git a/kernel/futex.c b/kernel/futex.c
> index 0cf84c8664f2..58cf9eb2b851 100644
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -215,6 +215,8 @@ struct futex_pi_state {
> * @rt_waiter: rt_waiter storage for use with requeue_pi
> * @requeue_pi_key: the requeue_pi target futex key
> * @bitset: bitset for the optional bitmasked wakeup
> + * @uaddr: userspace address of futex
> + * @uval: expected futex's value
> *
> * We use this hashed waitqueue, instead of a normal wait_queue_entry_t, so
> * we can wake only the relevant ones (hashed queues may be shared).
> @@ -237,6 +239,8 @@ struct futex_q {
> struct rt_mutex_waiter *rt_waiter;
> union futex_key *requeue_pi_key;
> u32 bitset;
> + u32 __user *uaddr;
> + u32 uval;
> } __randomize_layout;

That creates a hole for no reason.

\
 
 \ /
  Last update: 2020-02-28 20:08    [W:0.130 / U:7.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site