Re: [RFC v2 1/4] futex2: Add new futex interface

From: Andrà Almeida
Date: Thu Jul 09 2020 - 20:20:01 EST


Hello,

On 7/9/20 9:09 PM, Randy Dunlap wrote:
> Hi,
>
> On 7/9/20 10:59 AM, Andrà Almeida wrote:
>>
>>
>> diff --git a/kernel/futex2.c b/kernel/futex2.c
>> new file mode 100644
>> index 000000000000..b87a10ba7c01
>> --- /dev/null
>> +++ b/kernel/futex2.c
>> @@ -0,0 +1,73 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * futex2 system call interface by Andrà Almeida <andrealmeid@xxxxxxxxxxxxx>
>> + *
>> + * Copyright 2020 Collabora Ltd.
>> + */
>> +
>> +#include <linux/syscalls.h>
>> +
>> +#include <asm/futex.h>
>> +
>> +/*
>> + * Set of flags that futex2 operates. If we got something that is not in this
>> + * set, it can be a unsupported futex1 operation like BITSET or PI, so we
>> + * refuse to accept
>> + */
>> +#define FUTEX2_MASK (FUTEX_SIZE_MASK | FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
>> +
>> +/**
>> + * sys_futex_wait: Wait on a futex address if (*uaddr) == val
>
> Function name line should use - as separator, not :, so
> * sys_futex_wait - Wait on a futex address if (*uaddr) == val
>
>> + * @uaddr: User address of futex
>> + * @val: Expected value of futex
>> + * @flags: Checks if futex is private, the size of futex and the clockid
>> + * @timo: Optional absolute timeout. Supports only 64bit time.
>> + */
>> +SYSCALL_DEFINE4(futex_wait, void __user *, uaddr, unsigned long, val,
>> + unsigned long, flags, struct __kernel_timespec __user *, timo)
>> +{
> ...
>> +}
>> +
>> +/**
>> + * sys_futex_wake: Wake a number of futexes waiting in an address
>
> Same here:
> * sys_futex_wake - Wake a number of futexes waiting in an address
>
> or could it be "on an address":
> * sys_futex_wake - Wake a number of futexes waiting on an address
>
>> + * @uaddr: Address of futex to be woken up
>> + * @nr_wake: Number of futexes to be woken up
>> + * @flags: Checks if futex is private and the size of futex
>> + */
>> +SYSCALL_DEFINE3(futex_wake, void __user *, uaddr, unsigned int, nr_wake,
>> + unsigned long, flags)
>> +{
>

Both changes applied for v3, thanks for the feedback.

>
> thanks.
>