[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58536544-e032-1954-ce30-d131869dc95e@collabora.com>
Date: Tue, 14 Sep 2021 14:18:58 -0300
From: André Almeida <andrealmeid@...labora.com>
To: Gabriel Krisman Bertazi <krisman@...labora.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Darren Hart <dvhart@...radead.org>,
linux-kernel@...r.kernel.org, Steven Rostedt <rostedt@...dmis.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
kernel@...labora.com, linux-api@...r.kernel.org,
libc-alpha@...rceware.org, mtk.manpages@...il.com,
Davidlohr Bueso <dave@...olabs.net>,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH v3 2/6] futex2: Implement vectorized wait
Hi Gabriel, thanks for the feedback! A few clarifications:
Às 22:03 de 13/09/21, Gabriel Krisman Bertazi escreveu:
> André Almeida <andrealmeid@...labora.com> writes:
>
>> Add support to wait on multiple futexes. This is the interface
>> implemented by this syscall:
>>
[...]
>>
>> +/*
>> + * Flags to specify the bit length of the futex word for futex2 syscalls.
>> + * Currently, only 32 is supported.
>> + */
>> +#define FUTEX_32 2
>
> Why start at 2?
I was planning to do:
FUTEX_8 0
FUTEX_16 1
FUTEX_32 2
FUTEX_64 3
>
>> +
>> +/*
>> + * Max numbers of elements in a futex_waitv array
>> + */
>> +#define FUTEX_WAITV_MAX 128
>> +
>> +/**
>> + * struct futex_waitv - A waiter for vectorized wait
>> + * @val: Expected value at uaddr
>> + * @uaddr: User address to wait on
>> + * @flags: Flags for this waiter
>> + * @__reserved: Reserved member to preserve data alignment. Should be 0.
>> + */
>> +struct futex_waitv {
>> + __u64 val;
>> + __u64 uaddr;
>> + __u32 flags;
>> + __u32 __reserved;
>> +};
>
> why force uaddr to be __u64, even for 32-bit? uaddr could be a (void*) for
> all we care, no? Also, by adding a reserved field, you are wasting 32
> bits even on 32-bit architectures.
>
We do that to make the structure layout compatible with both entry
points, remove the need for special cast and duplicated code, as
suggested by Thomas and Arnd:
https://lore.kernel.org/lkml/87v94310gm.ffs@tglx/
https://lore.kernel.org/lkml/CAK8P3a0MO1qJLRkCH8KrZ3+=L66KOsMRmcbrUvYdMoKykdKoyQ@mail.gmail.com/
Powered by blists - more mailing lists