[PATCH v5 3/4] um: add a UML specific futex implementation
Richard Weinberger
richard at nod.at
Tue Dec 15 04:46:54 EST 2020
Anton,
----- Ursprüngliche Mail -----
> Von: "anton ivanov" <anton.ivanov at cambridgegreys.com>
> An: "linux-um" <linux-um at lists.infradead.org>
> CC: "richard" <richard at nod.at>
> Gesendet: Dienstag, 15. Dezember 2020 10:43:48
> Betreff: Re: [PATCH v5 3/4] um: add a UML specific futex implementation
> On 14/12/2020 18:14, anton.ivanov at cambridgegreys.com wrote:
>> From: Anton Ivanov <anton.ivanov at cambridgegreys.com>
>>
>> The generic asm futex implementation emulates atomic access to
>> memory by doing a get_user followed by put_user. These translate
>> to two mapping operations on UML with paging enabled in the
>> meantime. This, in turn may end up changing interrupts,
>> invoking the signal loop, etc.
>>
>> This replaces the generic implementation by a mapping followed
>> by an operation on the mapped segment.
>>
>> Signed-off-by: Anton Ivanov <anton.ivanov at cambridgegreys.com>
>> ---
>> arch/um/include/asm/Kbuild | 1 -
>> arch/um/include/asm/futex.h | 14 ++++
>> arch/um/kernel/skas/uaccess.c | 130 ++++++++++++++++++++++++++++++++++
>> 3 files changed, 144 insertions(+), 1 deletion(-)
>> create mode 100644 arch/um/include/asm/futex.h
>>
>> diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
>> index 1c63b260ecc4..873e6815bc50 100644
>> --- a/arch/um/include/asm/Kbuild
>> +++ b/arch/um/include/asm/Kbuild
>> @@ -8,7 +8,6 @@ generic-y += emergency-restart.h
>> generic-y += exec.h
>> generic-y += extable.h
>> generic-y += ftrace.h
>> -generic-y += futex.h
>> generic-y += hw_irq.h
>> generic-y += irq_regs.h
>> generic-y += irq_work.h
>> diff --git a/arch/um/include/asm/futex.h b/arch/um/include/asm/futex.h
>> new file mode 100644
>> index 000000000000..0a01f1f60de0
>> --- /dev/null
>> +++ b/arch/um/include/asm/futex.h
>> @@ -0,0 +1,14 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#ifndef _ASM_GENERIC_FUTEX_H
>> +#define _ASM_GENERIC_FUTEX_H
>
> ^^^^ Uggghhh
>
>> +
>> +#include <linux/futex.h>
>> +#include <linux/uaccess.h>
>> +#include <asm/errno.h>
>> +
>> +
>> +extern int arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user
>> *uaddr);
>> +extern int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
>> + u32 oldval, u32 newval);
> ^^^^ Did not address Johannes comments, will do in v6
No need to hurry. This has to wait anyway for 5.12. :-)
Thanks,
//richard
More information about the linux-um
mailing list